At Sun, 11 Apr 2021 16:06:27 -0000 (UTC), [email protected] (Michael van Elst) 
wrote:
Subject: Re: I think I've found why Xen domUs can't mount some file-backed disk 
images! (vnd(4) hides labels!)
>
> [email protected] (Robert Elz) writes:
>
> >    Date:        Sun, 11 Apr 2021 14:25:40 -0000 (UTC)
> >    From:        [email protected] (Michael van Elst)
> >    Message-ID:  <[email protected]>
>
> >  | +       dg->dg_secperunit = vnd->sc_size / DEV_BSIZE;
>
> >While it shouldn't make any difference for any properly created image
> >file, make it be
>
> >                     (vnd->sc_size + DEV_BSIZE - 1) / DEV_BSIZE;
>
> >so that any trailing partial sector remains in the image.
>
>
> The trailing partial sector is already ignored. Fortunately no disk image
> can even have a partial trailing sector and some magically implicit
> padding would have unexpected side effects.
>
> But the code also needs to be adjusted for different sector sizes.

So since vnd->sc_size is in units of disk blocks....

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

right?

--
                                        Greg A. Woods <[email protected]>

Kelowna, BC     +1 250 762-7675           RoboHack <[email protected]>
Planix, Inc. <[email protected]>     Avoncote Farms <[email protected]>

Attachment: pgpHppeDklPmd.pgp
Description: OpenPGP Digital Signature

Reply via email to