]>
Commit | Line | Data |
---|---|---|
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 | ||
6f569084 CS |
14 | /* |
15 | * Not so fast! You might want to read the 9p developer docs first: | |
16 | * https://wiki.qemu.org/Documentation/9p | |
17 | */ | |
18 | ||
fbc04127 | 19 | #include "qemu/osdep.h" |
1ceffa54 | 20 | #include "fsdev/qemu-fsdev.h" |
1de7afc9 | 21 | #include "qemu/thread.h" |
db725815 | 22 | #include "qemu/main-loop.h" |
fe52840c | 23 | #include "coth.h" |
1ceffa54 | 24 | |
5bdade66 GK |
25 | int coroutine_fn v9fs_co_llistxattr(V9fsPDU *pdu, V9fsPath *path, void *value, |
26 | size_t size) | |
1ceffa54 AK |
27 | { |
28 | int err; | |
bccacf6c | 29 | V9fsState *s = pdu->s; |
1ceffa54 | 30 | |
bccacf6c AK |
31 | if (v9fs_request_cancelled(pdu)) { |
32 | return -EINTR; | |
33 | } | |
532decb7 | 34 | v9fs_path_read_lock(s); |
1ceffa54 AK |
35 | v9fs_co_run_in_worker( |
36 | { | |
2289be19 | 37 | err = s->ops->llistxattr(&s->ctx, path, value, size); |
1ceffa54 AK |
38 | if (err < 0) { |
39 | err = -errno; | |
40 | } | |
41 | }); | |
532decb7 | 42 | v9fs_path_unlock(s); |
1ceffa54 AK |
43 | return err; |
44 | } | |
45 | ||
5bdade66 GK |
46 | int coroutine_fn v9fs_co_lgetxattr(V9fsPDU *pdu, V9fsPath *path, |
47 | V9fsString *xattr_name, void *value, | |
48 | size_t size) | |
1ceffa54 AK |
49 | { |
50 | int err; | |
bccacf6c | 51 | V9fsState *s = pdu->s; |
1ceffa54 | 52 | |
bccacf6c AK |
53 | if (v9fs_request_cancelled(pdu)) { |
54 | return -EINTR; | |
55 | } | |
532decb7 | 56 | v9fs_path_read_lock(s); |
1ceffa54 AK |
57 | v9fs_co_run_in_worker( |
58 | { | |
2289be19 | 59 | err = s->ops->lgetxattr(&s->ctx, path, |
1ceffa54 AK |
60 | xattr_name->data, |
61 | value, size); | |
62 | if (err < 0) { | |
63 | err = -errno; | |
64 | } | |
65 | }); | |
532decb7 | 66 | v9fs_path_unlock(s); |
1ceffa54 AK |
67 | return err; |
68 | } | |
bed4352c | 69 | |
5bdade66 GK |
70 | int coroutine_fn v9fs_co_lsetxattr(V9fsPDU *pdu, V9fsPath *path, |
71 | V9fsString *xattr_name, void *value, | |
72 | size_t size, int flags) | |
bed4352c AK |
73 | { |
74 | int err; | |
bccacf6c | 75 | V9fsState *s = pdu->s; |
bed4352c | 76 | |
bccacf6c AK |
77 | if (v9fs_request_cancelled(pdu)) { |
78 | return -EINTR; | |
79 | } | |
532decb7 | 80 | v9fs_path_read_lock(s); |
bed4352c AK |
81 | v9fs_co_run_in_worker( |
82 | { | |
2289be19 | 83 | err = s->ops->lsetxattr(&s->ctx, path, |
bed4352c AK |
84 | xattr_name->data, value, |
85 | size, flags); | |
86 | if (err < 0) { | |
87 | err = -errno; | |
88 | } | |
89 | }); | |
532decb7 | 90 | v9fs_path_unlock(s); |
bed4352c AK |
91 | return err; |
92 | } | |
93 | ||
5bdade66 GK |
94 | int coroutine_fn v9fs_co_lremovexattr(V9fsPDU *pdu, V9fsPath *path, |
95 | V9fsString *xattr_name) | |
bed4352c AK |
96 | { |
97 | int err; | |
bccacf6c | 98 | V9fsState *s = pdu->s; |
bed4352c | 99 | |
bccacf6c AK |
100 | if (v9fs_request_cancelled(pdu)) { |
101 | return -EINTR; | |
102 | } | |
532decb7 | 103 | v9fs_path_read_lock(s); |
bed4352c AK |
104 | v9fs_co_run_in_worker( |
105 | { | |
2289be19 | 106 | err = s->ops->lremovexattr(&s->ctx, path, xattr_name->data); |
bed4352c AK |
107 | if (err < 0) { |
108 | err = -errno; | |
109 | } | |
110 | }); | |
532decb7 | 111 | v9fs_path_unlock(s); |
bed4352c AK |
112 | return err; |
113 | } |