k...@munnari.oz.au (Robert Elz) writes: > Date: Sun, 11 Apr 2021 18:14:44 -0000 (UTC) > From: mlel...@serpens.de (Michael van Elst) > Message-ID: <s4veak$cl1$1...@serpens.de>
> | + 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 sectors. 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.