[PATCH 09/51] fsdev/virtfs-proxy-helper: Use g_mkdir_with_parents()

Bin Meng posted 51 patches 3 years, 5 months ago
Maintainers: "Alex Bennée" <alex.bennee@linaro.org>, "Philippe Mathieu-Daudé" <f4bug@amsat.org>, Thomas Huth <thuth@redhat.com>, Wainer dos Santos Moschetta <wainersm@redhat.com>, Beraldo Leal <bleal@redhat.com>, Laurent Vivier <lvivier@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Stefan Berger <stefanb@linux.vnet.ibm.com>, Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, Greg Kurz <groug@kaod.org>, Christian Schoenebeck <qemu_oss@crudebyte.com>, "Cédric Le Goater" <clg@kaod.org>, Daniel Henrique Barboza <danielhb413@gmail.com>, David Gibson <david@gibson.dropbear.id.au>, Gerd Hoffmann <kraxel@redhat.com>, Eduardo Habkost <eduardo@habkost.net>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Yanan Wang <wangyanan55@huawei.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Michael Roth <michael.roth@amd.com>, Konstantin Kostiuk <kkostiuk@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, Juan Quintela <quintela@redhat.com>, "Dr. David Alan Gilbert" <dgilbert@redhat.com>, John Snow <jsnow@redhat.com>, Peter Maydell <peter.maydell@linaro.org>, Andrew Jeffery <andrew@aj.id.au>, Joel Stanley <joel@jms.id.au>, "Michael S. Tsirkin" <mst@redhat.com>, Igor Mammedov <imammedo@redhat.com>, Ani Sinha <ani@anisinha.ca>, Alexander Bulekov <alxndr@bu.edu>, Bandan Das <bsd@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>, Darren Kenny <darren.kenny@oracle.com>, Qiuhao Li <Qiuhao.Li@outlook.com>, Havard Skinnemoen <hskinnemoen@google.com>, Tyrone Ting <kfting@nuvoton.com>, Markus Armbruster <armbru@redhat.com>, Coiby Xu <Coiby.Xu@gmail.com>, Jason Wang <jasowang@redhat.com>, Fam Zheng <fam@euphon.net>
There is a newer version of this series
[PATCH 09/51] fsdev/virtfs-proxy-helper: Use g_mkdir_with_parents()
Posted by Bin Meng 3 years, 5 months ago
From: Bin Meng <bin.meng@windriver.com>

Use the same g_mkdir_with_parents() call to create a directory on
all platforms.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
---

 fsdev/virtfs-proxy-helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fsdev/virtfs-proxy-helper.c b/fsdev/virtfs-proxy-helper.c
index 2dde27922f..d0cf76d6d1 100644
--- a/fsdev/virtfs-proxy-helper.c
+++ b/fsdev/virtfs-proxy-helper.c
@@ -639,7 +639,7 @@ static int do_create_others(int type, struct iovec *iovec)
         if (retval < 0) {
             goto err_out;
         }
-        retval = mkdir(path.data, mode);
+        retval = g_mkdir_with_parents(path.data, mode);
         break;
     case T_SYMLINK:
         retval = proxy_unmarshal(iovec, offset, "ss", &oldpath, &path);
-- 
2.34.1
Re: [PATCH 09/51] fsdev/virtfs-proxy-helper: Use g_mkdir_with_parents()
Posted by Christian Schoenebeck 3 years, 5 months ago
On Mittwoch, 24. August 2022 11:39:47 CEST Bin Meng wrote:
> From: Bin Meng <bin.meng@windriver.com>
> 
> Use the same g_mkdir_with_parents() call to create a directory on
> all platforms.

The same would be g_mkdir(), not g_mkdir_with_parents(), so please use that 
instead.

> Signed-off-by: Bin Meng <bin.meng@windriver.com>
> ---
> 
>  fsdev/virtfs-proxy-helper.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fsdev/virtfs-proxy-helper.c b/fsdev/virtfs-proxy-helper.c
> index 2dde27922f..d0cf76d6d1 100644
> --- a/fsdev/virtfs-proxy-helper.c
> +++ b/fsdev/virtfs-proxy-helper.c
> @@ -639,7 +639,7 @@ static int do_create_others(int type, struct iovec
> *iovec) if (retval < 0) {
>              goto err_out;
>          }
> -        retval = mkdir(path.data, mode);
> +        retval = g_mkdir_with_parents(path.data, mode);
>          break;
>      case T_SYMLINK:
>          retval = proxy_unmarshal(iovec, offset, "ss", &oldpath, &path);
Re: [PATCH 09/51] fsdev/virtfs-proxy-helper: Use g_mkdir_with_parents()
Posted by Bin Meng 3 years, 5 months ago
On Fri, Aug 26, 2022 at 6:09 PM Christian Schoenebeck
<qemu_oss@crudebyte.com> wrote:
>
> On Mittwoch, 24. August 2022 11:39:47 CEST Bin Meng wrote:
> > From: Bin Meng <bin.meng@windriver.com>
> >
> > Use the same g_mkdir_with_parents() call to create a directory on
> > all platforms.
>
> The same would be g_mkdir(), not g_mkdir_with_parents(), so please use that
> instead.
>

No, g_mkdir() is a deprecated API.

