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.
13 #ifndef _QEMU_VIRTIO_9P_XATTR_H
14 #define _QEMU_VIRTIO_9P_XATTR_H
16 #include "qemu/xattr.h"
18 typedef struct xattr_operations
21 ssize_t (*getxattr
)(FsContext
*ctx
, const char *path
,
22 const char *name
, void *value
, size_t size
);
23 ssize_t (*listxattr
)(FsContext
*ctx
, const char *path
,
24 char *name
, void *value
, size_t size
);
25 int (*setxattr
)(FsContext
*ctx
, const char *path
, const char *name
,
26 void *value
, size_t size
, int flags
);
27 int (*removexattr
)(FsContext
*ctx
,
28 const char *path
, const char *name
);
32 extern XattrOperations mapped_user_xattr
;
33 extern XattrOperations passthrough_user_xattr
;
35 extern XattrOperations mapped_pacl_xattr
;
36 extern XattrOperations mapped_dacl_xattr
;
37 extern XattrOperations passthrough_acl_xattr
;
38 extern XattrOperations none_acl_xattr
;
40 extern XattrOperations
*mapped_xattr_ops
[];
41 extern XattrOperations
*passthrough_xattr_ops
[];
42 extern XattrOperations
*none_xattr_ops
[];
44 ssize_t
v9fs_get_xattr(FsContext
*ctx
, const char *path
, const char *name
,
45 void *value
, size_t size
);
46 ssize_t
v9fs_list_xattr(FsContext
*ctx
, const char *path
, void *value
,
48 int v9fs_set_xattr(FsContext
*ctx
, const char *path
, const char *name
,
49 void *value
, size_t size
, int flags
);
50 int v9fs_remove_xattr(FsContext
*ctx
, const char *path
, const char *name
);
51 ssize_t
pt_listxattr(FsContext
*ctx
, const char *path
, char *name
, void *value
,
54 static inline ssize_t
pt_getxattr(FsContext
*ctx
, const char *path
,
55 const char *name
, void *value
, size_t size
)
60 buffer
= rpath(ctx
, path
);
61 ret
= lgetxattr(buffer
, name
, value
, size
);
66 static inline int pt_setxattr(FsContext
*ctx
, const char *path
,
67 const char *name
, void *value
,
68 size_t size
, int flags
)
73 buffer
= rpath(ctx
, path
);
74 ret
= lsetxattr(buffer
, name
, value
, size
, flags
);
79 static inline int pt_removexattr(FsContext
*ctx
,
80 const char *path
, const char *name
)
85 buffer
= rpath(ctx
, path
);
86 ret
= lremovexattr(path
, name
);
91 static inline ssize_t
notsup_getxattr(FsContext
*ctx
, const char *path
,
92 const char *name
, void *value
,
99 static inline int notsup_setxattr(FsContext
*ctx
, const char *path
,
100 const char *name
, void *value
,
101 size_t size
, int flags
)
107 static inline ssize_t
notsup_listxattr(FsContext
*ctx
, const char *path
,
108 char *name
, void *value
, size_t size
)
113 static inline int notsup_removexattr(FsContext
*ctx
,
114 const char *path
, const char *name
)