libixp

git clone git://oldgit.suckless.org/libixp/
Log | Files | Refs | LICENSE

commit 46871e2b3d7b68d28d2019382256f89e608acb4a
parent 4e768deb11ddb2c1bdb9241fa8c53768e25303bb
Author: Kris Maglione <jg@suckless.org>
Date:   Tue, 13 Feb 2007 00:35:24 -0500

Add ixp_fcall.h, with a version with and without anonymous structs/unions, and a config.mk flag


Diffstat:
Makefile | 14++++++++++++--
config.mk | 1+
fcall.h.nounion | 41+++++++++++++++++++++++++++++++++++++++++
fcall.h.union | 54++++++++++++++++++++++++++++++++++++++++++++++++++++++
ixp.h | 57++-------------------------------------------------------
5 files changed, 110 insertions(+), 57 deletions(-)

diff --git a/Makefile b/Makefile @@ -24,7 +24,14 @@ options: @echo CC $< @${CC} -c ${CFLAGS} $< -${OBJ}: config.mk ixp.h +${OBJ}: config.mk ixp.h ixp_fcall.h + +ixp_fcall.h: fcall.h.union fcall.h.nounion config.mk +.ifndef NO_ANON_STRUCTS + @cat fcall.h.union > ixp_fcall.h +.else + @cat fcall.h.nounion > ixp_fcall.h +.endif libixp.a: ${OBJ} @echo AR $@ @@ -47,7 +54,7 @@ clean: dist: clean @echo creating dist tarball @mkdir -p libixp-${VERSION} - @cp -R LICENSE LICENSE.p9p Makefile README config.mk ixp.h ixpc.1 ${SRC} ${SRCIXPC} libixp-${VERSION} + @cp -R LICENSE LICENSE.p9p Makefile README config.mk ixp.h fcall.h.union fcall.h.nounion ixpc.1 ${SRC} ${SRCIXPC} libixp-${VERSION} @tar -cf libixp-${VERSION}.tar libixp-${VERSION} @gzip libixp-${VERSION}.tar @rm -rf libixp-${VERSION} @@ -57,6 +64,8 @@ install: all @mkdir -p ${DESTDIR}${PREFIX}/include @cp -f ixp.h ${DESTDIR}${PREFIX}/include @chmod 644 ${DESTDIR}${PREFIX}/include/ixp.h + @cp -f ixp_fcall.h ${DESTDIR}${PREFIX}/include + @chmod 644 ${DESTDIR}${PREFIX}/include/ixp_fcall.h @echo installing library to ${DESTDIR}${PREFIX}/lib @mkdir -p ${DESTDIR}${PREFIX}/lib @cp -f libixp.a ${DESTDIR}${PREFIX}/lib @@ -76,6 +85,7 @@ install: all uninstall: @echo removing header file from ${DESTDIR}${PREFIX}/include @rm -f ${DESTDIR}${PREFIX}/include/ixp.h + @rm -f ${DESTDIR}${PREFIX}/include/ixp_fcall.h @echo removing library file from ${DESTDIR}${PREFIX}/lib @rm -f ${DESTDIR}${PREFIX}/lib/libixp.a diff --git a/config.mk b/config.mk @@ -24,6 +24,7 @@ SOFLAGS = -fPIC -shared #SOFLAGS = -G #LIBS += -lsocket -lnsl #CFLAGS += -xtarget=ultra +#NO_ANON_STRUCTS = TRUE # compiler and linker AR = ar cr diff --git a/fcall.h.nounion b/fcall.h.nounion @@ -0,0 +1,41 @@ +/* from fcall(3) in plan9port */ +typedef struct Fcall { + unsigned char type; + unsigned short tag; + unsigned int fid; + /* Tversion, Rversion */ + unsigned int msize; + char *version; + /* Tflush */ + unsigned short oldtag; + /* Rerror */ + char *ename; + /* Ropen, Rcreate */ + Qid qid; /* +Rattach */ + unsigned int iounit; + /* Rauth */ + Qid aqid; + /* Tauth, Tattach */ + unsigned int afid; + char *uname; + char *aname; + /* Tcreate */ + unsigned int perm; + char *name; + unsigned char mode; /* +Topen */ + /* Twalk */ + unsigned int newfid; + unsigned short nwname; + char *wname[IXP_MAX_WELEM]; + /* Rwalk */ + unsigned short nwqid; + Qid wqid[IXP_MAX_WELEM]; + /* Twrite */ + unsigned long long offset; /* +Tread */ + /* +Rread */ + unsigned int count; /* +Tread */ + char *data; + /* Twstat, Rstat */ + unsigned short nstat; + unsigned char *stat; +} Fcall; diff --git a/fcall.h.union b/fcall.h.union @@ -0,0 +1,54 @@ +/* from fcall(3) in plan9port */ +typedef struct Fcall { + unsigned char type; + unsigned short tag; + unsigned int fid; + union { + struct { /* Tversion, Rversion */ + unsigned int msize; + char *version; + }; + struct { /* Tflush */ + unsigned short oldtag; + }; + struct { /* Rerror */ + char *ename; + }; + struct { /* Ropen, Rcreate */ + Qid qid; /* +Rattach */ + unsigned int iounit; + }; + struct { /* Rauth */ + Qid aqid; + }; + struct { /* Tauth, Tattach */ + unsigned int afid; + char *uname; + char *aname; + }; + struct { /* Tcreate */ + unsigned int perm; + char *name; + unsigned char mode; /* +Topen */ + }; + struct { /* Twalk */ + unsigned int newfid; + unsigned short nwname; + char *wname[IXP_MAX_WELEM]; + }; + struct { /* Rwalk */ + unsigned short nwqid; + Qid wqid[IXP_MAX_WELEM]; + }; + struct { /* Twrite */ + unsigned long long offset; /* +Tread */ + /* +Rread */ + unsigned int count; /* +Tread */ + char *data; + }; + struct { /* Twstat, Rstat */ + unsigned short nstat; + unsigned char *stat; + }; + }; +} Fcall; diff --git a/ixp.h b/ixp.h @@ -139,6 +139,8 @@ struct Qid { unsigned char dir_type; }; +#include <ixp_fcall.h> + /* stat structure */ typedef struct Stat { unsigned short type; @@ -154,61 +156,6 @@ typedef struct Stat { char *muid; } Stat; -/* from fcall(3) in plan9port */ -typedef struct Fcall { - unsigned char type; - unsigned short tag; - unsigned int fid; - union { - struct { /* Tversion, Rversion */ - unsigned int msize; - char *version; - }; - struct { /* Tflush */ - unsigned short oldtag; - }; - struct { /* Rerror */ - char *ename; - }; - struct { /* Ropen, Rcreate */ - Qid qid; /* +Rattach */ - unsigned int iounit; - }; - struct { /* Rauth */ - Qid aqid; - }; - struct { /* Tauth, Tattach */ - unsigned int afid; - char *uname; - char *aname; - }; - struct { /* Tcreate */ - unsigned int perm; - char *name; - unsigned char mode; /* +Topen */ - }; - struct { /* Twalk */ - unsigned int newfid; - unsigned short nwname; - char *wname[IXP_MAX_WELEM]; - }; - struct { /* Rwalk */ - unsigned short nwqid; - Qid wqid[IXP_MAX_WELEM]; - }; - struct { /* Twrite */ - unsigned long long offset; /* +Tread */ - /* +Rread */ - unsigned int count; /* +Tread */ - char *data; - }; - struct { /* Twstat, Rstat */ - unsigned short nstat; - unsigned char *stat; - }; - }; -} Fcall; - typedef struct IXPServer IXPServer; typedef struct IXPConn IXPConn; typedef struct Intmap Intmap;