Search result (https://docs.gtk.org/glib/?q=mkdir) shows only
g_mkdir_with_parents().

Regards,
Bin
Re: [PATCH 09/51] fsdev/virtfs-proxy-helper: Use g_mkdir_with_parents()
Posted by Christian Schoenebeck 3 years, 5 months ago
On Freitag, 26. August 2022 12:30:20 CEST Bin Meng wrote:
> On Fri, Aug 26, 2022 at 6:09 PM Christian Schoenebeck
> 
> <qemu_oss@crudebyte.com> wrote:
> > On Mittwoch, 24. August 2022 11:39:47 CEST Bin Meng wrote:
> > > From: Bin Meng <bin.meng@windriver.com>
> > > 
> > > Use the same g_mkdir_with_parents() call to create a directory on
> > > all platforms.
> > 
> > The same would be g_mkdir(), not g_mkdir_with_parents(), so please use
> > that
> > instead.
> 
> No, g_mkdir() is a deprecated API.

Where did you got that from? AFAICS g_mkdir() does not seem to be deprecated:
https://gitlab.gnome.org/GNOME/glib/-/blob/main/glib/gstdio.c#L1201
https://gitlab.gnome.org/GNOME/glib/-/blob/main/glib/gstdio.h#L131

> Search result (https://docs.gtk.org/glib/?q=mkdir) shows only
> g_mkdir_with_parents().

Yeah, but that does not say that it was deprecated.

> Regards,
> Bin
Re: [PATCH 09/51] fsdev/virtfs-proxy-helper: Use g_mkdir_with_parents()
Posted by Bin Meng 3 years, 5 months ago
On Fri, Aug 26, 2022 at 7:16 PM Christian Schoenebeck
<qemu_oss@crudebyte.com> wrote:
>
> On Freitag, 26. August 2022 12:30:20 CEST Bin Meng wrote:
> > On Fri, Aug 26, 2022 at 6:09 PM Christian Schoenebeck
> >
> > <qemu_oss@crudebyte.com> wrote:
> > > On Mittwoch, 24. August 2022 11:39:47 CEST Bin Meng wrote:
> > > > From: Bin Meng <bin.meng@windriver.com>
> > > >
> > > > Use the same g_mkdir_with_parents() call to create a directory on
> > > > all platforms.
> > >
> > > The same would be g_mkdir(), not g_mkdir_with_parents(), so please use
> > > that
> > > instead.
> >
> > No, g_mkdir() is a deprecated API.
>
> Where did you got that from? AFAICS g_mkdir() does not seem to be deprecated:
> https://gitlab.gnome.org/GNOME/glib/-/blob/main/glib/gstdio.c#L1201
> https://gitlab.gnome.org/GNOME/glib/-/blob/main/glib/gstdio.h#L131
>
> > Search result (https://docs.gtk.org/glib/?q=mkdir) shows only
> > g_mkdir_with_parents().
>
> Yeah, but that does not say that it was deprecated.
>

Umm, correct. However I don't remember where I got the statement that
it was deprecated.

Maybe I was misled by the doc. Do you know why does the doc not
document g_mkdir()?

Regards,
Bin
Re: [PATCH 09/51] fsdev/virtfs-proxy-helper: Use g_mkdir_with_parents()
Posted by Christian Schoenebeck 3 years, 5 months ago
On Freitag, 26. August 2022 14:38:27 CEST Bin Meng wrote:
> On Fri, Aug 26, 2022 at 7:16 PM Christian Schoenebeck
> 
> <qemu_oss@crudebyte.com> wrote:
> > On Freitag, 26. August 2022 12:30:20 CEST Bin Meng wrote:
> > > On Fri, Aug 26, 2022 at 6:09 PM Christian Schoenebeck
> > > 
> > > <qemu_oss@crudebyte.com> wrote:
> > > > On Mittwoch, 24. August 2022 11:39:47 CEST Bin Meng wrote:
> > > > > From: Bin Meng <bin.meng@windriver.com>
> > > > > 
> > > > > Use the same g_mkdir_with_parents() call to create a directory on
> > > > > all platforms.
> > > > 
> > > > The same would be g_mkdir(), not g_mkdir_with_parents(), so please use
> > > > that
> > > > instead.
> > > 
> > > No, g_mkdir() is a deprecated API.
> > 
> > Where did you got that from? AFAICS g_mkdir() does not seem to be
> > deprecated:
> > https://gitlab.gnome.org/GNOME/glib/-/blob/main/glib/gstdio.c#L1201
> > https://gitlab.gnome.org/GNOME/glib/-/blob/main/glib/gstdio.h#L131> 
> > > Search result (https://docs.gtk.org/glib/?q=mkdir) shows only
> > > g_mkdir_with_parents().
> > 
> > Yeah, but that does not say that it was deprecated.
> 
> Umm, correct. However I don't remember where I got the statement that
> it was deprecated.
> 
> Maybe I was misled by the doc. Do you know why does the doc not
> document g_mkdir()?

Maybe gtk-doc does not define G_STDIO_WRAP_ON_UNIX?

Other functions like g_chmod() are missing in the generated docs as well, 
whereas g_access() et al. are there, those are declared in both conditions.
 
> Regards,
> Bin