ppc/pnv: Add POWER10 quads
[qemu.git] / hw / 9pfs / coxattr.c
blobdbcd09e0fd55ce63295a8ec861a282d1e09df629
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.
15 * Not so fast! You might want to read the 9p developer docs first:
16 * https://wiki.qemu.org/Documentation/9p
19 #include "qemu/osdep.h"
20 #include "fsdev/qemu-fsdev.h"
21 #include "qemu/thread.h"
22 #include "qemu/coroutine.h"
23 #include "qemu/main-loop.h"
24 #include "coth.h"
26 int coroutine_fn v9fs_co_llistxattr(V9fsPDU *pdu, V9fsPath *path, void *value,
27 size_t size)
29 int err;
30 V9fsState *s = pdu->s;
32 if (v9fs_request_cancelled(pdu)) {
33 return -EINTR;
35 v9fs_path_read_lock(s);
36 v9fs_co_run_in_worker(
38 err = s->ops->llistxattr(&s->ctx, path, value, size);
39 if (err < 0) {
40 err = -errno;
42 });
43 v9fs_path_unlock(s);
44 return err;
47 int coroutine_fn v9fs_co_lgetxattr(V9fsPDU *pdu, V9fsPath *path,
48 V9fsString *xattr_name, void *value,
49 size_t size)
51 int err;
52 V9fsState *s = pdu->s;
54 if (v9fs_request_cancelled(pdu)) {
55 return -EINTR;
57 v9fs_path_read_lock(s);
58 v9fs_co_run_in_worker(
60 err = s->ops->lgetxattr(&s->ctx, path,
61 xattr_name->data,
62 value, size);
63 if (err < 0) {
64 err = -errno;
66 });
67 v9fs_path_unlock(s);
68 return err;
71 int coroutine_fn v9fs_co_lsetxattr(V9fsPDU *pdu, V9fsPath *path,
72 V9fsString *xattr_name, void *value,
73 size_t size, int flags)
75 int err;
76 V9fsState *s = pdu->s;
78 if (v9fs_request_cancelled(pdu)) {
79 return -EINTR;
81 v9fs_path_read_lock(s);
82 v9fs_co_run_in_worker(
84 err = s->ops->lsetxattr(&s->ctx, path,
85 xattr_name->data, value,
86 size, flags);
87 if (err < 0) {
88 err = -errno;
90 });
91 v9fs_path_unlock(s);
92 return err;
95 int coroutine_fn v9fs_co_lremovexattr(V9fsPDU *pdu, V9fsPath *path,
96 V9fsString *xattr_name)
98 int err;
99 V9fsState *s = pdu->s;
101 if (v9fs_request_cancelled(pdu)) {
102 return -EINTR;
104 v9fs_path_read_lock(s);
105 v9fs_co_run_in_worker(
107 err = s->ops->lremovexattr(&s->ctx, path, xattr_name->data);
108 if (err < 0) {
109 err = -errno;
112 v9fs_path_unlock(s);
113 return err;