[uClibc]Patch to make devfsd 1.3.25 compile with uClibc

Erik Andersen andersen at codepoet.org
Tue Feb 11 09:02:34 UTC 2003


On Mon Feb 10, 2003 at 07:07:18PM -0500, Thomas Cameron wrote:
>    I will agree with Erik that devfs is an evil hack to a simple 
> problem, but the real question should be "Who is willing to write a good 
> replacement".  I'd be willing to test a replacement, if any exist, but 

I did not say that "devfs is an evil hack".  That particular
flame fest has been well played out on the Linux kernel mailing
list and I'd rather not have a repeat here. 

What I said was that using the NIS code as a mechanism to store
and retrieve devfsd configuration data is an evil hack.  And I
am right.  :)

> it would have to offer the same level of use.  Simply put, devfs saves 
> space in a file system image by not requiring inodes, etc. from the 
> filesystem.  This is important.  Additionally, it allows a user to add a 
> device to the system, and not have to know how to use `mknod`, or what 
> parameters to use.

dude, I wasn't talking about the merits of devfs...  If you
really want to discuss the relative merits of devfs on embedded
systems, email me privately not on the list.

Regardless, mostly because I think Ross deserves to be treated
nicely, I whipped up a quick patch vs devfsd-1.3.25 so it now
compiles with uClibc.  I've not tried it (as I don't personally
use devfs) but it at least compiles and I see no reason why it
shouldn't work.

Have fun.

diff -urN devfsd-1.3.25.orig/GNUmakefile devfsd-1.3.25/GNUmakefile
--- devfsd-1.3.25.orig/GNUmakefile	2003-02-11 01:44:48.000000000 -0700
+++ devfsd-1.3.25/GNUmakefile	2003-02-11 01:52:02.000000000 -0700
@@ -1,3 +1,7 @@
+#Do you want to enable use of libnsl?
+ENABLE_NSL:=false
+
+
 PREFIX      =
 SBINDIR     = $(PREFIX)/sbin
 MANDIR      = $(PREFIX)/usr/share/man
@@ -8,10 +12,12 @@
 KERNEL_DIR  = /usr/src/linux
 endif
 
+ifeq ($(strip $(ENABLE_NSL)),true)
 nsl_libs := $(wildcard /lib/libnsl.so.*)
 ifneq ($(nsl_libs),)
 LIBNSL      = $(shell for file in /lib/libnsl.so.[0-9]* ; do echo $$file ; done | sort -t . -n -k 2 | head -1)
-DEFINES     += -DLIBNSL="\"$(LIBNSL)\""
+DEFINES     += -DENABLE_NSL -DLIBNSL="\"$(LIBNSL)\""
+endif
 endif
 
 
diff -urN devfsd-1.3.25.orig/devfsd.c devfsd-1.3.25/devfsd.c
--- devfsd-1.3.25.orig/devfsd.c	2003-02-11 01:44:48.000000000 -0700
+++ devfsd-1.3.25/devfsd.c	2003-02-11 01:53:15.000000000 -0700
@@ -283,8 +283,10 @@
 #include <regex.h>
 #include <errno.h>
 #include <dlfcn.h>
+#ifdef ENABLE_NSL
 #include <rpcsvc/ypclnt.h>
 #include <rpcsvc/yp_prot.h>
+#endif
 #include <karma.h>
 #include "devfsd.h"
 #include "version.h"
@@ -418,9 +420,11 @@
 			      unsigned long *event_mask);
 static void process_config_line (CONST char *line, unsigned long *event_mask);
 static void *dlsym_nofail (const char *file, void *handle, char *symbol);
+#ifdef ENABLE_NSL
 static int process_yp_line (int instatus, char *inkey, int inkeylen,
 			    char *inval, int invallen, char *indata);
 static void load_libnsl (void);
+#endif
 static flag do_servicing (int fd, unsigned long event_mask);
 static void service_name (const struct devfsd_notify_struct *info);
 static void action_permissions (const struct devfsd_notify_struct *info,
@@ -490,10 +494,12 @@
     {"fd/2", "stderr"},
     {NULL, NULL},
 };
+#ifdef ENABLE_NSL
 static int (*my_yp_all) (const char *, const char *,
 				         const struct ypall_callback *); /* = NULL */
 
 static int (*my_yp_get_default_domain) (char **domainptr); /* = NULL */
+#endif
 static struct event_type
 {
     unsigned int type;        /*  The DEVFSD_NOTIFY_* value                  */
@@ -719,6 +725,7 @@
     [RETURNS] Nothing.
 */
 {
+#ifdef ENABLE_NSL
     if (location[0] == '+')
     {
 	/*  It's a YP map  */
@@ -741,6 +748,7 @@
 	SYSLOG (LOG_ERR, "error reading map: \"%s\"\n", location + 1);
 	exit (1);
     }
+#endif
     read_config_file (location, optional, event_mask);
 }   /*  End Function read_config   */
 
@@ -1049,6 +1057,7 @@
     return (result);
 }   /*  End Function dlsym_nofail  */
 
+#ifdef ENABLE_NSL
 static void load_libnsl (void)
 {
 #ifdef LIBNSL  /*  It comes from a shared object  */
@@ -1077,6 +1086,7 @@
     if (invallen > 0) process_config_line (inval, (unsigned long *) indata);
     return (0);
 }   /*  End Function process_yp_line  */
+#endif
 
 static flag do_servicing (int fd, unsigned long event_mask)
 /*  [SUMMARY] Service devfs changes until a signal is received.

 -Erik

--
Erik B. Andersen             http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--



More information about the uClibc mailing list