Skip to contentSkip to conversation

Turn rpc_pipefs into a library

RFC New Daniel Phillips 1 participant 1 message Apr 5, 2006

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

RFC 1/1 Turn rpc_pipefs into a library

Hi,

Executive summary: rpc_pipefs is a one-off virtual filesystem Trond invented for connecting kernel components of nfs to userspace helpers. It provides a nice set of capabilities that I would like to use for my own project, which is to split nbd-server into a userspace server and a kernel transfer component. Rather than just forking rpc_pipefs I thought I would see if I could make a library out of it that can be used with a thin upper layer both in its current role and for my new application. This turned out to be pretty easy.

Changes are minimal:

* Pass various structures as parameters instead of using statics
* Add some temporary shims in rpc_pipe_fs.h to keep changes local
* Move generic rpc_pipe.c code to fs/pipefs.c module
* Move generic rpc_pipe_fs.h code to include/linux/pipefs.h
* Miscellaneous renames

Over 80% of the original rpc_pipe.c code turned out to be generic, leaving about 130 lines needed to define the specialized rpc interface.

I stopped here for comment, resisting the temptation to tackle the odd slight imperfection. For example, it is lucky that rpc never attempts to create any directories or pipes before userspace mounts the virtual filesystem, because they would have disappeared again immediately. This is easily fixed, but I thought I should see what people think of the effort so far. What do you think, does this seem to be heading in a useful direction?

Regards,

Daniel

 fs/Kconfig                         |   10
 fs/Makefile                        |    1
 fs/pipefs.c                        |  705 ++++++++++++++++++++++++++++++++
 include/linux/pipefs.h             |   63 ++
 include/linux/sunrpc/rpc_pipe_fs.h |   65 +-
 net/sunrpc/rpc_pipe.c              |  810 +------------------------------------
 6 files changed, 841 insertions(+), 813 deletions(-)
fs/Kconfig +10 -0
diff -urp 2.6.16.clean/fs/Kconfig 2.6.16/fs/Kconfig
@@ -859,6 +859,16 @@ config RAMFS
 	  To compile this as a module, choose M here: the module will be called
 	  ramfs.
 
+config PIPEFS
+	tristate "Pipefs filesystem support"
+	---help---
+	  Pipefs is a quick hack and who knows where its going
+
+	  To compile this code as a module, choose M here: the module will be
+	  called pipefs.
+
+	  If unsure, say N.
+
 config RELAYFS_FS
 	tristate "Relayfs file system support"
 	---help---
fs/Makefile +1 -0
diff -urp 2.6.16.clean/fs/Makefile 2.6.16/fs/Makefile
@@ -46,6 +46,7 @@ obj-$(CONFIG_PROC_FS)		+= proc/
 obj-y				+= partitions/
 obj-$(CONFIG_SYSFS)		+= sysfs/
 obj-y				+= devpts/
+obj-$(CONFIG_PIPEFS)		+= pipefs.o
 
 obj-$(CONFIG_PROFILING)		+= dcookies.o
  
fs/pipefs.c +705 -0

705 lines not on this page · raw message

include/linux/pipefs.h +63 -0

63 lines not on this page · raw message

include/linux/sunrpc/rpc_pipe_fs.h +25 -40

75 lines not on this page · raw message

net/sunrpc/rpc_pipe.c +37 -773

858 lines not on this page · raw message

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs