more busyboxes, remove 1 extern function (mainstream also have for one fsck)
author"Vladimir N. Oleynik" <dzo@simtreas.ru>
Wed, 12 Oct 2005 12:11:42 +0000 (12:11 -0000)
committer"Vladimir N. Oleynik" <dzo@simtreas.ru>
Wed, 12 Oct 2005 12:11:42 +0000 (12:11 -0000)
e2fsprogs/Makefile.in
e2fsprogs/base_device.c [deleted file]
e2fsprogs/blkid/read.c
e2fsprogs/e2fsbb.h
e2fsprogs/fsck.c
e2fsprogs/fsck.h
e2fsprogs/tune2fs.c
e2fsprogs/uuid/gen_uuid.c

index 419b2c6a545fa414b3e161597f5b4ddeec46ff3b..90aac632767cc26f1289d756afa7bda4903b95e9 100644 (file)
@@ -57,7 +57,7 @@ $(patsubst %,$(E2FSPROGS_DIR)/%, $(UUID_OBJS)):|$(E2FSPROGS_DIR)/uuid
 E2FSPROGS-y:=
 E2FSPROGS-$(CONFIG_CHATTR)     += chattr.o $(E2P_OBJS)
 E2FSPROGS-$(CONFIG_E2FSCK)     += e2fsck.o util.o $(BLKID_OBJS) $(EXT2FS_OBJS) $(UUID_OBJS)
-E2FSPROGS-$(CONFIG_FSCK)       += fsck.o base_device.o $(BLKID_OBJS) $(UUID_OBJS)
+E2FSPROGS-$(CONFIG_FSCK)       += fsck.o $(BLKID_OBJS) $(UUID_OBJS)
 E2FSPROGS-$(CONFIG_LSATTR)     += lsattr.o $(E2P_OBJS)
 E2FSPROGS-$(CONFIG_MKE2FS)     += mke2fs.o util.o $(E2P_OBJS) $(BLKID_OBJS) $(EXT2FS_OBJS) $(UUID_OBJS)
 E2FSPROGS-$(CONFIG_TUNE2FS)    += tune2fs.o util.o $(E2P_OBJS) $(BLKID_OBJS) $(EXT2FS_OBJS) $(UUID_OBJS)
