root / hw / virtio-9p-xattr.h @ 258dc7c9
History | View | Annotate | Download (3.3 kB)
1 | fc22118d | Aneesh Kumar K.V | /*
|
---|---|---|---|
2 | fc22118d | Aneesh Kumar K.V | * Virtio 9p
|
3 | fc22118d | Aneesh Kumar K.V | *
|
4 | fc22118d | Aneesh Kumar K.V | * Copyright IBM, Corp. 2010
|
5 | fc22118d | Aneesh Kumar K.V | *
|
6 | fc22118d | Aneesh Kumar K.V | * Authors:
|
7 | fc22118d | Aneesh Kumar K.V | * Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
|
8 | fc22118d | Aneesh Kumar K.V | *
|
9 | fc22118d | Aneesh Kumar K.V | * This work is licensed under the terms of the GNU GPL, version 2. See
|
10 | fc22118d | Aneesh Kumar K.V | * the COPYING file in the top-level directory.
|
11 | fc22118d | Aneesh Kumar K.V | *
|
12 | fc22118d | Aneesh Kumar K.V | */
|
13 | fc22118d | Aneesh Kumar K.V | #ifndef _QEMU_VIRTIO_9P_XATTR_H
|
14 | fc22118d | Aneesh Kumar K.V | #define _QEMU_VIRTIO_9P_XATTR_H
|
15 | fc22118d | Aneesh Kumar K.V | |
16 | fc22118d | Aneesh Kumar K.V | #include <attr/xattr.h> |
17 | fc22118d | Aneesh Kumar K.V | |
18 | fc22118d | Aneesh Kumar K.V | typedef struct xattr_operations |
19 | fc22118d | Aneesh Kumar K.V | { |
20 | fc22118d | Aneesh Kumar K.V | const char *name; |
21 | fc22118d | Aneesh Kumar K.V | ssize_t (*getxattr)(FsContext *ctx, const char *path, |
22 | fc22118d | Aneesh Kumar K.V | const char *name, void *value, size_t size); |
23 | fc22118d | Aneesh Kumar K.V | ssize_t (*listxattr)(FsContext *ctx, const char *path, |
24 | fc22118d | Aneesh Kumar K.V | char *name, void *value, size_t size); |
25 | fc22118d | Aneesh Kumar K.V | int (*setxattr)(FsContext *ctx, const char *path, const char *name, |
26 | fc22118d | Aneesh Kumar K.V | void *value, size_t size, int flags); |
27 | fc22118d | Aneesh Kumar K.V | int (*removexattr)(FsContext *ctx,
|
28 | fc22118d | Aneesh Kumar K.V | const char *path, const char *name); |
29 | fc22118d | Aneesh Kumar K.V | } XattrOperations; |
30 | fc22118d | Aneesh Kumar K.V | |
31 | fc22118d | Aneesh Kumar K.V | |
32 | fc22118d | Aneesh Kumar K.V | extern XattrOperations mapped_user_xattr;
|
33 | fc22118d | Aneesh Kumar K.V | extern XattrOperations passthrough_user_xattr;
|
34 | fc22118d | Aneesh Kumar K.V | |
35 | 70fc55eb | Aneesh Kumar K.V | extern XattrOperations mapped_pacl_xattr;
|
36 | 70fc55eb | Aneesh Kumar K.V | extern XattrOperations mapped_dacl_xattr;
|
37 | 70fc55eb | Aneesh Kumar K.V | extern XattrOperations passthrough_acl_xattr;
|
38 | 70fc55eb | Aneesh Kumar K.V | extern XattrOperations none_acl_xattr;
|
39 | 70fc55eb | Aneesh Kumar K.V | |
40 | fc22118d | Aneesh Kumar K.V | extern XattrOperations *mapped_xattr_ops[];
|
41 | fc22118d | Aneesh Kumar K.V | extern XattrOperations *passthrough_xattr_ops[];
|
42 | fc22118d | Aneesh Kumar K.V | extern XattrOperations *none_xattr_ops[];
|
43 | fc22118d | Aneesh Kumar K.V | |
44 | fc22118d | Aneesh Kumar K.V | extern ssize_t v9fs_get_xattr(FsContext *ctx, const char *path, |
45 | fc22118d | Aneesh Kumar K.V | const char *name, void *value, size_t size); |
46 | fc22118d | Aneesh Kumar K.V | extern ssize_t v9fs_list_xattr(FsContext *ctx, const char *path, |
47 | fc22118d | Aneesh Kumar K.V | void *value, size_t vsize);
|
48 | fc22118d | Aneesh Kumar K.V | extern int v9fs_set_xattr(FsContext *ctx, const char *path, const char *name, |
49 | fc22118d | Aneesh Kumar K.V | void *value, size_t size, int flags); |
50 | fc22118d | Aneesh Kumar K.V | extern int v9fs_remove_xattr(FsContext *ctx, |
51 | fc22118d | Aneesh Kumar K.V | const char *path, const char *name); |
52 | fc22118d | Aneesh Kumar K.V | extern ssize_t pt_listxattr(FsContext *ctx, const char *path, |
53 | fc22118d | Aneesh Kumar K.V | char *name, void *value, size_t size); |
54 | fc22118d | Aneesh Kumar K.V | |
55 | fc22118d | Aneesh Kumar K.V | static inline ssize_t pt_getxattr(FsContext *ctx, const char *path, |
56 | fc22118d | Aneesh Kumar K.V | const char *name, void *value, size_t size) |
57 | fc22118d | Aneesh Kumar K.V | { |
58 | fc22118d | Aneesh Kumar K.V | return lgetxattr(rpath(ctx, path), name, value, size);
|
59 | fc22118d | Aneesh Kumar K.V | } |
60 | fc22118d | Aneesh Kumar K.V | |
61 | fc22118d | Aneesh Kumar K.V | static inline int pt_setxattr(FsContext *ctx, const char *path, |
62 | fc22118d | Aneesh Kumar K.V | const char *name, void *value, |
63 | fc22118d | Aneesh Kumar K.V | size_t size, int flags)
|
64 | fc22118d | Aneesh Kumar K.V | { |
65 | fc22118d | Aneesh Kumar K.V | return lsetxattr(rpath(ctx, path), name, value, size, flags);
|
66 | fc22118d | Aneesh Kumar K.V | } |
67 | fc22118d | Aneesh Kumar K.V | |
68 | fc22118d | Aneesh Kumar K.V | static inline int pt_removexattr(FsContext *ctx, |
69 | fc22118d | Aneesh Kumar K.V | const char *path, const char *name) |
70 | fc22118d | Aneesh Kumar K.V | { |
71 | fc22118d | Aneesh Kumar K.V | return lremovexattr(rpath(ctx, path), name);
|
72 | fc22118d | Aneesh Kumar K.V | } |
73 | fc22118d | Aneesh Kumar K.V | |
74 | 70fc55eb | Aneesh Kumar K.V | static inline ssize_t notsup_getxattr(FsContext *ctx, const char *path, |
75 | 70fc55eb | Aneesh Kumar K.V | const char *name, void *value, |
76 | 70fc55eb | Aneesh Kumar K.V | size_t size) |
77 | 70fc55eb | Aneesh Kumar K.V | { |
78 | 70fc55eb | Aneesh Kumar K.V | errno = ENOTSUP; |
79 | 70fc55eb | Aneesh Kumar K.V | return -1; |
80 | 70fc55eb | Aneesh Kumar K.V | } |
81 | 70fc55eb | Aneesh Kumar K.V | |
82 | 70fc55eb | Aneesh Kumar K.V | static inline int notsup_setxattr(FsContext *ctx, const char *path, |
83 | 70fc55eb | Aneesh Kumar K.V | const char *name, void *value, |
84 | 70fc55eb | Aneesh Kumar K.V | size_t size, int flags)
|
85 | 70fc55eb | Aneesh Kumar K.V | { |
86 | 70fc55eb | Aneesh Kumar K.V | errno = ENOTSUP; |
87 | 70fc55eb | Aneesh Kumar K.V | return -1; |
88 | 70fc55eb | Aneesh Kumar K.V | } |
89 | 70fc55eb | Aneesh Kumar K.V | |
90 | 70fc55eb | Aneesh Kumar K.V | static inline ssize_t notsup_listxattr(FsContext *ctx, const char *path, |
91 | 70fc55eb | Aneesh Kumar K.V | char *name, void *value, size_t size) |
92 | 70fc55eb | Aneesh Kumar K.V | { |
93 | 70fc55eb | Aneesh Kumar K.V | return 0; |
94 | 70fc55eb | Aneesh Kumar K.V | } |
95 | 70fc55eb | Aneesh Kumar K.V | |
96 | 70fc55eb | Aneesh Kumar K.V | static inline int notsup_removexattr(FsContext *ctx, |
97 | 70fc55eb | Aneesh Kumar K.V | const char *path, const char *name) |
98 | 70fc55eb | Aneesh Kumar K.V | { |
99 | 70fc55eb | Aneesh Kumar K.V | errno = ENOTSUP; |
100 | 70fc55eb | Aneesh Kumar K.V | return -1; |
101 | 70fc55eb | Aneesh Kumar K.V | } |
102 | 70fc55eb | Aneesh Kumar K.V | |
103 | fc22118d | Aneesh Kumar K.V | #endif |