yast2-storage
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | Friends

storage::Disk Class Reference

#include <Disk.h>

Inheritance diagram for storage::Disk:
storage::Container storage::Device storage::Dasd

List of all members.

Classes

struct  label_info
struct  PartitionCPI
struct  PartitionPI
struct  SysfsInfo

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
Region detectSysfsBlkRegion (bool log_error=true) 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)
static string devToSysfs (const string &nm)
static string sysfsToDev (const string &nm)

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 checkFakePartition (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
bool has_fake_partition
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 &)

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 
)

References storage::decString(), and y2mil.

storage::Disk::Disk ( Storage s,
const xmlNode *  node 
)
storage::Disk::Disk ( const Disk c)
storage::Disk::~Disk ( ) [virtual]

Member Function Documentation

void storage::Disk::addPartition ( unsigned  num,
unsigned long long  sz,
SystemInfo ppart 
) [protected]
unsigned storage::Disk::availablePartNumber ( storage::PartitionType  type = storage::PRIMARY) const
bool storage::Disk::callAddpart ( unsigned  nr,
const Region blkRegion 
) const [protected]
bool storage::Disk::callDelpart ( unsigned  nr) const [protected]
void storage::Disk::changeNumbers ( const PartIter b,
const PartIter e,
unsigned  start,
int  incr 
) [protected]
int storage::Disk::changePartitionArea ( unsigned  nr,
const Region cylRegion,
bool  checkRelaxed = false 
)
int storage::Disk::changePartitionId ( unsigned  nr,
unsigned  id 
) [virtual]
bool storage::Disk::checkFakePartition ( SystemInfo systeminfo,
const list< Partition * > &  pl 
) const [protected]
bool storage::Disk::checkPartedOutput ( SystemInfo systeminfo) [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]
int storage::Disk::checkSystemError ( const string &  cmd_line,
const SystemCmd cmd 
) const [protected]

References y2err.

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

Reimplemented from storage::Container.

Reimplemented in storage::Dasd.

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

Reimplemented from storage::Container.

int storage::Disk::createChecks ( PartitionType type,
const Region cylRegion,
bool  checkRelaxed 
) const [protected]
int storage::Disk::createPartition ( long unsigned  len,
string &  device,
bool  checkRelaxed = false 
)
int storage::Disk::createPartition ( storage::PartitionType  type,
string &  device 
)
virtual int storage::Disk::createPartition ( storage::PartitionType  type,
long unsigned  start,
long unsigned  len,
string &  device,
bool  checkRelaxed = false 
) [virtual]
unsigned long storage::Disk::cylinders ( ) const [inline]
unsigned long long storage::Disk::cylinderToKb ( unsigned long  cylinder) const [inline]
string storage::Disk::defaultLabel ( ) const [protected, virtual]

Reimplemented in storage::Dasd.

int storage::Disk::destroyPartitionTable ( const string &  new_label)
bool storage::Disk::detect ( SystemInfo systeminfo)
bool storage::Disk::detectGeometry ( ) [protected, virtual]
bool storage::Disk::detectPartitions ( SystemInfo systeminfo) [protected, virtual]

Reimplemented in storage::Dasd.

Region storage::Disk::detectSysfsBlkRegion ( bool  log_error = true) const
string storage::Disk::devToSysfs ( const string &  nm) [static]
int storage::Disk::doCreate ( Volume v) [protected, virtual]
int storage::Disk::doCreateLabel ( ) [protected, virtual]
int storage::Disk::doRemove ( Volume v) [protected, virtual]
int storage::Disk::doResize ( Volume v) [protected, virtual]
int storage::Disk::doSetType ( Volume v) [protected, virtual]
void storage::Disk::enlargeGpt ( ) [protected]

References PARTEDBIN, and storage::quote().

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

Reimplemented from storage::Container.

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::extendedPossible ( ) const [inline]
bool storage::Disk::FakeDisk ( ) const [inline]

References range.

int storage::Disk::forgetChangePartitionId ( unsigned  nr)
int storage::Disk::freeCylindersAroundPartition ( const Partition p,
unsigned long &  freeCylsBefore,
unsigned long &  freeCylsAfter 
) const
void storage::Disk::getCommitActions ( list< commitAction > &  l) const [virtual]

Reimplemented from storage::Container.

Reimplemented in storage::Dasd.

References storage::DECREASE.

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

Implements storage::Container.

Reimplemented in storage::Dasd.

References Disk().

pair< string, unsigned > storage::Disk::getDiskPartition ( const string &  dev) [static]
bool storage::Disk::getDlabelCapabilities ( const string &  dlabel,
storage::DlabelCapabilities dlabelcapabilities 
) [static]
const Geometry& storage::Disk::getGeometry ( ) const [inline]

References geometry.

Referenced by storage::operator<<().

void storage::Disk::getInfo ( storage::DiskInfo info) const
string storage::Disk::getPartDevice ( unsigned  nr) const
bool storage::Disk::getPartedSectors ( const Partition p,
unsigned long long &  start,
unsigned long long &  end 
) const [protected]
bool storage::Disk::getPartedValues ( Partition p) const [protected]
const Partition * storage::Disk::getPartitionAfter ( const Partition p) const [protected]
string storage::Disk::getPartName ( unsigned  nr) const
bool storage::Disk::getSysfsInfo ( const string &  sysfsdir,
SysfsInfo sysfsinfo 
) [static]
bool storage::Disk::getSysfsInfo ( ) [protected]
void storage::Disk::getToCommit ( storage::CommitStage  stage,
list< const Container * > &  col,
list< const Volume * > &  vol 
) const [virtual]

Reimplemented from storage::Container.

