Skip to contentSkip to conversation

9pfs: fix missing sys/mount.h include

PATCH In review Christian Schoenebeck 3 participants 5 messages Oct 28, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 9pfs: fix missing sys/mount.h include

Fixes the following build error:

fsdev/file-op-9p.h:156:56: error: declaration of 'struct statfs' will not be visible outside of this function [-Werror,-Wvisibility]

    int (*statfs)(FsContext *s, V9fsPath *path, struct statfs *stbuf);
                                                       ^

As Windows neither has statfs, nor sys/mount.h, don't include it there.

Fixes 684f91203439 ("tests/9p: split virtio-9p-test.c ...")
---
 fsdev/file-op-9p.h | 2 ++
 1 file changed, 2 insertions(+)
fsdev/file-op-9p.h +2 -0
index 4997677460..700f1857b4 100644
@@ -24,6 +24,8 @@
 #endif
 #ifdef CONFIG_DARWIN
 # include <sys/param.h>
+#endif
+#ifndef CONFIG_WIN32
 # include <sys/mount.h>
 #endif
 
Signature · 1 line
2.30.2
#1 lore raw
Quoted 21 lines · Christian Schoenebeck

Fixes the following build error:

fsdev/file-op-9p.h:156:56: error: declaration of 'struct statfs' will not be visible outside of this function [-Werror,-Wvisibility]

     int (*statfs)(FsContext *s, V9fsPath *path, struct statfs *stbuf);
                                                        ^

As Windows neither has statfs, nor sys/mount.h, don't include it there.

Fixes 684f91203439 ("tests/9p: split virtio-9p-test.c ...")
---
  fsdev/file-op-9p.h | 2 ++
  1 file changed, 2 insertions(+)
fsdev/file-op-9p.h +0 -0
index 4997677460..700f1857b4 100644

fsdev/file-op-9p.h line 30

Quoted 7 lines
fsdev/file-op-9p.h +2 -0
@@ -24,6 +24,8 @@
  #endif
  #ifdef CONFIG_DARWIN
  # include <sys/param.h>
+#endif
+#ifndef CONFIG_WIN32
  # include <sys/mount.h>
  #endif

Do you feel confident that this will also work on other exotic systems? (e.g. does it work with "make vm-build-haiku.x86_64" ?) Otherwise it might be better to add a meson.build test for this header instead.

Thomas

#2 lore raw
Quoted 17 lines · CEST Thomas Huth
Quoted 16 lines · Christian Schoenebeck

Fixes the following build error:

fsdev/file-op-9p.h:156:56: error: declaration of 'struct statfs' will not be visible outside of this function [-Werror,-Wvisibility]

     int (*statfs)(FsContext *s, V9fsPath *path, struct statfs *stbuf);
                                                        ^

As Windows neither has statfs, nor sys/mount.h, don't include it there.

Fixes 684f91203439 ("tests/9p: split virtio-9p-test.c ...")
---
  fsdev/file-op-9p.h | 2 ++
  1 file changed, 2 insertions(+)
Quoted 16 lines

fsdev/file-op-9p.h line 30

Quoted 12 lines
fsdev/file-op-9p.h +2 -0
index 4997677460..700f1857b4 100644
@@ -24,6 +24,8 @@
  #endif
  #ifdef CONFIG_DARWIN
  # include <sys/param.h>
+#endif
+#ifndef CONFIG_WIN32
  # include <sys/mount.h>
  #endif

Do you feel confident that this will also work on other exotic systems? (e.g. does it work with "make vm-build-haiku.x86_64" ?)
Otherwise it might be better to add a meson.build test for this header instead.

9pfs only supports Linux and macOS ATM, and Windows being WIP. From meson.buid:

have_virtfs = get_option('virtfs') \
    .require(targetos == 'linux' or targetos == 'darwin',
             error_message: 'virtio-9p (virtfs) requires Linux or macOS') \
    .require(targetos == 'linux' or cc.has_function('pthread_fchdir_np'),
             error_message: 'virtio-9p (virtfs) on macOS requires the presence of pthread_fchdir_np') \
    .require(targetos == 'darwin' or (libattr.found() and libcap_ng.found()),
             error_message: 'virtio-9p (virtfs) on Linux requires libcap-ng-devel and libattr-devel') \
    .disable_auto_if(not have_tools and not have_system) \
    .allowed()

And Bin Meng just sent a related patch to fix building 9pfs tests unconditionally:

https://lore.kernel.org/all/[email protected]/

Best regards,
Christian Schoenebeck

#3 lore raw
Quoted 35 lines · Christian Schoenebeck
Quoted 17 lines · CEST Thomas Huth
Quoted 16 lines · Christian Schoenebeck

Fixes the following build error:

fsdev/file-op-9p.h:156:56: error: declaration of 'struct statfs' will not be visible outside of this function [-Werror,-Wvisibility]
int (*statfs)(FsContext *s, V9fsPath *path, struct statfs *stbuf);
^

As Windows neither has statfs, nor sys/mount.h, don't include it there.

Fixes 684f91203439 ("tests/9p: split virtio-9p-test.c ...")
---
   fsdev/file-op-9p.h | 2 ++
   1 file changed, 2 insertions(+)
Quoted 16 lines

fsdev/file-op-9p.h line 30

Quoted 12 lines
fsdev/file-op-9p.h +2 -0
index 4997677460..700f1857b4 100644
@@ -24,6 +24,8 @@
   #endif
   #ifdef CONFIG_DARWIN
   # include <sys/param.h>
+#endif
+#ifndef CONFIG_WIN32
   # include <sys/mount.h>
   #endif

Do you feel confident that this will also work on other exotic systems? (e.g. does it work with "make vm-build-haiku.x86_64" ?)
Otherwise it might be better to add a meson.build test for this header instead.

Quoted 1 line

9pfs only supports Linux and macOS ATM, and Windows being WIP.

Ok, makes sense now, thanks!

Thomas

Reviewed-by on v1 1/1
#4 lore raw
In reply to Christian Schoenebeck
Quoted 8 lines · Christian Schoenebeck

Fixes the following build error:

fsdev/file-op-9p.h:156:56: error: declaration of 'struct statfs' will not be visible outside of this function [-Werror,-Wvisibility]

    int (*statfs)(FsContext *s, V9fsPath *path, struct statfs *stbuf);
                                                       ^
Quoted 9 lines

As Windows neither has statfs, nor sys/mount.h, don't include it there.

Fixes 684f91203439 ("tests/9p: split virtio-9p-test.c ...")
---
 fsdev/file-op-9p.h | 2 ++
 1 file changed, 2 insertions(+)