[PATCH] guess_fstype applet

Ralf Friedl Ralf.Friedl at online.de
Wed Aug 21 10:26:59 UTC 2013


James B wrote:
> klibc has "fstype" binary to detect filesystem types during boot time.
> util-linux mount has "mount -guess-fstype" to do the same.
Why not use printf? It's already used in busybox, so it wont be included 
just for this applet. I'm sure it would also make the code shorter. (I 
do hope that the compiler can optimize out the calls to strlen for the 
constant strings.)

How about this:
char const *type;
if ((!volume_id_probe_all (id, 0)) && id->type)
   type = id->type;
else {
   type = "unknown";
   retcode = 1;
}
if (argc > 2)
   printf ("%s: ", argv[0]);
printf ("%s\n", type);


More information about the busybox mailing list