diff options
author | landley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-05-21 18:33:27 +0000 |
---|---|---|
committer | landley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-05-21 18:33:27 +0000 |
commit | c42021ab2f33fe4be99686d5c002418c861c35a7 (patch) | |
tree | ab9c5cf47898578428ae305e870a1c5a3da5fc89 | |
parent | 8f30399d9a813414e47d89bed9efbc9e84ae697d (diff) | |
download | busybox-w32-c42021ab2f33fe4be99686d5c002418c861c35a7.tar.gz busybox-w32-c42021ab2f33fe4be99686d5c002418c861c35a7.tar.bz2 busybox-w32-c42021ab2f33fe4be99686d5c002418c861c35a7.zip |
Convert to a global struct, the way sed was. Now I have two, I can work out
the infrastructure to merge global structs into a union...
git-svn-id: svn://busybox.net/trunk/busybox@15157 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r-- | util-linux/mdev.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/util-linux/mdev.c b/util-linux/mdev.c index 73938f8de..d0c40e2ae 100644 --- a/util-linux/mdev.c +++ b/util-linux/mdev.c | |||
@@ -28,7 +28,12 @@ | |||
28 | 28 | ||
29 | #include <busybox.h> | 29 | #include <busybox.h> |
30 | 30 | ||
31 | int root_major, root_minor; | 31 | struct mdev_globals |
32 | { | ||
33 | int root_major, root_minor; | ||
34 | } mdev_globals; | ||
35 | |||
36 | #define bbg mdev_globals | ||
32 | 37 | ||
33 | /* mknod in /dev based on a path like "/sys/block/hda/hda1" */ | 38 | /* mknod in /dev based on a path like "/sys/block/hda/hda1" */ |
34 | static void make_device(char *path) | 39 | static void make_device(char *path) |
@@ -173,7 +178,7 @@ found_device: | |||
173 | if (mknod(device_name, mode | type, makedev(major, minor)) && errno != EEXIST) | 178 | if (mknod(device_name, mode | type, makedev(major, minor)) && errno != EEXIST) |
174 | bb_perror_msg_and_die("mknod %s failed", device_name); | 179 | bb_perror_msg_and_die("mknod %s failed", device_name); |
175 | 180 | ||
176 | if (major==root_major && minor==root_minor) | 181 | if (major==bbg.root_major && minor==bbg.root_minor) |
177 | symlink(device_name, "root"); | 182 | symlink(device_name, "root"); |
178 | 183 | ||
179 | if (ENABLE_FEATURE_MDEV_CONF) chown(device_name, uid, gid); | 184 | if (ENABLE_FEATURE_MDEV_CONF) chown(device_name, uid, gid); |
@@ -226,8 +231,8 @@ int mdev_main(int argc, char *argv[]) | |||
226 | struct stat st; | 231 | struct stat st; |
227 | 232 | ||
228 | stat("/", &st); // If this fails, we have bigger problems. | 233 | stat("/", &st); // If this fails, we have bigger problems. |
229 | root_major=major(st.st_dev); | 234 | bbg.root_major=major(st.st_dev); |
230 | root_minor=minor(st.st_dev); | 235 | bbg.root_minor=minor(st.st_dev); |
231 | strcpy(temp,"/sys/block"); | 236 | strcpy(temp,"/sys/block"); |
232 | find_dev(temp); | 237 | find_dev(temp); |
233 | strcpy(temp,"/sys/class"); | 238 | strcpy(temp,"/sys/class"); |