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

From: Kris Maglione <jg_AT_suckless.org>
Date: Tue Feb 13 06:36:00 2007

changeset: 23:cf4511f57458
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Tue Feb 13 00:35:24 2007 -0500
summary: Add ixp_fcall.h, with a version with and without anonymous structs/unions, and a config.mk flag

diff -r c72788f34990 -r cf4511f57458 Makefile
--- a/Makefile Sun Feb 11 20:34:17 2007 -0500
+++ b/Makefile Tue Feb 13 00:35:24 2007 -0500
@@ -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 @@ dist: 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 @@ uninstall:
 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 -r c72788f34990 -r cf4511f57458 config.mk
--- a/config.mk Sun Feb 11 20:34:17 2007 -0500
+++ b/config.mk Tue Feb 13 00:35:24 2007 -0500
@@ -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 -r c72788f34990 -r cf4511f57458 fcall.h.nounion
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/fcall.h.nounion Tue Feb 13 00:35:24 2007 -0500
@@ -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 -r c72788f34990 -r cf4511f57458 fcall.h.union
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/fcall.h.union Tue Feb 13 00:35:24 2007 -0500
@@ -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 -r c72788f34990 -r cf4511f57458 ixp.h
--- a/ixp.h Sun Feb 11 20:34:17 2007 -0500
+++ b/ixp.h Tue Feb 13 00:35:24 2007 -0500
@@ -139,6 +139,8 @@ struct Qid {
         unsigned char dir_type;
 };
 
+#include <ixp_fcall.h>
+
 /* stat structure */
 typedef struct Stat {
         unsigned short type;
@@ -153,61 +155,6 @@ typedef struct Stat {
         char *gid;
         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;
Received on Tue Feb 13 2007 - 06:36:00 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:55:15 UTC