4 * Copyright IBM, Corp. 2010
7 * Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
9 * This work is licensed under the terms of the GNU GPL, version 2. See
10 * the COPYING file in the top-level directory.
14 #ifndef QEMU_9P_XATTR_H
15 #define QEMU_9P_XATTR_H
17 #include "qemu/xattr.h"
19 typedef struct xattr_operations
22 ssize_t (*getxattr
)(FsContext
*ctx
, const char *path
,
23 const char *name
, void *value
, size_t size
);
24 ssize_t (*listxattr
)(FsContext
*ctx
, const char *path
,
25 char *name
, void *value
, size_t size
);
26 int (*setxattr
)(FsContext
*ctx
, const char *path
, const char *name
,
27 void *value
, size_t size
, int flags
);
28 int (*removexattr
)(FsContext
*ctx
,
29 const char *path
, const char *name
);
33 extern XattrOperations mapped_user_xattr
;
34 extern XattrOperations passthrough_user_xattr
;
36 extern XattrOperations mapped_pacl_xattr
;
37 extern XattrOperations mapped_dacl_xattr
;
38 extern XattrOperations passthrough_acl_xattr
;
39 extern XattrOperations none_acl_xattr
;
41 extern XattrOperations
*mapped_xattr_ops
[];
42 extern XattrOperations
*passthrough_xattr_ops
[];
43 extern XattrOperations
*none_xattr_ops
[];
45 ssize_t
v9fs_get_xattr(FsContext
*ctx
, const char *path
, const char *name
,
46 void *value
, size_t size
);
47 ssize_t
v9fs_list_xattr(FsContext
*ctx
, const char *path
, void *value
,
49 int v9fs_set_xattr(FsContext
*ctx
, const char *path
, const char *name
,
50 void *value
, size_t size
, int flags
);
51 int v9fs_remove_xattr(FsContext
*ctx
, const char *path
, const char *name
);
52 ssize_t
pt_listxattr(FsContext
*ctx
, const char *path
, char *name
, void *value
,
55 static inline ssize_t
pt_getxattr(FsContext
*ctx
, const char *path
,
56 const char *name
, void *value
, size_t size
)
61 buffer
= rpath(ctx
, path
);
62 ret
= lgetxattr(buffer
, name
, value
, size
);
67 static inline int pt_setxattr(FsContext
*ctx
, const char *path
,
68 const char *name
, void *value
,
69 size_t size
, int flags
)
74 buffer
= rpath(ctx
, path
);
75 ret
= lsetxattr(buffer
, name
, value
, size
, flags
);
80 static inline int pt_removexattr(FsContext
*ctx
,
81 const char *path
, const char *name
)
86 buffer
= rpath(ctx
, path
);
87 ret
= lremovexattr(path
, name
);
92 static inline ssize_t
notsup_getxattr(FsContext
*ctx
, const char *path
,
93 const char *name
, void *value
,
100 static inline int notsup_setxattr(FsContext
*ctx
, const char *path
,
101 const char *name
, void *value
,
102 size_t size
, int flags
)
108 static inline ssize_t
notsup_listxattr(FsContext
*ctx
, const char *path
,
109 char *name
, void *value
, size_t size
)
114 static inline int notsup_removexattr(FsContext
*ctx
,
115 const char *path
, const char *name
)