storage::Disk Class Reference

#include <Disk.h>

Inheritance diagram for storage::Disk:

storage::Container storage::Dasd

List of all members.

Public Types

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

Public Member Functions

 Disk (Storage *const s, const string &Name, unsigned long long Size)
 Disk (Storage *const s, const string &Name, unsigned num, unsigned long long Size, ProcPart &ppart)
 Disk (const Disk &rhs)
virtual ~Disk ()
unsigned long cylinders () const
unsigned heads () const
unsigned sectors () const
unsigned long numMinor () const
unsigned long cylSizeB () const
unsigned maxPrimary () const
unsigned maxLogical () const
const string & labelName () const
const string & udevPath () const
const std::list< string > & udevId () const
void setSlave (bool val=true)
void setNumMinor (unsigned long val)
void addMpAlias (const string &dev)
void clearMpAlias ()
const std::list< string > & mpAlias () const
const string & sysfsDir () const
unsigned numPartitions () const
bool isDasd () const
bool isLogical (unsigned nr) const
bool detect (ProcPart &ppart)
void triggerUdevUpdate ()
void setUdevData (const string &path, const 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, unsigned long start, unsigned long size, bool checkRelaxed=false)
int nextFreePartition (storage::PartitionType type, unsigned &nr, string &device)
int destroyPartitionTable (const string &new_label)
unsigned availablePartNumber (storage::PartitionType type=storage::PRIMARY)
virtual void getCommitActions (std::list< storage::commitAction * > &l) const
virtual int getToCommit (storage::CommitStage stage, std::list< Container * > &col, std::list< Volume * > &vol)
virtual int commitChanges (storage::CommitStage stage)
int commitChanges (storage::CommitStage stage, Volume *vol)
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)
bool hasExtended () const
string setDiskLabelText (bool doing=true) const
unsigned long long cylinderToKb (unsigned long) const
unsigned long kbToCylinder (unsigned long long) const
string getPartName (unsigned nr) const
void getInfo (storage::DiskInfo &info) const
bool equalContent (const Container &rhs) const
void logDifference (const Container &d) const
Diskoperator= (const Disk &rhs)
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 storage::CType staticType ()
static bool needP (const string &dev)
static string getPartName (const string &disk, unsigned nr)
static string getPartName (const string &disk, const string &nr)
static std::pair< string,
unsigned > 
getDiskPartition (const string &dev)
static unsigned long long maxSizeLabelK (const string &label)

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)
 Disk (Storage *const s, const string &File)
virtual bool detectGeometry ()
virtual bool detectPartitions (ProcPart &ppart)
bool getSysfsInfo (const string &SysFsDir)
int checkSystemError (const string &cmd_line, const SystemCmd &cmd)
int execCheckFailed (const string &cmd_line)
int execCheckFailed (SystemCmd &cmd, const string &cmd_line)
bool checkPartedOutput (const SystemCmd &cmd, ProcPart &ppart)
bool scanPartedLine (const string &Line, unsigned &nr, unsigned long &start, unsigned long &csize, storage::PartitionType &type, unsigned &id, bool &boot)
bool checkPartedValid (const ProcPart &pp, const string &diskname, std::list< Partition * > &pl, unsigned long &rng)
bool getPartedValues (Partition *p)
bool getPartedSectors (const Partition *p, unsigned long long &start, unsigned long long &end)
const PartitiongetPartitionAfter (const Partition *p)
virtual void print (std::ostream &s) const
virtual ContainergetCopy () const
void getGeometry (const string &line, unsigned long &c, unsigned &h, unsigned &s)
virtual void redetectGeometry ()
void changeNumbers (const PartIter &b, const PartIter &e, unsigned start, int incr)
int createChecks (storage::PartitionType &type, unsigned long start, unsigned long len, bool checkRelaxed)
void removePresentPartitions ()
void removeFromMemory ()
void enlargeGpt ()
virtual int doCreate (Volume *v)
virtual int doRemove (Volume *v)
virtual int doResize (Volume *v)
virtual int doSetType (Volume *v)
virtual int doCreateLabel ()
void logData (const string &Dir)
bool haveBsdPart (const std::list< Partition * > &pl) const
void setLabelData (const string &)

Static Protected Member Functions

static bool notDeleted (const Partition &d)
static bool bootSpecial (const Partition &d)
static string defaultLabel (unsigned long long size_k)

Protected Attributes

