NetBSD-Bugs archive

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

kern/59162: statvfs(5) man page gives wrong/unusable declaration of fsid_t



>Number:         59162
>Category:       kern
>Synopsis:       statvfs(5) man page gives wrong/unusable declaration of fsid_t
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          doc-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Mar 09 17:35:00 +0000 2025
>Originator:     Taylor R Campbell
>Release:        current, 10, 9, ...
>Organization:
The StatVFS Identification
>Environment:
>Description:
The statvfs(5) man page says:

     typedef struct { int32_t val[2]; } fsid_t;      /* file system id type */
...
     struct statvfs {
...
             unsigned long   f_fsid;   /* POSIX compliant file system id */
             fsid_t          f_fsidx;  /* NetBSD compatible file system id */
...

But this is not correct.  The header file actually defines:

/* sys/fstypes.h */
typedef struct { int32_t __fsid_val[2]; } fsid_t; /* file system id type */
>How-To-Repeat:
$ cat foo.c
#include <sys/statvfs.h>
int foo(struct statvfs *f) { return f->f_fsidx.val[0]; }
$ make foo.o
cc -O2   -c foo.c
foo.c: In function ?foo?:
foo.c:2:47: error: ?fsid_t {aka struct <anonymous>}? has no member named ?val?
 int foo(struct statvfs *f) { return f->f_fsidx.val[0]; }
                                               ^
*** Error code 1

Stop.
make: stopped in /tmp/riastradh

>Fix:
Yes, please!

Not sure __fsid_val is actually meant to be a public member name.  But `#define val ...' is surely asking for trouble, and I'm not sure why it was called __fsid_val.



Home | Main Index | Thread Index | Old Index