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, TMPFS, 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_DEFAULT, LEFT_ASYMMETRIC, LEFT_SYMMETRIC,
00148 RIGHT_ASYMMETRIC, RIGHT_SYMMETRIC, PAR_FIRST, PAR_LAST,
00149 LEFT_ASYMMETRIC_6, LEFT_SYMMETRIC_6, RIGHT_ASYMMETRIC_6,
00150 RIGHT_SYMMETRIC_6, PAR_FIRST_6,
00151 PAR_NEAR_2, PAR_OFFSET_2, PAR_FAR_2,
00152 PAR_NEAR_3, PAR_OFFSET_3, PAR_FAR_3 };
00153
00154 enum MdArrayState { UNKNOWN, CLEAR, INACTIVE, SUSPENDED, READONLY, READ_AUTO,
00155 CLEAN, ACTIVE, WRITE_PENDING, ACTIVE_IDLE };
00156
00157 enum UsedByType { UB_NONE, UB_LVM, UB_MD, UB_MDPART, UB_DM, UB_DMRAID, UB_DMMULTIPATH, UB_BTRFS };
00158
00159 enum CType { CUNKNOWN, DISK, MD, LOOP, LVM, DM, DMRAID, NFSC, DMMULTIPATH, MDPART, BTRFSC, TMPFSC };
00160
00161 enum Transport { TUNKNOWN, SBP, ATA, FC, ISCSI, SAS, SATA, SPI, USB, FCOE };
00162
00163 enum ImsmDriver { IMSM_UNDECIDED, IMSM_DMRAID, IMSM_MDADM };
00164
00165 enum MultipathAutostart { MPAS_UNDECIDED, MPAS_ON, MPAS_OFF };
00166
00167 enum PartAlign { ALIGN_OPTIMAL, ALIGN_CYLINDER };
00168
00169
00174 typedef void (*CallbackProgressBar)(const string& id, unsigned cur, unsigned max);
00175
00180 typedef void (*CallbackShowInstallInfo)(const string& id);
00181
00186 typedef void (*CallbackInfoPopup)(const string& text);
00187
00194 typedef bool (*CallbackYesNoPopup)(const string& text);
00195
00201 typedef bool (*CallbackCommitErrorPopup)(int error, const string& last_action,
00202 const string& extended_message);
00203
00209 typedef bool (*CallbackPasswordPopup)(const string& device, int attempts, string& password);
00210
00211
00215 struct FsCapabilities
00216 {
00217 FsCapabilities() {}
00218 bool isExtendable;
00219 bool isExtendableWhileMounted;
00220 bool isReduceable;
00221 bool isReduceableWhileMounted;
00222 bool supportsUuid;
00223 bool supportsLabel;
00224 bool labelWhileMounted;
00225 unsigned int labelLength;
00226 unsigned long long minimalFsSizeK;
00227 };
00228
00232 struct DlabelCapabilities
00233 {
00234 DlabelCapabilities() {}
00235 unsigned maxPrimary;
00236 bool extendedPossible;
00237 unsigned maxLogical;
00238 unsigned long long maxSectors;
00239 };
00240
00241
00242 struct UsedByInfo
00243 {
00244 UsedByInfo(UsedByType type, const string& device) : type(type), device(device) {}
00245 UsedByType type;
00246 string device;
00247 };
00248
00249
00250 struct SubvolInfo
00251 {
00252 SubvolInfo(const string& path) : path(path) {}
00253 string path;
00254 };
00255
00256
00257 struct ResizeInfo
00258 {
00259 ResizeInfo() : df_freeK(0), resize_freeK(0), usedK(0), resize_ok(false) {}
00260 unsigned long long df_freeK;
00261 unsigned long long resize_freeK;
00262 unsigned long long usedK;
00263 bool resize_ok;
00264 };
00265
00266
00267 struct ContentInfo
00268 {
00269 ContentInfo() : windows(false), efi(false), homes(0) {}
00270 bool windows;
00271 bool efi;
00272 unsigned homes;
00273 };
00274
00275
00279 struct ContainerInfo
00280 {
00281 ContainerInfo() {}
00282 CType type;
00283 string device;
00284 string name;
00285 string udevPath;
00286 string udevId;
00287 list<UsedByInfo> usedBy;
00288 UsedByType usedByType;
00289 string usedByDevice;
00290 bool readonly;
00291 };
00292
00296 struct DiskInfo
00297 {
00298 DiskInfo() {}
00299 unsigned long long sizeK;
00300 unsigned long long cylSize;
00301 unsigned long cyl;
00302 unsigned long heads;
00303 unsigned long sectors;
00304 unsigned int sectorSize;
00305 string disklabel;
00306 string orig_disklabel;
00307 unsigned maxPrimary;
00308 bool extendedPossible;
00309 unsigned maxLogical;
00310 bool initDisk;
00311 Transport transport;
00312 bool iscsi;
00313 };
00314
00318 struct LvmVgInfo
00319 {
00320 LvmVgInfo() {}
00321 unsigned long long sizeK;
00322 unsigned long long peSizeK;
00323 unsigned long peCount;
00324 unsigned long peFree;
00325 string uuid;
00326 bool lvm2;
00327 bool create;
00328 string devices;
00329 string devices_add;
00330 string devices_rem;
00331 };
00332
00336 struct DmPartCoInfo
00337 {
00338 DmPartCoInfo() {}
00339 DiskInfo d;
00340 string devices;
00341 unsigned long minor;
00342 };
00343
00344 struct DmraidCoInfo
00345 {
00346 DmraidCoInfo() {}
00347 DmPartCoInfo p;
00348 };
00349
00350 struct DmmultipathCoInfo
00351 {
00352 DmmultipathCoInfo() {}
00353 DmPartCoInfo p;
00354 string vendor;
00355 string model;
00356 };
00357
00361 struct VolumeInfo
00362 {
00363 VolumeInfo() {}
00364 unsigned long long sizeK;
00365 unsigned long major;
00366 unsigned long minor;
00367 string name;
00368 string device;
00369 string mount;
00370 string crypt_device;
00371 MountByType mount_by;
00372 string udevPath;
00373 string udevId;
00374 list<UsedByInfo> usedBy;
00375 UsedByType usedByType;
00376 string usedByDevice;
00377 bool ignore_fstab;
00378 string fstab_options;
00379 string uuid;
00380 string label;
00381 string mkfs_options;
00382 string tunefs_options;
00383 string loop;
00384 string dtxt;
00385 EncryptType encryption;
00386 string crypt_pwd;
00387 FsType fs;
00388 FsType detected_fs;
00389 bool format;
00390 bool create;
00391 bool is_mounted;
00392 bool resize;
00393 bool ignore_fs;
00394 unsigned long long origSizeK;
00395 };
00396
00397 struct PartitionAddInfo
00398 {
00399 PartitionAddInfo() {}
00400 unsigned nr;
00401 unsigned long cylStart;
00402 unsigned long cylSize;
00403 PartitionType partitionType;
00404 unsigned id;
00405 bool boot;
00406 };
00407
00411 struct PartitionInfo
00412 {
00413 PartitionInfo() {}
00414 PartitionInfo& operator=( const PartitionAddInfo& rhs );
00415 VolumeInfo v;
00416 unsigned nr;
00417 unsigned long cylStart;
00418 unsigned long cylSize;
00419 PartitionType partitionType;
00420 unsigned id;
00421 bool boot;
00422 };
00423
00427 struct LvmLvInfo
00428 {
00429 LvmLvInfo() {}
00430 VolumeInfo v;
00431 unsigned stripes;
00432 unsigned stripeSizeK;
00433 string uuid;
00434 string status;
00435 string allocation;
00436 string dm_table;
00437 string dm_target;
00438 string origin;
00439 unsigned long long sizeK;
00440 };
00441
00445 struct LvmLvSnapshotStateInfo
00446 {
00447 LvmLvSnapshotStateInfo() {}
00448 bool active;
00449 double allocated;
00450 };
00451
00455 struct MdInfo
00456 {
00457 MdInfo() {}
00458 VolumeInfo v;
00459 unsigned nr;
00460 unsigned type;
00461 unsigned parity;
00462 string uuid;
00463 string sb_ver;
00464 unsigned long chunkSizeK;
00465 string devices;
00466 string spares;
00467 };
00468
00472 struct MdStateInfo
00473 {
00474 MdStateInfo() {}
00475 MdArrayState state;
00476 };
00477
00482 struct MdPartCoInfo
00483 {
00484 MdPartCoInfo() {}
00485 DiskInfo d;
00486 unsigned type;
00487 unsigned nr;
00488 unsigned parity;
00489 string uuid;
00490 string sb_ver;
00491 unsigned long chunkSizeK;
00492 string devices;
00493 string spares;
00494 };
00495
00496 struct MdPartCoStateInfo
00497 {
00498 MdPartCoStateInfo() {}
00499 MdArrayState state;
00500 };
00501
00505 struct MdPartInfo
00506 {
00507 MdPartInfo() {}
00508 VolumeInfo v;
00509 PartitionAddInfo p;
00510 bool part;
00511 };
00512
00516 struct NfsInfo
00517 {
00518 NfsInfo() {}
00519 VolumeInfo v;
00520 };
00521
00525 struct LoopInfo
00526 {
00527 LoopInfo() {}
00528 VolumeInfo v;
00529 bool reuseFile;
00530 unsigned nr;
00531 string file;
00532 };
00533
00537 struct BtrfsInfo
00538 {
00539 BtrfsInfo() {}
00540 VolumeInfo v;
00541 string devices;
00542 string devices_add;
00543 string devices_rem;
00544 string subvol;
00545 string subvol_add;
00546 string subvol_rem;
00547 };
00548
00552 struct TmpfsInfo
00553 {
00554 TmpfsInfo() {}
00555 VolumeInfo v;
00556 };
00557
00561 struct DmInfo
00562 {
00563 DmInfo() {}
00564 VolumeInfo v;
00565 unsigned nr;
00566 string table;
00567 string target;
00568 };
00569
00573 struct DmPartInfo
00574 {
00575 DmPartInfo() {}
00576 VolumeInfo v;
00577 PartitionAddInfo p;
00578 bool part;
00579 string table;
00580 string target;
00581 };
00582
00586 struct DmraidInfo
00587 {
00588 DmraidInfo() {}
00589 DmPartInfo p;
00590 };
00591
00595 struct DmmultipathInfo
00596 {
00597 DmmultipathInfo() {}
00598 DmPartInfo p;
00599 };
00600
00604 struct ContVolInfo
00605 {
00606 ContVolInfo() : ctype(CUNKNOWN), num(-1) {}
00607 CType ctype;
00608 string cname;
00609 string cdevice;
00610 string vname;
00611 string vdevice;
00612 int num;
00613 };
00614
00618 struct PartitionSlotInfo
00619 {
00620 PartitionSlotInfo() {}
00621 unsigned long cylStart;
00622 unsigned long cylSize;
00623 bool primarySlot;
00624 bool primaryPossible;
00625 bool extendedSlot;
00626 bool extendedPossible;
00627 bool logicalSlot;
00628 bool logicalPossible;
00629 };
00630
00634 struct CommitInfo
00635 {
00636 CommitInfo() {}
00637 bool destructive;
00638 string text;
00639 };
00640
00641
00645 enum ErrorCodes
00646 {
00647 STORAGE_NO_ERROR = 0,
00648
00649 DISK_PARTITION_OVERLAPS_EXISTING = -1000,
00650 DISK_PARTITION_EXCEEDS_DISK = -1001,
00651 DISK_CREATE_PARTITION_EXT_ONLY_ONCE = -1002,
00652 DISK_CREATE_PARTITION_EXT_IMPOSSIBLE = -1003,
00653 DISK_PARTITION_NO_FREE_NUMBER = -1004,
00654 DISK_CREATE_PARTITION_INVALID_VOLUME = -1005,
00655 DISK_CREATE_PARTITION_INVALID_TYPE = -1006,
00656 DISK_CREATE_PARTITION_PARTED_FAILED = -1007,
00657 DISK_PARTITION_NOT_FOUND = -1008,
00658 DISK_CREATE_PARTITION_LOGICAL_NO_EXT = -1009,
00659 DISK_PARTITION_LOGICAL_OUTSIDE_EXT = -1010,
00660 DISK_SET_TYPE_INVALID_VOLUME = -1011,
00661 DISK_SET_TYPE_PARTED_FAILED = -1012,
00662 DISK_SET_LABEL_PARTED_FAILED = -1013,
00663 DISK_REMOVE_PARTITION_PARTED_FAILED = -1014,
00664 DISK_REMOVE_PARTITION_INVALID_VOLUME = -1015,
00665 DISK_REMOVE_PARTITION_LIST_ERASE = -1016,
00666 DISK_DESTROY_TABLE_INVALID_LABEL = -1017,
00667 DISK_PARTITION_ZERO_SIZE = -1018,
00668 DISK_CHANGE_READONLY = -1019,
00669 DISK_RESIZE_PARTITION_INVALID_VOLUME = -1020,
00670 DISK_RESIZE_PARTITION_PARTED_FAILED = -1021,
00671 DISK_RESIZE_NO_SPACE = -1022,
00672 DISK_CHECK_RESIZE_INVALID_VOLUME = -1023,
00673 DISK_REMOVE_PARTITION_CREATE_NOT_FOUND = -1024,
00674 DISK_COMMIT_NOTHING_TODO = -1025,
00675 DISK_CREATE_PARTITION_NO_SPACE = -1026,
00676 DISK_REMOVE_USED_BY = -1027,
00677 DISK_INIT_NOT_POSSIBLE = -1028,
00678 DISK_INVALID_PARTITION_ID = -1029,
00679
00680 STORAGE_DISK_NOT_FOUND = -2000,
00681 STORAGE_VOLUME_NOT_FOUND = -2001,
00682 STORAGE_REMOVE_PARTITION_INVALID_CONTAINER = -2002,
00683 STORAGE_CHANGE_PARTITION_ID_INVALID_CONTAINER = -2003,
00684 STORAGE_CHANGE_READONLY = -2004,
00685 STORAGE_DISK_USED_BY = -2005,
00686 STORAGE_LVM_VG_EXISTS = -2006,
00687 STORAGE_LVM_VG_NOT_FOUND = -2007,
00688 STORAGE_LVM_INVALID_DEVICE = -2008,
00689 STORAGE_CONTAINER_NOT_FOUND = -2009,
00690 STORAGE_VG_INVALID_NAME = -2010,
00691 STORAGE_REMOVE_USED_VOLUME = -2011,
00692 STORAGE_REMOVE_USING_UNKNOWN_TYPE = -2012,
00693 STORAGE_NOT_YET_IMPLEMENTED = -2013,
00694 STORAGE_MD_INVALID_NAME = -2014,
00695 STORAGE_MD_NOT_FOUND = -2015,
00696 STORAGE_MEMORY_EXHAUSTED = -2016,
00697 STORAGE_LOOP_NOT_FOUND = -2017,
00698 STORAGE_CREATED_LOOP_NOT_FOUND = -2018,
00699 STORAGE_CHANGE_AREA_INVALID_CONTAINER = -2023,
00700 STORAGE_BACKUP_STATE_NOT_FOUND = -2024,
00701 STORAGE_INVALID_FSTAB_VALUE = -2025,
00702 STORAGE_NO_FSTAB_PTR = -2026,
00703 STORAGE_DEVICE_NODE_NOT_FOUND = -2027,
00704 STORAGE_DMRAID_CO_NOT_FOUND = -2028,
00705 STORAGE_RESIZE_INVALID_CONTAINER = -2029,
00706 STORAGE_DMMULTIPATH_CO_NOT_FOUND = -2030,
00707 STORAGE_ZERO_DEVICE_FAILED = -2031,
00708 STORAGE_INVALID_BACKUP_STATE_NAME = -2032,
00709 STORAGE_MDPART_CO_NOT_FOUND = -2033,
00710 STORAGE_DEVICE_NOT_FOUND = -2034,
00711 STORAGE_BTRFS_CO_NOT_FOUND = -2035,
00712 STORAGE_TMPFS_CO_NOT_FOUND = -2036,
00713
00714 VOLUME_COMMIT_UNKNOWN_STAGE = -3000,
00715 VOLUME_FSTAB_EMPTY_MOUNT = -3001,
00716 VOLUME_UMOUNT_FAILED = -3002,
00717 VOLUME_MOUNT_FAILED = -3003,
00718 VOLUME_FORMAT_UNKNOWN_FS = -3005,
00719 VOLUME_FORMAT_FS_UNDETECTED = -3006,
00720 VOLUME_FORMAT_FS_TOO_SMALL = -3007,
00721 VOLUME_FORMAT_FAILED = -3008,
00722 VOLUME_TUNE2FS_FAILED = -3009,
00723 VOLUME_MKLABEL_FS_UNABLE = -3010,
00724 VOLUME_MKLABEL_FAILED = -3011,
00725 VOLUME_LOSETUP_NO_LOOP = -3012,
00726 VOLUME_LOSETUP_FAILED = -3013,
00727 VOLUME_CRYPT_NO_PWD = -3014,
00728 VOLUME_CRYPT_PWD_TOO_SHORT = -3015,
00729 VOLUME_CRYPT_NOT_DETECTED = -3016,
00730 VOLUME_FORMAT_EXTENDED_UNSUPPORTED = -3017,
00731 VOLUME_MOUNT_EXTENDED_UNSUPPORTED = -3018,
00732 VOLUME_MOUNT_POINT_INVALID = -3019,
00733 VOLUME_MOUNTBY_NOT_ENCRYPTED = -3020,
00734 VOLUME_MOUNTBY_UNSUPPORTED_BY_FS = -3021,
00735 VOLUME_LABEL_NOT_SUPPORTED = -3022,
00736 VOLUME_LABEL_TOO_LONG = -3023,
00737 VOLUME_LABEL_WHILE_MOUNTED = -3024,
00738 VOLUME_RESIZE_UNSUPPORTED_BY_FS = -3025,
00739 VOLUME_RESIZE_UNSUPPORTED_BY_CONTAINER = -3026,
00740 VOLUME_RESIZE_FAILED = -3027,
00741 VOLUME_ALREADY_IN_USE = -3028,
00742 VOLUME_LOUNSETUP_FAILED = -3029,
00743 VOLUME_DEVICE_NOT_PRESENT = -3030,
00744 VOLUME_DEVICE_NOT_BLOCK = -3031,
00745 VOLUME_MOUNTBY_UNSUPPORTED_BY_VOLUME = -3032,
00746 VOLUME_CRYPTFORMAT_FAILED = -3033,
00747 VOLUME_CRYPTSETUP_FAILED = -3034,
00748 VOLUME_CRYPTUNSETUP_FAILED = -3035,
00749 VOLUME_FORMAT_NOT_IMPLEMENTED = -3036,
00750 VOLUME_FORMAT_IMPOSSIBLE = -3037,
00751 VOLUME_CRYPT_NFS_IMPOSSIBLE = -3038,
00752 VOLUME_REMOUNT_FAILED = -3039,
00753 VOLUME_TUNEREISERFS_FAILED = -3040,
00754 VOLUME_UMOUNT_NOT_MOUNTED = -3041,
00755 VOLUME_BTRFS_ADD_FAILED = -3042,
00756 VOLUME_CANNOT_TMP_MOUNT = -3043,
00757 VOLUME_CANNOT_TMP_UMOUNT = -3044,
00758 VOLUME_BTRFS_SUBVOL_INIT_FAILED = -3045,
00759 VOLUME_BTRFS_SUBVOL_DETDEFAULT = -3046,
00760
00761 LVM_CREATE_PV_FAILED = -4000,
00762 LVM_PV_ALREADY_CONTAINED = -4001,
00763 LVM_PV_DEVICE_UNKNOWN = -4002,
00764 LVM_PV_DEVICE_USED = -4003,
00765 LVM_VG_HAS_NONE_PV = -4004,
00766 LVM_LV_INVALID_NAME = -4005,
00767 LVM_LV_DUPLICATE_NAME = -4006,
00768 LVM_LV_NO_SPACE = -4007,
00769 LVM_LV_UNKNOWN_NAME = -4008,
00770 LVM_LV_NOT_IN_LIST = -4009,
00771 LVM_VG_CREATE_FAILED = -4010,
00772 LVM_VG_EXTEND_FAILED = -4011,
00773 LVM_VG_REDUCE_FAILED = -4012,
00774 LVM_VG_REMOVE_FAILED = -4013,
00775 LVM_LV_CREATE_FAILED = -4014,
00776 LVM_LV_REMOVE_FAILED = -4015,
00777 LVM_LV_RESIZE_FAILED = -4016,
00778 LVM_PV_STILL_ADDED = -4017,
00779 LVM_PV_REMOVE_NOT_FOUND = -4018,
00780 LVM_CREATE_LV_INVALID_VOLUME = -4019,
00781 LVM_REMOVE_LV_INVALID_VOLUME = -4020,
00782 LVM_RESIZE_LV_INVALID_VOLUME = -4021,
00783 LVM_CHANGE_READONLY = -4022,
00784 LVM_CHECK_RESIZE_INVALID_VOLUME = -4023,
00785 LVM_COMMIT_NOTHING_TODO = -4024,
00786 LVM_LV_REMOVE_USED_BY = -4025,
00787 LVM_LV_ALREADY_ON_DISK = -4026,
00788 LVM_LV_NO_STRIPE_SIZE = -4027,
00789 LVM_LV_UNKNOWN_ORIGIN = -4028,
00790 LVM_LV_NOT_ON_DISK = -4029,
00791 LVM_LV_NOT_SNAPSHOT = -4030,
00792 LVM_LV_HAS_SNAPSHOTS = -4031,
00793 LVM_LV_IS_SNAPSHOT = -4032,
00794 LVM_LIST_EMPTY = -4033,
00795
00796 FSTAB_ENTRY_NOT_FOUND = -5000,
00797 FSTAB_CHANGE_PREFIX_IMPOSSIBLE = -5001,
00798 FSTAB_REMOVE_ENTRY_NOT_FOUND = -5002,
00799 FSTAB_UPDATE_ENTRY_NOT_FOUND = -5003,
00800 FSTAB_ADD_ENTRY_FOUND = -5004,
00801
00802 MD_CHANGE_READONLY = -6000,
00803 MD_DUPLICATE_NUMBER = -6001,
00804 MD_TOO_FEW_DEVICES = -6002,
00805 MD_DEVICE_UNKNOWN = -6003,
00806 MD_DEVICE_USED = -6004,
00807 MD_CREATE_INVALID_VOLUME = -6005,
00808 MD_REMOVE_FAILED = -6006,
00809 MD_NOT_IN_LIST = -6007,
00810 MD_CREATE_FAILED = -6008,
00811 MD_UNKNOWN_NUMBER = -6009,
00812 MD_REMOVE_USED_BY = -6010,
00813 MD_NUMBER_TOO_LARGE = -6011,
00814 MD_REMOVE_INVALID_VOLUME = -6012,
00815 MD_REMOVE_CREATE_NOT_FOUND = -6013,
00816 MD_NO_RESIZE_ON_DISK = -6014,
00817 MD_ADD_DUPLICATE = -6015,
00818 MD_REMOVE_NONEXISTENT = -6016,
00819 MD_NO_CHANGE_ON_DISK = -6017,
00820 MD_NO_CREATE_UNKNOWN = -6018,
00821 MD_STATE_NOT_ON_DISK = -6019,
00822 MD_PARTITION_NOT_FOUND = -6020,
00823 MD_INVALID_PARITY = -6021,
00824 MD_TOO_MANY_SPARES = -6022,
00825 MD_GET_STATE_FAILED = -6023,
00826
00827 MDPART_CHANGE_READONLY = -6100,
00828 MDPART_INTERNAL_ERR = -6101,
00829 MDPART_INVALID_VOLUME = -6012,
00830 MDPART_PARTITION_NOT_FOUND = -6103,
00831 MDPART_REMOVE_PARTITION_LIST_ERASE = -6104,
00832 MDPART_COMMIT_NOTHING_TODO = -6105,
00833 MDPART_NO_REMOVE = -6106,
00834 MDPART_DEVICE_NOT_FOUND = -6107,
00835
00836 LOOP_CHANGE_READONLY = -7000,
00837 LOOP_DUPLICATE_FILE = -7001,
00838 LOOP_UNKNOWN_FILE = -7002,
00839 LOOP_REMOVE_USED_BY = -7003,
00840 LOOP_FILE_CREATE_FAILED = -7004,
00841 LOOP_CREATE_INVALID_VOLUME = -7005,
00842 LOOP_REMOVE_FILE_FAILED = -7006,
00843 LOOP_REMOVE_INVALID_VOLUME = -7007,
00844 LOOP_NOT_IN_LIST = -7008,
00845 LOOP_REMOVE_CREATE_NOT_FOUND = -7009,
00846 LOOP_MODIFY_EXISTING = -7010,
00847
00848 PEC_PE_SIZE_INVALID = -9000,
00849 PEC_PV_NOT_FOUND = -9001,
00850 PEC_REMOVE_PV_IN_USE = -9002,
00851 PEC_REMOVE_PV_SIZE_NEEDED = -9003,
00852 PEC_LV_NO_SPACE_STRIPED = -9004,
00853 PEC_LV_NO_SPACE_SINGLE = -9005,
00854 PEC_LV_PE_DEV_NOT_FOUND = -9006,
00855
00856 DM_CHANGE_READONLY = -10000,
00857 DM_UNKNOWN_TABLE = -10001,
00858 DM_REMOVE_USED_BY = -10002,
00859 DM_REMOVE_CREATE_NOT_FOUND = -10003,
00860 DM_REMOVE_INVALID_VOLUME = -10004,
00861 DM_REMOVE_FAILED = -10005,
00862 DM_NOT_IN_LIST = -10006,
00863
00864 DASD_NOT_POSSIBLE = -11000,
00865 DASD_FDASD_FAILED = -11001,
00866 DASD_DASDFMT_FAILED = -11002,
00867
00868 DMPART_CHANGE_READONLY = -12001,
00869 DMPART_INTERNAL_ERR = -12002,
00870 DMPART_INVALID_VOLUME = -12003,
00871 DMPART_PARTITION_NOT_FOUND = -12004,
00872 DMPART_REMOVE_PARTITION_LIST_ERASE = -12005,
00873 DMPART_COMMIT_NOTHING_TODO = -12006,
00874 DMPART_NO_REMOVE = -12007,
00875
00876 DMRAID_REMOVE_FAILED = -13001,
00877
00878 NFS_VOLUME_NOT_FOUND = -14001,
00879 NFS_CHANGE_READONLY = -14002,
00880 NFS_REMOVE_VOLUME_CREATE_NOT_FOUND = -14003,
00881 NFS_REMOVE_VOLUME_LIST_ERASE = -14004,
00882 NFS_REMOVE_INVALID_VOLUME = -14005,
00883
00884 BTRFS_COMMIT_INVALID_VOLUME = -15001,
00885 BTRFS_CANNOT_TMP_MOUNT = -15002,
00886 BTRFS_CANNOT_TMP_UMOUNT = -15003,
00887 BTRFS_DELETE_SUBVOL_FAIL = -15004,
00888 BTRFS_CREATE_SUBVOL_FAIL = -15005,
00889 BTRFS_VOLUME_NOT_FOUND = -15006,
00890 BTRFS_SUBVOL_EXISTS = -15007,
00891 BTRFS_SUBVOL_NON_EXISTS = -15008,
00892 BTRFS_REMOVE_NOT_FOUND = -15009,
00893 BTRFS_REMOVE_NO_BTRFS = -15010,
00894 BTRFS_REMOVE_INVALID_VOLUME = -15011,
00895 BTRFS_CHANGE_READONLY = -15012,
00896 BTRFS_DEV_ALREADY_CONTAINED = -15013,
00897 BTRFS_DEVICE_UNKNOWN = -15014,
00898 BTRFS_DEVICE_USED = -15015,
00899 BTRFS_HAS_NONE_DEV = -15016,
00900 BTRFS_DEV_NOT_FOUND = -15017,
00901 BTRFS_EXTEND_FAIL = -15018,
00902 BTRFS_REDUCE_FAIL = -15019,
00903 BTRFS_LIST_EMPTY = -15020,
00904
00905 TMPFS_REMOVE_INVALID_VOLUME = -16001,
00906 TMPFS_REMOVE_NO_TMPFS = -16002,
00907 TMPFS_REMOVE_NOT_FOUND = -16003,
00908
00909 CONTAINER_INTERNAL_ERROR = -99000,
00910 CONTAINER_INVALID_VIRTUAL_CALL = -99001,
00911
00912 };
00913
00914
00918 class StorageInterface
00919 {
00920 public:
00921
00922 StorageInterface () {}
00923 virtual ~StorageInterface () {}
00924
00928 virtual void getContainers( deque<ContainerInfo>& infos) = 0;
00929
00937 virtual int getDiskInfo( const string& disk, DiskInfo& info) = 0;
00938
00947 virtual int getContDiskInfo( const string& disk, ContainerInfo& cinfo,
00948 DiskInfo& info ) = 0;
00949
00957 virtual int getLvmVgInfo( const string& name, LvmVgInfo& info) = 0;
00958
00967 virtual int getContLvmVgInfo( const string& name, ContainerInfo& cinfo,
00968 LvmVgInfo& info) = 0;
00969
00977 virtual int getDmraidCoInfo( const string& name, DmraidCoInfo& info) = 0;
00978
00987 virtual int getContDmraidCoInfo( const string& name, ContainerInfo& cinfo,
00988 DmraidCoInfo& info) = 0;
00989
00997 virtual int getDmmultipathCoInfo( const string& name, DmmultipathCoInfo& info) = 0;
00998
01007 virtual int getContDmmultipathCoInfo( const string& name, ContainerInfo& cinfo,
01008 DmmultipathCoInfo& info) = 0;
01009
01017 virtual int getMdPartCoInfo( const string& name, MdPartCoInfo& info) = 0;
01018
01019
01028 virtual int getContMdPartCoInfo( const string& name, ContainerInfo& cinfo,
01029 MdPartCoInfo& info) = 0;
01030
01036 virtual void setImsmDriver(ImsmDriver driver) = 0;
01037
01043 virtual ImsmDriver getImsmDriver() const = 0;
01044
01050 virtual void setMultipathAutostart(MultipathAutostart multipath_autostart) = 0;
01051
01057 virtual MultipathAutostart getMultipathAutostart() const = 0;
01058
01064 virtual void getVolumes( deque<VolumeInfo>& infos) = 0;
01065
01073 virtual int getVolume( const string& device, VolumeInfo& info) = 0;
01074
01082 virtual int getPartitionInfo( const string& disk,
01083 deque<PartitionInfo>& plist ) = 0;
01084
01092 virtual int getLvmLvInfo( const string& name,
01093 deque<LvmLvInfo>& plist ) = 0;
01094
01101 virtual int getMdInfo( deque<MdInfo>& plist ) = 0;
01102
01110 virtual int getMdPartInfo( const string& device,
01111 deque<MdPartInfo>& plist ) = 0;
01112
01119 virtual int getNfsInfo( deque<NfsInfo>& plist ) = 0;
01120
01127 virtual int getLoopInfo( deque<LoopInfo>& plist ) = 0;
01128
01135 virtual int getDmInfo( deque<DmInfo>& plist ) = 0;
01136
01143 virtual int getBtrfsInfo( deque<BtrfsInfo>& plist ) = 0;
01144
01151 virtual int getTmpfsInfo( deque<TmpfsInfo>& plist ) = 0;
01152
01160 virtual int getDmraidInfo( const string& name,
01161 deque<DmraidInfo>& plist ) = 0;
01162
01170 virtual int getDmmultipathInfo( const string& name,
01171 deque<DmmultipathInfo>& plist ) = 0;
01172
01176 virtual bool getFsCapabilities (FsType fstype, FsCapabilities& fscapabilities) const = 0;
01177
01181 virtual bool getDlabelCapabilities(const string& dlabel,
01182 DlabelCapabilities& dlabelcapabilities) const = 0;
01183
01187 virtual list<string> getAllUsedFs() const = 0;
01188
01201 virtual int createPartition( const string& disk, PartitionType type,
01202 unsigned long startCyl,
01203 unsigned long sizeCyl,
01204 string& device ) = 0;
01205
01214 virtual int resizePartition( const string& device,
01215 unsigned long sizeCyl ) = 0;
01216
01225 virtual int resizePartitionNoFs( const string& device,
01226 unsigned long sizeCyl ) = 0;
01227
01238 virtual int updatePartitionArea( const string& device,
01239 unsigned long startCyl,
01240 unsigned long sizeCyl ) = 0;
01241
01250 virtual int freeCylindersAroundPartition(const string& device, unsigned long& freeCylsBefore,
01251 unsigned long& freeCylsAfter) = 0;
01252
01262 virtual int nextFreePartition( const string& disk, PartitionType type,
01263 unsigned &nr, string& device ) = 0;
01264
01277 virtual int createPartitionKb( const string& disk, PartitionType type,
01278 unsigned long long startK,
01279 unsigned long long sizeK,
01280 string& device ) = 0;
01281
01292 virtual int createPartitionAny( const string& disk,
01293 unsigned long long sizeK,
01294 string& device ) = 0;
01295
01306 virtual int createPartitionMax( const string& disk, PartitionType type,
01307 string& device ) = 0;
01308
01316 virtual unsigned long long cylinderToKb( const string& disk,
01317 unsigned long sizeCyl) = 0;
01318
01326 virtual unsigned long kbToCylinder( const string& disk,
01327 unsigned long long sizeK) = 0;
01328
01335 virtual int removePartition (const string& partition) = 0;
01336
01344 virtual int changePartitionId (const string& partition, unsigned id) = 0;
01345
01352 virtual int forgetChangePartitionId (const string& partition ) = 0;
01353
01361 virtual string getPartitionPrefix(const string& disk) = 0;
01362
01371 virtual string getPartitionName(const string& disk, int partition_no) = 0;
01372
01380 virtual int getUnusedPartitionSlots(const string& disk, list<PartitionSlotInfo>& slots) = 0;
01381
01390 virtual int destroyPartitionTable (const string& disk, const string& label) = 0;
01391
01402 virtual int initializeDisk( const string& disk, bool value ) = 0;
01403
01412 virtual string defaultDiskLabel(const string& device) = 0;
01413
01422 virtual int changeFormatVolume( const string& device, bool format, FsType fs ) = 0;
01423
01431 virtual int changeLabelVolume( const string& device, const string& label ) = 0;
01432
01440 virtual int changeMkfsOptVolume( const string& device, const string& opts ) = 0;
01441
01449 virtual int changeTunefsOptVolume( const string& device, const string& opts ) = 0;
01450
01459 virtual int changeMountPoint( const string& device, const string& mount ) = 0;
01460
01468 virtual int getMountPoint( const string& device, string& mount ) = 0;
01469
01477 virtual int changeMountBy( const string& device, MountByType mby ) = 0;
01478
01486 #ifndef SWIG
01487 virtual int getMountBy( const string& device, MountByType& mby ) = 0;
01488 #else
01489 virtual int getMountBy( const string& device, MountByType& REFERENCE ) = 0;
01490 #endif
01491
01501 virtual int changeFstabOptions( const string& device, const string& options ) = 0;
01502
01511 virtual int getFstabOptions( const string& device, string& options ) = 0;
01512
01521 virtual int addFstabOptions( const string& device, const string& options ) = 0;
01522
01532 virtual int removeFstabOptions( const string& device, const string& options ) = 0;
01533
01541 virtual int setCryptPassword( const string& device, const string& pwd ) = 0;
01542
01549 virtual int forgetCryptPassword( const string& device ) = 0;
01550
01558 virtual int getCryptPassword( const string& device, string& pwd ) = 0;
01559
01568 virtual int verifyCryptPassword( const string& device,
01569 const string& pwd, bool erase ) = 0;
01570
01577 virtual bool needCryptPassword( const string& device ) = 0;
01578
01586 virtual int setCrypt( const string& device, bool val ) = 0;
01587
01596 virtual int setCryptType( const string& device, bool val, EncryptType typ ) = 0;
01597
01605 #ifndef SWIG
01606 virtual int getCrypt( const string& device, bool& val ) = 0;
01607 #else
01608 virtual int getCrypt( const string& device, bool& REFERENCE ) = 0;
01609 #endif
01610
01620 virtual int setIgnoreFstab( const string& device, bool val ) = 0;
01621
01629 #ifndef SWIG
01630 virtual int getIgnoreFstab( const string& device, bool& val ) = 0;
01631 #else
01632 virtual int getIgnoreFstab( const string& device, bool& REFERENCE ) = 0;
01633 #endif
01634
01644 virtual int changeDescText( const string& device, const string& txt ) = 0;
01645
01660 virtual int addFstabEntry( const string& device, const string& mount,
01661 const string& vfs, const string& options,
01662 unsigned freq, unsigned passno ) = 0;
01663
01664
01672 virtual int resizeVolume(const string& device, unsigned long long newSizeK) = 0;
01673
01681 virtual int resizeVolumeNoFs(const string& device, unsigned long long newSizeK) = 0;
01682
01689 virtual int forgetResizeVolume( const string& device ) = 0;
01690
01705 virtual void setRecursiveRemoval( bool val ) = 0;
01706
01712 virtual bool getRecursiveRemoval() const = 0;
01713
01722 virtual int getRecursiveUsing(const string& device, list<string>& devices) = 0;
01723
01733 virtual int getRecursiveUsedBy(const list<string>& devices, bool itself,
01734 list<string>& usedby_devices) = 0;
01735
01749 virtual void setZeroNewPartitions( bool val ) = 0;
01750
01756 virtual bool getZeroNewPartitions() const = 0;
01757
01769 virtual void setPartitionAlignment( PartAlign val ) = 0;
01770
01776 virtual PartAlign getPartitionAlignment() const = 0;
01777
01783 virtual void setDefaultMountBy( MountByType val ) = 0;
01784
01790 virtual MountByType getDefaultMountBy() const = 0;
01791
01797 virtual void setDefaultFs(FsType val) = 0;
01798
01804 virtual FsType getDefaultFs() const = 0;
01805
01811 virtual void setDefaultSubvolName( const string& val) = 0;
01812
01818 virtual string getDefaultSubvolName() const = 0;
01819
01825 virtual bool getEfiBoot() = 0;
01826
01837 virtual void setRootPrefix( const string& root ) = 0;
01838
01844 virtual string getRootPrefix() const = 0;
01845
01851 virtual void setDetectMountedVolumes( bool val ) = 0;
01852
01858 virtual bool getDetectMountedVolumes() const = 0;
01859
01867 virtual int removeVolume( const string& device ) = 0;
01868
01879 virtual int createLvmVg( const string& name,
01880 unsigned long long peSizeK, bool lvm1,
01881 const deque<string>& devs ) = 0;
01882
01890 virtual int removeLvmVg( const string& name ) = 0;
01891
01899 virtual int extendLvmVg( const string& name,
01900 const deque<string>& devs ) = 0;
01901
01909 virtual int shrinkLvmVg( const string& name,
01910 const deque<string>& devs ) = 0;
01911
01923 virtual int createLvmLv( const string& vg, const string& name,
01924 unsigned long long sizeK, unsigned stripes,
01925 string& device ) = 0;
01926
01933 virtual int removeLvmLvByDevice( const string& device ) = 0;
01934
01942 virtual int removeLvmLv( const string& vg, const string& name ) = 0;
01943
01953 virtual int changeLvStripeCount( const string& vg, const string& name,
01954 unsigned long stripes ) = 0;
01955
01965 virtual int changeLvStripeSize( const string& vg, const string& name,
01966 unsigned long long stripeSizeK) = 0;
01967
01978 virtual int createLvmLvSnapshot(const string& vg, const string& origin,
01979 const string& name, unsigned long long cowSizeK,
01980 string& device) = 0;
01981
01989 virtual int removeLvmLvSnapshot(const string& vg, const string& name) = 0;
01990
02001 virtual int getLvmLvSnapshotStateInfo(const string& vg, const string& name,
02002 LvmLvSnapshotStateInfo& info) = 0;
02003
02011 virtual int nextFreeMd(unsigned& nr, string &device) = 0;
02012
02022 virtual int createMd(const string& name, MdType md_type, const list<string>& devices,
02023 const list<string>& spares) = 0;
02024
02034 virtual int createMdAny(MdType md_type, const list<string>& devices,
02035 const list<string>& spares, string& device) = 0;
02036
02045 virtual int removeMd( const string& name, bool destroySb ) = 0;
02046
02056 virtual int extendMd(const string& name, const list<string>& devices,
02057 const list<string>& spares) = 0;
02058
02068 virtual int shrinkMd(const string& name, const list<string>& devices,
02069 const list<string>& spares) = 0;
02070
02079 virtual int changeMdType(const string& name, MdType md_type) = 0;
02080
02089 virtual int changeMdChunk(const string& name, unsigned long chunkSizeK) = 0;
02090
02099 virtual int changeMdParity( const string& name, MdParity ptype ) = 0;
02100
02107 virtual int checkMd( const string& name ) = 0;
02108
02118 virtual int getMdStateInfo(const string& name, MdStateInfo& info) = 0;
02119
02129 virtual int getMdPartCoStateInfo(const string& name,
02130 MdPartCoStateInfo& info) = 0;
02131
02144 virtual int computeMdSize(MdType md_type, const list<string>& devices,
02145 const list<string>& spares, unsigned long long& sizeK) = 0;
02146
02154 virtual list<int> getMdAllowedParity(MdType md_type, unsigned devnr) = 0;
02155
02166 virtual int removeMdPartCo(const string& name, bool destroySb ) = 0;
02167
02178 virtual int addNfsDevice(const string& nfsDev, const string& opts,
02179 unsigned long long sizeK, const string& mp,
02180 bool nfs4) = 0;
02181
02191 virtual int checkNfsDevice(const string& nfsDev, const string& opts,
02192 bool nfs4, unsigned long long& sizeK) = 0;
02193
02210 virtual int createFileLoop( const string& lname, bool reuseExisting,
02211 unsigned long long sizeK,
02212 const string& mp, const string& pwd,
02213 string& device ) = 0;
02214
02232 virtual int modifyFileLoop( const string& device, const string& lname,
02233 bool reuseExisting,
02234 unsigned long long sizeK ) = 0;
02235
02244 virtual int removeFileLoop( const string& lname, bool removeFile ) = 0;
02245
02252 virtual int removeDmraid( const string& name ) = 0;
02253
02261 virtual bool existSubvolume( const string& device, const string& name ) = 0;
02262
02270 virtual int createSubvolume( const string& device, const string& name ) = 0;
02271
02279 virtual int removeSubvolume( const string& device, const string& name ) = 0;
02280
02289 virtual int extendBtrfsVolume( const string& name,
02290 const deque<string>& devs ) = 0;
02291
02300 virtual int shrinkBtrfsVolume( const string& name,
02301 const deque<string>& devs ) = 0;
02302
02310 virtual int addTmpfsMount( const string& mp, const string& opts ) = 0;
02311
02318 virtual int removeTmpfsMount( const string& mp ) = 0;
02319
02325 virtual void getCommitInfos(list<CommitInfo>& infos) const = 0;
02326
02332 virtual const string& getLastAction() const = 0;
02333
02340 virtual const string& getExtendedErrorMessage() const = 0;
02341
02342
02343 #ifndef SWIG
02344
02350 virtual void setCallbackProgressBar(CallbackProgressBar pfnc) = 0;
02351
02357 virtual CallbackProgressBar getCallbackProgressBar() const = 0;
02358
02359
02365 virtual void setCallbackShowInstallInfo(CallbackShowInstallInfo pfnc) = 0;
02366
02372 virtual CallbackShowInstallInfo getCallbackShowInstallInfo() const = 0;
02373
02374
02381 virtual void setCallbackInfoPopup(CallbackInfoPopup pfnc) = 0;
02382
02389 virtual CallbackInfoPopup getCallbackInfoPopup() const = 0;
02390
02391
02398 virtual void setCallbackYesNoPopup(CallbackYesNoPopup pfnc) = 0;
02399
02406 virtual CallbackYesNoPopup getCallbackYesNoPopup() const = 0;
02407
02408
02414 virtual void setCallbackCommitErrorPopup(CallbackCommitErrorPopup pfnc) = 0;
02415
02421 virtual CallbackCommitErrorPopup getCallbackCommitErrorPopup() const = 0;
02422
02423
02429 virtual void setCallbackPasswordPopup(CallbackPasswordPopup pfnc) = 0;
02430
02437 virtual CallbackPasswordPopup getCallbackPasswordPopup() const = 0;
02438
02439 #endif
02440
02446 virtual void setCacheChanges (bool cache) = 0;
02447
02451 virtual bool isCacheChanges () const = 0;
02452
02457 virtual int commit() = 0;
02458
02462 virtual string getErrorString(int error) const = 0;
02463
02470 virtual int createBackupState( const string& name ) = 0;
02471
02478 virtual int restoreBackupState( const string& name ) = 0;
02479
02486 virtual bool checkBackupState(const string& name) const = 0;
02487
02496 virtual bool equalBackupStates(const string& lhs, const string& rhs,
02497 bool verbose_log) const = 0;
02498
02506 virtual int removeBackupState( const string& name ) = 0;
02507
02515 virtual bool checkDeviceMounted(const string& device, list<string>& mps) = 0;
02516
02526 virtual bool umountDevice( const string& device ) = 0;
02527
02538 virtual bool mountDevice( const string& device, const string& mp ) = 0;
02539
02550 virtual int activateEncryption( const string& device, bool on ) = 0;
02551
02563 virtual bool mountDeviceOpts( const string& device, const string& mp,
02564 const string& opts ) = 0;
02565
02577 virtual bool mountDeviceRo( const string& device, const string& mp,
02578 const string& opts ) = 0;
02579
02586 virtual bool checkDmMapsTo( const string& device ) = 0;
02587
02593 virtual void removeDmTableTo( const string& device ) = 0;
02594
02606 virtual bool getFreeInfo(const string& device, bool get_resize, ResizeInfo& resize_info,
02607 bool get_content, ContentInfo& content_info, bool use_cache) = 0;
02608
02616 virtual bool readFstab( const string& dir, deque<VolumeInfo>& infos) = 0;
02617
02627 virtual void activateHld( bool val ) = 0;
02628
02637 virtual void activateMultipath( bool val ) = 0;
02638
02647 virtual void rescanEverything() = 0;
02648
02657 virtual bool rescanCryptedObjects() = 0;
02658
02662 virtual void dumpObjectList() = 0;
02663
02667 virtual void dumpCommitInfos() const = 0;
02668
02678 virtual int getContVolInfo(const string& dev, ContVolInfo& info) = 0;
02679
02680 };
02681
02682
02686 void initDefaultLogger();
02687
02688
02692 struct Environment
02693 {
02694 Environment(bool readonly) : readonly(readonly), testmode(false), autodetect(true),
02695 instsys(false), logdir("/var/log/YaST2"), testdir("tmp") {}
02696
02697 bool readonly;
02698 bool testmode;
02699 bool autodetect;
02700 bool instsys;
02701 string logdir;
02702 string testdir;
02703 };
02704
02705
02711 StorageInterface* createStorageInterface(const Environment& env);
02712
02713
02721 StorageInterface* createStorageInterfacePid(const Environment& env, int& locker_pid);
02722
02723
02727 void destroyStorageInterface(StorageInterface*);
02728
02729 }
02730
02731
02732 #endif