This is basically a rip off of ntfs_vfsops.c r1.25 and allows the use of DUIDs in fstab for ext2fs.

Works for me on amd64 GENERIC.MP.

Index: ext2fs_vfsops.c
===================================================================
RCS file: /cvs/src/sys/ufs/ext2fs/ext2fs_vfsops.c,v
retrieving revision 1.59
diff -u -r1.59 ext2fs_vfsops.c
--- ext2fs_vfsops.c     21 Dec 2010 20:14:44 -0000      1.59
+++ ext2fs_vfsops.c     2 Jun 2011 03:25:01 -0000
@@ -44,6 +44,7 @@
 #include <sys/mount.h>
 #include <sys/buf.h>
 #include <sys/device.h>
+#include <sys/disk.h>
 #include <sys/mbuf.h>
 #include <sys/file.h>
 #include <sys/disklabel.h>
@@ -170,6 +171,7 @@
        size_t size;
        int error, flags;
        mode_t accessmode;
+       char *fspec = NULL;

        error = copyin(data, (caddr_t)&args, sizeof (struct ufs_args));
        if (error)
@@ -234,7 +236,11 @@
         * Not an update, or updating the name: look up the name
         * and verify that it refers to a sensible block device.
         */
-       NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, p);
+       fspec = malloc(MNAMELEN, M_MOUNT, M_WAITOK);
+       error = copyinstr(args.fspec, fspec, MNAMELEN - 1, &size);
+       disk_map(fspec, fspec, MNAMELEN, DM_OPENBLCK);
+
+       NDINIT(ndp, LOOKUP, FOLLOW, UIO_SYSSPACE, fspec, p);
        if ((error = namei(ndp)) != 0)
                return (error);
        devvp = ndp->ni_vp;
@@ -286,8 +292,7 @@
                bzero(fs->e2fs.e2fs_fsmnt, sizeof(fs->e2fs.e2fs_fsmnt) - size);
        }
        bcopy(fs->e2fs_fsmnt, mp->mnt_stat.f_mntonname, MNAMELEN);
-       (void)copyinstr(args.fspec, mp->mnt_stat.f_mntfromname, MNAMELEN - 1,
-               &size);
+       size = strlcpy(mp->mnt_stat.f_mntfromname, fspec, MNAMELEN - 1);
        bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size);
        if (fs->e2fs_fmod != 0) {    /* XXX */
                fs->e2fs_fmod = 0;
@@ -298,6 +303,10 @@
                                mp->mnt_stat.f_mntfromname);
                (void)ext2fs_cgupdate(ump, MNT_WAIT);
        }
+
+       if (fspec)
+               free(fspec, M_MOUNT);
+
        return (0);
 }

Reply via email to