diff --git a/e2fsprogs/base_device.c b/e2fsprogs/base_device.c
deleted file mode 100644 (file)
index d81bb09..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * base_device.c
- *
- * Return the "base device" given a particular device; this is used to
- * assure that we only fsck one partition on a particular drive at any
- * one time.  Otherwise, the disk heads will be seeking all over the
- * place.  If the base device can not be determined, return NULL.
- * 
- * The base_device() function returns an allocated string which must
- * be freed.
- * 
- * Written by Theodore Ts'o, <tytso@mit.edu>
- * 
- * Copyright (C) 2000 Theodore Ts'o.
- *
- * %Begin-Header%
- * This file may be redistributed under the terms of the GNU Public
- * License.
- * %End-Header%
- */
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <string.h>
-
-#include "busybox.h"
-
-#ifdef CONFIG_FEATURE_DEVFS
-/*
- * Required for the uber-silly devfs /dev/ide/host1/bus2/target3/lun3
- * pathames.
- */
-static const char *devfs_hier[] = {
-       "host", "bus", "target", "lun", 0
-};
-#endif
-
-char *base_device(const char *device)
-{
-       char *str, *cp;
-#ifdef CONFIG_FEATURE_DEVFS
-       const char **hier, *disk;
-       int len;
-#endif
-
-       cp = str = bb_xstrdup(device);
-
-       /* Skip over /dev/; if it's not present, give up. */
-       if (strncmp(cp, "/dev/", 5) != 0)
-               goto errout;
-       cp += 5;
-
-#if 0  /* this is for old stuff no one uses anymore ? */
-       /* Skip over /dev/dsk/... */
-       if (strncmp(cp, "dsk/", 4) == 0)
-               cp += 4;
-#endif
-
-       /*
-        * For md devices, we treat them all as if they were all
-        * on one disk, since we don't know how to parallelize them.
-        */
-       if (cp[0] == 'm' && cp[1] == 'd') {
-               *(cp+2) = 0;
-               return str;
-       }
-
-       /* Handle DAC 960 devices */
-       if (strncmp(cp, "rd/", 3) == 0) {
-               cp += 3;
-               if (cp[0] != 'c' || cp[2] != 'd' ||
-                   !isdigit(cp[1]) || !isdigit(cp[3]))
-                       goto errout;
-               *(cp+4) = 0;
-               return str;
-       }
-
-       /* Now let's handle /dev/hd* and /dev/sd* devices.... */
-       if ((cp[0] == 'h' || cp[0] == 's') && (cp[1] == 'd')) {
-               cp += 2;
-               /* If there's a single number after /dev/hd, skip it */
-               if (isdigit(*cp))
-                       cp++;
-               /* What follows must be an alpha char, or give up */
-               if (!isalpha(*cp))
-                       goto errout;
-               *(cp + 1) = 0;
-               return str;
-       }
-
-#ifdef CONFIG_FEATURE_DEVFS
-       /* Now let's handle devfs (ugh) names */
-       len = 0;
-       if (strncmp(cp, "ide/", 4) == 0)
-               len = 4;
-       if (strncmp(cp, "scsi/", 5) == 0)
-               len = 5;
-       if (len) {
-               cp += len;
-               /*
-                * Now we proceed down the expected devfs hierarchy.
-                * i.e., .../host1/bus2/target3/lun4/...
-                * If we don't find the expected token, followed by
-                * some number of digits at each level, abort.
-                */
-               for (hier = devfs_hier; *hier; hier++) {
-                       len = strlen(*hier);
-                       if (strncmp(cp, *hier, len) != 0)
-                               goto errout;
-                       cp += len;
-                       while (*cp != '/' && *cp != 0) {
-                               if (!isdigit(*cp))
-                                       goto errout;
-                               cp++;
-                       }
-                       cp++;
-               }
-               *(cp - 1) = 0;
-               return str;
-       }
-
-       /* Now handle devfs /dev/disc or /dev/disk names */
-       disk = 0;
-       if (strncmp(cp, "discs/", 6) == 0)
-               disk = "disc";
-       else if (strncmp(cp, "disks/", 6) == 0)
-               disk = "disk";
-       if (disk) {
-               cp += 6;
-               if (strncmp(cp, disk, 4) != 0)
-                       goto errout;
-               cp += 4;
-               while (*cp != '/' && *cp != 0) {
-                       if (!isdigit(*cp))
-                               goto errout;
-                       cp++;
-               }
-               *cp = 0;
-               return str;
-       }
-#endif
-
-errout:
-       free(str);
-       return NULL;
-}
index 36292ab135e45ef10c9f86e7ef1b450448090313..78464145d54b6267269d16cd7496a04c5d058892 100644 (file)
@@ -18,9 +18,7 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <unistd.h>
-#if HAVE_ERRNO_H
 #include <errno.h>
-#endif
 
 #include "blkidP.h"
 #include "../uuid/uuid.h"
@@ -33,9 +31,7 @@
 #define STRTOULL strtoul
 #endif
 
-#if HAVE_STDLIB_H
 #include <stdlib.h>
