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 #include <ostream>
00031
00032 using std::string;
00033 using std::deque;
00034 using std::list;
00035
00036
00121 namespace storage
00122 {
00123 enum FsType { FSUNKNOWN, REISERFS, EXT2, EXT3, VFAT, XFS, JFS, HFS, NTFS, SWAP, HFSPLUS, NFS, FSNONE };
00124
00125 enum PartitionType { PRIMARY, EXTENDED, LOGICAL, PTYPE_ANY };
00126
00127 enum MountByType { MOUNTBY_DEVICE, MOUNTBY_UUID, MOUNTBY_LABEL, MOUNTBY_ID, MOUNTBY_PATH };
00128
00129 enum EncryptType { ENC_NONE, ENC_TWOFISH, ENC_TWOFISH_OLD,
00130 ENC_TWOFISH256_OLD, ENC_LUKS, ENC_UNKNOWN };
00131
00132 enum MdType { RAID_UNK, RAID0, RAID1, RAID5, RAID6, RAID10, MULTIPATH };
00133
00134 enum MdParity { PAR_NONE, LEFT_ASYMMETRIC, LEFT_SYMMETRIC,
00135 RIGHT_ASYMMETRIC, RIGHT_SYMMETRIC };
00136
00137 enum MdArrayState { UNKNOWN, CLEAR, INACTIVE, SUSPENDED, READONLY, READ_AUTO,
00138 CLEAN, ACTIVE, WRITE_PENDING, ACTIVE_IDLE };
00139
00140 enum UsedByType { UB_NONE, UB_LVM, UB_MD, UB_DM, UB_DMRAID, UB_DMMULTIPATH,
00141 UB_MDPART };
00142
00143 enum CType { CUNKNOWN, DISK, MD, LOOP, LVM, DM, DMRAID, NFSC, DMMULTIPATH,
00144 MDPART, COTYPE_LAST_ENTRY };
00145
00146 enum ImsmDriver { IMSM_UNDECIDED, IMSM_DMRAID, IMSM_MDADM };
00147
00148
00152 typedef void (*CallbackProgressBar)(const string& id, unsigned cur, unsigned max);
00153
00158 typedef void (*CallbackShowInstallInfo)(const string& id);
00159
00164 typedef void (*CallbackInfoPopup)(const string& text);
00165
00172 typedef bool (*CallbackYesNoPopup)(const string& text);
00173
00179 typedef bool (*CallbackPasswordPopup)(const string& device, int attempts, string& password);
00180
00181
00185 struct FsCapabilities
00186 {
00187 FsCapabilities () {}
00188 bool isExtendable;
00189 bool isExtendableWhileMounted;
00190 bool isReduceable;
00191 bool isReduceableWhileMounted;
00192 bool supportsUuid;
00193 bool supportsLabel;
00194 bool labelWhileMounted;
00195 unsigned int labelLength;
00196 unsigned long long minimalFsSizeK;
00197 };
00198
00202 struct ContainerInfo
00203 {
00204 ContainerInfo() {}
00205 CType type;
00206 unsigned volcnt;
00207 string device;
00208 string name;
00209 UsedByType usedByType;
00210 string usedByName;
00211 string usedByDevice;
00212 bool readonly;
00213 };
00214
00218 struct DiskInfo
00219 {
00220 DiskInfo() {}
00221 unsigned long long sizeK;
00222 unsigned long long cylSizeB;
00223 unsigned long cyl;
00224 unsigned long heads;
00225 unsigned long sectors;
00226 string disklabel;
00227 string udevPath;
00228 string udevId;
00229 unsigned maxLogical;
00230 unsigned maxPrimary;
00231 bool initDisk;
00232 bool iscsi;
00233 };
00234
00238 struct LvmVgInfo
00239 {
00240 LvmVgInfo() {}
00241 unsigned long long sizeK;
00242 unsigned long long peSize;
00243 unsigned long peCount;
00244 unsigned long peFree;
00245 string uuid;
00246 bool lvm2;
00247 bool create;
00248 string devices;
00249 string devices_add;
00250 string devices_rem;
00251 };
00252
00256 struct DmPartCoInfo
00257 {
00258 DmPartCoInfo() {}
00259 DiskInfo d;
00260 string devices;
00261 unsigned long minor;
00262 };
00263
00264 struct DmraidCoInfo
00265 {
00266 DmraidCoInfo() {}
00267 DmPartCoInfo p;
00268 };
00269
00270 struct DmmultipathCoInfo
00271 {
00272 DmmultipathCoInfo() {}
00273 DmPartCoInfo p;
00274 string vendor;
00275 string model;
00276 };
00277
00281 struct VolumeInfo
00282 {
00283 VolumeInfo() {}
00284 unsigned long long sizeK;
00285 unsigned long major;
00286 unsigned long minor;
00287 string name;
00288 string device;
00289 string mount;
00290 MountByType mount_by;
00291 UsedByType usedByType;
00292 string usedByName;
00293 string usedByDevice;
00294 string fstab_options;
00295 string uuid;
00296 string label;
00297 string mkfs_options;
00298 string tunefs_options;
00299 string loop;
00300 string dtxt;
00301 EncryptType encryption;
00302 string crypt_pwd;
00303 FsType fs;
00304 bool format;
00305 bool create;
00306 bool is_mounted;
00307 bool resize;
00308 bool ignore_fs;
00309 unsigned long long OrigSizeK;
00310 };
00311
00312 struct PartitionAddInfo
00313 {
00314 PartitionAddInfo() {}
00315 unsigned nr;
00316 unsigned long cylStart;
00317 unsigned long cylSize;
00318 PartitionType partitionType;
00319 unsigned id;
00320 bool boot;
00321 string udevPath;
00322 string udevId;
00323 };
00324
00328 struct PartitionInfo
00329 {
00330 PartitionInfo() {}
00331 PartitionInfo& operator=( const PartitionAddInfo& rhs );
00332 VolumeInfo v;
00333 unsigned nr;
00334 unsigned long cylStart;
00335 unsigned long cylSize;
00336 PartitionType partitionType;
00337 unsigned id;
00338 bool boot;
00339 string udevPath;
00340 string udevId;
00341 };
00342
00346 struct LvmLvInfo
00347 {
00348 LvmLvInfo() {}
00349 VolumeInfo v;
00350 unsigned stripe;
00351 unsigned stripe_size;
00352 string uuid;
00353 string status;
00354 string allocation;
00355 string dm_table;
00356 string dm_target;
00357 string origin;
00358 unsigned long long sizeK;
00359 };
00360
00364 struct LvmLvSnapshotStateInfo
00365 {
00366 LvmLvSnapshotStateInfo() {}
00367 bool active;
00368 double allocated;
00369 };
00370
00374 struct MdInfo
00375 {
00376 MdInfo() {}
00377 VolumeInfo v;
00378 unsigned nr;
00379 unsigned type;
00380 unsigned parity;
00381 string uuid;
00382 string sb_ver;
00383 unsigned long chunk;
00384 string devices;
00385 };
00386
00390 struct MdStateInfo
00391 {
00392 MdStateInfo() {}
00393 bool active;
00394 bool degraded;
00395 enum MdArrayState state;
00396 };
00397
00402 struct MdPartCoInfo
00403 {
00404 MdPartCoInfo() {}
00405 DiskInfo d;
00406 string devices;
00407 string spares;
00408 unsigned long minor;
00409
00410 unsigned level;
00411 unsigned nr;
00412 unsigned parity;
00413 string uuid;
00414 string sb_ver;
00415 unsigned long chunk;
00416 string md_name;
00417 };
00418
00419 struct MdPartCoStateInfo
00420 {
00421 MdPartCoStateInfo() {}
00422 bool active;
00423 bool degraded;
00424 enum MdArrayState state;
00425 };
00426
00427
00431 struct MdPartInfo
00432 {
00433 MdPartInfo() {}
00434 VolumeInfo v;
00435 PartitionAddInfo p;
00436 bool part;
00437 };
00438
00442 struct NfsInfo
00443 {
00444 NfsInfo() {}
00445 VolumeInfo v;
00446 };
00447
00451 struct LoopInfo
00452 {
00453 LoopInfo() {}
00454 VolumeInfo v;
00455 bool reuseFile;
00456 unsigned nr;
00457 string file;
00458 };
00459
00463 struct DmInfo
00464 {
00465 DmInfo() {}
00466 VolumeInfo v;
00467 unsigned nr;
00468 string table;
00469 string target;
00470 };
00471
00475 struct DmPartInfo
00476 {
00477 DmPartInfo() {}
00478 VolumeInfo v;
00479 PartitionAddInfo p;
00480 bool part;
00481 string table;
00482 string target;
00483 };
00484
00488 struct DmraidInfo
00489 {
00490 DmraidInfo() {}
00491 DmPartInfo p;
00492 };
00493
00497 struct DmmultipathInfo
00498 {
00499 DmmultipathInfo() {}
00500 DmPartInfo p;
00501 };
00502
00506 struct ContVolInfo
00507 {
00508 ContVolInfo() { numeric=false; nr=0; type=CUNKNOWN; }
00509 CType type;
00510 string cname;
00511 string vname;
00512 bool numeric;
00513 unsigned nr;
00514 };
00515
00519 struct PartitionSlotInfo
00520 {
00521 PartitionSlotInfo() {}
00522 unsigned long cylStart;
00523 unsigned long cylSize;
00524 bool primarySlot;
00525 bool primaryPossible;
00526 bool extendedSlot;
00527 bool extendedPossible;
00528 bool logicalSlot;
00529 bool logicalPossible;
00530 };
00531
00535 struct CommitInfo
00536 {
00537 bool destructive;
00538 deque<string> actions;
00539 };
00540
00541
00545 enum ErrorCodes
00546 {
00547 DISK_PARTITION_OVERLAPS_EXISTING = -1000,
00548 DISK_PARTITION_EXCEEDS_DISK = -1001,
00549 DISK_CREATE_PARTITION_EXT_ONLY_ONCE = -1002,
00550 DISK_CREATE_PARTITION_EXT_IMPOSSIBLE = -1003,
00551 DISK_PARTITION_NO_FREE_NUMBER = -1004,
00552 DISK_CREATE_PARTITION_INVALID_VOLUME = -1005,
00553 DISK_CREATE_PARTITION_INVALID_TYPE = -1006,
00554 DISK_CREATE_PARTITION_PARTED_FAILED = -1007,
00555 DISK_PARTITION_NOT_FOUND = -1008,
00556 DISK_CREATE_PARTITION_LOGICAL_NO_EXT = -1009,
00557 DISK_PARTITION_LOGICAL_OUTSIDE_EXT = -1010,
00558 DISK_SET_TYPE_INVALID_VOLUME = -1011,
00559 DISK_SET_TYPE_PARTED_FAILED = -1012,
00560 DISK_SET_LABEL_PARTED_FAILED = -1013,
00561 DISK_REMOVE_PARTITION_PARTED_FAILED = -1014,
00562 DISK_REMOVE_PARTITION_INVALID_VOLUME = -1015,
00563 DISK_REMOVE_PARTITION_LIST_ERASE = -1016,
00564 DISK_DESTROY_TABLE_INVALID_LABEL = -1017,
00565 DISK_PARTITION_ZERO_SIZE = -1018,
00566 DISK_CHANGE_READONLY = -1019,
00567 DISK_RESIZE_PARTITION_INVALID_VOLUME = -1020,
00568 DISK_RESIZE_PARTITION_PARTED_FAILED = -1021,
00569 DISK_RESIZE_NO_SPACE = -1022,
00570 DISK_CHECK_RESIZE_INVALID_VOLUME = -1023,
00571 DISK_REMOVE_PARTITION_CREATE_NOT_FOUND = -1024,
00572 DISK_COMMIT_NOTHING_TODO = -1025,
00573 DISK_CREATE_PARTITION_NO_SPACE = -1026,
00574 DISK_REMOVE_USED_BY = -1027,
00575 DISK_INIT_NOT_POSSIBLE = -1028,
00576 DISK_INVALID_PARTITION_ID = -1029,
00577
00578 STORAGE_DISK_NOT_FOUND = -2000,
00579 STORAGE_VOLUME_NOT_FOUND = -2001,
00580 STORAGE_REMOVE_PARTITION_INVALID_CONTAINER = -2002,
00581 STORAGE_CHANGE_PARTITION_ID_INVALID_CONTAINER = -2003,
00582 STORAGE_CHANGE_READONLY = -2004,
00583 STORAGE_DISK_USED_BY = -2005,
00584 STORAGE_LVM_VG_EXISTS = -2006,
00585 STORAGE_LVM_VG_NOT_FOUND = -2007,
00586 STORAGE_LVM_INVALID_DEVICE = -2008,
00587 STORAGE_CONTAINER_NOT_FOUND = -2009,
00588 STORAGE_VG_INVALID_NAME = -2010,
00589 STORAGE_REMOVE_USED_VOLUME = -2011,
00590 STORAGE_REMOVE_USING_UNKNOWN_TYPE = -2012,
00591 STORAGE_NOT_YET_IMPLEMENTED = -2013,
00592 STORAGE_MD_INVALID_NAME = -2014,
00593 STORAGE_MD_NOT_FOUND = -2015,
00594 STORAGE_MEMORY_EXHAUSTED = -2016,
00595 STORAGE_LOOP_NOT_FOUND = -2017,
00596 STORAGE_CREATED_LOOP_NOT_FOUND = -2018,
00597 STORAGE_CHANGE_AREA_INVALID_CONTAINER = -2023,
00598 STORAGE_BACKUP_STATE_NOT_FOUND = -2024,
00599 STORAGE_INVALID_FSTAB_VALUE = -2025,
00600 STORAGE_NO_FSTAB_PTR = -2026,
00601 STORAGE_DEVICE_NODE_NOT_FOUND = -2027,
00602 STORAGE_DMRAID_CO_NOT_FOUND = -2028,
00603 STORAGE_RESIZE_INVALID_CONTAINER = -2029,
00604 STORAGE_DMMULTIPATH_CO_NOT_FOUND = -2030,
00605 STORAGE_ZERO_DEVICE_FAILED = -2031,
00606 STORAGE_MDPART_CO_NOT_FOUND = -2032,
00607
00608 VOLUME_COMMIT_UNKNOWN_STAGE = -3000,
00609 VOLUME_FSTAB_EMPTY_MOUNT = -3001,
00610 VOLUME_UMOUNT_FAILED = -3002,
00611 VOLUME_MOUNT_FAILED = -3003,
00612 VOLUME_FORMAT_UNKNOWN_FS = -3005,
00613 VOLUME_FORMAT_FS_UNDETECTED = -3006,
00614 VOLUME_FORMAT_FS_TOO_SMALL = -3007,
00615 VOLUME_FORMAT_FAILED = -3008,
00616 VOLUME_TUNE2FS_FAILED = -3009,
00617 VOLUME_MKLABEL_FS_UNABLE = -3010,
00618 VOLUME_MKLABEL_FAILED = -3011,
00619 VOLUME_LOSETUP_NO_LOOP = -3012,
00620 VOLUME_LOSETUP_FAILED = -3013,
00621 VOLUME_CRYPT_NO_PWD = -3014,
00622 VOLUME_CRYPT_PWD_TOO_SHORT = -3015,
00623 VOLUME_CRYPT_NOT_DETECTED = -3016,
00624 VOLUME_FORMAT_EXTENDED_UNSUPPORTED = -3017,
00625 VOLUME_MOUNT_EXTENDED_UNSUPPORTED = -3018,
00626 VOLUME_MOUNT_POINT_INVALID = -3019,
00627 VOLUME_MOUNTBY_NOT_ENCRYPTED = -3020,
00628 VOLUME_MOUNTBY_UNSUPPORTED_BY_FS = -3021,
00629 VOLUME_LABEL_NOT_SUPPORTED = -3022,
00630 VOLUME_LABEL_TOO_LONG = -3023,
00631 VOLUME_LABEL_WHILE_MOUNTED = -3024,
00632 VOLUME_RESIZE_UNSUPPORTED_BY_FS = -3025,
00633 VOLUME_RESIZE_UNSUPPORTED_BY_CONTAINER = -3026,
00634 VOLUME_RESIZE_FAILED = -3027,
00635 VOLUME_ALREADY_IN_USE = -3028,
00636 VOLUME_LOUNSETUP_FAILED = -3029,
00637 VOLUME_DEVICE_NOT_PRESENT = -3030,
00638 VOLUME_DEVICE_NOT_BLOCK = -3031,
00639 VOLUME_MOUNTBY_UNSUPPORTED_BY_VOLUME = -3032,
00640 VOLUME_CRYPTFORMAT_FAILED = -3033,
00641 VOLUME_CRYPTSETUP_FAILED = -3034,
00642 VOLUME_CRYPTUNSETUP_FAILED = -3035,
00643 VOLUME_FORMAT_NOT_IMPLEMENTED = -3036,
00644 VOLUME_FORMAT_NFS_IMPOSSIBLE = -3037,
00645 VOLUME_CRYPT_NFS_IMPOSSIBLE = -3038,
00646 VOLUME_REMOUNT_FAILED = -3039,
00647 VOLUME_TUNEREISERFS_FAILED = -3040,
00648
00649 LVM_CREATE_PV_FAILED = -4000,
00650 LVM_PV_ALREADY_CONTAINED = -4001,
00651 LVM_PV_DEVICE_UNKNOWN = -4002,
00652 LVM_PV_DEVICE_USED = -4003,
00653 LVM_VG_HAS_NONE_PV = -4004,
00654 LVM_LV_INVALID_NAME = -4005,
00655 LVM_LV_DUPLICATE_NAME = -4006,
00656 LVM_LV_NO_SPACE = -4007,
00657 LVM_LV_UNKNOWN_NAME = -4008,
00658 LVM_LV_NOT_IN_LIST = -4009,
00659 LVM_VG_CREATE_FAILED = -4010,
00660 LVM_VG_EXTEND_FAILED = -4011,
00661 LVM_VG_REDUCE_FAILED = -4012,
00662 LVM_VG_REMOVE_FAILED = -4013,
00663 LVM_LV_CREATE_FAILED = -4014,
00664 LVM_LV_REMOVE_FAILED = -4015,
00665 LVM_LV_RESIZE_FAILED = -4016,
00666 LVM_PV_STILL_ADDED = -4017,
00667 LVM_PV_REMOVE_NOT_FOUND = -4018,
00668 LVM_CREATE_LV_INVALID_VOLUME = -4019,
00669 LVM_REMOVE_LV_INVALID_VOLUME = -4020,
00670 LVM_RESIZE_LV_INVALID_VOLUME = -4021,
00671 LVM_CHANGE_READONLY = -4022,
00672 LVM_CHECK_RESIZE_INVALID_VOLUME = -4023,
00673 LVM_COMMIT_NOTHING_TODO = -4024,
00674 LVM_LV_REMOVE_USED_BY = -4025,
00675 LVM_LV_ALREADY_ON_DISK = -4026,
00676 LVM_LV_NO_STRIPE_SIZE = -4027,
00677 LVM_LV_UNKNOWN_ORIGIN = -4028,
00678 LVM_LV_NOT_ON_DISK = -4029,
00679 LVM_LV_NOT_SNAPSHOT = -4030,
00680 LVM_LV_HAS_SNAPSHOTS = -4031,
00681 LVM_LV_IS_SNAPSHOT = -4032,
00682
00683 FSTAB_ENTRY_NOT_FOUND = -5000,
00684 FSTAB_CHANGE_PREFIX_IMPOSSIBLE = -5001,
00685 FSTAB_REMOVE_ENTRY_NOT_FOUND = -5002,
00686 FSTAB_UPDATE_ENTRY_NOT_FOUND = -5003,
00687 FSTAB_ADD_ENTRY_FOUND = -5004,
00688
00689 MD_CHANGE_READONLY = -6000,
00690 MD_DUPLICATE_NUMBER = -6001,
00691 MD_TOO_FEW_DEVICES = -6002,
00692 MD_DEVICE_UNKNOWN = -6003,
00693 MD_DEVICE_USED = -6004,
00694 MD_CREATE_INVALID_VOLUME = -6005,
00695 MD_REMOVE_FAILED = -6006,
00696 MD_NOT_IN_LIST = -6007,
00697 MD_CREATE_FAILED = -6008,
00698 MD_UNKNOWN_NUMBER = -6009,
00699 MD_REMOVE_USED_BY = -6010,
00700 MD_NUMBER_TOO_LARGE = -6011,
00701 MD_REMOVE_INVALID_VOLUME = -6012,
00702 MD_REMOVE_CREATE_NOT_FOUND = -6013,
00703 MD_NO_RESIZE_ON_DISK = -6014,
00704 MD_ADD_DUPLICATE = -6015,
00705 MD_REMOVE_NONEXISTENT = -6016,
00706 MD_NO_CHANGE_ON_DISK = -6017,
00707 MD_NO_CREATE_UNKNOWN = -6018,
00708 MD_STATE_NOT_ON_DISK = -6019,
00709 MD_PARTITION_NOT_FOUND = -6020,
00710
00711 MDPART_CHANGE_READONLY = -6100,
00712 MDPART_INTERNAL_ERR = -6101,
00713 MDPART_INVALID_VOLUME = -6012,
00714 MDPART_PARTITION_NOT_FOUND = -6103,
00715 MDPART_REMOVE_PARTITION_LIST_ERASE = -6104,
00716 MDPART_COMMIT_NOTHING_TODO = -6105,
00717 MDPART_NO_REMOVE = -6106,
00718 MDPART_DEVICE_NOT_FOUND = -6107,
00719
00720 LOOP_CHANGE_READONLY = -7000,
00721 LOOP_DUPLICATE_FILE = -7001,
00722 LOOP_UNKNOWN_FILE = -7002,
00723 LOOP_REMOVE_USED_BY = -7003,
00724 LOOP_FILE_CREATE_FAILED = -7004,
00725 LOOP_CREATE_INVALID_VOLUME = -7005,
00726 LOOP_REMOVE_FILE_FAILED = -7006,
00727 LOOP_REMOVE_INVALID_VOLUME = -7007,
00728 LOOP_NOT_IN_LIST = -7008,
00729 LOOP_REMOVE_CREATE_NOT_FOUND = -7009,
00730 LOOP_MODIFY_EXISTING = -7010,
00731
00732 PEC_PE_SIZE_INVALID = -9000,
00733 PEC_PV_NOT_FOUND = -9001,
00734 PEC_REMOVE_PV_IN_USE = -9002,
00735 PEC_REMOVE_PV_SIZE_NEEDED = -9003,
00736 PEC_LV_NO_SPACE_STRIPED = -9004,
00737 PEC_LV_NO_SPACE_SINGLE = -9005,
00738 PEC_LV_PE_DEV_NOT_FOUND = -9006,
00739
00740 DM_CHANGE_READONLY = -10000,
00741 DM_UNKNOWN_TABLE = -10001,
00742 DM_REMOVE_USED_BY = -10002,
00743 DM_REMOVE_CREATE_NOT_FOUND = -10003,
00744 DM_REMOVE_INVALID_VOLUME = -10004,
00745 DM_REMOVE_FAILED = -10005,
00746 DM_NOT_IN_LIST = -10006,
00747
00748 DASD_NOT_POSSIBLE = -11000,
00749 DASD_FDASD_FAILED = -11001,
00750 DASD_DASDFMT_FAILED = -11002,
00751
00752 DMPART_CHANGE_READONLY = -12001,
00753 DMPART_INTERNAL_ERR = -12002,
00754 DMPART_INVALID_VOLUME = -12003,
00755 DMPART_PARTITION_NOT_FOUND = -12004,
00756 DMPART_REMOVE_PARTITION_LIST_ERASE = -12005,
00757 DMPART_COMMIT_NOTHING_TODO = -12006,
00758 DMPART_NO_REMOVE = -12007,
00759
00760 DMRAID_REMOVE_FAILED = -13001,
00761
00762 NFS_VOLUME_NOT_FOUND = -14001,
00763 NFS_CHANGE_READONLY = -14002,
00764 NFS_REMOVE_VOLUME_CREATE_NOT_FOUND = -14003,
00765 NFS_REMOVE_VOLUME_LIST_ERASE = -14004,
00766 NFS_REMOVE_INVALID_VOLUME = -14005,
00767
00768 CONTAINER_INTERNAL_ERROR = -99000,
00769 CONTAINER_INVALID_VIRTUAL_CALL = -99001,
00770
00771 };
00772
00773
00777 class StorageInterface
00778 {
00779 public:
00780
00781 StorageInterface () {}
00782 virtual ~StorageInterface () {}
00783
00787 virtual void getContainers( deque<ContainerInfo>& infos) = 0;
00788
00796 virtual int getDiskInfo( const string& disk, DiskInfo& info) = 0;
00797
00806 virtual int getContDiskInfo( const string& disk, ContainerInfo& cinfo,
00807 DiskInfo& info ) = 0;
00808
00816 virtual int getLvmVgInfo( const string& name, LvmVgInfo& info) = 0;
00817
00826 virtual int getContLvmVgInfo( const string& name, ContainerInfo& cinfo,
00827 LvmVgInfo& info) = 0;
00828
00836 virtual int getDmraidCoInfo( const string& name, DmraidCoInfo& info) = 0;
00837
00846 virtual int getContDmraidCoInfo( const string& name, ContainerInfo& cinfo,
00847 DmraidCoInfo& info) = 0;
00848
00856 virtual int getDmmultipathCoInfo( const string& name, DmmultipathCoInfo& info) = 0;
00857
00866 virtual int getContDmmultipathCoInfo( const string& name, ContainerInfo& cinfo,
00867 DmmultipathCoInfo& info) = 0;
00868
00876 virtual int getMdPartCoInfo( const string& name, MdPartCoInfo& info) = 0;
00877
00878
00887 virtual int getContMdPartCoInfo( const string& name, ContainerInfo& cinfo,
00888 MdPartCoInfo& info) = 0;
00889
00895 virtual void setImsmDriver(ImsmDriver driver) = 0;
00896
00902 virtual ImsmDriver getImsmDriver() const = 0;
00903
00909 virtual void getVolumes( deque<VolumeInfo>& infos) = 0;
00910
00918 virtual int getVolume( const string& device, VolumeInfo& info) = 0;
00919
00927 virtual int getPartitionInfo( const string& disk,
00928 deque<PartitionInfo>& plist ) = 0;
00929
00937 virtual int getLvmLvInfo( const string& name,
00938 deque<LvmLvInfo>& plist ) = 0;
00939
00946 virtual int getMdInfo( deque<MdInfo>& plist ) = 0;
00947
00955 virtual int getMdPartInfo( const string& device,
00956 deque<MdPartInfo>& plist ) = 0;
00957
00964 virtual int getNfsInfo( deque<NfsInfo>& plist ) = 0;
00965
00972 virtual int getLoopInfo( deque<LoopInfo>& plist ) = 0;
00973
00980 virtual int getDmInfo( deque<DmInfo>& plist ) = 0;
00981
00989 virtual int getDmraidInfo( const string& name,
00990 deque<DmraidInfo>& plist ) = 0;
00991
00999 virtual int getDmmultipathInfo( const string& name,
01000 deque<DmmultipathInfo>& plist ) = 0;
01001
01005 virtual bool getFsCapabilities (FsType fstype, FsCapabilities& fscapabilities) const = 0;
01006
01010 virtual list<string> getAllUsedFs() const = 0;
01011
01019 virtual void printInfo( std::ostream& str ) = 0;
01020
01029 virtual void printInfoCo( std::ostream& str, const string& name ) = 0;
01030
01043 virtual int createPartition( const string& disk, PartitionType type,
01044 unsigned long start,
01045 unsigned long sizeCyl,
01046 string& device ) = 0;
01047
01056 virtual int resizePartition( const string& device,
01057 unsigned long sizeCyl ) = 0;
01058
01067 virtual int resizePartitionNoFs( const string& device,
01068 unsigned long sizeCyl ) = 0;
01069
01080 virtual int updatePartitionArea( const string& device,
01081 unsigned long start,
01082 unsigned long sizeCyl ) = 0;
01083
01091 virtual int freeCylindersAfterPartition(const string& device, unsigned long& freeCyls) = 0;
01092
01102 virtual int nextFreePartition( const string& disk, PartitionType type,
01103 unsigned &nr, string& device ) = 0;
01104
01117 virtual int createPartitionKb( const string& disk, PartitionType type,
01118 unsigned long long start,
01119 unsigned long long size,
01120 string& device ) = 0;
01121
01132 virtual int createPartitionAny( const string& disk,
01133 unsigned long long size,
01134 string& device ) = 0;
01135
01146 virtual int createPartitionMax( const string& disk, PartitionType type,
01147 string& device ) = 0;
01148
01156 virtual unsigned long long cylinderToKb( const string& disk,
01157 unsigned long size ) = 0;
01158
01166 virtual unsigned long kbToCylinder( const string& disk,
01167 unsigned long long size ) = 0;
01168
01175 virtual int removePartition (const string& partition) = 0;
01176
01184 virtual int changePartitionId (const string& partition, unsigned id) = 0;
01185
01192 virtual int forgetChangePartitionId (const string& partition ) = 0;
01193
01204 virtual int getUnusedPartitionSlots(const string& disk, list<PartitionSlotInfo>& slots) = 0;
01205
01214 virtual int destroyPartitionTable (const string& disk, const string& label) = 0;
01215
01226 virtual int initializeDisk( const string& disk, bool value ) = 0;
01227
01234 virtual string defaultDiskLabel() const = 0;
01235
01245 virtual string defaultDiskLabelSize( unsigned long long size_k ) const = 0;
01246
01252 virtual unsigned long long maxSizeLabelK( const string& label ) const = 0;
01253
01262 virtual int changeFormatVolume( const string& device, bool format, FsType fs ) = 0;
01263
01271 virtual int changeLabelVolume( const string& device, const string& label ) = 0;
01272
01280 virtual int changeMkfsOptVolume( const string& device, const string& opts ) = 0;
01281
01289 virtual int changeTunefsOptVolume( const string& device, const string& opts ) = 0;
01290
01299 virtual int changeMountPoint( const string& device, const string& mount ) = 0;
01300
01308 virtual int getMountPoint( const string& device, string& mount ) = 0;
01309
01317 virtual int changeMountBy( const string& device, MountByType mby ) = 0;
01318
01326 #ifndef SWIG
01327 virtual int getMountBy( const string& device, MountByType& mby ) = 0;
01328 #else
01329 virtual int getMountBy( const string& device, MountByType& REFERENCE ) = 0;
01330 #endif
01331
01341 virtual int changeFstabOptions( const string& device, const string& options ) = 0;
01342
01351 virtual int getFstabOptions( const string& device, string& options ) = 0;
01352
01361 virtual int addFstabOptions( const string& device, const string& options ) = 0;
01362
01372 virtual int removeFstabOptions( const string& device, const string& options ) = 0;
01373
01381 virtual int setCryptPassword( const string& device, const string& pwd ) = 0;
01382
01389 virtual int forgetCryptPassword( const string& device ) = 0;
01390
01398 virtual int getCryptPassword( const string& device, string& pwd ) = 0;
01399
01407 virtual int verifyCryptPassword( const string& device, const string& pwd ) = 0;
01414 virtual bool needCryptPassword( const string& device ) = 0;
01415
01423 virtual int setCrypt( const string& device, bool val ) = 0;
01424
01433 virtual int setCryptType( const string& device, bool val, EncryptType typ ) = 0;
01434
01442 #ifndef SWIG
01443 virtual int getCrypt( const string& device, bool& val ) = 0;
01444 #else
01445 virtual int getCrypt( const string& device, bool& REFERENCE ) = 0;
01446 #endif
01447
01457 virtual int setIgnoreFstab( const string& device, bool val ) = 0;
01458
01466 #ifndef SWIG
01467 virtual int getIgnoreFstab( const string& device, bool& val ) = 0;
01468 #else
01469 virtual int getIgnoreFstab( const string& device, bool& REFERENCE ) = 0;
01470 #endif
01471
01481 virtual int changeDescText( const string& device, const string& txt ) = 0;
01482
01494 virtual int addFstabEntry( const string& device, const string& mount,
01495 const string& vfs, const string& options,
01496 unsigned freq, unsigned passno ) = 0;
01497
01498
01506 virtual int resizeVolume( const string& device, unsigned long long newSizeMb ) = 0;
01507
01515 virtual int resizeVolumeNoFs( const string& device, unsigned long long newSizeMb ) = 0;
01516
01523 virtual int forgetResizeVolume( const string& device ) = 0;
01524
01539 virtual void setRecursiveRemoval( bool val ) = 0;
01540
01546 virtual bool getRecursiveRemoval() const = 0;
01547
01561 virtual void setZeroNewPartitions( bool val ) = 0;
01562
01568 virtual bool getZeroNewPartitions() const = 0;
01569
01575 virtual void setDefaultMountBy( MountByType val ) = 0;
01576
01582 virtual MountByType getDefaultMountBy() const = 0;
01583
01591 virtual void setEfiBoot(bool val) = 0;
01592
01598 virtual bool getEfiBoot() = 0;
01599
01610 virtual void setRootPrefix( const string& root ) = 0;
01611
01617 virtual string getRootPrefix() const = 0;
01618
01624 virtual void setDetectMountedVolumes( bool val ) = 0;
01625
01631 virtual bool getDetectMountedVolumes() const = 0;
01632
01640 virtual int removeVolume( const string& device ) = 0;
01641
01652 virtual int createLvmVg( const string& name,
01653 unsigned long long peSizeK, bool lvm1,
01654 const deque<string>& devs ) = 0;
01655
01663 virtual int removeLvmVg( const string& name ) = 0;
01664
01672 virtual int extendLvmVg( const string& name,
01673 const deque<string>& devs ) = 0;
01674
01682 virtual int shrinkLvmVg( const string& name,
01683 const deque<string>& devs ) = 0;
01684
01696 virtual int createLvmLv( const string& vg, const string& name,
01697 unsigned long long sizeM, unsigned stripe,
01698 string& device ) = 0;
01699
01706 virtual int removeLvmLvByDevice( const string& device ) = 0;
01707
01715 virtual int removeLvmLv( const string& vg, const string& name ) = 0;
01716
01726 virtual int changeLvStripeCount( const string& vg, const string& name,
01727 unsigned long stripes ) = 0;
01728
01738 virtual int changeLvStripeSize( const string& vg, const string& name,
01739 unsigned long long stripeSize ) = 0;
01740
01751 virtual int createLvmLvSnapshot(const string& vg, const string& origin,
01752 const string& name, unsigned long long cowSizeK,
01753 string& device) = 0;
01754
01762 virtual int removeLvmLvSnapshot(const string& vg, const string& name) = 0;
01763
01774 virtual int getLvmLvSnapshotStateInfo(const string& vg, const string& name,
01775 LvmLvSnapshotStateInfo& info) = 0;
01776
01784 virtual int nextFreeMd(int &nr, string &device) = 0;
01785
01794 virtual int createMd( const string& name, MdType rtype,
01795 const deque<string>& devs ) = 0;
01796
01805 virtual int createMdAny( MdType rtype, const deque<string>& devs,
01806 string& device ) = 0;
01807
01816 virtual int removeMd( const string& name, bool destroySb ) = 0;
01817
01826 virtual int extendMd( const string& name, const string& dev ) = 0;
01827
01836 virtual int shrinkMd( const string& name, const string& dev ) = 0;
01837
01846 virtual int changeMdType( const string& name, MdType rtype ) = 0;
01847
01856 virtual int changeMdChunk( const string& name, unsigned long chunk ) = 0;
01857
01866 virtual int changeMdParity( const string& name, MdParity ptype ) = 0;
01867
01874 virtual int checkMd( const string& name ) = 0;
01875
01885 virtual int getMdStateInfo(const string& name, MdStateInfo& info) = 0;
01886
01896 virtual int getMdPartCoStateInfo(const string& name,
01897 MdPartCoStateInfo& info) = 0;
01898
01910 virtual int computeMdSize(MdType md_type, list<string> devices,
01911 unsigned long long& sizeK) = 0;
01912
01923 virtual int removeMdPartCo(const string& name, bool destroySb ) = 0;
01924
01934 virtual int addNfsDevice( const string& nfsDev, const string& opts,
01935 unsigned long long sizeK,
01936 const string& mp ) = 0;
01937
01946 virtual int checkNfsDevice( const string& nfsDev, const string& opts,
01947 unsigned long long& sizeK ) = 0;
01948
01965 virtual int createFileLoop( const string& lname, bool reuseExisting,
01966 unsigned long long sizeK,
01967 const string& mp, const string& pwd,
01968 string& device ) = 0;
01969
01987 virtual int modifyFileLoop( const string& device, const string& lname,
01988 bool reuseExisting,
01989 unsigned long long sizeK ) = 0;
01990
01999 virtual int removeFileLoop( const string& lname, bool removeFile ) = 0;
02000
02007 virtual int removeDmraid( const string& name ) = 0;
02008
02019 virtual deque<string> getCommitActions(bool mark_destructive) const = 0;
02020
02028 virtual void getCommitInfo(bool mark_destructive, CommitInfo& info) const = 0;
02029
02035 virtual const string& getLastAction() const = 0;
02036
02043 virtual const string& getExtendedErrorMessage() const = 0;
02044
02045
02046 #ifndef SWIG
02047
02053 virtual void setCallbackProgressBar(CallbackProgressBar pfnc) = 0;
02054
02060 virtual CallbackProgressBar getCallbackProgressBar() const = 0;
02061
02062
02068 virtual void setCallbackShowInstallInfo(CallbackShowInstallInfo pfnc) = 0;
02069
02075 virtual CallbackShowInstallInfo getCallbackShowInstallInfo() const = 0;
02076
02077
02084 virtual void setCallbackInfoPopup(CallbackInfoPopup pfnc) = 0;
02085
02092 virtual CallbackInfoPopup getCallbackInfoPopup() const = 0;
02093
02094
02101 virtual void setCallbackYesNoPopup(CallbackYesNoPopup pfnc) = 0;
02102
02109 virtual CallbackYesNoPopup getCallbackYesNoPopup() const = 0;
02110
02111
02117 virtual void setCallbackPasswordPopup(CallbackPasswordPopup pfnc) = 0;
02118
02125 virtual CallbackPasswordPopup getCallbackPasswordPopup() const = 0;
02126
02127 #endif
02128
02134 virtual void setCacheChanges (bool cache) = 0;
02135
02139 virtual bool isCacheChanges () const = 0;
02140
02145 virtual int commit() = 0;
02146
02153 virtual int createBackupState( const string& name ) = 0;
02154
02161 virtual int restoreBackupState( const string& name ) = 0;
02162
02169 virtual bool checkBackupState( const string& name ) = 0;
02170
02179 virtual bool equalBackupStates( const string& lhs,
02180 const string& rhs,
02181 bool verbose_log ) const = 0;
02182
02190 virtual int removeBackupState( const string& name ) = 0;
02191
02199 virtual bool checkDeviceMounted( const string& device, string& mp ) = 0;
02200
02209 virtual bool umountDevice( const string& device ) = 0;
02210
02220 virtual bool mountDevice( const string& device, const string& mp ) = 0;
02221
02232 virtual bool mountDeviceOpts( const string& device, const string& mp,
02233 const string& opts ) = 0;
02234
02245 virtual bool mountDeviceRo( const string& device, const string& mp,
02246 const string& opts ) = 0;
02247
02254 virtual bool checkDmMapsTo( const string& device ) = 0;
02255
02261 virtual void removeDmTableTo( const string& device ) = 0;
02262
02274 virtual bool getFreeInfo( const string& device,
02275 unsigned long long& resize_free,
02276 unsigned long long& df_free,
02277 unsigned long long& used,
02278 bool& win, bool& efi, bool use_cache ) = 0;
02279
02287 virtual bool readFstab( const string& dir, deque<VolumeInfo>& infos) = 0;
02288
02297 virtual void activateHld( bool val ) = 0;
02298
02305 virtual void activateMultipath( bool val ) = 0;
02306
02315 virtual void rescanEverything() = 0;
02316
02320 virtual void dumpObjectList() = 0;
02321
02331 virtual int getContVolInfo( const string& dev, ContVolInfo& info) = 0;
02332
02343 virtual string byteToHumanString(unsigned long long size, bool classic, int precision,
02344 bool omit_zeroes) const = 0;
02345
02357 virtual bool humanStringToByte(const string& str, bool classic, unsigned long long&
02358 size) const = 0;
02359 };
02360
02361
02365 void initDefaultLogger();
02366
02367
02371 struct Environment
02372 {
02373 Environment(bool readonly) : readonly(readonly), testmode(false), autodetect(true),
02374 instsys(false), logdir("/var/log/YaST2"), testdir("") {}
02375
02376 bool readonly;
02377 bool testmode;
02378 bool autodetect;
02379 bool instsys;
02380 string logdir;
02381 string testdir;
02382 };
02383
02384
02390 StorageInterface* createStorageInterface(const Environment& env);
02391
02392
02400 StorageInterface* createStorageInterfacePid(const Environment& env, int& locker_pid);
02401
02402
02406 void destroyStorageInterface(StorageInterface*);
02407
02408 }
02409
02410
02411 #endif