setfacl.h revision 201016
1222417Sjulian/*-
2222417Sjulian * Copyright (c) 2001 Chris D. Faulhaber
3222417Sjulian * All rights reserved.
4222417Sjulian *
5222417Sjulian * Redistribution and use in source and binary forms, with or without
6222417Sjulian * modification, are permitted provided that the following conditions
7222417Sjulian * are met:
8222417Sjulian * 1. Redistributions of source code must retain the above copyright
9222417Sjulian *    notice, this list of conditions and the following disclaimer.
10222417Sjulian * 2. Redistributions in binary form must reproduce the above copyright
11222417Sjulian *    notice, this list of conditions and the following disclaimer in the
12222417Sjulian *    documentation and/or other materials provided with the distribution.
13222417Sjulian *
14222417Sjulian * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15222417Sjulian * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16222417Sjulian * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17222417Sjulian * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD BE
18222417Sjulian * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19222417Sjulian * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20222417Sjulian * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21222417Sjulian * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22222417Sjulian * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23222417Sjulian * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24222417Sjulian * POSSIBILITY OF SUCH DAMAGE.
25222417Sjulian *
26222417Sjulian * $FreeBSD: head/bin/setfacl/setfacl.h 201016 2009-12-26 10:06:45Z trasz $
27222417Sjulian */
28222417Sjulian
29222417Sjulian#ifndef _SETFACL_H
30222417Sjulian#define _SETFACL_H
31222417Sjulian
32235873Swblock#include <sys/types.h>
33222417Sjulian#include <sys/acl.h>
34222417Sjulian#include <sys/queue.h>
35222417Sjulian
36222417Sjulian/* file operations */
37222417Sjulian#define	OP_MERGE_ACL		0x00	/* merge acl's (-mM) */
38222417Sjulian#define	OP_REMOVE_DEF		0x01	/* remove default acl's (-k) */
39222417Sjulian#define	OP_REMOVE_EXT		0x02	/* remove extended acl's (-b) */
40222417Sjulian#define	OP_REMOVE_ACL		0x03	/* remove acl's (-xX) */
41222417Sjulian#define OP_REMOVE_BY_NUMBER	0x04	/* remove acl's (-xX) by acl entry number */
42222417Sjulian#define OP_ADD_ACL		0x05	/* add acls entries at a given position */
43222417Sjulian
44222417Sjulian/* TAILQ entry for acl operations */
45222417Sjulianstruct sf_entry {
46222417Sjulian	uint	op;
47222417Sjulian	acl_t	acl;
48222417Sjulian	uint	entry_number;
49222417Sjulian	TAILQ_ENTRY(sf_entry) next;
50222417Sjulian};
51222417SjulianTAILQ_HEAD(, sf_entry) entrylist;
52222417Sjulian
53222417Sjulian/* TAILQ entry for files */
54222417Sjulianstruct sf_file {
55222417Sjulian	const char *filename;
56222417Sjulian	TAILQ_ENTRY(sf_file) next;
57222417Sjulian};
58222417SjulianTAILQ_HEAD(, sf_file) filelist;
59222417Sjulian
60222417Sjulian/* files.c */
61222417Sjulianacl_t  get_acl_from_file(const char *filename);
62222417Sjulian/* merge.c */
63222417Sjulianint    merge_acl(acl_t acl, acl_t *prev_acl, const char *filename);
64222417Sjulianint    add_acl(acl_t acl, uint entry_number, acl_t *prev_acl, const char *filename);
65222417Sjulian/* remove.c */
66222417Sjulianint    remove_acl(acl_t acl, acl_t *prev_acl, const char *filename);
67222417Sjulianint    remove_by_number(uint entry_number, acl_t *prev_acl, const char *filename);
68222417Sjulianint    remove_default(acl_t *prev_acl, const char *filename);
69222417Sjulianvoid   remove_ext(acl_t *prev_acl, const char *filename);
70222417Sjulian/* mask.c */
71222417Sjulianint    set_acl_mask(acl_t *prev_acl, const char *filename);
72222417Sjulian/* util.c */
73222417Sjulianvoid  *zmalloc(size_t size);
74222417Sjulianconst char *brand_name(int brand);
75222417Sjulianint    branding_mismatch(int brand1, int brand2);
76222417Sjulian
77222417Sjulianuint       have_mask;
78222417Sjulianuint       need_mask;
79222417Sjulianuint       have_stdin;
80222417Sjulianuint       n_flag;
81222417Sjulian
82222417Sjulian#endif /* _SETFACL_H */
83222417Sjulian