00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef STORAGE_INTERFACE_H
00024 #define STORAGE_INTERFACE_H
00025
00026
00027 #include <string>
00028 #include <deque>
00029 #include <list>
00030
00031 using std::string;
00032 using std::deque;
00033 using std::list;
00034
00035
00133 namespace storage
00134 {
00135 enum FsType { FSUNKNOWN, REISERFS, EXT2, EXT3, EXT4, BTRFS, VFAT, XFS, JFS, HFS, NTFS,
00136 SWAP, HFSPLUS, NFS, FSNONE };
00137
00138 enum PartitionType { PRIMARY, EXTENDED, LOGICAL, PTYPE_ANY };
00139
00140 enum MountByType { MOUNTBY_DEVICE, MOUNTBY_UUID, MOUNTBY_LABEL, MOUNTBY_ID, MOUNTBY_PATH };
00141
00142 enum EncryptType { ENC_NONE, ENC_TWOFISH, ENC_TWOFISH_OLD,
00143 ENC_TWOFISH256_OLD, ENC_LUKS, ENC_UNKNOWN };
00144
00145 enum MdType { RAID_UNK, RAID0, RAID1, RAID5, RAID6, RAID10, MULTIPATH };
00146
00147 enum MdParity { PAR_NONE, LEFT_ASYMMETRIC, LEFT_SYMMETRIC,
00148 RIGHT_ASYMMETRIC, RIGHT_SYMMETRIC };
00149
00150 enum UsedByType { UB_NONE, UB_LVM, UB_MD, UB_DM, UB_DMRAID, UB_DMMULTIPATH };
00151
00152 enum CType { CUNKNOWN, DISK, MD, LOOP, LVM, DM, DMRAID, NFSC, DMMULTIPATH,
00153 COTYPE_LAST_ENTRY };
00154
00155
00160 typedef void (*CallbackProgressBar)(const string& id, unsigned cur, unsigned max);
00161
00166 typedef void (*CallbackShowInstallInfo)(const string& id);
00167
00172 typedef void (*CallbackInfoPopup)(const string& text);
00173
00180 typedef bool (*CallbackYesNoPopup)(const string& text);
00181
00187 typedef bool (*CallbackPasswordPopup)(const string& device, int attempts, string& password);
00188
00189
00193 struct FsCapabilities
00194 {
00195 FsCapabilities() {}
00196 bool isExtendable;
00197 bool isExtendableWhileMounted;
00198 bool isReduceable;
00199 bool isReduceableWhileMounted;
00200 bool supportsUuid;
00201 bool supportsLabel;
00202 bool labelWhileMounted;
00203 unsigned int labelLength;
00204 unsigned long long minimalFsSizeK;
00205 };
00206
00210 struct DlabelCapabilities
00211 {
00212 DlabelCapabilities() {}
00213 unsigned maxPrimary;
00214 bool extendedPossible;
00215 unsigned maxLogical;
00216 unsigned long long maxSizeK;
00217 };
00218
00219
00223 struct ContainerInfo
00224 {
00225 ContainerInfo() {}
00226 CType type;
00227 string device;
00228 string name;
00229 UsedByType usedByType;
00230 string usedByDevice;
00231 bool readonly;
00232 };
00233
00237 struct DiskInfo
00238 {
00239 DiskInfo() {}
00240 unsigned long long sizeK;
00241 unsigned long long cylSize;
00242 unsigned long cyl;
00243 unsigned long heads;
00244 unsigned long sectors;
00245 string disklabel;
00246 string udevPath;
00247 string udevId;
00248 unsigned maxPrimary;
00249 bool extendedPossible;
00250 unsigned maxLogical;
00251 bool initDisk;
00252 bool iscsi;
00253 };
00254
00258 struct LvmVgInfo
00259 {
00260 LvmVgInfo() {}
00261 unsigned long long sizeK;
00262 unsigned long long peSizeK;
00263 unsigned long peCount;
00264 unsigned long peFree;
00265 string uuid;
00266 bool lvm2;
00267 bool create;
00268 string devices;
00269 string devices_add;
00270 string devices_rem;
00271 };
00272
00276 struct DmPartCoInfo
00277 {
00278 DmPartCoInfo() {}
00279 DiskInfo d;
00280 string devices;
00281 unsigned long minor;
00282 };
00283
00284 struct DmraidCoInfo
00285 {
00286 DmraidCoInfo() {}
00287 DmPartCoInfo p;
00288 };
00289
00290 struct DmmultipathCoInfo
00291 {
00292 DmmultipathCoInfo() {}
00293 DmPartCoInfo p;
00294 string vendor;
00295 string model;
00296 };
00297
00301 struct VolumeInfo
00302 {
00303 VolumeInfo() {}
00304 unsigned long long sizeK;
00305 unsigned long major;
00306 unsigned long minor;
00307 string name;
00308 string device;
00309 string mount;
00310 MountByType mount_by;
00311 UsedByType usedByType;
00312 string usedByDevice;
00313 bool ignore_fstab;
00314 string fstab_options;
00315 string uuid;
00316 string label;
00317 string mkfs_options;
00318 string tunefs_options;
00319 string loop;
00320 string dtxt;
00321 EncryptType encryption;
00322 string crypt_pwd;
00323 FsType fs;
00324 bool format;
00325 bool create;
00326 bool is_mounted;
00327 bool resize;
00328 bool ignore_fs;
00329 unsigned long long origSizeK;
00330 };
00331
00332 struct PartitionAddInfo
00333 {
00334 PartitionAddInfo() {}
00335 unsigned nr;
00336 unsigned long cylStart;
00337 unsigned long cylSize;
00338 PartitionType partitionType;
00339 unsigned id;
00340 bool boot;
00341 string udevPath;
00342 string udevId;
00343 };
00344
00348 struct PartitionInfo
00349 {
00350 PartitionInfo() {}
00351 PartitionInfo& operator=( const PartitionAddInfo& rhs );
00352 VolumeInfo v;
00353 unsigned nr;
00354 unsigned long cylStart;
00355 unsigned long cylSize;
00356 PartitionType partitionType;
00357 unsigned id;
00358 bool boot;
00359 string udevPath;
00360 string udevId;
00361 };
00362
00366 struct LvmLvInfo
00367 {
00368 LvmLvInfo() {}
00369 VolumeInfo v;
00370 unsigned stripes;
00371 unsigned stripeSizeK;
00372 string uuid;
00373 string status;
00374 string allocation;
00375 string dm_table;
00376 string dm_target;
00377 string origin;
00378 unsigned long long sizeK;
00379 };
00380
00384 struct LvmLvSnapshotStateInfo
00385 {
00386 LvmLvSnapshotStateInfo() {}
00387 bool active;
00388 double allocated;
00389 };
00390
00394 struct MdInfo
00395 {
00396 MdInfo() {}
00397 VolumeInfo v;
00398 unsigned nr;
00399 unsigned type;
00400 unsigned parity;
00401 string uuid;
00402 string sb_ver;
00403 unsigned long chunkSizeK;
00404 string devices;
00405 };
00406
00410 struct MdStateInfo
00411 {
00412 MdStateInfo() {}
00413 bool active;
00414 bool degraded;
00415 };
00416
00420 struct NfsInfo
00421 {
00422 NfsInfo() {}
00423 VolumeInfo v;
00424 };
00425
00429 struct LoopInfo
00430 {
00431 LoopInfo() {}
00432 VolumeInfo v;
00433 bool reuseFile;
00434 unsigned nr;
00435 string file;
00436 };
00437
00441 struct DmInfo
00442 {
00443 DmInfo() {}
00444 VolumeInfo v;
00445 unsigned nr;
00446 string table;
00447 string target;
00448 };
00449
00453 struct DmPartInfo
00454 {
00455 DmPartInfo() {}
00456 VolumeInfo v;
00457 PartitionAddInfo p;
00458 bool part;
00459 string table;
00460 string target;
00461 };
00462
00466 struct DmraidInfo
00467 {
00468 DmraidInfo() {}
00469 DmPartInfo p;
00470 };
00471
00475 struct DmmultipathInfo
00476 {
00477 DmmultipathInfo() {}
00478 DmPartInfo p;
00479 };
00480
00484 struct ContVolInfo
00485 {
00486 ContVolInfo() { numeric=false; nr=0; type=CUNKNOWN; }
00487 CType type;
00488 string cname;
00489 string vname;
00490 bool numeric;
00491 unsigned nr;
00492 };
00493
00497 struct PartitionSlotInfo
00498 {
00499 PartitionSlotInfo() {}
00500 unsigned long cylStart;
00501 unsigned long cylSize;
00502 bool primarySlot;
00503 bool primaryPossible;
00504 bool extendedSlot;
00505 bool extendedPossible;
00506 bool logicalSlot;
00507 bool logicalPossible;
00508 };
00509
00513 struct CommitInfo
00514 {
00515 CommitInfo() {}
00516 bool destructive;
00517 string text;
00518 };
00519
00520
00524 enum ErrorCodes
00525 {
00526 DISK_PARTITION_OVERLAPS_EXISTING = -1000,
00527 DISK_PARTITION_EXCEEDS_DISK = -1001,
00528 DISK_CREATE_PARTITION_EXT_ONLY_ONCE = -1002,
00529 DISK_CREATE_PARTITION_EXT_IMPOSSIBLE = -1003,
00530 DISK_PARTITION_NO_FREE_NUMBER = -1004,
00531 DISK_CREATE_PARTITION_INVALID_VOLUME = -1005,
00532 DISK_CREATE_PARTITION_INVALID_TYPE = -1006,
00533 DISK_CREATE_PARTITION_PARTED_FAILED = -1007,
00534 DISK_PARTITION_NOT_FOUND = -1008,
00535 DISK_CREATE_PARTITION_LOGICAL_NO_EXT = -1009,
00536 DISK_PARTITION_LOGICAL_OUTSIDE_EXT = -1010,
00537 DISK_SET_TYPE_INVALID_VOLUME = -1011,
00538 DISK_SET_TYPE_PARTED_FAILED = -1012,
00539 DISK_SET_LABEL_PARTED_FAILED = -1013,
00540 DISK_REMOVE_PARTITION_PARTED_FAILED = -1014,
00541 DISK_REMOVE_PARTITION_INVALID_VOLUME = -1015,
00542 DISK_REMOVE_PARTITION_LIST_ERASE = -1016,
00543 DISK_DESTROY_TABLE_INVALID_LABEL = -1017,
00544 DISK_PARTITION_ZERO_SIZE = -1018,
00545 DISK_CHANGE_READONLY = -1019,
00546 DISK_RESIZE_PARTITION_INVALID_VOLUME = -1020,
00547 DISK_RESIZE_PARTITION_PARTED_FAILED = -1021,
00548 DISK_RESIZE_NO_SPACE = -1022,
00549 DISK_CHECK_RESIZE_INVALID_VOLUME = -1023,
00550 DISK_REMOVE_PARTITION_CREATE_NOT_FOUND = -1024,
00551 DISK_COMMIT_NOTHING_TODO = -1025,
00552 DISK_CREATE_PARTITION_NO_SPACE = -1026,
00553 DISK_REMOVE_USED_BY = -1027,
00554 DISK_INIT_NOT_POSSIBLE = -1028,
00555 DISK_INVALID_PARTITION_ID = -1029,
00556
00557 STORAGE_DISK_NOT_FOUND = -2000,
00558 STORAGE_VOLUME_NOT_FOUND = -2001,
00559 STORAGE_REMOVE_PARTITION_INVALID_CONTAINER = -2002,
00560 STORAGE_CHANGE_PARTITION_ID_INVALID_CONTAINER = -2003,
00561 STORAGE_CHANGE_READONLY = -2004,
00562 STORAGE_DISK_USED_BY = -2005,
00563 STORAGE_LVM_VG_EXISTS = -2006,
00564 STORAGE_LVM_VG_NOT_FOUND = -2007,
00565 STORAGE_LVM_INVALID_DEVICE = -2008,
00566 STORAGE_CONTAINER_NOT_FOUND = -2009,
00567 STORAGE_VG_INVALID_NAME = -2010,
00568 STORAGE_REMOVE_USED_VOLUME = -2011,
00569 STORAGE_REMOVE_USING_UNKNOWN_TYPE = -2012,
00570 STORAGE_NOT_YET_IMPLEMENTED = -2013,
00571 STORAGE_MD_INVALID_NAME = -2014,
00572 STORAGE_MD_NOT_FOUND = -2015,
00573 STORAGE_MEMORY_EXHAUSTED = -2016,
00574 STORAGE_LOOP_NOT_FOUND = -2017,
00575 STORAGE_CREATED_LOOP_NOT_FOUND = -2018,
00576 STORAGE_CHANGE_AREA_INVALID_CONTAINER = -2023,
00577 STORAGE_BACKUP_STATE_NOT_FOUND = -2024,
00578 STORAGE_INVALID_FSTAB_VALUE = -2025,
00579 STORAGE_NO_FSTAB_PTR = -2026,
00580 STORAGE_DEVICE_NODE_NOT_FOUND = -2027,
00581 STORAGE_DMRAID_CO_NOT_FOUND = -2028,
00582 STORAGE_RESIZE_INVALID_CONTAINER = -2029,
00583 STORAGE_DMMULTIPATH_CO_NOT_FOUND = -2030,
00584 STORAGE_ZERO_DEVICE_FAILED = -2031,
00585 STORAGE_INVALID_BACKUP_STATE_NAME = -2032,
00586
00587 VOLUME_COMMIT_UNKNOWN_STAGE = -3000,
00588 VOLUME_FSTAB_EMPTY_MOUNT = -3001,
00589 VOLUME_UMOUNT_FAILED = -3002,
00590 VOLUME_MOUNT_FAILED = -3003,
00591 VOLUME_FORMAT_UNKNOWN_FS = -3005,
00592 VOLUME_FORMAT_FS_UNDETECTED = -3006,
00593 VOLUME_FORMAT_FS_TOO_SMALL = -3007,
00594 VOLUME_FORMAT_FAILED = -3008,
00595 VOLUME_TUNE2FS_FAILED = -3009,
00596 VOLUME_MKLABEL_FS_UNABLE = -3010,
00597 VOLUME_MKLABEL_FAILED = -3011,
00598 VOLUME_LOSETUP_NO_LOOP = -3012,
00599 VOLUME_LOSETUP_FAILED = -3013,
00600 VOLUME_CRYPT_NO_PWD = -3014,
00601 VOLUME_CRYPT_PWD_TOO_SHORT = -3015,
00602 VOLUME_CRYPT_NOT_DETECTED = -3016,
00603 VOLUME_FORMAT_EXTENDED_UNSUPPORTED = -3017,
00604 VOLUME_MOUNT_EXTENDED_UNSUPPORTED = -3018,
00605 VOLUME_MOUNT_POINT_INVALID = -3019,
00606 VOLUME_MOUNTBY_NOT_ENCRYPTED = -3020,
00607 VOLUME_MOUNTBY_UNSUPPORTED_BY_FS = -3021,
00608 VOLUME_LABEL_NOT_SUPPORTED = -3022,
00609 VOLUME_LABEL_TOO_LONG = -3023,
00610 VOLUME_LABEL_WHILE_MOUNTED = -3024,
00611 VOLUME_RESIZE_UNSUPPORTED_BY_FS = -3025,
00612 VOLUME_RESIZE_UNSUPPORTED_BY_CONTAINER = -3026,
00613 VOLUME_RESIZE_FAILED = -3027,
00614 VOLUME_ALREADY_IN_USE = -3028,
00615 VOLUME_LOUNSETUP_FAILED = -3029,
00616 VOLUME_DEVICE_NOT_PRESENT = -3030,
00617 VOLUME_DEVICE_NOT_BLOCK = -3031,
00618 VOLUME_MOUNTBY_UNSUPPORTED_BY_VOLUME = -3032,
00619 VOLUME_CRYPTFORMAT_FAILED = -3033,
00620 VOLUME_CRYPTSETUP_FAILED = -3034,
00621 VOLUME_CRYPTUNSETUP_FAILED = -3035,
00622 VOLUME_FORMAT_NOT_IMPLEMENTED = -3036,
00623 VOLUME_FORMAT_NFS_IMPOSSIBLE = -3037,
00624 VOLUME_CRYPT_NFS_IMPOSSIBLE = -3038,
00625 VOLUME_REMOUNT_FAILED = -3039,
00626 VOLUME_TUNEREISERFS_FAILED = -3040,
00627
00628 LVM_CREATE_PV_FAILED = -4000,
00629 LVM_PV_ALREADY_CONTAINED = -4001,
00630 LVM_PV_DEVICE_UNKNOWN = -4002,
00631 LVM_PV_DEVICE_USED = -4003,
00632 LVM_VG_HAS_NONE_PV = -4004,
00633 LVM_LV_INVALID_NAME = -4005,
00634 LVM_LV_DUPLICATE_NAME = -4006,
00635 LVM_LV_NO_SPACE = -4007,
00636 LVM_LV_UNKNOWN_NAME = -4008,
00637 LVM_LV_NOT_IN_LIST = -4009,
00638 LVM_VG_CREATE_FAILED = -4010,
00639 LVM_VG_EXTEND_FAILED = -4011,
00640 LVM_VG_REDUCE_FAILED = -4012,
00641 LVM_VG_REMOVE_FAILED = -4013,
00642 LVM_LV_CREATE_FAILED = -4014,
00643 LVM_LV_REMOVE_FAILED = -4015,
00644 LVM_LV_RESIZE_FAILED = -4016,
00645 LVM_PV_STILL_ADDED = -4017,
00646 LVM_PV_REMOVE_NOT_FOUND = -4018,
00647 LVM_CREATE_LV_INVALID_VOLUME = -4019,
00648 LVM_REMOVE_LV_INVALID_VOLUME = -4020,
00649 LVM_RESIZE_LV_INVALID_VOLUME = -4021,
00650 LVM_CHANGE_READONLY = -4022,
00651 LVM_CHECK_RESIZE_INVALID_VOLUME = -4023,
00652 LVM_COMMIT_NOTHING_TODO = -4024,
00653 LVM_LV_REMOVE_USED_BY = -4025,
00654 LVM_LV_ALREADY_ON_DISK = -4026,
00655 LVM_LV_NO_STRIPE_SIZE = -4027,
00656 LVM_LV_UNKNOWN_ORIGIN = -4028,
00657 LVM_LV_NOT_ON_DISK = -4029,
00658 LVM_LV_NOT_SNAPSHOT = -4030,
00659 LVM_LV_HAS_SNAPSHOTS = -4031,
00660 LVM_LV_IS_SNAPSHOT = -4032,
00661
00662 FSTAB_ENTRY_NOT_FOUND = -5000,
00663 FSTAB_CHANGE_PREFIX_IMPOSSIBLE = -5001,
00664 FSTAB_REMOVE_ENTRY_NOT_FOUND = -5002,
00665 FSTAB_UPDATE_ENTRY_NOT_FOUND = -5003,
00666 FSTAB_ADD_ENTRY_FOUND = -5004,
00667
00668 MD_CHANGE_READONLY = -6000,
00669 MD_DUPLICATE_NUMBER = -6001,
00670 MD_TOO_FEW_DEVICES = -6002,
00671 MD_DEVICE_UNKNOWN = -6003,
00672 MD_DEVICE_USED = -6004,
00673 MD_CREATE_INVALID_VOLUME = -6005,
00674 MD_REMOVE_FAILED = -6006,
00675 MD_NOT_IN_LIST = -6007,
00676 MD_CREATE_FAILED = -6008,
00677 MD_UNKNOWN_NUMBER = -6009,
00678 MD_REMOVE_USED_BY = -6010,
00679 MD_NUMBER_TOO_LARGE = -6011,
00680 MD_REMOVE_INVALID_VOLUME = -6012,
00681 MD_REMOVE_CREATE_NOT_FOUND = -6013,
00682 MD_NO_RESIZE_ON_DISK = -6014,
00683 MD_ADD_DUPLICATE = -6015,
00684 MD_REMOVE_NONEXISTENT = -6016,
00685 MD_NO_CHANGE_ON_DISK = -6017,
00686 MD_NO_CREATE_UNKNOWN = -6018,
00687 MD_STATE_NOT_ON_DISK = -6019,
00688
00689 LOOP_CHANGE_READONLY = -7000,
00690 LOOP_DUPLICATE_FILE = -7001,
00691 LOOP_UNKNOWN_FILE = -7002,
00692 LOOP_REMOVE_USED_BY = -7003,
00693 LOOP_FILE_CREATE_FAILED = -7004,
00694 LOOP_CREATE_INVALID_VOLUME = -7005,
00695 LOOP_REMOVE_FILE_FAILED = -7006,
00696 LOOP_REMOVE_INVALID_VOLUME = -7007,
00697 LOOP_NOT_IN_LIST = -7008,
00698 LOOP_REMOVE_CREATE_NOT_FOUND = -7009,
00699 LOOP_MODIFY_EXISTING = -7010,
00700
00701 PEC_PE_SIZE_INVALID = -9000,
00702 PEC_PV_NOT_FOUND = -9001,
00703 PEC_REMOVE_PV_IN_USE = -9002,
00704 PEC_REMOVE_PV_SIZE_NEEDED = -9003,
00705 PEC_LV_NO_SPACE_STRIPED = -9004,
00706 PEC_LV_NO_SPACE_SINGLE = -9005,
00707 PEC_LV_PE_DEV_NOT_FOUND = -9006,
00708
00709 DM_CHANGE_READONLY = -10000,
00710 DM_UNKNOWN_TABLE = -10001,
00711 DM_REMOVE_USED_BY = -10002,
00712 DM_REMOVE_CREATE_NOT_FOUND = -10003,
00713 DM_REMOVE_INVALID_VOLUME = -10004,
00714 DM_REMOVE_FAILED = -10005,
00715 DM_NOT_IN_LIST = -10006,
00716
00717 DASD_NOT_POSSIBLE = -11000,
00718 DASD_FDASD_FAILED = -11001,
00719 DASD_DASDFMT_FAILED = -11002,
00720
00721 DMPART_CHANGE_READONLY = -12001,
00722 DMPART_INTERNAL_ERR = -12002,
00723 DMPART_INVALID_VOLUME = -12003,
00724 DMPART_PARTITION_NOT_FOUND = -12004,
00725 DMPART_REMOVE_PARTITION_LIST_ERASE = -12005,
00726 DMPART_COMMIT_NOTHING_TODO = -12006,
00727 DMPART_NO_REMOVE = -12007,
00728
00729 DMRAID_REMOVE_FAILED = -13001,
00730
00731 NFS_VOLUME_NOT_FOUND = -14001,
00732 NFS_CHANGE_READONLY = -14002,
00733 NFS_REMOVE_VOLUME_CREATE_NOT_FOUND = -14003,
00734 NFS_REMOVE_VOLUME_LIST_ERASE = -14004,
00735 NFS_REMOVE_INVALID_VOLUME = -14005,
00736
00737 CONTAINER_INTERNAL_ERROR = -99000,
00738 CONTAINER_INVALID_VIRTUAL_CALL = -99001,
00739
00740 };
00741
00742
00746 class StorageInterface
00747 {
00748 public:
00749
00750 StorageInterface () {}
00751 virtual ~StorageInterface () {}
00752
00756 virtual void getContainers( deque<ContainerInfo>& infos) = 0;
00757
00765 virtual int getDiskInfo( const string& disk, DiskInfo& info) = 0;
00766
00775 virtual int getContDiskInfo( const string& disk, ContainerInfo& cinfo,
00776 DiskInfo& info ) = 0;
00777
00785 virtual int getLvmVgInfo( const string& name, LvmVgInfo& info) = 0;
00786
00795 virtual int getContLvmVgInfo( const string& name, ContainerInfo& cinfo,
00796 LvmVgInfo& info) = 0;
00797
00805 virtual int getDmraidCoInfo( const string& name, DmraidCoInfo& info) = 0;
00806
00815 virtual int getContDmraidCoInfo( const string& name, ContainerInfo& cinfo,
00816 DmraidCoInfo& info) = 0;
00817
00825 virtual int getDmmultipathCoInfo( const string& name, DmmultipathCoInfo& info) = 0;
00826
00835 virtual int getContDmmultipathCoInfo( const string& name, ContainerInfo& cinfo,
00836 DmmultipathCoInfo& info) = 0;
00837
00843 virtual void getVolumes( deque<VolumeInfo>& infos) = 0;
00844
00852 virtual int getVolume( const string& device, VolumeInfo& info) = 0;
00853
00861 virtual int getPartitionInfo( const string& disk,
00862 deque<PartitionInfo>& plist ) = 0;
00863
00871 virtual int getLvmLvInfo( const string& name,
00872 deque<LvmLvInfo>& plist ) = 0;
00873
00880 virtual int getMdInfo( deque<MdInfo>& plist ) = 0;
00881
00888 virtual int getNfsInfo( deque<NfsInfo>& plist ) = 0;
00889
00896 virtual int getLoopInfo( deque<LoopInfo>& plist ) = 0;
00897
00904 virtual int getDmInfo( deque<DmInfo>& plist ) = 0;
00905
00913 virtual int getDmraidInfo( const string& name,
00914 deque<DmraidInfo>& plist ) = 0;
00915
00923 virtual int getDmmultipathInfo( const string& name,
00924 deque<DmmultipathInfo>& plist ) = 0;
00925
00929 virtual bool getFsCapabilities (FsType fstype, FsCapabilities& fscapabilities) const = 0;
00930
00934 virtual bool getDlabelCapabilities(const string& dlabel,
00935 DlabelCapabilities& dlabelcapabilities) const = 0;
00936
00940 virtual list<string> getAllUsedFs() const = 0;
00941
00954 virtual int createPartition( const string& disk, PartitionType type,
00955 unsigned long startCyl,
00956 unsigned long sizeCyl,
00957 string& device ) = 0;
00958
00967 virtual int resizePartition( const string& device,
00968 unsigned long sizeCyl ) = 0;
00969
00978 virtual int resizePartitionNoFs( const string& device,
00979 unsigned long sizeCyl ) = 0;
00980
00991 virtual int updatePartitionArea( const string& device,
00992 unsigned long startCyl,
00993 unsigned long sizeCyl ) = 0;
00994
01002 virtual int freeCylindersAfterPartition(const string& device, unsigned long& freeCyls) = 0;
01003
01013 virtual int nextFreePartition( const string& disk, PartitionType type,
01014 unsigned &nr, string& device ) = 0;
01015
01028 virtual int createPartitionKb( const string& disk, PartitionType type,
01029 unsigned long long startK,
01030 unsigned long long sizeK,
01031 string& device ) = 0;
01032
01043 virtual int createPartitionAny( const string& disk,
01044 unsigned long long sizeK,
01045 string& device ) = 0;
01046
01057 virtual int createPartitionMax( const string& disk, PartitionType type,
01058 string& device ) = 0;
01059
01067 virtual unsigned long long cylinderToKb( const string& disk,
01068 unsigned long sizeCyl) = 0;
01069
01077 virtual unsigned long kbToCylinder( const string& disk,
01078 unsigned long long sizeK) = 0;
01079
01086 virtual int removePartition (const string& partition) = 0;
01087
01095 virtual int changePartitionId (const string& partition, unsigned id) = 0;
01096
01103 virtual int forgetChangePartitionId (const string& partition ) = 0;
01104
01112 virtual string getPartitionPrefix(const string& disk) = 0;
01113
01122 virtual string getPartitionName(const string& disk, int partition_no) = 0;
01123
01134 virtual int getUnusedPartitionSlots(const string& disk, list<PartitionSlotInfo>& slots) = 0;
01135
01144 virtual int destroyPartitionTable (const string& disk, const string& label) = 0;
01145
01156 virtual int initializeDisk( const string& disk, bool value ) = 0;
01157
01164 virtual string defaultDiskLabel() const = 0;
01165
01175 virtual string defaultDiskLabelSize(unsigned long long sizeK) const = 0;
01176
01185 virtual int changeFormatVolume( const string& device, bool format, FsType fs ) = 0;
01186
01194 virtual int changeLabelVolume( const string& device, const string& label ) = 0;
01195
01203 virtual int changeMkfsOptVolume( const string& device, const string& opts ) = 0;
01204
01212 virtual int changeTunefsOptVolume( const string& device, const string& opts ) = 0;
01213
01222 virtual int changeMountPoint( const string& device, const string& mount ) = 0;
01223
01231 virtual int getMountPoint( const string& device, string& mount ) = 0;
01232
01240 virtual int changeMountBy( const string& device, MountByType mby ) = 0;
01241
01249 #ifndef SWIG
01250 virtual int getMountBy( const string& device, MountByType& mby ) = 0;
01251 #else
01252 virtual int getMountBy( const string& device, MountByType& REFERENCE ) = 0;
01253 #endif
01254
01264 virtual int changeFstabOptions( const string& device, const string& options ) = 0;
01265
01274 virtual int getFstabOptions( const string& device, string& options ) = 0;
01275
01284 virtual int addFstabOptions( const string& device, const string& options ) = 0;
01285
01295 virtual int removeFstabOptions( const string& device, const string& options ) = 0;
01296
01304 virtual int setCryptPassword( const string& device, const string& pwd ) = 0;
01305
01312 virtual int forgetCryptPassword( const string& device ) = 0;
01313
01321 virtual int getCryptPassword( const string& device, string& pwd ) = 0;
01322
01330 virtual int setCrypt( const string& device, bool val ) = 0;
01331
01340 virtual int setCryptType( const string& device, bool val, EncryptType typ ) = 0;
01341
01349 #ifndef SWIG
01350 virtual int getCrypt( const string& device, bool& val ) = 0;
01351 #else
01352 virtual int getCrypt( const string& device, bool& REFERENCE ) = 0;
01353 #endif
01354
01364 virtual int setIgnoreFstab( const string& device, bool val ) = 0;
01365
01373 #ifndef SWIG
01374 virtual int getIgnoreFstab( const string& device, bool& val ) = 0;
01375 #else
01376 virtual int getIgnoreFstab( const string& device, bool& REFERENCE ) = 0;
01377 #endif
01378
01388 virtual int changeDescText( const string& device, const string& txt ) = 0;
01389
01404 virtual int addFstabEntry( const string& device, const string& mount,
01405 const string& vfs, const string& options,
01406 unsigned freq, unsigned passno ) = 0;
01407
01408
01416 virtual int resizeVolume(const string& device, unsigned long long newSizeK) = 0;
01417
01425 virtual int resizeVolumeNoFs(const string& device, unsigned long long newSizeK) = 0;
01426
01433 virtual int forgetResizeVolume( const string& device ) = 0;
01434
01449 virtual void setRecursiveRemoval( bool val ) = 0;
01450
01456 virtual bool getRecursiveRemoval() const = 0;
01457
01471 virtual void setZeroNewPartitions( bool val ) = 0;
01472
01478 virtual bool getZeroNewPartitions() const = 0;
01479
01485 virtual void setDefaultMountBy( MountByType val ) = 0;
01486
01492 virtual MountByType getDefaultMountBy() const = 0;
01493
01499 virtual void setDefaultFs(FsType val) = 0;
01500
01506 virtual FsType getDefaultFs() const = 0;
01507
01515 virtual void setEfiBoot(bool val) = 0;
01516
01522 virtual bool getEfiBoot() = 0;
01523
01534 virtual void setRootPrefix( const string& root ) = 0;
01535
01541 virtual string getRootPrefix() const = 0;
01542
01548 virtual void setDetectMountedVolumes( bool val ) = 0;
01549
01555 virtual bool getDetectMountedVolumes() const = 0;
01556
01564 virtual int removeVolume( const string& device ) = 0;
01565
01576 virtual int createLvmVg( const string& name,
01577 unsigned long long peSizeK, bool lvm1,
01578 const deque<string>& devs ) = 0;
01579
01587 virtual int removeLvmVg( const string& name ) = 0;
01588
01596 virtual int extendLvmVg( const string& name,
01597 const deque<string>& devs ) = 0;
01598
01606 virtual int shrinkLvmVg( const string& name,
01607 const deque<string>& devs ) = 0;
01608
01620 virtual int createLvmLv( const string& vg, const string& name,
01621 unsigned long long sizeK, unsigned stripes,
01622 string& device ) = 0;
01623
01630 virtual int removeLvmLvByDevice( const string& device ) = 0;
01631
01639 virtual int removeLvmLv( const string& vg, const string& name ) = 0;
01640
01650 virtual int changeLvStripeCount( const string& vg, const string& name,
01651 unsigned long stripes ) = 0;
01652
01662 virtual int changeLvStripeSize( const string& vg, const string& name,
01663 unsigned long long stripeSizeK) = 0;
01664
01675 virtual int createLvmLvSnapshot(const string& vg, const string& origin,
01676 const string& name, unsigned long long cowSizeK,
01677 string& device) = 0;
01678
01686 virtual int removeLvmLvSnapshot(const string& vg, const string& name) = 0;
01687
01698 virtual int getLvmLvSnapshotStateInfo(const string& vg, const string& name,
01699 LvmLvSnapshotStateInfo& info) = 0;
01700
01708 virtual int nextFreeMd(int &nr, string &device) = 0;
01709
01718 virtual int createMd( const string& name, MdType rtype,
01719 const deque<string>& devs ) = 0;
01720
01729 virtual int createMdAny( MdType rtype, const deque<string>& devs,
01730 string& device ) = 0;
01731
01740 virtual int removeMd( const string& name, bool destroySb ) = 0;
01741
01750 virtual int extendMd( const string& name, const string& dev ) = 0;
01751
01760 virtual int shrinkMd( const string& name, const string& dev ) = 0;
01761
01770 virtual int changeMdType( const string& name, MdType rtype ) = 0;
01771
01780 virtual int changeMdChunk(const string& name, unsigned long chunkSizeK) = 0;
01781
01790 virtual int changeMdParity( const string& name, MdParity ptype ) = 0;
01791
01798 virtual int checkMd( const string& name ) = 0;
01799
01809 virtual int getMdStateInfo(const string& name, MdStateInfo& info) = 0;
01810
01822 virtual int computeMdSize(MdType md_type, list<string> devices,
01823 unsigned long long& sizeK) = 0;
01824
01834 virtual int addNfsDevice( const string& nfsDev, const string& opts,
01835 unsigned long long sizeK,
01836 const string& mp ) = 0;
01837
01846 virtual int checkNfsDevice( const string& nfsDev, const string& opts,
01847 unsigned long long& sizeK ) = 0;
01848
01865 virtual int createFileLoop( const string& lname, bool reuseExisting,
01866 unsigned long long sizeK,
01867 const string& mp, const string& pwd,
01868 string& device ) = 0;
01869
01887 virtual int modifyFileLoop( const string& device, const string& lname,
01888 bool reuseExisting,
01889 unsigned long long sizeK ) = 0;
01890
01899 virtual int removeFileLoop( const string& lname, bool removeFile ) = 0;
01900
01907 virtual int removeDmraid( const string& name ) = 0;
01908
01914 virtual void getCommitInfos(list<CommitInfo>& infos) const = 0;
01915
01921 virtual const string& getLastAction() const = 0;
01922
01929 virtual const string& getExtendedErrorMessage() const = 0;
01930
01931
01932 #ifndef SWIG
01933
01939 virtual void setCallbackProgressBar(CallbackProgressBar pfnc) = 0;
01940
01946 virtual CallbackProgressBar getCallbackProgressBar() const = 0;
01947
01948
01954 virtual void setCallbackShowInstallInfo(CallbackShowInstallInfo pfnc) = 0;
01955
01961 virtual CallbackShowInstallInfo getCallbackShowInstallInfo() const = 0;
01962
01963
01970 virtual void setCallbackInfoPopup(CallbackInfoPopup pfnc) = 0;
01971
01978 virtual CallbackInfoPopup getCallbackInfoPopup() const = 0;
01979
01980
01987 virtual void setCallbackYesNoPopup(CallbackYesNoPopup pfnc) = 0;
01988
01995 virtual CallbackYesNoPopup getCallbackYesNoPopup() const = 0;
01996
01997
02003 virtual void setCallbackPasswordPopup(CallbackPasswordPopup pfnc) = 0;
02004
02011 virtual CallbackPasswordPopup getCallbackPasswordPopup() const = 0;
02012
02013 #endif
02014
02020 virtual void setCacheChanges (bool cache) = 0;
02021
02025 virtual bool isCacheChanges () const = 0;
02026
02031 virtual int commit() = 0;
02032
02039 virtual int createBackupState( const string& name ) = 0;
02040
02047 virtual int restoreBackupState( const string& name ) = 0;
02048
02055 virtual bool checkBackupState(const string& name) const = 0;
02056
02065 virtual bool equalBackupStates(const string& lhs, const string& rhs,
02066 bool verbose_log) const = 0;
02067
02075 virtual int removeBackupState( const string& name ) = 0;
02076
02084 virtual bool checkDeviceMounted(const string& device, list<string>& mps) = 0;
02085
02095 virtual bool umountDevice( const string& device ) = 0;
02096
02107 virtual bool mountDevice( const string& device, const string& mp ) = 0;
02108
02120 virtual bool mountDeviceOpts( const string& device, const string& mp,
02121 const string& opts ) = 0;
02122
02134 virtual bool mountDeviceRo( const string& device, const string& mp,
02135 const string& opts ) = 0;
02136
02143 virtual bool checkDmMapsTo( const string& device ) = 0;
02144
02150 virtual void removeDmTableTo( const string& device ) = 0;
02151
02164 virtual bool getFreeInfo( const string& device,
02165 unsigned long long& resize_freeK,
02166 unsigned long long& df_freeK,
02167 unsigned long long& usedK,
02168 bool& win, bool& efi, bool use_cache ) = 0;
02169
02177 virtual bool readFstab( const string& dir, deque<VolumeInfo>& infos) = 0;
02178
02187 virtual void activateHld( bool val ) = 0;
02188
02195 virtual void activateMultipath( bool val ) = 0;
02196
02205 virtual void rescanEverything() = 0;
02206
02210 virtual void dumpObjectList() = 0;
02211
02221 virtual int getContVolInfo( const string& dev, ContVolInfo& info) = 0;
02222
02223 };
02224
02225
02229 void initDefaultLogger();
02230
02231
02235 struct Environment
02236 {
02237 Environment(bool readonly) : readonly(readonly), testmode(false), autodetect(true),
02238 instsys(false), logdir("/var/log/YaST2"), testdir("") {}
02239
02240 bool readonly;
02241 bool testmode;
02242 bool autodetect;
02243 bool instsys;
02244 string logdir;
02245 string testdir;
02246 };
02247
02248
02254 StorageInterface* createStorageInterface(const Environment& env);
02255
02256
02264 StorageInterface* createStorageInterfacePid(const Environment& env, int& locker_pid);
02265
02266
02270 void destroyStorageInterface(StorageInterface*);
02271
02272 }
02273
02274
02275 #endif