1
2
3
4
5
6
7
8
9
10
11
12
13
14
15#include "fsdev/qemu-fsdev.h"
16#include "qemu-thread.h"
17#include "qemu-coroutine.h"
18#include "virtio-9p-coth.h"
19
20int v9fs_co_llistxattr(V9fsPDU *pdu, V9fsPath *path, void *value, size_t size)
21{
22 int err;
23 V9fsState *s = pdu->s;
24
25 if (v9fs_request_cancelled(pdu)) {
26 return -EINTR;
27 }
28 v9fs_path_read_lock(s);
29 v9fs_co_run_in_worker(
30 {
31 err = s->ops->llistxattr(&s->ctx, path, value, size);
32 if (err < 0) {
33 err = -errno;
34 }
35 });
36 v9fs_path_unlock(s);
37 return err;
38}
39
40int v9fs_co_lgetxattr(V9fsPDU *pdu, V9fsPath *path,
41 V9fsString *xattr_name,
42 void *value, size_t size)
43{
44 int err;
45 V9fsState *s = pdu->s;
46
47 if (v9fs_request_cancelled(pdu)) {
48 return -EINTR;
49 }
50 v9fs_path_read_lock(s);
51 v9fs_co_run_in_worker(
52 {
53 err = s->ops->lgetxattr(&s->ctx, path,
54 xattr_name->data,
55 value, size);
56 if (err < 0) {
57 err = -errno;
58 }
59 });
60 v9fs_path_unlock(s);
61 return err;
62}
63
64int v9fs_co_lsetxattr(V9fsPDU *pdu, V9fsPath *path,
65 V9fsString *xattr_name, void *value,
66 size_t size, int flags)
67{
68 int err;
69 V9fsState *s = pdu->s;
70
71 if (v9fs_request_cancelled(pdu)) {
72 return -EINTR;
73 }
74 v9fs_path_read_lock(s);
75 v9fs_co_run_in_worker(
76 {
77 err = s->ops->lsetxattr(&s->ctx, path,
78 xattr_name->data, value,
79 size, flags);
80 if (err < 0) {
81 err = -errno;
82 }
83 });
84 v9fs_path_unlock(s);
85 return err;
86}
87
88int v9fs_co_lremovexattr(V9fsPDU *pdu, V9fsPath *path,
89 V9fsString *xattr_name)
90{
91 int err;
92 V9fsState *s = pdu->s;
93
94 if (v9fs_request_cancelled(pdu)) {
95 return -EINTR;
96 }
97 v9fs_path_read_lock(s);
98 v9fs_co_run_in_worker(
99 {
100 err = s->ops->lremovexattr(&s->ctx, path, xattr_name->data);
101 if (err < 0) {
102 err = -errno;
103 }
104 });
105 v9fs_path_unlock(s);
106 return err;
107}
108