devfs
[Top] [All Lists]

[PATCH] devfsd-1.3.11 old compatibility names

To: devfs@xxxxxxxxxxx
Subject: [PATCH] devfsd-1.3.11 old compatibility names
From: "Kevin P. Fleming" <kevin@xxxxxxxxxxxxx>
Date: Thu, 14 Jun 2001 13:17:29 +0700
Organization: LSG, Inc.
Sender: owner-devfs@xxxxxxxxxxx
The attached patch is against devfsd-1.3.11 (downloaded today). The
problem it fixes can best be explained by example... I use the Universal
TUN/TAP network device driver, and it registers a "misc" character
device called "net/tun".

The devfs core registers this device as /dev/misc/net/tun, and this is
fine. When devfsd gets the event for this registration, it creates a
symlink at /dev/net/tun, but the link points to "misc/net/tun", so it
does not work as the link not located at /dev.

The patch adds a "../" prefix to the symlink destination path for every
"/" character in the compatibility name about to be added. Works fine
for me... <G>

--- cut here ---
--- devfsd/devfsd.c     Tue Feb  6 13:13:19 2001
+++ devfsd-new/devfsd.c Fri Jun 15 02:38:19 2001
@@ -1253,6 +1253,7 @@
 {
     const char *compat_name = NULL;
     const char *dest_name = info->devname;
+    const char *compat_ptr;
     char *ptr;
     char compat_buf[STRING_LENGTH], dest_buf[STRING_LENGTH];
     static char function_name[] = "action_compat";
@@ -1264,6 +1265,17 @@
       case AC_RMOLDCOMPAT:
        compat_name = get_old_name (info->devname, info->namelen,
compat_buf,
                                    info->major, info->minor);
+       if (compat_name != NULL) {
+         /* If the compat_name has leading directories, the dest_name
will need leading ".." to match */
+         dest_buf[0] = '\0';
+         for (compat_ptr = compat_name; *compat_ptr != '\0';
compat_ptr++) {
+           if (*compat_ptr == '/') {
+             strcat(dest_buf, "../");
+           }
+         }
+         strcat(dest_buf, info->devname);
+         dest_name = dest_buf;
+       }
        break;
       case AC_MKNEWCOMPAT:
       case AC_RMNEWCOMPAT:

<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH] devfsd-1.3.11 old compatibility names, Kevin P. Fleming <=