storage::MdPartCo Class Reference

#include <MdPartCo.h>

Inheritance diagram for storage::MdPartCo:

storage::Container

List of all members.

Public Member Functions

 MdPartCo (Storage *const s, const string &Name, ProcPart *ppart=NULL)
 MdPartCo (const MdPartCo &rhs)
virtual ~MdPartCo ()
unsigned long long sizeK () const
const string & labelName () const
const string & udevPath () const
const std::list< string > & udevId () const
unsigned numPartitions () const
void setUdevData (const list< string > &id)
bool matchMdName (const string &name)
void getMdPartCoState (storage::MdPartCoStateInfo &info)
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)
int removePartition (unsigned nr)
int changePartitionId (unsigned nr, unsigned id)
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) const
int destroyPartitionTable (const string &new_label)
int freeCylindersAfterPartition (const MdPart *p, unsigned long &freeCyls) const
int resizePartition (MdPart *p, unsigned long newCyl)
int resizeVolume (Volume *v, unsigned long long newSize)
int removeVolume (Volume *v)
int removeMdPart ()
unsigned maxPrimary () const
bool extendedPossible () const
unsigned maxLogical () const
unsigned int numPrimary () const
bool hasExtended () const
unsigned int numLogical () const
void getUnusedSpace (std::list< Region > &free, bool all=true, bool logical=false) const
unsigned long long cylinderToKb (unsigned long val) const
unsigned long kbToCylinder (unsigned long long val) const
string getPartName (unsigned nr) const
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)
PartitiongetPartition (unsigned nr, bool del)
int getPartitionInfo (deque< storage::PartitionInfo > &plist)
void getInfo (storage::MdPartCoInfo &info) const
bool equalContent (const Container &rhs) const
virtual string getDiffString (const Container &d) const
void logDifference (const MdPartCo &d) const
MdPartCooperator= (const MdPartCo &rhs)
string numToName (unsigned mdNum) const
void syncRaidtab ()
int nr (const string &name)
int nr ()
unsigned long chunkSize () const
storage::MdType personality () const
storage::MdArrayState getArrayState ()
void getMdUuid (string &val)
const string & pName () const
const string & ptName () const
void getDevs (std::list< string > &devices, bool all=true, bool spare=false) const
void getSpareDevs (std::list< string > &devices)

Static Public Member Functions

static storage::CType staticType ()
static string undevName (const string &name)
static list< string > getMdRaids ()
static bool matchMdRegex (const string &dev)
static unsigned mdMajor ()
static const string & pName (storage::MdType t)
static void activate (bool val, const string &tmpDir)
static bool isActive (void)
static bool hasPartitionTable (const string &name)
static bool hasFileSystem (const string &name)
static bool isImsmPlatform ()
static bool matchRegex (const string &dev)
static bool mdStringNum (const string &name, unsigned &num)
static int scanForRaid (list< string > &raidNames)
static list< string > filterMdPartCo (list< string > &raidList, ProcPart &ppart, bool isInst)
static bool getUuidName (const string dev, string &uuid, string &mdName)

Protected Types

enum  mdMap { MAP_DEV = 0, MAP_META, MAP_UUID, MAP_NAME }
enum  MdProperty {
  METADATA = 0, COMPONENT_SIZE, CHUNK_SIZE, ARRAY_STATE,
  LEVEL, LAYOUT, MDPROP_LAST
}
typedef CastIterator< VIter,
MdPart * > 
MdPartInter
typedef CastIterator< CVIter,
const MdPart * > 
MdPartCInter
typedef CheckFnc< const MdPartCheckFncMdPart
typedef CheckerIterator
< CheckFncMdPart, MdPartPI
< CheckFncMdPart >::type,
MdPartInter, MdPart
MdPartPIterator
typedef CheckerIterator
< CheckFncMdPart, MdPartCPI
< CheckFncMdPart >::type,
MdPartCInter, const MdPart
MdPartCPIterator
typedef DerefIterator
< MdPartPIterator, MdPart
MdPartIter
typedef DerefIterator
< MdPartCPIterator, const
MdPart
ConstMdPartIter
typedef IterPair< MdPartIterMdPartPair
typedef IterPair< ConstMdPartIterConstMdPartPair

Protected Member Functions

