Subject: lib/832: getfsstat(2) and statfs(2) manpages are incorrect
To: None <gnats-admin@NetBSD.ORG>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: netbsd-bugs
Date: 03/01/1995 17:50:04
>Number:         832
>Category:       lib
>Synopsis:       getfsstat(2) and statfs(2) manpages are incorrect
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people (Library Bug People)
>State:          open
>Class:          doc-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Mar  1 17:50:03 1995
>Originator:     Jason Thorpe
>Organization:
Numerical Aerodynamic Simulation Project - NASA Ames
>Release:        NetBSD-current of Feb 20
>Environment:
	
System: NetBSD antie 1.0A NetBSD 1.0A (ANTIE) #53: Tue Feb 28 13:28:06 PST 1995 thorpej@antie:/work/netbsd/src/sys/arch/i386/compile/ANTIE i386

>Description:
	The getfsstat(2) manpage is horribly out of date.  The statfs(2)
	manpage is *close*, but still not quite there.
>How-To-Repeat:
	% man getfsstat
	% man statfs
>Fix:
	Apply the following diffs to src/lib/libc/sys/getfsstat.2
	and src/lib/libc/statfs.2

*** getfsstat.2.orig	Wed Mar  1 12:47:34 1995
--- getfsstat.2	Wed Mar  1 13:10:14 1995
***************
*** 51,62 ****
  .Xr statfs
  structures defined as follows:
  .Bd -literal
! typedef quad fsid_t;
  
! #define MNAMELEN 32	/* length of buffer for returned name */
  
  struct statfs {
!     short   f_type;	/* type of filesystem (see below) */
      short   f_flags;	/* copy of mount flags */
      long    f_fsize;	/* fundamental filesystem block size */
      long    f_bsize;	/* optimal transfer block size */
--- 51,63 ----
  .Xr statfs
  structures defined as follows:
  .Bd -literal
! typedef struct { int32_t val[2]; } fsid_t;	/* file system id type */
  
! #define MFSNAMELEN 15	/* length of fs type name, not inc. null */
! #define MNAMELEN   32	/* length of buffer for returned name */
  
  struct statfs {
!     short   f_type;	/* type of filesystem (unused: zero) */
      short   f_flags;	/* copy of mount flags */
      long    f_fsize;	/* fundamental filesystem block size */
      long    f_bsize;	/* optimal transfer block size */
***************
*** 66,86 ****
      long    f_files;	/* total file nodes in filesystem */
      long    f_ffree;	/* free file nodes in fs */
      fsid_t  f_fsid;	/* filesystem id */
!     long    f_spare[6];	/* spare for later */
      char    f_mntonname[MNAMELEN]; /* directory on which mounted */
      char    f_mntfromname[MNAMELEN]; /* mounted filesystem */
  };
  /*
   * File system types.
   */
! #define	MOUNT_UFS	1
! #define	MOUNT_NFS	2
! #define	MOUNT_PC	3
  .Ed
  .Pp
  Fields that are undefined for a particular filesystem are set to -1.
  The buffer is filled with an array of
! .Fa fsstat
  structures, one for each mounted filesystem
  up to the size specified by
  .Fa bufsize .
--- 67,103 ----
      long    f_files;	/* total file nodes in filesystem */
      long    f_ffree;	/* free file nodes in fs */
      fsid_t  f_fsid;	/* filesystem id */
!     uid_t   f_owner;	/* user that mounted the filesystem */
!     long    f_spare[4];	/* spare for later */
!     char    f_fstypename[MFSNAMELEN+1]; /* fs type name (inc. null) */
      char    f_mntonname[MNAMELEN]; /* directory on which mounted */
      char    f_mntfromname[MNAMELEN]; /* mounted filesystem */
  };
+ 
  /*
   * File system types.
   */
! #define MOUNT_UFS    "ufs"	/* UNIX "Fast" Filesystem */
! #define MOUNT_NFS    "nfs"	/* Network Filesystem */
! #define MOUNT_MFS    "mfs"	/* Memory Filesystem */
! #define MOUNT_MSDOS  "msdos"	/* MSDOS Filesystem */
! #define MOUNT_LFS    "lfs"	/* Log-based Filesystem */
! #define MOUNT_LOFS   "lofs"	/* Loopback filesystem */
! #define MOUNT_FDESC  "fdesc"	/* File Descriptor Filesystem */
! #define MOUNT_PORTAL "portal"	/* Portal Filesystem */
! #define MOUNT_NULL   "null"	/* Minimal Filesystem Layer */
! #define MOUNT_UMAP   "umap"/* User/Group Identifier Remapping Filesystem */
! #define MOUNT_KERNFS "kernfs"	/* Kernel Information Filesystem */
! #define MOUNT_PROCFS "procfs"	/* /proc Filesystem */
! #define MOUNT_AFS    "afs"	/* Andrew Filesystem */
! #define MOUNT_CD9660 "cd9660"	/* ISO9660 (aka CDROM) Filesystem */
! #define MOUNT_UNION  "union"	/* Union (translucent) Filesystem */
! #define MOUNT_ADOSFS "adosfs"	/* AmigaDOS Filesystem */
  .Ed
  .Pp
  Fields that are undefined for a particular filesystem are set to -1.
  The buffer is filled with an array of
