]> git.proxmox.com Git - mirror_qemu.git/blame - hw/9pfs/coxattr.c
9pfs: use coroutine_fn annotation in hw/9pfs/co*.[ch]
[mirror_qemu.git] / hw / 9pfs / coxattr.c
CommitLineData
1ceffa54 1/*
af8b38b0 2 * 9p backend
1ceffa54
AK
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
fbc04127 14#include "qemu/osdep.h"
1ceffa54 15#include "fsdev/qemu-fsdev.h"
1de7afc9 16#include "qemu/thread.h"
10817bf0 17#include "qemu/coroutine.h"
fe52840c 18#include "coth.h"
1ceffa54 19
5bdade66
GK
20int coroutine_fn v9fs_co_llistxattr(V9fsPDU *pdu, V9fsPath *path, void *value,
21 size_t size)
1ceffa54
AK
22{
23 int err;
bccacf6c 24 V9fsState *s = pdu->s;
1ceffa54 25
bccacf6c
AK
26 if (v9fs_request_cancelled(pdu)) {
27 return -EINTR;
28 }
532decb7 29 v9fs_path_read_lock(s);
1ceffa54
AK
30 v9fs_co_run_in_worker(
31 {
2289be19 32 err = s->ops->llistxattr(&s->ctx, path, value, size);
1ceffa54
AK
33 if (err < 0) {
34 err = -errno;
35 }
36 });
532decb7 37 v9fs_path_unlock(s);
1ceffa54
AK
38 return err;
39}
40
5bdade66
GK
41int coroutine_fn v9fs_co_lgetxattr(V9fsPDU *pdu, V9fsPath *path,
42 V9fsString *xattr_name, void *value,
43 size_t size)
1ceffa54
AK
44{
45 int err;
bccacf6c 46 V9fsState *s = pdu->s;
1ceffa54 47
bccacf6c
AK
48 if (v9fs_request_cancelled(pdu)) {
49 return -EINTR;
50 }
532decb7 51 v9fs_path_read_lock(s);
1ceffa54
AK
52 v9fs_co_run_in_worker(
53 {
2289be19 54 err = s->ops->lgetxattr(&s->ctx, path,
1ceffa54
AK
55 xattr_name->data,
56 value, size);
57 if (err < 0) {
58 err = -errno;
59 }
60 });
532decb7 61 v9fs_path_unlock(s);
1ceffa54
AK
62 return err;
63}
bed4352c 64
5bdade66
GK
65int coroutine_fn v9fs_co_lsetxattr(V9fsPDU *pdu, V9fsPath *path,
66 V9fsString *xattr_name, void *value,
67 size_t size, int flags)
bed4352c
AK
68{
69 int err;
bccacf6c 70 V9fsState *s = pdu->s;
bed4352c 71
bccacf6c
AK
72 if (v9fs_request_cancelled(pdu)) {
73 return -EINTR;
74 }
532decb7 75 v9fs_path_read_lock(s);
bed4352c
AK
76 v9fs_co_run_in_worker(
77 {
2289be19 78 err = s->ops->lsetxattr(&s->ctx, path,
bed4352c
AK
79 xattr_name->data, value,
80 size, flags);
81 if (err < 0) {
82 err = -errno;
83 }
84 });
532decb7 85 v9fs_path_unlock(s);
bed4352c
AK
86 return err;
87}
88
5bdade66
GK
89int coroutine_fn v9fs_co_lremovexattr(V9fsPDU *pdu, V9fsPath *path,
90 V9fsString *xattr_name)
bed4352c
AK
91{
92 int err;
bccacf6c 93 V9fsState *s = pdu->s;
bed4352c 94
bccacf6c
AK
95 if (v9fs_request_cancelled(pdu)) {
96 return -EINTR;
97 }
532decb7 98 v9fs_path_read_lock(s);
bed4352c
AK
99 v9fs_co_run_in_worker(
100 {
2289be19 101 err = s->ops->lremovexattr(&s->ctx, path, xattr_name->data);
bed4352c
AK
102 if (err < 0) {
103 err = -errno;
104 }
105 });
532decb7 106 v9fs_path_unlock(s);
bed4352c
AK
107 return err;
108}