]> git.proxmox.com Git - mirror_qemu.git/blob - hw/9pfs/coxattr.c
hw/9pfs: Add fs driver specific details to fscontext
[mirror_qemu.git] / hw / 9pfs / coxattr.c
1
2 /*
3 * Virtio 9p backend
4 *
5 * Copyright IBM, Corp. 2011
6 *
7 * Authors:
8 * Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
9 *
10 * This work is licensed under the terms of the GNU GPL, version 2. See
11 * the COPYING file in the top-level directory.
12 *
13 */
14
15 #include "fsdev/qemu-fsdev.h"
16 #include "qemu-thread.h"
17 #include "qemu-coroutine.h"
18 #include "virtio-9p-coth.h"
19
20 int v9fs_co_llistxattr(V9fsState *s, V9fsPath *path, void *value, size_t size)
21 {
22 int err;
23
24 v9fs_path_read_lock(s);
25 v9fs_co_run_in_worker(
26 {
27 err = s->ops->llistxattr(&s->ctx, path, value, size);
28 if (err < 0) {
29 err = -errno;
30 }
31 });
32 v9fs_path_unlock(s);
33 return err;
34 }
35
36 int v9fs_co_lgetxattr(V9fsState *s, V9fsPath *path,
37 V9fsString *xattr_name,
38 void *value, size_t size)
39 {
40 int err;
41
42 v9fs_path_read_lock(s);
43 v9fs_co_run_in_worker(
44 {
45 err = s->ops->lgetxattr(&s->ctx, path,
46 xattr_name->data,
47 value, size);
48 if (err < 0) {
49 err = -errno;
50 }
51 });
52 v9fs_path_unlock(s);
53 return err;
54 }
55
56 int v9fs_co_lsetxattr(V9fsState *s, V9fsPath *path,
57 V9fsString *xattr_name, void *value,
58 size_t size, int flags)
59 {
60 int err;
61
62 v9fs_path_read_lock(s);
63 v9fs_co_run_in_worker(
64 {
65 err = s->ops->lsetxattr(&s->ctx, path,
66 xattr_name->data, value,
67 size, flags);
68 if (err < 0) {
69 err = -errno;
70 }
71 });
72 v9fs_path_unlock(s);
73 return err;
74 }
75
76 int v9fs_co_lremovexattr(V9fsState *s, V9fsPath *path,
77 V9fsString *xattr_name)
78 {
79 int err;
80
81 v9fs_path_read_lock(s);
82 v9fs_co_run_in_worker(
83 {
84 err = s->ops->lremovexattr(&s->ctx, path, xattr_name->data);
85 if (err < 0) {
86 err = -errno;
87 }
88 });
89 v9fs_path_unlock(s);
90 return err;
91 }