diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2012-03-25 22:13:55 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2012-03-25 22:33:49 +0200 |
commit | 69056411a354300a17d1e92027435c988508655d (patch) | |
tree | 0d3741400b400cef79c7bf52625adc8966f2207f /libtreefs | |
parent | f605070d37c741436b5f82745eae2a5c018e304d (diff) | |
download | hurd-69056411a354300a17d1e92027435c988508655d.tar.gz hurd-69056411a354300a17d1e92027435c988508655d.tar.bz2 hurd-69056411a354300a17d1e92027435c988508655d.zip |
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 <features.h>, 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 <features.h>, 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".
Diffstat (limited to 'libtreefs')
-rw-r--r-- | libtreefs/Makefile | 4 | ||||
-rw-r--r-- | libtreefs/mig-decls.h | 9 | ||||
-rw-r--r-- | libtreefs/treefs.h | 37 | ||||
-rw-r--r-- | libtreefs/xinl.c | 3 |
4 files changed, 41 insertions, 12 deletions
diff --git a/libtreefs/Makefile b/libtreefs/Makefile index 89d95e9b..3cdc30c9 100644 --- a/libtreefs/Makefile +++ b/libtreefs/Makefile @@ -25,12 +25,12 @@ installhdrs = treefs.h S_SRCS = s-file.c s-dir.c s-io.c s-fsys.c OTHERSRCS = defhooks.c dir-hooks.c dir-lookup.c fsys-getroot.c fsys-hooks.c \ fsys-startup.c hooks.c mdir.c nlist.c node-hooks.c rights.c \ - trans-help.c trans-start.c + trans-help.c trans-start.c xinl.c SRCS = $(OTHERSRCS) $(S_SRCS) LCLHDRS = treefs.h fs-mutate.h MIGSTUBS = fsServer.o ioServer.o fsysServer.o -OBJS = $(sort $(subst .c,.o,$(SRCS)) $(MIGSTUBS) +OBJS = $(sort $(SRCS:.c=.o)) $(MIGSTUBS) MIGSFLAGS = -imacros fs-mutate.h MIGCOMSFLAGS = -prefix treefs_ diff --git a/libtreefs/mig-decls.h b/libtreefs/mig-decls.h index 0d051e9c..e17f6196 100644 --- a/libtreefs/mig-decls.h +++ b/libtreefs/mig-decls.h @@ -25,7 +25,11 @@ /* For mig */ typedef struct treefs_handle *treefs_handle_t; -extern inline +extern treefs_handle_t treefs_begin_using_handle_port(mach_port_t port); +extern void treefs_end_using_handle_port (treefs_handle_t handle); + +#if defined(__USE_EXTERN_INLINES) || defined(TREEFS_DEFINE_EI) +TREEFS_EI treefs_handle_t treefs_begin_using_handle_port(mach_port_t port) { return @@ -33,9 +37,10 @@ treefs_handle_t treefs_begin_using_handle_port(mach_port_t port) ports_lookup_port (0, port, treefs_fsys_port_class); } -extern inline void +TREEFS_EI void treefs_end_using_handle_port (treefs_handle_t handle) { if (handle != NULL) ports_port_deref (&handle->pi); } +#endif /* Use extern inlines. */ diff --git a/libtreefs/treefs.h b/libtreefs/treefs.h index 0ad528d8..d8f30e4e 100644 --- a/libtreefs/treefs.h +++ b/libtreefs/treefs.h @@ -26,6 +26,7 @@ #include <errno.h> #include <cthreads.h> #include <assert.h> +#include <features.h> #include <sys/stat.h> @@ -36,6 +37,12 @@ /* Include the hook calling macros and non-rpc hook definitions (to get those, include "trees-s-hooks.h"). */ #include "treefs-hooks.h" + +#ifdef TREEFS_DEFINE_EI +#define TREEFS_EI +#else +#define TREEFS_EI __extern_inline +#endif /* ---------------------------------------------------------------- */ @@ -237,10 +244,18 @@ void treefs_hooks_set (treefs_hook_vector_t hooks, extern spin_lock_t treefs_node_refcnt_lock; +extern void treefs_node_ref (struct treefs_node *node); +extern void treefs_node_release (struct treefs_node *node); +extern void treefs_node_unref (struct treefs_node *node); +extern void treefs_node_ref_weak (struct treefs_node *node); +extern void treefs_node_release_weak (struct treefs_node *node); +extern void treefs_node_unref_weak (struct treefs_node *node); + +#if defined(__USE_EXTERN_INLINES) || defined(TREEFS_DEFINE_EI) /* Add a hard reference to a node. If there were no hard references previously, then the node cannot be locked (because you must hold a hard reference to hold the lock). */ -extern inline void +TREEFS_EI void treefs_node_ref (struct treefs_node *node) { int new_ref; @@ -259,7 +274,7 @@ treefs_node_ref (struct treefs_node *node) /* Unlock node NODE and release a hard reference; if this is the last hard reference and there are no links to the file then request weak references to be dropped. */ -extern inline void +TREEFS_EI void treefs_node_release (struct treefs_node *node) { int tried_drop_weak_refs = 0; @@ -306,7 +321,7 @@ treefs_node_release (struct treefs_node *node) hard reference in order to hold the lock). If this is the last hard reference and there are no links, then request weak references to be dropped. */ -extern inline void +TREEFS_EI void treefs_node_unref (struct treefs_node *node) { int tried_drop_weak_refs = 0; @@ -346,7 +361,7 @@ treefs_node_unref (struct treefs_node *node) } /* Add a weak reference to a node. */ -extern inline void +TREEFS_EI void treefs_node_ref_weak (struct treefs_node *node) { spin_lock (&treefs_node_refcnt_lock); @@ -355,7 +370,7 @@ treefs_node_ref_weak (struct treefs_node *node) } /* Unlock node NODE and release a weak reference */ -extern inline void +TREEFS_EI void treefs_node_release_weak (struct treefs_node *node) { spin_lock (&treefs_node_refcnt_lock); @@ -373,7 +388,7 @@ treefs_node_release_weak (struct treefs_node *node) /* Release a weak reference on NODE. If NODE is locked by anyone, then this cannot be the last reference (because you must hold a hard reference in order to hold the lock). */ -extern inline void +TREEFS_EI void treefs_node_unref_weak (struct treefs_node *node) { spin_lock (&treefs_node_refcnt_lock); @@ -387,6 +402,7 @@ treefs_node_unref_weak (struct treefs_node *node) else spin_unlock (&treefs_node_refcnt_lock); } +#endif /* Use extern inlines. */ /* ---------------------------------------------------------------- */ @@ -408,8 +424,12 @@ treefs_node_create_right (struct treefs_node *node, int flags, /* ---------------------------------------------------------------- */ /* Auth functions; copied from diskfs. */ +extern int treefs_auth_has_uid (struct treefs_auth *auth, uid_t uid); +extern int treefs_auth_in_group (struct treefs_auth *auth, gid_t gid); + +#if defined(__USE_EXTERN_INLINES) || defined(TREEFS_DEFINE_EI) /* Return nonzero iff the user identified by AUTH has uid UID. */ -extern inline int +TREEFS_EI int treefs_auth_has_uid (struct treefs_auth *auth, uid_t uid) { int i; @@ -420,7 +440,7 @@ treefs_auth_has_uid (struct treefs_auth *auth, uid_t uid) } /* Return nonzero iff the user identified by AUTH has group GID. */ -extern inline int +TREEFS_EI int treefs_auth_in_group (struct treefs_auth *auth, gid_t gid) { int i; @@ -429,6 +449,7 @@ treefs_auth_in_group (struct treefs_auth *auth, gid_t gid) return 1; return 0; } +#endif /* Use extern inlines. */ /* ---------------------------------------------------------------- */ /* Helper routines for dealing with translators. */ diff --git a/libtreefs/xinl.c b/libtreefs/xinl.c new file mode 100644 index 00000000..fe83e5a3 --- /dev/null +++ b/libtreefs/xinl.c @@ -0,0 +1,3 @@ +#define TREEFS_DEFINE_EI +#include "treefs.h" +#include "mig-decls.h" |