From 552113d0cd000b86e266c8ca23724511f8fdb8c4 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sun, 25 Mar 2012 22:13:55 +0200 Subject: Fix extern inline use * ext2fs/Makefile (SRCS): Add xinl.c * libtreefs/Makefile (OTHERSRCS): Likewise. * term/Makefile (SRCS): Likewise. * ufs/Makefile (SRCS): Likewise. * hostmux/hostmux-xinl.c: Define HOSTMUX_DEFINE_EI instead of HOSTMUX_EI. * libdiskfs/extern-inline.c: Define DISKFS_DEFINE_EXTERN_INLINE instead of DISKFS_EXTERN_INLINE. * libftpconn/xinl.c: Define FTP_CONN_DEFINE_EI instead of FTP_CONN_EI. * libpipe/pipe-funcs.c: Define PIPE_DEFINE_EI instead of PIPE_EI. * libpipe/pq-funcs.c: Define PQ_DEFINE_EI instead of PQ_EI. * libshouldbeinlibc/idvec-funcs.c: Define IDVEC_DEFINE_EI instead of IDVEC_EI. * libshouldbeinlibc/maptime-funcs.c: Define MAPTIME_DEFINE_EI instead of MAPTIME_EI. * libshouldbeinlibc/ugids-xinl.c: Define UGIDS_DEFINE_EI instead of UGIDS_EI. * libstore/xinl.c: Define STORE_DEFINE_EI instead of STORE_EI. * libthreads/rwlock.c: Define RWLOCK_DEFINE_EI instead of RWLOCK_EI. * ext2fs/xinl.c: New file, define EXT2FS_DEFINE_EI and include "ext2fs.h" * libtreefs/xinl.c: New file, define TREEFS_DEFINE_EI and include "treefs.h" and "mig-decls.h". * term/xinl.c: New file, define TERM_DEFINE_EI and include "term.h". * ufs/xinl.c: New file, define UFS_DEFINE_EI and include "ufs.h" * ext2fs/ext2fs.h: Include , define EXT2FS_EI to __extern_inline instead of "extern inline", define it to empty when EXT2FS_DEFINE_EI is defined. Always declare extern inline prototypes, and define extern inlines content only if __USE_EXTERN_INLINES or EXT2FS_DEFINE_EI is defined. * libdiskfs/diskfs.h: Likewise with DISKFS_EXTERN_INLINE and DISKFS_DEFINE_EXTERN_INLINE. * libftpconn/ftpconn.h: Likewise with FTP_CONN_EI and FTP_CONN_DEFINE_EI. * libftpconn/priv.h: Likewise. * libpipe/pipe.h: Likewise with PIPE_EI and PIPE_DEFINE_EI. * libpipe/pq.h: Likewise with PQ_EI and PQ_DEFINE_EI. * libshouldbeinlibc/idvec.h: Likewise with IDVEC_EI and IDVEC_DEFINE_EI. * libshouldbeinlibc/maptime.h: Likewise with MAPTIME_EI and MAPTIME_DEFINE_EI. * libshouldbeinlibc/ugids.h: Likewise with UGIDS_EI and UGIDS_DEFINE_EI. * libstore/store.h: Likewise with STORE_EI and STORE_DEFINE_EI. * libthreads/rwlock.h: Likewise with RWLOCK_EI and RWLOCK_DEFINE_EI. * term/term.h: Likewise with TERM_EI and TERM_DEFINE_EI. * ufs/ufs.h: Likewise with UFS_EI and UFS_DEFINE_EI. * libtreefs/treefs.h: Include , define TREE_FS_EI to __extern_inline, or to empty when TREEFS_DEFINE_EI is defined. Use TREEFS_EI instead of "extern inline". * libtreefs/mig-decls.h: Use TREEFS_EI instead of "extern inline". --- ufs/Makefile | 2 +- ufs/ufs.h | 34 ++++++++++++++++++++++++++-------- ufs/xinl.c | 2 ++ 3 files changed, 29 insertions(+), 9 deletions(-) create mode 100644 ufs/xinl.c diff --git a/ufs/Makefile b/ufs/Makefile index 02cf38ba..cf5c40d7 100644 --- a/ufs/Makefile +++ b/ufs/Makefile @@ -21,7 +21,7 @@ makemode := server target = ufs SRCS = alloc.c consts.c dir.c hyper.c inode.c main.c pager.c \ - sizes.c subr.c tables.c bmap.c pokeloc.c + sizes.c subr.c tables.c bmap.c pokeloc.c xinl.c LCLHDRS = ufs.h fs.h dinode.h dir.h OBJS = $(SRCS:.c=.o) diff --git a/ufs/ufs.h b/ufs/ufs.h index 5d823ebc..f59784d5 100644 --- a/ufs/ufs.h +++ b/ufs/ufs.h @@ -25,9 +25,16 @@ #include #include #include +#include #include "fs.h" #include "dinode.h" +#ifdef UFS_DEFINE_EI +#define UFS_EI +#else +#define UFS_EI __extern_inline +#endif + /* Define this if memory objects should not be cached by the kernel. Normally, don't define it, but defining it causes a much greater rate of paging requests, which may be helpful in catching bugs. */ @@ -150,8 +157,18 @@ unsigned log2_dev_blocks_per_dev_bsize; /* Functions for looking inside disk_image */ +extern struct dinode * dino (ino_t inum); +extern daddr_t * indir_block (daddr_t bno); +extern struct cg * cg_locate (int ncg); +extern void sync_disk_blocks (daddr_t blkno, size_t nbytes, int wait); +extern void sync_dinode (int inum, int wait); +extern short swab_short (short arg); +extern long swab_long (long arg); +extern long long swab_long_long (long long arg); + +#if defined(__USE_EXTERN_INLINES) || defined(UFS_DEFINE_EI) /* Convert an inode number to the dinode on disk. */ -extern inline struct dinode * +UFS_EI struct dinode * dino (ino_t inum) { return (struct dinode *) @@ -161,28 +178,28 @@ dino (ino_t inum) } /* Convert a indirect block number to a daddr_t table. */ -extern inline daddr_t * +UFS_EI daddr_t * indir_block (daddr_t bno) { return (daddr_t *) (disk_image + fsaddr (sblock, bno)); } /* Convert a cg number to the cylinder group. */ -extern inline struct cg * +UFS_EI struct cg * cg_locate (int ncg) { return (struct cg *) (disk_image + fsaddr (sblock, cgtod (sblock, ncg))); } /* Sync part of the disk */ -extern inline void +UFS_EI void sync_disk_blocks (daddr_t blkno, size_t nbytes, int wait) { pager_sync_some (diskfs_disk_pager, fsaddr (sblock, blkno), nbytes, wait); } /* Sync an disk inode */ -extern inline void +UFS_EI void sync_dinode (int inum, int wait) { sync_disk_blocks (ino_to_fsba (sblock, inum), sblock->fs_fsize, wait); @@ -190,26 +207,27 @@ sync_dinode (int inum, int wait) /* Functions for byte swapping */ -extern inline short +UFS_EI short swab_short (short arg) { return (((arg & 0xff) << 8) | ((arg & 0xff00) >> 8)); } -extern inline long +UFS_EI long swab_long (long arg) { return (((long) swab_short (arg & 0xffff) << 16) | swab_short ((arg & 0xffff0000) >> 16)); } -extern inline long long +UFS_EI long long swab_long_long (long long arg) { return (((long long) swab_long (arg & 0xffffffff) << 32) | swab_long ((arg & 0xffffffff00000000LL) >> 32)); } +#endif /* Use extern inlines. */ /* Return ENTRY, after byteswapping it if necessary */ #define read_disk_entry(entry) \ diff --git a/ufs/xinl.c b/ufs/xinl.c new file mode 100644 index 00000000..7994a1f7 --- /dev/null +++ b/ufs/xinl.c @@ -0,0 +1,2 @@ +#define UFS_DEFINE_EI +#include "ufs.h" -- cgit v1.2.3