]> err.no Git - util-linux/commitdiff
mount: kill mount_guess_rootdev
authorStepan Kasal <skasal@redhat.com>
Tue, 15 May 2007 19:57:10 +0000 (21:57 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 16 May 2007 11:22:39 +0000 (13:22 +0200)
It's not used.

Signed-off-by: Stepan Kasal <skasal@redhat.com>
mount/Makefile.am
mount/mount.c
mount/mount_guess_rootdev.c [deleted file]
mount/mount_guess_rootdev.h [deleted file]
po/POTFILES.in

index 96ecc3238ddab82171be5eba045f6d631b5d2a94..1808930de040135860f76a3b795a45c645cab3ae 100644 (file)
@@ -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
index 5058a7ec77bb837ce6aaa94fe39d7745d1ff1d0b..da210fb5bc2dc93bbc26d9b4cbf83b5f7663417b 100644 (file)
@@ -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 (file)
index c0f0f50..0000000
+++ /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 <stdio.h>
-#include <string.h>
-#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 (file)
index 41b3270..0000000
+++ /dev/null
@@ -1 +0,0 @@
-extern char *mount_guess_rootdev(void);
index 6799f76a6a539b08fa3c7d5cac6b4b53658d0109..c26153d7ff2f7ef9c31b51af6ed90865a6f5db64 100644 (file)
@@ -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