diff options
Diffstat (limited to 'fs/xfs/xfs_attr.h')
-rw-r--r-- | fs/xfs/xfs_attr.h | 90 |
1 files changed, 30 insertions, 60 deletions
diff --git a/fs/xfs/xfs_attr.h b/fs/xfs/xfs_attr.h index 6cfc9384fe35..8b2d31c19e4d 100644 --- a/fs/xfs/xfs_attr.h +++ b/fs/xfs/xfs_attr.h | |||
@@ -18,9 +18,11 @@ | |||
18 | #ifndef __XFS_ATTR_H__ | 18 | #ifndef __XFS_ATTR_H__ |
19 | #define __XFS_ATTR_H__ | 19 | #define __XFS_ATTR_H__ |
20 | 20 | ||
21 | struct xfs_inode; | ||
22 | struct xfs_da_args; | ||
23 | struct xfs_attr_list_context; | ||
24 | |||
21 | /* | 25 | /* |
22 | * xfs_attr.h | ||
23 | * | ||
24 | * Large attribute lists are structured around Btrees where all the data | 26 | * Large attribute lists are structured around Btrees where all the data |
25 | * elements are in the leaf nodes. Attribute names are hashed into an int, | 27 | * elements are in the leaf nodes. Attribute names are hashed into an int, |
26 | * then that int is used as the index into the Btree. Since the hashval | 28 | * then that int is used as the index into the Btree. Since the hashval |
@@ -35,35 +37,6 @@ | |||
35 | * External interfaces | 37 | * External interfaces |
36 | *========================================================================*/ | 38 | *========================================================================*/ |
37 | 39 | ||
38 | struct cred; | ||
39 | struct xfs_attr_list_context; | ||
40 | |||
41 | typedef int (*attrset_t)(bhv_vnode_t *, char *, void *, size_t, int); | ||
42 | typedef int (*attrget_t)(bhv_vnode_t *, char *, void *, size_t, int); | ||
43 | typedef int (*attrremove_t)(bhv_vnode_t *, char *, int); | ||
44 | typedef int (*attrexists_t)(bhv_vnode_t *); | ||
45 | typedef int (*attrcapable_t)(bhv_vnode_t *, struct cred *); | ||
46 | |||
47 | typedef struct attrnames { | ||
48 | char * attr_name; | ||
49 | unsigned int attr_namelen; | ||
50 | unsigned int attr_flag; | ||
51 | attrget_t attr_get; | ||
52 | attrset_t attr_set; | ||
53 | attrremove_t attr_remove; | ||
54 | attrexists_t attr_exists; | ||
55 | attrcapable_t attr_capable; | ||
56 | } attrnames_t; | ||
57 | |||
58 | #define ATTR_NAMECOUNT 4 | ||
59 | extern struct attrnames attr_user; | ||
60 | extern struct attrnames attr_secure; | ||
61 | extern struct attrnames attr_system; | ||
62 | extern struct attrnames attr_trusted; | ||
63 | extern struct attrnames *attr_namespaces[ATTR_NAMECOUNT]; | ||
64 | |||
65 | extern attrnames_t *attr_lookup_namespace(char *, attrnames_t **, int); | ||
66 | extern int attr_generic_list(bhv_vnode_t *, void *, size_t, int, ssize_t *); | ||
67 | 40 | ||
68 | #define ATTR_DONTFOLLOW 0x0001 /* -- unused, from IRIX -- */ | 41 | #define ATTR_DONTFOLLOW 0x0001 /* -- unused, from IRIX -- */ |
69 | #define ATTR_ROOT 0x0002 /* use attrs in root (trusted) namespace */ | 42 | #define ATTR_ROOT 0x0002 /* use attrs in root (trusted) namespace */ |
@@ -71,16 +44,9 @@ extern int attr_generic_list(bhv_vnode_t *, void *, size_t, int, ssize_t *); | |||
71 | #define ATTR_SECURE 0x0008 /* use attrs in security namespace */ | 44 | #define ATTR_SECURE 0x0008 /* use attrs in security namespace */ |
72 | #define ATTR_CREATE 0x0010 /* pure create: fail if attr already exists */ | 45 | #define ATTR_CREATE 0x0010 /* pure create: fail if attr already exists */ |
73 | #define ATTR_REPLACE 0x0020 /* pure set: fail if attr does not exist */ | 46 | #define ATTR_REPLACE 0x0020 /* pure set: fail if attr does not exist */ |
74 | #define ATTR_SYSTEM 0x0100 /* use attrs in system (pseudo) namespace */ | ||
75 | 47 | ||
76 | #define ATTR_KERNACCESS 0x0400 /* [kernel] iaccess, inode held io-locked */ | ||
77 | #define ATTR_KERNOTIME 0x1000 /* [kernel] don't update inode timestamps */ | 48 | #define ATTR_KERNOTIME 0x1000 /* [kernel] don't update inode timestamps */ |
78 | #define ATTR_KERNOVAL 0x2000 /* [kernel] get attr size only, not value */ | 49 | #define ATTR_KERNOVAL 0x2000 /* [kernel] get attr size only, not value */ |
79 | #define ATTR_KERNAMELS 0x4000 /* [kernel] list attr names (simple list) */ | ||
80 | |||
81 | #define ATTR_KERNORMALS 0x0800 /* [kernel] normal attr list: user+secure */ | ||
82 | #define ATTR_KERNROOTLS 0x8000 /* [kernel] include root in the attr list */ | ||
83 | #define ATTR_KERNFULLS (ATTR_KERNORMALS|ATTR_KERNROOTLS) | ||
84 | 50 | ||
85 | /* | 51 | /* |
86 | * The maximum size (into the kernel or returned from the kernel) of an | 52 | * The maximum size (into the kernel or returned from the kernel) of an |
@@ -119,22 +85,6 @@ typedef struct attrlist_ent { /* data from attr_list() */ | |||
119 | &((char *)buffer)[ ((attrlist_t *)(buffer))->al_offset[index] ]) | 85 | &((char *)buffer)[ ((attrlist_t *)(buffer))->al_offset[index] ]) |
120 | 86 | ||
121 | /* | 87 | /* |
122 | * Multi-attribute operation vector. | ||
123 | */ | ||
124 | typedef struct attr_multiop { | ||
125 | int am_opcode; /* operation to perform (ATTR_OP_GET, etc.) */ | ||
126 | int am_error; /* [out arg] result of this sub-op (an errno) */ | ||
127 | char *am_attrname; /* attribute name to work with */ | ||
128 | char *am_attrvalue; /* [in/out arg] attribute value (raw bytes) */ | ||
129 | int am_length; /* [in/out arg] length of value */ | ||
130 | int am_flags; /* bitwise OR of attr API flags defined above */ | ||
131 | } attr_multiop_t; | ||
132 | |||
133 | #define ATTR_OP_GET 1 /* return the indicated attr's value */ | ||
134 | #define ATTR_OP_SET 2 /* set/create the indicated attr/value pair */ | ||
135 | #define ATTR_OP_REMOVE 3 /* remove the indicated attr */ | ||
136 | |||
137 | /* | ||
138 | * Kernel-internal version of the attrlist cursor. | 88 | * Kernel-internal version of the attrlist cursor. |
139 | */ | 89 | */ |
140 | typedef struct attrlist_cursor_kern { | 90 | typedef struct attrlist_cursor_kern { |
@@ -148,20 +98,40 @@ typedef struct attrlist_cursor_kern { | |||
148 | 98 | ||
149 | 99 | ||
150 | /*======================================================================== | 100 | /*======================================================================== |
151 | * Function prototypes for the kernel. | 101 | * Structure used to pass context around among the routines. |
152 | *========================================================================*/ | 102 | *========================================================================*/ |
153 | 103 | ||
154 | struct xfs_inode; | 104 | |
155 | struct attrlist_cursor_kern; | 105 | typedef int (*put_listent_func_t)(struct xfs_attr_list_context *, int, |
156 | struct xfs_da_args; | 106 | char *, int, int, char *); |
107 | |||
108 | typedef struct xfs_attr_list_context { | ||
109 | struct xfs_inode *dp; /* inode */ | ||
110 | struct attrlist_cursor_kern *cursor; /* position in list */ | ||
111 | char *alist; /* output buffer */ | ||
112 | int seen_enough; /* T/F: seen enough of list? */ | ||
113 | ssize_t count; /* num used entries */ | ||
114 | int dupcnt; /* count dup hashvals seen */ | ||
115 | int bufsize; /* total buffer size */ | ||
116 | int firstu; /* first used byte in buffer */ | ||
117 | int flags; /* from VOP call */ | ||
118 | int resynch; /* T/F: resynch with cursor */ | ||
119 | int put_value; /* T/F: need value for listent */ | ||
120 | put_listent_func_t put_listent; /* list output fmt function */ | ||
121 | int index; /* index into output buffer */ | ||
122 | } xfs_attr_list_context_t; | ||
123 | |||
124 | |||
125 | /*======================================================================== | ||
126 | * Function prototypes for the kernel. | ||
127 | *========================================================================*/ | ||
157 | 128 | ||
158 | /* | 129 | /* |
159 | * Overall external interface routines. | 130 | * Overall external interface routines. |
160 | */ | 131 | */ |
161 | int xfs_attr_inactive(struct xfs_inode *dp); | 132 | int xfs_attr_inactive(struct xfs_inode *dp); |
162 | |||
163 | int xfs_attr_shortform_getvalue(struct xfs_da_args *); | ||
164 | int xfs_attr_fetch(struct xfs_inode *, struct xfs_name *, char *, int *, int); | 133 | int xfs_attr_fetch(struct xfs_inode *, struct xfs_name *, char *, int *, int); |
165 | int xfs_attr_rmtval_get(struct xfs_da_args *args); | 134 | int xfs_attr_rmtval_get(struct xfs_da_args *args); |
135 | int xfs_attr_list_int(struct xfs_attr_list_context *); | ||
166 | 136 | ||
167 | #endif /* __XFS_ATTR_H__ */ | 137 | #endif /* __XFS_ATTR_H__ */ |