[PATCH] guess_fstype applet

Isaac Dunham ibid.ag at gmail.com
Wed Feb 11 19:32:24 UTC 2015


On Wed, Feb 11, 2015 at 07:50:49PM +0100, Tanguy Pruvot wrote:
> 2015-02-11 19:48 GMT+01:00 Denys Vlasenko <vda.linux at googlemail.com>:
> 
> > On Fri, Feb 6, 2015 at 5:35 PM, Tanguy Pruvot <tanguy.pruvot at gmail.com>
> > wrote:
> > > From CyanogenMod :
> > >
> > > http://review.cyanogenmod.org/#/c/87995/
> > >
> > > 2013-08-23 6:20 GMT+02:00 James B <jamesbond3142 at gmail.com>:
> > >>
> > >> If the interface can be simplifed to detect filesystem only (instead
> > >> of also looking for labels and UUID) I think I think it would get an
> > >> order of magnitude speed-up (taking the cues from Puppy Linux's
> > >> original guess_fstype which basically does just that). I'm not so sure
> > >> about code-size reduction, though.
> > >>
> > >> It is called guess_fstype for historical reason (because that's how it
> > >> was used and called in Puppy Linux), I'm happy to change it to
> > >> "fstype" if that helps everybody else :)
> >
> > I'm confused.
> > Is here something proposed for inclusion into busybox,
> > or you are now talking about hacks for a particular project only?
>
> its a feature to enhance the auto mount with blkid code... we are about to
> merge this commit soon in CM12

Comments:
- do NOT let code override a user specification.
If I specify -t (ntfs|ntfs-3g) or (msdos|vfat) manually, it should force
mount to try mounting using that specific driver and then *fail* if
it's impossible.
If fstype overrides user specifications, you may end up breaking future
filesystems.
I would think that this would be better:
	// Treat fstype "auto" as unspecified
	if (mp->mnt_type && strcmp(mp->mnt_type, "auto") == 0)
		mp->mnt_type = NULL;
+#if ENABLE_FEATURE_BLKID_TYPE
+	// try to to autodetect type
+	if (!mp->mnt_type)
+		mp->mnt_type = get_fstype_from_devname(mp->mnt_fsname);
#endif

OTOH, if I specify -t auto and userspace code selects the wrong fs type
(as it surely will, because bugs and unexpected inputs happen...),
it would be proper for mount to keep retrying, as would be done if
mp->mnt_type is unset after the new code.

- I'm guessing that the use of != to compare two strings is a mistake?
+	|| (detected_fstype != NULL && detected_fstype != mp->mnt_type))

- guess_fstype, fstype, blkid commands:
 guess_fstype is the name that Puppy Linux has used for a command that
 outputs filesystem type without label/uuid.
 fstype is the name that it goes by in Toybox, which is now in Android.
 However, upstream Android turns it off and just uses blkid.

HTH,
Isaac Dunham


More information about the busybox mailing list