Reimplemented in storage::Dasd.

void storage::Disk::getUnusedSpace ( std::list< Region > &  free,
bool  all = true,
bool  logical = false 
) const
bool storage::Disk::hasExtended ( ) const
unsigned storage::Disk::heads ( ) const [inline]
virtual int storage::Disk::initializeDisk ( bool  ) [inline, virtual]

Reimplemented in storage::Dasd.

References storage::DISK_INIT_NOT_POSSIBLE.

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

References init_disk.

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

References storage::Device::nm.

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
unsigned long storage::Disk::kbToCylinder ( unsigned long long  kb) const [inline]
unsigned long long storage::Disk::kbToSector ( unsigned long long  kb) const [inline]
const string& storage::Disk::labelName ( ) const [inline]
void storage::Disk::logData ( const string &  Dir) const [protected, virtual]

Reimplemented from storage::Container.

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

Implements storage::Container.

unsigned storage::Disk::maxLogical ( ) const [inline]
unsigned storage::Disk::maxPrimary ( ) const [inline]
bool storage::Disk::needP ( const string &  dev) [static]
int storage::Disk::nextFreePartition ( storage::PartitionType  type,
unsigned &  nr,
string &  device 
) const
unsigned int storage::Disk::numLogical ( ) const
unsigned long storage::Disk::numMinor ( ) const [inline]

References range.

unsigned storage::Disk::numPartitions ( ) const
unsigned int storage::Disk::numPrimary ( ) const
Disk& storage::Disk::operator= ( const Disk ) [private]
PartIter storage::Disk::partBegin ( bool(*)(const Partition &)  CheckPart = NULL) [inline, protected]
ConstPartIter storage::Disk::partBegin ( bool(*)(const Partition &)  CheckPart = NULL) const [inline]
ConstPartIter storage::Disk::partEnd ( bool(*)(const Partition &)  CheckPart = NULL) const [inline]
PartIter storage::Disk::partEnd ( bool(*)(const Partition &)  CheckPart = NULL) [inline, protected]
list< string > storage::Disk::partitionsKernelKnowns ( const ProcParts parts) const [protected]
string storage::Disk::partNaming ( const string &  disk) [static]
PartPair storage::Disk::partPair ( bool(*)(const Partition &)  CheckPart = NULL) [inline, protected]
ConstPartPair storage::Disk::partPair ( bool(*)(const Partition &)  CheckPart = NULL) const [inline]

References partBegin(), and partEnd().

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

Reimplemented from storage::Container.

Reimplemented in storage::Dasd.

unsigned long long storage::Disk::procExtendedBlks ( ) const [protected]
virtual string storage::Disk::procName ( ) const [inline, virtual]

Reimplemented from storage::Device.

References storage::Device::nm.

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

Reimplemented in storage::Dasd.

References y2mil.

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

References y2mil.

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

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

References y2mil.

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

Reimplemented from storage::Container.

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

References init_disk.

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

int storage::Disk::resizePartition ( Partition p,
unsigned long  newCyl 
) [virtual]
int storage::Disk::resizeVolume ( Volume v,
unsigned long long  newSize 
) [virtual]
void storage::Disk::saveData ( xmlNode *  node) const

Reimplemented from storage::Container.

unsigned storage::Disk::sectors ( ) const [inline]
unsigned storage::Disk::sectorSize ( ) const [inline]
unsigned long long storage::Disk::sectorToKb ( unsigned long long  sector) const [inline]
void storage::Disk::setAddpart ( bool  val = true) [inline]

References no_addpart.

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

Text storage::Disk::setDiskLabelText ( bool  doing) const
void storage::Disk::setLabelData ( const string &  disklabel) [protected]
void storage::Disk::setNumMinor ( unsigned long  val) [inline]
void storage::Disk::setSlave ( bool  val = true) [inline]
void storage::Disk::setUdevData ( const string &  path,
const list< string > &  id 
)
static storage::CType storage::Disk::staticType ( ) [inline, static]

Reimplemented from storage::Container.

References storage::DISK.

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

string storage::Disk::sysfsPath ( ) const [virtual]
string storage::Disk::sysfsPath ( const string &  device) [static]
string storage::Disk::sysfsToDev ( const string &  nm) [static]
void storage::Disk::triggerUdevUpdate ( ) const
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().

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

Friends And Related Function Documentation

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

Reimplemented from storage::Container.

Reimplemented in storage::Dasd.


Member Data Documentation

bool storage::Disk::del_ptable [protected]
string storage::Disk::detected_label [protected]
bool storage::Disk::dmp_slave [protected]

Referenced by setSlave().

bool storage::Disk::ext_possible [protected]

Referenced by extendedPossible().

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

Reimplemented from storage::Container.

bool storage::Disk::init_disk [protected]
string storage::Disk::label [protected]

Referenced by labelName().

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 },
        { "xenxvd", false, 256, 0, (1ULL << 32) - 1 },  
        { "", false, 0, 0, 0 }
    }
string storage::Disk::logfile_name [protected]
unsigned storage::Disk::max_logical [protected]

Referenced by maxLogical().

unsigned storage::Disk::max_primary [protected]

Referenced by maxPrimary().

bool storage::Disk::no_addpart [protected]

Referenced by setAddpart().

const string storage::Disk::p_disks [static, protected]
Initial value:
 { "cciss/", "ida/", "ataraid/", "etherd/", "rd/", "mmcblk[0-9]+",
                                     "md[0-9]+", "nvme[0-9]+n[0-9]+" }
unsigned long storage::Disk::range [protected]

Referenced by isIScsi().

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

Referenced by udevId().

string storage::Disk::udev_path [protected]

Referenced by udevPath().


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