svn commit: trunk/busybox/util-linux
landley at busybox.net
landley at busybox.net
Tue Feb 21 06:11:15 UTC 2006
Author: landley
Date: 2006-02-20 22:11:13 -0800 (Mon, 20 Feb 2006)
New Revision: 14159
Log:
Create /dev/root symlink pointing to real root device, if any.
Modified:
trunk/busybox/util-linux/mdev.c
Changeset:
Modified: trunk/busybox/util-linux/mdev.c
===================================================================
--- trunk/busybox/util-linux/mdev.c 2006-02-21 05:06:42 UTC (rev 14158)
+++ trunk/busybox/util-linux/mdev.c 2006-02-21 06:11:13 UTC (rev 14159)
@@ -16,6 +16,7 @@
#include <string.h>
#include <sys/mman.h>
#include <sys/stat.h>
+#include <sys/sysmacros.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
@@ -27,6 +28,8 @@
#include <busybox.h>
+int root_major, root_minor;
+
/* mknod in /dev based on a path like "/sys/block/hda/hda1" */
static void make_device(char *path)
{
@@ -169,6 +172,9 @@
if (mknod(temp, mode | type, makedev(major, minor)) && errno != EEXIST)
bb_perror_msg_and_die("mknod %s failed", temp);
+ if (major==root_major && minor==root_minor)
+ symlink(temp,DEV_PATH "/root");
+
if (ENABLE_FEATURE_MDEV_CONF) chown(temp,uid,gid);
end:
@@ -217,6 +223,11 @@
/* Scan */
if (argc == 2 && !strcmp(argv[1],"-s")) {
+ struct stat st;
+
+ stat("/", &st); // If this fails, we have bigger problems.
+ root_major=major(st.st_dev);
+ 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