[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v4 14/32] tools/xen-9pfsd: add 9pfs read request support



On 08.02.24 02:28, Jason Andryuk wrote:
On Mon, Feb 5, 2024 at 5:51 AM Juergen Gross <jgross@xxxxxxxx> wrote:

Add the read request of the 9pfs protocol.

Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
Reviewed-by: Jason Andryuk <jandryuk@xxxxxxxxx>
Acked-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
---
V2:
- make error check more readable (Jason Andryuk)
V4:
- add directory read support
---
  tools/xen-9pfsd/io.c | 90 ++++++++++++++++++++++++++++++++++++++++++++
  1 file changed, 90 insertions(+)

diff --git a/tools/xen-9pfsd/io.c b/tools/xen-9pfsd/io.c
index b763e3d8d9..cfbf3bef59 100644
--- a/tools/xen-9pfsd/io.c
+++ b/tools/xen-9pfsd/io.c

+
+    len = count;
+    buf = ring->buffer + sizeof(*hdr) + sizeof(uint32_t);
+
+    if ( fidp->isdir )
+    {
+        struct dirent *dirent;
+        struct stat st;
+        struct p9_stat p9s;
+

"""
For directories, read returns an integral number of direc- tory
entries exactly as in stat (see stat(5)), one for each member of the
directory. The read request message must have offset equal to zero or
the value of offset in the previous read on the directory, plus the
number of bytes returned in the previous read. In other words, seeking
other than to the beginning is illegal in a directory (see seek(2)).
"""

I think you need to check `off`.  Looks like QEMU only checks for off
== 0 and rewinds in that case.  QEMU ignores other values.

Oh, indeed. Thanks for noticing. I'll use the same approach as qemu.


Juergen



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.