00001 #ifndef STORAGEINTERFACE_H
00002 #define STORAGEINTERFACE_H
00003
00004
00005 #include <string>
00006 #include <deque>
00007 #include <ostream>
00008
00009 using std::string;
00010 using std::deque;
00011
00012
00081 namespace storage
00082 {
00083 enum FsType { FSUNKNOWN, REISERFS, EXT2, EXT3, VFAT, XFS, JFS, HFS, NTFS, SWAP, FSNONE };
00084
00085 enum PartitionType { PRIMARY, EXTENDED, LOGICAL, PTYPE_ANY };
00086
00087 enum MountByType { MOUNTBY_DEVICE, MOUNTBY_UUID, MOUNTBY_LABEL };
00088
00089 enum EncryptType { ENC_NONE, ENC_TWOFISH, ENC_TWOFISH_OLD,
00090 ENC_TWOFISH256_OLD, ENC_UNKNOWN };
00091
00092 enum MdType { RAID_UNK, RAID0, RAID1, RAID5, RAID6, RAID10, MULTIPATH };
00093
00094 enum MdParity { PAR_NONE, LEFT_ASYMMETRIC, LEFT_SYMMETRIC,
00095 RIGHT_ASYMMETRIC, RIGHT_SYMMETRIC };
00096
00097 enum UsedByType { UB_NONE, UB_LVM, UB_MD, UB_EVMS, UB_DM };
00098
00099 enum CType { CUNKNOWN, DISK, MD, LOOP, LVM, DM, EVMS };
00100
00101
00105 typedef void (*CallbackProgressBar)( const string& id, unsigned cur, unsigned max );
00106
00111 typedef void (*CallbackShowInstallInfo)( const string& id );
00112
00117 typedef void (*CallbackInfoPopup)( const string& text );
00118
00125 typedef bool (*CallbackYesNoPopup)( const string& text );
00126
00127
00131 struct FsCapabilities
00132 {
00133 FsCapabilities () {}
00134 bool isExtendable;
00135 bool isExtendableWhileMounted;
00136 bool isReduceable;
00137 bool isReduceableWhileMounted;
00138 bool supportsUuid;
00139 bool supportsLabel;
00140 bool labelWhileMounted;
00141 unsigned int labelLength;
00142 unsigned long long minimalFsSizeK;
00143 };
00144
00148 struct ContainerInfo
00149 {
00150 ContainerInfo() {};
00151 CType type;
00152 unsigned volcnt;
00153 string device;
00154 string name;
00155 UsedByType usedBy;
00156 string usedByName;
00157 bool readonly;
00158 };
00159
00163 struct DiskInfo
00164 {
00165 DiskInfo() {};
00166 unsigned long long sizeK;
00167 unsigned long long cylSizeB;
00168 unsigned long cyl;
00169 unsigned long heads;
00170 unsigned long sectors;
00171 string disklabel;
00172 unsigned maxLogical;
00173 unsigned maxPrimary;
00174 };
00175
00179 struct LvmVgInfo
00180 {
00181 LvmVgInfo() {};
00182 unsigned long long sizeK;
00183 unsigned long long peSize;
00184 unsigned long peCount;
00185 unsigned long peFree;
00186 string uuid;
00187 bool lvm2;
00188 bool create;
00189 string devices;
00190 string devices_add;
00191 string devices_rem;
00192 };
00193
00194
00198 struct EvmsCoInfo
00199 {
00200 EvmsCoInfo() {};
00201 unsigned long long sizeK;
00202 unsigned long long peSize;
00203 unsigned long peCount;
00204 unsigned long peFree;
00205 string uuid;
00206 bool lvm2;
00207 bool create;
00208 bool realContainer;
00209 string devices;
00210 string devices_add;
00211 string devices_rem;
00212 };
00213
00217 struct VolumeInfo
00218 {
00219 VolumeInfo() {};
00220 unsigned long long sizeK;
00221 unsigned long major;
00222 unsigned long minor;
00223 string name;
00224 string device;
00225 string mount;
00226 MountByType mount_by;
00227 UsedByType usedBy;
00228 string usedByName;
00229 string fstab_options;
00230 string uuid;
00231 string label;
00232 string mkfs_options;
00233 string loop;
00234 EncryptType encryption;
00235 string crypt_pwd;
00236 FsType fs;
00237 bool format;
00238 bool create;
00239 bool is_mounted;
00240 bool resize;
00241 unsigned long long OrigSizeK;
00242 };
00243
00247 struct PartitionInfo
00248 {
00249 PartitionInfo() {};
00250 VolumeInfo v;
00251 unsigned nr;
00252 unsigned long cylStart;
00253 unsigned long cylSize;
00254 PartitionType partitionType;
00255 unsigned id;
00256 bool boot;
00257 };
00258
00262 struct LvmLvInfo
00263 {
00264 LvmLvInfo() {};
00265 VolumeInfo v;
00266 unsigned stripe;
00267 unsigned stripe_size;
00268 string uuid;
00269 string status;
00270 string allocation;
00271 string dm_table;
00272 string dm_target;
00273 };
00274
00278 struct EvmsInfo
00279 {
00280 EvmsInfo() {};
00281 VolumeInfo v;
00282 unsigned stripe;
00283 unsigned stripe_size;
00284 bool compatible;
00285 string dm_table;
00286 string dm_target;
00287 };
00288
00293 struct MdInfo
00294 {
00295 MdInfo() {};
00296 VolumeInfo v;
00297 unsigned nr;
00298 unsigned type;
00299 unsigned parity;
00300 string uuid;
00301 unsigned long chunk;
00302 string devices;
00303 };
00304
00308 struct LoopInfo
00309 {
00310 LoopInfo() {};
00311 VolumeInfo v;
00312 bool reuseFile;
00313 unsigned nr;
00314 string file;
00315 };
00316
00320 struct DmInfo
00321 {
00322 DmInfo() {};
00323 VolumeInfo v;
00324 unsigned nr;
00325 string table;
00326 string target;
00327 };
00328
00332 enum ErrorCodes
00333 {
00334 DISK_PARTITION_OVERLAPS_EXISTING = -1000,
00335 DISK_PARTITION_EXCEEDS_DISK = -1001,
00336 DISK_CREATE_PARTITION_EXT_ONLY_ONCE = -1002,
00337 DISK_CREATE_PARTITION_EXT_IMPOSSIBLE = -1003,
00338 DISK_PARTITION_NO_FREE_NUMBER = -1004,
00339 DISK_CREATE_PARTITION_INVALID_VOLUME = -1005,
00340 DISK_CREATE_PARTITION_INVALID_TYPE = -1006,
00341 DISK_CREATE_PARTITION_PARTED_FAILED = -1007,
00342 DISK_PARTITION_NOT_FOUND = -1008,
00343 DISK_CREATE_PARTITION_LOGICAL_NO_EXT = -1009,
00344 DISK_PARTITION_LOGICAL_OUTSIDE_EXT = -1010,
00345 DISK_SET_TYPE_INVALID_VOLUME = -1011,
00346 DISK_SET_TYPE_PARTED_FAILED = -1012,
00347 DISK_SET_LABEL_PARTED_FAILED = -1013,
00348 DISK_REMOVE_PARTITION_PARTED_FAILED = -1014,
00349 DISK_REMOVE_PARTITION_INVALID_VOLUME = -1015,
00350 DISK_REMOVE_PARTITION_LIST_ERASE = -1016,
00351 DISK_DESTROY_TABLE_INVALID_LABEL = -1017,
00352 DISK_PARTITION_ZERO_SIZE = -1018,
00353 DISK_CHANGE_READONLY = -1019,
00354 DISK_RESIZE_PARTITION_INVALID_VOLUME = -1020,
00355 DISK_RESIZE_PARTITION_PARTED_FAILED = -1021,
00356 DISK_RESIZE_NO_SPACE = -1022,
00357 DISK_CHECK_RESIZE_INVALID_VOLUME = -1023,
00358 DISK_REMOVE_PARTITION_CREATE_NOT_FOUND = -1024,
00359 DISK_COMMIT_NOTHING_TODO = -1025,
00360 DISK_CREATE_PARTITION_NO_SPACE = -1026,
00361 DISK_REMOVE_USED_BY = -1027,
00362
00363 STORAGE_DISK_NOT_FOUND = -2000,
00364 STORAGE_VOLUME_NOT_FOUND = -2001,
00365 STORAGE_REMOVE_PARTITION_INVALID_CONTAINER = -2002,
00366 STORAGE_CHANGE_PARTITION_ID_INVALID_CONTAINER = -2003,
00367 STORAGE_CHANGE_READONLY = -2004,
00368 STORAGE_DISK_USED_BY = -2005,
00369 STORAGE_LVM_VG_EXISTS = -2006,
00370 STORAGE_LVM_VG_NOT_FOUND = -2007,
00371 STORAGE_LVM_INVALID_DEVICE = -2008,
00372 STORAGE_CONTAINER_NOT_FOUND = -2009,
00373 STORAGE_VG_INVALID_NAME = -2010,
00374 STORAGE_REMOVE_USED_VOLUME = -2011,
00375 STORAGE_REMOVE_USING_UNKNOWN_TYPE = -2012,
00376 STORAGE_NOT_YET_IMPLEMENTED = -2013,
00377 STORAGE_MD_INVALID_NAME = -2014,
00378 STORAGE_MD_NOT_FOUND = -2015,
00379 STORAGE_MEMORY_EXHAUSTED = -2016,
00380 STORAGE_LOOP_NOT_FOUND = -2017,
00381 STORAGE_CREATED_LOOP_NOT_FOUND = -2018,
00382 STORAGE_EVMS_INVALID_NAME = -2019,
00383 STORAGE_EVMS_CO_EXISTS = -2020,
00384 STORAGE_EVMS_CO_NOT_FOUND = -2021,
00385 STORAGE_EVMS_INVALID_DEVICE = -2022,
00386 STORAGE_CHANGE_AREA_INVALID_CONTAINER = -2023,
00387 STORAGE_BACKUP_STATE_NOT_FOUND = -2024,
00388 STORAGE_INVALID_FSTAB_VALUE = -2025,
00389 STORAGE_NO_FSTAB_PTR = -2026,
00390 STORAGE_DEVICE_NODE_NOT_FOUND = -2027,
00391
00392 VOLUME_COMMIT_UNKNOWN_STAGE = -3000,
00393 VOLUME_FSTAB_EMPTY_MOUNT = -3001,
00394 VOLUME_UMOUNT_FAILED = -3002,
00395 VOLUME_MOUNT_FAILED = -3003,
00396 VOLUME_FORMAT_DD_FAILED = -3004,
00397 VOLUME_FORMAT_UNKNOWN_FS = -3005,
00398 VOLUME_FORMAT_FS_UNDETECTED = -3006,
00399 VOLUME_FORMAT_FS_TOO_SMALL = -3007,
00400 VOLUME_FORMAT_FAILED = -3008,
00401 VOLUME_TUNE2FS_FAILED = -3009,
00402 VOLUME_MKLABEL_FS_UNABLE = -3010,
00403 VOLUME_MKLABEL_FAILED = -3011,
00404 VOLUME_LOSETUP_NO_LOOP = -3012,
00405 VOLUME_LOSETUP_FAILED = -3013,
00406 VOLUME_CRYPT_NO_PWD = -3014,
00407 VOLUME_CRYPT_PWD_TOO_SHORT = -3015,
00408 VOLUME_CRYPT_NOT_DETECTED = -3016,
00409 VOLUME_FORMAT_EXTENDED_UNSUPPORTED = -3017,
00410 VOLUME_MOUNT_EXTENDED_UNSUPPORTED = -3018,
00411 VOLUME_MOUNT_POINT_INAVLID = -3019,
00412 VOLUME_MOUNTBY_NOT_ENCRYPTED = -3020,
00413 VOLUME_MOUNTBY_UNSUPPORTED_BY_FS = -3021,
00414 VOLUME_LABEL_NOT_SUPPORTED = -3022,
00415 VOLUME_LABEL_TOO_LONG = -3023,
00416 VOLUME_LABEL_WHILE_MOUNTED = -3024,
00417 VOLUME_RESIZE_UNSUPPORTED_BY_FS = -3025,
00418 VOLUME_RESIZE_UNSUPPORTED_BY_CONTAINER = -3026,
00419 VOLUME_RESIZE_FAILED = -3027,
00420 VOLUME_ALREADY_IN_USE = -3028,
00421 VOLUME_LOUNSETUP_FAILED = -3029,
00422 VOLUME_DEVICE_NOT_PRESENT = -3030,
00423 VOLUME_DEVICE_NOT_BLOCK = -3031,
00424
00425 LVM_CREATE_PV_FAILED = -4000,
00426 LVM_PV_ALREADY_CONTAINED = -4001,
00427 LVM_PV_DEVICE_UNKNOWN = -4002,
00428 LVM_PV_DEVICE_USED = -4003,
00429 LVM_VG_HAS_NONE_PV = -4004,
00430 LVM_LV_INVALID_NAME = -4005,
00431 LVM_LV_DUPLICATE_NAME = -4006,
00432 LVM_LV_NO_SPACE = -4007,
00433 LVM_LV_UNKNOWN_NAME = -4008,
00434 LVM_LV_NOT_IN_LIST = -4009,
00435 LVM_VG_CREATE_FAILED = -4010,
00436 LVM_VG_EXTEND_FAILED = -4011,
00437 LVM_VG_REDUCE_FAILED = -4012,
00438 LVM_VG_REMOVE_FAILED = -4013,
00439 LVM_LV_CREATE_FAILED = -4014,
00440 LVM_LV_REMOVE_FAILED = -4015,
00441 LVM_LV_RESIZE_FAILED = -4016,
00442 LVM_PV_STILL_ADDED = -4017,
00443 LVM_PV_REMOVE_NOT_FOUND = -4018,
00444 LVM_CREATE_LV_INVALID_VOLUME = -4019,
00445 LVM_REMOVE_LV_INVALID_VOLUME = -4020,
00446 LVM_RESIZE_LV_INVALID_VOLUME = -4021,
00447 LVM_CHANGE_READONLY = -4022,
00448 LVM_CHECK_RESIZE_INVALID_VOLUME = -4023,
00449 LVM_COMMIT_NOTHING_TODO = -4024,
00450 LVM_LV_REMOVE_USED_BY = -4025,
00451 LVM_LV_ALREADY_ON_DISK = -4026,
00452 LVM_LV_NO_STRIPE_SIZE = -4027,
00453
00454 FSTAB_ENTRY_NOT_FOUND = -5000,
00455 FSTAB_CHANGE_PREFIX_IMPOSSIBLE = -5001,
00456 FSTAB_REMOVE_ENTRY_NOT_FOUND = -5002,
00457 FSTAB_UPDATE_ENTRY_NOT_FOUND = -5003,
00458 FSTAB_ADD_ENTRY_FOUND = -5004,
00459
00460 MD_CHANGE_READONLY = -6000,
00461 MD_DUPLICATE_NUMBER = -6001,
00462 MD_TOO_FEW_DEVICES = -6002,
00463 MD_DEVICE_UNKNOWN = -6003,
00464 MD_DEVICE_USED = -6004,
00465 MD_CREATE_INVALID_VOLUME = -6005,
00466 MD_REMOVE_FAILED = -6006,
00467 MD_NOT_IN_LIST = -6007,
00468 MD_CREATE_FAILED = -6008,
00469 MD_UNKNOWN_NUMBER = -6009,
00470 MD_REMOVE_USED_BY = -6010,
00471 MD_NUMBER_TOO_LARGE = -6011,
00472 MD_REMOVE_INVALID_VOLUME = -6012,
00473 MD_REMOVE_CREATE_NOT_FOUND = -6013,
00474 MD_NO_RESIZE_ON_DISK = -6014,
00475 MD_ADD_DUPLICATE = -6015,
00476 MD_REMOVE_NONEXISTENT = -6016,
00477 MD_NO_CHANGE_ON_DISK = -6017,
00478 MD_NO_CREATE_UNKNOWN = -6018,
00479
00480 LOOP_CHANGE_READONLY = -7000,
00481 LOOP_DUPLICATE_FILE = -7001,
00482 LOOP_UNKNOWN_FILE = -7002,
00483 LOOP_REMOVE_USED_BY = -7003,
00484 LOOP_FILE_CREATE_FAILED = -7004,
00485 LOOP_CREATE_INVALID_VOLUME = -7005,
00486 LOOP_REMOVE_FILE_FAILED = -7006,
00487 LOOP_REMOVE_INVALID_VOLUME = -7007,
00488 LOOP_NOT_IN_LIST = -7008,
00489 LOOP_REMOVE_CREATE_NOT_FOUND = -7009,
00490
00491 EVMS_HELPER_UNKNOWN_CMD = -8000,
00492 EVMS_UNSUPPORTED_CONTAINER_TYPE = -8001,
00493 EVMS_MALLOC_FAILED = -8002,
00494 EVMS_INVALID_PHYSICAL_VOLUME = -8003,
00495 EVMS_PHYSICAL_VOLUME_IN_USE = -8004,
00496 EVMS_PLUGIN_NOT_FOUND = -8005,
00497 EVMS_CREATE_CONTAINER_FAILED = -8006,
00498 EVMS_RESIZE_VOLUME_NOT_FOUND = -8007,
00499 EVMS_RESIZE_CONTAINER_NOT_FOUND = -8008,
00500 EVMS_RESIZE_EXPAND_FAILED = -8009,
00501 EVMS_RESIZE_SHRINK_FAILED = -8010,
00502 EVMS_COMMIT_FAILED = -8011,
00503 EVMS_CREATE_VOLUME_FREESPACE_NOT_FOUND = -8012,
00504 EVMS_CREATE_VOLUME_FAILED = -8013,
00505 EVMS_CREATE_COMPAT_VOLUME_FAILED = -8014,
00506 EVMS_SEGMENT_NOT_FOUND = -8015,
00507 EVMS_REMOVE_VOLUME_NOT_FOUND = -8016,
00508 EVMS_REMOVE_REGION_FAILED = -8017,
00509 EVMS_CONTAINER_NOT_FOUND = -8018,
00510 EVMS_CONTAINER_EXPAND_FAILED = -8019,
00511 EVMS_CONTAINER_SHRINK_INVALID_SEGMENT = -8020,
00512 EVMS_CONTAINER_SHRINK_FAILED = -8021,
00513 EVMS_CONTAINER_REMOVE_FAILED = -8022,
00514 EVMS_PV_ALREADY_CONTAINED = -8023,
00515 EVMS_PV_DEVICE_UNKNOWN = -8024,
00516 EVMS_PV_DEVICE_USED = -8025,
00517 EVMS_CO_HAS_NONE_PV = -8026,
00518 EVMS_LV_INVALID_NAME = -8027,
00519 EVMS_LV_DUPLICATE_NAME = -8028,
00520 EVMS_LV_NO_SPACE = -8020,
00521 EVMS_LV_UNKNOWN_NAME = -8030,
00522 EVMS_LV_NOT_IN_LIST = -8031,
00523 EVMS_PV_STILL_ADDED = -8032,
00524 EVMS_PV_REMOVE_NOT_FOUND = -8033,
00525 EVMS_CREATE_LV_INVALID_VOLUME = -8034,
00526 EVMS_REMOVE_LV_INVALID_VOLUME = -8035,
00527 EVMS_RESIZE_LV_INVALID_VOLUME = -8036,
00528 EVMS_CHANGE_READONLY = -8037,
00529 EVMS_CHECK_RESIZE_INVALID_VOLUME = -8038,
00530 EVMS_COMMIT_NOTHING_TODO = -8039,
00531 EVMS_LV_REMOVE_USED_BY = -8040,
00532 EVMS_COMMUNICATION_FAILED = -8041,
00533 EVMS_LV_ALREADY_ON_DISK = -8042,
00534 EVMS_LV_NO_STRIPE_SIZE = -8043,
00535
00536 PEC_PE_SIZE_INVALID = -9000,
00537 PEC_PV_NOT_FOUND = -9001,
00538 PEC_REMOVE_PV_IN_USE = -9002,
00539 PEC_REMOVE_PV_SIZE_NEEDED = -9003,
00540 PEC_LV_NO_SPACE_STRIPED = -9004,
00541 PEC_LV_NO_SPACE_SINGLE = -9005,
00542 PEC_LV_PE_DEV_NOT_FOUND = -9006,
00543
00544 DM_CHANGE_READONLY = -10000,
00545 DM_UNKNOWN_TABLE = -10001,
00546 DM_REMOVE_USED_BY = -10002,
00547 DM_REMOVE_CREATE_NOT_FOUND = -10003,
00548 DM_REMOVE_INVALID_VOLUME = -10004,
00549 DM_REMOVE_FAILED = -10005,
00550 DM_NOT_IN_LIST = -10006,
00551
00552 CONTAINER_INTERNAL_ERROR = -99000,
00553 CONTAINER_INVALID_VIRTUAL_CALL = -99001,
00554
00555 };
00556
00557
00561 class StorageInterface
00562 {
00563 public:
00564
00565 StorageInterface () {}
00566 virtual ~StorageInterface () {}
00567
00571 virtual void getContainers( deque<ContainerInfo>& infos) = 0;
00572
00580 virtual int getDiskInfo( const string& disk, DiskInfo& info) = 0;
00581
00590 virtual int getContDiskInfo( const string& disk, ContainerInfo& cinfo,
00591 DiskInfo& info ) = 0;
00592
00600 virtual int getLvmVgInfo( const string& name, LvmVgInfo& info) = 0;
00601
00610 virtual int getContLvmVgInfo( const string& name, ContainerInfo& cinfo,
00611 LvmVgInfo& info) = 0;
00612
00620 virtual int getEvmsCoInfo( const string& name, EvmsCoInfo& info) = 0;
00621
00630 virtual int getContEvmsCoInfo( const string& name, ContainerInfo& cinfo,
00631 EvmsCoInfo& info) = 0;
00632
00638 virtual void getVolumes( deque<VolumeInfo>& infos) = 0;
00639
00647 virtual int getVolume( const string& device, VolumeInfo& info) = 0;
00648
00656 virtual int getPartitionInfo( const string& disk,
00657 deque<PartitionInfo>& plist ) = 0;
00658
00666 virtual int getLvmLvInfo( const string& name,
00667 deque<LvmLvInfo>& plist ) = 0;
00668
00676 virtual int getEvmsInfo( const string& name,
00677 deque<EvmsInfo>& plist ) = 0;
00678
00685 virtual int getMdInfo( deque<MdInfo>& plist ) = 0;
00686
00693 virtual int getLoopInfo( deque<LoopInfo>& plist ) = 0;
00694
00701 virtual int getDmInfo( deque<DmInfo>& plist ) = 0;
00702
00706 virtual bool getFsCapabilities (FsType fstype, FsCapabilities& fscapabilities) const = 0;
00707
00715 virtual void printInfo( std::ostream& str ) = 0;
00716
00729 virtual int createPartition( const string& disk, PartitionType type,
00730 unsigned long start,
00731 unsigned long sizeCyl,
00732 string& device ) = 0;
00733
00741 virtual int resizePartition( const string& device,
00742 unsigned long sizeCyl ) = 0;
00743
00754 virtual int updatePartitionArea( const string& device,
00755 unsigned long start,
00756 unsigned long sizeCyl ) = 0;
00757
00758
00768 virtual int nextFreePartition( const string& disk, PartitionType type,
00769 unsigned &nr, string& device ) = 0;
00770
00783 virtual int createPartitionKb( const string& disk, PartitionType type,
00784 unsigned long long start,
00785 unsigned long long size,
00786 string& device ) = 0;
00787
00798 virtual int createPartitionAny( const string& disk,
00799 unsigned long long size,
00800 string& device ) = 0;
00801
00812 virtual int createPartitionMax( const string& disk, PartitionType type,
00813 string& device ) = 0;
00814
00822 virtual unsigned long long cylinderToKb( const string& disk,
00823 unsigned long size ) = 0;
00824
00832 virtual unsigned long kbToCylinder( const string& disk,
00833 unsigned long long size ) = 0;
00834
00841 virtual int removePartition (const string& partition) = 0;
00842
00843
00851 virtual int changePartitionId (const string& partition, unsigned id) = 0;
00858 virtual int forgetChangePartitionId (const string& partition ) = 0;
00859
00868 virtual int destroyPartitionTable (const string& disk, const string& label) = 0;
00869
00876 virtual string defaultDiskLabel() const = 0;
00877
00886 virtual int changeFormatVolume( const string& device, bool format, FsType fs ) = 0;
00887
00895 virtual int changeLabelVolume( const string& device, const string& label ) = 0;
00896
00904 virtual int changeMkfsOptVolume( const string& device, const string& opts ) = 0;
00905
00914 virtual int changeMountPoint( const string& device, const string& mount ) = 0;
00915
00923 virtual int getMountPoint( const string& device, string& mount ) = 0;
00924
00932 virtual int changeMountBy( const string& device, MountByType mby ) = 0;
00933
00941 #ifndef SWIG
00942 virtual int getMountBy( const string& device, MountByType& mby ) = 0;
00943 #else
00944 virtual int getMountBy( const string& device, MountByType& REFERENCE ) = 0;
00945 #endif
00946
00956 virtual int changeFstabOptions( const string& device, const string& options ) = 0;
00957
00966 virtual int getFstabOptions( const string& device, string& options ) = 0;
00967
00976 virtual int addFstabOptions( const string& device, const string& options ) = 0;
00977
00987 virtual int removeFstabOptions( const string& device, const string& options ) = 0;
00988
00996 virtual int setCryptPassword( const string& device, const string& pwd ) = 0;
00997
01004 virtual int forgetCryptPassword( const string& device ) = 0;
01005
01013 virtual int getCryptPassword( const string& device, string& pwd ) = 0;
01014
01022 virtual int setCrypt( const string& device, bool val ) = 0;
01023
01031 #ifndef SWIG
01032 virtual int getCrypt( const string& device, bool& val ) = 0;
01033 #else
01034 virtual int getCrypt( const string& device, bool& REFERENCE ) = 0;
01035 #endif
01036
01046 virtual int setIgnoreFstab( const string& device, bool val ) = 0;
01047
01055 #ifndef SWIG
01056 virtual int getIgnoreFstab( const string& device, bool& val ) = 0;
01057 #else
01058 virtual int getIgnoreFstab( const string& device, bool& REFERENCE ) = 0;
01059 #endif
01060
01072 virtual int addFstabEntry( const string& device, const string& mount,
01073 const string& vfs, const string& options,
01074 unsigned freq, unsigned passno ) = 0;
01075
01076
01084 virtual int resizeVolume( const string& device, unsigned long long newSizeMb ) = 0;
01085
01092 virtual int forgetResizeVolume( const string& device ) = 0;
01093
01108 virtual void setRecursiveRemoval( bool val ) = 0;
01109
01115 virtual bool getRecursiveRemoval() const = 0;
01116
01130 virtual void setZeroNewPartitions( bool val ) = 0;
01131
01137 virtual bool getZeroNewPartitions() const = 0;
01138
01148 virtual void setRootPrefix( const string& root ) = 0;
01149
01155 virtual void setDetectMountedVolumes( bool val ) = 0;
01156
01162 virtual bool getDetectMountedVolumes() const = 0;
01163
01171 virtual int removeVolume( const string& device ) = 0;
01172
01183 virtual int createLvmVg( const string& name,
01184 unsigned long long peSizeK, bool lvm1,
01185 const deque<string>& devs ) = 0;
01186
01194 virtual int removeLvmVg( const string& name ) = 0;
01195
01203 virtual int extendLvmVg( const string& name,
01204 const deque<string>& devs ) = 0;
01205
01213 virtual int shrinkLvmVg( const string& name,
01214 const deque<string>& devs ) = 0;
01215
01227 virtual int createLvmLv( const string& vg, const string& name,
01228 unsigned long long sizeM, unsigned stripe,
01229 string& device ) = 0;
01230
01237 virtual int removeLvmLvByDevice( const string& device ) = 0;
01238
01246 virtual int removeLvmLv( const string& vg, const string& name ) = 0;
01247
01257 virtual int changeLvStripeSize( const string& vg, const string& name,
01258 unsigned long long stripeSize ) = 0;
01259
01270 virtual int createEvmsContainer( const string& name,
01271 unsigned long long peSizeK, bool lvm1,
01272 const deque<string>& devs ) = 0;
01273
01281 virtual int removeEvmsContainer( const string& name ) = 0;
01282
01290 virtual int extendEvmsContainer( const string& name,
01291 const deque<string>& devs ) = 0;
01292
01300 virtual int shrinkEvmsContainer( const string& name,
01301 const deque<string>& devs ) = 0;
01302
01314 virtual int createEvmsVolume( const string& coname, const string& name,
01315 unsigned long long sizeM, unsigned stripe,
01316 string& device ) = 0;
01317
01324 virtual int removeEvmsVolumeByDevice( const string& device ) = 0;
01325
01333 virtual int removeEvmsVolume( const string& coname, const string& name ) = 0;
01334
01344 virtual int changeEvmsStripeSize( const string& coname,
01345 const string& name,
01346 unsigned long long stripeSize ) = 0;
01347
01356 virtual int createMd( const string& name, MdType rtype,
01357 const deque<string>& devs ) = 0;
01358
01367 virtual int createMdAny( MdType rtype, const deque<string>& devs,
01368 string& device ) = 0;
01369
01378 virtual int removeMd( const string& name, bool destroySb ) = 0;
01379
01388 virtual int extendMd( const string& name, const string& dev ) = 0;
01389
01398 virtual int shrinkMd( const string& name, const string& dev ) = 0;
01399
01408 virtual int changeMdType( const string& name, MdType rtype ) = 0;
01409
01418 virtual int changeMdChunk( const string& name, unsigned long chunk ) = 0;
01419
01428 virtual int changeMdParity( const string& name, MdParity ptype ) = 0;
01429
01436 virtual int checkMd( const string& name ) = 0;
01437
01454 virtual int createFileLoop( const string& lname, bool reuseExisting,
01455 unsigned long long sizeK,
01456 const string& mp, const string& pwd,
01457 string& device ) = 0;
01458
01467 virtual int removeFileLoop( const string& lname, bool removeFile ) = 0;
01468
01477 virtual deque<string> getCommitActions( bool mark_destructive ) = 0;
01478
01484 virtual const string& getLastAction() const = 0;
01485
01492 virtual const string& getExtendedErrorMessage() const = 0;
01493
01494
01495 #ifndef SWIG
01496
01502 virtual void setCallbackProgressBar( CallbackProgressBar pfnc ) = 0;
01503
01509 virtual CallbackProgressBar getCallbackProgressBar() const = 0;
01510
01511
01517 virtual void setCallbackShowInstallInfo( CallbackShowInstallInfo pfnc ) = 0;
01518
01524 virtual CallbackShowInstallInfo getCallbackShowInstallInfo() const = 0;
01525
01526
01533 virtual void setCallbackInfoPopup( CallbackInfoPopup pfnc ) = 0;
01534
01541 virtual CallbackInfoPopup getCallbackInfoPopup() const = 0;
01542
01543
01550 virtual void setCallbackYesNoPopup( CallbackYesNoPopup pfnc ) = 0;
01551
01558 virtual CallbackYesNoPopup getCallbackYesNoPopup() const = 0;
01559
01560 #endif
01561
01567 virtual void setCacheChanges (bool cache) = 0;
01568
01572 virtual bool isCacheChanges () const = 0;
01573
01578 virtual int commit() = 0;
01579
01586 virtual int createBackupState( const string& name ) = 0;
01587
01594 virtual int restoreBackupState( const string& name ) = 0;
01595
01602 virtual bool checkBackupState( const string& name ) = 0;
01603
01612 virtual bool equalBackupStates( const string& lhs,
01613 const string& rhs,
01614 bool verbose_log ) const = 0;
01615
01623 virtual int removeBackupState( const string& name ) = 0;
01624
01632 virtual bool checkDeviceMounted( const string& device, string& mp ) = 0;
01633
01642 virtual bool umountDevice( const string& device ) = 0;
01643
01653 virtual bool mountDevice( const string& device, const string& mp ) = 0;
01654
01666 virtual bool getFreeInfo( const string& device,
01667 unsigned long long& resize_free,
01668 unsigned long long& df_free,
01669 unsigned long long& used,
01670 bool& win, bool use_cache ) = 0;
01671
01679 virtual bool readFstab( const string& dir, deque<VolumeInfo>& infos) = 0;
01680
01687 virtual void activateHld( bool val ) = 0;
01688
01698 virtual void rescanEverything() = 0;
01699
01700 };
01701
01702
01706 void initDefaultLogger ();
01707
01708
01712 StorageInterface* createDefaultStorageInterface ();
01713
01714
01718 StorageInterface* createStorageInterface (bool readonly, bool testmode,
01719 bool autodetect);
01720
01721
01725 void destroyStorageInterface (StorageInterface*);
01726
01727 };
01728
01729
01730 #endif