]> Git Repo - qemu.git/blame - hw/9pfs/virtio-9p-xattr.h
virtio-serial: fix ANY_LAYOUT
[qemu.git] / hw / 9pfs / virtio-9p-xattr.h
CommitLineData
fc22118d
AK
1/*
2 * Virtio 9p
3 *
4 * Copyright IBM, Corp. 2010
5 *
6 * Authors:
7 * Aneesh Kumar K.V <[email protected]>
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#ifndef _QEMU_VIRTIO_9P_XATTR_H
14#define _QEMU_VIRTIO_9P_XATTR_H
15
1de7afc9 16#include "qemu/xattr.h"
fc22118d
AK
17
18typedef struct xattr_operations
19{
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} XattrOperations;
30
31
32extern XattrOperations mapped_user_xattr;
33extern XattrOperations passthrough_user_xattr;
34
70fc55eb
AK
35extern XattrOperations mapped_pacl_xattr;
36extern XattrOperations mapped_dacl_xattr;
37extern XattrOperations passthrough_acl_xattr;
38extern XattrOperations none_acl_xattr;
39
fc22118d
AK
40extern XattrOperations *mapped_xattr_ops[];
41extern XattrOperations *passthrough_xattr_ops[];
42extern XattrOperations *none_xattr_ops[];
43
64b85a8f
BS
44ssize_t v9fs_get_xattr(FsContext *ctx, const char *path, const char *name,
45 void *value, size_t size);
46ssize_t v9fs_list_xattr(FsContext *ctx, const char *path, void *value,
47 size_t vsize);
48int v9fs_set_xattr(FsContext *ctx, const char *path, const char *name,
fc22118d 49 void *value, size_t size, int flags);
64b85a8f
BS
50int v9fs_remove_xattr(FsContext *ctx, const char *path, const char *name);
51ssize_t pt_listxattr(FsContext *ctx, const char *path, char *name, void *value,
52 size_t size);
fc22118d
AK
53
54static inline ssize_t pt_getxattr(FsContext *ctx, const char *path,
55 const char *name, void *value, size_t size)
56{
4fa4ce71
CG
57 char *buffer;
58 ssize_t ret;
59
60 buffer = rpath(ctx, path);
61 ret = lgetxattr(buffer, name, value, size);
62 g_free(buffer);
63 return ret;
fc22118d
AK
64}
65
66static inline int pt_setxattr(FsContext *ctx, const char *path,
67 const char *name, void *value,
68 size_t size, int flags)
69{
4fa4ce71
CG
70 char *buffer;
71 int ret;
72
73 buffer = rpath(ctx, path);
74 ret = lsetxattr(buffer, name, value, size, flags);
75 g_free(buffer);
76 return ret;
fc22118d
AK
77}
78
79static inline int pt_removexattr(FsContext *ctx,
80 const char *path, const char *name)
81{
4fa4ce71
CG
82 char *buffer;
83 int ret;
84
85 buffer = rpath(ctx, path);
86 ret = lremovexattr(path, name);
87 g_free(buffer);
88 return ret;
fc22118d
AK
89}
90
70fc55eb
AK
91static inline ssize_t notsup_getxattr(FsContext *ctx, const char *path,
92 const char *name, void *value,
93 size_t size)
94{
95 errno = ENOTSUP;
96 return -1;
97}
98
99static inline int notsup_setxattr(FsContext *ctx, const char *path,
100 const char *name, void *value,
101 size_t size, int flags)
102{
103 errno = ENOTSUP;
104 return -1;
105}
106
107static inline ssize_t notsup_listxattr(FsContext *ctx, const char *path,
108 char *name, void *value, size_t size)
109{
110 return 0;
111}
112
113static inline int notsup_removexattr(FsContext *ctx,
114 const char *path, const char *name)
115{
116 errno = ENOTSUP;
117 return -1;
118}
119
fc22118d 120#endif
This page took 0.419219 seconds and 4 git commands to generate.