sm501: Add missing arbitration control register
[qemu.git] / hw / 9pfs / coxattr.c
1 /*
2 * 9p backend
3 *
4 * Copyright IBM, Corp. 2011
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
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"
19
20 int coroutine_fn v9fs_co_llistxattr(V9fsPDU *pdu, V9fsPath *path, void *value,
21 size_t size)
22 {
23 int err;
24 V9fsState *s = pdu->s;
25
26 if (v9fs_request_cancelled(pdu)) {
27 return -EINTR;
28 }
29 v9fs_path_read_lock(s);
30 v9fs_co_run_in_worker(
31 {
32 err = s->ops->llistxattr(&s->ctx, path, value, size);
33 if (err < 0) {
34 err = -errno;
35 }
36 });
37 v9fs_path_unlock(s);
38 return err;
39 }
40
41 int coroutine_fn v9fs_co_lgetxattr(V9fsPDU *pdu, V9fsPath *path,
42 V9fsString *xattr_name, void *value,
43 size_t size)
44 {
45 int err;
46 V9fsState *s = pdu->s;
47
48 if (v9fs_request_cancelled(pdu)) {
49 return -EINTR;
50 }
51 v9fs_path_read_lock(s);
52 v9fs_co_run_in_worker(
53 {
54 err = s->ops->lgetxattr(&s->ctx, path,
55 xattr_name->data,
56 value, size);
57 if (err < 0) {
58 err = -errno;
59 }
60 });
61 v9fs_path_unlock(s);
62 return err;
63 }
64
65 int coroutine_fn v9fs_co_lsetxattr(V9fsPDU *pdu, V9fsPath *path,
66 V9fsString *xattr_name, void *value,
67 size_t size, int flags)
68 {
69 int err;
70 V9fsState *s = pdu->s;
71
72 if (v9fs_request_cancelled(pdu)) {
73 return -EINTR;
74 }
75 v9fs_path_read_lock(s);
76 v9fs_co_run_in_worker(
77 {
78 err = s->ops->lsetxattr(&s->ctx, path,
79 xattr_name->data, value,
80 size, flags);
81 if (err < 0) {
82 err = -errno;
83 }
84 });
85 v9fs_path_unlock(s);
86 return err;
87 }
88
89 int coroutine_fn v9fs_co_lremovexattr(V9fsPDU *pdu, V9fsPath *path,
90 V9fsString *xattr_name)
91 {
92 int err;
93 V9fsState *s = pdu->s;
94
95 if (v9fs_request_cancelled(pdu)) {
96 return -EINTR;
97 }
98 v9fs_path_read_lock(s);
99 v9fs_co_run_in_worker(
100 {
101 err = s->ops->lremovexattr(&s->ctx, path, xattr_name->data);
102 if (err < 0) {
103 err = -errno;
104 }
105 });
106 v9fs_path_unlock(s);
107 return err;
108 }