tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

DIOCGDISKINFO support for vnd



The attached trivial patch allows vnd(4) to support generic disk ioctls.
The only one in kern/subr_disk.c at the moment is DIOCGDISKINFO.

Before:
$ ./vndtest /dev/vnd0a 
vndtest: DIOCGDISKINFO: Inappropriate ioctl for device

After:
$ ./vndtest /dev/vnd0a
size of /dev/vnd0a: 524288 bytes

Thanks to pooka@ for help in creating librumpdev_vnd.so which made finding
the root of the problem easy.

Comments?

Cheers,

Patrick
Index: sys/dev/vnd.c
===================================================================
RCS file: /cvsroot/src/sys/dev/vnd.c,v
retrieving revision 1.227
diff -u -r1.227 vnd.c
--- sys/dev/vnd.c       29 Dec 2013 08:09:44 -0000      1.227
+++ sys/dev/vnd.c       11 Mar 2014 11:58:05 -0000
@@ -1572,7 +1572,11 @@
                return dkwedge_list(&vnd->sc_dkdev, dkwl, l);
 
        default:
-               return ENOTTY;
+               error = disk_ioctl(&vnd->sc_dkdev, cmd, data, flag, l);
+               if (error == EPASSTHROUGH)
+                       return ENOTTY;
+               else
+                       return error;
        }
 
        return 0;
@@ -2007,6 +2011,11 @@
        dg->dg_ntracks = vnd->sc_geom.vng_ntracks;
        dg->dg_ncylinders = vnd->sc_geom.vng_ncylinders;
 
+#ifdef DEBUG
+       if (vnddebug & VDB_LABEL)
+               printf("dg->dg_secperunit: %" PRId64 "\n", dg->dg_secperunit);
+               printf("dg->dg_ncylinders: %u\n", dg->dg_ncylinders);
+#endif
        disk_set_info(vnd->sc_dev, &vnd->sc_dkdev, NULL);
 }
 


Home | Main Index | Thread Index | Old Index