tech-kern archive

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

Re: I think I've found why Xen domUs can't mount some file-backed disk images! (vnd(4) hides labels!)



woods%planix.ca@localhost ("Greg A. Woods") writes:

>	dg->dg_secperunit =
>	    ((vnd->sc_size * DEV_BSIZE) + DEV_BSIZE - 1) /
>	    vnd->sc_geom.vng_secsize;

@@ -2104,11 +2108,12 @@ static void
 vnd_set_geometry(struct vnd_softc *vnd)
 {
        struct disk_geom *dg = &vnd->sc_dkdev.dk_geom;
+       unsigned spb;
 
        memset(dg, 0, sizeof(*dg));
 
-       dg->dg_secperunit = (int64_t)vnd->sc_geom.vng_nsectors *
-           vnd->sc_geom.vng_ntracks * vnd->sc_geom.vng_ncylinders;
+       spb = vnd->sc_geom.vng_secsize / DEV_BSIZE;
+       dg->dg_secperunit = vnd->sc_size / spb;
        dg->dg_secsize = vnd->sc_geom.vng_secsize;
        dg->dg_nsectors = vnd->sc_geom.vng_nsectors;
        dg->dg_ntracks = vnd->sc_geom.vng_ntracks;



Home | Main Index | Thread Index | Old Index