diff --git a/include/volume_id.h b/include/volume_id.h index e639e1f14..263865634 100644 --- a/include/volume_id.h +++ b/include/volume_id.h @@ -17,16 +17,16 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +int FAST_FUNC add_to_uuid_cache(const char *device); +void FAST_FUNC display_uuid_cache(int scan_devices); -char *get_devname_from_label(const char *spec); -char *get_devname_from_uuid(const char *spec); -void display_uuid_cache(int scan_devices); - +//static: char *get_devname_from_label(const char *spec); +//static: char *get_devname_from_uuid(const char *spec); /* Returns: * 0: no UUID= or LABEL= prefix found * 1: UUID= or LABEL= prefix found. In this case, * *fsname is replaced if device with such UUID or LABEL is found. * The new string is malloced. The old string is NOT freed! + * *fsname is NOT replaced in "LABEL=notfound" case! [FIXME: return 2 in this case to make distinguishable?] */ -int resolve_mount_spec(char **fsname); -int add_to_uuid_cache(const char *device); +int FAST_FUNC resolve_mount_spec(char **fsname); diff --git a/util-linux/findfs.c b/util-linux/findfs.c index 372c75dee..0a62afeed 100644 --- a/util-linux/findfs.c +++ b/util-linux/findfs.c @@ -47,12 +47,13 @@ int findfs_main(int argc UNUSED_PARAM, char **argv) /* Otherwise, handle LABEL=xxx and UUID=xxx, * fail on anything else */ if (!resolve_mount_spec(argv)) - bb_show_usage(); + bb_show_usage(); /* not in LABEL= or UUID= form */ } if (*argv != dev) { puts(*argv); return 0; } + // util-linux 2.41.1 says: "findfs: unable to resolve 'LABEL=bogus'" return 1; } diff --git a/util-linux/volume_id/get_devname.c b/util-linux/volume_id/get_devname.c index 52bb8e03a..69b4dddd7 100644 --- a/util-linux/volume_id/get_devname.c +++ b/util-linux/volume_id/get_devname.c @@ -230,7 +230,8 @@ get_spec_by_volume_label(const char *s, int *major, int *minor) #endif // UNUSED /* Used by blkid */ -void display_uuid_cache(int scan_devices) + +void FAST_FUNC display_uuid_cache(int scan_devices) { struct uuidCache_s *uc; @@ -250,7 +251,7 @@ void display_uuid_cache(int scan_devices) } } -int add_to_uuid_cache(const char *device) +int FAST_FUNC add_to_uuid_cache(const char *device) { char *uuid = uuid; /* for compiler */ char *label = label; @@ -272,10 +273,8 @@ int add_to_uuid_cache(const char *device) return 0; } - -/* Used by mount and findfs */ - -char *get_devname_from_label(const char *spec) +/* Used by mount, findfs, swapon, fsck */ +static char *get_devname_from_label(const char *spec) { struct uuidCache_s *uc; @@ -288,8 +287,7 @@ char *get_devname_from_label(const char *spec) } return NULL; } - -char *get_devname_from_uuid(const char *spec) +static char *get_devname_from_uuid(const char *spec) { struct uuidCache_s *uc; @@ -303,15 +301,14 @@ char *get_devname_from_uuid(const char *spec) } return NULL; } - -int resolve_mount_spec(char **fsname) +int FAST_FUNC resolve_mount_spec(char **fsname) { char *tmp = *fsname; - if (is_prefixed_with(*fsname, "UUID=")) - tmp = get_devname_from_uuid(*fsname + 5); - else if (is_prefixed_with(*fsname, "LABEL=")) - tmp = get_devname_from_label(*fsname + 6); + if (is_prefixed_with(tmp, "UUID=")) + tmp = get_devname_from_uuid(tmp + 5); + else if (is_prefixed_with(tmp, "LABEL=")) + tmp = get_devname_from_label(tmp + 6); if (tmp == *fsname) return 0; /* no UUID= or LABEL= prefix found */