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, NFS4, 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 MdArrayState { UNKNOWN, CLEAR, INACTIVE, SUSPENDED, READONLY, READ_AUTO,
00151 CLEAN, ACTIVE, WRITE_PENDING, ACTIVE_IDLE };
00152
00153 enum UsedByType { UB_NONE, UB_LVM, UB_MD, UB_MDPART, UB_DM, UB_DMRAID, UB_DMMULTIPATH };
00154
00155 enum CType { CUNKNOWN, DISK, MD, LOOP, LVM, DM, DMRAID, NFSC, DMMULTIPATH, MDPART,
00156 COTYPE_LAST_ENTRY };
00157
00158 enum ImsmDriver { IMSM_UNDECIDED, IMSM_DMRAID, IMSM_MDADM };
00159
00160 enum PartAlign { ALIGN_OPTIMAL, ALIGN_CYLINDER };
00161
00162
00167 typedef void (*CallbackProgressBar)(const string& id, unsigned cur, unsigned max);
00168
00173 typedef void (*CallbackShowInstallInfo)(const string& id);
00174
00179 typedef void (*CallbackInfoPopup)(const string& text);
00180
00187 typedef bool (*CallbackYesNoPopup)(const string& text);
00188
00194 typedef bool (*CallbackCommitErrorPopup)(int error, const string& last_action,
00195 const string& extended_message);
00196
00202 typedef bool (*CallbackPasswordPopup)(const string& device, int attempts, string& password);
00203
00204
00208 struct FsCapabilities
00209 {
00210 FsCapabilities() {}
00211 bool isExtendable;
00212 bool isExtendableWhileMounted;
00213 bool isReduceable;
00214 bool isReduceableWhileMounted;
00215 bool supportsUuid;
00216 bool supportsLabel;
00217 bool labelWhileMounted;
00218 unsigned int labelLength;
00219 unsigned long long minimalFsSizeK;
00220 };
00221
00225 struct DlabelCapabilities
00226 {
00227 DlabelCapabilities() {}
00228 unsigned maxPrimary;
00229 bool extendedPossible;
00230 unsigned maxLogical;
00231 unsigned long long maxSectors;
00232 };
00233
00234
00235 struct UsedByInfo
00236 {
00237 UsedByInfo(UsedByType type, const string& device) : type(type), device(device) {}
00238 UsedByType type;
00239 string device;
00240 };
00241
00242
00243 struct ResizeInfo
00244 {
00245 ResizeInfo() : df_freeK(0), resize_freeK(0), usedK(0), resize_ok(false) {}
00246 unsigned long long df_freeK;
00247 unsigned long long resize_freeK;
00248 unsigned long long usedK;
00249 bool resize_ok;
00250 };
00251
00252
00253 struct ContentInfo
00254 {
00255 ContentInfo() : windows(false), efi(false), homes(0) {}
00256 bool windows;
00257 bool efi;
00258 unsigned homes;
00259 };
00260
00261
00265 struct ContainerInfo
00266 {
00267 ContainerInfo() {}
00268 CType type;
00269 string device;
00270 string name;
00271 string udevPath;
00272 string udevId;
00273 list<UsedByInfo> usedBy;
00274 UsedByType usedByType;
00275 string usedByDevice;
00276 bool readonly;
00277 };
00278
00282 struct DiskInfo
00283 {
00284 DiskInfo() {}
00285 unsigned long long sizeK;
00286 unsigned long long cylSize;
00287 unsigned long cyl;
00288 unsigned long heads;
00289 unsigned long sectors;
00290 unsigned int sectorSize;
00291 string disklabel;
00292 unsigned maxPrimary;
00293 bool extendedPossible;
00294 unsigned maxLogical;
00295 bool initDisk;
00296 bool iscsi;
00297 };
00298
00302 struct LvmVgInfo
00303 {
00304 LvmVgInfo() {}
00305 unsigned long long sizeK;
00306 unsigned long long peSizeK;
00307 unsigned long peCount;
00308 unsigned long peFree;
00309 string uuid;
00310 bool lvm2;
00311 bool create;
00312 string devices;
00313 string devices_add;
00314 string devices_rem;
00315 };
00316
00320 struct DmPartCoInfo
00321 {
00322 DmPartCoInfo() {}
00323 DiskInfo d;
00324 string devices;
00325 unsigned long minor;
00326 };
00327
00328 struct DmraidCoInfo
00329 {
00330 DmraidCoInfo() {}
00331 DmPartCoInfo p;
00332 };
00333
00334 struct DmmultipathCoInfo
00335 {
00336 DmmultipathCoInfo() {}
00337 DmPartCoInfo p;
00338 string vendor;
00339 string model;
00340 };
00341
00345 struct VolumeInfo
00346 {
00347 VolumeInfo() {}
00348 unsigned long long sizeK;
00349 unsigned long major;
00350 unsigned long minor;
00351 string name;
00352 string device;
00353 string mount;
00354 string crypt_device;
00355 MountByType mount_by;
00356 string udevPath;
00357 string udevId;
00358 list<UsedByInfo> usedBy;
00359 UsedByType usedByType;
00360 string usedByDevice;
00361 bool ignore_fstab;
00362 string fstab_options;
00363 string uuid;
00364 string label;
00365 string mkfs_options;
00366 string tunefs_options;
00367 string loop;
00368 string dtxt;
00369 EncryptType encryption;
00370 string crypt_pwd;
00371 FsType fs;
00372 FsType detected_fs;
00373 bool format;
00374 bool create;
00375 bool is_mounted;
00376 bool resize;
00377 bool ignore_fs;
00378 unsigned long long origSizeK;
00379 };
00380
00381 struct PartitionAddInfo
00382 {
00383 PartitionAddInfo() {}
00384 unsigned nr;
00385 unsigned long cylStart;
00386 unsigned long cylSize;
00387 PartitionType partitionType;
00388 unsigned id;
00389 bool boot;
00390 };
00391
00395 struct PartitionInfo
00396 {
00397 PartitionInfo() {}
00398 PartitionInfo& operator=( const PartitionAddInfo& rhs );
00399 VolumeInfo v;
00400 unsigned nr;
00401 unsigned long cylStart;
00402 unsigned long cylSize;
00403 PartitionType partitionType;
00404 unsigned id;
00405 bool boot;
00406 };
00407
00411 struct LvmLvInfo
00412 {
00413 LvmLvInfo() {}
00414 VolumeInfo v;
00415 unsigned stripes;
00416 unsigned stripeSizeK;
00417 string uuid;
00418 string status;
00419 string allocation;
00420 string dm_table;
00421 string dm_target;
00422 string origin;
00423 unsigned long long sizeK;
00424 };
00425
00429 struct LvmLvSnapshotStateInfo
00430 {
00431 LvmLvSnapshotStateInfo() {}
00432 bool active;
00433 double allocated;
00434 };
00435
00439 struct MdInfo
00440 {
00441 MdInfo() {}
00442 VolumeInfo v;
00443 unsigned nr;
00444 unsigned type;
00445 unsigned parity;
00446 string uuid;
00447 string sb_ver;
00448 unsigned long chunkSizeK;
00449 string devices;
00450 string spares;
00451 };
00452
00456 struct MdStateInfo
00457 {
00458 MdStateInfo() {}
00459 MdArrayState state;
00460 };
00461
00466 struct MdPartCoInfo
00467 {
00468 MdPartCoInfo() {}
00469 DiskInfo d;
00470 unsigned type;
00471 unsigned nr;
00472 unsigned parity;
00473 string uuid;
00474 string sb_ver;
00475 unsigned long chunkSizeK;
00476 string devices;
00477 string spares;
00478 };
00479
00480 struct MdPartCoStateInfo
00481 {
00482 MdPartCoStateInfo() {}
00483 MdArrayState state;
00484 };
00485
00489 struct MdPartInfo
00490 {
00491 MdPartInfo() {}
00492 VolumeInfo v;
00493 PartitionAddInfo p;
00494 bool part;
00495 };
00496
00500 struct NfsInfo
00501 {
00502 NfsInfo() {}
00503 VolumeInfo v;
00504 };
00505
00509 struct LoopInfo
00510 {
00511 LoopInfo() {}
00512 VolumeInfo v;
00513 bool reuseFile;
00514 unsigned nr;
00515 string file;
00516 };
00517
00521 struct DmInfo
00522 {
00523 DmInfo() {}
00524 VolumeInfo v;
00525 unsigned nr;
00526 string table;
00527 string target;
00528 };
00529
00533 struct DmPartInfo
00534 {
00535 DmPartInfo() {}
00536 VolumeInfo v;
00537 PartitionAddInfo p;
00538 bool part;
00539 string table;
00540 string target;
00541 };
00542
00546 struct DmraidInfo
00547 {
00548 DmraidInfo() {}
00549 DmPartInfo p;
00550 };
00551
00555 struct DmmultipathInfo
00556 {
00557 DmmultipathInfo() {}
00558 DmPartInfo p;
00559 };
00560
00564 struct ContVolInfo
00565 {
00566 ContVolInfo() : ctype(CUNKNOWN) {}
00567 CType ctype;
00568 string cname;
00569 string cdevice;
00570 string vname;
00571 string vdevice;
00572 };
00573
00577 struct PartitionSlotInfo
00578 {
00579 PartitionSlotInfo() {}
00580 unsigned long cylStart;
00581 unsigned long cylSize;
00582 bool primarySlot;
00583 bool primaryPossible;
00584 bool extendedSlot;
00585 bool extendedPossible;
00586 bool logicalSlot;
00587 bool logicalPossible;
00588 };
00589
00593 struct CommitInfo
00594 {
00595 CommitInfo() {}
00596 bool destructive;
00597 string text;
00598 };
00599
00600
00604 enum ErrorCodes
00605 {
00606 DISK_PARTITION_OVERLAPS_EXISTING = -1000,
00607 DISK_PARTITION_EXCEEDS_DISK = -1001,
00608 DISK_CREATE_PARTITION_EXT_ONLY_ONCE = -1002,
00609 DISK_CREATE_PARTITION_EXT_IMPOSSIBLE = -1003,
00610 DISK_PARTITION_NO_FREE_NUMBER = -1004,
00611 DISK_CREATE_PARTITION_INVALID_VOLUME = -1005,
00612 DISK_CREATE_PARTITION_INVALID_TYPE = -1006,
00613 DISK_CREATE_PARTITION_PARTED_FAILED = -1007,
00614 DISK_PARTITION_NOT_FOUND = -1008,
00615 DISK_CREATE_PARTITION_LOGICAL_NO_EXT = -1009,
00616 DISK_PARTITION_LOGICAL_OUTSIDE_EXT = -1010,
00617 DISK_SET_TYPE_INVALID_VOLUME = -1011,
00618 DISK_SET_TYPE_PARTED_FAILED = -1012,
00619 DISK_SET_LABEL_PARTED_FAILED = -1013,
00620 DISK_REMOVE_PARTITION_PARTED_FAILED = -1014,
00621 DISK_REMOVE_PARTITION_INVALID_VOLUME = -1015,
00622 DISK_REMOVE_PARTITION_LIST_ERASE = -1016,
00623 DISK_DESTROY_TABLE_INVALID_LABEL = -1017,
00624 DISK_PARTITION_ZERO_SIZE = -1018,
00625 DISK_CHANGE_READONLY = -1019,
00626 DISK_RESIZE_PARTITION_INVALID_VOLUME = -1020,
00627 DISK_RESIZE_PARTITION_PARTED_FAILED = -1021,
00628 DISK_RESIZE_NO_SPACE = -1022,
00629 DISK_CHECK_RESIZE_INVALID_VOLUME = -1023,
00630 DISK_REMOVE_PARTITION_CREATE_NOT_FOUND = -1024,
00631 DISK_COMMIT_NOTHING_TODO = -1025,
00632 DISK_CREATE_PARTITION_NO_SPACE = -1026,
00633 DISK_REMOVE_USED_BY = -1027,
00634 DISK_INIT_NOT_POSSIBLE = -1028,
00635 DISK_INVALID_PARTITION_ID = -1029,
00636
00637 STORAGE_DISK_NOT_FOUND = -2000,
00638 STORAGE_VOLUME_NOT_FOUND = -2001,
00639 STORAGE_REMOVE_PARTITION_INVALID_CONTAINER = -2002,
00640 STORAGE_CHANGE_PARTITION_ID_INVALID_CONTAINER = -2003,
00641 STORAGE_CHANGE_READONLY = -2004,
00642 STORAGE_DISK_USED_BY = -2005,
00643 STORAGE_LVM_VG_EXISTS = -2006,
00644 STORAGE_LVM_VG_NOT_FOUND = -2007,
00645 STORAGE_LVM_INVALID_DEVICE = -2008,
00646 STORAGE_CONTAINER_NOT_FOUND = -2009,
00647 STORAGE_VG_INVALID_NAME = -2010,
00648 STORAGE_REMOVE_USED_VOLUME = -2011,
00649 STORAGE_REMOVE_USING_UNKNOWN_TYPE = -2012,
00650 STORAGE_NOT_YET_IMPLEMENTED = -2013,
00651 STORAGE_MD_INVALID_NAME = -2014,
00652 STORAGE_MD_NOT_FOUND = -2015,
00653 STORAGE_MEMORY_EXHAUSTED = -2016,
00654 STORAGE_LOOP_NOT_FOUND = -2017,
00655 STORAGE_CREATED_LOOP_NOT_FOUND = -2018,
00656 STORAGE_CHANGE_AREA_INVALID_CONTAINER = -2023,
00657 STORAGE_BACKUP_STATE_NOT_FOUND = -2024,
00658 STORAGE_INVALID_FSTAB_VALUE = -2025,
00659 STORAGE_NO_FSTAB_PTR = -2026,
00660 STORAGE_DEVICE_NODE_NOT_FOUND = -2027,
00661 STORAGE_DMRAID_CO_NOT_FOUND = -2028,
00662 STORAGE_RESIZE_INVALID_CONTAINER = -2029,
00663 STORAGE_DMMULTIPATH_CO_NOT_FOUND = -2030,
00664 STORAGE_ZERO_DEVICE_FAILED = -2031,
00665 STORAGE_INVALID_BACKUP_STATE_NAME = -2032,
00666 STORAGE_MDPART_CO_NOT_FOUND = -2033,
00667 STORAGE_DEVICE_NOT_FOUND = -2034,
00668
00669 VOLUME_COMMIT_UNKNOWN_STAGE = -3000,
00670 VOLUME_FSTAB_EMPTY_MOUNT = -3001,
00671 VOLUME_UMOUNT_FAILED = -3002,
00672 VOLUME_MOUNT_FAILED = -3003,
00673 VOLUME_FORMAT_UNKNOWN_FS = -3005,
00674 VOLUME_FORMAT_FS_UNDETECTED = -3006,
00675 VOLUME_FORMAT_FS_TOO_SMALL = -3007,
00676 VOLUME_FORMAT_FAILED = -3008,
00677 VOLUME_TUNE2FS_FAILED = -3009,
00678 VOLUME_MKLABEL_FS_UNABLE = -3010,
00679 VOLUME_MKLABEL_FAILED = -3011,
00680 VOLUME_LOSETUP_NO_LOOP = -3012,
00681 VOLUME_LOSETUP_FAILED = -3013,
00682 VOLUME_CRYPT_NO_PWD = -3014,
00683 VOLUME_CRYPT_PWD_TOO_SHORT = -3015,
00684 VOLUME_CRYPT_NOT_DETECTED = -3016,
00685 VOLUME_FORMAT_EXTENDED_UNSUPPORTED = -3017,
00686 VOLUME_MOUNT_EXTENDED_UNSUPPORTED = -3018,
00687 VOLUME_MOUNT_POINT_INVALID = -3019,
00688 VOLUME_MOUNTBY_NOT_ENCRYPTED = -3020,
00689 VOLUME_MOUNTBY_UNSUPPORTED_BY_FS = -3021,
00690 VOLUME_LABEL_NOT_SUPPORTED = -3022,
00691 VOLUME_LABEL_TOO_LONG = -3023,
00692 VOLUME_LABEL_WHILE_MOUNTED = -3024,
00693 VOLUME_RESIZE_UNSUPPORTED_BY_FS = -3025,
00694 VOLUME_RESIZE_UNSUPPORTED_BY_CONTAINER = -3026,
00695 VOLUME_RESIZE_FAILED = -3027,
00696 VOLUME_ALREADY_IN_USE = -3028,
00697 VOLUME_LOUNSETUP_FAILED = -3029,
00698 VOLUME_DEVICE_NOT_PRESENT = -3030,
00699 VOLUME_DEVICE_NOT_BLOCK = -3031,
00700 VOLUME_MOUNTBY_UNSUPPORTED_BY_VOLUME = -3032,
00701 VOLUME_CRYPTFORMAT_FAILED = -3033,
00702 VOLUME_CRYPTSETUP_FAILED = -3034,
00703 VOLUME_CRYPTUNSETUP_FAILED = -3035,
00704 VOLUME_FORMAT_NOT_IMPLEMENTED = -3036,
00705 VOLUME_FORMAT_NFS_IMPOSSIBLE = -3037,
00706 VOLUME_CRYPT_NFS_IMPOSSIBLE = -3038,
00707 VOLUME_REMOUNT_FAILED = -3039,
00708 VOLUME_TUNEREISERFS_FAILED = -3040,
00709 VOLUME_UMOUNT_NOT_MOUNTED = -3041,
00710
00711 LVM_CREATE_PV_FAILED = -4000,
00712 LVM_PV_ALREADY_CONTAINED = -4001,
00713 LVM_PV_DEVICE_UNKNOWN = -4002,
00714 LVM_PV_DEVICE_USED = -4003,
00715 LVM_VG_HAS_NONE_PV = -4004,
00716 LVM_LV_INVALID_NAME = -4005,
00717 LVM_LV_DUPLICATE_NAME = -4006,
00718 LVM_LV_NO_SPACE = -4007,
00719 LVM_LV_UNKNOWN_NAME = -4008,
00720 LVM_LV_NOT_IN_LIST = -4009,
00721 LVM_VG_CREATE_FAILED = -4010,
00722 LVM_VG_EXTEND_FAILED = -4011,
00723 LVM_VG_REDUCE_FAILED = -4012,
00724 LVM_VG_REMOVE_FAILED = -4013,
00725 LVM_LV_CREATE_FAILED = -4014,
00726 LVM_LV_REMOVE_FAILED = -4015,
00727 LVM_LV_RESIZE_FAILED = -4016,
00728 LVM_PV_STILL_ADDED = -4017,
00729 LVM_PV_REMOVE_NOT_FOUND = -4018,
00730 LVM_CREATE_LV_INVALID_VOLUME = -4019,
00731 LVM_REMOVE_LV_INVALID_VOLUME = -4020,
00732 LVM_RESIZE_LV_INVALID_VOLUME = -4021,
00733 LVM_CHANGE_READONLY = -4022,
00734 LVM_CHECK_RESIZE_INVALID_VOLUME = -4023,
00735 LVM_COMMIT_NOTHING_TODO = -4024,
00736 LVM_LV_REMOVE_USED_BY = -4025,
00737 LVM_LV_ALREADY_ON_DISK = -4026,
00738 LVM_LV_NO_STRIPE_SIZE = -4027,
00739 LVM_LV_UNKNOWN_ORIGIN = -4028,
00740 LVM_LV_NOT_ON_DISK = -4029,
00741 LVM_LV_NOT_SNAPSHOT = -4030,
00742 LVM_LV_HAS_SNAPSHOTS = -4031,
00743 LVM_LV_IS_SNAPSHOT = -4032,
00744
00745 FSTAB_ENTRY_NOT_FOUND = -5000,
00746 FSTAB_CHANGE_PREFIX_IMPOSSIBLE = -5001,
00747 FSTAB_REMOVE_ENTRY_NOT_FOUND = -5002,
00748 FSTAB_UPDATE_ENTRY_NOT_FOUND = -5003,
00749 FSTAB_ADD_ENTRY_FOUND = -5004,
00750
00751 MD_CHANGE_READONLY = -6000,
00752 MD_DUPLICATE_NUMBER = -6001,
00753 MD_TOO_FEW_DEVICES = -6002,
00754 MD_DEVICE_UNKNOWN = -6003,
00755 MD_DEVICE_USED = -6004,
00756 MD_CREATE_INVALID_VOLUME = -6005,
00757 MD_REMOVE_FAILED = -6006,
00758 MD_NOT_IN_LIST = -6007,
00759 MD_CREATE_FAILED = -6008,
00760 MD_UNKNOWN_NUMBER = -6009,
00761 MD_REMOVE_USED_BY = -6010,
00762 MD_NUMBER_TOO_LARGE = -6011,
00763 MD_REMOVE_INVALID_VOLUME = -6012,
00764 MD_REMOVE_CREATE_NOT_FOUND = -6013,
00765 MD_NO_RESIZE_ON_DISK = -6014,
00766 MD_ADD_DUPLICATE = -6015,
00767 MD_REMOVE_NONEXISTENT = -6016,
00768 MD_NO_CHANGE_ON_DISK = -6017,
00769 MD_NO_CREATE_UNKNOWN = -6018,
00770 MD_STATE_NOT_ON_DISK = -6019,
00771 MD_PARTITION_NOT_FOUND = -6020,
00772
00773 MDPART_CHANGE_READONLY = -6100,
00774 MDPART_INTERNAL_ERR = -6101,
00775 MDPART_INVALID_VOLUME = -6012,
00776 MDPART_PARTITION_NOT_FOUND = -6103,
00777 MDPART_REMOVE_PARTITION_LIST_ERASE = -6104,
00778 MDPART_COMMIT_NOTHING_TODO = -6105,
00779 MDPART_NO_REMOVE = -6106,
00780 MDPART_DEVICE_NOT_FOUND = -6107,
00781
00782 LOOP_CHANGE_READONLY = -7000,
00783 LOOP_DUPLICATE_FILE = -7001,
00784 LOOP_UNKNOWN_FILE = -7002,
00785 LOOP_REMOVE_USED_BY = -7003,
00786 LOOP_FILE_CREATE_FAILED = -7004,
00787 LOOP_CREATE_INVALID_VOLUME = -7005,
00788 LOOP_REMOVE_FILE_FAILED = -7006,
00789 LOOP_REMOVE_INVALID_VOLUME = -7007,
00790 LOOP_NOT_IN_LIST = -7008,
00791 LOOP_REMOVE_CREATE_NOT_FOUND = -7009,
00792 LOOP_MODIFY_EXISTING = -7010,
00793
00794 PEC_PE_SIZE_INVALID = -9000,
00795 PEC_PV_NOT_FOUND = -9001,
00796 PEC_REMOVE_PV_IN_USE = -9002,
00797 PEC_REMOVE_PV_SIZE_NEEDED = -9003,
00798 PEC_LV_NO_SPACE_STRIPED = -9004,
00799 PEC_LV_NO_SPACE_SINGLE = -9005,
00800 PEC_LV_PE_DEV_NOT_FOUND = -9006,
00801
00802 DM_CHANGE_READONLY = -10000,
00803 DM_UNKNOWN_TABLE = -10001,
00804 DM_REMOVE_USED_BY = -10002,
00805 DM_REMOVE_CREATE_NOT_FOUND = -10003,
00806 DM_REMOVE_INVALID_VOLUME = -10004,
00807 DM_REMOVE_FAILED = -10005,
00808 DM_NOT_IN_LIST = -10006,
00809
00810 DASD_NOT_POSSIBLE = -11000,
00811 DASD_FDASD_FAILED = -11001,
00812 DASD_DASDFMT_FAILED = -11002,
00813
00814 DMPART_CHANGE_READONLY = -12001,
00815 DMPART_INTERNAL_ERR = -12002,
00816 DMPART_INVALID_VOLUME = -12003,
00817 DMPART_PARTITION_NOT_FOUND = -12004,
00818 DMPART_REMOVE_PARTITION_LIST_ERASE = -12005,
00819 DMPART_COMMIT_NOTHING_TODO = -12006,
00820 DMPART_NO_REMOVE = -12007,
00821
00822 DMRAID_REMOVE_FAILED = -13001,
00823
00824 NFS_VOLUME_NOT_FOUND = -14001,
00825 NFS_CHANGE_READONLY = -14002,
00826 NFS_REMOVE_VOLUME_CREATE_NOT_FOUND = -14003,
00827 NFS_REMOVE_VOLUME_LIST_ERASE = -14004,
00828 NFS_REMOVE_INVALID_VOLUME = -14005,
00829
00830 CONTAINER_INTERNAL_ERROR = -99000,
00831 CONTAINER_INVALID_VIRTUAL_CALL = -99001,
00832
00833 };
00834
00835
00839 class StorageInterface
00840 {
00841 public:
00842
00843 StorageInterface () {}
00844 virtual ~StorageInterface () {}
00845
00849 virtual void getContainers( deque<ContainerInfo>& infos) = 0;
00850
00858 virtual int getDiskInfo( const string& disk, DiskInfo& info) = 0;
00859
00868 virtual int getContDiskInfo( const string& disk, ContainerInfo& cinfo,
00869 DiskInfo& info ) = 0;
00870
00878 virtual int getLvmVgInfo( const string& name, LvmVgInfo& info) = 0;
00879
00888 virtual int getContLvmVgInfo( const string& name, ContainerInfo& cinfo,
00889 LvmVgInfo& info) = 0;
00890
00898 virtual int getDmraidCoInfo( const string& name, DmraidCoInfo& info) = 0;
00899
00908 virtual int getContDmraidCoInfo( const string& name, ContainerInfo& cinfo,
00909 DmraidCoInfo& info) = 0;
00910
00918 virtual int getDmmultipathCoInfo( const string& name, DmmultipathCoInfo& info) = 0;
00919
00928 virtual int getContDmmultipathCoInfo( const string& name, ContainerInfo& cinfo,
00929 DmmultipathCoInfo& info) = 0;
00930
00938 virtual int getMdPartCoInfo( const string& name, MdPartCoInfo& info) = 0;
00939
00940
00949 virtual int getContMdPartCoInfo( const string& name, ContainerInfo& cinfo,
00950 MdPartCoInfo& info) = 0;
00951
00957 virtual void setImsmDriver(ImsmDriver driver) = 0;
00958
00964 virtual ImsmDriver getImsmDriver() const = 0;
00965
00971 virtual void getVolumes( deque<VolumeInfo>& infos) = 0;
00972
00980 virtual int getVolume( const string& device, VolumeInfo& info) = 0;
00981
00989 virtual int getPartitionInfo( const string& disk,
00990 deque<PartitionInfo>& plist ) = 0;
00991
00999 virtual int getLvmLvInfo( const string& name,
01000 deque<LvmLvInfo>& plist ) = 0;
01001
01008 virtual int getMdInfo( deque<MdInfo>& plist ) = 0;
01009
01017 virtual int getMdPartInfo( const string& device,
01018 deque<MdPartInfo>& plist ) = 0;
01019
01026 virtual int getNfsInfo( deque<NfsInfo>& plist ) = 0;
01027
01034 virtual int getLoopInfo( deque<LoopInfo>& plist ) = 0;
01035
01042 virtual int getDmInfo( deque<DmInfo>& plist ) = 0;
01043
01051 virtual int getDmraidInfo( const string& name,
01052 deque<DmraidInfo>& plist ) = 0;
01053
01061 virtual int getDmmultipathInfo( const string& name,
01062 deque<DmmultipathInfo>& plist ) = 0;
01063
01067 virtual bool getFsCapabilities (FsType fstype, FsCapabilities& fscapabilities) const = 0;
01068
01072 virtual bool getDlabelCapabilities(const string& dlabel,
01073 DlabelCapabilities& dlabelcapabilities) const = 0;
01074
01078 virtual list<string> getAllUsedFs() const = 0;
01079
01092 virtual int createPartition( const string& disk, PartitionType type,
01093 unsigned long startCyl,
01094 unsigned long sizeCyl,
01095 string& device ) = 0;
01096
01105 virtual int resizePartition( const string& device,
01106 unsigned long sizeCyl ) = 0;
01107
01116 virtual int resizePartitionNoFs( const string& device,
01117 unsigned long sizeCyl ) = 0;
01118
01129 virtual int updatePartitionArea( const string& device,
01130 unsigned long startCyl,
01131 unsigned long sizeCyl ) = 0;
01132
01141 virtual int freeCylindersAroundPartition(const string& device, unsigned long& freeCylsBefore,
01142 unsigned long& freeCylsAfter) = 0;
01143
01153 virtual int nextFreePartition( const string& disk, PartitionType type,
01154 unsigned &nr, string& device ) = 0;
01155
01168 virtual int createPartitionKb( const string& disk, PartitionType type,
01169 unsigned long long startK,
01170 unsigned long long sizeK,
01171 string& device ) = 0;
01172
01183 virtual int createPartitionAny( const string& disk,
01184 unsigned long long sizeK,
01185 string& device ) = 0;
01186
01197 virtual int createPartitionMax( const string& disk, PartitionType type,
01198 string& device ) = 0;
01199
01207 virtual unsigned long long cylinderToKb( const string& disk,
01208 unsigned long sizeCyl) = 0;
01209
01217 virtual unsigned long kbToCylinder( const string& disk,
01218 unsigned long long sizeK) = 0;
01219
01226 virtual int removePartition (const string& partition) = 0;
01227
01235 virtual int changePartitionId (const string& partition, unsigned id) = 0;
01236
01243 virtual int forgetChangePartitionId (const string& partition ) = 0;
01244
01252 virtual string getPartitionPrefix(const string& disk) = 0;
01253
01262 virtual string getPartitionName(const string& disk, int partition_no) = 0;
01263
01271 virtual int getUnusedPartitionSlots(const string& disk, list<PartitionSlotInfo>& slots) = 0;
01272
01281 virtual int destroyPartitionTable (const string& disk, const string& label) = 0;
01282
01293 virtual int initializeDisk( const string& disk, bool value ) = 0;
01294
01303 virtual string defaultDiskLabel(const string& device) = 0;
01304
01313 virtual int changeFormatVolume( const string& device, bool format, FsType fs ) = 0;
01314
01322 virtual int changeLabelVolume( const string& device, const string& label ) = 0;
01323
01331 virtual int changeMkfsOptVolume( const string& device, const string& opts ) = 0;
01332
01340 virtual int changeTunefsOptVolume( const string& device, const string& opts ) = 0;
01341
01350 virtual int changeMountPoint( const string& device, const string& mount ) = 0;
01351
01359 virtual int getMountPoint( const string& device, string& mount ) = 0;
01360
01368 virtual int changeMountBy( const string& device, MountByType mby ) = 0;
01369
01377 #ifndef SWIG
01378 virtual int getMountBy( const string& device, MountByType& mby ) = 0;
01379 #else
01380 virtual int getMountBy( const string& device, MountByType& REFERENCE ) = 0;
01381 #endif
01382
01392 virtual int changeFstabOptions( const string& device, const string& options ) = 0;
01393
01402 virtual int getFstabOptions( const string& device, string& options ) = 0;
01403
01412 virtual int addFstabOptions( const string& device, const string& options ) = 0;
01413
01423 virtual int removeFstabOptions( const string& device, const string& options ) = 0;
01424
01432 virtual int setCryptPassword( const string& device, const string& pwd ) = 0;
01433
01440 virtual int forgetCryptPassword( const string& device ) = 0;
01441
01449 virtual int getCryptPassword( const string& device, string& pwd ) = 0;
01450
01459 virtual int verifyCryptPassword( const string& device,
01460 const string& pwd, bool erase ) = 0;
01461
01468 virtual bool needCryptPassword( const string& device ) = 0;
01469
01477 virtual int setCrypt( const string& device, bool val ) = 0;
01478
01487 virtual int setCryptType( const string& device, bool val, EncryptType typ ) = 0;
01488
01496 #ifndef SWIG
01497 virtual int getCrypt( const string& device, bool& val ) = 0;
01498 #else
01499 virtual int getCrypt( const string& device, bool& REFERENCE ) = 0;
01500 #endif
01501
01511 virtual int setIgnoreFstab( const string& device, bool val ) = 0;
01512
01520 #ifndef SWIG
01521 virtual int getIgnoreFstab( const string& device, bool& val ) = 0;
01522 #else
01523 virtual int getIgnoreFstab( const string& device, bool& REFERENCE ) = 0;
01524 #endif
01525
01535 virtual int changeDescText( const string& device, const string& txt ) = 0;
01536
01551 virtual int addFstabEntry( const string& device, const string& mount,
01552 const string& vfs, const string& options,
01553 unsigned freq, unsigned passno ) = 0;
01554
01555
01563 virtual int resizeVolume(const string& device, unsigned long long newSizeK) = 0;
01564
01572 virtual int resizeVolumeNoFs(const string& device, unsigned long long newSizeK) = 0;
01573
01580 virtual int forgetResizeVolume( const string& device ) = 0;
01581
01596 virtual void setRecursiveRemoval( bool val ) = 0;
01597
01603 virtual bool getRecursiveRemoval() const = 0;
01604
01613 virtual int getRecursiveUsing(const string& device, list<string>& devices) = 0;
01614
01628 virtual void setZeroNewPartitions( bool val ) = 0;
01629
01635 virtual bool getZeroNewPartitions() const = 0;
01636
01648 virtual void setPartitionAlignment( PartAlign val ) = 0;
01649
01655 virtual PartAlign getPartitionAlignment() const = 0;
01656
01662 virtual void setDefaultMountBy( MountByType val ) = 0;
01663
01669 virtual MountByType getDefaultMountBy() const = 0;
01670
01676 virtual void setDefaultFs(FsType val) = 0;
01677
01683 virtual FsType getDefaultFs() const = 0;
01684
01692 virtual void setEfiBoot(bool val) = 0;
01693
01699 virtual bool getEfiBoot() = 0;
01700
01711 virtual void setRootPrefix( const string& root ) = 0;
01712
01718 virtual string getRootPrefix() const = 0;
01719
01725 virtual void setDetectMountedVolumes( bool val ) = 0;
01726
01732 virtual bool getDetectMountedVolumes() const = 0;
01733
01741 virtual int removeVolume( const string& device ) = 0;
01742
01753 virtual int createLvmVg( const string& name,
01754 unsigned long long peSizeK, bool lvm1,
01755 const deque<string>& devs ) = 0;
01756
01764 virtual int removeLvmVg( const string& name ) = 0;
01765
01773 virtual int extendLvmVg( const string& name,
01774 const deque<string>& devs ) = 0;
01775
01783 virtual int shrinkLvmVg( const string& name,
01784 const deque<string>& devs ) = 0;
01785
01797 virtual int createLvmLv( const string& vg, const string& name,
01798 unsigned long long sizeK, unsigned stripes,
01799 string& device ) = 0;
01800
01807 virtual int removeLvmLvByDevice( const string& device ) = 0;
01808
01816 virtual int removeLvmLv( const string& vg, const string& name ) = 0;
01817
01827 virtual int changeLvStripeCount( const string& vg, const string& name,
01828 unsigned long stripes ) = 0;
01829
01839 virtual int changeLvStripeSize( const string& vg, const string& name,
01840 unsigned long long stripeSizeK) = 0;
01841
01852 virtual int createLvmLvSnapshot(const string& vg, const string& origin,
01853 const string& name, unsigned long long cowSizeK,
01854 string& device) = 0;
01855
01863 virtual int removeLvmLvSnapshot(const string& vg, const string& name) = 0;
01864
01875 virtual int getLvmLvSnapshotStateInfo(const string& vg, const string& name,
01876 LvmLvSnapshotStateInfo& info) = 0;
01877
01885 virtual int nextFreeMd(unsigned& nr, string &device) = 0;
01886
01895 virtual int createMd( const string& name, MdType rtype,
01896 const deque<string>& devs ) = 0;
01897
01906 virtual int createMdAny( MdType rtype, const deque<string>& devs,
01907 string& device ) = 0;
01908
01917 virtual int removeMd( const string& name, bool destroySb ) = 0;
01918
01927 virtual int extendMd( const string& name, const string& dev ) = 0;
01928
01937 virtual int shrinkMd( const string& name, const string& dev ) = 0;
01938
01947 virtual int changeMdType( const string& name, MdType rtype ) = 0;
01948
01957 virtual int changeMdChunk(const string& name, unsigned long chunkSizeK) = 0;
01958
01967 virtual int changeMdParity( const string& name, MdParity ptype ) = 0;
01968
01975 virtual int checkMd( const string& name ) = 0;
01976
01986 virtual int getMdStateInfo(const string& name, MdStateInfo& info) = 0;
01987
01997 virtual int getMdPartCoStateInfo(const string& name,
01998 MdPartCoStateInfo& info) = 0;
01999
02011 virtual int computeMdSize(MdType md_type, const list<string>& devices,
02012 unsigned long long& sizeK) = 0;
02013
02024 virtual int removeMdPartCo(const string& name, bool destroySb ) = 0;
02025
02036 virtual int addNfsDevice(const string& nfsDev, const string& opts,
02037 unsigned long long sizeK, const string& mp,
02038 bool nfs4) = 0;
02039
02049 virtual int checkNfsDevice(const string& nfsDev, const string& opts,
02050 bool nfs4, unsigned long long& sizeK) = 0;
02051
02068 virtual int createFileLoop( const string& lname, bool reuseExisting,
02069 unsigned long long sizeK,
02070 const string& mp, const string& pwd,
02071 string& device ) = 0;
02072
02090 virtual int modifyFileLoop( const string& device, const string& lname,
02091 bool reuseExisting,
02092 unsigned long long sizeK ) = 0;
02093
02102 virtual int removeFileLoop( const string& lname, bool removeFile ) = 0;
02103
02110 virtual int removeDmraid( const string& name ) = 0;
02111
02117 virtual void getCommitInfos(list<CommitInfo>& infos) const = 0;
02118
02124 virtual const string& getLastAction() const = 0;
02125
02132 virtual const string& getExtendedErrorMessage() const = 0;
02133
02134
02135 #ifndef SWIG
02136
02142 virtual void setCallbackProgressBar(CallbackProgressBar pfnc) = 0;
02143
02149 virtual CallbackProgressBar getCallbackProgressBar() const = 0;
02150
02151
02157 virtual void setCallbackShowInstallInfo(CallbackShowInstallInfo pfnc) = 0;
02158
02164 virtual CallbackShowInstallInfo getCallbackShowInstallInfo() const = 0;
02165
02166
02173 virtual void setCallbackInfoPopup(CallbackInfoPopup pfnc) = 0;
02174
02181 virtual CallbackInfoPopup getCallbackInfoPopup() const = 0;
02182
02183
02190 virtual void setCallbackYesNoPopup(CallbackYesNoPopup pfnc) = 0;
02191
02198 virtual CallbackYesNoPopup getCallbackYesNoPopup() const = 0;
02199
02200
02206 virtual void setCallbackCommitErrorPopup(CallbackCommitErrorPopup pfnc) = 0;
02207
02213 virtual CallbackCommitErrorPopup getCallbackCommitErrorPopup() const = 0;
02214
02215
02221 virtual void setCallbackPasswordPopup(CallbackPasswordPopup pfnc) = 0;
02222
02229 virtual CallbackPasswordPopup getCallbackPasswordPopup() const = 0;
02230
02231 #endif
02232
02238 virtual void setCacheChanges (bool cache) = 0;
02239
02243 virtual bool isCacheChanges () const = 0;
02244
02249 virtual int commit() = 0;
02250
02254 virtual string getErrorString(int error) const = 0;
02255
02262 virtual int createBackupState( const string& name ) = 0;
02263
02270 virtual int restoreBackupState( const string& name ) = 0;
02271
02278 virtual bool checkBackupState(const string& name) const = 0;
02279
02288 virtual bool equalBackupStates(const string& lhs, const string& rhs,
02289 bool verbose_log) const = 0;
02290
02298 virtual int removeBackupState( const string& name ) = 0;
02299
02307 virtual bool checkDeviceMounted(const string& device, list<string>& mps) = 0;
02308
02318 virtual bool umountDevice( const string& device ) = 0;
02319
02330 virtual bool mountDevice( const string& device, const string& mp ) = 0;
02331
02342 virtual int activateEncryption( const string& device, bool on ) = 0;
02343
02355 virtual bool mountDeviceOpts( const string& device, const string& mp,
02356 const string& opts ) = 0;
02357
02369 virtual bool mountDeviceRo( const string& device, const string& mp,
02370 const string& opts ) = 0;
02371
02378 virtual bool checkDmMapsTo( const string& device ) = 0;
02379
02385 virtual void removeDmTableTo( const string& device ) = 0;
02386
02398 virtual bool getFreeInfo(const string& device, bool get_resize, ResizeInfo& resize_info,
02399 bool get_content, ContentInfo& content_info, bool use_cache) = 0;
02400
02408 virtual bool readFstab( const string& dir, deque<VolumeInfo>& infos) = 0;
02409
02419 virtual void activateHld( bool val ) = 0;
02420
02429 virtual void activateMultipath( bool val ) = 0;
02430
02439 virtual void rescanEverything() = 0;
02440
02449 virtual bool rescanCryptedObjects() = 0;
02450
02454 virtual void dumpObjectList() = 0;
02455
02459 virtual void dumpCommitInfos() const = 0;
02460
02470 virtual int getContVolInfo(const string& dev, ContVolInfo& info) = 0;
02471
02472 };
02473
02474
02478 void initDefaultLogger();
02479
02480
02484 struct Environment
02485 {
02486 Environment(bool readonly) : readonly(readonly), testmode(false), autodetect(true),
02487 instsys(false), logdir("/var/log/YaST2"), testdir("tmp") {}
02488
02489 bool readonly;
02490 bool testmode;
02491 bool autodetect;
02492 bool instsys;
02493 string logdir;
02494 string testdir;
02495 };
02496
02497
02503 StorageInterface* createStorageInterface(const Environment& env);
02504
02505
02513 StorageInterface* createStorageInterfacePid(const Environment& env, int& locker_pid);
02514
02515
02519 void destroyStorageInterface(StorageInterface*);
02520
02521 }
02522
02523
02524 #endif