! .Fa statfs
  structures, one for each mounted filesystem
  up to the size specified by
  .Fa bufsize .
***************
*** 108,114 ****
  unable to respond.
  .Sh RETURN VALUES
  Upon successful completion, the number of 
! .Fa fsstat
  structures is returned.
  Otherwise, -1 is returned and the global variable
  .Va errno
--- 125,131 ----
  unable to respond.
  .Sh RETURN VALUES
  Upon successful completion, the number of 
! .Fa statfs
  structures is returned.
  Otherwise, -1 is returned and the global variable
  .Va errno

*** statfs.2.orig	Wed Mar  1 13:05:57 1995
--- statfs.2	Wed Mar  1 13:10:03 1995
***************
*** 55,81 ****
  .Fn statfs
  structure defined as follows:
  .Bd -literal
! typedef struct { long val[2]; } fsid_t;
  
  #define	MFSNAMELEN	15	/* length of fs type name, not inc. null */
  #define	MNAMELEN	90	/* length of buffer for returned name */
  
  struct statfs {
! 	short	f_type;		  /* type of filesystem (unused; zero) */
! 	short	f_flags;	  /* copy of mount flags */
! 	long	f_bsize;	  /* fundamental file system block size */
! 	long	f_iosize;	  /* optimal transfer block size */
! 	long	f_blocks;	  /* total data blocks in file system */
! 	long	f_bfree;	  /* free blocks in fs */
! 	long	f_bavail;	  /* free blocks avail to non-superuser */
! 	long	f_files;	  /* total file nodes in file system */
! 	long	f_ffree;	  /* free file nodes in fs */
! 	fsid_t	f_fsid;		  /* file system id */
! 	long	f_spare[6];	  /* spare for later */
! 	char	f_fstypename[MFSNAMELEN+1]; /* fs type name (inc. null) */
! 	char	f_mntonname[MNAMELEN];	/* mount point */
! 	char	f_mntfromname[MNAMELEN]; /* mounted filesystem */
  };
  .Ed
  .Pp
  Fields that are undefined for a particular file system are set to -1.
--- 55,102 ----
  .Fn statfs
  structure defined as follows:
  .Bd -literal
! typedef struct { int32_t val[2]; } fsid_t;
  
  #define	MFSNAMELEN	15	/* length of fs type name, not inc. null */
  #define	MNAMELEN	90	/* length of buffer for returned name */
  
  struct statfs {
!     short   f_type;	/* type of filesystem (unused: zero) */
!     short   f_flags;	/* copy of mount flags */
!     long    f_fsize;	/* fundamental filesystem block size */
!     long    f_bsize;	/* optimal transfer block size */
!     long    f_blocks;	/* total data blocks in filesystem */
!     long    f_bfree;	/* free blocks in fs */
!     long    f_bavail;	/* free blocks avail to non-superuser */
!     long    f_files;	/* total file nodes in filesystem */
!     long    f_ffree;	/* free file nodes in fs */
!     fsid_t  f_fsid;	/* filesystem id */
!     uid_t   f_owner;	/* user that mounted the filesystem */
!     long    f_spare[4];	/* spare for later */
!     char    f_fstypename[MFSNAMELEN+1]; /* fs type name (inc. null) */
!     char    f_mntonname[MNAMELEN]; /* directory on which mounted */
!     char    f_mntfromname[MNAMELEN]; /* mounted filesystem */
  };
+ 
+ /*
+  * File system types.
+  */
+ #define MOUNT_UFS    "ufs"	/* UNIX "Fast" Filesystem */
+ #define MOUNT_NFS    "nfs"	/* Network Filesystem */
+ #define MOUNT_MFS    "mfs"	/* Memory Filesystem */
+ #define MOUNT_MSDOS  "msdos"	/* MSDOS Filesystem */
+ #define MOUNT_LFS    "lfs"	/* Log-based Filesystem */
+ #define MOUNT_LOFS   "lofs"	/* Loopback filesystem */
+ #define MOUNT_FDESC  "fdesc"	/* File Descriptor Filesystem */
+ #define MOUNT_PORTAL "portal"	/* Portal Filesystem */
+ #define MOUNT_NULL   "null"	/* Minimal Filesystem Layer */
+ #define MOUNT_UMAP   "umap"/* User/Group Identifier Remapping Filesystem */
+ #define MOUNT_KERNFS "kernfs"	/* Kernel Information Filesystem */
+ #define MOUNT_PROCFS "procfs"	/* /proc Filesystem */
+ #define MOUNT_AFS    "afs"	/* Andrew Filesystem */
+ #define MOUNT_CD9660 "cd9660"	/* ISO9660 (aka CDROM) Filesystem */
+ #define MOUNT_UNION  "union"	/* Union (translucent) Filesystem */
+ #define MOUNT_ADOSFS "adosfs"	/* AmigaDOS Filesystem */
  .Ed
  .Pp
  Fields that are undefined for a particular file system are set to -1.
>Audit-Trail:
>Unformatted: