Statistics
| Branch: | Revision:

root / hw / virtio-9p-xattr.h @ fc22118d

History | View | Annotate | Download (2.3 kB)

1
/*
2
 * Virtio 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
#ifndef _QEMU_VIRTIO_9P_XATTR_H
14
#define _QEMU_VIRTIO_9P_XATTR_H
15

    
16
#include <attr/xattr.h>
17

    
18
typedef 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

    
32
extern XattrOperations mapped_user_xattr;
33
extern XattrOperations passthrough_user_xattr;
34

    
35
extern XattrOperations *mapped_xattr_ops[];
36
extern XattrOperations *passthrough_xattr_ops[];
37
extern XattrOperations *none_xattr_ops[];
38

    
39
extern ssize_t v9fs_get_xattr(FsContext *ctx, const char *path,
40
                              const char *name, void *value, size_t size);
41
extern ssize_t v9fs_list_xattr(FsContext *ctx, const char *path,
42
                               void *value, size_t vsize);
43
extern int v9fs_set_xattr(FsContext *ctx, const char *path, const char *name,
44
                          void *value, size_t size, int flags);
45
extern int v9fs_remove_xattr(FsContext *ctx,
46
                             const char *path, const char *name);
47
extern ssize_t pt_listxattr(FsContext *ctx, const char *path,
48
                            char *name, void *value, size_t size);
49

    
50
static inline ssize_t pt_getxattr(FsContext *ctx, const char *path,
51
                                  const char *name, void *value, size_t size)
52
{
53
    return lgetxattr(rpath(ctx, path), name, value, size);
54
}
55

    
56
static inline int pt_setxattr(FsContext *ctx, const char *path,
57
                              const char *name, void *value,
58
                              size_t size, int flags)
59
{
60
    return lsetxattr(rpath(ctx, path), name, value, size, flags);
61
}
62

    
63
static inline int pt_removexattr(FsContext *ctx,
64
                                 const char *path, const char *name)
65
{
66
    return lremovexattr(rpath(ctx, path), name);
67
}
68

    
69
#endif