unsigned long cyl
unsigned head
unsigned sector
unsigned long new_cyl
unsigned new_head
unsigned new_sector
string label
string udev_path
std::list< string > udev_id
std::list< string > mp_alias
string detected_label
string system_stderr
string logfile_name
string sysfs_dir
unsigned max_primary
bool ext_possible
bool init_disk
bool iscsi
bool dmp_slave
bool gpt_enlarge
unsigned max_logical
unsigned long byte_cyl
unsigned long range
storage::DiskInfo info

Static Protected Attributes

static label_info labels []
static string p_disks [] = { "cciss/", "ida/", "ataraid/", "etherd/", "rd/" }

Friends

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

Classes

struct  label_info
struct  PartitionCPI
struct  PartitionPI


Member Typedef Documentation

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


Constructor & Destructor Documentation

Disk::Disk ( Storage *const   s,
const string &  Name,
unsigned long long  Size 
)

Disk::Disk ( Storage *const   s,
const string &  Name,
unsigned  num,
unsigned long long  Size,
ProcPart ppart 
)

Disk::Disk ( const Disk rhs  ) 

Disk::~Disk (  )  [virtual]

References storage::Container::dev, and y2debug.

Disk::Disk ( Storage *const   s,
const string &  File 
) [protected]


Member Function Documentation

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

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

References head.

Referenced by getInfo().

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

References sector.

Referenced by getInfo().

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

References range.

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

References byte_cyl.

Referenced by getInfo().

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

References max_primary.

Referenced by getInfo().

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

References max_logical.

Referenced by getInfo().

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

References label.

Referenced by getInfo(), and storage::DmPartCo::labelName().

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

References udev_path.

Referenced by storage::Partition::changeNumber().

const std::list<string>& storage::Disk::udevId (  )  const [inline]

References udev_id.

Referenced by storage::Partition::addAltUdevId().

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

References dmp_slave.

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

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

References range.

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

void Disk::addMpAlias ( const string &  dev  ) 

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

References mp_alias.

const std::list<string>& storage::Disk::mpAlias (  )  const [inline]

References mp_alias.

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

References sysfs_dir.

Referenced by storage::Partition::sysfsPath().

unsigned Disk::numPartitions (  )  const

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

References storage::Container::nm.

Referenced by needDasdfmt().

bool Disk::isLogical ( unsigned  nr  )  const

bool Disk::detect ( ProcPart ppart  ) 

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

Reimplemented from storage::Container.

References storage::DISK.

void Disk::triggerUdevUpdate (  ) 

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

void Disk::setUdevData ( const string &  path,
const 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 Disk::createPartition ( storage::PartitionType  type,
string &  device 
)

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

int 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 needDasdfmt().

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

References init_disk.

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

References init_disk.

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

int Disk::forgetChangePartitionId ( unsigned  nr  ) 

int Disk::changePartitionArea ( unsigned  nr,
unsigned long  start,
unsigned long  size,
bool  checkRelaxed = false 
)

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

int Disk::destroyPartitionTable ( const string &  new_label  ) 

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

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

Reimplemented from storage::Container.

Reimplemented in storage::Dasd.

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

Reimplemented from storage::Container.

Reimplemented in storage::Dasd.

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

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

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

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

int 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 
)

Referenced by createPartition().

bool Disk::hasExtended (  )  const

References ext_possible, isExtended(), and partPair().

Referenced by availablePartNumber().

string Disk::setDiskLabelText ( bool  doing = true  )  const

unsigned long long Disk::cylinderToKb ( unsigned long  cylinder  )  const

unsigned long Disk::kbToCylinder ( unsigned long long  kb  )  const

string Disk::getPartName ( unsigned  nr  )  const

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

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

void Disk::logDifference ( const Container d  )  const [virtual]

Disk & Disk::operator= ( const Disk rhs  ) 

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

References range.

Referenced by Disk().

string Disk::getPartName ( const string &  disk,
unsigned  nr 
) [static]

References storage::decString(), and needP().

string Disk::getPartName ( const string &  disk,
const string &  nr 
) [static]

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

