base system incomplete types

In sys/ufs/ffs/fs.h there is a struct called "struct fsrecovery". sbin/fsck_ffs/setup.c includes this file. When building the sbin/fsck_ffs I get "variable has incomplete type". I was able to get around this by manually inserting the structure definition into setup.c. I do not see any preprocessor statements in fs.h that would prevent the struct from being included. How does this make sense?

Repo: https://svn.freebsd.org/base/stable/11
Revision: 323057
Platform: AMD64

EDIT:

Found another one. NFSSVC_FORCEDISM is defined in sys/nfs/nfssvc.h and included in sbin/umount/umount.c. The macro is referenced on line 190. The compiler does not think it is defined. I was only able to get around this by manually defining the macro. nfssvc.h definitely has no preprocessor defs that could possibly be preventing the inclusion. I even tried undefining the _NFS_NFSSVC_H_ header macro. What is going on here?

/etc/src.conf
Code:
# Compilers - not needed anymore
CC=clang
CXX=clang++
CPP=clang-cpp

# LLVM
WITH_LLDB=
WITH_CLANG_EXTRAS=

# LLD
WITH_LLD_IS_LD=
WITH_LLD_BOOTSTRAP=

# Stack Unwinder
WITH_LLVM_LIBUNWIND=

# Remove
WITHOUT_BINUTILS_BOOTSTRAP=
WITHOUT_FREEBSD_UPDATE=
WITHOUT_GDB=
WITHOUT_LIB32=
WITHOUT_MAIL=
WITHOUT_NIS=

All patches needed for successful build:

Code:
Index: sbin/fsck_ffs/setup.c
===================================================================
--- sbin/fsck_ffs/setup.c   (revision 323057)
+++ sbin/fsck_ffs/setup.c   (working copy)
@@ -456,7 +456,22 @@
    dev_bsize = secsize = DEV_BSIZE;
 }

+/* JAS */
 /*
+ * A recovery structure placed at the end of the boot block area by newfs
+ * that can be used by fsck to search for alternate superblocks.
+ */
+#define RESID  (4096 - 20) /* disk sector size minus recovery area size */
+struct fsrecovery {
+   char    block[RESID];   /* unused part of sector */
+   int32_t fsr_magic;  /* magic number */
+   int32_t fsr_fsbtodb;    /* fsbtodb and dbtofsb shift constant */
+   int32_t fsr_sblkno; /* offset of super-block in filesys */
+   int32_t fsr_fpg;    /* blocks per group * fs_frag */
+   u_int32_t fsr_ncg;  /* number of cylinder groups */
+};
+
+/*
  * Calculate a prototype superblock based on information in the boot area.
  * When done the cgsblock macro can be calculated and the fs_ncg field
  * can be used. Do NOT attempt to use other macros without verifying that
Index: sbin/newfs/mkfs.c
===================================================================
--- sbin/newfs/mkfs.c   (revision 323057)
+++ sbin/newfs/mkfs.c   (working copy)
@@ -109,6 +109,21 @@
        disk->d_sblock) * disk->d_bsize)));
 }

+/* JAS */
+/*
+ * A recovery structure placed at the end of the boot block area by newfs
+ * that can be used by fsck to search for alternate superblocks.
+ */
+#define RESID  (4096 - 20) /* disk sector size minus recovery area size */
+struct fsrecovery {
+   char    block[RESID];   /* unused part of sector */
+   int32_t fsr_magic;  /* magic number */
+   int32_t fsr_fsbtodb;    /* fsbtodb and dbtofsb shift constant */
+   int32_t fsr_sblkno; /* offset of super-block in filesys */
+   int32_t fsr_fpg;    /* blocks per group * fs_frag */
+   u_int32_t fsr_ncg;  /* number of cylinder groups */
+};
+
 void
 mkfs(struct partition *pp, char *fsys)
 {
Index: sbin/umount/umount.c
===================================================================
--- sbin/umount/umount.c    (revision 323057)
+++ sbin/umount/umount.c    (working copy)
@@ -51,6 +51,9 @@
 #include <rpcsvc/mount.h>
 #include <nfs/nfssvc.h>

+/* JAS */
+#define NFSSVC_FORCEDISM    0x40000000
+
 #include <ctype.h>
 #include <err.h>
 #include <errno.h>
Index: sys/fs/nfsclient/nfs_clport.c
===================================================================
--- sys/fs/nfsclient/nfs_clport.c   (revision 323057)
+++ sys/fs/nfsclient/nfs_clport.c   (working copy)
@@ -54,6 +54,9 @@

 #include <fs/nfsclient/nfs_kdtrace.h>

+/* JAS */
+#include <nfs/nfssvc.h>
+
 #ifdef KDTRACE_HOOKS
 dtrace_nfsclient_attrcache_flush_probe_func_t
        dtrace_nfscl_attrcache_flush_done_probe;
 
Back
Top