diff options
author | "Vladimir N. Oleynik" <dzo@simtreas.ru> | 2005-10-12 12:11:42 +0000 |
---|---|---|
committer | "Vladimir N. Oleynik" <dzo@simtreas.ru> | 2005-10-12 12:11:42 +0000 |
commit | ab57f76e13c00830fb8c3fe32dc210158abc5e91 (patch) | |
tree | f91ad789cad64c33d51c40981eca0e1dae1f259d /e2fsprogs | |
parent | 1c275de6a2b332d49355d02d3d8650aea33f1b87 (diff) | |
download | busybox-w32-ab57f76e13c00830fb8c3fe32dc210158abc5e91.tar.gz busybox-w32-ab57f76e13c00830fb8c3fe32dc210158abc5e91.tar.bz2 busybox-w32-ab57f76e13c00830fb8c3fe32dc210158abc5e91.zip |
more busyboxes, remove 1 extern function (mainstream also have for one fsck)
Diffstat (limited to 'e2fsprogs')
-rw-r--r-- | e2fsprogs/Makefile.in | 2 | ||||
-rw-r--r-- | e2fsprogs/base_device.c | 147 | ||||
-rw-r--r-- | e2fsprogs/blkid/read.c | 4 | ||||
-rw-r--r-- | e2fsprogs/e2fsbb.h | 3 | ||||
-rw-r--r-- | e2fsprogs/fsck.c | 137 | ||||
-rw-r--r-- | e2fsprogs/fsck.h | 3 | ||||
-rw-r--r-- | e2fsprogs/tune2fs.c | 3 | ||||
-rw-r--r-- | e2fsprogs/uuid/gen_uuid.c | 4 |
8 files changed, 140 insertions, 163 deletions
diff --git a/e2fsprogs/Makefile.in b/e2fsprogs/Makefile.in index 419b2c6a5..90aac6327 100644 --- a/e2fsprogs/Makefile.in +++ b/e2fsprogs/Makefile.in | |||
@@ -57,7 +57,7 @@ $(patsubst %,$(E2FSPROGS_DIR)/%, $(UUID_OBJS)):|$(E2FSPROGS_DIR)/uuid | |||
57 | E2FSPROGS-y:= | 57 | E2FSPROGS-y:= |
58 | E2FSPROGS-$(CONFIG_CHATTR) += chattr.o $(E2P_OBJS) | 58 | E2FSPROGS-$(CONFIG_CHATTR) += chattr.o $(E2P_OBJS) |
59 | E2FSPROGS-$(CONFIG_E2FSCK) += e2fsck.o util.o $(BLKID_OBJS) $(EXT2FS_OBJS) $(UUID_OBJS) | 59 | E2FSPROGS-$(CONFIG_E2FSCK) += e2fsck.o util.o $(BLKID_OBJS) $(EXT2FS_OBJS) $(UUID_OBJS) |
60 | E2FSPROGS-$(CONFIG_FSCK) += fsck.o base_device.o $(BLKID_OBJS) $(UUID_OBJS) | 60 | E2FSPROGS-$(CONFIG_FSCK) += fsck.o $(BLKID_OBJS) $(UUID_OBJS) |
61 | E2FSPROGS-$(CONFIG_LSATTR) += lsattr.o $(E2P_OBJS) | 61 | E2FSPROGS-$(CONFIG_LSATTR) += lsattr.o $(E2P_OBJS) |
62 | E2FSPROGS-$(CONFIG_MKE2FS) += mke2fs.o util.o $(E2P_OBJS) $(BLKID_OBJS) $(EXT2FS_OBJS) $(UUID_OBJS) | 62 | E2FSPROGS-$(CONFIG_MKE2FS) += mke2fs.o util.o $(E2P_OBJS) $(BLKID_OBJS) $(EXT2FS_OBJS) $(UUID_OBJS) |
63 | E2FSPROGS-$(CONFIG_TUNE2FS) += tune2fs.o util.o $(E2P_OBJS) $(BLKID_OBJS) $(EXT2FS_OBJS) $(UUID_OBJS) | 63 | 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 index d81bb0952..000000000 --- a/e2fsprogs/base_device.c +++ /dev/null | |||
@@ -1,147 +0,0 @@ | |||
1 | /* | ||
2 | * base_device.c | ||
3 | * | ||
4 | * Return the "base device" given a particular device; this is used to | ||
5 | * assure that we only fsck one partition on a particular drive at any | ||
6 | * one time. Otherwise, the disk heads will be seeking all over the | ||
7 | * place. If the base device can not be determined, return NULL. | ||
8 | * | ||
9 | * The base_device() function returns an allocated string which must | ||
10 | * be freed. | ||
11 | * | ||
12 | * Written by Theodore Ts'o, <tytso@mit.edu> | ||
13 | * | ||
14 | * Copyright (C) 2000 Theodore Ts'o. | ||
15 | * | ||
16 | * %Begin-Header% | ||
17 | * This file may be redistributed under the terms of the GNU Public | ||
18 | * License. | ||
19 | * %End-Header% | ||
20 | */ | ||
21 | #include <stdio.h> | ||
22 | #include <unistd.h> | ||
23 | #include <stdlib.h> | ||
24 | #include <ctype.h> | ||
25 | #include <string.h> | ||
26 | |||
27 | #include "busybox.h" | ||
28 | |||
29 | #ifdef CONFIG_FEATURE_DEVFS | ||
30 | /* | ||
31 | * Required for the uber-silly devfs /dev/ide/host1/bus2/target3/lun3 | ||
32 | * pathames. | ||
33 | */ | ||
34 | static const char *devfs_hier[] = { | ||
35 | "host", "bus", "target", "lun", 0 | ||
36 | }; | ||
37 | #endif | ||
38 | |||
39 | char *base_device(const char *device) | ||
40 | { | ||
41 | char *str, *cp; | ||
42 | #ifdef CONFIG_FEATURE_DEVFS | ||
43 | const char **hier, *disk; | ||
44 | int len; | ||
45 | #endif | ||
46 | |||
47 | cp = str = bb_xstrdup(device); | ||
48 | |||
49 | /* Skip over /dev/; if it's not present, give up. */ | ||
50 | if (strncmp(cp, "/dev/", 5) != 0) | ||
51 | goto errout; | ||
52 | cp += 5; | ||
53 | |||
54 | #if 0 /* this is for old stuff no one uses anymore ? */ | ||
55 | /* Skip over /dev/dsk/... */ | ||
56 | if (strncmp(cp, "dsk/", 4) == 0) | ||
57 | cp += 4; | ||
58 | #endif | ||
59 | |||
60 | /* | ||
61 | * For md devices, we treat them all as if they were all | ||
62 | * on one disk, since we don't know how to parallelize them. | ||
63 | */ | ||
64 | if (cp[0] == 'm' && cp[1] == 'd') { | ||
65 | *(cp+2) = 0; | ||
66 | return str; | ||
67 | } | ||
68 | |||
69 | /* Handle DAC 960 devices */ | ||
70 | if (strncmp(cp, "rd/", 3) == 0) { | ||
71 | cp += 3; | ||
72 | if (cp[0] != 'c' || cp[2] != 'd' || | ||
73 | !isdigit(cp[1]) || !isdigit(cp[3])) | ||
74 | goto errout; | ||
75 | *(cp+4) = 0; | ||
76 | return str; | ||
77 | } | ||
78 | |||
79 | /* Now let's handle /dev/hd* and /dev/sd* devices.... */ | ||
80 | if ((cp[0] == 'h' || cp[0] == 's') && (cp[1] == 'd')) { | ||
81 | cp += 2; | ||
82 | /* If there's a single number after /dev/hd, skip it */ | ||
83 | if (isdigit(*cp)) | ||
84 | cp++; | ||
85 | /* What follows must be an alpha char, or give up */ | ||
86 | if (!isalpha(*cp)) | ||
87 | goto errout; | ||
88 | *(cp + 1) = 0; | ||
89 | return str; | ||
90 | } | ||
91 | |||
92 | #ifdef CONFIG_FEATURE_DEVFS | ||
93 | /* Now let's handle devfs (ugh) names */ | ||
94 | len = 0; | ||
95 | if (strncmp(cp, "ide/", 4) == 0) | ||
96 | len = 4; | ||
97 | if (strncmp(cp, "scsi/", 5) == 0) | ||
98 | len = 5; | ||
99 | if (len) { | ||
100 | cp += len; | ||
101 | /* | ||
102 | * Now we proceed down the expected devfs hierarchy. | ||
103 | * i.e., .../host1/bus2/target3/lun4/... | ||
104 | * If we don't find the expected token, followed by | ||
105 | * some number of digits at each level, abort. | ||
106 | */ | ||
107 | for (hier = devfs_hier; *hier; hier++) { | ||
108 | len = strlen(*hier); | ||
109 | if (strncmp(cp, *hier, len) != 0) | ||
110 | goto errout; | ||
111 | cp += len; | ||
112 | while (*cp != '/' && *cp != 0) { | ||
113 | if (!isdigit(*cp)) | ||
114 | goto errout; | ||
115 | cp++; | ||
116 | } | ||
117 | cp++; | ||
118 | } | ||
119 | *(cp - 1) = 0; | ||
120 | return str; | ||
121 | } | ||
122 | |||
123 | /* Now handle devfs /dev/disc or /dev/disk names */ | ||
124 | disk = 0; | ||
125 | if (strncmp(cp, "discs/", 6) == 0) | ||
126 | disk = "disc"; | ||
127 | else if (strncmp(cp, "disks/", 6) == 0) | ||
128 | disk = "disk"; | ||
129 | if (disk) { | ||
130 | cp += 6; | ||
131 | if (strncmp(cp, disk, 4) != 0) | ||
132 | goto errout; | ||
133 | cp += 4; | ||
134 | while (*cp != '/' && *cp != 0) { | ||
135 | if (!isdigit(*cp)) | ||
136 | goto errout; | ||
137 | cp++; | ||
138 | } | ||
139 | *cp = 0; | ||
140 | return str; | ||
141 | } | ||
142 | #endif | ||
143 | |||
144 | errout: | ||
145 | free(str); | ||
146 | return NULL; | ||
147 | } | ||
diff --git a/e2fsprogs/blkid/read.c b/e2fsprogs/blkid/read.c index 36292ab13..78464145d 100644 --- a/e2fsprogs/blkid/read.c +++ b/e2fsprogs/blkid/read.c | |||
@@ -18,9 +18,7 @@ | |||
18 | #include <sys/stat.h> | 18 | #include <sys/stat.h> |
19 | #include <fcntl.h> | 19 | #include <fcntl.h> |
20 | #include <unistd.h> | 20 | #include <unistd.h> |
21 | #if HAVE_ERRNO_H | ||
22 | #include <errno.h> | 21 | #include <errno.h> |
23 | #endif | ||
24 | 22 | ||
25 | #include "blkidP.h" | 23 | #include "blkidP.h" |
26 | #include "../uuid/uuid.h" | 24 | #include "../uuid/uuid.h" |
@@ -33,9 +31,7 @@ | |||
33 | #define STRTOULL strtoul | 31 | #define STRTOULL strtoul |
34 | #endif | 32 | #endif |
35 | 33 | ||
36 | #if HAVE_STDLIB_H | ||
37 | #include <stdlib.h> | 34 | #include <stdlib.h> |
38 | #endif | ||
39 | 35 | ||
40 | /* | 36 | /* |
41 | * File format: | 37 | * File format: |
diff --git a/e2fsprogs/e2fsbb.h b/e2fsprogs/e2fsbb.h index 570d536f2..fe4241d1d 100644 --- a/e2fsprogs/e2fsbb.h +++ b/e2fsprogs/e2fsbb.h | |||
@@ -45,9 +45,6 @@ typedef long errcode_t; | |||
45 | #define HAVE_MNTENT_H 1 | 45 | #define HAVE_MNTENT_H 1 |
46 | #define HAVE_NETINET_IN_H 1 | 46 | #define HAVE_NETINET_IN_H 1 |
47 | #define HAVE_NET_IF_H 1 | 47 | #define HAVE_NET_IF_H 1 |
48 | #define HAVE_SETJMP_H 1 | ||
49 | #define HAVE_SIGNAL_H 1 | ||
50 | #define HAVE_STDLIB_H 1 | ||
51 | #define HAVE_SYS_IOCTL_H 1 | 48 | #define HAVE_SYS_IOCTL_H 1 |
52 | #define HAVE_SYS_MOUNT_H 1 | 49 | #define HAVE_SYS_MOUNT_H 1 |
53 | #define HAVE_SYS_QUEUE_H 1 | 50 | #define HAVE_SYS_QUEUE_H 1 |
diff --git a/e2fsprogs/fsck.c b/e2fsprogs/fsck.c index 93514a391..ec0c38b0b 100644 --- a/e2fsprogs/fsck.c +++ b/e2fsprogs/fsck.c | |||
@@ -47,10 +47,147 @@ | |||
47 | 47 | ||
48 | #include "e2fsbb.h" | 48 | #include "e2fsbb.h" |
49 | 49 | ||
50 | #include "busybox.h" | ||
51 | |||
50 | #ifndef _PATH_MNTTAB | 52 | #ifndef _PATH_MNTTAB |
51 | #define _PATH_MNTTAB "/etc/fstab" | 53 | #define _PATH_MNTTAB "/etc/fstab" |
52 | #endif | 54 | #endif |
53 | 55 | ||
56 | /* | ||
57 | * base_device.c | ||
58 | * | ||
59 | * Return the "base device" given a particular device; this is used to | ||
60 | * assure that we only fsck one partition on a particular drive at any | ||
61 | * one time. Otherwise, the disk heads will be seeking all over the | ||
62 | * place. If the base device can not be determined, return NULL. | ||
63 | * | ||
64 | * The base_device() function returns an allocated string which must | ||
65 | * be freed. | ||
66 | * | ||
67 | */ | ||
68 | |||
69 | |||
70 | #ifdef CONFIG_FEATURE_DEVFS | ||
71 | /* | ||
72 | * Required for the uber-silly devfs /dev/ide/host1/bus2/target3/lun3 | ||
73 | * pathames. | ||
74 | */ | ||
75 | static const char *devfs_hier[] = { | ||
76 | "host", "bus", "target", "lun", 0 | ||
77 | }; | ||
78 | #endif | ||
79 | |||
80 | static char *base_device(const char *device) | ||
81 | { | ||
82 | char *str, *cp; | ||
83 | #ifdef CONFIG_FEATURE_DEVFS | ||
84 | const char **hier, *disk; | ||
85 | int len; | ||
86 | #endif | ||
87 | |||
88 | cp = str = bb_xstrdup(device); | ||
89 | |||
90 | /* Skip over /dev/; if it's not present, give up. */ | ||
91 | if (strncmp(cp, "/dev/", 5) != 0) | ||
92 | goto errout; | ||
93 | cp += 5; | ||
94 | |||
95 | #if 0 /* this is for old stuff no one uses anymore ? */ | ||
96 | /* Skip over /dev/dsk/... */ | ||
97 | if (strncmp(cp, "dsk/", 4) == 0) | ||
98 | cp += 4; | ||
99 | #endif | ||
100 | |||
101 | /* | ||
102 | * For md devices, we treat them all as if they were all | ||
103 | * on one disk, since we don't know how to parallelize them. | ||
104 | */ | ||
105 | if (cp[0] == 'm' && cp[1] == 'd') { | ||
106 | *(cp+2) = 0; | ||
107 | return str; | ||
108 | } | ||
109 | |||
110 | /* Handle DAC 960 devices */ | ||
111 | if (strncmp(cp, "rd/", 3) == 0) { | ||
112 | cp += 3; | ||
113 | if (cp[0] != 'c' || cp[2] != 'd' || | ||
114 | !isdigit(cp[1]) || !isdigit(cp[3])) | ||
115 | goto errout; | ||
116 | *(cp+4) = 0; | ||
117 | return str; | ||
118 | } | ||
119 | |||
120 | /* Now let's handle /dev/hd* and /dev/sd* devices.... */ | ||
121 | if ((cp[0] == 'h' || cp[0] == 's') && (cp[1] == 'd')) { | ||
122 | cp += 2; | ||
123 | /* If there's a single number after /dev/hd, skip it */ | ||
124 | if (isdigit(*cp)) | ||
125 | cp++; | ||
126 | /* What follows must be an alpha char, or give up */ | ||
127 | if (!isalpha(*cp)) | ||
128 | goto errout; | ||
129 | *(cp + 1) = 0; | ||
130 | return str; | ||
131 | } | ||
132 | |||
133 | #ifdef CONFIG_FEATURE_DEVFS | ||
134 | /* Now let's handle devfs (ugh) names */ | ||
135 | len = 0; | ||
136 | if (strncmp(cp, "ide/", 4) == 0) | ||
137 | len = 4; | ||
138 | if (strncmp(cp, "scsi/", 5) == 0) | ||
139 | len = 5; | ||
140 | if (len) { | ||
141 | cp += len; | ||
142 | /* | ||
143 | * Now we proceed down the expected devfs hierarchy. | ||
144 | * i.e., .../host1/bus2/target3/lun4/... | ||
145 | * If we don't find the expected token, followed by | ||
146 | * some number of digits at each level, abort. | ||
147 | */ | ||
148 | for (hier = devfs_hier; *hier; hier++) { | ||
149 | len = strlen(*hier); | ||
150 | if (strncmp(cp, *hier, len) != 0) | ||
151 | goto errout; | ||
152 | cp += len; | ||
153 | while (*cp != '/' && *cp != 0) { | ||
154 | if (!isdigit(*cp)) | ||
155 | goto errout; | ||
156 | cp++; | ||
157 | } | ||
158 | cp++; | ||
159 | } | ||
160 | *(cp - 1) = 0; | ||
161 | return str; | ||
162 | } | ||
163 | |||
164 | /* Now handle devfs /dev/disc or /dev/disk names */ | ||
165 | disk = 0; | ||
166 | if (strncmp(cp, "discs/", 6) == 0) | ||
167 | disk = "disc"; | ||
168 | else if (strncmp(cp, "disks/", 6) == 0) | ||
169 | disk = "disk"; | ||
170 | if (disk) { | ||
171 | cp += 6; | ||
172 | if (strncmp(cp, disk, 4) != 0) | ||
173 | goto errout; | ||
174 | cp += 4; | ||
175 | while (*cp != '/' && *cp != 0) { | ||
176 | if (!isdigit(*cp)) | ||
177 | goto errout; | ||
178 | cp++; | ||
179 | } | ||
180 | *cp = 0; | ||
181 | return str; | ||
182 | } | ||
183 | #endif | ||
184 | |||
185 | errout: | ||
186 | free(str); | ||
187 | return NULL; | ||
188 | } | ||
189 | |||
190 | |||
54 | static const char * const ignored_types[] = { | 191 | static const char * const ignored_types[] = { |
55 | "ignore", | 192 | "ignore", |
56 | "iso9660", | 193 | "iso9660", |
diff --git a/e2fsprogs/fsck.h b/e2fsprogs/fsck.h index 59626122f..87914af3b 100644 --- a/e2fsprogs/fsck.h +++ b/e2fsprogs/fsck.h | |||
@@ -54,6 +54,3 @@ struct fsck_instance { | |||
54 | char * base_device; | 54 | char * base_device; |
55 | struct fsck_instance *next; | 55 | struct fsck_instance *next; |
56 | }; | 56 | }; |
57 | |||
58 | extern char *base_device(const char *device); | ||
59 | extern const char *identify_fs(const char *fs_name, const char *fs_types); | ||
diff --git a/e2fsprogs/tune2fs.c b/e2fsprogs/tune2fs.c index 0519c0981..e36c47734 100644 --- a/e2fsprogs/tune2fs.c +++ b/e2fsprogs/tune2fs.c | |||
@@ -25,13 +25,14 @@ | |||
25 | * 94/03/06 - Added the checks interval from Uwe Ohse (uwe@tirka.gun.de) | 25 | * 94/03/06 - Added the checks interval from Uwe Ohse (uwe@tirka.gun.de) |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include <sys/types.h> | ||
28 | #include <fcntl.h> | 29 | #include <fcntl.h> |
29 | #include <stdio.h> | 30 | #include <stdio.h> |
30 | #include <stdlib.h> | 31 | #include <stdlib.h> |
31 | #include <string.h> | 32 | #include <string.h> |
32 | #include <time.h> | 33 | #include <time.h> |
33 | #include <unistd.h> | 34 | #include <unistd.h> |
34 | #include <sys/types.h> | 35 | #include <getopt.h> |
35 | 36 | ||
36 | #include "e2fsbb.h" | 37 | #include "e2fsbb.h" |
37 | #include "ext2fs/ext2_fs.h" | 38 | #include "ext2fs/ext2_fs.h" |
diff --git a/e2fsprogs/uuid/gen_uuid.c b/e2fsprogs/uuid/gen_uuid.c index 489cdd2b9..52328cfc4 100644 --- a/e2fsprogs/uuid/gen_uuid.c +++ b/e2fsprogs/uuid/gen_uuid.c | |||
@@ -32,12 +32,8 @@ | |||
32 | * %End-Header% | 32 | * %End-Header% |
33 | */ | 33 | */ |
34 | 34 | ||
35 | #ifdef HAVE_UNISTD_H | ||
36 | #include <unistd.h> | 35 | #include <unistd.h> |
37 | #endif | ||
38 | #ifdef HAVE_STDLIB_H | ||
39 | #include <stdlib.h> | 36 | #include <stdlib.h> |
40 | #endif | ||
41 | #include <string.h> | 37 | #include <string.h> |
42 | #include <fcntl.h> | 38 | #include <fcntl.h> |
43 | #include <errno.h> | 39 | #include <errno.h> |