Date: Thu, 28 May 2020 08:19:14 +0000 (UTC) From: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= <royger@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361579 - head/sys/dev/xen/blkfront Message-ID: <202005280819.04S8JEGh075884@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: royger Date: Thu May 28 08:19:13 2020 New Revision: 361579 URL: https://svnweb.freebsd.org/changeset/base/361579 Log: xen/blkfront: use the correct type for disk sectors The correct type to use to represent disk sectors is blkif_sector_t (which is an uint64_t underneath). This avoid truncation of the disk size calculation when resizing on i386, as otherwise the calculation of d_mediasize in xbd_connect is truncated to the size of unsigned long, which is 32bits on i386. Note this issue didn't affect amd64, because the size of unsigned long is 64bits there. Sponsored by: Citrix Systems R&D MFC after: 1 week Modified: head/sys/dev/xen/blkfront/blkfront.c Modified: head/sys/dev/xen/blkfront/blkfront.c ============================================================================== --- head/sys/dev/xen/blkfront/blkfront.c Thu May 28 08:18:34 2020 (r361578) +++ head/sys/dev/xen/blkfront/blkfront.c Thu May 28 08:19:13 2020 (r361579) @@ -1225,7 +1225,8 @@ static void xbd_connect(struct xbd_softc *sc) { device_t dev = sc->xbd_dev; - unsigned long sectors, sector_size, phys_sector_size; + blkif_sector_t sectors; + unsigned long sector_size, phys_sector_size; unsigned int binfo; int err, feature_barrier, feature_flush; int i, j; @@ -1244,7 +1245,7 @@ xbd_connect(struct xbd_softc *sc) return; } err = xs_gather(XST_NIL, xenbus_get_otherend_path(dev), - "sectors", "%lu", §ors, NULL); + "sectors", "%"PRIu64, §ors, NULL); if (err != 0) { xenbus_dev_error(dev, err, "reading sectors at %s", @@ -1266,7 +1267,7 @@ xbd_connect(struct xbd_softc *sc) } err = xs_gather(XST_NIL, xenbus_get_otherend_path(dev), - "sectors", "%lu", §ors, + "sectors", "%"PRIu64, §ors, "info", "%u", &binfo, "sector-size", "%lu", §or_size, NULL); @@ -1279,7 +1280,7 @@ xbd_connect(struct xbd_softc *sc) if ((sectors == 0) || (sector_size == 0)) { xenbus_dev_fatal(dev, 0, "invalid parameters from %s:" - " sectors = %lu, sector_size = %lu", + " sectors = %"PRIu64", sector_size = %lu", xenbus_get_otherend_path(dev), sectors, sector_size); return;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202005280819.04S8JEGh075884>