From 05cdb20aa2d96ec05edd345aa1b7689aa26db87d Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 9 Nov 2010 18:54:45 +1030 Subject: [PATCH 1/1] nfs: ccanize a little more. rename libnfs.h to nfs.h (CCAN expects "main" header to match module name). tools move into tools/, .x file move into rpc/ Don't sed the rpcgen files, generate headers in rpc/ Make tools use as per normal ccan usage. --- ccan/nfs/Makefile | 66 +++++++++++++------------- ccan/nfs/init.c | 2 +- ccan/nfs/libnfs-sync.c | 6 +-- ccan/nfs/libnfs.c | 6 +-- ccan/nfs/mount.c | 4 +- ccan/nfs/nfs.c | 4 +- ccan/nfs/{libnfs.h => nfs.h} | 0 ccan/nfs/nfsacl.c | 4 +- ccan/nfs/pdu.c | 2 +- ccan/nfs/portmap.c | 4 +- ccan/nfs/{ => rpc}/mount.x | 0 ccan/nfs/{ => rpc}/nfs.x | 0 ccan/nfs/{ => rpc}/nfsacl.x | 0 ccan/nfs/{ => rpc}/portmap.x | 0 ccan/nfs/socket.c | 2 +- ccan/nfs/{ => tools}/nfsclient-async.c | 2 +- ccan/nfs/{ => tools}/nfsclient-raw.c | 6 +-- ccan/nfs/{ => tools}/nfsclient-sync.c | 2 +- 18 files changed, 55 insertions(+), 55 deletions(-) rename ccan/nfs/{libnfs.h => nfs.h} (100%) rename ccan/nfs/{ => rpc}/mount.x (100%) rename ccan/nfs/{ => rpc}/nfs.x (100%) rename ccan/nfs/{ => rpc}/nfsacl.x (100%) rename ccan/nfs/{ => rpc}/portmap.x (100%) rename ccan/nfs/{ => tools}/nfsclient-async.c (99%) rename ccan/nfs/{ => tools}/nfsclient-raw.c (98%) rename ccan/nfs/{ => tools}/nfsclient-sync.c (99%) diff --git a/ccan/nfs/Makefile b/ccan/nfs/Makefile index f4425d7e..93f325bc 100644 --- a/ccan/nfs/Makefile +++ b/ccan/nfs/Makefile @@ -1,79 +1,79 @@ CC=gcc -CFLAGS=-g -O0 -Wall -W -I. "-D_U_=__attribute__((unused))" -D_FILE_OFFSET_BITS=64 +CFLAGS=-g -O0 -Wall -W -I../.. "-D_U_=__attribute__((unused))" -D_FILE_OFFSET_BITS=64 LIBS= LIBNFS_OBJ = libnfs-raw-mount.o libnfs-raw-portmap.o libnfs-raw-nfs.o libnfs-raw-nfsacl.o mount.o nfs.o nfsacl.o portmap.o pdu.o init.o socket.o libnfs.o libnfs-sync.o -all: nfsclient-raw nfsclient-async nfsclient-sync +all: tools/nfsclient-raw tools/nfsclient-async tools/nfsclient-sync -nfsclient-async: nfsclient-async.c libnfs.a - $(CC) -o $@ nfsclient-async.c libnfs.a $(LIBS) +tools/nfsclient-async: tools/nfsclient-async.c libnfs.a + $(CC) $(CFLAGS) -o $@ tools/nfsclient-async.c libnfs.a $(LIBS) -nfsclient-sync: nfsclient-sync.c libnfs.a - $(CC) -o $@ nfsclient-sync.c libnfs.a $(LIBS) +tools/nfsclient-sync: tools/nfsclient-sync.c libnfs.a + $(CC) $(CFLAGS) -o $@ tools/nfsclient-sync.c libnfs.a $(LIBS) -nfsclient-raw: nfsclient-raw.c libnfs.a - $(CC) -o $@ nfsclient-raw.c libnfs.a $(LIBS) +tools/nfsclient-raw: tools/nfsclient-raw.c libnfs.a + $(CC) $(CFLAGS) -o $@ tools/nfsclient-raw.c libnfs.a $(LIBS) libnfs.a: $(LIBNFS_OBJ) @echo Creating library $@ ar r libnfs.a $(LIBNFS_OBJ) ranlib libnfs.a -libnfs-raw-mount.h: mount.x +rpc/mount.h: rpc/mount.x @echo Generating $@ - rpcgen -h mount.x > libnfs-raw-mount.h + rpcgen -h rpc/mount.x > $@ -libnfs-raw-mount.c: mount.x +libnfs-raw-mount.c: rpc/mount.x @echo Generating $@ - rpcgen -c mount.x | sed -e "s/#include \"mount.h\"/#include \"libnfs-raw-mount.h\"/" > libnfs-raw-mount.c + rpcgen -c rpc/mount.x > libnfs-raw-mount.c -libnfs-raw-mount.o: libnfs-raw-mount.c libnfs-raw-mount.h +libnfs-raw-mount.o: libnfs-raw-mount.c rpc/mount.h @echo Compiling $@ gcc -g -c libnfs-raw-mount.c -o $@ -libnfs-raw-nfs.h: nfs.x +rpc/nfs.h: rpc/nfs.x @echo Generating $@ - rpcgen -h nfs.x > libnfs-raw-nfs.h + rpcgen -h rpc/nfs.x > $@ -libnfs-raw-nfs.c: nfs.x +libnfs-raw-nfs.c: rpc/nfs.x @echo Generating $@ - rpcgen -c nfs.x | sed -e "s/#include \"nfs.h\"/#include \"libnfs-raw-nfs.h\"/" > libnfs-raw-nfs.c + rpcgen -c rpc/nfs.x > $@ -libnfs-raw-nfs.o: libnfs-raw-nfs.c libnfs-raw-nfs.h +libnfs-raw-nfs.o: libnfs-raw-nfs.c rpc/nfs.h @echo Compiling $@ gcc -g -c libnfs-raw-nfs.c -o $@ -libnfs-raw-nfsacl.h: nfsacl.x +rpc/nfsacl.h: rpc/nfsacl.x @echo Generating $@ - rpcgen -h nfsacl.x > libnfs-raw-nfsacl.h + rpcgen -h rpc/nfsacl.x > $@ -libnfs-raw-nfsacl.c: nfsacl.x +libnfs-raw-nfsacl.c: rpc/nfsacl.x @echo Generating $@ - rpcgen -c nfsacl.x | sed -e "s/#include \"nfsacl.h\"/#include \"libnfs-raw-nfsacl.h\"/" > libnfs-raw-nfsacl.c + rpcgen -c rpc/nfsacl.x > $@ -libnfs-raw-nfsacl.o: libnfs-raw-nfsacl.c libnfs-raw-nfsacl.h +libnfs-raw-nfsacl.o: libnfs-raw-nfsacl.c rpc/nfsacl.h @echo Compiling $@ gcc -g -c libnfs-raw-nfsacl.c -o $@ -libnfs-raw-portmap.h: portmap.x +rpc/portmap.h: rpc/portmap.x @echo Generating $@ - rpcgen -h portmap.x > libnfs-raw-portmap.h + rpcgen -h rpc/portmap.x > $@ -libnfs-raw-portmap.c: portmap.x +libnfs-raw-portmap.c: rpc/portmap.x @echo Generating $@ - rpcgen -c portmap.x | sed -e "s/#include \"portmap.h\"/#include \"libnfs-raw-portmap.h\"/" > libnfs-raw-portmap.c + rpcgen -c rpc/portmap.x > $@ -libnfs-raw-portmap.o: libnfs-raw-portmap.c libnfs-raw-portmap.h +libnfs-raw-portmap.o: libnfs-raw-portmap.c rpc/portmap.h @echo Compiling $@ gcc -g -c libnfs-raw-portmap.c -o $@ clean: rm -f *.o rm -f *.a - rm -f libnfs-raw-mount.h libnfs-raw-mount.c - rm -f libnfs-raw-nfs.h libnfs-raw-nfs.c - rm -f libnfs-raw-nfsacl.h libnfs-raw-nfsacl.c - rm -f libnfs-raw-portmap.h libnfs-raw-portmap.c - rm -f nfsclient-raw nfsclient-async nfsclient-sync + rm -f rpc/mount.h libnfs-raw-mount.c + rm -f rpc/nfs.h libnfs-raw-nfs.c + rm -f rpc/nfsacl.h libnfs-raw-nfsacl.c + rm -f rpc/portmap.h libnfs-raw-portmap.c + rm -f tools/nfsclient-raw tools/nfsclient-async tools/nfsclient-sync diff --git a/ccan/nfs/init.c b/ccan/nfs/init.c index ae0c7878..9bc3c7e8 100644 --- a/ccan/nfs/init.c +++ b/ccan/nfs/init.c @@ -23,7 +23,7 @@ #include #include #include "dlinklist.h" -#include "libnfs.h" +#include "nfs.h" #include "libnfs-raw.h" #include "libnfs-private.h" diff --git a/ccan/nfs/libnfs-sync.c b/ccan/nfs/libnfs-sync.c index f8f98bc1..d6f58f4e 100644 --- a/ccan/nfs/libnfs-sync.c +++ b/ccan/nfs/libnfs-sync.c @@ -29,10 +29,10 @@ #include #include #include -#include "libnfs.h" +#include "nfs.h" #include "libnfs-raw.h" -#include "libnfs-raw-mount.h" -#include "libnfs-raw-nfs.h" +#include "rpc/mount.h" +#include "rpc/nfs.h" struct sync_cb_data { int is_finished; diff --git a/ccan/nfs/libnfs.c b/ccan/nfs/libnfs.c index d3257247..025b391d 100644 --- a/ccan/nfs/libnfs.c +++ b/ccan/nfs/libnfs.c @@ -29,10 +29,10 @@ #include #include #include -#include "libnfs.h" +#include "nfs.h" #include "libnfs-raw.h" -#include "libnfs-raw-mount.h" -#include "libnfs-raw-nfs.h" +#include "rpc/mount.h" +#include "rpc/nfs.h" struct nfsfh { struct nfs_fh3 fh; diff --git a/ccan/nfs/mount.c b/ccan/nfs/mount.c index 212eaedc..7c7ac7ec 100644 --- a/ccan/nfs/mount.c +++ b/ccan/nfs/mount.c @@ -18,10 +18,10 @@ #include #include #include -#include "libnfs.h" +#include "nfs.h" #include "libnfs-raw.h" #include "libnfs-private.h" -#include "libnfs-raw-mount.h" +#include "rpc/mount.h" int rpc_mount_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data) diff --git a/ccan/nfs/nfs.c b/ccan/nfs/nfs.c index 6d3e82f9..dd67be52 100644 --- a/ccan/nfs/nfs.c +++ b/ccan/nfs/nfs.c @@ -19,10 +19,10 @@ #include #include #include -#include "libnfs.h" +#include "nfs.h" #include "libnfs-raw.h" #include "libnfs-private.h" -#include "libnfs-raw-nfs.h" +#include "rpc/nfs.h" diff --git a/ccan/nfs/libnfs.h b/ccan/nfs/nfs.h similarity index 100% rename from ccan/nfs/libnfs.h rename to ccan/nfs/nfs.h diff --git a/ccan/nfs/nfsacl.c b/ccan/nfs/nfsacl.c index c1053340..71c72cd4 100644 --- a/ccan/nfs/nfsacl.c +++ b/ccan/nfs/nfsacl.c @@ -18,10 +18,10 @@ #include #include #include -#include "libnfs.h" +#include "nfs.h" #include "libnfs-raw.h" #include "libnfs-private.h" -#include "libnfs-raw-nfsacl.h" +#include "rpc/nfsacl.h" int rpc_nfsacl_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data) diff --git a/ccan/nfs/pdu.c b/ccan/nfs/pdu.c index 0f32d7e0..79c0392f 100644 --- a/ccan/nfs/pdu.c +++ b/ccan/nfs/pdu.c @@ -20,7 +20,7 @@ #include #include #include "dlinklist.h" -#include "libnfs.h" +#include "nfs.h" #include "libnfs-raw.h" #include "libnfs-private.h" diff --git a/ccan/nfs/portmap.c b/ccan/nfs/portmap.c index 269aded6..5753736e 100644 --- a/ccan/nfs/portmap.c +++ b/ccan/nfs/portmap.c @@ -17,10 +17,10 @@ #include #include -#include "libnfs.h" +#include "nfs.h" #include "libnfs-raw.h" #include "libnfs-private.h" -#include "libnfs-raw-portmap.h" +#include "rpc/portmap.h" int rpc_pmap_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data) diff --git a/ccan/nfs/mount.x b/ccan/nfs/rpc/mount.x similarity index 100% rename from ccan/nfs/mount.x rename to ccan/nfs/rpc/mount.x diff --git a/ccan/nfs/nfs.x b/ccan/nfs/rpc/nfs.x similarity index 100% rename from ccan/nfs/nfs.x rename to ccan/nfs/rpc/nfs.x diff --git a/ccan/nfs/nfsacl.x b/ccan/nfs/rpc/nfsacl.x similarity index 100% rename from ccan/nfs/nfsacl.x rename to ccan/nfs/rpc/nfsacl.x diff --git a/ccan/nfs/portmap.x b/ccan/nfs/rpc/portmap.x similarity index 100% rename from ccan/nfs/portmap.x rename to ccan/nfs/rpc/portmap.x diff --git a/ccan/nfs/socket.c b/ccan/nfs/socket.c index b1d0f292..ccdd18df 100644 --- a/ccan/nfs/socket.c +++ b/ccan/nfs/socket.c @@ -25,7 +25,7 @@ #include #include #include -#include "libnfs.h" +#include "nfs.h" #include "libnfs-raw.h" #include "libnfs-private.h" #include "dlinklist.h" diff --git a/ccan/nfs/nfsclient-async.c b/ccan/nfs/tools/nfsclient-async.c similarity index 99% rename from ccan/nfs/nfsclient-async.c rename to ccan/nfs/tools/nfsclient-async.c index 4abb901a..feb44781 100644 --- a/ccan/nfs/nfsclient-async.c +++ b/ccan/nfs/tools/nfsclient-async.c @@ -31,7 +31,7 @@ #include #include #include -#include "libnfs.h" +#include struct client { char *server; diff --git a/ccan/nfs/nfsclient-raw.c b/ccan/nfs/tools/nfsclient-raw.c similarity index 98% rename from ccan/nfs/nfsclient-raw.c rename to ccan/nfs/tools/nfsclient-raw.c index 4738bdf9..d9db3734 100644 --- a/ccan/nfs/nfsclient-raw.c +++ b/ccan/nfs/tools/nfsclient-raw.c @@ -25,9 +25,9 @@ #include #include #include -#include "libnfs.h" -#include "libnfs-raw.h" -#include "libnfs-raw-mount.h" +#include +#include +#include struct client { char *server; diff --git a/ccan/nfs/nfsclient-sync.c b/ccan/nfs/tools/nfsclient-sync.c similarity index 99% rename from ccan/nfs/nfsclient-sync.c rename to ccan/nfs/tools/nfsclient-sync.c index a9f5265b..e7621092 100644 --- a/ccan/nfs/nfsclient-sync.c +++ b/ccan/nfs/tools/nfsclient-sync.c @@ -33,7 +33,7 @@ #include #include #include -#include "libnfs.h" +#include #include /* for authunix_create() */ struct client { -- 2.39.2