From: deraadt Date: Wed, 27 Jan 2021 05:03:23 +0000 (+0000) Subject: shuffle externs (and definitions) around to satisfy -fno-common X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=0986c2042dc71e110db3e0120dcdf168872f6f21;p=openbsd shuffle externs (and definitions) around to satisfy -fno-common ok mortimer --- diff --git a/sbin/fsck_ext2fs/fsck.h b/sbin/fsck_ext2fs/fsck.h index ecb40508911..8790c3f5de1 100644 --- a/sbin/fsck_ext2fs/fsck.h +++ b/sbin/fsck_ext2fs/fsck.h @@ -1,4 +1,4 @@ -/* $OpenBSD: fsck.h,v 1.12 2015/01/19 18:20:47 deraadt Exp $ */ +/* $OpenBSD: fsck.h,v 1.13 2021/01/27 05:03:23 deraadt Exp $ */ /* $NetBSD: fsck.h,v 1.1 1997/06/11 11:21:47 bouyer Exp $ */ /* @@ -68,13 +68,13 @@ struct bufarea { #define B_INUSE 1 #define MINBUFS 5 /* minimum number of buffers required */ -struct bufarea bufhead; /* head of list of other blks in filesys */ -struct bufarea sblk; /* file system superblock */ -struct bufarea asblk; /* first alternate superblock */ -struct bufarea *pdirbp; /* current directory contents */ -struct bufarea *pbp; /* current inode block */ -struct bufarea *getdatablk(daddr32_t, long); -struct m_ext2fs sblock; +extern struct bufarea bufhead; /* head of list of other blks in filesys */ +extern struct bufarea sblk; /* file system superblock */ +extern struct bufarea asblk; /* first alternate superblock */ +extern struct bufarea *pdirbp; /* current directory contents */ +extern struct bufarea *pbp; /* current inode block */ +extern struct bufarea *getdatablk(daddr32_t, long); +extern struct m_ext2fs sblock; #define dirty(bp) (bp)->b_dirty = 1 #define initbarea(bp) \ @@ -130,8 +130,8 @@ struct dups { struct dups *next; daddr32_t dup; }; -struct dups *duplist; /* head of dup list */ -struct dups *muldup; /* end of unique duplicate dup block numbers */ +extern struct dups *duplist; /* head of dup list */ +extern struct dups *muldup; /* end of unique duplicate dup block numbers */ /* * Linked list of inodes with zero link counts. @@ -140,12 +140,12 @@ struct zlncnt { struct zlncnt *next; ino_t zlncnt; }; -struct zlncnt *zlnhead; /* head of zero link count list */ +extern struct zlncnt *zlnhead; /* head of zero link count list */ /* * Inode cache data structures. */ -struct inoinfo { +extern struct inoinfo { struct inoinfo *i_nexthash; /* next entry in hash chain */ struct inoinfo *i_child, *i_sibling, *i_parentp; ino_t i_number; /* inode number of this entry */ @@ -155,38 +155,38 @@ struct inoinfo { u_int i_numblks; /* size of block array in bytes */ daddr32_t i_blks[1]; /* actually longer */ } **inphead, **inpsort; -long numdirs, listmax, inplast; - -long secsize; /* actual disk sector size */ -char nflag; /* assume a no response */ -char yflag; /* assume a yes response */ -int bflag; /* location of alternate super block */ -int debug; /* output debugging info */ -int preen; /* just fix normal inconsistencies */ -char havesb; /* superblock has been read */ -char skipclean; /* skip clean file systems if preening */ -int fsmodified; /* 1 => write done to file system */ -int fsreadfd; /* file descriptor for reading file system */ -int fswritefd; /* file descriptor for writing file system */ -int rerun; /* rerun fsck. Only used in non-preen mode */ - -daddr32_t maxfsblock; /* number of blocks in the file system */ -char *blockmap; /* ptr to primary blk allocation map */ -ino_t maxino; /* number of inodes in file system */ -ino_t lastino; /* last inode in use */ -char *statemap; /* ptr to inode state table */ -u_char *typemap; /* ptr to inode type table */ -int16_t *lncntp; /* ptr to link count table */ - -ino_t lfdir; /* lost & found directory inode number */ -char *lfname; /* lost & found directory name */ -int lfmode; /* lost & found directory creation mode */ - -daddr32_t n_blks; /* number of blocks in use */ -daddr32_t n_files; /* number of files in use */ +extern long numdirs, listmax, inplast; + +extern long secsize; /* actual disk sector size */ +extern char nflag; /* assume a no response */ +extern char yflag; /* assume a yes response */ +extern int bflag; /* location of alternate super block */ +extern int debug; /* output debugging info */ +extern int preen; /* just fix normal inconsistencies */ +extern char havesb; /* superblock has been read */ +extern char skipclean; /* skip clean file systems if preening */ +extern int fsmodified; /* 1 => write done to file system */ +extern int fsreadfd; /* file descriptor for reading file system */ +extern int fswritefd; /* file descriptor for writing file system */ +extern int rerun; /* rerun fsck. Only used in non-preen mode */ + +extern daddr32_t maxfsblock; /* number of blocks in the file system */ +extern char *blockmap; /* ptr to primary blk allocation map */ +extern ino_t maxino; /* number of inodes in file system */ +extern ino_t lastino; /* last inode in use */ +extern char *statemap; /* ptr to inode state table */ +extern u_char *typemap; /* ptr to inode type table */ +extern int16_t *lncntp; /* ptr to link count table */ + +extern ino_t lfdir; /* lost & found directory inode number */ +extern char *lfname; /* lost & found directory name */ +extern int lfmode; /* lost & found directory creation mode */ + +extern daddr32_t n_blks; /* number of blocks in use */ +extern daddr32_t n_files; /* number of files in use */ #define clearinode(dp) (*(dp) = zino) -struct ext2fs_dinode zino; +extern struct ext2fs_dinode zino; #define setbmap(blkno) setbit(blockmap, blkno) #define testbmap(blkno) isset(blockmap, blkno) diff --git a/sbin/fsck_ext2fs/main.c b/sbin/fsck_ext2fs/main.c index b8610a60e08..9ca48e38c8d 100644 --- a/sbin/fsck_ext2fs/main.c +++ b/sbin/fsck_ext2fs/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.28 2018/09/24 21:26:02 deraadt Exp $ */ +/* $OpenBSD: main.c,v 1.29 2021/01/27 05:03:23 deraadt Exp $ */ /* $NetBSD: main.c,v 1.1 1997/06/11 11:21:50 bouyer Exp $ */ /* @@ -58,6 +58,49 @@ static int argtoi(int, char *, char *, int); static int checkfilesys(char *, char *, long, int); static void usage(void); +struct bufarea bufhead; /* head of list of other blks in filesys */ +struct bufarea sblk; /* file system superblock */ +struct bufarea asblk; /* first alternate superblock */ +struct bufarea *pdirbp; /* current directory contents */ +struct bufarea *pbp; /* current inode block */ +struct bufarea *getdatablk(daddr32_t, long); +struct m_ext2fs sblock; + +struct dups *duplist; /* head of dup list */ +struct dups *muldup; /* end of unique duplicate dup block numbers */ + +struct zlncnt *zlnhead; /* head of zero link count list */ + +struct inoinfo **inphead, **inpsort; +long numdirs, listmax, inplast; + +long secsize; /* actual disk sector size */ +char nflag; /* assume a no response */ +char yflag; /* assume a yes response */ +int bflag; /* location of alternate super block */ +int debug; /* output debugging info */ +int preen; /* just fix normal inconsistencies */ +char havesb; /* superblock has been read */ +char skipclean; /* skip clean file systems if preening */ +int fsmodified; /* 1 => write done to file system */ +int fsreadfd; /* file descriptor for reading file system */ +int fswritefd; /* file descriptor for writing file system */ +int rerun; /* rerun fsck. Only used in non-preen mode */ + +daddr32_t maxfsblock; /* number of blocks in the file system */ +char *blockmap; /* ptr to primary blk allocation map */ +ino_t maxino; /* number of inodes in file system */ +ino_t lastino; /* last inode in use */ +char *statemap; /* ptr to inode state table */ +u_char *typemap; /* ptr to inode type table */ +int16_t *lncntp; /* ptr to link count table */ + +ino_t lfdir; /* lost & found directory inode number */ + +daddr32_t n_blks; /* number of blocks in use */ +daddr32_t n_files; /* number of files in use */ + +struct ext2fs_dinode zino; int main(int argc, char *argv[]) diff --git a/sbin/fsck_ffs/fsck.h b/sbin/fsck_ffs/fsck.h index 682266c6392..981871cd851 100644 --- a/sbin/fsck_ffs/fsck.h +++ b/sbin/fsck_ffs/fsck.h @@ -1,4 +1,4 @@ -/* $OpenBSD: fsck.h,v 1.33 2020/07/13 06:52:53 otto Exp $ */ +/* $OpenBSD: fsck.h,v 1.34 2021/01/27 05:03:25 deraadt Exp $ */ /* $NetBSD: fsck.h,v 1.13 1996/10/11 20:15:46 thorpej Exp $ */ /* @@ -86,7 +86,7 @@ struct inostat { * Inode state information is contained on per cylinder group lists * which are described by the following structure. */ -struct inostatlist { +extern struct inostatlist { long il_numalloced; /* number of inodes allocated in this cg */ struct inostat *il_stat;/* inostat info for this cylinder group */ } *inostathead; @@ -133,12 +133,12 @@ struct bufarea { #define B_INUSE 1 #define MINBUFS 5 /* minimum number of buffers required */ -struct bufarea bufhead; /* head of list of other blks in filesys */ -struct bufarea sblk; /* file system superblock */ -struct bufarea asblk; /* alternate file system superblock */ -struct bufarea *pdirbp; /* current directory contents */ -struct bufarea *pbp; /* current inode block */ -struct bufarea *getdatablk(daddr_t, long); +extern struct bufarea bufhead; /* head of list of other blks in filesys */ +extern struct bufarea sblk; /* file system superblock */ +extern struct bufarea asblk; /* alternate file system superblock */ +extern struct bufarea *pdirbp; /* current directory contents */ +extern struct bufarea *pbp; /* current inode block */ +extern struct bufarea *getdatablk(daddr_t, long); #define dirty(bp) (bp)->b_dirty = 1 #define initbarea(bp) \ @@ -195,8 +195,8 @@ struct dups { struct dups *next; daddr_t dup; }; -struct dups *duplist; /* head of dup list */ -struct dups *muldup; /* end of unique duplicate dup block numbers */ +extern struct dups *duplist; /* head of dup list */ +extern struct dups *muldup; /* end of unique duplicate dup block numbers */ /* * Linked list of inodes with zero link counts. @@ -205,12 +205,12 @@ struct zlncnt { struct zlncnt *next; ino_t zlncnt; }; -struct zlncnt *zlnhead; /* head of zero link count list */ +extern struct zlncnt *zlnhead; /* head of zero link count list */ /* * Inode cache data structures. */ -struct inoinfo { +extern struct inoinfo { struct inoinfo *i_nexthash; /* next entry in hash chain */ struct inoinfo *i_child, *i_sibling; size_t i_isize; /* size of inode */ @@ -223,33 +223,33 @@ struct inoinfo { extern long numdirs, listmax, inplast; -long secsize; /* actual disk sector size */ -char nflag; /* assume a no response */ -char yflag; /* assume a yes response */ -daddr_t bflag; /* location of alternate super block */ -int debug; /* output debugging info */ -int cvtlevel; /* convert to newer file system format */ -char usedsoftdep; /* just fix soft dependency inconsistencies */ -int preen; /* just fix normal inconsistencies */ -char resolved; /* cleared if unresolved changes => not clean */ -char havesb; /* superblock has been read */ -char skipclean; /* skip clean file systems if preening */ -int fsmodified; /* 1 => write done to file system */ -int fsreadfd; /* file descriptor for reading file system */ -int fswritefd; /* file descriptor for writing file system */ -int rerun; /* rerun fsck. Only used in non-preen mode */ - -daddr_t maxfsblock; /* number of blocks in the file system */ -char *blockmap; /* ptr to primary blk allocation map */ -ino_t maxino; /* number of inodes in file system */ -ino_t lastino; /* last inode in use */ - -ino_t lfdir; /* lost & found directory inode number */ -char *lfname; /* lost & found directory name */ -int lfmode; /* lost & found directory creation mode */ - -daddr_t n_blks; /* number of blocks in use */ -int64_t n_files; /* number of files in use */ +extern long secsize; /* actual disk sector size */ +extern char nflag; /* assume a no response */ +extern char yflag; /* assume a yes response */ +extern daddr_t bflag; /* location of alternate super block */ +extern int debug; /* output debugging info */ +extern int cvtlevel; /* convert to newer file system format */ +extern char usedsoftdep; /* just fix soft dependency inconsistencies */ +extern int preen; /* just fix normal inconsistencies */ +extern char resolved; /* cleared if unresolved changes => not clean */ +extern char havesb; /* superblock has been read */ +extern char skipclean; /* skip clean file systems if preening */ +extern int fsmodified; /* 1 => write done to file system */ +extern int fsreadfd; /* file descriptor for reading file system */ +extern int fswritefd; /* file descriptor for writing file system */ +extern int rerun; /* rerun fsck. Only used in non-preen mode */ + +extern daddr_t maxfsblock; /* number of blocks in the file system */ +extern char *blockmap; /* ptr to primary blk allocation map */ +extern ino_t maxino; /* number of inodes in file system */ +extern ino_t lastino; /* last inode in use */ + +extern ino_t lfdir; /* lost & found directory inode number */ +extern char *lfname; /* lost & found directory name */ +extern int lfmode; /* lost & found directory creation mode */ + +extern daddr_t n_blks; /* number of blocks in use */ +extern int64_t n_files; /* number of files in use */ #define clearinode(dp) \ if (sblock.fs_magic == FS_UFS1_MAGIC) { \ @@ -258,8 +258,8 @@ int64_t n_files; /* number of files in use */ (dp)->dp2 = ufs2_zino; \ } -struct ufs1_dinode ufs1_zino; -struct ufs2_dinode ufs2_zino; +extern struct ufs1_dinode ufs1_zino; +extern struct ufs2_dinode ufs2_zino; #define setbmap(blkno) setbit(blockmap, blkno) #define testbmap(blkno) isset(blockmap, blkno) @@ -280,5 +280,5 @@ void *Malloc(size_t); void *Calloc(size_t, size_t); void *Reallocarray(void *, size_t, size_t); -int (*info_fn)(char *, size_t); -char *info_filesys; +extern int (*info_fn)(char *, size_t); +extern char *info_filesys; diff --git a/sbin/fsck_ffs/main.c b/sbin/fsck_ffs/main.c index 0f6b6f7ae28..d8c1a673d7e 100644 --- a/sbin/fsck_ffs/main.c +++ b/sbin/fsck_ffs/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.52 2018/09/24 21:26:02 deraadt Exp $ */ +/* $OpenBSD: main.c,v 1.53 2021/01/27 05:03:25 deraadt Exp $ */ /* $NetBSD: main.c,v 1.22 1996/10/11 20:15:48 thorpej Exp $ */ /* @@ -54,6 +54,52 @@ int main(int, char *[]); extern char *__progname; +struct inostatlist *inostathead; + +struct bufarea bufhead; /* head of list of other blks in filesys */ +struct bufarea sblk; /* file system superblock */ +struct bufarea asblk; /* alternate file system superblock */ +struct bufarea *pdirbp; /* current directory contents */ +struct bufarea *pbp; /* current inode block */ + +struct dups *duplist; /* head of dup list */ +struct dups *muldup; /* end of unique duplicate dup block numbers */ + +struct zlncnt *zlnhead; /* head of zero link count list */ + +struct inoinfo **inphead, **inpsort; + +extern long numdirs, listmax, inplast; + +long secsize; /* actual disk sector size */ +char nflag; /* assume a no response */ +char yflag; /* assume a yes response */ +daddr_t bflag; /* location of alternate super block */ +int debug; /* output debugging info */ +int cvtlevel; /* convert to newer file system format */ +char usedsoftdep; /* just fix soft dependency inconsistencies */ +int preen; /* just fix normal inconsistencies */ +char resolved; /* cleared if unresolved changes => not clean */ +char havesb; /* superblock has been read */ +char skipclean; /* skip clean file systems if preening */ +int fsmodified; /* 1 => write done to file system */ +int fsreadfd; /* file descriptor for reading file system */ +int fswritefd; /* file descriptor for writing file system */ +int rerun; /* rerun fsck. Only used in non-preen mode */ + +daddr_t maxfsblock; /* number of blocks in the file system */ +char *blockmap; /* ptr to primary blk allocation map */ +ino_t maxino; /* number of inodes in file system */ +ino_t lastino; /* last inode in use */ + +ino_t lfdir; /* lost & found directory inode number */ + +daddr_t n_blks; /* number of blocks in use */ +int64_t n_files; /* number of files in use */ + +struct ufs1_dinode ufs1_zino; +struct ufs2_dinode ufs2_zino; + void usage(void) { diff --git a/sbin/fsdb/fsdb.c b/sbin/fsdb/fsdb.c index d52f01aa7c8..171920988ae 100644 --- a/sbin/fsdb/fsdb.c +++ b/sbin/fsdb/fsdb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fsdb.c,v 1.33 2020/05/28 15:48:28 otto Exp $ */ +/* $OpenBSD: fsdb.c,v 1.34 2021/01/27 05:03:25 deraadt Exp $ */ /* $NetBSD: fsdb.c,v 1.7 1997/01/11 06:50:53 lukem Exp $ */ /*- @@ -70,6 +70,53 @@ int returntosingle = 0; union dinode *curinode; ino_t curinum; +struct inostatlist *inostathead; + +struct bufarea bufhead; /* head of list of other blks in filesys */ +struct bufarea sblk; /* file system superblock */ +struct bufarea asblk; /* alternate file system superblock */ +struct bufarea *pdirbp; /* current directory contents */ +struct bufarea *pbp; /* current inode block */ + +struct dups *duplist; /* head of dup list */ +struct dups *muldup; /* end of unique duplicate dup block numbers */ + +struct zlncnt *zlnhead; /* head of zero link count list */ + +struct inoinfo **inphead, **inpsort; + +extern long numdirs, listmax, inplast; + +long secsize; /* actual disk sector size */ +char nflag; /* assume a no response */ +char yflag; /* assume a yes response */ +daddr_t bflag; /* location of alternate super block */ +int debug; /* output debugging info */ +int cvtlevel; /* convert to newer file system format */ +char usedsoftdep; /* just fix soft dependency inconsistencies */ +int preen; /* just fix normal inconsistencies */ +char resolved; /* cleared if unresolved changes => not clean */ +char havesb; /* superblock has been read */ +char skipclean; /* skip clean file systems if preening */ +int fsmodified; /* 1 => write done to file system */ +int fsreadfd; /* file descriptor for reading file system */ +int fswritefd; /* file descriptor for writing file system */ +int rerun; /* rerun fsck. Only used in non-preen mode */ + +daddr_t maxfsblock; /* number of blocks in the file system */ +char *blockmap; /* ptr to primary blk allocation map */ +ino_t maxino; /* number of inodes in file system */ +ino_t lastino; /* last inode in use */ + +ino_t lfdir; /* lost & found directory inode number */ + +daddr_t n_blks; /* number of blocks in use */ +int64_t n_files; /* number of files in use */ + +struct ufs1_dinode ufs1_zino; +struct ufs2_dinode ufs2_zino; + + static void usage(void) {