s390x: upgrade status of KVM cores to "supported"
[qemu/ar7.git] / hw / 9pfs / coxattr.c
blob154392eade7385228a81069120dc05756b35a4e6
1 /*
2 * 9p backend
4 * Copyright IBM, Corp. 2011
6 * Authors:
7 * Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
9 * This work is licensed under the terms of the GNU GPL, version 2. See
10 * the COPYING file in the top-level directory.
14 #include "qemu/osdep.h"
15 #include "fsdev/qemu-fsdev.h"
16 #include "qemu/thread.h"
17 #include "qemu/coroutine.h"
18 #include "coth.h"
20 int coroutine_fn v9fs_co_llistxattr(V9fsPDU *pdu, V9fsPath *path, void *value,
21 size_t size)
23 int err;
24 V9fsState *s = pdu->s;
26 if (v9fs_request_cancelled(pdu)) {
27 return -EINTR;
29 v9fs_path_read_lock(s);
30 v9fs_co_run_in_worker(
32 err = s->ops->llistxattr(&s->ctx, path, value, size);
33 if (err < 0) {
34 err = -errno;
36 });
37 v9fs_path_unlock(s);
38 return err;
41 int coroutine_fn v9fs_co_lgetxattr(V9fsPDU *pdu, V9fsPath *path,
42 V9fsString *xattr_name, void *value,
43 size_t size)
45 int err;
46 V9fsState *s = pdu->s;
48 if (v9fs_request_cancelled(pdu)) {
49 return -EINTR;
51 v9fs_path_read_lock(s);
52 v9fs_co_run_in_worker(
54 err = s->ops->lgetxattr(&s->ctx, path,
55 xattr_name->data,
56 value, size);
57 if (err < 0) {
58 err = -errno;
60 });
61 v9fs_path_unlock(s);
62 return err;
65 int coroutine_fn v9fs_co_lsetxattr(V9fsPDU *pdu, V9fsPath *path,
66 V9fsString *xattr_name, void *value,
67 size_t size, int flags)
69 int err;
70 V9fsState *s = pdu->s;
72 if (v9fs_request_cancelled(pdu)) {
73 return -EINTR;
75 v9fs_path_read_lock(s);
76 v9fs_co_run_in_worker(
78 err = s->ops->lsetxattr(&s->ctx, path,
79 xattr_name->data, value,
80 size, flags);
81 if (err < 0) {
82 err = -errno;
84 });
85 v9fs_path_unlock(s);
86 return err;
89 int coroutine_fn v9fs_co_lremovexattr(V9fsPDU *pdu, V9fsPath *path,
90 V9fsString *xattr_name)
92 int err;
93 V9fsState *s = pdu->s;
95 if (v9fs_request_cancelled(pdu)) {
96 return -EINTR;
98 v9fs_path_read_lock(s);
99 v9fs_co_run_in_worker(
101 err = s->ops->lremovexattr(&s->ctx, path, xattr_name->data);
102 if (err < 0) {
103 err = -errno;
106 v9fs_path_unlock(s);
107 return err;