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!)

kre%munnari.OZ.AU@localhost (Robert Elz) writes:

>    Date:        Sun, 11 Apr 2021 18:14:44 -0000 (UTC)
>    From: (Michael van Elst)
>    Message-ID:  <s4veak$cl1$>

>  | +       spb = vnd->sc_geom.vng_secsize / DEV_BSIZE;

>Do we know for sure here that vng_secsize >= DEV_BSIZE ?

>When I first used unix (long long ago) the drives I used had a
>sector size of 256 bytes (not DEC hardware.)    (Floppies were
>128 bytes if I recall correctly).

>It would not be good if spb became 0 there.

I have also seen winchester disks with 128 byte sectors, ESDI
disks with 576 byte sectors and CD-ROM XA media uses 2352 byte

vng_secsize is either initialized to DEV_BSIZE or the value
is validated with DK_DEV_BSIZE_OK():

#define DK_DEV_BSIZE_OK(b) \
    ((b) >= DEV_BSIZE && ((b) & ((b) - 1)) == 0 && (b) <= MAXPHYS)

So dividing by DEV_BSIZE is ok.

Home | Main Index | Thread Index | Old Index