qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Christian Schoenebeck <qemu_oss@crudebyte.com>
To: qemu-devel@nongnu.org, "Shi, Guohuai" <Guohuai.Shi@windriver.com>,
	Greg Kurz <groug@kaod.org>
Cc: "Meng, Bin" <Bin.Meng@windriver.com>, Bin Meng <bmeng.cn@gmail.com>
Subject: Re: [PATCH 5/9] hw/9pfs: Add a 'local' file system backend driver for Windows
Date: Thu, 05 May 2022 13:43:33 +0200	[thread overview]
Message-ID: <4564343.M1kaXOOn0d@silver> (raw)
In-Reply-To: <CH2PR11MB445462A54AC1006BD093737BEFC39@CH2PR11MB4454.namprd11.prod.outlook.com>

On Mittwoch, 4. Mai 2022 21:34:22 CEST Shi, Guohuai wrote:
[...]
> > > index 0000000000..aab7c9f7b5
> > > --- /dev/null
> > > +++ b/hw/9pfs/9p-local-win32.c
> > > @@ -0,0 +1,1242 @@
> > > +/*
> > > + * 9p Windows callback
> > > + *
> > > + * Copyright (c) 2022 Wind River Systems, Inc.
> > > + *
> > > + * Based on hw/9pfs/9p-local.c
> > > + *
> > > + * This work is licensed under the terms of the GNU GPL, version 2. 
> > > See
> > > + * the COPYING file in the top-level directory.
> > > + */
> > > +
> > > +/*
> > > + * Not so fast! You might want to read the 9p developer docs first:
> > > + * https://wiki.qemu.org/Documentation/9p
> > > + */
> > > +
> > > +#include "qemu/osdep.h"
> > > +#include <windows.h>
> > > +#include <dirent.h>
> > > +#include "9p.h"
> > > +#include "9p-local.h"
> > > +#include "9p-xattr.h"
> > > +#include "9p-util.h"
> > > +#include "fsdev/qemu-fsdev.h"   /* local_ops */
> > > +#include "qapi/error.h"
> > > +#include "qemu/cutils.h"
> > > +#include "qemu/error-report.h"
> > > +#include "qemu/option.h"
> > > +#include <libgen.h>
> > 
> > I'm not sure whether all of this (i.e. 9p-local-win32.c in general) is
> > really needed. I mean yes, it probably does the job, but you basically
> > add a complete
> > separate 'local' backend implementation just for the Windows host
> > platform.
> > 
> > My expectation would be to stick to 9p-local.c being OS-agnostic, and only
> > define OS-specific functionality in 9p-util-windows.c if needed.
> > 
> > And most importantly: don't duplicate code as far as possible! I mean
> > somebody
> > would need to also review and maintain all of this.
> 
> Actually, almost all FileOperations functions are re-written for Windows
> host.
> 
> Here is the comparison statistics for 9p-local.c and 9p-local-win32.c:
> Total lines : 1611
> Changed lines: 590
> Inserted lines: 138
> Removed lines: 414
> 
> For function level difference count:
> 
> Changed function: 39
> Unchanged function: 13
> 
> If use "#ifdef _WIN32" to sperate Windows host code, it may need to be
> inserted about 150 code blocks (or 39 code blocks for all changed
> functions).
> 
> I am not sure if it is a good idea to insert so many "#ifdef _WIN32", it may
> cause this file not readable.
> 
> If stick to 9p-local.c being OS-agnostic, I think it is better to create two
> new files: 9p-local-linux.c and 9p-local-win32.c

The thing is, as this is presented right now, I can hardly even see where 
deviating behaviour for Windows would be, where not, and I'm missing any 
explanations and reasons for the individual deviations right now. Chances are 
that you are unnecessarilly adding duplicate code and unnecessary code 
deviations. For me this 9p-local-win32.c approach looks overly complex and not 
appropriately abstracted on first sight.

I suggest waiting for Greg to give his opinion on this as well before 
continuing.

Best regards,
Christian Schoenebeck




  reply	other threads:[~2022-05-05 11:47 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-25 14:26 [PATCH 0/9] 9pfs: Add 9pfs support for Windows host Bin Meng
2022-04-25 14:26 ` [PATCH 1/9] hw/9pfs: Compile 9p-local.c and 9p-proxy.c for Linux and macOS Bin Meng
2022-04-25 14:26 ` [PATCH 2/9] qemu/xatth.h: Update for Windows build Bin Meng
2022-04-25 14:26 ` [PATCH 3/9] hw/9pfs: Extract common stuff to 9p-local.h Bin Meng
2022-04-25 14:27 ` [PATCH 4/9] fsdev: Add missing definitions for Windows in file-op-9p.h Bin Meng
2022-05-04 17:35   ` Christian Schoenebeck
2022-04-25 14:27 ` [PATCH 5/9] hw/9pfs: Add a 'local' file system backend driver for Windows Bin Meng
2022-05-04 18:01   ` Christian Schoenebeck
2022-05-04 19:34     ` Shi, Guohuai
2022-05-05 11:43       ` Christian Schoenebeck [this message]
2022-05-06  6:46         ` Shi, Guohuai
2022-05-09 14:29   ` Greg Kurz
2022-05-09 15:09     ` Shi, Guohuai
2022-05-09 16:20       ` Greg Kurz
2022-05-10  2:13         ` Shi, Guohuai
2022-05-10  2:17           ` Shi, Guohuai
2022-05-10 10:18             ` Christian Schoenebeck
2022-05-10 11:54               ` Christian Schoenebeck
2022-05-10 13:40                 ` Greg Kurz
2022-05-10 14:04                   ` Christian Schoenebeck
2022-05-10 14:34                     ` Greg Kurz
2022-05-10 15:35                       ` Shi, Guohuai
2022-05-11 11:18                         ` Christian Schoenebeck
2022-05-11 12:18                         ` Greg Kurz
2022-05-11 15:57                           ` Shi, Guohuai
2022-05-24 12:23                             ` Christian Schoenebeck
2022-04-25 14:27 ` [PATCH 6/9] hw/9pfs: Update 9p-synth.c for Windows build Bin Meng
2022-04-25 14:27 ` [PATCH 7/9] fsdev: Enable 'local' file system driver backend for Windows Bin Meng
2022-04-25 14:27 ` [PATCH 8/9] meson.build: Turn on virtfs for Windows host Bin Meng
2022-04-25 14:27 ` [PATCH 9/9] hw/9p: win32: Translate Windows error number to Linux value Bin Meng
2022-05-04 18:15   ` Christian Schoenebeck
2022-04-26  1:41 ` [PATCH 0/9] 9pfs: Add 9pfs support for Windows host Bin Meng
2022-05-03  3:42   ` Bin Meng
2022-05-04 17:16     ` Christian Schoenebeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4564343.M1kaXOOn0d@silver \
    --to=qemu_oss@crudebyte.com \
    --cc=Bin.Meng@windriver.com \
    --cc=Guohuai.Shi@windriver.com \
    --cc=bmeng.cn@gmail.com \
    --cc=groug@kaod.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).