xref: /openbmc/qemu/hw/9pfs/9p-xattr.h (revision 9cbb6362)
1 /*
2  * 9p
3  *
4  * Copyright IBM, Corp. 2010
5  *
6  * Authors:
7  *  Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
8  *
9  * This work is licensed under the terms of the GNU GPL, version 2.  See
10  * the COPYING file in the top-level directory.
11  *
12  */
13 
14 #ifndef QEMU_9P_XATTR_H
15 #define QEMU_9P_XATTR_H
16 
17 #include "qemu/xattr.h"
18 
19 struct XattrOperations {
20     const char *name;
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);
29 };
30 
31 ssize_t local_getxattr_nofollow(FsContext *ctx, const char *path,
32                                 const char *name, void *value, size_t size);
33 ssize_t local_setxattr_nofollow(FsContext *ctx, const char *path,
34                                 const char *name, void *value, size_t size,
35                                 int flags);
36 ssize_t local_removexattr_nofollow(FsContext *ctx, const char *path,
37                                    const char *name);
38 
39 extern XattrOperations mapped_user_xattr;
40 extern XattrOperations passthrough_user_xattr;
41 
42 extern XattrOperations mapped_pacl_xattr;
43 extern XattrOperations mapped_dacl_xattr;
44 extern XattrOperations passthrough_acl_xattr;
45 extern XattrOperations none_acl_xattr;
46 
47 extern XattrOperations *mapped_xattr_ops[];
48 extern XattrOperations *passthrough_xattr_ops[];
49 extern XattrOperations *none_xattr_ops[];
50 
51 ssize_t v9fs_get_xattr(FsContext *ctx, const char *path, const char *name,
52                        void *value, size_t size);
53 ssize_t v9fs_list_xattr(FsContext *ctx, const char *path, void *value,
54                         size_t vsize);
55 int v9fs_set_xattr(FsContext *ctx, const char *path, const char *name,
56                           void *value, size_t size, int flags);
57 int v9fs_remove_xattr(FsContext *ctx, const char *path, const char *name);
58 
59 ssize_t pt_listxattr(FsContext *ctx, const char *path, char *name, void *value,
60                      size_t size);
61 ssize_t pt_getxattr(FsContext *ctx, const char *path, const char *name,
62                     void *value, size_t size);
63 int pt_setxattr(FsContext *ctx, const char *path, const char *name, void *value,
64                 size_t size, int flags);
65 int pt_removexattr(FsContext *ctx, const char *path, const char *name);
66 
67 ssize_t notsup_getxattr(FsContext *ctx, const char *path, const char *name,
68                         void *value, size_t size);
69 int notsup_setxattr(FsContext *ctx, const char *path, const char *name,
70                     void *value, size_t size, int flags);
71 ssize_t notsup_listxattr(FsContext *ctx, const char *path, char *name,
72                          void *value, size_t size);
73 int notsup_removexattr(FsContext *ctx, const char *path, const char *name);
74 
75 #endif
76