svn commit: trunk/busybox/util-linux

landley at busybox.net landley at busybox.net
Sun May 21 18:33:28 UTC 2006


Author: landley
Date: 2006-05-21 11:33:27 -0700 (Sun, 21 May 2006)
New Revision: 15157

Log:
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...


Modified:
   trunk/busybox/util-linux/mdev.c


Changeset:
Modified: trunk/busybox/util-linux/mdev.c
===================================================================
--- trunk/busybox/util-linux/mdev.c	2006-05-21 18:30:35 UTC (rev 15156)
+++ trunk/busybox/util-linux/mdev.c	2006-05-21 18:33:27 UTC (rev 15157)
@@ -28,8 +28,13 @@
 
 #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 @@
 	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 @@
 		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");




More information about the busybox-cvs mailing list