MAINTAINERS: Add David Gibson as ppc maintainer
[qemu/cris-port.git] / hw / 9pfs / coxattr.c
blob6ad96ea9f60dfb78ca272f088fb931264790a0f5
2 /*
3 * Virtio 9p backend
5 * Copyright IBM, Corp. 2011
7 * Authors:
8 * Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
10 * This work is licensed under the terms of the GNU GPL, version 2. See
11 * the COPYING file in the top-level directory.
15 #include "qemu/osdep.h"
16 #include "fsdev/qemu-fsdev.h"
17 #include "qemu/thread.h"
18 #include "qemu/coroutine.h"
19 #include "coth.h"
21 int v9fs_co_llistxattr(V9fsPDU *pdu, V9fsPath *path, void *value, 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 v9fs_co_lgetxattr(V9fsPDU *pdu, V9fsPath *path,
42 V9fsString *xattr_name,
43 void *value, 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 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 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;