This error is due to the relatively small storage size available to
store the path to the disk image.  I see no reason to use 90 bytes only
and not PATH_MAX here.

Since bumping the size of the struct is an incompatible change, the
kernel keeps some glue to allow old programs to work on a fresh kernel.

This survived a make release.

ok?


Index: dev/vnd.c
===================================================================
RCS file: /d/cvs/src/sys/dev/vnd.c,v
retrieving revision 1.159
diff -u -p -r1.159 vnd.c
--- dev/vnd.c   8 Oct 2016 05:52:06 -0000       1.159
+++ dev/vnd.c   11 Nov 2016 22:56:03 -0000
@@ -396,6 +396,7 @@ vndioctl(dev_t dev, u_long cmd, caddr_t 
        struct vnd_softc *sc;
        struct vnd_ioctl *vio;
        struct vnd_user *vnu;
+       struct vnd_user60 *vnu60;
        struct vattr vattr;
        struct nameidata nd;
        int error, part, pmask;
@@ -542,6 +543,35 @@ vndioctl(dev_t dev, u_long cmd, caddr_t 
                /* Detach the disk. */
                disk_detach(&sc->sc_dk);
                disk_unlock(&sc->sc_dk);
+               break;
+
+       /* XXX kill after 6.1 */
+       case VNDIOCGET60:
+               vnu60 = (struct vnd_user60 *)addr;
+
+               if (vnu60->vnu60_unit == -1)
+                       vnu60->vnu60_unit = unit;
+               if (vnu60->vnu60_unit >= numvnd)
+                       return (ENXIO);
+               if (vnu60->vnu60_unit < 0)
+                       return (EINVAL);
+
+               sc = &vnd_softc[vnu60->vnu60_unit];
+
+               if (sc->sc_flags & VNF_INITED) {
+                       error = VOP_GETATTR(sc->sc_vp, &vattr, p->p_ucred, p);
+                       if (error)
+                               return (error);
+
+                       strlcpy(vnu60->vnu60_file, sc->sc_file,
+                           sizeof(vnu60->vnu60_file));
+                       vnu60->vnu60_dev = vattr.va_fsid;
+                       vnu60->vnu60_ino = vattr.va_fileid;
+               } else {
+                       vnu60->vnu60_dev = 0;
+                       vnu60->vnu60_ino = 0;
+               }
+
                break;
 
        case VNDIOCGET:
Index: dev/vndioctl.h
===================================================================
RCS file: /d/cvs/src/sys/dev/vndioctl.h,v
retrieving revision 1.8
diff -u -p -r1.8 vndioctl.h
--- dev/vndioctl.h      3 Sep 2008 23:24:25 -0000       1.8
+++ dev/vndioctl.h      11 Nov 2016 22:56:35 -0000
@@ -42,7 +42,7 @@
 #ifndef _SYS_VNDIOCTL_H_
 #define _SYS_VNDIOCTL_H_
 
-#define VNDNLEN        90
+#define VNDNLEN        1024            /* PATH_MAX */
 
 /*
  * Ioctl definitions for file (vnode) disk pseudo-device.
@@ -67,6 +67,14 @@ struct vnd_user {
        ino_t   vnu_ino;                /* vnd inode */
 };
 
+/* XXX kill after 6.1 */
+struct vnd_user60 {
+       char    vnu60_file[90];         /* vnd file */
+       int     vnu60_unit;             /* vnd unit */
+       dev_t   vnu60_dev;              /* vnd device */
+       ino_t   vnu60_ino;              /* vnd inode */
+};
+
 /*
  * Before you can use a unit, it must be configured with VNDIOCSET.
  * The configuration persists across opens and closes of the device;
@@ -75,6 +83,8 @@ struct vnd_user {
  */
 #define VNDIOCSET      _IOWR('F', 0, struct vnd_ioctl) /* enable disk */
 #define VNDIOCCLR      _IOW('F', 1, struct vnd_ioctl)  /* disable disk */
-#define VNDIOCGET      _IOWR('F', 2, struct vnd_user)  /* get disk info */
+/* XXX kill after 6.1 */
+#define VNDIOCGET60    _IOWR('F', 2, struct vnd_user60)        /* get disk 
info */
+#define VNDIOCGET      _IOWR('F', 3, struct vnd_user)  /* get disk info */
 
 #endif /* !_SYS_VNDIOCTL_H_ */


-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE

Reply via email to