[patch] merge mtab_file.c into messages.c and provide fstab_file

Bernhard Fischer rep.nop at aon.at
Fri Mar 31 12:34:34 PST 2006


On Thu, Mar 30, 2006 at 04:33:31PM -0500, Rob Landley wrote:
>On Thursday 30 March 2006 7:06 am, Bernhard Fischer wrote:
>> Hi,
>>
>> Attached patch merges libbb/mtab_file.c into libbb/messages.c
>> It also adds a bb_path_fstab_file and peruses it where apporpriate.
>>
>> If you apply this, please don't forget to svn rm libbb/mtab_file.c
>>
>> Objections or comments?
>
>-LIBBB_MOBJ0:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ0))
>-$(LIBBB_MOBJ0):$(LIBBB_MSRC0)
>+LIBBB_MOBJ0-$(CONFIG_FSCK)     += fstab_file.o
>+LIBBB_MOBJ0-$(CONFIG_MOUNT)    += fstab_file.o
>+LIBBB_MOBJ0-$(CONFIG_SWAPONOFF)        += fstab_file.o
>+LIBBB_MOBJ0-$(CONFIG_DF)       += mtab_file.o
>+LIBBB_MOBJ0-$(CONFIG_EJECT)    += mtab_file.o
>+LIBBB_MOBJ0-$(CONFIG_MOUNT)    += mtab_file.o
>+LIBBB_MOBJ0-$(CONFIG_UMOUNT)   += mtab_file.o
>+LIBBB_MOBJ0-y:=$(patsubst %,$(LIBBB_DIR)/%,$(sort $(LIBBB_MOBJ0-y)))
>+$(LIBBB_MOBJ0-y):$(LIBBB_MSRC0)
>        $(compile.c) -DL_$(notdir $*)
>
>Ok, I see that turning into exponential complexity really, really fast.  And 

Sigh. We can as well build it unconditionally, if you'd prefer that.

>it's the kind that bites users because if CONFIG_EJECT doesn't have the right 
>link to mtab_file.o but we're building CONFIG_DF so it gets built anyway, 
>then we won't hit it in testing.  (The losetup thing from before, only an 

We have that build-single-applet script which would catch stuff like
this if people are sloppy about simply grepping for the conditional
compiled symbol and depending on all occurances. But see below.

>order of magnitude worse.)  Plus just having this kind of huge table of 
>dependencies in the CONFIG file anyway is a bit unpleasant...
>
>I still have the dependency generation thing I was playing with in February.  
>Maybe I can autodetect this kind of dependency?  (If all the symbols that do 

That would be way cool. We wouldn't have to do all that stuff hardcoded in
the Makefiles, so this would of course be well received.

>this kind of thing are required to have a bb_ prefix I can do a really simple 
>whole-word search on the files...)

They don't currently all have bb_ prefixes, unfortunately. Let's see..

I have an busybox.enforce-usage-of-libbb.diff here, which was ment to
help people in porting new applets to use libbb. My list is
contained also these:

+ifeq ($(strip $(CONFIG_PORT_NEW_APPLET)),y)
+# OBJ1
+LIBBB_X_FUNCTIONS:= malloc realloc calloc 
+LIBBB_FUNCTIONS:= strlen
+LIBBB_BB_X_FUNCTIONS:= strdup strndup fopen open read ferror 
+# OBJ2
+LIBBB_BB_FUNCTIONS:= vfprintf fprintf printf
+# OBJ4
+LIBBB_SAFE_FUNCTIONS := strtoi strtod strtol
+# OBJ
+LIBBB_MY_FUNCTIONS:= getgrgid getgrnam getpwnam getpwuid
+LIBBB__FUNCTIONS:= asprintf


the my_*() are gone by now, IIRC.


>Or else we can use whatever markup in the files these things are generated 
>from to compile a search list.  Or force it to #include some special header 
>file that defines this symbol, or...

.. extract a full list from libbb.h, look for these symbols in the
selected applets via bb_mkdep and emit a dep for the respective .o
files, or..


More information about the busybox mailing list