[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 06/19] hw/9pfs: Add missing definitions for Windows
From: |
Christian Schoenebeck |
Subject: |
Re: [PATCH v2 06/19] hw/9pfs: Add missing definitions for Windows |
Date: |
Wed, 16 Nov 2022 13:52:58 +0100 |
On Wednesday, November 16, 2022 10:01:39 AM CET Shi, Guohuai wrote:
[...]
> > > diff --git a/fsdev/file-op-9p.h b/fsdev/file-op-9p.h index
> > > 4997677460..7d9a736b66 100644
> > > --- a/fsdev/file-op-9p.h
> > > +++ b/fsdev/file-op-9p.h
> > > @@ -27,6 +27,39 @@
> > > # include <sys/mount.h>
> > > #endif
> > >
> > > +#ifdef CONFIG_WIN32
> > > +
> > > +/* POSIX structure not defined in Windows */
> > > +
> > > +typedef uint32_t uid_t;
> > > +typedef uint32_t gid_t;
> > > +
> > > +/* from http://man7.org/linux/man-pages/man2/statfs.2.html */ typedef
> > > +uint32_t __fsword_t; typedef uint32_t fsblkcnt_t; typedef uint32_t
> > > +fsfilcnt_t;
> > > +
> > > +/* from linux/include/uapi/asm-generic/posix_types.h */ typedef
> > > +struct {
> > > + long __val[2];
> > > +} fsid_t;
> > > +
> > > +struct statfs {
> > > + __fsword_t f_type;
> > > + __fsword_t f_bsize;
> > > + fsblkcnt_t f_blocks;
> > > + fsblkcnt_t f_bfree;
> > > + fsblkcnt_t f_bavail;
> > > + fsfilcnt_t f_files;
> > > + fsfilcnt_t f_ffree;
> > > + fsid_t f_fsid;
> > > + __fsword_t f_namelen;
> > > + __fsword_t f_frsize;
> > > + __fsword_t f_flags;
> > > +};
> > > +
> >
> > Does it make sense to define all of these, even though not being used?
>
> Windows does not have this definition, so use Linux definition can make less
> impact to 9pfs code.
> If not, need to add many macro "#ifdef CONFIG_WIN32" in other places to
> disable the unsupported code.
My bad, I thought most of these were not referenced in code at all, but I just
realized they are indeed. Only exception is probably `f_flags`, but I haven't
checked yet whether you are using that for something new in your patches.
The previous patches LGTM BTW. I still have to look at all following patches
though. So better wait some more days before posting a v3.
Best regards,
Christian Schoenebeck
[PATCH v2 03/19] hw/9pfs: Replace the direct call to xxxat() APIs with a wrapper, Bin Meng, 2022/11/10
[PATCH v2 05/19] hw/9pfs: Update 9pfs to use the new QemuFd_t type, Bin Meng, 2022/11/10
[PATCH v2 08/19] hw/9pfs: Update the local fs driver to support Windows, Bin Meng, 2022/11/10
[PATCH v2 07/19] hw/9pfs: Implement Windows specific utilities functions for 9pfs, Bin Meng, 2022/11/10