From 8ceadc24da05133dfbf2ad9ec1d520605e27f01c Mon Sep 17 00:00:00 2001 From: Stepan Kasal Date: Tue, 15 May 2007 21:57:10 +0200 Subject: [PATCH] mount: kill mount_guess_rootdev It's not used. Signed-off-by: Stepan Kasal --- mount/Makefile.am | 3 +- mount/mount.c | 1 - mount/mount_guess_rootdev.c | 96 ------------------------------------- mount/mount_guess_rootdev.h | 1 - po/POTFILES.in | 1 - 5 files changed, 1 insertion(+), 101 deletions(-) delete mode 100644 mount/mount_guess_rootdev.c delete mode 100644 mount/mount_guess_rootdev.h diff --git a/mount/Makefile.am b/mount/Makefile.am index 96ecc323..1808930d 100644 --- a/mount/Makefile.am +++ b/mount/Makefile.am @@ -9,8 +9,7 @@ man_MANS = fstab.5 mount.8 swapoff.8 swapon.8 umount.8 losetup.8 MNTHDRS = fstab.h linux_fs.h mount_mntent.h mount_constants.h my_dev_t.h \ mount_paths.h get_label_uuid.h lomount.h mount_blkid.h \ mount_guess_fstype.h realpath.h xmalloc.h \ - getusername.h loop.h mount_by_label.h mount_guess_rootdev.h \ - sundries.h + getusername.h loop.h mount_by_label.h sundries.h mount_common = fstab.c sundries.c xmalloc.c realpath.c mount_mntent.c \ getusername.c get_label_uuid.c mount_by_label.c mount_blkid.c \ lomount.c $(MNTHDRS) ../lib/env.c diff --git a/mount/mount.c b/mount/mount.c index 5058a7ec..da210fb5 100644 --- a/mount/mount.c +++ b/mount/mount.c @@ -38,7 +38,6 @@ #include "lomount.h" #include "loop.h" #include "linux_fs.h" /* for BLKGETSIZE */ -#include "mount_guess_rootdev.h" #include "mount_guess_fstype.h" #include "mount_by_label.h" #include "getusername.h" diff --git a/mount/mount_guess_rootdev.c b/mount/mount_guess_rootdev.c deleted file mode 100644 index c0f0f503..00000000 --- a/mount/mount_guess_rootdev.c +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Having the wrong rootdevice listed in mtab is slightly inconvenient. - * Try to guess what it could be... - * In case /proc/cmdline exists, and has the format - * stuff root=R more stuff... - * and we think we understand the number R, decode it as a root device. - * - * Another possibility: - * Erik Andersen writes: - * I did a similar find_real_root_device_name() in busybox some time back. - * Basically, do a stat("/", &rootstat) then walk /dev stat'ing each file - * and if (statbuf.st_rdev == rootstat.st_rdev) then you have a match. - * Works fine. - */ -#include -#include -#include "mount_guess_rootdev.h" - -#define PROC_CMDLINE "/proc/cmdline" - -static char * -rootdev(char *p) { - unsigned long devno; - char *ep; - char *type = "hd"; - char let; - int ma, mi; - char devname[32]; - - devno = strtoul(p, &ep, 16); - if ((ep == p+3 || ep == p+4) && (*ep == ' ' || *ep == 0)) { - ma = (devno >> 8); - mi = (devno & 0xff); - switch(ma) { - case 8: - type = "sd"; - let = 'a'+(mi/16); - mi = mi%16; - break; - case 3: - let = 'a'; break; - case 0x16: - let = 'c'; break; - case 0x21: - let = 'e'; break; - case 0x22: - let = 'g'; break; - case 0x38: - let = 'i'; break; - case 0x39: - let = 'k'; break; - default: - return NULL; - } - if (mi & 0x40) { - mi -= 0x40; - let++; - } - if (mi == 0) - sprintf(devname, "/dev/%s%c", type, let); - else - sprintf(devname, "/dev/%s%c%d", type, let, mi); - return xstrdup(devname); - } - return NULL; -} - -char * -mount_guess_rootdev() { - FILE *cf; - char line[1024]; - char *p, *ret = NULL; - - cf = fopen(PROC_CMDLINE, "r"); - if (cf) { - if (fgets(line, sizeof(line), cf)) { - for (p = line; *p; p++) { - if (!strncmp(p, " root=", 6)) { - ret = rootdev(p+6); - break; - } - } - } - fclose(cf); - } - return ret; -} - -#if 0 -main(){ - char *p = mount_guess_rootdev(); - if (!p) - p = "/dev/root"; - printf("%s\n", p); -} -#endif diff --git a/mount/mount_guess_rootdev.h b/mount/mount_guess_rootdev.h deleted file mode 100644 index 41b32703..00000000 --- a/mount/mount_guess_rootdev.h +++ /dev/null @@ -1 +0,0 @@ -extern char *mount_guess_rootdev(void); diff --git a/po/POTFILES.in b/po/POTFILES.in index 6799f76a..c26153d7 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -68,7 +68,6 @@ mount/mount_blkid.c mount/mount_by_label.c mount/mount.c mount/mount_guess_fstype.c -mount/mount_guess_rootdev.c mount/mount_mntent.c mount/pivot_root.c mount/realpath.c -- 2.39.5