summaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
authorRob Landley2006-05-21 18:33:27 +0000
committerRob Landley2006-05-21 18:33:27 +0000
commit5cd1ccd9955d1eaa692da62fd06295a8bc9f6172 (patch)
treeab9c5cf47898578428ae305e870a1c5a3da5fc89 /util-linux
parent9ffd42317b5a53c2236268808e34c90601f286c1 (diff)
downloadbusybox-5cd1ccd9955d1eaa692da62fd06295a8bc9f6172.zip
busybox-5cd1ccd9955d1eaa692da62fd06295a8bc9f6172.tar.gz
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...
Diffstat (limited to 'util-linux')
-rw-r--r--util-linux/mdev.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/util-linux/mdev.c b/util-linux/mdev.c
index 73938f8..d0c40e2 100644
--- a/util-linux/mdev.c
+++ b/util-linux/mdev.c
@@ -28,7 +28,12 @@
#include <busybox.h>
-int root_major, root_minor;
+struct mdev_globals
+{
+ int root_major, root_minor;
+} mdev_globals;
+
+#define bbg mdev_globals
/* mknod in /dev based on a path like "/sys/block/hda/hda1" */
static void make_device(char *path)
@@ -173,7 +178,7 @@ found_device:
if (mknod(device_name, mode | type, makedev(major, minor)) && errno != EEXIST)
bb_perror_msg_and_die("mknod %s failed", device_name);
- if (major==root_major && minor==root_minor)
+ if (major==bbg.root_major && minor==bbg.root_minor)
symlink(device_name, "root");
if (ENABLE_FEATURE_MDEV_CONF) chown(device_name, uid, gid);
@@ -226,8 +231,8 @@ int mdev_main(int argc, char *argv[])
struct stat st;
stat("/", &st); // If this fails, we have bigger problems.
- root_major=major(st.st_dev);
- root_minor=minor(st.st_dev);
+ bbg.root_major=major(st.st_dev);
+ bbg.root_minor=minor(st.st_dev);
strcpy(temp,"/sys/block");
find_dev(temp);
strcpy(temp,"/sys/class");