chardev: add hmp hotplug commands
[qemu/opensuse.git] / hw / 9pfs / coxattr.c
blob18ee08df0f5fc386a563526b86e44666938c5c14
2 /*
3 * Virtio 9p backend
5 * Copyright IBM, Corp. 2011
7 * Authors:
8 * Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
10 * This work is licensed under the terms of the GNU GPL, version 2. See
11 * the COPYING file in the top-level directory.
15 #include "fsdev/qemu-fsdev.h"
16 #include "qemu/thread.h"
17 #include "block/coroutine.h"
18 #include "virtio-9p-coth.h"
20 int v9fs_co_llistxattr(V9fsPDU *pdu, V9fsPath *path, void *value, size_t size)
22 int err;
23 V9fsState *s = pdu->s;
25 if (v9fs_request_cancelled(pdu)) {
26 return -EINTR;
28 v9fs_path_read_lock(s);
29 v9fs_co_run_in_worker(
31 err = s->ops->llistxattr(&s->ctx, path, value, size);
32 if (err < 0) {
33 err = -errno;
35 });
36 v9fs_path_unlock(s);
37 return err;
40 int v9fs_co_lgetxattr(V9fsPDU *pdu, V9fsPath *path,
41 V9fsString *xattr_name,
42 void *value, size_t size)
44 int err;
45 V9fsState *s = pdu->s;
47 if (v9fs_request_cancelled(pdu)) {
48 return -EINTR;
50 v9fs_path_read_lock(s);
51 v9fs_co_run_in_worker(
53 err = s->ops->lgetxattr(&s->ctx, path,
54 xattr_name->data,
55 value, size);
56 if (err < 0) {
57 err = -errno;
59 });
60 v9fs_path_unlock(s);
61 return err;
64 int v9fs_co_lsetxattr(V9fsPDU *pdu, V9fsPath *path,
65 V9fsString *xattr_name, void *value,
66 size_t size, int flags)
68 int err;
69 V9fsState *s = pdu->s;
71 if (v9fs_request_cancelled(pdu)) {
72 return -EINTR;
74 v9fs_path_read_lock(s);
75 v9fs_co_run_in_worker(
77 err = s->ops->lsetxattr(&s->ctx, path,
78 xattr_name->data, value,
79 size, flags);
80 if (err < 0) {
81 err = -errno;
83 });
84 v9fs_path_unlock(s);
85 return err;
88 int v9fs_co_lremovexattr(V9fsPDU *pdu, V9fsPath *path,
89 V9fsString *xattr_name)
91 int err;
92 V9fsState *s = pdu->s;
94 if (v9fs_request_cancelled(pdu)) {
95 return -EINTR;
97 v9fs_path_read_lock(s);
98 v9fs_co_run_in_worker(
100 err = s->ops->lremovexattr(&s->ctx, path, xattr_name->data);
101 if (err < 0) {
102 err = -errno;
105 v9fs_path_unlock(s);
106 return err;