VirtualBox

Changeset 8835 in vbox for trunk/src/VBox


Ignore:
Timestamp:
May 15, 2008 9:18:29 AM (17 years ago)
Author:
vboxsync
Message:

Implement getting the block device size on Solaris in creating raw disk VMDKs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxInternalManage.cpp

    r8812 r8835  
    5353#include <windows.h>
    5454#include <winioctl.h>
    55 #elif defined(RT_OS_LINUX) || defined(RT_OS_DARWIN)
     55#elif defined(RT_OS_LINUX) || defined(RT_OS_DARWIN) || defined(RT_OS_SOLARIS)
    5656#include <errno.h>
    5757#include <sys/ioctl.h>
     
    6969#include <sys/disk.h>
    7070#endif /* RT_OS_DARWIN */
     71#ifdef RT_OS_SOLARIS
     72#include <stropts.h>
     73#include <sys/dkio.h>
     74#include <sys/vtoc.h>
     75#endif /* RT_OS_SOLARIS */
    7176
    7277using namespace com;
     
    831836    else
    832837    {
    833         RTPrintf("File '%s' is no disk\n", rawdisk.raw());
     838        RTPrintf("File '%s' is no block device\n", rawdisk.raw());
    834839        return VERR_INVALID_PARAMETER;
    835840    }
     
    852857    else
    853858    {
    854         RTPrintf("File '%s' is no disk\n", rawdisk.raw());
     859        RTPrintf("File '%s' is no block device\n", rawdisk.raw());
     860        return VERR_INVALID_PARAMETER;
     861    }
     862#elif defined(RT_OS_SOLARIS)
     863    struct stat DevStat;
     864    if (!fstat(RawFile, &DevStat) && S_ISBLK(DevStat.st_mode))
     865    {
     866        struct dk_minfo mediainfo;
     867        if (!ioctl(RawFile, DKIOCGMEDIAINFO, &mediainfo))
     868            cbSize = mediainfo.dki_capacity * mediainfo.dki_lbsize;
     869        else
     870            return RTErrConvertFromErrno(errno);
     871    }
     872    else
     873    {
     874        RTPrintf("File '%s' is no block device\n", rawdisk.raw());
    855875        return VERR_INVALID_PARAMETER;
    856876    }
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette