storage::Disk Class Reference

#include <Disk.h>

Inheritance diagram for storage::Disk:

storage::Container storage::Device storage::Dasd

List of all members.

Public Types

typedef DerefIterator
< PartCPIterator, const
Partition
ConstPartIter
typedef IterPair< ConstPartIterConstPartPair

Public Member Functions

 Disk (Storage *s, const string &name, const string &device, unsigned long long Size, SystemInfo &systeminfo)
 Disk (Storage *s, const string &name, const string &device, unsigned num, unsigned long long Size, SystemInfo &systeminfo)
 Disk (Storage *s, const xmlNode *node)
 Disk (const Disk &c)
virtual ~Disk ()
void saveData (xmlNode *node) const
unsigned long cylinders () const
unsigned heads () const
unsigned sectors () const
unsigned sectorSize () const
const GeometrygetGeometry () const
Region usableCylRegion () const
unsigned long numMinor () const
unsigned maxPrimary () const
bool extendedPossible () const
unsigned maxLogical () const
const string & labelName () const
virtual string udevPath () const
virtual list< string > udevId () const
void setSlave (bool val=true)
void setAddpart (bool val=true)
void setNumMinor (unsigned long val)
virtual string procName () const
virtual string sysfsPath () const
unsigned numPartitions () const
bool isDasd () const
bool isIScsi () const
bool isLogical (unsigned nr) const
bool detect (SystemInfo &systeminfo)
void triggerUdevUpdate () const
void setUdevData (const string &path, const list< string > &id)
virtual int createPartition (storage::PartitionType type, long unsigned start, long unsigned len, string &device, bool checkRelaxed=false)
int createPartition (long unsigned len, string &device, bool checkRelaxed=false)
int createPartition (storage::PartitionType type, string &device)
virtual int removePartition (unsigned nr)
virtual int changePartitionId (unsigned nr, unsigned id)
virtual int initializeDisk (bool)
bool initializeDisk () const
void resetInitDisk ()
int forgetChangePartitionId (unsigned nr)
int changePartitionArea (unsigned nr, const Region &cylRegion, bool checkRelaxed=false)
int nextFreePartition (storage::PartitionType type, unsigned &nr, string &device) const
int destroyPartitionTable (const string &new_label)
unsigned availablePartNumber (storage::PartitionType type=storage::PRIMARY) const
virtual void getCommitActions (list< commitAction > &l) const
virtual void getToCommit (storage::CommitStage stage, list< const Container * > &col, list< const Volume * > &vol) const
virtual int commitChanges (storage::CommitStage stage)
int commitChanges (storage::CommitStage stage, Volume *vol)
int freeCylindersAroundPartition (const Partition *p, unsigned long &freeCylsBefore, unsigned long &freeCylsAfter) const
virtual int resizePartition (Partition *p, unsigned long newCyl)
int resizeVolume (Volume *v, unsigned long long newSize)
int removeVolume (Volume *v)
void getUnusedSpace (std::list< Region > &free, bool all=true, bool logical=false) const
unsigned int numPrimary () const
bool hasExtended () const
unsigned int numLogical () const
Text setDiskLabelText (bool doing) const
unsigned long long cylinderToKb (unsigned long cylinder) const
unsigned long kbToCylinder (unsigned long long kb) const
unsigned long long sectorToKb (unsigned long long sector) const
unsigned long long kbToSector (unsigned long long kb) const
string getPartName (unsigned nr) const
string getPartDevice (unsigned nr) const
void getInfo (storage::DiskInfo &info) const
bool equalContent (const Container &rhs) const
void logDifference (std::ostream &log, const Disk &rhs) const
virtual void logDifferenceWithVolumes (std::ostream &log, const Container &rhs) const
bool FakeDisk () const
ConstPartPair partPair (bool(*CheckPart)(const Partition &)=NULL) const
ConstPartIter partBegin (bool(*CheckPart)(const Partition &)=NULL) const
ConstPartIter partEnd (bool(*CheckPart)(const Partition &)=NULL) const

Static Public Member Functions

static string sysfsPath (const string &device)
static bool isIScsi (const Disk &d)
static storage::CType staticType ()
static bool needP (const string &dev)
static string partNaming (const string &disk)
static std::pair< string,
unsigned > 
getDiskPartition (const string &dev)
static bool getDlabelCapabilities (const string &dlabel, storage::DlabelCapabilities &dlabelcapabilities)
static bool getSysfsInfo (const string &sysfsdir, SysfsInfo &sysfsinfo)

Protected Types

typedef CastIterator< VIter,
Partition * > 
PartInter
typedef CastIterator< CVIter,
const Partition * > 
PartCInter
typedef CheckFnc< const PartitionCheckFncPartition
typedef CheckerIterator
< CheckFncPartition,
PartitionPI< CheckFncPartition >
::type, PartInter, Partition
PartPIterator
typedef CheckerIterator
< CheckFncPartition,
PartitionCPI
< CheckFncPartition >::type,
PartCInter, const Partition
PartCPIterator
typedef DerefIterator
< PartPIterator, Partition
PartIter
typedef IterPair< PartIterPartPair

Protected Member Functions

PartPair partPair (bool(*CheckPart)(const Partition &)=NULL)
PartIter partBegin (bool(*CheckPart)(const Partition &)=NULL)
PartIter partEnd (bool(*CheckPart)(const Partition &)=NULL)
virtual bool detectGeometry ()
virtual bool detectPartitions (SystemInfo &systeminfo)
bool getSysfsInfo ()
int checkSystemError (const string &cmd_line, const SystemCmd &cmd) const
int execCheckFailed (const string &cmd_line, bool stop_hald=true)
int execCheckFailed (SystemCmd &cmd, const string &cmd_line, bool stop_hald=true)
bool checkPartedOutput (SystemInfo &systeminfo)
list< string > partitionsKernelKnowns (const ProcParts &parts) const
bool checkPartedValid (SystemInfo &systeminfo, list< Partition * > &pl, unsigned long &rng) const
virtual bool checkPartitionsValid (SystemInfo &systeminfo, const list< Partition * > &pl) const
bool callDelpart (unsigned nr) const
bool callAddpart (unsigned nr, const Region &blkRegion) const
bool getPartedValues (Partition *p) const
bool getPartedSectors (const Partition *p, unsigned long long &start, unsigned long long &end) const
const PartitiongetPartitionAfter (const Partition *p) const
void addPartition (unsigned num, unsigned long long sz, SystemInfo &ppart)
virtual void print (std::ostream &s) const
virtual ContainergetCopy () const
virtual void redetectGeometry ()
void changeNumbers (const PartIter &b, const PartIter &e, unsigned start, int incr)
int createChecks (PartitionType &type, const Region &cylRegion, bool checkRelaxed) const
void removePresentPartitions ()
void removeFromMemory ()
void enlargeGpt ()
unsigned long long procExtendedBlks () const
virtual int doCreate (Volume *v)
virtual int doRemove (Volume *v)
virtual int doResize (Volume *v)
virtual int doSetType (Volume *v)
virtual int doCreateLabel ()
virtual void logData (const string &Dir) const
void setLabelData (const string &)
virtual string defaultLabel () const

Protected Attributes

Geometry geometry
Geometry new_geometry
string label
string udev_path
list< string > udev_id
string detected_label
string logfile_name
unsigned max_primary
bool ext_possible
unsigned max_logical
bool init_disk
Transport transport
bool dmp_slave
bool no_addpart
bool gpt_enlarge
unsigned long range
bool del_ptable
storage::DiskInfo info

Static Protected Attributes

static const label_info labels []
static const string p_disks []

Private Member Functions

Diskoperator= (const Disk &)

Friends

class Storage
class DmPartCo
class MdPartCo
std::ostream & operator<< (std::ostream &, const Disk &)

Classes

struct  label_info
struct  PartitionCPI
struct  PartitionPI
struct  SysfsInfo


Member Typedef Documentation

typedef CastIterator<CVIter, const Partition *> storage::Disk::PartCInter [protected]


Constructor & Destructor Documentation

storage::Disk::Disk ( Storage s,
const string &  name,
const string &  device,
unsigned long long  Size,
SystemInfo systeminfo 
)

storage::Disk::Disk ( Storage s,
const string &  name,
const string &  device,
unsigned  num,
unsigned long long  Size,
SystemInfo systeminfo 
)

storage::Disk::Disk ( Storage s,
const xmlNode *  node 
)

storage::Disk::Disk ( const Disk c  ) 

storage::Disk::~Disk (  )  [virtual]

References storage::Device::dev, and y2deb.


Member Function Documentation

void storage::Disk::saveData ( xmlNode *  node  )  const

unsigned long storage::Disk::cylinders (  )  const [inline]

unsigned storage::Disk::heads (  )  const [inline]

References geometry, and storage::Geometry::heads.

Referenced by getInfo().

unsigned storage::Disk::sectors (  )  const [inline]

References geometry, and storage::Geometry::sectors.

Referenced by getInfo().

unsigned storage::Disk::sectorSize (  )  const [inline]

const Geometry& storage::Disk::getGeometry (  )  const [inline]

References geometry.

Referenced by storage::operator<<().

Region storage::Disk::usableCylRegion (  )  const

unsigned long storage::Disk::numMinor (  )  const [inline]

References range.

unsigned storage::Disk::maxPrimary (  )  const [inline]

bool storage::Disk::extendedPossible (  )  const [inline]

unsigned storage::Disk::maxLogical (  )  const [inline]

const string& storage::Disk::labelName (  )  const [inline]

virtual string storage::Disk::udevPath (  )  const [inline, virtual]

virtual list<string> storage::Disk::udevId (  )  const [inline, virtual]

Reimplemented from storage::Device.

References udev_id.

Referenced by storage::Partition::addAltUdevId(), and storage::Partition::udevId().

void storage::Disk::setSlave ( bool  val = true  )  [inline]

void storage::Disk::setAddpart ( bool  val = true  )  [inline]

References no_addpart.

Referenced by storage::DmPartCo::createDisk().

void storage::Disk::setNumMinor ( unsigned long  val  )  [inline]

virtual string storage::Disk::procName (  )  const [inline, virtual]

Reimplemented from storage::Device.

References storage::Device::nm.

Referenced by sysfsPath().

string storage::Disk::sysfsPath (  )  const [virtual]

string storage::Disk::sysfsPath ( const string &  device  )  [static]

References storage::Device::dev, and SYSFSDIR.

unsigned storage::Disk::numPartitions (  )  const

bool storage::Disk::isDasd (  )  const [inline]

References storage::Device::nm.

Referenced by storage::needDasdfmt().

bool storage::Disk::isIScsi (  )  const [inline]

static bool storage::Disk::isIScsi ( const Disk d  )  [inline, static]

References isIScsi().

bool storage::Disk::isLogical ( unsigned  nr  )  const

References ext_possible, max_primary, and y2mil.

bool storage::Disk::detect ( SystemInfo systeminfo  ) 

static storage::CType storage::Disk::staticType (  )  [inline, static]

Reimplemented from storage::Container.

References storage::DISK.

Referenced by getCommitActions(), and storage::Dasd::getCommitActions().

void storage::Disk::triggerUdevUpdate (  )  const

bool storage::Disk::needP ( const string &  dev  )  [static]

string storage::Disk::partNaming ( const string &  disk  )  [static]

void storage::Disk::setUdevData ( const string &  path,
const list< string > &  id 
)

virtual int storage::Disk::createPartition ( storage::PartitionType  type,
long unsigned  start,
long unsigned  len,
string &  device,
bool  checkRelaxed = false 
) [virtual]

int storage::Disk::createPartition ( long unsigned  len,
string &  device,
bool  checkRelaxed = false 
)

int storage::Disk::createPartition ( storage::PartitionType  type,
string &  device 
)

int storage::Disk::removePartition ( unsigned  nr  )  [virtual]

int storage::Disk::changePartitionId ( unsigned  nr,
unsigned  id 
) [virtual]

virtual int storage::Disk::initializeDisk ( bool   )  [inline, virtual]

Reimplemented in storage::Dasd.

References storage::DISK_INIT_NOT_POSSIBLE.

Referenced by storage::needDasdfmt().

bool storage::Disk::initializeDisk (  )  const [inline]

References init_disk.

void storage::Disk::resetInitDisk (  )  [inline]

References init_disk.

Referenced by storage::Dasd::doDasdfmt().

int storage::Disk::forgetChangePartitionId ( unsigned  nr  ) 

int storage::Disk::changePartitionArea ( unsigned  nr,
const Region cylRegion,
bool  checkRelaxed = false 
)

int storage::Disk::nextFreePartition ( storage::PartitionType  type,
unsigned &  nr,
string &  device 
) const

int storage::Disk::destroyPartitionTable ( const string &  new_label  ) 

unsigned storage::Disk::availablePartNumber ( storage::PartitionType  type = storage::PRIMARY  )  const

void storage::Disk::getCommitActions ( list< commitAction > &  l  )  const [virtual]

void storage::Disk::getToCommit ( storage::CommitStage  stage,
list< const Container * > &  col,
list< const Volume * > &  vol 
) const [virtual]

int storage::Disk::commitChanges ( storage::CommitStage  stage  )  [virtual]

int storage::Disk::commitChanges ( storage::CommitStage  stage,
Volume vol 
) [virtual]

int storage::Disk::freeCylindersAroundPartition ( const Partition p,
unsigned long &  freeCylsBefore,
unsigned long &  freeCylsAfter 
) const

int storage::Disk::resizePartition ( Partition p,
unsigned long  newCyl 
) [virtual]

int storage::Disk::resizeVolume ( Volume v,
unsigned long long  newSize 
) [virtual]

int storage::Disk::removeVolume ( Volume v  )  [virtual]

Reimplemented from storage::Container.

References storage::Volume::nr(), and removePartition().

void storage::Disk::getUnusedSpace ( std::list< Region > &  free,
bool  all = true,
bool  logical = false 
) const

unsigned int storage::Disk::numPrimary (  )  const

bool storage::Disk::hasExtended (  )  const

unsigned int storage::Disk::numLogical (  )  const

Text storage::Disk::setDiskLabelText ( bool  doing  )  const

unsigned long long storage::Disk::cylinderToKb ( unsigned long  cylinder  )  const [inline]

unsigned long storage::Disk::kbToCylinder ( unsigned long long  kb  )  const [inline]

unsigned long long storage::Disk::sectorToKb ( unsigned long long  sector  )  const [inline]

unsigned long long storage::Disk::kbToSector ( unsigned long long  kb  )  const [inline]

string storage::Disk::getPartName ( unsigned  nr  )  const

string storage::Disk::getPartDevice ( unsigned  nr  )  const

void storage::Disk::getInfo ( storage::DiskInfo info  )  const

bool storage::Disk::equalContent ( const Container rhs  )  const [virtual]

void storage::Disk::logDifference ( std::ostream &  log,
const Disk rhs 
) const

void storage::Disk::logDifferenceWithVolumes ( std::ostream &  log,
const Container rhs 
) const [virtual]

bool storage::Disk::FakeDisk (  )  const [inline]

References range.

pair< string, unsigned > storage::Disk::getDiskPartition ( const string &  dev  )  [static]

bool storage::Disk::getDlabelCapabilities ( const string &  dlabel,
storage::DlabelCapabilities dlabelcapabilities 
) [static]

bool storage::Disk::getSysfsInfo ( const string &  sysfsdir,
SysfsInfo sysfsinfo 
) [static]

PartPair storage::Disk::partPair ( bool(*)(const Partition &)  CheckPart = NULL  )  [inline, protected]

PartIter storage::Disk::partBegin ( bool(*)(const Partition &)  CheckPart = NULL  )  [inline, protected]

PartIter storage::Disk::partEnd ( bool(*)(const Partition &)  CheckPart = NULL  )  [inline, protected]

ConstPartPair storage::Disk::partPair ( bool(*)(const Partition &)  CheckPart = NULL  )  const [inline]

References partBegin(), and partEnd().

ConstPartIter storage::Disk::partBegin ( bool(*)(const Partition &)  CheckPart = NULL  )  const [inline]

ConstPartIter storage::Disk::partEnd ( bool(*)(const Partition &)  CheckPart = NULL  )  const [inline]

bool storage::Disk::detectGeometry (  )  [protected, virtual]

bool storage::Disk::detectPartitions ( SystemInfo systeminfo  )  [protected, virtual]

bool storage::Disk::getSysfsInfo (  )  [protected]

int storage::Disk::checkSystemError ( const string &  cmd_line,
const SystemCmd cmd 
) const [protected]

int storage::Disk::execCheckFailed ( const string &  cmd_line,
bool  stop_hald = true 
) [protected]

int storage::Disk::execCheckFailed ( SystemCmd cmd,
const string &  cmd_line,
bool  stop_hald = true 
) [protected]

bool storage::Disk::checkPartedOutput ( SystemInfo systeminfo  )  [protected]

list< string > storage::Disk::partitionsKernelKnowns ( const ProcParts parts  )  const [protected]

bool storage::Disk::checkPartedValid ( SystemInfo systeminfo,
list< Partition * > &  pl,
unsigned long &  rng 
) const [protected]

bool storage::Disk::checkPartitionsValid ( SystemInfo systeminfo,
const list< Partition * > &  pl 
) const [protected, virtual]

bool storage::Disk::callDelpart ( unsigned  nr  )  const [protected]

bool storage::Disk::callAddpart ( unsigned  nr,
const Region blkRegion 
) const [protected]

bool storage::Disk::getPartedValues ( Partition p  )  const [protected]

bool storage::Disk::getPartedSectors ( const Partition p,
unsigned long long &  start,
unsigned long long &  end 
) const [protected]

const Partition * storage::Disk::getPartitionAfter ( const Partition p  )  const [protected]

void storage::Disk::addPartition ( unsigned  num,
unsigned long long  sz,
SystemInfo ppart 
) [protected]

virtual void storage::Disk::print ( std::ostream &  s  )  const [inline, protected, virtual]

Reimplemented from storage::Container.

Reimplemented in storage::Dasd.

virtual Container* storage::Disk::getCopy (  )  const [inline, protected, virtual]

Implements storage::Container.

Reimplemented in storage::Dasd.

References Disk().

void storage::Disk::redetectGeometry (  )  [protected, virtual]

void storage::Disk::changeNumbers ( const PartIter b,
const PartIter e,
unsigned  start,
int  incr 
) [protected]

References y2mil.

Referenced by removePartition(), and storage::Dasd::removePartition().

int storage::Disk::createChecks ( PartitionType type,
const Region cylRegion,
bool  checkRelaxed 
) const [protected]

void storage::Disk::removePresentPartitions (  )  [protected]

void storage::Disk::removeFromMemory (  )  [protected]

void storage::Disk::enlargeGpt (  )  [protected]

unsigned long long storage::Disk::procExtendedBlks (  )  const [protected]

References sectorSize().

Referenced by checkPartedValid(), and getPartedValues().

int storage::Disk::doCreate ( Volume v  )  [protected, virtual]

Reimplemented from storage::Container.

Reimplemented in storage::Dasd.

References storage::IterPair< Iter >::begin(), BLOCKDEVBIN, storage::classic(), storage::Partition::createText(), storage::Geometry::cylinders, cylinders(), storage::Partition::cylSize(), storage::Partition::cylStart(), storage::decString(), detected_label, storage::Device::device(), storage::DISK_CREATE_PARTITION_INVALID_TYPE, storage::DISK_CREATE_PARTITION_INVALID_VOLUME, storage::DISK_CREATE_PARTITION_PARTED_FAILED, storage::DISK_PARTITION_NOT_FOUND, dmp_slave, doCreateLabel(), doSetType(), storage::IterPair< Iter >::empty(), storage::IterPair< Iter >::end(), storage::Container::end(), enlargeGpt(), execCheckFailed(), storage::existingLog(), storage::existingNotLog(), storage::EXTENDED, storage::fuzz_cyl, geometry, storage::Volume::getFormat(), storage::Volume::getLabel(), getPartedValues(), storage::Container::getStorage(), gpt_enlarge, storage::Storage::handleHald(), storage::Partition::id(), storage::Partition::ID_APPLE_HFS, storage::Partition::ID_DOS16, storage::Partition::ID_DOS32, storage::Partition::ID_GPT_BOOT, storage::Partition::ID_LINUX, storage::Partition::ID_SWAP, storage::Storage::instsys(), label, storage::IterPair< Iter >::length(), storage::LOGICAL, storage::logicalCreated(), storage::Device::name(), storage::Volume::needLabel(), new_geometry, storage::notDeletedExt(), storage::Volume::nr(), PARTEDCMD, partPair(), storage::PRIMARY, storage::quote(), storage::Device::setCreated(), storage::Volume::setLabel(), storage::Storage::showInfoCb(), storage::Device::silent, storage::sub_sat(), storage::toString(), storage::Partition::type(), storage::Volume::updateFsData(), storage::Storage::waitForDevice(), y2mil, and storage::Partition::zeroIfNeeded().

Referenced by storage::MdPartCo::doCreate(), and storage::DmPartCo::doCreate().

int storage::Disk::doRemove ( Volume v  )  [protected, virtual]

int storage::Disk::doResize ( Volume v  )  [protected, virtual]

int storage::Disk::doSetType ( Volume v  )  [protected, virtual]

int storage::Disk::doCreateLabel (  )  [protected, virtual]

void storage::Disk::logData ( const string &  Dir  )  const [protected, virtual]

void storage::Disk::setLabelData ( const string &  disklabel  )  [protected]

string storage::Disk::defaultLabel (  )  const [protected, virtual]

Disk& storage::Disk::operator= ( const Disk  )  [private]


Friends And Related Function Documentation

friend class Storage [friend]

Reimplemented from storage::Container.

Reimplemented in storage::Dasd.

friend class DmPartCo [friend]

friend class MdPartCo [friend]

std::ostream& operator<< ( std::ostream &  s,
const Disk d 
) [friend]


Member Data Documentation

const Disk::label_info storage::Disk::labels [static, protected]

Initial value:

 {
        { "msdos", true, 4, 256, (1ULL << 32) - 1 },    
        { "gpt", false, 128, 0, (1ULL << 48) - 1 },     
                                                        
        { "bsd", false, 8, 0, (1ULL << 32) - 1 },
        { "sun", false, 8, 0, (1ULL << 32) - 1 },
        { "mac", false, 64, 0, (1ULL << 32) - 1 },
        { "dasd", false, 3, 0, (1ULL << 32) - 1 },
        { "aix", false, 0, 0, (1ULL << 32) - 1 },
        { "amiga", false, 63, 0, (1ULL << 32) - 1 },
        { "", false, 0, 0, 0 }
    }

Referenced by getDlabelCapabilities().

const string storage::Disk::p_disks [static, protected]

Initial value:

 { "cciss/", "ida/", "ataraid/", "etherd/", "rd/", "mmcblk[0-9]+",
                                     "md[0-9]+" }

Referenced by needP().

string storage::Disk::label [protected]

string storage::Disk::udev_path [protected]

list<string> storage::Disk::udev_id [protected]

string storage::Disk::detected_label [protected]

string storage::Disk::logfile_name [protected]

Referenced by Disk(), and logData().

unsigned storage::Disk::max_primary [protected]

bool storage::Disk::ext_possible [protected]

unsigned storage::Disk::max_logical [protected]

bool storage::Disk::init_disk [protected]

bool storage::Disk::dmp_slave [protected]

bool storage::Disk::no_addpart [protected]

bool storage::Disk::gpt_enlarge [protected]

unsigned long storage::Disk::range [protected]

bool storage::Disk::del_ptable [protected]

storage::DiskInfo storage::Disk::info [mutable, protected]

Reimplemented from storage::Container.

Referenced by getInfo().


The documentation for this class was generated from the following files:

Generated on Mon Feb 6 10:42:57 2012 for yast2-storage by  doxygen 1.5.6