qapi/error: Check format string argument in error_*prepend()
[qemu/armbru.git] / hw / 9pfs / coxattr.c
blob0e00ffaa0d4cf22a87207907bd897d6f321bb46b
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 "qemu/main-loop.h"
19 #include "coth.h"
21 int coroutine_fn v9fs_co_llistxattr(V9fsPDU *pdu, V9fsPath *path, void *value,
22 size_t size)
24 int err;
25 V9fsState *s = pdu->s;
27 if (v9fs_request_cancelled(pdu)) {
28 return -EINTR;
30 v9fs_path_read_lock(s);
31 v9fs_co_run_in_worker(
33 err = s->ops->llistxattr(&s->ctx, path, value, size);
34 if (err < 0) {
35 err = -errno;
37 });
38 v9fs_path_unlock(s);
39 return err;
42 int coroutine_fn v9fs_co_lgetxattr(V9fsPDU *pdu, V9fsPath *path,
43 V9fsString *xattr_name, void *value,
44 size_t size)
46 int err;
47 V9fsState *s = pdu->s;
49 if (v9fs_request_cancelled(pdu)) {
50 return -EINTR;
52 v9fs_path_read_lock(s);
53 v9fs_co_run_in_worker(
55 err = s->ops->lgetxattr(&s->ctx, path,
56 xattr_name->data,
57 value, size);
58 if (err < 0) {
59 err = -errno;
61 });
62 v9fs_path_unlock(s);
63 return err;
66 int coroutine_fn v9fs_co_lsetxattr(V9fsPDU *pdu, V9fsPath *path,
67 V9fsString *xattr_name, void *value,
68 size_t size, int flags)
70 int err;
71 V9fsState *s = pdu->s;
73 if (v9fs_request_cancelled(pdu)) {
74 return -EINTR;
76 v9fs_path_read_lock(s);
77 v9fs_co_run_in_worker(
79 err = s->ops->lsetxattr(&s->ctx, path,
80 xattr_name->data, value,
81 size, flags);
82 if (err < 0) {
83 err = -errno;
85 });
86 v9fs_path_unlock(s);
87 return err;
90 int coroutine_fn v9fs_co_lremovexattr(V9fsPDU *pdu, V9fsPath *path,
91 V9fsString *xattr_name)
93 int err;
94 V9fsState *s = pdu->s;
96 if (v9fs_request_cancelled(pdu)) {
97 return -EINTR;
99 v9fs_path_read_lock(s);
100 v9fs_co_run_in_worker(
102 err = s->ops->lremovexattr(&s->ctx, path, xattr_name->data);
103 if (err < 0) {
104 err = -errno;
107 v9fs_path_unlock(s);
108 return err;