MdPartPair mdpartPair (bool(*CheckMdPart)(const MdPart &)=NULL)
MdPartIter mdpartBegin (bool(*CheckMdPart)(const MdPart &)=NULL)
MdPartIter mdpartEnd (bool(*CheckMdPart)(const MdPart &)=NULL)
ConstMdPartPair mdpartPair (bool(*CheckMdPart)(const MdPart &)=NULL) const
ConstMdPartIter mdpartBegin (bool(*CheckMdPart)(const MdPart &)=NULL) const
ConstMdPartIter mdpartEnd (bool(*CheckMdPart)(const MdPart &)=NULL) const
 MdPartCo (Storage *const s, const string &File)
virtual void print (std::ostream &s) const
virtual ContainergetCopy () const
void activate_part (bool val)
void init (ProcPart *ppart)
void createDisk (ProcPart *ppart)
void getVolumes (ProcPart *ppart)
void updatePointers (bool invalid=false)
void updateMinor ()
virtual void newP (MdPart *&dm, unsigned num, Partition *p)
int addNewDev (string &device)
int updateDelDev ()
void handleWholeDevice ()
void removeFromMemory ()
void removePresentPartitions ()
bool validPartition (const Partition *p)
bool findMdPart (unsigned nr, MdPartIter &i)
void updateEntry ()
string mdadmLine () const
void raidtabLines (list< string > &lines) const
int doCreate (Volume *v)
int doRemove (Volume *v)
int doResize (Volume *v)
int doSetType (MdPart *v)
int doCreateLabel ()
virtual int doRemove ()
virtual string removeText (bool doing) const
virtual string setDiskLabelText (bool doing) const
void getMajorMinor (void)
void makeDevName (const string &name)
void initMd (void)
void setSize (unsigned long long size)
bool isMdPart (const string &name)
void getPartNum (const string &device, unsigned &num)
void getMdProps (void)
void setSpares (void)
int unuseDevs (void)
void logData (const string &Dir)
void getParent ()
void setMetaData ()
void setMdDevs ()
void setMdParity ()
void getSlaves (const string name, std::list< string > &devs_list)
string getContMember () const
bool readProp (enum MdProperty prop, string &val)
bool hasParity () const

Static Protected Member Functions

static bool partNotDeleted (const MdPart &d)
static bool isMdName (const string &name)
static bool findMdMap (std::ifstream &file)
static storage::CType envSelection (const string &name)
static bool havePartsInProc (const string &name, ProcPart &ppart)
static void getMdMajor ()
static storage::MdType toMdType (const string &val)
static storage::MdParity toMdParity (const string &val)
static storage::MdArrayState toMdArrayState (const string &val)

Protected Attributes

string udev_path
std::list< string > udev_id
string logfile_name
Diskdisk
bool del_ptable
unsigned num_part
unsigned long chunk_size
storage::MdType md_type
storage::MdParity md_parity
storage::MdArrayState md_state
bool has_container
string parent_container
string parent_uuid
string parent_metadata
string parent_md_name
string md_metadata
string md_uuid
string sb_ver
bool destrSb
std::list< string > devs
std::list< string > spare
string md_name
storage::MdPartCoInfo info

Static Protected Attributes

static string md_names [storage::MULTIPATH+1]
static string par_names [storage::RIGHT_SYMMETRIC+1]
static string md_states [storage::ACTIVE_IDLE+1]
static unsigned md_major = 0
static string sysfs_path = "/sys/devices/virtual/block/"
static string md_props [MDPROP_LAST]
static bool active = false

Friends

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

Classes

struct  MdPartCPI
struct  MdPartPI


Detailed Description

Class: MdPartCo

Brief: MD RAID Volume that can be partitioned and used as container for partitions.


Member Typedef Documentation


Member Enumeration Documentation

enum storage::MdPartCo::mdMap [protected]

Enumerator:
MAP_DEV 
MAP_META 
MAP_UUID 
MAP_NAME 

Enumerator:
METADATA 
COMPONENT_SIZE 
CHUNK_SIZE 
ARRAY_STATE 
LEVEL 
LAYOUT 
MDPROP_LAST 


Constructor & Destructor Documentation

storage::MdPartCo::MdPartCo ( Storage *const   s,
const string &  Name,
ProcPart ppart = NULL 
)

storage::MdPartCo::MdPartCo ( const MdPartCo rhs  ) 

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

References storage::Container::dev, disk, and y2deb.

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


