Re: [PATCH] Add blkzonecmd and blkreport ZAC/ZBC drives

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

 



On Mon, Jan 23, 2017 at 04:38:43PM +0900, Damien Le Moal wrote:
> Shaun,
> 
> On 1/19/17 18:02, Shaun Tancheff wrote:
> > +++ b/sys-utils/blkreset.c
> > @@ -0,0 +1,192 @@
> > +/*
> [...]
> > +
> > +	if (ioctl(fd, BLKGETSIZE64, &blksize))
> > +		err(EXIT_FAILURE, _("%s: BLKGETSIZE64 ioctl failed"), path);
> > +
> > +	blksectors = blksize << 9;
> 
> blksize being in bytes here, it looks like the shift is in the wrong
> direction here... i.e.
> 
> blksectors = blksize >> 9;

The ideal solution would be to avoid the ioctl and use
blkdev_get_sectors() or blkdev_get_size() from include/blkdev.h

    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux