libstorage
|
00001 /* 00002 * Copyright (c) [2004-2010] Novell, Inc. 00003 * 00004 * All Rights Reserved. 00005 * 00006 * This program is free software; you can redistribute it and/or modify it 00007 * under the terms of version 2 of the GNU General Public License as published 00008 * by the Free Software Foundation. 00009 * 00010 * This program is distributed in the hope that it will be useful, but WITHOUT 00011 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 00013 * more details. 00014 * 00015 * You should have received a copy of the GNU General Public License along 00016 * with this program; if not, contact Novell, Inc. 00017 * 00018 * To contact Novell about this file by physical or electronic mail, you may 00019 * find current contact information at www.novell.com. 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_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 }; 00158 00159 enum CType { CUNKNOWN, DISK, MD, LOOP, LVM, DM, DMRAID, NFSC, DMMULTIPATH, MDPART }; 00160 00161 enum Transport { TUNKNOWN, SBP, ATA, FC, ISCSI, SAS, SATA, SPI, USB }; 00162 00163 enum ImsmDriver { IMSM_UNDECIDED, IMSM_DMRAID, IMSM_MDADM }; 00164 00165 enum PartAlign { ALIGN_OPTIMAL, ALIGN_CYLINDER }; 00166 00167 00172 typedef void (*CallbackProgressBar)(const string& id, unsigned cur, unsigned max); 00173 00178 typedef void (*CallbackShowInstallInfo)(const string& id); 00179 00184 typedef void (*CallbackInfoPopup)(const string& text); 00185 00192 typedef bool (*CallbackYesNoPopup)(const string& text); 00193 00199 typedef bool (*CallbackCommitErrorPopup)(int error, const string& last_action, 00200 const string& extended_message); 00201 00207 typedef bool (*CallbackPasswordPopup)(const string& device, int attempts, string& password); 00208 00209 00213 struct FsCapabilities 00214 { 00215 FsCapabilities() {} 00216 bool isExtendable; 00217 bool isExtendableWhileMounted; 00218 bool isReduceable; 00219 bool isReduceableWhileMounted; 00220 bool supportsUuid; 00221 bool supportsLabel; 00222 bool labelWhileMounted; 00223 unsigned int labelLength; 00224 unsigned long long minimalFsSizeK; 00225 }; 00226 00230 struct DlabelCapabilities 00231 { 00232 DlabelCapabilities() {} 00233 unsigned maxPrimary; 00234 bool extendedPossible; 00235 unsigned maxLogical; 00236 unsigned long long maxSectors; 00237 }; 00238 00239 00240 struct UsedByInfo 00241 { 00242 UsedByInfo(UsedByType type, const string& device) : type(type), device(device) {} 00243 UsedByType type; 00244 string device; 00245 }; 00246 00247 00248 struct ResizeInfo 00249 { 00250 ResizeInfo() : df_freeK(0), resize_freeK(0), usedK(0), resize_ok(false) {} 00251 unsigned long long df_freeK; 00252 unsigned long long resize_freeK; 00253 unsigned long long usedK; 00254 bool resize_ok; 00255 }; 00256 00257 00258 struct ContentInfo 00259 { 00260 ContentInfo() : windows(false), efi(false), homes(0) {} 00261 bool windows; 00262 bool efi; 00263 unsigned homes; 00264 }; 00265 00266 00270 struct ContainerInfo 00271 { 00272 ContainerInfo() {} 00273 CType type; 00274 string device; 00275 string name; 00276 string udevPath; 00277 string udevId; 00278 list<UsedByInfo> usedBy; 00279 UsedByType usedByType; // deprecated 00280 string usedByDevice; // deprecated 00281 bool readonly; 00282 }; 00283 00287 struct DiskInfo 00288 { 00289 DiskInfo() {} 00290 unsigned long long sizeK; 00291 unsigned long long cylSize; 00292 unsigned long cyl; 00293 unsigned long heads; 00294 unsigned long sectors; 00295 unsigned int sectorSize; 00296 string disklabel; 00297 unsigned maxPrimary; 00298 bool extendedPossible; 00299 unsigned maxLogical; 00300 bool initDisk; 00301 Transport transport; 00302 bool iscsi; // deprecated 00303 }; 00304 00308 struct LvmVgInfo 00309 { 00310 LvmVgInfo() {} 00311 unsigned long long sizeK; 00312 unsigned long long peSizeK; 00313 unsigned long peCount; 00314 unsigned long peFree; 00315 string uuid; 00316 bool lvm2; 00317 bool create; 00318 string devices; 00319 string devices_add; 00320 string devices_rem; 00321 }; 00322 00326 struct DmPartCoInfo 00327 { 00328 DmPartCoInfo() {} 00329 DiskInfo d; 00330 string devices; 00331 unsigned long minor; 00332 }; 00333 00334 struct DmraidCoInfo 00335 { 00336 DmraidCoInfo() {} 00337 DmPartCoInfo p; 00338 }; 00339 00340 struct DmmultipathCoInfo 00341 { 00342 DmmultipathCoInfo() {} 00343 DmPartCoInfo p; 00344 string vendor; 00345 string model; 00346 }; 00347 00351 struct VolumeInfo 00352 { 00353 VolumeInfo() {} 00354 unsigned long long sizeK; 00355 unsigned long major; 00356 unsigned long minor; 00357 string name; 00358 string device; 00359 string mount; 00360 string crypt_device; 00361 MountByType mount_by; 00362 string udevPath; 00363 string udevId; 00364 list<UsedByInfo> usedBy; 00365 UsedByType usedByType; // deprecated 00366 string usedByDevice; // deprecated 00367 bool ignore_fstab; 00368 string fstab_options; 00369 string uuid; 00370 string label; 00371 string mkfs_options; 00372 string tunefs_options; 00373 string loop; 00374 string dtxt; 00375 EncryptType encryption; 00376 string crypt_pwd; 00377 FsType fs; 00378 FsType detected_fs; 00379 bool format; 00380 bool create; 00381 bool is_mounted; 00382 bool resize; 00383 bool ignore_fs; 00384 unsigned long long origSizeK; 00385 }; 00386 00387 struct PartitionAddInfo 00388 { 00389 PartitionAddInfo() {} 00390 unsigned nr; 00391 unsigned long cylStart; 00392 unsigned long cylSize; 00393 PartitionType partitionType; 00394 unsigned id; 00395 bool boot; 00396 }; 00397 00401 struct PartitionInfo 00402 { 00403 PartitionInfo() {} 00404 PartitionInfo& operator=( const PartitionAddInfo& rhs ); 00405 VolumeInfo v; 00406 unsigned nr; 00407 unsigned long cylStart; 00408 unsigned long cylSize; 00409 PartitionType partitionType; 00410 unsigned id; 00411 bool boot; 00412 }; 00413 00417 struct LvmLvInfo 00418 { 00419 LvmLvInfo() {} 00420 VolumeInfo v; 00421 unsigned stripes; 00422 unsigned stripeSizeK; 00423 string uuid; 00424 string status; 00425 string allocation; 00426 string dm_table; 00427 string dm_target; 00428 string origin; 00429 unsigned long long sizeK; 00430 }; 00431 00435 struct LvmLvSnapshotStateInfo 00436 { 00437 LvmLvSnapshotStateInfo() {} 00438 bool active; 00439 double allocated; 00440 }; 00441 00445 struct MdInfo 00446 { 00447 MdInfo() {} 00448 VolumeInfo v; 00449 unsigned nr; 00450 unsigned type; 00451 unsigned parity; 00452 string uuid; 00453 string sb_ver; 00454 unsigned long chunkSizeK; 00455 string devices; 00456 string spares; 00457 }; 00458 00462 struct MdStateInfo 00463 { 00464 MdStateInfo() {} 00465 MdArrayState state; 00466 }; 00467 00472 struct MdPartCoInfo 00473 { 00474 MdPartCoInfo() {} 00475 DiskInfo d; 00476 unsigned type; // RAID level 00477 unsigned nr; // MD device number 00478 unsigned parity; // Parity (not for all RAID level) 00479 string uuid; // MD Device UUID 00480 string sb_ver; // Metadata version 00481 unsigned long chunkSizeK; // Chunksize (strip size) 00482 string devices; 00483 string spares; 00484 }; 00485 00486 struct MdPartCoStateInfo 00487 { 00488 MdPartCoStateInfo() {} 00489 MdArrayState state; 00490 }; 00491 00495 struct MdPartInfo 00496 { 00497 MdPartInfo() {} 00498 VolumeInfo v; 00499 PartitionAddInfo p; 00500 bool part; 00501 }; 00502 00506 struct NfsInfo 00507 { 00508 NfsInfo() {} 00509 VolumeInfo v; 00510 }; 00511 00515 struct LoopInfo 00516 { 00517 LoopInfo() {} 00518 VolumeInfo v; 00519 bool reuseFile; 00520 unsigned nr; 00521 string file; 00522 }; 00523 00527 struct DmInfo 00528 { 00529 DmInfo() {} 00530 VolumeInfo v; 00531 unsigned nr; 00532 string table; 00533 string target; 00534 }; 00535 00539 struct DmPartInfo 00540 { 00541 DmPartInfo() {} 00542 VolumeInfo v; 00543 PartitionAddInfo p; 00544 bool part; 00545 string table; 00546 string target; 00547 }; 00548 00552 struct DmraidInfo 00553 { 00554 DmraidInfo() {} 00555 DmPartInfo p; 00556 }; 00557 00561 struct DmmultipathInfo 00562 { 00563 DmmultipathInfo() {} 00564 DmPartInfo p; 00565 }; 00566 00570 struct ContVolInfo 00571 { 00572 ContVolInfo() : ctype(CUNKNOWN) {} 00573 CType ctype; 00574 string cname; 00575 string cdevice; 00576 string vname; 00577 string vdevice; 00578 }; 00579 00583 struct PartitionSlotInfo 00584 { 00585 PartitionSlotInfo() {} 00586 unsigned long cylStart; 00587 unsigned long cylSize; 00588 bool primarySlot; 00589 bool primaryPossible; 00590 bool extendedSlot; 00591 bool extendedPossible; 00592 bool logicalSlot; 00593 bool logicalPossible; 00594 }; 00595 00599 struct CommitInfo 00600 { 00601 CommitInfo() {} 00602 bool destructive; 00603 string text; 00604 }; 00605 00606 00610 enum ErrorCodes 00611 { 00612 STORAGE_NO_ERROR = 0, 00613 00614 DISK_PARTITION_OVERLAPS_EXISTING = -1000, 00615 DISK_PARTITION_EXCEEDS_DISK = -1001, 00616 DISK_CREATE_PARTITION_EXT_ONLY_ONCE = -1002, 00617 DISK_CREATE_PARTITION_EXT_IMPOSSIBLE = -1003, 00618 DISK_PARTITION_NO_FREE_NUMBER = -1004, 00619 DISK_CREATE_PARTITION_INVALID_VOLUME = -1005, 00620 DISK_CREATE_PARTITION_INVALID_TYPE = -1006, 00621 DISK_CREATE_PARTITION_PARTED_FAILED = -1007, 00622 DISK_PARTITION_NOT_FOUND = -1008, 00623 DISK_CREATE_PARTITION_LOGICAL_NO_EXT = -1009, 00624 DISK_PARTITION_LOGICAL_OUTSIDE_EXT = -1010, 00625 DISK_SET_TYPE_INVALID_VOLUME = -1011, 00626 DISK_SET_TYPE_PARTED_FAILED = -1012, 00627 DISK_SET_LABEL_PARTED_FAILED = -1013, 00628 DISK_REMOVE_PARTITION_PARTED_FAILED = -1014, 00629 DISK_REMOVE_PARTITION_INVALID_VOLUME = -1015, 00630 DISK_REMOVE_PARTITION_LIST_ERASE = -1016, 00631 DISK_DESTROY_TABLE_INVALID_LABEL = -1017, 00632 DISK_PARTITION_ZERO_SIZE = -1018, 00633 DISK_CHANGE_READONLY = -1019, 00634 DISK_RESIZE_PARTITION_INVALID_VOLUME = -1020, 00635 DISK_RESIZE_PARTITION_PARTED_FAILED = -1021, 00636 DISK_RESIZE_NO_SPACE = -1022, 00637 DISK_CHECK_RESIZE_INVALID_VOLUME = -1023, 00638 DISK_REMOVE_PARTITION_CREATE_NOT_FOUND = -1024, 00639 DISK_COMMIT_NOTHING_TODO = -1025, 00640 DISK_CREATE_PARTITION_NO_SPACE = -1026, 00641 DISK_REMOVE_USED_BY = -1027, 00642 DISK_INIT_NOT_POSSIBLE = -1028, 00643 DISK_INVALID_PARTITION_ID = -1029, 00644 00645 STORAGE_DISK_NOT_FOUND = -2000, 00646 STORAGE_VOLUME_NOT_FOUND = -2001, 00647 STORAGE_REMOVE_PARTITION_INVALID_CONTAINER = -2002, 00648 STORAGE_CHANGE_PARTITION_ID_INVALID_CONTAINER = -2003, 00649 STORAGE_CHANGE_READONLY = -2004, 00650 STORAGE_DISK_USED_BY = -2005, 00651 STORAGE_LVM_VG_EXISTS = -2006, 00652 STORAGE_LVM_VG_NOT_FOUND = -2007, 00653 STORAGE_LVM_INVALID_DEVICE = -2008, 00654 STORAGE_CONTAINER_NOT_FOUND = -2009, 00655 STORAGE_VG_INVALID_NAME = -2010, 00656 STORAGE_REMOVE_USED_VOLUME = -2011, 00657 STORAGE_REMOVE_USING_UNKNOWN_TYPE = -2012, 00658 STORAGE_NOT_YET_IMPLEMENTED = -2013, 00659 STORAGE_MD_INVALID_NAME = -2014, 00660 STORAGE_MD_NOT_FOUND = -2015, 00661 STORAGE_MEMORY_EXHAUSTED = -2016, 00662 STORAGE_LOOP_NOT_FOUND = -2017, 00663 STORAGE_CREATED_LOOP_NOT_FOUND = -2018, 00664 STORAGE_CHANGE_AREA_INVALID_CONTAINER = -2023, 00665 STORAGE_BACKUP_STATE_NOT_FOUND = -2024, 00666 STORAGE_INVALID_FSTAB_VALUE = -2025, 00667 STORAGE_NO_FSTAB_PTR = -2026, 00668 STORAGE_DEVICE_NODE_NOT_FOUND = -2027, 00669 STORAGE_DMRAID_CO_NOT_FOUND = -2028, 00670 STORAGE_RESIZE_INVALID_CONTAINER = -2029, 00671 STORAGE_DMMULTIPATH_CO_NOT_FOUND = -2030, 00672 STORAGE_ZERO_DEVICE_FAILED = -2031, 00673 STORAGE_INVALID_BACKUP_STATE_NAME = -2032, 00674 STORAGE_MDPART_CO_NOT_FOUND = -2033, 00675 STORAGE_DEVICE_NOT_FOUND = -2034, 00676 00677 VOLUME_COMMIT_UNKNOWN_STAGE = -3000, 00678 VOLUME_FSTAB_EMPTY_MOUNT = -3001, 00679 VOLUME_UMOUNT_FAILED = -3002, 00680 VOLUME_MOUNT_FAILED = -3003, 00681 VOLUME_FORMAT_UNKNOWN_FS = -3005, 00682 VOLUME_FORMAT_FS_UNDETECTED = -3006, 00683 VOLUME_FORMAT_FS_TOO_SMALL = -3007, 00684 VOLUME_FORMAT_FAILED = -3008, 00685 VOLUME_TUNE2FS_FAILED = -3009, 00686 VOLUME_MKLABEL_FS_UNABLE = -3010, 00687 VOLUME_MKLABEL_FAILED = -3011, 00688 VOLUME_LOSETUP_NO_LOOP = -3012, 00689 VOLUME_LOSETUP_FAILED = -3013, 00690 VOLUME_CRYPT_NO_PWD = -3014, 00691 VOLUME_CRYPT_PWD_TOO_SHORT = -3015, 00692 VOLUME_CRYPT_NOT_DETECTED = -3016, 00693 VOLUME_FORMAT_EXTENDED_UNSUPPORTED = -3017, 00694 VOLUME_MOUNT_EXTENDED_UNSUPPORTED = -3018, 00695 VOLUME_MOUNT_POINT_INVALID = -3019, 00696 VOLUME_MOUNTBY_NOT_ENCRYPTED = -3020, 00697 VOLUME_MOUNTBY_UNSUPPORTED_BY_FS = -3021, 00698 VOLUME_LABEL_NOT_SUPPORTED = -3022, 00699 VOLUME_LABEL_TOO_LONG = -3023, 00700 VOLUME_LABEL_WHILE_MOUNTED = -3024, 00701 VOLUME_RESIZE_UNSUPPORTED_BY_FS = -3025, 00702 VOLUME_RESIZE_UNSUPPORTED_BY_CONTAINER = -3026, 00703 VOLUME_RESIZE_FAILED = -3027, 00704 VOLUME_ALREADY_IN_USE = -3028, 00705 VOLUME_LOUNSETUP_FAILED = -3029, 00706 VOLUME_DEVICE_NOT_PRESENT = -3030, 00707 VOLUME_DEVICE_NOT_BLOCK = -3031, 00708 VOLUME_MOUNTBY_UNSUPPORTED_BY_VOLUME = -3032, 00709 VOLUME_CRYPTFORMAT_FAILED = -3033, 00710 VOLUME_CRYPTSETUP_FAILED = -3034, 00711 VOLUME_CRYPTUNSETUP_FAILED = -3035, 00712 VOLUME_FORMAT_NOT_IMPLEMENTED = -3036, 00713 VOLUME_FORMAT_NFS_IMPOSSIBLE = -3037, 00714 VOLUME_CRYPT_NFS_IMPOSSIBLE = -3038, 00715 VOLUME_REMOUNT_FAILED = -3039, 00716 VOLUME_TUNEREISERFS_FAILED = -3040, 00717 VOLUME_UMOUNT_NOT_MOUNTED = -3041, 00718 00719 LVM_CREATE_PV_FAILED = -4000, 00720 LVM_PV_ALREADY_CONTAINED = -4001, 00721 LVM_PV_DEVICE_UNKNOWN = -4002, 00722 LVM_PV_DEVICE_USED = -4003, 00723 LVM_VG_HAS_NONE_PV = -4004, 00724 LVM_LV_INVALID_NAME = -4005, 00725 LVM_LV_DUPLICATE_NAME = -4006, 00726 LVM_LV_NO_SPACE = -4007, 00727 LVM_LV_UNKNOWN_NAME = -4008, 00728 LVM_LV_NOT_IN_LIST = -4009, 00729 LVM_VG_CREATE_FAILED = -4010, 00730 LVM_VG_EXTEND_FAILED = -4011, 00731 LVM_VG_REDUCE_FAILED = -4012, 00732 LVM_VG_REMOVE_FAILED = -4013, 00733 LVM_LV_CREATE_FAILED = -4014, 00734 LVM_LV_REMOVE_FAILED = -4015, 00735 LVM_LV_RESIZE_FAILED = -4016, 00736 LVM_PV_STILL_ADDED = -4017, 00737 LVM_PV_REMOVE_NOT_FOUND = -4018, 00738 LVM_CREATE_LV_INVALID_VOLUME = -4019, 00739 LVM_REMOVE_LV_INVALID_VOLUME = -4020, 00740 LVM_RESIZE_LV_INVALID_VOLUME = -4021, 00741 LVM_CHANGE_READONLY = -4022, 00742 LVM_CHECK_RESIZE_INVALID_VOLUME = -4023, 00743 LVM_COMMIT_NOTHING_TODO = -4024, 00744 LVM_LV_REMOVE_USED_BY = -4025, 00745 LVM_LV_ALREADY_ON_DISK = -4026, 00746 LVM_LV_NO_STRIPE_SIZE = -4027, 00747 LVM_LV_UNKNOWN_ORIGIN = -4028, 00748 LVM_LV_NOT_ON_DISK = -4029, 00749 LVM_LV_NOT_SNAPSHOT = -4030, 00750 LVM_LV_HAS_SNAPSHOTS = -4031, 00751 LVM_LV_IS_SNAPSHOT = -4032, 00752 00753 FSTAB_ENTRY_NOT_FOUND = -5000, 00754 FSTAB_CHANGE_PREFIX_IMPOSSIBLE = -5001, 00755 FSTAB_REMOVE_ENTRY_NOT_FOUND = -5002, 00756 FSTAB_UPDATE_ENTRY_NOT_FOUND = -5003, 00757 FSTAB_ADD_ENTRY_FOUND = -5004, 00758 00759 MD_CHANGE_READONLY = -6000, 00760 MD_DUPLICATE_NUMBER = -6001, 00761 MD_TOO_FEW_DEVICES = -6002, 00762 MD_DEVICE_UNKNOWN = -6003, 00763 MD_DEVICE_USED = -6004, 00764 MD_CREATE_INVALID_VOLUME = -6005, 00765 MD_REMOVE_FAILED = -6006, 00766 MD_NOT_IN_LIST = -6007, 00767 MD_CREATE_FAILED = -6008, 00768 MD_UNKNOWN_NUMBER = -6009, 00769 MD_REMOVE_USED_BY = -6010, 00770 MD_NUMBER_TOO_LARGE = -6011, 00771 MD_REMOVE_INVALID_VOLUME = -6012, 00772 MD_REMOVE_CREATE_NOT_FOUND = -6013, 00773 MD_NO_RESIZE_ON_DISK = -6014, 00774 MD_ADD_DUPLICATE = -6015, 00775 MD_REMOVE_NONEXISTENT = -6016, 00776 MD_NO_CHANGE_ON_DISK = -6017, 00777 MD_NO_CREATE_UNKNOWN = -6018, 00778 MD_STATE_NOT_ON_DISK = -6019, 00779 MD_PARTITION_NOT_FOUND = -6020, 00780 MD_INVALID_PARITY = -6021, 00781 MD_TOO_MANY_SPARES = -6022, 00782 MD_GET_STATE_FAILED = -6023, 00783 00784 MDPART_CHANGE_READONLY = -6100, 00785 MDPART_INTERNAL_ERR = -6101, 00786 MDPART_INVALID_VOLUME = -6012, 00787 MDPART_PARTITION_NOT_FOUND = -6103, 00788 MDPART_REMOVE_PARTITION_LIST_ERASE = -6104, 00789 MDPART_COMMIT_NOTHING_TODO = -6105, 00790 MDPART_NO_REMOVE = -6106, 00791 MDPART_DEVICE_NOT_FOUND = -6107, 00792 00793 LOOP_CHANGE_READONLY = -7000, 00794 LOOP_DUPLICATE_FILE = -7001, 00795 LOOP_UNKNOWN_FILE = -7002, 00796 LOOP_REMOVE_USED_BY = -7003, 00797 LOOP_FILE_CREATE_FAILED = -7004, 00798 LOOP_CREATE_INVALID_VOLUME = -7005, 00799 LOOP_REMOVE_FILE_FAILED = -7006, 00800 LOOP_REMOVE_INVALID_VOLUME = -7007, 00801 LOOP_NOT_IN_LIST = -7008, 00802 LOOP_REMOVE_CREATE_NOT_FOUND = -7009, 00803 LOOP_MODIFY_EXISTING = -7010, 00804 00805 PEC_PE_SIZE_INVALID = -9000, 00806 PEC_PV_NOT_FOUND = -9001, 00807 PEC_REMOVE_PV_IN_USE = -9002, 00808 PEC_REMOVE_PV_SIZE_NEEDED = -9003, 00809 PEC_LV_NO_SPACE_STRIPED = -9004, 00810 PEC_LV_NO_SPACE_SINGLE = -9005, 00811 PEC_LV_PE_DEV_NOT_FOUND = -9006, 00812 00813 DM_CHANGE_READONLY = -10000, 00814 DM_UNKNOWN_TABLE = -10001, 00815 DM_REMOVE_USED_BY = -10002, 00816 DM_REMOVE_CREATE_NOT_FOUND = -10003, 00817 DM_REMOVE_INVALID_VOLUME = -10004, 00818 DM_REMOVE_FAILED = -10005, 00819 DM_NOT_IN_LIST = -10006, 00820 00821 DASD_NOT_POSSIBLE = -11000, 00822 DASD_FDASD_FAILED = -11001, 00823 DASD_DASDFMT_FAILED = -11002, 00824 00825 DMPART_CHANGE_READONLY = -12001, 00826 DMPART_INTERNAL_ERR = -12002, 00827 DMPART_INVALID_VOLUME = -12003, 00828 DMPART_PARTITION_NOT_FOUND = -12004, 00829 DMPART_REMOVE_PARTITION_LIST_ERASE = -12005, 00830 DMPART_COMMIT_NOTHING_TODO = -12006, 00831 DMPART_NO_REMOVE = -12007, 00832 00833 DMRAID_REMOVE_FAILED = -13001, 00834 00835 NFS_VOLUME_NOT_FOUND = -14001, 00836 NFS_CHANGE_READONLY = -14002, 00837 NFS_REMOVE_VOLUME_CREATE_NOT_FOUND = -14003, 00838 NFS_REMOVE_VOLUME_LIST_ERASE = -14004, 00839 NFS_REMOVE_INVALID_VOLUME = -14005, 00840 00841 CONTAINER_INTERNAL_ERROR = -99000, 00842 CONTAINER_INVALID_VIRTUAL_CALL = -99001, 00843 00844 }; 00845 00846 00850 class StorageInterface 00851 { 00852 public: 00853 00854 StorageInterface () {} 00855 virtual ~StorageInterface () {} 00856 00860 virtual void getContainers( deque<ContainerInfo>& infos) = 0; 00861 00869 virtual int getDiskInfo( const string& disk, DiskInfo& info) = 0; 00870 00879 virtual int getContDiskInfo( const string& disk, ContainerInfo& cinfo, 00880 DiskInfo& info ) = 0; 00881 00889 virtual int getLvmVgInfo( const string& name, LvmVgInfo& info) = 0; 00890 00899 virtual int getContLvmVgInfo( const string& name, ContainerInfo& cinfo, 00900 LvmVgInfo& info) = 0; 00901 00909 virtual int getDmraidCoInfo( const string& name, DmraidCoInfo& info) = 0; 00910 00919 virtual int getContDmraidCoInfo( const string& name, ContainerInfo& cinfo, 00920 DmraidCoInfo& info) = 0; 00921 00929 virtual int getDmmultipathCoInfo( const string& name, DmmultipathCoInfo& info) = 0; 00930 00939 virtual int getContDmmultipathCoInfo( const string& name, ContainerInfo& cinfo, 00940 DmmultipathCoInfo& info) = 0; 00941 00949 virtual int getMdPartCoInfo( const string& name, MdPartCoInfo& info) = 0; 00950 00951 00960 virtual int getContMdPartCoInfo( const string& name, ContainerInfo& cinfo, 00961 MdPartCoInfo& info) = 0; 00962 00968 virtual void setImsmDriver(ImsmDriver driver) = 0; 00969 00975 virtual ImsmDriver getImsmDriver() const = 0; 00976 00982 virtual void getVolumes( deque<VolumeInfo>& infos) = 0; 00983 00991 virtual int getVolume( const string& device, VolumeInfo& info) = 0; 00992 01000 virtual int getPartitionInfo( const string& disk, 01001 deque<PartitionInfo>& plist ) = 0; 01002 01010 virtual int getLvmLvInfo( const string& name, 01011 deque<LvmLvInfo>& plist ) = 0; 01012 01019 virtual int getMdInfo( deque<MdInfo>& plist ) = 0; 01020 01028 virtual int getMdPartInfo( const string& device, 01029 deque<MdPartInfo>& plist ) = 0; 01030 01037 virtual int getNfsInfo( deque<NfsInfo>& plist ) = 0; 01038 01045 virtual int getLoopInfo( deque<LoopInfo>& plist ) = 0; 01046 01053 virtual int getDmInfo( deque<DmInfo>& plist ) = 0; 01054 01062 virtual int getDmraidInfo( const string& name, 01063 deque<DmraidInfo>& plist ) = 0; 01064 01072 virtual int getDmmultipathInfo( const string& name, 01073 deque<DmmultipathInfo>& plist ) = 0; 01074 01078 virtual bool getFsCapabilities (FsType fstype, FsCapabilities& fscapabilities) const = 0; 01079 01083 virtual bool getDlabelCapabilities(const string& dlabel, 01084 DlabelCapabilities& dlabelcapabilities) const = 0; 01085 01089 virtual list<string> getAllUsedFs() const = 0; 01090 01103 virtual int createPartition( const string& disk, PartitionType type, 01104 unsigned long startCyl, 01105 unsigned long sizeCyl, 01106 string& device ) = 0; 01107 01116 virtual int resizePartition( const string& device, 01117 unsigned long sizeCyl ) = 0; 01118 01127 virtual int resizePartitionNoFs( const string& device, 01128 unsigned long sizeCyl ) = 0; 01129 01140 virtual int updatePartitionArea( const string& device, 01141 unsigned long startCyl, 01142 unsigned long sizeCyl ) = 0; 01143 01152 virtual int freeCylindersAroundPartition(const string& device, unsigned long& freeCylsBefore, 01153 unsigned long& freeCylsAfter) = 0; 01154 01164 virtual int nextFreePartition( const string& disk, PartitionType type, 01165 unsigned &nr, string& device ) = 0; 01166 01179 virtual int createPartitionKb( const string& disk, PartitionType type, 01180 unsigned long long startK, 01181 unsigned long long sizeK, 01182 string& device ) = 0; 01183 01194 virtual int createPartitionAny( const string& disk, 01195 unsigned long long sizeK, 01196 string& device ) = 0; 01197 01208 virtual int createPartitionMax( const string& disk, PartitionType type, 01209 string& device ) = 0; 01210 01218 virtual unsigned long long cylinderToKb( const string& disk, 01219 unsigned long sizeCyl) = 0; 01220 01228 virtual unsigned long kbToCylinder( const string& disk, 01229 unsigned long long sizeK) = 0; 01230 01237 virtual int removePartition (const string& partition) = 0; 01238 01246 virtual int changePartitionId (const string& partition, unsigned id) = 0; 01247 01254 virtual int forgetChangePartitionId (const string& partition ) = 0; 01255 01263 virtual string getPartitionPrefix(const string& disk) = 0; 01264 01273 virtual string getPartitionName(const string& disk, int partition_no) = 0; 01274 01282 virtual int getUnusedPartitionSlots(const string& disk, list<PartitionSlotInfo>& slots) = 0; 01283 01292 virtual int destroyPartitionTable (const string& disk, const string& label) = 0; 01293 01304 virtual int initializeDisk( const string& disk, bool value ) = 0; 01305 01314 virtual string defaultDiskLabel(const string& device) = 0; 01315 01324 virtual int changeFormatVolume( const string& device, bool format, FsType fs ) = 0; 01325 01333 virtual int changeLabelVolume( const string& device, const string& label ) = 0; 01334 01342 virtual int changeMkfsOptVolume( const string& device, const string& opts ) = 0; 01343 01351 virtual int changeTunefsOptVolume( const string& device, const string& opts ) = 0; 01352 01361 virtual int changeMountPoint( const string& device, const string& mount ) = 0; 01362 01370 virtual int getMountPoint( const string& device, string& mount ) = 0; 01371 01379 virtual int changeMountBy( const string& device, MountByType mby ) = 0; 01380 01388 #ifndef SWIG 01389 virtual int getMountBy( const string& device, MountByType& mby ) = 0; 01390 #else 01391 virtual int getMountBy( const string& device, MountByType& REFERENCE ) = 0; 01392 #endif 01393 01403 virtual int changeFstabOptions( const string& device, const string& options ) = 0; 01404 01413 virtual int getFstabOptions( const string& device, string& options ) = 0; 01414 01423 virtual int addFstabOptions( const string& device, const string& options ) = 0; 01424 01434 virtual int removeFstabOptions( const string& device, const string& options ) = 0; 01435 01443 virtual int setCryptPassword( const string& device, const string& pwd ) = 0; 01444 01451 virtual int forgetCryptPassword( const string& device ) = 0; 01452 01460 virtual int getCryptPassword( const string& device, string& pwd ) = 0; 01461 01470 virtual int verifyCryptPassword( const string& device, 01471 const string& pwd, bool erase ) = 0; 01472 01479 virtual bool needCryptPassword( const string& device ) = 0; 01480 01488 virtual int setCrypt( const string& device, bool val ) = 0; 01489 01498 virtual int setCryptType( const string& device, bool val, EncryptType typ ) = 0; 01499 01507 #ifndef SWIG 01508 virtual int getCrypt( const string& device, bool& val ) = 0; 01509 #else 01510 virtual int getCrypt( const string& device, bool& REFERENCE ) = 0; 01511 #endif 01512 01522 virtual int setIgnoreFstab( const string& device, bool val ) = 0; 01523 01531 #ifndef SWIG 01532 virtual int getIgnoreFstab( const string& device, bool& val ) = 0; 01533 #else 01534 virtual int getIgnoreFstab( const string& device, bool& REFERENCE ) = 0; 01535 #endif 01536 01546 virtual int changeDescText( const string& device, const string& txt ) = 0; 01547 01562 virtual int addFstabEntry( const string& device, const string& mount, 01563 const string& vfs, const string& options, 01564 unsigned freq, unsigned passno ) = 0; 01565 01566 01574 virtual int resizeVolume(const string& device, unsigned long long newSizeK) = 0; 01575 01583 virtual int resizeVolumeNoFs(const string& device, unsigned long long newSizeK) = 0; 01584 01591 virtual int forgetResizeVolume( const string& device ) = 0; 01592 01607 virtual void setRecursiveRemoval( bool val ) = 0; 01608 01614 virtual bool getRecursiveRemoval() const = 0; 01615 01624 virtual int getRecursiveUsing(const string& device, list<string>& devices) = 0; 01625 01639 virtual void setZeroNewPartitions( bool val ) = 0; 01640 01646 virtual bool getZeroNewPartitions() const = 0; 01647 01659 virtual void setPartitionAlignment( PartAlign val ) = 0; 01660 01666 virtual PartAlign getPartitionAlignment() const = 0; 01667 01673 virtual void setDefaultMountBy( MountByType val ) = 0; 01674 01680 virtual MountByType getDefaultMountBy() const = 0; 01681 01687 virtual void setDefaultFs(FsType val) = 0; 01688 01694 virtual FsType getDefaultFs() const = 0; 01695 01701 virtual bool getEfiBoot() = 0; 01702 01713 virtual void setRootPrefix( const string& root ) = 0; 01714 01720 virtual string getRootPrefix() const = 0; 01721 01727 virtual void setDetectMountedVolumes( bool val ) = 0; 01728 01734 virtual bool getDetectMountedVolumes() const = 0; 01735 01743 virtual int removeVolume( const string& device ) = 0; 01744 01755 virtual int createLvmVg( const string& name, 01756 unsigned long long peSizeK, bool lvm1, 01757 const deque<string>& devs ) = 0; 01758 01766 virtual int removeLvmVg( const string& name ) = 0; 01767 01775 virtual int extendLvmVg( const string& name, 01776 const deque<string>& devs ) = 0; 01777 01785 virtual int shrinkLvmVg( const string& name, 01786 const deque<string>& devs ) = 0; 01787 01799 virtual int createLvmLv( const string& vg, const string& name, 01800 unsigned long long sizeK, unsigned stripes, 01801 string& device ) = 0; 01802 01809 virtual int removeLvmLvByDevice( const string& device ) = 0; 01810 01818 virtual int removeLvmLv( const string& vg, const string& name ) = 0; 01819 01829 virtual int changeLvStripeCount( const string& vg, const string& name, 01830 unsigned long stripes ) = 0; 01831 01841 virtual int changeLvStripeSize( const string& vg, const string& name, 01842 unsigned long long stripeSizeK) = 0; 01843 01854 virtual int createLvmLvSnapshot(const string& vg, const string& origin, 01855 const string& name, unsigned long long cowSizeK, 01856 string& device) = 0; 01857 01865 virtual int removeLvmLvSnapshot(const string& vg, const string& name) = 0; 01866 01877 virtual int getLvmLvSnapshotStateInfo(const string& vg, const string& name, 01878 LvmLvSnapshotStateInfo& info) = 0; 01879 01887 virtual int nextFreeMd(unsigned& nr, string &device) = 0; 01888 01898 virtual int createMd(const string& name, MdType md_type, const list<string>& devices, 01899 const list<string>& spares) = 0; 01900 01910 virtual int createMdAny(MdType md_type, const list<string>& devices, 01911 const list<string>& spares, string& device) = 0; 01912 01921 virtual int removeMd( const string& name, bool destroySb ) = 0; 01922 01932 virtual int extendMd(const string& name, const list<string>& devices, 01933 const list<string>& spares) = 0; 01934 01944 virtual int shrinkMd(const string& name, const list<string>& devices, 01945 const list<string>& spares) = 0; 01946 01955 virtual int changeMdType(const string& name, MdType md_type) = 0; 01956 01965 virtual int changeMdChunk(const string& name, unsigned long chunkSizeK) = 0; 01966 01975 virtual int changeMdParity( const string& name, MdParity ptype ) = 0; 01976 01983 virtual int checkMd( const string& name ) = 0; 01984 01994 virtual int getMdStateInfo(const string& name, MdStateInfo& info) = 0; 01995 02005 virtual int getMdPartCoStateInfo(const string& name, 02006 MdPartCoStateInfo& info) = 0; 02007 02020 virtual int computeMdSize(MdType md_type, const list<string>& devices, 02021 const list<string>& spares, unsigned long long& sizeK) = 0; 02022 02030 virtual list<int> getMdAllowedParity(MdType md_type, unsigned devnr) = 0; 02031 02042 virtual int removeMdPartCo(const string& name, bool destroySb ) = 0; 02043 02054 virtual int addNfsDevice(const string& nfsDev, const string& opts, 02055 unsigned long long sizeK, const string& mp, 02056 bool nfs4) = 0; 02057 02067 virtual int checkNfsDevice(const string& nfsDev, const string& opts, 02068 bool nfs4, unsigned long long& sizeK) = 0; 02069 02086 virtual int createFileLoop( const string& lname, bool reuseExisting, 02087 unsigned long long sizeK, 02088 const string& mp, const string& pwd, 02089 string& device ) = 0; 02090 02108 virtual int modifyFileLoop( const string& device, const string& lname, 02109 bool reuseExisting, 02110 unsigned long long sizeK ) = 0; 02111 02120 virtual int removeFileLoop( const string& lname, bool removeFile ) = 0; 02121 02128 virtual int removeDmraid( const string& name ) = 0; 02129 02135 virtual void getCommitInfos(list<CommitInfo>& infos) const = 0; 02136 02142 virtual const string& getLastAction() const = 0; 02143 02150 virtual const string& getExtendedErrorMessage() const = 0; 02151 02152 // temporarily disable callback function for swig 02153 #ifndef SWIG 02154 02160 virtual void setCallbackProgressBar(CallbackProgressBar pfnc) = 0; 02161 02167 virtual CallbackProgressBar getCallbackProgressBar() const = 0; 02168 02169 02175 virtual void setCallbackShowInstallInfo(CallbackShowInstallInfo pfnc) = 0; 02176 02182 virtual CallbackShowInstallInfo getCallbackShowInstallInfo() const = 0; 02183 02184 02191 virtual void setCallbackInfoPopup(CallbackInfoPopup pfnc) = 0; 02192 02199 virtual CallbackInfoPopup getCallbackInfoPopup() const = 0; 02200 02201 02208 virtual void setCallbackYesNoPopup(CallbackYesNoPopup pfnc) = 0; 02209 02216 virtual CallbackYesNoPopup getCallbackYesNoPopup() const = 0; 02217 02218 02224 virtual void setCallbackCommitErrorPopup(CallbackCommitErrorPopup pfnc) = 0; 02225 02231 virtual CallbackCommitErrorPopup getCallbackCommitErrorPopup() const = 0; 02232 02233 02239 virtual void setCallbackPasswordPopup(CallbackPasswordPopup pfnc) = 0; 02240 02247 virtual CallbackPasswordPopup getCallbackPasswordPopup() const = 0; 02248 02249 #endif 02250 02256 virtual void setCacheChanges (bool cache) = 0; 02257 02261 virtual bool isCacheChanges () const = 0; 02262 02267 virtual int commit() = 0; 02268 02272 virtual string getErrorString(int error) const = 0; 02273 02280 virtual int createBackupState( const string& name ) = 0; 02281 02288 virtual int restoreBackupState( const string& name ) = 0; 02289 02296 virtual bool checkBackupState(const string& name) const = 0; 02297 02306 virtual bool equalBackupStates(const string& lhs, const string& rhs, 02307 bool verbose_log) const = 0; 02308 02316 virtual int removeBackupState( const string& name ) = 0; 02317 02325 virtual bool checkDeviceMounted(const string& device, list<string>& mps) = 0; 02326 02336 virtual bool umountDevice( const string& device ) = 0; 02337 02348 virtual bool mountDevice( const string& device, const string& mp ) = 0; 02349 02360 virtual int activateEncryption( const string& device, bool on ) = 0; 02361 02373 virtual bool mountDeviceOpts( const string& device, const string& mp, 02374 const string& opts ) = 0; 02375 02387 virtual bool mountDeviceRo( const string& device, const string& mp, 02388 const string& opts ) = 0; 02389 02396 virtual bool checkDmMapsTo( const string& device ) = 0; 02397 02403 virtual void removeDmTableTo( const string& device ) = 0; 02404 02416 virtual bool getFreeInfo(const string& device, bool get_resize, ResizeInfo& resize_info, 02417 bool get_content, ContentInfo& content_info, bool use_cache) = 0; 02418 02426 virtual bool readFstab( const string& dir, deque<VolumeInfo>& infos) = 0; 02427 02437 virtual void activateHld( bool val ) = 0; 02438 02447 virtual void activateMultipath( bool val ) = 0; 02448 02457 virtual void rescanEverything() = 0; 02458 02467 virtual bool rescanCryptedObjects() = 0; 02468 02472 virtual void dumpObjectList() = 0; 02473 02477 virtual void dumpCommitInfos() const = 0; 02478 02488 virtual int getContVolInfo(const string& dev, ContVolInfo& info) = 0; 02489 02490 }; 02491 02492 02496 void initDefaultLogger(); 02497 02498 02502 struct Environment 02503 { 02504 Environment(bool readonly) : readonly(readonly), testmode(false), autodetect(true), 02505 instsys(false), logdir("/var/log/YaST2"), testdir("tmp") {} 02506 02507 bool readonly; 02508 bool testmode; 02509 bool autodetect; 02510 bool instsys; 02511 string logdir; 02512 string testdir; 02513 }; 02514 02515 02521 StorageInterface* createStorageInterface(const Environment& env); 02522 02523 02531 StorageInterface* createStorageInterfacePid(const Environment& env, int& locker_pid); 02532 02533 02537 void destroyStorageInterface(StorageInterface*); 02538 02539 } 02540 02541 02542 #endif