Member Function Documentation

unsigned long long storage::MdPartCo::sizeK (  )  const [inline]

Reimplemented from storage::Container.

References storage::Container::size_k.

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

References disk, and storage::Disk::labelName().

Referenced by doCreateLabel(), and setDiskLabelText().

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

References udev_path.

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

unsigned storage::MdPartCo::numPartitions (  )  const [inline]

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

Reimplemented from storage::Container.

References storage::MDPART.

Referenced by getCommitActions().

void storage::MdPartCo::setUdevData ( const list< string > &  id  ) 

bool storage::MdPartCo::matchMdName ( const string &  name  )  [inline]

void storage::MdPartCo::getMdPartCoState ( storage::MdPartCoStateInfo info  ) 

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

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

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

int storage::MdPartCo::removePartition ( unsigned  nr  ) 

int storage::MdPartCo::changePartitionId ( unsigned  nr,
unsigned  id 
)

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

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

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

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

int storage::MdPartCo::freeCylindersAfterPartition ( const MdPart p,
unsigned long &  freeCyls 
) const

int storage::MdPartCo::resizePartition ( MdPart p,
unsigned long  newCyl 
)

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

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

int storage::MdPartCo::removeMdPart (  ) 

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

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

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

unsigned int storage::MdPartCo::numPrimary (  )  const [inline]

bool storage::MdPartCo::hasExtended (  )  const [inline]

unsigned int storage::MdPartCo::numLogical (  )  const [inline]

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

unsigned long long storage::MdPartCo::cylinderToKb ( unsigned long  val  )  const [inline]

unsigned long storage::MdPartCo::kbToCylinder ( unsigned long long  val  )  const [inline]

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

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

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

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

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

Partition * storage::MdPartCo::getPartition ( unsigned  nr,
bool  del 
)

int storage::MdPartCo::getPartitionInfo ( deque< storage::PartitionInfo > &  plist  ) 

void storage::MdPartCo::getInfo ( storage::MdPartCoInfo info  )  const

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

string storage::MdPartCo::getDiffString ( const Container d  )  const [virtual]

Reimplemented from storage::Container.

References active, del_ptable, and storage::Container::getDiffString().

Referenced by logDifference().

void storage::MdPartCo::logDifference ( const MdPartCo d  )  const

MdPartCo& storage::MdPartCo::operator= ( const MdPartCo rhs  ) 

string storage::MdPartCo::undevName ( const string &  name  )  [static]

string storage::MdPartCo::numToName ( unsigned  mdNum  )  const

list< string > storage::MdPartCo::getMdRaids (  )  [static]

void storage::MdPartCo::syncRaidtab (  ) 

References updateEntry().

int storage::MdPartCo::nr ( const string &  name  ) 

int storage::MdPartCo::nr (  ) 

References storage::Container::mnr.

Referenced by doRemove().

unsigned long storage::MdPartCo::chunkSize (  )  const [inline]

References chunk_size.

storage::MdType storage::MdPartCo::personality (  )  const [inline]

References md_type.

storage::MdArrayState storage::MdPartCo::getArrayState (  )  [inline]

References md_state.

void storage::MdPartCo::getMdUuid ( string &  val  )  [inline]

References md_uuid.

const string& storage::MdPartCo::pName (  )  const [inline]

References md_names, and md_type.

Referenced by mdadmLine().

const string& storage::MdPartCo::ptName (  )  const [inline]

References md_parity, and par_names.

Referenced by raidtabLines().

void storage::MdPartCo::getDevs ( std::list< string > &  devices,
bool  all = true,
bool  spare = false 
) const

References devs, and spare.

Referenced by doRemove(), and unuseDevs().

void storage::MdPartCo::getSpareDevs ( std::list< string > &  devices  ) 

References spare.

bool storage::MdPartCo::matchMdRegex ( const string &  dev  )  [static]

unsigned storage::MdPartCo::mdMajor (  )  [static]

References getMdMajor(), and md_major.

static const string& storage::MdPartCo::pName ( storage::MdType  t  )  [inline, static]

References md_names.

void storage::MdPartCo::activate ( bool  val,
const string &  tmpDir 
) [static]

static bool storage::MdPartCo::isActive ( void   )  [inline, static]

References active.

bool storage::MdPartCo::hasPartitionTable ( const string &  name  )  [static]

bool storage::MdPartCo::hasFileSystem ( const string &  name  )  [static]

bool storage::MdPartCo::isImsmPlatform (  )  [static]

bool storage::MdPartCo::matchRegex ( const string &  dev  )  [static]

References storage::Regex::match().

Referenced by mdStringNum().

bool storage::MdPartCo::mdStringNum ( const string &  name,
unsigned &  num 
) [static]

int storage::MdPartCo::scanForRaid ( list< string > &  raidNames  )  [static]

list< string > storage::MdPartCo::filterMdPartCo ( list< string > &  raidList,
ProcPart ppart,
bool  isInst 
) [static]

bool storage::MdPartCo::getUuidName ( const string  dev,
string &  uuid,
string &  mdName 
) [static]

MdPartPair storage::MdPartCo::mdpartPair ( bool(*)(const MdPart &)  CheckMdPart = NULL  )  [inline, protected]

MdPartIter storage::MdPartCo::mdpartBegin ( bool(*)(const MdPart &)  CheckMdPart = NULL  )  [inline, protected]

MdPartIter storage::MdPartCo::mdpartEnd ( bool(*)(const MdPart &)  CheckMdPart = NULL  )  [inline, protected]

ConstMdPartPair storage::MdPartCo::mdpartPair ( bool(*)(const MdPart &)  CheckMdPart = NULL  )  const [inline, protected]

References mdpartBegin(), and mdpartEnd().

ConstMdPartIter storage::MdPartCo::mdpartBegin ( bool(*)(const MdPart &)  CheckMdPart = NULL  )  const [inline, protected]

ConstMdPartIter storage::MdPartCo::mdpartEnd ( bool(*)(const MdPart &)  CheckMdPart = NULL  )  const [inline, protected]

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

Reimplemented from storage::Container.

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

Reimplemented from storage::Container.

References MdPartCo().

void storage::MdPartCo::activate_part ( bool  val  )  [protected]

Referenced by doCreate(), and doResize().

void storage::MdPartCo::init ( ProcPart ppart  )  [protected]

void storage::MdPartCo::createDisk ( ProcPart ppart  )  [protected]

void storage::MdPartCo::getVolumes ( ProcPart ppart  )  [protected]

void storage::MdPartCo::updatePointers ( bool  invalid = false  )  [protected]

void storage::MdPartCo::updateMinor (  )  [protected]

void storage::MdPartCo::newP ( MdPart *&  dm,
unsigned  num,
Partition p 
) [protected, virtual]

int storage::MdPartCo::addNewDev ( string &  device  )  [protected]

int storage::MdPartCo::updateDelDev (  )  [protected]

void storage::MdPartCo::handleWholeDevice (  )  [protected]

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

References storage::Container::vols, and y2mil.

Referenced by doCreateLabel().

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

bool storage::MdPartCo::validPartition ( const Partition p  )  [protected]

bool storage::MdPartCo::findMdPart ( unsigned  nr,
MdPartIter i 
) [protected]

void storage::MdPartCo::updateEntry (  )  [protected]

string storage::MdPartCo::mdadmLine (  )  const [protected]

void storage::MdPartCo::raidtabLines ( list< string > &  lines  )  const [protected]

static bool storage::MdPartCo::partNotDeleted ( const MdPart d  )  [inline, static, protected]

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

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

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

int storage::MdPartCo::doSetType ( MdPart v  )  [protected]

int storage::MdPartCo::doCreateLabel (  )  [protected]

int storage::MdPartCo::doRemove (  )  [protected, virtual]

string storage::MdPartCo::removeText ( bool  doing  )  const [protected, virtual]

string storage::MdPartCo::setDiskLabelText ( bool  doing  )  const [protected, virtual]

void storage::MdPartCo::getMajorMinor ( void   )  [protected]

void storage::MdPartCo::makeDevName ( const string &  name  )  [protected]

References storage::Container::dev.

Referenced by MdPartCo().

void storage::MdPartCo::initMd ( void   )  [protected]

References getMdProps().

Referenced by MdPartCo().

void storage::MdPartCo::setSize ( unsigned long long  size  )  [protected]

References storage::Container::size_k.

Referenced by getMdProps().

bool storage::MdPartCo::isMdName ( const string &  name  )  [static, protected]

bool storage::MdPartCo::isMdPart ( const string &  name  )  [protected]

References storage::Regex::match(), and undevName().

Referenced by addNewDev().

void storage::MdPartCo::getPartNum ( const string &  device,
unsigned &  num 
) [protected]

References storage::Container::dev.

Referenced by addNewDev().

void storage::MdPartCo::getMdProps ( void   )  [protected]

void storage::MdPartCo::setSpares ( void   )  [protected]

int storage::MdPartCo::unuseDevs ( void   )  [protected]

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

Reimplemented from storage::Container.

void storage::MdPartCo::getParent (  )  [protected]

void storage::MdPartCo::setMetaData (  )  [protected]

void storage::MdPartCo::setMdDevs (  )  [protected]

void storage::MdPartCo::setMdParity (  )  [protected]

void storage::MdPartCo::getSlaves ( const string  name,
std::list< string > &  devs_list 
) [protected]

References sysfs_path, and y2mil.

Referenced by setMdDevs(), and setSpares().

bool storage::MdPartCo::findMdMap ( std::ifstream &  file  )  [static, protected]

References storage::classic(), and y2war.

Referenced by getUuidName().

string storage::MdPartCo::getContMember (  )  const [protected]

References md_metadata, and y2mil.

Referenced by updateEntry().

storage::CType storage::MdPartCo::envSelection ( const string &  name  )  [static, protected]

bool storage::MdPartCo::havePartsInProc ( const string &  name,
ProcPart ppart 
) [static, protected]

void storage::MdPartCo::getMdMajor (  )  [static, protected]

References storage::getMajorDevices(), and md_major.

Referenced by mdMajor().

MdType storage::MdPartCo::toMdType ( const string &  val  )  [static, protected]

References md_names, storage::MULTIPATH, and storage::RAID_UNK.

Referenced by getMdProps().

MdParity storage::MdPartCo::toMdParity ( const string &  val  )  [static, protected]

storage::MdArrayState storage::MdPartCo::toMdArrayState ( const string &  val  )  [static, protected]

bool storage::MdPartCo::readProp ( enum MdProperty  prop,
string &  val 
) [protected]

bool storage::MdPartCo::hasParity (  )  const [inline, protected]


Friends And Related Function Documentation

friend class Storage [friend]

Reimplemented from storage::Container.

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


Member Data Documentation

string storage::MdPartCo::udev_path [protected]

Referenced by MdPartCo(), and udevPath().

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

string storage::MdPartCo::logfile_name [protected]

unsigned storage::MdPartCo::num_part [protected]

unsigned long storage::MdPartCo::chunk_size [protected]

string storage::MdPartCo::parent_uuid [protected]

string storage::MdPartCo::md_metadata [protected]

string storage::MdPartCo::md_uuid [protected]

string storage::MdPartCo::sb_ver [protected]

bool storage::MdPartCo::destrSb [protected]

std::list<string> storage::MdPartCo::devs [protected]

std::list<string> storage::MdPartCo::spare [protected]

string storage::MdPartCo::md_names [static, protected]

Initial value:

 { "unknown", "raid0", "raid1", "raid5", "raid6",
                          "raid10", "multipath" }

Referenced by logDifference(), pName(), and toMdType().

string storage::MdPartCo::par_names [static, protected]

Initial value:

 { "none", "left-asymmetric", "left-symmetric",
                           "right-asymmetric", "right-symmetric" }

Referenced by logDifference(), ptName(), and toMdParity().

string storage::MdPartCo::md_states [static, protected]

Initial value:

 {"clear", "inactive", "suspended", "readonly",
                          "read-auto", "clean", "active", "write-pending",
                          "active-idle"}

Referenced by toMdArrayState().

unsigned storage::MdPartCo::md_major = 0 [static, protected]

Referenced by getMdMajor(), and mdMajor().

string storage::MdPartCo::md_name [protected]

string storage::MdPartCo::sysfs_path = "/sys/devices/virtual/block/" [static, protected]

string storage::MdPartCo::md_props [static, protected]

Initial value:

 {"metadata_version", "component_size", "chunk_size",
                       "array_state", "level", "layout" }

Referenced by readProp(), and setMetaData().

Reimplemented from storage::Container.

Referenced by getInfo(), and updateEntry().

bool storage::MdPartCo::active = false [static, protected]


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

Generated on Tue May 11 23:29:45 2010 for yast2-storage by  doxygen 1.5.6