29 #include <linux/xattr.h>
36 struct xfs_inode *
ip = XFS_I(dentry->
d_inode);
48 error = -
xfs_attr_get(ip, (
unsigned char *)name, value, &asize, xflags);
55 xfs_xattr_set(
struct dentry *dentry,
const char *name,
const void *value,
56 size_t size,
int flags,
int xflags)
58 struct xfs_inode *ip = XFS_I(dentry->
d_inode);
72 (
void *)value, size, xflags);
82 static const struct xattr_handler xfs_xattr_trusted_handler = {
89 static const struct xattr_handler xfs_xattr_security_handler = {
97 &xfs_xattr_user_handler,
98 &xfs_xattr_trusted_handler,
99 &xfs_xattr_security_handler,
100 #ifdef CONFIG_XFS_POSIX_ACL
107 static unsigned int xfs_xattr_prefix_len(
int flags)
110 return sizeof(
"security");
112 return sizeof(
"trusted");
114 return sizeof(
"user");
117 static const char *xfs_xattr_prefix(
int flags)
119 if (flags & XFS_ATTR_SECURE)
120 return xfs_xattr_security_handler.
prefix;
122 return xfs_xattr_trusted_handler.
prefix;
124 return xfs_xattr_user_handler.
prefix;
128 xfs_xattr_put_listent(
134 unsigned char *value)
136 unsigned int prefix_len = xfs_xattr_prefix_len(flags);
149 arraytop = context->
count + prefix_len + namelen + 1;
150 if (arraytop > context->
firstu) {
154 offset = (
char *)context->
alist + context->
count;
155 strncpy(offset, xfs_xattr_prefix(flags), prefix_len);
156 offset += prefix_len;
157 strncpy(offset, (
char *)name, namelen);
160 context->
count += prefix_len + namelen + 1;
165 xfs_xattr_put_listent_sizes(
171 unsigned char *value)
173 context->
count += xfs_xattr_prefix_len(flags) + namelen + 1;
178 list_one_attr(
const char *name,
const size_t len,
void *
data,
204 memset(&context, 0,
sizeof(context));
205 context.
dp = XFS_I(inode);
218 if (context.
count < 0)
227 data, size, &context.
count);
235 data, size, &context.
count);
240 return context.
count;