Merge tag 'pull-9p-20261019' of https://github.com/cschoenebeck/qemu into staging
9pfs changes: - Fix dir stream race via legacy 9p2000.u Tread request. - Tests: add 9p race test suite (registered as slow tests). # -----BEGIN PGP SIGNATURE----- # # iQJLBAABCgA1FiEEltjREM96+AhPiFkBNMK1h2Wkc5UFAmrWKLEXHHFlbXVfb3Nz # QGNydWRlYnl0ZS5jb20ACgkQNMK1h2Wkc5WrYw//V/K6pqpBlNHNBm9uAmWCQUcy # 1imcc3zjvWkuvXPpjvoDVWqOkBaXh7a/1foCHsr5yxFBoMisw4N6wvTN5kXGwZZ/ # gUxpiERi8FmRyH27TNoOVQ6hf2ndY13B/1jX7IHhlJX1vclzwUYTT6vlybiJc0jJ # M8cyIRQ+NqFkjKl74IF0E+xdljNOxlAqSgL7fGBRGOBwS/9Wx5soCOajcfULsWba # 60scZgHb04xx11JIhy+qm2pTgLw7FLx5lhFqtnIE6tCh0F/mk7RHrpzr0B556+e+ # lEGwdUJCE3w09bqfEtKwZmLT+C4XYiPEA+uc/wq31ydWmWwZjsvkxAF5c3GW+6Cp # gslpy0w0Qsb+ymvQG6LjB6rzQT28DFnuI7QPIA129QZVCmjjBeOJt9isL8xAG1FO # ivzpQjPAtthexJkMjoQh6DjJrlTZkmuVVh8S3zOYHJw46xYaYNJjLQPns7HfB+A/ # A183ok2oIXT/ATQMPLguXKxLPcfPfJ34rDsfdYngzJwbGbNd2QEzrEGa86K0vA73 # EBS7MoV7oJ5mXuLLmC5NFt+TN/Q2PuyKG8vYfTbyt6X0VAkf1+5oOftxxExXaV7W # /42pFYDMM6jmq09DlBAKh6D2KWvHC1eNcSOp5LEJrE0c5gBMK1stBc9geptoNhmB # wTH1mNkGf7OgWa3XC6A= # =jenn # -----END PGP SIGNATURE----- # gpg: Signature made Mon 19 Oct 2026 04:26:57 PM CEST # gpg: using RSA key 96D8D110CF7AF8084F88590134C2B58765A47395 # gpg: issuer "qemu_oss@crudebyte.com" # gpg: Good signature from "Christian Schoenebeck <qemu_oss@crudebyte.com>" [unknown] # gpg: WARNING: The key's User ID is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: ECAB 1A45 4014 1413 BA38 4926 30DB 47C3 A012 D5F4 # Subkey fingerprint: 96D8 D110 CF7A F808 4F88 5901 34C2 B587 65A4 7395 * tag 'pull-9p-20261019' of https://github.com/cschoenebeck/qemu: tests/9p-race: add Tread-on-dir race test tests/9p-client: track the negotiated 9p version for session tests/9p-client: add Tcreate / Rcreate test client functions hw/9pfs: fix dirent stream protection for legacy (9p2000.u) Tread tests/9p-race: add Treaddir race test tests/9p-client: add Tstat / Rstat test client functions tests/9p-client: add Rerror function (legacy 9p2000.u) tests/9p-race: add 9p race test suite (race FID-path mutations) tests/9p-client: add Txattrwalk / Rxattrwalk test client functions Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
commit
8967b2fe1b
7 files changed
+1393
-10
No files matched your search
@@ -2582,6 +2582,7 @@ F: hw/9pfs/
|
||||
X: hw/9pfs/xen-9p*
|
||||
F: fsdev/
|
||||
F: tests/qtest/virtio-9p-test.c
|
||||
F: tests/qtest/virtio-9p-race-test.c
|
||||
F: tests/qtest/libqos/virtio-9p*
|
||||
T: git https://github.com/cschoenebeck/qemu.git 9p.next
|
||||
|
||||
|
||||
+14
-9
@@ -2421,6 +2421,10 @@ v9fs_xattr_read(V9fsState *s, V9fsPDU *pdu, V9fsFidState *fidp,
|
||||
return offset;
|
||||
}
|
||||
|
||||
/*
|
||||
* The only caller of this function (v9fs_read()) holds the per-FID readdir
|
||||
* lock during the whole call of this function.
|
||||
*/
|
||||
static int coroutine_fn v9fs_do_readdir_with_stat(V9fsPDU *pdu,
|
||||
V9fsFidState *fidp,
|
||||
uint32_t max_count)
|
||||
@@ -2431,6 +2435,7 @@ static int coroutine_fn v9fs_do_readdir_with_stat(V9fsPDU *pdu,
|
||||
int32_t count = 0;
|
||||
struct stat stbuf;
|
||||
off_t saved_dir_pos;
|
||||
off_t current_dir_pos;
|
||||
struct dirent *dent;
|
||||
|
||||
/* save the directory position */
|
||||
@@ -2442,12 +2447,11 @@ static int coroutine_fn v9fs_do_readdir_with_stat(V9fsPDU *pdu,
|
||||
while (1) {
|
||||
v9fs_path_init(&path);
|
||||
|
||||
v9fs_readdir_lock(&fidp->fs.dir);
|
||||
|
||||
err = v9fs_co_readdir(pdu, fidp, &dent);
|
||||
if (err || !dent) {
|
||||
break;
|
||||
}
|
||||
current_dir_pos = qemu_dirent_off(dent);
|
||||
err = v9fs_co_name_to_path(pdu, &fidp->path, dent->d_name, &path);
|
||||
if (err < 0) {
|
||||
break;
|
||||
@@ -2461,8 +2465,6 @@ static int coroutine_fn v9fs_do_readdir_with_stat(V9fsPDU *pdu,
|
||||
break;
|
||||
}
|
||||
if ((count + v9stat.size + 2) > max_count) {
|
||||
v9fs_readdir_unlock(&fidp->fs.dir);
|
||||
|
||||
/* Ran out of buffer. Set dir back to old position and return */
|
||||
v9fs_co_seekdir(pdu, fidp, saved_dir_pos);
|
||||
v9fs_stat_free(&v9stat);
|
||||
@@ -2473,8 +2475,6 @@ static int coroutine_fn v9fs_do_readdir_with_stat(V9fsPDU *pdu,
|
||||
/* 11 = 7 + 4 (7 = start offset, 4 = space for storing count) */
|
||||
len = pdu_marshal(pdu, 11 + count, "S", &v9stat);
|
||||
|
||||
v9fs_readdir_unlock(&fidp->fs.dir);
|
||||
|
||||
if (len < 0) {
|
||||
v9fs_co_seekdir(pdu, fidp, saved_dir_pos);
|
||||
v9fs_stat_free(&v9stat);
|
||||
@@ -2484,11 +2484,9 @@ static int coroutine_fn v9fs_do_readdir_with_stat(V9fsPDU *pdu,
|
||||
count += len;
|
||||
v9fs_stat_free(&v9stat);
|
||||
v9fs_path_free(&path);
|
||||
saved_dir_pos = qemu_dirent_off(dent);
|
||||
saved_dir_pos = current_dir_pos;
|
||||
}
|
||||
|
||||
v9fs_readdir_unlock(&fidp->fs.dir);
|
||||
|
||||
v9fs_path_free(&path);
|
||||
if (err < 0) {
|
||||
return err;
|
||||
@@ -2528,10 +2526,17 @@ static void coroutine_fn v9fs_read(void *opaque)
|
||||
err = -EOPNOTSUPP;
|
||||
goto out;
|
||||
}
|
||||
/*
|
||||
* Hold the lock for the entire readdir transaction (rewind and
|
||||
* getdents) to prevent dirent stream corruption on concurrent requests
|
||||
* on the same FID.
|
||||
*/
|
||||
v9fs_readdir_lock(&fidp->fs.dir);
|
||||
if (off == 0) {
|
||||
v9fs_co_rewinddir(pdu, fidp);
|
||||
}
|
||||
count = v9fs_do_readdir_with_stat(pdu, fidp, max_count);
|
||||
v9fs_readdir_unlock(&fidp->fs.dir);
|
||||
if (count < 0) {
|
||||
err = count;
|
||||
goto out;
|
||||
|
||||
@@ -287,6 +287,17 @@ void v9fs_req_free(P9Req *req)
|
||||
g_free(req);
|
||||
}
|
||||
|
||||
/* size[4] Rerror tag[2] ename[s] errno[4] */
|
||||
void v9fs_rerror(P9Req *req, uint32_t *err)
|
||||
{
|
||||
g_autofree char *ename = NULL;
|
||||
|
||||
v9fs_req_recv(req, P9_RERROR);
|
||||
v9fs_string_read(req, NULL, &ename);
|
||||
v9fs_uint32_read(req, err);
|
||||
v9fs_req_free(req);
|
||||
}
|
||||
|
||||
/* size[4] Rlerror tag[2] ecode[4] */
|
||||
void v9fs_rlerror(P9Req *req, uint32_t *err)
|
||||
{
|
||||
@@ -295,6 +306,33 @@ void v9fs_rlerror(P9Req *req, uint32_t *err)
|
||||
v9fs_req_free(req);
|
||||
}
|
||||
|
||||
/*
|
||||
* Asserts for caller that the request's response returned with the passed,
|
||||
* expected error code (in a protocol version agnostic manner).
|
||||
*/
|
||||
static void v9fs_req_check_err(P9Req *req, uint32_t expect_err)
|
||||
{
|
||||
P9Hdr hdr;
|
||||
uint32_t err;
|
||||
|
||||
/* peek the response header */
|
||||
v9fs_memread(req, &hdr, sizeof(hdr));
|
||||
/* reset offset after peek, so v9fs_rlerror() etc. read correctly */
|
||||
req->r_off = 0;
|
||||
|
||||
if (hdr.id == P9_RLERROR) {
|
||||
v9fs_rlerror(req, &err);
|
||||
} else if (hdr.id == P9_RERROR) {
|
||||
v9fs_rerror(req, &err);
|
||||
} else {
|
||||
g_printerr("Received response %d (%s) instead of an error response\n",
|
||||
hdr.id, rmessage_name(hdr.id));
|
||||
v9fs_req_free(req);
|
||||
g_assert_not_reached();
|
||||
}
|
||||
g_assert_cmpint(err, ==, expect_err);
|
||||
}
|
||||
|
||||
/* size[4] Tversion tag[2] msize[4] version[s] */
|
||||
TVersionRes v9fs_tversion(TVersionOpt opt)
|
||||
{
|
||||
@@ -328,6 +366,15 @@ TVersionRes v9fs_tversion(TVersionOpt opt)
|
||||
v9fs_string_write(req, opt.version);
|
||||
v9fs_req_send(req);
|
||||
|
||||
/* store session's protocol version to client object */
|
||||
if (!strcmp(opt.version, "9P2000.u")) {
|
||||
opt.client->proto_version = V9FS_PROTO_2000U;
|
||||
} else if (!strcmp(opt.version, "9P2000.L")) {
|
||||
opt.client->proto_version = V9FS_PROTO_2000L;
|
||||
} else {
|
||||
g_assert_not_reached();
|
||||
}
|
||||
|
||||
if (!opt.requestOnly) {
|
||||
v9fs_req_wait_for_reply(req, NULL);
|
||||
if (opt.expectErr) {
|
||||
@@ -374,7 +421,11 @@ TAttachRes v9fs_tattach(TAttachOpt opt)
|
||||
/* expecting either Rattach or Rlerror, but obviously not both */
|
||||
g_assert(!opt.expectErr || !opt.rattach.qid);
|
||||
|
||||
if (!opt.requestOnly) {
|
||||
/*
|
||||
* convenience feature: send an implicit Tversion request, however only if
|
||||
* Tversion has not been issued for this session before.
|
||||
*/
|
||||
if (!opt.requestOnly && opt.client->proto_version == 0) {
|
||||
v9fs_tversion((TVersionOpt) { .client = opt.client });
|
||||
}
|
||||
|
||||
@@ -1227,3 +1278,163 @@ void v9fs_rxattrcreate(P9Req *req)
|
||||
v9fs_req_recv(req, P9_RXATTRCREATE);
|
||||
v9fs_req_free(req);
|
||||
}
|
||||
|
||||
/* size[4] Txattrwalk tag[2] fid[4] newfid[4] name[s] */
|
||||
TXattrWalkRes v9fs_txattrwalk(TXattrWalkOpt opt)
|
||||
{
|
||||
P9Req *req;
|
||||
uint32_t err;
|
||||
uint32_t body_size = 4 + 4;
|
||||
uint16_t string_size;
|
||||
uint64_t xattr_size = 0;
|
||||
|
||||
g_assert(opt.client);
|
||||
g_assert(opt.name);
|
||||
|
||||
string_size = v9fs_string_size(opt.name);
|
||||
g_assert_cmpint(body_size, <=, UINT32_MAX - string_size);
|
||||
body_size += string_size;
|
||||
|
||||
req = v9fs_req_init(opt.client, body_size, P9_TXATTRWALK, opt.tag);
|
||||
v9fs_uint32_write(req, opt.fid);
|
||||
v9fs_uint32_write(req, opt.newfid);
|
||||
v9fs_string_write(req, opt.name);
|
||||
v9fs_req_send(req);
|
||||
|
||||
if (!opt.requestOnly) {
|
||||
v9fs_req_wait_for_reply(req, NULL);
|
||||
if (opt.expectErr) {
|
||||
v9fs_rlerror(req, &err);
|
||||
g_assert_cmpint(err, ==, opt.expectErr);
|
||||
} else {
|
||||
v9fs_rxattrwalk(req, &xattr_size);
|
||||
}
|
||||
req = NULL; /* request was freed */
|
||||
}
|
||||
|
||||
return (TXattrWalkRes) { .req = req, xattr_size };
|
||||
}
|
||||
|
||||
/* size[4] Rxattrwalk tag[2] size[8] */
|
||||
void v9fs_rxattrwalk(P9Req *req, uint64_t *size)
|
||||
{
|
||||
v9fs_req_recv(req, P9_RXATTRWALK);
|
||||
if (size) {
|
||||
v9fs_uint64_read(req, size);
|
||||
} else {
|
||||
v9fs_memskip(req, 8);
|
||||
}
|
||||
v9fs_req_free(req);
|
||||
}
|
||||
|
||||
/* size[4] Tstat tag[2] fid[4] */
|
||||
TStatRes v9fs_tstat(TStatOpt opt)
|
||||
{
|
||||
P9Req *req;
|
||||
|
||||
g_assert(opt.client);
|
||||
/* expecting either Rstat or an error response, but obviously not both */
|
||||
g_assert(!opt.expectErr || !opt.rstat.stat);
|
||||
|
||||
req = v9fs_req_init(opt.client, 4, P9_TSTAT, opt.tag);
|
||||
v9fs_uint32_write(req, opt.fid);
|
||||
v9fs_req_send(req);
|
||||
|
||||
if (!opt.requestOnly) {
|
||||
v9fs_req_wait_for_reply(req, NULL);
|
||||
if (opt.expectErr) {
|
||||
v9fs_req_check_err(req, opt.expectErr);
|
||||
} else {
|
||||
v9fs_rstat(req, opt.rstat.stat);
|
||||
}
|
||||
req = NULL; /* request was freed */
|
||||
}
|
||||
|
||||
return (TStatRes) { .req = req };
|
||||
}
|
||||
|
||||
/* size[4] Rstat tag[2] stat[n] */
|
||||
void v9fs_rstat(P9Req *req, v9fs_stat *stat)
|
||||
{
|
||||
v9fs_req_recv(req, P9_RSTAT);
|
||||
|
||||
v9fs_memskip(req, 2); /* protocol quirk: size appears twice */
|
||||
v9fs_uint16_read(req, &stat->size);
|
||||
v9fs_uint16_read(req, &stat->type);
|
||||
v9fs_uint32_read(req, &stat->dev);
|
||||
v9fs_memread(req, &stat->qid, 13);
|
||||
v9fs_uint32_read(req, &stat->mode);
|
||||
v9fs_uint32_read(req, &stat->atime);
|
||||
v9fs_uint32_read(req, &stat->mtime);
|
||||
v9fs_uint64_read(req, &stat->length);
|
||||
v9fs_string_read(req, NULL, &stat->name);
|
||||
v9fs_string_read(req, NULL, &stat->uid);
|
||||
v9fs_string_read(req, NULL, &stat->gid);
|
||||
v9fs_string_read(req, NULL, &stat->muid);
|
||||
v9fs_string_read(req, NULL, &stat->extension);
|
||||
v9fs_uint32_read(req, &stat->n_uid);
|
||||
v9fs_uint32_read(req, &stat->n_gid);
|
||||
v9fs_uint32_read(req, &stat->n_muid);
|
||||
|
||||
v9fs_req_free(req);
|
||||
}
|
||||
|
||||
/* size[4] Tcreate tag[2] fid[4] name[s] perm[4] mode[1] extension[s] */
|
||||
TCreateRes v9fs_tcreate(TCreateOpt opt)
|
||||
{
|
||||
P9Req *req;
|
||||
uint8_t mode = opt.mode;
|
||||
uint32_t body_size = 4 + 4 + 1;
|
||||
uint16_t string_size;
|
||||
|
||||
g_assert(opt.client);
|
||||
/* expecting either Rcreate or an error response, but obviously not both */
|
||||
g_assert(!opt.expectErr || !(opt.rcreate.qid || opt.rcreate.iounit));
|
||||
|
||||
if (!opt.perm) {
|
||||
opt.perm = 0644;
|
||||
}
|
||||
if (!opt.extension) {
|
||||
opt.extension = "";
|
||||
}
|
||||
|
||||
string_size = v9fs_string_size(opt.name) +
|
||||
v9fs_string_size(opt.extension);
|
||||
g_assert_cmpint(body_size, <=, UINT32_MAX - string_size);
|
||||
body_size += string_size;
|
||||
|
||||
req = v9fs_req_init(opt.client, body_size, P9_TCREATE, opt.tag);
|
||||
v9fs_uint32_write(req, opt.fid);
|
||||
v9fs_string_write(req, opt.name);
|
||||
v9fs_uint32_write(req, opt.perm);
|
||||
v9fs_memwrite(req, &mode, 1);
|
||||
v9fs_string_write(req, opt.extension);
|
||||
v9fs_req_send(req);
|
||||
|
||||
if (!opt.requestOnly) {
|
||||
v9fs_req_wait_for_reply(req, NULL);
|
||||
if (opt.expectErr) {
|
||||
v9fs_req_check_err(req, opt.expectErr);
|
||||
} else {
|
||||
v9fs_rcreate(req, opt.rcreate.qid, opt.rcreate.iounit);
|
||||
}
|
||||
req = NULL; /* request was freed */
|
||||
}
|
||||
|
||||
return (TCreateRes) { .req = req };
|
||||
}
|
||||
|
||||
/* size[4] Rcreate tag[2] qid[13] iounit[4] */
|
||||
void v9fs_rcreate(P9Req *req, v9fs_qid *qid, uint32_t *iounit)
|
||||
{
|
||||
v9fs_req_recv(req, P9_RCREATE);
|
||||
if (qid) {
|
||||
v9fs_memread(req, qid, 13);
|
||||
} else {
|
||||
v9fs_memskip(req, 13);
|
||||
}
|
||||
if (iounit) {
|
||||
v9fs_uint32_read(req, iounit);
|
||||
}
|
||||
v9fs_req_free(req);
|
||||
}
|
||||
@@ -63,6 +63,25 @@ typedef struct v9fs_attr {
|
||||
uint64_t data_version;
|
||||
} v9fs_attr;
|
||||
|
||||
typedef struct v9fs_stat {
|
||||
uint16_t size;
|
||||
uint16_t type;
|
||||
uint32_t dev;
|
||||
v9fs_qid qid;
|
||||
uint32_t mode;
|
||||
uint32_t atime;
|
||||
uint32_t mtime;
|
||||
uint64_t length;
|
||||
char *name;
|
||||
char *uid;
|
||||
char *gid;
|
||||
char *muid;
|
||||
char *extension;
|
||||
uint32_t n_uid;
|
||||
uint32_t n_gid;
|
||||
uint32_t n_muid;
|
||||
} v9fs_stat;
|
||||
|
||||
#define P9_GETATTR_BASIC 0x000007ffULL /* Mask for fields up to BLOCKS */
|
||||
#define P9_GETATTR_ALL 0x00003fffULL /* Mask for ALL fields */
|
||||
|
||||
@@ -353,6 +372,54 @@ typedef struct TMkdirRes {
|
||||
P9Req *req;
|
||||
} TMkdirRes;
|
||||
|
||||
/* create directory */
|
||||
#define P9_CREATE_PERM_DMDIR 0x80000000
|
||||
|
||||
/* options for 'Tcreate' 9p request (legacy 9p2000.u) */
|
||||
typedef struct TCreateOpt {
|
||||
/* 9P client being used (mandatory) */
|
||||
QVirtio9P *client;
|
||||
/* user supplied tag number being returned with response (optional) */
|
||||
uint16_t tag;
|
||||
/* file ID of the directory the new file shall be created in (required) */
|
||||
uint32_t fid;
|
||||
/* name of the new file (required) */
|
||||
const char *name;
|
||||
/*
|
||||
* Create mode bits (including file type bits):
|
||||
* e.g. 0644 for a regular file,
|
||||
* or P9_CREATE_PERM_DMDIR | 0755 for a directory
|
||||
* (optional)
|
||||
*/
|
||||
uint32_t perm;
|
||||
/*
|
||||
* Open mode byte:
|
||||
* OREAD (0), OWRITE (1), ORDWR (2), OEXEC(3), OTRUNC(0x10), ORCLOSE(0x40)
|
||||
* (optional)
|
||||
*/
|
||||
uint8_t mode;
|
||||
/*
|
||||
* Extension data for special files (e.g. symlink target), empty for
|
||||
* regular files. (optional)
|
||||
*/
|
||||
const char *extension;
|
||||
/* data being received from 9p server as 'Rcreate' response (optional) */
|
||||
struct {
|
||||
v9fs_qid *qid;
|
||||
uint32_t *iounit;
|
||||
} rcreate;
|
||||
/* only send Tcreate request but not wait for a reply? (optional) */
|
||||
bool requestOnly;
|
||||
/* do we expect an error response, if yes which error code? (optional) */
|
||||
uint32_t expectErr;
|
||||
} TCreateOpt;
|
||||
|
||||
/* result of 'Tcreate' 9p request */
|
||||
typedef struct TCreateRes {
|
||||
/* if requestOnly was set: request object for further processing */
|
||||
P9Req *req;
|
||||
} TCreateRes;
|
||||
|
||||
/* options for 'Tlcreate' 9p request */
|
||||
typedef struct TlcreateOpt {
|
||||
/* 9P client being used (mandatory) */
|
||||
@@ -553,6 +620,56 @@ typedef struct TXattrCreateRes {
|
||||
uint32_t err;
|
||||
} TXattrCreateRes;
|
||||
|
||||
/* options for 'Txattrwalk' 9p request */
|
||||
typedef struct TXattrWalkOpt {
|
||||
/* 9P client being used (mandatory) */
|
||||
QVirtio9P *client;
|
||||
/* user supplied tag number being returned with response (optional) */
|
||||
uint16_t tag;
|
||||
/* file ID of file/dir from which to walk (required) */
|
||||
uint32_t fid;
|
||||
/* file ID that will refer to the walked-to xattr (required) */
|
||||
uint32_t newfid;
|
||||
/* xattr name, or empty for a list of all xattrs (required) */
|
||||
const char *name;
|
||||
/* only send Txattrwalk request but not wait for a reply? (optional) */
|
||||
bool requestOnly;
|
||||
/* do we expect an Rlerror response, if yes which error code? (optional) */
|
||||
uint32_t expectErr;
|
||||
} TXattrWalkOpt;
|
||||
|
||||
/* result of 'Txattrwalk' 9p request */
|
||||
typedef struct TXattrWalkRes {
|
||||
/* if requestOnly was set: request object for further processing */
|
||||
P9Req *req;
|
||||
/* size of xattr */
|
||||
uint64_t size;
|
||||
} TXattrWalkRes;
|
||||
|
||||
/* options for 'Tstat' 9p request */
|
||||
typedef struct TStatOpt {
|
||||
/* 9P client being used (mandatory) */
|
||||
QVirtio9P *client;
|
||||
/* user supplied tag number being returned with response (optional) */
|
||||
uint16_t tag;
|
||||
/* file ID to get the Rstat for (required) */
|
||||
uint32_t fid;
|
||||
/* data being received from 9p server as 'Rstat' response (optional) */
|
||||
struct {
|
||||
v9fs_stat *stat;
|
||||
} rstat;
|
||||
/* only send Tstat request but not wait for a reply? (optional) */
|
||||
bool requestOnly;
|
||||
/* do we expect an error response, if yes which error code? (optional) */
|
||||
uint32_t expectErr;
|
||||
} TStatOpt;
|
||||
|
||||
/* result of 'Tstat' 9p request */
|
||||
typedef struct TStatRes {
|
||||
/* if requestOnly was set: request object for further processing */
|
||||
P9Req *req;
|
||||
} TStatRes;
|
||||
|
||||
void v9fs_set_allocator(QGuestAllocator *t_alloc);
|
||||
void v9fs_memwrite(P9Req *req, const void *addr, size_t len);
|
||||
void v9fs_memskip(P9Req *req, size_t len);
|
||||
@@ -573,6 +690,7 @@ void v9fs_req_send(P9Req *req);
|
||||
void v9fs_req_wait_for_reply(P9Req *req, uint32_t *len);
|
||||
void v9fs_req_recv(P9Req *req, uint8_t id);
|
||||
void v9fs_req_free(P9Req *req);
|
||||
void v9fs_rerror(P9Req *req, uint32_t *err);
|
||||
void v9fs_rlerror(P9Req *req, uint32_t *err);
|
||||
TVersionRes v9fs_tversion(TVersionOpt);
|
||||
void v9fs_rversion(P9Req *req, uint16_t *len, char **version);
|
||||
@@ -596,6 +714,8 @@ TFlushRes v9fs_tflush(TFlushOpt);
|
||||
void v9fs_rflush(P9Req *req);
|
||||
TMkdirRes v9fs_tmkdir(TMkdirOpt);
|
||||
void v9fs_rmkdir(P9Req *req, v9fs_qid *qid);
|
||||
TCreateRes v9fs_tcreate(TCreateOpt opt);
|
||||
void v9fs_rcreate(P9Req *req, v9fs_qid *qid, uint32_t *iounit);
|
||||
TlcreateRes v9fs_tlcreate(TlcreateOpt);
|
||||
void v9fs_rlcreate(P9Req *req, v9fs_qid *qid, uint32_t *iounit);
|
||||
TsymlinkRes v9fs_tsymlink(TsymlinkOpt);
|
||||
@@ -610,5 +730,9 @@ TClunkRes v9fs_tclunk(TClunkOpt opt);
|
||||
void v9fs_rclunk(P9Req *req);
|
||||
TXattrCreateRes v9fs_txattrcreate(TXattrCreateOpt opt);
|
||||
void v9fs_rxattrcreate(P9Req *req);
|
||||
TXattrWalkRes v9fs_txattrwalk(TXattrWalkOpt opt);
|
||||
void v9fs_rxattrwalk(P9Req *req, uint64_t *size);
|
||||
TStatRes v9fs_tstat(TStatOpt opt);
|
||||
void v9fs_rstat(P9Req *req, v9fs_stat *stat);
|
||||
|
||||
#endif
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "qgraph.h"
|
||||
#include "virtio.h"
|
||||
#include "virtio-pci.h"
|
||||
#include "hw/9pfs/9p.h"
|
||||
|
||||
typedef struct QVirtio9P QVirtio9P;
|
||||
typedef struct QVirtio9PPCI QVirtio9PPCI;
|
||||
@@ -32,6 +33,11 @@ typedef struct QVirtio9PDevice QVirtio9PDevice;
|
||||
struct QVirtio9P {
|
||||
QVirtioDevice *vdev;
|
||||
QVirtQueue *vq;
|
||||
/*
|
||||
* The protocol version negotiated for this 9p session via Tversion request
|
||||
* (0 if no protocol version negotiated yet)
|
||||
*/
|
||||
P9ProtoVersion proto_version;
|
||||
};
|
||||
|
||||
struct QVirtio9PPCI {
|
||||
|
||||
@@ -374,6 +374,7 @@ if host_os != 'windows'
|
||||
endif
|
||||
if have_virtfs
|
||||
qos_test_ss.add(files('virtio-9p-test.c'))
|
||||
qos_test_ss.add(files('virtio-9p-race-test.c'))
|
||||
endif
|
||||
if have_vhost_user
|
||||
qos_test_ss.add(files('vhost-user-test.c'))
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user