git: installer: Use ioctl(DIOCGPART) for getting a disk's size.

Sascha Wildner swildner at crater.dragonflybsd.org
Tue May 31 14:28:53 PDT 2016


commit 795e32157bb0bc3e1efe5a4a0fce70a9f39b74be
Author: Sascha Wildner <saw at online.de>
Date:   Tue May 31 23:27:35 2016 +0200

    installer: Use ioctl(DIOCGPART) for getting a disk's size.
    
    Before this commit, the installer was grepping in /var/run/dmesg.boot.
    This approach has one problem in particular, which is that it was
    used with CAM attached disks in mind, which will always print their
    size in MiBs. However, some drivers, such as mmcsd(4), roll their own
    disk, so they are free to choose what they print in their *_attach()
    function. Yet we still want to offer these disks from the installer.
    For example, mmcsd(4) starts printing the size in gigabytes if the
    disk is >= 10GiB.
    
    This commit changes the installer's survey function to read the
    disk's size using ioctl(DIOCGPART) to have consistent results.
    
    Reported-by:   Dmitry Postolov <dpostolov at yandex.ru>
    Dragonfly-bug: <https://bugs.dragonflybsd.org/issues/2899>

Summary of changes:
 usr.sbin/installer/libinstaller/survey.c | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/795e32157bb0bc3e1efe5a4a0fce70a9f39b74be


-- 
DragonFly BSD source repository



More information about the Commits mailing list