unsigned long long Disk::maxSizeLabelK ( const string &  label  )  [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 Disk::detectGeometry (  )  [protected, virtual]

bool Disk::detectPartitions ( ProcPart ppart  )  [protected, virtual]

bool Disk::getSysfsInfo ( const string &  SysFsDir  )  [protected]

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

int Disk::execCheckFailed ( const string &  cmd_line  )  [protected]

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

bool Disk::checkPartedOutput ( const SystemCmd cmd,
ProcPart ppart 
) [protected]

bool Disk::scanPartedLine ( const string &  Line,
unsigned &  nr,
unsigned long &  start,
unsigned long &  csize,
storage::PartitionType type,
unsigned &  id,
bool &  boot 
) [protected]

bool storage::Disk::checkPartedValid ( const ProcPart pp,
const string &  diskname,
std::list< Partition * > &  pl,
unsigned long &  rng 
) [protected]

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

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

const Partition * Disk::getPartitionAfter ( const Partition p  )  [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]

Reimplemented from storage::Container.

Reimplemented in storage::Dasd.

References Disk().

void Disk::getGeometry ( const string &  line,
unsigned long &  c,
unsigned &  h,
unsigned &  s 
) [protected]

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

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

int Disk::createChecks ( storage::PartitionType type,
unsigned long  start,
unsigned long  len,
bool  checkRelaxed 
) [protected]

void Disk::removePresentPartitions (  )  [protected]

void Disk::removeFromMemory (  )  [protected]

void Disk::enlargeGpt (  )  [protected]

static bool storage::Disk::notDeleted ( const Partition d  )  [inline, static, protected]

static bool storage::Disk::bootSpecial ( const Partition d  )  [inline, static, protected]

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

Reimplemented from storage::Container.

Reimplemented in storage::Dasd.

References storage::IterPair< Iter >::begin(), storage::Partition::createText(), cylinders(), storage::Partition::cylSize(), storage::Partition::cylStart(), storage::decString(), detected_label, storage::Volume::device(), storage::Container::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::SystemCmd::execute(), existingLog(), existingNotLog(), storage::EXTENDED, storage::Volume::getFormat(), getPartedValues(), storage::Container::getStorage(), storage::Volume::getUsedByType(), gpt_enlarge, head, storage::Partition::id(), storage::Partition::ID_APPLE_HFS, storage::Partition::ID_DOS, storage::Partition::ID_DOS16, storage::Partition::ID_GPT_BOOT, storage::Partition::ID_LINUX, storage::Partition::ID_SWAP, storage::Storage::instsys(), isExtended(), label, storage::IterPair< Iter >::length(), storage::LOGICAL, logicalCreated(), storage::Volume::name(), storage::Container::name(), new_cyl, new_head, new_sector, storage::Volume::nr(), PARTEDCMD, partPair(), storage::PRIMARY, sector, storage::Volume::setCreated(), storage::Storage::showInfoCb(), storage::Container::silent, storage::Volume::sizeK(), system_stderr, storage::Partition::type(), storage::UB_EVMS, storage::UB_LVM, storage::Volume::updateFsData(), storage::Storage::waitForDevice(), y2mil, and y2milestone.

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

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

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

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

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

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

bool storage::Disk::haveBsdPart ( const std::list< Partition * > &  pl  )  const [protected]

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

string Disk::defaultLabel ( unsigned long long  size_k  )  [static, protected]


Friends And Related Function Documentation

friend class Storage [friend]

Reimplemented from storage::Container.

Reimplemented in storage::Dasd.

friend class DmPartCo [friend]

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


Member Data Documentation

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

Initial value:

 {
        { "msdos", true, 4, 63, 2*TB },
        { "gpt", false, 128, 0, 16*PB },
        { "bsd", false, 8, 0, 2*TB },
        { "sun", false, 8, 0, 2*TB },
        { "mac", false, 64, 0, 2*TB },
        { "dasd", false, 3, 0, 2*TB },
        { "aix", false, 0, 0, 2*TB },
        { "amiga", false, 63, 0, 2*TB },
        { "", false, 0, 0, 0 }
    }

Referenced by maxSizeLabelK(), and setLabelData().

string Disk::p_disks = { "cciss/", "ida/", "ataraid/", "etherd/", "rd/" } [static, protected]

Referenced by needP().

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

unsigned storage::Disk::head [protected]

unsigned storage::Disk::sector [protected]

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

unsigned storage::Disk::new_head [protected]

unsigned storage::Disk::new_sector [protected]

string storage::Disk::label [protected]

string storage::Disk::udev_path [protected]

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

std::list<string> storage::Disk::mp_alias [protected]

string storage::Disk::detected_label [protected]

string storage::Disk::system_stderr [protected]

string storage::Disk::logfile_name [protected]

Referenced by Disk(), logData(), and operator=().

string storage::Disk::sysfs_dir [protected]

unsigned storage::Disk::max_primary [protected]

bool storage::Disk::ext_possible [protected]

bool storage::Disk::init_disk [protected]

bool storage::Disk::iscsi [protected]

bool storage::Disk::dmp_slave [protected]

bool storage::Disk::gpt_enlarge [protected]

unsigned storage::Disk::max_logical [protected]

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

unsigned long storage::Disk::range [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 Sun Jun 8 10:48:03 2008 for yast2-storage by  doxygen 1.5.5