audio: replace the resampling loop in audio_pcm_sw_write()
[qemu/ar7.git] / hw / 9pfs / coxattr.c
blobcd0f8488ac9c31d06cc45a006a90fe8d89f6ee6b
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/main-loop.h"
23 #include "coth.h"
25 int coroutine_fn v9fs_co_llistxattr(V9fsPDU *pdu, V9fsPath *path, void *value,
26 size_t size)
28 int err;
29 V9fsState *s = pdu->s;
31 if (v9fs_request_cancelled(pdu)) {
32 return -EINTR;
34 v9fs_path_read_lock(s);
35 v9fs_co_run_in_worker(
37 err = s->ops->llistxattr(&s->ctx, path, value, size);
38 if (err < 0) {
39 err = -errno;
41 });
42 v9fs_path_unlock(s);
43 return err;
46 int coroutine_fn v9fs_co_lgetxattr(V9fsPDU *pdu, V9fsPath *path,
47 V9fsString *xattr_name, void *value,
48 size_t size)
50 int err;
51 V9fsState *s = pdu->s;
53 if (v9fs_request_cancelled(pdu)) {
54 return -EINTR;
56 v9fs_path_read_lock(s);
57 v9fs_co_run_in_worker(
59 err = s->ops->lgetxattr(&s->ctx, path,
60 xattr_name->data,
61 value, size);
62 if (err < 0) {
63 err = -errno;
65 });
66 v9fs_path_unlock(s);
67 return err;
70 int coroutine_fn v9fs_co_lsetxattr(V9fsPDU *pdu, V9fsPath *path,
71 V9fsString *xattr_name, void *value,
72 size_t size, int flags)
74 int err;
75 V9fsState *s = pdu->s;
77 if (v9fs_request_cancelled(pdu)) {
78 return -EINTR;
80 v9fs_path_read_lock(s);
81 v9fs_co_run_in_worker(
83 err = s->ops->lsetxattr(&s->ctx, path,
84 xattr_name->data, value,
85 size, flags);
86 if (err < 0) {
87 err = -errno;
89 });
90 v9fs_path_unlock(s);
91 return err;
94 int coroutine_fn v9fs_co_lremovexattr(V9fsPDU *pdu, V9fsPath *path,
95 V9fsString *xattr_name)
97 int err;
98 V9fsState *s = pdu->s;
100 if (v9fs_request_cancelled(pdu)) {
101 return -EINTR;
103 v9fs_path_read_lock(s);
104 v9fs_co_run_in_worker(
106 err = s->ops->lremovexattr(&s->ctx, path, xattr_name->data);
107 if (err < 0) {
108 err = -errno;
111 v9fs_path_unlock(s);
112 return err;