From 69056411a354300a17d1e92027435c988508655d 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". --- libpipe/pipe.h | 50 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 46 insertions(+), 4 deletions(-) (limited to 'libpipe/pipe.h') diff --git a/libpipe/pipe.h b/libpipe/pipe.h index 701cc918..96432990 100644 --- a/libpipe/pipe.h +++ b/libpipe/pipe.h @@ -24,13 +24,16 @@ #define EWOULDBLOCK EAGAIN /* XXX */ #include /* For conditions & mutexes */ +#include -#include "pq.h" - -#ifndef PIPE_EI -#define PIPE_EI extern inline +#ifdef PIPE_DEFINE_EI +#define PIPE_EI +#else +#define PIPE_EI __extern_inline #endif +#include "pq.h" + /* A description of a class of pipes and how to operate on them. */ struct pipe_class @@ -107,6 +110,21 @@ struct pipe /* Pipe flags. */ #define PIPE_BROKEN 0x1 /* This pipe isn't connected. */ + +extern size_t pipe_readable (struct pipe *pipe, int data_only); + +extern int pipe_is_readable (struct pipe *pipe, int data_only); + +extern error_t pipe_wait_readable (struct pipe *pipe, int noblock, int data_only); + +extern error_t pipe_select_readable (struct pipe *pipe, int data_only); + +extern error_t pipe_wait_writable (struct pipe *pipe, int noblock); + +extern error_t pipe_select_writable (struct pipe *pipe); + +#if defined(__USE_EXTERN_INLINES) || defined(PIPE_DEFINE_EI) + /* Returns the number of characters quickly readable from PIPE. If DATA_ONLY is true, then `control' packets are ignored. */ PIPE_EI size_t @@ -203,6 +221,8 @@ pipe_select_writable (struct pipe *pipe) return 0; } +#endif /* Use extern inlines. */ + /* Creates a new pipe of class CLASS and returns it in RESULT. */ error_t pipe_create (struct pipe_class *class, struct pipe **pipe); @@ -223,6 +243,26 @@ void _pipe_no_readers (struct pipe *pipe); should be locked. */ void _pipe_no_writers (struct pipe *pipe); +extern void pipe_acquire_reader (struct pipe *pipe); + +extern void pipe_acquire_writer (struct pipe *pipe); + +extern void pipe_release_reader (struct pipe *pipe); + +extern void pipe_release_writer (struct pipe *pipe); + +extern void pipe_add_reader (struct pipe *pipe); + +extern void pipe_add_writer (struct pipe *pipe); + +extern void pipe_remove_reader (struct pipe *pipe); + +extern void pipe_remove_writer (struct pipe *pipe); + +extern void pipe_drain (struct pipe *pipe); + +#if defined(__USE_EXTERN_INLINES) || defined(PIPE_DEFINE_EI) + /* Lock PIPE and increment its readers count. */ PIPE_EI void pipe_acquire_reader (struct pipe *pipe) @@ -304,6 +344,8 @@ pipe_drain (struct pipe *pipe) pq_drain (pipe->queue); } +#endif /* Use extern inlines. */ + /* Writes up to LEN bytes of DATA, to PIPE, which should be locked, and returns the amount written in AMOUNT. If present, the information in CONTROL & PORTS is written in a preceding control packet. If an error is -- cgit v1.2.3