-#endif
 
 /*
  * File format:
index 570d536f25ad0564ecadcadce6ddc741704849ad..fe4241d1dc952c33794aefaae7eaef06d0583930 100644 (file)
@@ -45,9 +45,6 @@ typedef long errcode_t;
 #define HAVE_MNTENT_H 1
 #define HAVE_NETINET_IN_H 1
 #define HAVE_NET_IF_H 1
-#define HAVE_SETJMP_H 1
-#define HAVE_SIGNAL_H 1
-#define HAVE_STDLIB_H 1
 #define HAVE_SYS_IOCTL_H 1
 #define HAVE_SYS_MOUNT_H 1
 #define HAVE_SYS_QUEUE_H 1
index 93514a3912991da4c7a07541dc818c4c0b1a17ea..ec0c38b0bf83dd9cdf6cbbf86f1d5ff35f2c07e0 100644 (file)
 
 #include "e2fsbb.h"
 
+#include "busybox.h"
+
 #ifndef _PATH_MNTTAB
 #define _PATH_MNTTAB    "/etc/fstab"
 #endif
 
+/*
+ * base_device.c
+ *
+ * Return the "base device" given a particular device; this is used to
+ * assure that we only fsck one partition on a particular drive at any
+ * one time.  Otherwise, the disk heads will be seeking all over the
+ * place.  If the base device can not be determined, return NULL.
+ * 
+ * The base_device() function returns an allocated string which must
+ * be freed.
+ * 
+ */
+
+
+#ifdef CONFIG_FEATURE_DEVFS
+/*
+ * Required for the uber-silly devfs /dev/ide/host1/bus2/target3/lun3
+ * pathames.
+ */
+static const char *devfs_hier[] = {
+       "host", "bus", "target", "lun", 0
+};
+#endif
+
+static char *base_device(const char *device)
+{
+       char *str, *cp;
+#ifdef CONFIG_FEATURE_DEVFS
+       const char **hier, *disk;
+       int len;
+#endif
+
+       cp = str = bb_xstrdup(device);
+
+       /* Skip over /dev/; if it's not present, give up. */
+       if (strncmp(cp, "/dev/", 5) != 0)
+               goto errout;
+       cp += 5;
+
+#if 0  /* this is for old stuff no one uses anymore ? */
+       /* Skip over /dev/dsk/... */
+       if (strncmp(cp, "dsk/", 4) == 0)
+               cp += 4;
+#endif
+
+       /*
+        * For md devices, we treat them all as if they were all
+        * on one disk, since we don't know how to parallelize them.
+        */
+       if (cp[0] == 'm' && cp[1] == 'd') {
+               *(cp+2) = 0;
+               return str;
+       }
+
+       /* Handle DAC 960 devices */
+       if (strncmp(cp, "rd/", 3) == 0) {
+               cp += 3;
+               if (cp[0] != 'c' || cp[2] != 'd' ||
+                   !isdigit(cp[1]) || !isdigit(cp[3]))
+                       goto errout;
+               *(cp+4) = 0;
+               return str;
+       }
+
+       /* Now let's handle /dev/hd* and /dev/sd* devices.... */
+       if ((cp[0] == 'h' || cp[0] == 's') && (cp[1] == 'd')) {
+               cp += 2;
+               /* If there's a single number after /dev/hd, skip it */
+               if (isdigit(*cp))
+                       cp++;
+               /* What follows must be an alpha char, or give up */
+               if (!isalpha(*cp))
+                       goto errout;
+               *(cp + 1) = 0;
+               return str;
+       }
+
+#ifdef CONFIG_FEATURE_DEVFS
+       /* Now let's handle devfs (ugh) names */
+       len = 0;
+       if (strncmp(cp, "ide/", 4) == 0)
+               len = 4;
+       if (strncmp(cp, "scsi/", 5) == 0)
+               len = 5;
+       if (len) {
+               cp += len;
+               /*
+                * Now we proceed down the expected devfs hierarchy.
+                * i.e., .../host1/bus2/target3/lun4/...
+                * If we don't find the expected token, followed by
+                * some number of digits at each level, abort.
+                */
+               for (hier = devfs_hier; *hier; hier++) {
+                       len = strlen(*hier);
+                       if (strncmp(cp, *hier, len) != 0)
+                               goto errout;
+                       cp += len;
+                       while (*cp != '/' && *cp != 0) {
+                               if (!isdigit(*cp))
+                                       goto errout;
+                               cp++;
+                       }
+                       cp++;
+               }
+               *(cp - 1) = 0;
+               return str;
+       }
+
+       /* Now handle devfs /dev/disc or /dev/disk names */
+       disk = 0;
+       if (strncmp(cp, "discs/", 6) == 0)
+               disk = "disc";
+       else if (strncmp(cp, "disks/", 6) == 0)
+               disk = "disk";
+       if (disk) {
+               cp += 6;
+               if (strncmp(cp, disk, 4) != 0)
+                       goto errout;
+               cp += 4;
+               while (*cp != '/' && *cp != 0) {
+                       if (!isdigit(*cp))
+                               goto errout;
+                       cp++;
+               }
+               *cp = 0;
+               return str;
+       }
+#endif
+
+errout:
+       free(str);
+       return NULL;
+}
+
+
 static const char * const ignored_types[] = {
        "ignore",
        "iso9660",
index 59626122f1c11af5276d426ae8712318738383b5..87914af3b1296a9848e858999e3ebf1859becc98 100644 (file)
@@ -54,6 +54,3 @@ struct fsck_instance {
        char *  base_device;
        struct fsck_instance *next;
 };
-
-extern char *base_device(const char *device);
-extern const char *identify_fs(const char *fs_name, const char *fs_types);
index 0519c09812828bf6caf752e24ad02d64ded98ba8..e36c47734105258a03f2eb5b74db441f85da127a 100644 (file)
  * 94/03/06    - Added the checks interval from Uwe Ohse (uwe@tirka.gun.de)
  */
 
+#include <sys/types.h>
 #include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
 #include <unistd.h>
-#include <sys/types.h>
+#include <getopt.h>
 
 #include "e2fsbb.h"
 #include "ext2fs/ext2_fs.h"
index 489cdd2b9c8fb9c4ce31f3ad2c058f36ff0dacf8..52328cfc42535d3ff4ef815f9135333900c6c484 100644 (file)
  * %End-Header%
  */
 
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
-#ifdef HAVE_STDLIB_H
 #include <stdlib.h>
-#endif
 #include <string.h>
 #include <fcntl.h>
 #include <errno.h>