diff options
| author | Rob Landley <rob@landley.net> | 2006-05-21 18:33:27 +0000 |
|---|---|---|
| committer | Rob Landley <rob@landley.net> | 2006-05-21 18:33:27 +0000 |
| commit | 5cd1ccd9955d1eaa692da62fd06295a8bc9f6172 (patch) | |
| tree | ab9c5cf47898578428ae305e870a1c5a3da5fc89 /util-linux | |
| parent | 9ffd42317b5a53c2236268808e34c90601f286c1 (diff) | |
| download | busybox-w32-5cd1ccd9955d1eaa692da62fd06295a8bc9f6172.tar.gz busybox-w32-5cd1ccd9955d1eaa692da62fd06295a8bc9f6172.tar.bz2 busybox-w32-5cd1ccd9955d1eaa692da62fd06295a8bc9f6172.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...
Diffstat (limited to 'util-linux')
| -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"); |
