libstorage
/usr/src/packages/BUILD/storage/StorageInterface.h
00001 /*
00002  * Copyright (c) [2004-2015] Novell, Inc.
00003  * Copyright (c) [2015] SUSE LLC
00004  *
00005  * All Rights Reserved.
00006  *
00007  * This program is free software; you can redistribute it and/or modify it
00008  * under the terms of version 2 of the GNU General Public License as published
00009  * by the Free Software Foundation.
00010  *
00011  * This program is distributed in the hope that it will be useful, but WITHOUT
00012  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00013  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
00014  * more details.
00015  *
00016  * You should have received a copy of the GNU General Public License along
00017  * with this program; if not, contact Novell, Inc.
00018  *
00019  * To contact Novell about this file by physical or electronic mail, you may
00020  * find current contact information at www.novell.com.
00021  */
00022 
00023 
00024 #ifndef STORAGE_INTERFACE_H
00025 #define STORAGE_INTERFACE_H
00026 
00027 
00028 #include <string>
00029 #include <vector>
00030 #include <deque>
00031 #include <list>
00032 #include <map>
00033 
00034 using std::string;
00035 using std::vector;
00036 using std::deque;
00037 using std::list;
00038 using std::map;
00039 
00040 
00041 #include "storage/StorageVersion.h"
00042 #include "storage/StorageSwig.h"
00043 
00044 
00142 namespace storage
00143 {
00144     enum FsType { FSUNKNOWN, REISERFS, EXT2, EXT3, EXT4, BTRFS, VFAT, XFS, JFS, HFS, NTFS,
00145                   SWAP, HFSPLUS, NFS, NFS4, TMPFS, ISO9660, UDF, FSNONE };
00146 
00147     enum PartitionType { PRIMARY, EXTENDED, LOGICAL, PTYPE_ANY };
00148 
00149     enum MountByType { MOUNTBY_DEVICE, MOUNTBY_UUID, MOUNTBY_LABEL, MOUNTBY_ID, MOUNTBY_PATH };
00150 
00151     enum EncryptType { ENC_NONE, ENC_TWOFISH, ENC_TWOFISH_OLD,
00152                        ENC_TWOFISH256_OLD, ENC_LUKS, ENC_UNKNOWN };
00153 
00154     enum MdType { RAID_UNK, RAID0, RAID1, RAID5, RAID6, RAID10, MULTIPATH };
00155 
00156     enum MdParity { PAR_DEFAULT, LEFT_ASYMMETRIC, LEFT_SYMMETRIC,
00157                     RIGHT_ASYMMETRIC, RIGHT_SYMMETRIC, PAR_FIRST, PAR_LAST,
00158                     LEFT_ASYMMETRIC_6, LEFT_SYMMETRIC_6, RIGHT_ASYMMETRIC_6,
00159                     RIGHT_SYMMETRIC_6, PAR_FIRST_6,
00160                     PAR_NEAR_2, PAR_OFFSET_2, PAR_FAR_2,
00161                     PAR_NEAR_3, PAR_OFFSET_3, PAR_FAR_3 };
00162 
00163     enum MdArrayState { UNKNOWN, CLEAR, INACTIVE, SUSPENDED, READONLY, READ_AUTO,
00164                         CLEAN, ACTIVE, WRITE_PENDING, ACTIVE_IDLE };
00165 
00166     enum UsedByType { UB_NONE, UB_LVM, UB_MD, UB_MDPART, UB_DM, UB_DMRAID, UB_DMMULTIPATH, UB_BTRFS };
00167 
00168     enum CType { CUNKNOWN, DISK, MD, LOOP, LVM, DM, DMRAID, NFSC, DMMULTIPATH, MDPART, BTRFSC, TMPFSC };
00169 
00170     enum Transport { TUNKNOWN, SBP, ATA, FC, ISCSI, SAS, SATA, SPI, USB, FCOE };
00171 
00172     enum MultipathAutostart { MPAS_UNDECIDED, MPAS_ON, MPAS_OFF };
00173 
00174     enum PartAlign { ALIGN_OPTIMAL, ALIGN_CYLINDER };
00175 
00176 
00181     typedef void (*CallbackProgressBar)(const string& id, unsigned cur, unsigned max);
00182 
00187     typedef void (*CallbackShowInstallInfo)(const string& id);
00188 
00193     typedef void (*CallbackInfoPopup)(const string& text);
00194 
00201     typedef bool (*CallbackYesNoPopup)(const string& text);
00202 
00208     typedef bool (*CallbackCommitErrorPopup)(int error, const string& last_action,
00209                                              const string& extended_message);
00210 
00216     typedef bool (*CallbackPasswordPopup)(const string& device, int attempts, string& password);
00217 
00218 
00223     class CommitCallbacks
00224     {
00225     public:
00226 
00227         virtual ~CommitCallbacks() {}
00228 
00229         virtual void post_root_filesystem_create() const {}
00230         virtual void post_root_mount() const {}
00231         virtual void post_root_fstab_add() const {}
00232 
00233     };
00234 
00235 
00239     struct FsCapabilities
00240     {
00241         FsCapabilities() {}
00242         bool isExtendable;
00243         bool isExtendableWhileMounted;
00244         bool isReduceable;
00245         bool isReduceableWhileMounted;
00246         bool supportsUuid;
00247         bool supportsLabel;
00248         bool labelWhileMounted;
00249         unsigned int labelLength;
00250         bool canFormat;
00251         unsigned long long minimalFsSizeK;
00252     };
00253 
00257     struct DlabelCapabilities
00258     {
00259         DlabelCapabilities() {}
00260         unsigned maxPrimary;
00261         bool extendedPossible;
00262         unsigned maxLogical;
00263         unsigned long long maxSectors;
00264     };
00265 
00266 
00267     struct UsedByInfo
00268     {
00269         UsedByInfo() : type(UB_NONE) {} // only for swig bindings
00270         UsedByInfo(UsedByType type, const string& device) : type(type), device(device) {}
00271         UsedByType type;
00272         string device;
00273     };
00274 
00275 
00276     struct ResizeInfo
00277     {
00278         ResizeInfo() : df_freeK(0), resize_freeK(0), usedK(0), resize_ok(false) {}
00279         unsigned long long df_freeK;
00280         unsigned long long resize_freeK;
00281         unsigned long long usedK;
00282         bool resize_ok;
00283     };
00284 
00285 
00286     struct ContentInfo
00287     {
00288         ContentInfo() : windows(false), efi(false), homes(0) {}
00289         bool windows;
00290         bool efi;
00291         unsigned homes;
00292     };
00293 
00294 
00295     struct DeviceInfo
00296     {
00297         DeviceInfo() {}
00298 
00299         string device;
00300         string name;
00301 
00302         string udevPath;
00303         list<string> udevId;
00304 
00305         list<UsedByInfo> usedBy;
00306 
00307         map<string, string> userdata;
00308     };
00309 
00310 
00314     struct ContainerInfo : public DeviceInfo
00315     {
00316         ContainerInfo() {}
00317         CType type;
00318         bool readonly;
00319     };
00320 
00324     struct DiskInfo
00325     {
00326         DiskInfo() {}
00327         unsigned long long sizeK;
00328         unsigned long long cylSize;
00329         unsigned long cyl;
00330         unsigned long heads;
00331         unsigned long sectors;
00332         unsigned int sectorSize;
00333         string disklabel;
00334         string orig_disklabel;
00335         unsigned maxPrimary;
00336         bool extendedPossible;
00337         unsigned maxLogical;
00338         bool initDisk;
00339         Transport transport;
00340         bool has_fake_partition;
00341     };
00342 
00346     struct LvmVgInfo
00347     {
00348         LvmVgInfo() {}
00349         unsigned long long sizeK;
00350         unsigned long long peSizeK;
00351         unsigned long peCount;
00352         unsigned long peFree;
00353         string uuid;
00354         bool lvm2;
00355         bool create;
00356         list<string> devices;
00357         list<string> devices_add;
00358         list<string> devices_rem;
00359     };
00360 
00364     struct DmPartCoInfo
00365     {
00366         DmPartCoInfo() {}
00367         DiskInfo d;
00368         list<string> devices;
00369         unsigned long minor;
00370     };
00371 
00372     struct DmraidCoInfo
00373     {
00374         DmraidCoInfo() {}
00375         DmPartCoInfo p;
00376     };
00377 
00378     struct DmmultipathCoInfo
00379     {
00380         DmmultipathCoInfo() {}
00381         DmPartCoInfo p;
00382         string vendor;
00383         string model;
00384     };
00385 
00389     struct VolumeInfo : public DeviceInfo
00390     {
00391         VolumeInfo() {}
00392         unsigned long long sizeK;
00393         unsigned long major;
00394         unsigned long minor;
00395         string mount;
00396         string crypt_device;
00397         MountByType mount_by;
00398         bool ignore_fstab;
00399         string fstab_options;
00400         string uuid;
00401         string label;
00402         string mkfs_options;
00403         string tunefs_options;
00404         string loop;
00405         string dtxt;
00406         EncryptType encryption;
00407         string crypt_pwd;
00408         FsType fs;
00409         FsType detected_fs;
00410         bool format;
00411         bool create;
00412         bool is_mounted;
00413         bool resize;
00414         bool ignore_fs;
00415         unsigned long long origSizeK;
00416     };
00417 
00421     struct RegionInfo
00422     {
00423         RegionInfo() : start(0), len(0) {}
00424         RegionInfo(unsigned long long start, unsigned long long len) : start(start), len(len) {}
00425         unsigned long long start;
00426         unsigned long long len;
00427     };
00428 
00429     struct PartitionAddInfo
00430     {
00431         PartitionAddInfo() {}
00432         unsigned nr;
00433         RegionInfo cylRegion;
00434         PartitionType partitionType;
00435         unsigned id;
00436         bool boot;
00437     };
00438 
00442     struct PartitionInfo
00443     {
00444         PartitionInfo() {}
00445         PartitionInfo& operator=( const PartitionAddInfo& rhs );
00446         VolumeInfo v;
00447         unsigned nr;
00448         RegionInfo cylRegion;
00449         PartitionType partitionType;
00450         unsigned id;
00451         bool boot;
00452     };
00453 
00457     struct LvmLvInfo
00458     {
00459         LvmLvInfo() {}
00460         VolumeInfo v;
00461         unsigned stripes;
00462         unsigned stripeSizeK;
00463         string uuid;
00464         string status;
00465         string dm_table;
00466         string dm_target;
00467         string origin;
00468         string used_pool;
00469         bool pool;
00470     };
00471 
00475     struct LvmLvSnapshotStateInfo
00476     {
00477         LvmLvSnapshotStateInfo() {}
00478         bool active;
00479         double allocated;
00480     };
00481 
00485     struct MdInfo
00486     {
00487         MdInfo() {}
00488         VolumeInfo v;
00489         unsigned nr;
00490         unsigned type;
00491         unsigned parity;
00492         string uuid;
00493         string sb_ver;
00494         unsigned long chunkSizeK;
00495         list<string> devices;
00496         list<string> spares;
00497         bool inactive;
00498     };
00499 
00503     struct MdStateInfo
00504     {
00505         MdStateInfo() {}
00506         MdArrayState state;
00507     };
00508 
00513     struct MdPartCoInfo
00514     {
00515         MdPartCoInfo() {}
00516         DiskInfo d;
00517         unsigned type;        // RAID level
00518         unsigned nr;          // MD device number
00519         unsigned parity;      // Parity (not for all RAID level)
00520         string   uuid;        // MD Device UUID
00521         string   sb_ver;      // Metadata version
00522         unsigned long chunkSizeK;  // Chunksize (strip size)
00523         list<string> devices;
00524         list<string> spares;
00525     };
00526 
00527     struct MdPartCoStateInfo
00528     {
00529         MdPartCoStateInfo() {}
00530         MdArrayState state;
00531     };
00532 
00536     struct MdPartInfo
00537     {
00538         MdPartInfo() {}
00539         VolumeInfo v;
00540         PartitionAddInfo p;
00541         bool part;
00542     };
00543 
00547     struct NfsInfo
00548     {
00549         NfsInfo() {}
00550         VolumeInfo v;
00551     };
00552 
00556     struct LoopInfo
00557     {
00558         LoopInfo() {}
00559         VolumeInfo v;
00560         bool reuseFile;
00561         unsigned nr;
00562         string file;
00563     };
00564 
00565 
00569     struct SubvolumeInfo
00570     {
00571         SubvolumeInfo()
00572             : path(), nocow(false), created(false), deleted(false) {}
00573         SubvolumeInfo(const string& path, bool nocow, bool created, bool deleted)
00574             : path(path), nocow(nocow), created(created), deleted(deleted) {}
00575 
00576         string path;
00577         bool nocow;
00578 
00579         bool created;
00580         bool deleted;
00581     };
00582 
00583 
00587     struct BtrfsInfo
00588     {
00589         BtrfsInfo() {}
00590         VolumeInfo v;
00591         list<string> devices;
00592         list<string> devices_add;
00593         list<string> devices_rem;
00594         vector<SubvolumeInfo> subvolumes;
00595     };
00596 
00597 
00601     struct TmpfsInfo
00602     {
00603         TmpfsInfo() {}
00604         VolumeInfo v;
00605     };
00606 
00610     struct DmInfo
00611     {
00612         DmInfo() {}
00613         VolumeInfo v;
00614         unsigned nr;
00615         string table;
00616         string target;
00617     };
00618 
00622     struct DmPartInfo
00623     {
00624         DmPartInfo() {}
00625         VolumeInfo v;
00626         PartitionAddInfo p;
00627         bool part;
00628         string table;
00629         string target;
00630     };
00631 
00635     struct DmraidInfo
00636     {
00637         DmraidInfo() {}
00638         DmPartInfo p;
00639     };
00640 
00644     struct DmmultipathInfo
00645     {
00646         DmmultipathInfo() {}
00647         DmPartInfo p;
00648     };
00649 
00653     struct ContVolInfo
00654     {
00655         ContVolInfo() : ctype(CUNKNOWN), num(-1) {}
00656         CType ctype;
00657         string cname;
00658         string cdevice;
00659         string vname;
00660         string vdevice;
00661         int num;
00662     };
00663 
00667     struct PartitionSlotInfo
00668     {
00669         PartitionSlotInfo() {}
00670         RegionInfo cylRegion;
00671         unsigned nr;
00672         string device;
00673         bool primarySlot;
00674         bool primaryPossible;
00675         bool extendedSlot;
00676         bool extendedPossible;
00677         bool logicalSlot;
00678         bool logicalPossible;
00679     };
00680 
00684     struct CommitInfo
00685     {
00686         CommitInfo() {}
00687         bool destructive;
00688         string text;
00689     };
00690 
00691 
00695     enum ErrorCodes
00696     {
00697         STORAGE_NO_ERROR = 0,
00698 
00699         DISK_PARTITION_OVERLAPS_EXISTING = -1000,
00700         DISK_PARTITION_EXCEEDS_DISK = -1001,
00701         DISK_CREATE_PARTITION_EXT_ONLY_ONCE = -1002,
00702         DISK_CREATE_PARTITION_EXT_IMPOSSIBLE = -1003,
00703         DISK_PARTITION_NO_FREE_NUMBER = -1004,
00704         DISK_CREATE_PARTITION_INVALID_VOLUME = -1005,
00705         DISK_CREATE_PARTITION_INVALID_TYPE = -1006,
00706         DISK_CREATE_PARTITION_PARTED_FAILED = -1007,
00707         DISK_PARTITION_NOT_FOUND = -1008,
00708         DISK_CREATE_PARTITION_LOGICAL_NO_EXT = -1009,
00709         DISK_PARTITION_LOGICAL_OUTSIDE_EXT = -1010,
00710         DISK_SET_TYPE_INVALID_VOLUME = -1011,
00711         DISK_SET_TYPE_PARTED_FAILED = -1012,
00712         DISK_SET_LABEL_PARTED_FAILED = -1013,
00713         DISK_REMOVE_PARTITION_PARTED_FAILED = -1014,
00714         DISK_REMOVE_PARTITION_INVALID_VOLUME = -1015,
00715         DISK_REMOVE_PARTITION_LIST_ERASE = -1016,
00716         DISK_DESTROY_TABLE_INVALID_LABEL = -1017,
00717         DISK_PARTITION_ZERO_SIZE = -1018,
00718         DISK_CHANGE_READONLY = -1019,
00719         DISK_RESIZE_PARTITION_INVALID_VOLUME = -1020,
00720         DISK_RESIZE_PARTITION_PARTED_FAILED = -1021,
00721         DISK_RESIZE_NO_SPACE = -1022,
00722         DISK_CHECK_RESIZE_INVALID_VOLUME = -1023,
00723         DISK_REMOVE_PARTITION_CREATE_NOT_FOUND = -1024,
00724         DISK_COMMIT_NOTHING_TODO = -1025,
00725         DISK_CREATE_PARTITION_NO_SPACE = -1026,
00726         DISK_REMOVE_USED_BY = -1027,
00727         DISK_INIT_NOT_POSSIBLE = -1028,
00728         DISK_INVALID_PARTITION_ID = -1029,
00729 
00730         STORAGE_DISK_NOT_FOUND = -2000,
00731         STORAGE_VOLUME_NOT_FOUND = -2001,
00732         STORAGE_REMOVE_PARTITION_INVALID_CONTAINER = -2002,
00733         STORAGE_CHANGE_PARTITION_ID_INVALID_CONTAINER = -2003,
00734         STORAGE_CHANGE_READONLY = -2004,
00735         STORAGE_DISK_USED_BY = -2005,
00736         STORAGE_LVM_VG_EXISTS = -2006,
00737         STORAGE_LVM_VG_NOT_FOUND = -2007,
00738         STORAGE_LVM_INVALID_DEVICE = -2008,
00739         STORAGE_CONTAINER_NOT_FOUND = -2009,
00740         STORAGE_VG_INVALID_NAME = -2010,
00741         STORAGE_REMOVE_USED_VOLUME = -2011,
00742         STORAGE_REMOVE_USING_UNKNOWN_TYPE = -2012,
00743         STORAGE_NOT_YET_IMPLEMENTED = -2013,
00744         STORAGE_MD_INVALID_NAME = -2014,
00745         STORAGE_MD_NOT_FOUND = -2015,
00746         STORAGE_MEMORY_EXHAUSTED = -2016,
00747         STORAGE_LOOP_NOT_FOUND = -2017,
00748         STORAGE_CREATED_LOOP_NOT_FOUND = -2018,
00749         STORAGE_CHANGE_AREA_INVALID_CONTAINER = -2023,
00750         STORAGE_BACKUP_STATE_NOT_FOUND = -2024,
00751         STORAGE_INVALID_FSTAB_VALUE = -2025,
00752         STORAGE_NO_FSTAB_PTR = -2026,
00753         STORAGE_DEVICE_NODE_NOT_FOUND = -2027,
00754         STORAGE_DMRAID_CO_NOT_FOUND = -2028,
00755         STORAGE_RESIZE_INVALID_CONTAINER = -2029,
00756         STORAGE_DMMULTIPATH_CO_NOT_FOUND = -2030,
00757         STORAGE_ZERO_DEVICE_FAILED = -2031,
00758         STORAGE_INVALID_BACKUP_STATE_NAME = -2032,
00759         STORAGE_MDPART_CO_NOT_FOUND = -2033,
00760         STORAGE_DEVICE_NOT_FOUND = -2034,
00761         STORAGE_BTRFS_CO_NOT_FOUND = -2035,
00762         STORAGE_TMPFS_CO_NOT_FOUND = -2036,
00763         STORAGE_VOLUME_NOT_ENCRYPTED = -2037,
00764         STORAGE_DM_RENAME_FAILED = -2038,
00765 
00766         VOLUME_COMMIT_UNKNOWN_STAGE = -3000,
00767         VOLUME_FSTAB_EMPTY_MOUNT = -3001,
00768         VOLUME_UMOUNT_FAILED = -3002,
00769         VOLUME_MOUNT_FAILED = -3003,
00770         VOLUME_FORMAT_UNKNOWN_FS = -3005,
00771         VOLUME_FORMAT_FS_UNDETECTED = -3006,
00772         VOLUME_FORMAT_FS_TOO_SMALL = -3007,
00773         VOLUME_FORMAT_FAILED = -3008,
00774         VOLUME_TUNE2FS_FAILED = -3009,
00775         VOLUME_MKLABEL_FS_UNABLE = -3010,
00776         VOLUME_MKLABEL_FAILED = -3011,
00777         VOLUME_LOSETUP_NO_LOOP = -3012,
00778         VOLUME_LOSETUP_FAILED = -3013,
00779         VOLUME_CRYPT_NO_PWD = -3014,
00780         VOLUME_CRYPT_PWD_TOO_SHORT = -3015,
00781         VOLUME_CRYPT_NOT_DETECTED = -3016,
00782         VOLUME_FORMAT_EXTENDED_UNSUPPORTED = -3017,
00783         VOLUME_MOUNT_EXTENDED_UNSUPPORTED = -3018,
00784         VOLUME_MOUNT_POINT_INVALID = -3019,
00785         VOLUME_MOUNTBY_NOT_ENCRYPTED = -3020,
00786         VOLUME_MOUNTBY_UNSUPPORTED_BY_FS = -3021,
00787         VOLUME_LABEL_NOT_SUPPORTED = -3022,
00788         VOLUME_LABEL_TOO_LONG = -3023,
00789         VOLUME_LABEL_WHILE_MOUNTED = -3024,
00790         VOLUME_RESIZE_UNSUPPORTED_BY_FS = -3025,
00791         VOLUME_RESIZE_UNSUPPORTED_BY_CONTAINER = -3026,
00792         VOLUME_RESIZE_FAILED = -3027,
00793         VOLUME_ALREADY_IN_USE = -3028,
00794         VOLUME_LOUNSETUP_FAILED = -3029,
00795         VOLUME_DEVICE_NOT_PRESENT = -3030,
00796         VOLUME_DEVICE_NOT_BLOCK = -3031,
00797         VOLUME_MOUNTBY_UNSUPPORTED_BY_VOLUME = -3032,
00798         VOLUME_CRYPTFORMAT_FAILED = -3033,
00799         VOLUME_CRYPTSETUP_FAILED = -3034,
00800         VOLUME_CRYPTUNSETUP_FAILED = -3035,
00801         VOLUME_FORMAT_NOT_IMPLEMENTED = -3036,
00802         VOLUME_FORMAT_IMPOSSIBLE = -3037,
00803         VOLUME_CRYPT_NFS_IMPOSSIBLE = -3038,
00804         VOLUME_REMOUNT_FAILED = -3039,
00805         VOLUME_TUNEREISERFS_FAILED = -3040,
00806         VOLUME_UMOUNT_NOT_MOUNTED = -3041,
00807         VOLUME_BTRFS_ADD_FAILED = -3042,
00808         VOLUME_CANNOT_TMP_MOUNT = -3043,
00809         VOLUME_CANNOT_TMP_UMOUNT = -3044,
00810         VOLUME_BTRFS_SUBVOL_INIT_FAILED = -3045,
00811         VOLUME_BTRFS_SUBVOL_SETDEFAULT = -3046,
00812 
00813         LVM_CREATE_PV_FAILED = -4000,
00814         LVM_PV_ALREADY_CONTAINED = -4001,
00815         LVM_PV_DEVICE_UNKNOWN = -4002,
00816         LVM_PV_DEVICE_USED = -4003,
00817         LVM_VG_HAS_NONE_PV = -4004,
00818         LVM_LV_INVALID_NAME = -4005,
00819         LVM_LV_DUPLICATE_NAME = -4006,
00820         LVM_LV_NO_SPACE = -4007,
00821         LVM_LV_UNKNOWN_NAME = -4008,
00822         LVM_LV_NOT_IN_LIST = -4009,
00823         LVM_VG_CREATE_FAILED = -4010,
00824         LVM_VG_EXTEND_FAILED = -4011,
00825         LVM_VG_REDUCE_FAILED = -4012,
00826         LVM_VG_REMOVE_FAILED = -4013,
00827         LVM_LV_CREATE_FAILED = -4014,
00828         LVM_LV_REMOVE_FAILED = -4015,
00829         LVM_LV_RESIZE_FAILED = -4016,
00830         LVM_PV_STILL_ADDED = -4017,
00831         LVM_PV_REMOVE_NOT_FOUND = -4018,
00832         LVM_CREATE_LV_INVALID_VOLUME = -4019,
00833         LVM_REMOVE_LV_INVALID_VOLUME = -4020,
00834         LVM_RESIZE_LV_INVALID_VOLUME = -4021,
00835         LVM_CHANGE_READONLY = -4022,
00836         LVM_CHECK_RESIZE_INVALID_VOLUME = -4023,
00837         LVM_COMMIT_NOTHING_TODO = -4024,
00838         LVM_LV_REMOVE_USED_BY = -4025,
00839         LVM_LV_ALREADY_ON_DISK = -4026,
00840         LVM_LV_NO_STRIPE_SIZE = -4027,
00841         LVM_LV_UNKNOWN_ORIGIN = -4028,
00842         LVM_LV_NOT_ON_DISK = -4029,
00843         LVM_LV_NOT_SNAPSHOT = -4030,
00844         LVM_LV_HAS_SNAPSHOTS = -4031,
00845         LVM_LV_IS_SNAPSHOT = -4032,
00846         LVM_LIST_EMPTY = -4033,
00847         LVM_LV_NO_POOL_OR_SNAP = -4034,
00848         LVM_LV_NO_POOL = -4035,
00849         LVM_LV_UNKNOWN_POOL = -4036,
00850         LVM_LV_INVALID_CHUNK_SIZE = -4037,
00851         LVM_LV_POOL_NO_FORMAT = -4038,
00852         LVM_LV_POOL_NO_MOUNT = -4039,
00853 
00854         FSTAB_ENTRY_NOT_FOUND = -5000,
00855         FSTAB_CHANGE_PREFIX_IMPOSSIBLE = -5001,
00856         FSTAB_REMOVE_ENTRY_NOT_FOUND = -5002,
00857         FSTAB_UPDATE_ENTRY_NOT_FOUND = -5003,
00858         FSTAB_ADD_ENTRY_FOUND = -5004,
00859 
00860         MD_CHANGE_READONLY = -6000,
00861         MD_DUPLICATE_NUMBER = -6001,
00862         MD_TOO_FEW_DEVICES = -6002,
00863         MD_DEVICE_UNKNOWN = -6003,
00864         MD_DEVICE_USED = -6004,
00865         MD_CREATE_INVALID_VOLUME = -6005,
00866         MD_REMOVE_FAILED = -6006,
00867         MD_NOT_IN_LIST = -6007,
00868         MD_CREATE_FAILED = -6008,
00869         MD_UNKNOWN_NUMBER = -6009,
00870         MD_REMOVE_USED_BY = -6010,
00871         MD_NUMBER_TOO_LARGE = -6011,
00872         MD_REMOVE_INVALID_VOLUME = -6012,
00873         MD_REMOVE_CREATE_NOT_FOUND = -6013,
00874         MD_NO_RESIZE_ON_DISK = -6014,
00875         MD_ADD_DUPLICATE = -6015,
00876         MD_REMOVE_NONEXISTENT = -6016,
00877         MD_NO_CHANGE_ON_DISK = -6017,
00878         MD_NO_CREATE_UNKNOWN = -6018,
00879         MD_STATE_NOT_ON_DISK = -6019,
00880         MD_PARTITION_NOT_FOUND = -6020,
00881         MD_INVALID_PARITY = -6021,
00882         MD_TOO_MANY_SPARES = -6022,
00883         MD_GET_STATE_FAILED = -6023,
00884         MD_DUPLICATE_NAME = -6024,
00885 
00886         MDPART_CHANGE_READONLY = -6100,
00887         MDPART_INTERNAL_ERR = -6101,
00888         MDPART_INVALID_VOLUME = -6102,
00889         MDPART_PARTITION_NOT_FOUND = -6103,
00890         MDPART_REMOVE_PARTITION_LIST_ERASE = -6104,
00891         MDPART_COMMIT_NOTHING_TODO = -6105,
00892         MDPART_NO_REMOVE = -6106,
00893         MDPART_DEVICE_NOT_FOUND = -6107,
00894 
00895         LOOP_CHANGE_READONLY = -7000,
00896         LOOP_DUPLICATE_FILE = -7001,
00897         LOOP_UNKNOWN_FILE = -7002,
00898         LOOP_REMOVE_USED_BY = -7003,
00899         LOOP_FILE_CREATE_FAILED = -7004,
00900         LOOP_CREATE_INVALID_VOLUME = -7005,
00901         LOOP_REMOVE_FILE_FAILED = -7006,
00902         LOOP_REMOVE_INVALID_VOLUME = -7007,
00903         LOOP_NOT_IN_LIST = -7008,
00904         LOOP_REMOVE_CREATE_NOT_FOUND = -7009,
00905         LOOP_MODIFY_EXISTING = -7010,
00906 
00907         PEC_PE_SIZE_INVALID = -9000,
00908         PEC_PV_NOT_FOUND = -9001,
00909         PEC_REMOVE_PV_IN_USE = -9002,
00910         PEC_REMOVE_PV_SIZE_NEEDED = -9003,
00911         PEC_LV_NO_SPACE_STRIPED = -9004,
00912         PEC_LV_NO_SPACE_SINGLE = -9005,
00913         PEC_LV_PE_DEV_NOT_FOUND = -9006,
00914 
00915         DM_CHANGE_READONLY = -10000,
00916         DM_UNKNOWN_TABLE = -10001,
00917         DM_REMOVE_USED_BY = -10002,
00918         DM_REMOVE_CREATE_NOT_FOUND = -10003,
00919         DM_REMOVE_INVALID_VOLUME = -10004,
00920         DM_REMOVE_FAILED = -10005,
00921         DM_NOT_IN_LIST = -10006,
00922 
00923         DASD_NOT_POSSIBLE = -11000,
00924         DASD_DASDFMT_FAILED = -11002,
00925 
00926         DMPART_CHANGE_READONLY = -12001,
00927         DMPART_INTERNAL_ERR = -12002,
00928         DMPART_INVALID_VOLUME = -12003,
00929         DMPART_PARTITION_NOT_FOUND = -12004,
00930         DMPART_REMOVE_PARTITION_LIST_ERASE = -12005,
00931         DMPART_COMMIT_NOTHING_TODO = -12006,
00932         DMPART_NO_REMOVE = -12007,
00933 
00934         DMRAID_REMOVE_FAILED = -13001,
00935 
00936         NFS_VOLUME_NOT_FOUND = -14001,
00937         NFS_CHANGE_READONLY = -14002,
00938         NFS_REMOVE_VOLUME_CREATE_NOT_FOUND = -14003,
00939         NFS_REMOVE_VOLUME_LIST_ERASE = -14004,
00940         NFS_REMOVE_INVALID_VOLUME = -14005,
00941 
00942         BTRFS_COMMIT_INVALID_VOLUME = -15001,
00943         BTRFS_CANNOT_TMP_MOUNT = -15002,
00944         BTRFS_CANNOT_TMP_UMOUNT = -15003,
00945         BTRFS_DELETE_SUBVOL_FAIL = -15004,
00946         BTRFS_CREATE_SUBVOL_FAIL = -15005,
00947         BTRFS_VOLUME_NOT_FOUND = -15006,
00948         BTRFS_SUBVOL_EXISTS = -15007,
00949         BTRFS_SUBVOL_NON_EXISTS = -15008,
00950         BTRFS_REMOVE_NOT_FOUND = -15009,
00951         BTRFS_REMOVE_NO_BTRFS = -15010,
00952         BTRFS_REMOVE_INVALID_VOLUME = -15011,
00953         BTRFS_CHANGE_READONLY = -15012,
00954         BTRFS_DEV_ALREADY_CONTAINED = -15013,
00955         BTRFS_DEVICE_UNKNOWN = -15014,
00956         BTRFS_DEVICE_USED = -15015,
00957         BTRFS_HAS_NONE_DEV = -15016,
00958         BTRFS_DEV_NOT_FOUND = -15017,
00959         BTRFS_EXTEND_FAIL = -15018,
00960         BTRFS_REDUCE_FAIL = -15019,
00961         BTRFS_LIST_EMPTY = -15020,
00962         BTRFS_RESIZE_INVALID_VOLUME = -15021,
00963         BTRFS_MULTIDEV_SHRINK_UNSUPPORTED = -15022,
00964 
00965         TMPFS_REMOVE_INVALID_VOLUME = -16001,
00966         TMPFS_REMOVE_NO_TMPFS = -16002,
00967         TMPFS_REMOVE_NOT_FOUND = -16003,
00968 
00969         CHATTR_FAILED = -17001,
00970         QUOTA_RESTART_FAILED = -17002,
00971 
00972         CONTAINER_INTERNAL_ERROR = -99000,
00973         CONTAINER_INVALID_VIRTUAL_CALL = -99001,
00974 
00975     };
00976 
00977 
00981     class StorageInterface
00982     {
00983     public:
00984 
00985         StorageInterface () {}
00986         virtual ~StorageInterface () {}
00987 
00991         virtual void getContainers( deque<ContainerInfo>& infos) = 0;
00992 
01000         virtual int getDiskInfo( const string& disk, DiskInfo& info) = 0;
01001 
01010         virtual int getContDiskInfo( const string& disk, ContainerInfo& cinfo,
01011                                      DiskInfo& info ) = 0;
01012 
01020         virtual int getLvmVgInfo( const string& name, LvmVgInfo& info) = 0;
01021 
01030         virtual int getContLvmVgInfo( const string& name, ContainerInfo& cinfo,
01031                                       LvmVgInfo& info) = 0;
01032 
01040         virtual int getDmraidCoInfo( const string& name, DmraidCoInfo& info) = 0;
01041 
01050         virtual int getContDmraidCoInfo( const string& name, ContainerInfo& cinfo,
01051                                          DmraidCoInfo& info) = 0;
01052 
01060         virtual int getDmmultipathCoInfo( const string& name, DmmultipathCoInfo& info) = 0;
01061 
01070         virtual int getContDmmultipathCoInfo( const string& name, ContainerInfo& cinfo,
01071                                               DmmultipathCoInfo& info) = 0;
01072 
01080         virtual int getMdPartCoInfo( const string& name, MdPartCoInfo& info) = 0;
01081 
01082 
01091         virtual int getContMdPartCoInfo( const string& name, ContainerInfo& cinfo,
01092                                          MdPartCoInfo& info) = 0;
01093 
01099         virtual void setMultipathAutostart(MultipathAutostart multipath_autostart) = 0;
01100 
01106         virtual MultipathAutostart getMultipathAutostart() const = 0;
01107 
01113         virtual void getVolumes( deque<VolumeInfo>& infos) = 0;
01114 
01122         virtual int getVolume( const string& device, VolumeInfo& info) = 0;
01123 
01131         virtual int getPartitionInfo( const string& disk,
01132                                       deque<PartitionInfo>& plist ) = 0;
01133 
01141         virtual int getLvmLvInfo( const string& name,
01142                                   deque<LvmLvInfo>& plist ) = 0;
01143 
01150         virtual int getMdInfo( deque<MdInfo>& plist ) = 0;
01151 
01159         virtual int getMdPartInfo( const string& device,
01160                                    deque<MdPartInfo>& plist ) = 0;
01161 
01168         virtual int getNfsInfo( deque<NfsInfo>& plist ) = 0;
01169 
01176         virtual int getLoopInfo( deque<LoopInfo>& plist ) = 0;
01177 
01184         virtual int getDmInfo( deque<DmInfo>& plist ) = 0;
01185 
01192         virtual int getBtrfsInfo( deque<BtrfsInfo>& plist ) = 0;
01193 
01200         virtual int getTmpfsInfo( deque<TmpfsInfo>& plist ) = 0;
01201 
01209         virtual int getDmraidInfo( const string& name,
01210                                    deque<DmraidInfo>& plist ) = 0;
01211 
01219         virtual int getDmmultipathInfo( const string& name,
01220                                         deque<DmmultipathInfo>& plist ) = 0;
01221 
01225         virtual bool getFsCapabilities (FsType fstype, FsCapabilities& fscapabilities) const = 0;
01226 
01230         virtual bool getDlabelCapabilities(const string& dlabel,
01231                                            DlabelCapabilities& dlabelcapabilities) const = 0;
01232 
01236         virtual list<string> getAllUsedFs() const = 0;
01237 
01249         virtual int createPartition(const string& disk, PartitionType type,
01250                                     const RegionInfo& cylRegion,
01251                                     string& SWIG_OUTPUT(device)) = 0;
01252 
01261         virtual int resizePartition( const string& device,
01262                                      unsigned long sizeCyl ) = 0;
01263 
01272         virtual int resizePartitionNoFs( const string& device,
01273                                          unsigned long sizeCyl ) = 0;
01274 
01284         virtual int updatePartitionArea(const string& device, const RegionInfo& cylRegion) = 0;
01285 
01294         virtual int freeCylindersAroundPartition(const string& device,
01295                                                  unsigned long& SWIG_OUTPUT(freeCylsBefore),
01296                                                  unsigned long& SWIG_OUTPUT(freeCylsAfter)) = 0;
01297 
01311         virtual int nextFreePartition( const string& disk, PartitionType type,
01312                                        unsigned & SWIG_OUTPUT(nr),
01313                                        string& SWIG_OUTPUT(device) ) = 0;
01314 
01326         virtual int createPartitionKb(const string& disk, PartitionType type,
01327                                       const RegionInfo& kRegion,
01328                                       string& SWIG_OUTPUT(device)) = 0;
01329 
01340         virtual int createPartitionAny( const string& disk,
01341                                         unsigned long long sizeK,
01342                                         string& SWIG_OUTPUT(device) ) = 0;
01343 
01354         virtual int createPartitionMax( const string& disk, PartitionType type,
01355                                         string& SWIG_OUTPUT(device) ) = 0;
01356 
01364         virtual unsigned long long cylinderToKb( const string& disk,
01365                                                  unsigned long sizeCyl) = 0;
01366 
01374         virtual unsigned long kbToCylinder( const string& disk,
01375                                             unsigned long long sizeK) = 0;
01376 
01383         virtual int removePartition (const string& partition) = 0;
01384 
01392         virtual int changePartitionId (const string& partition, unsigned id) = 0;
01393 
01400         virtual int forgetChangePartitionId (const string& partition ) = 0;
01401 
01409         virtual string getPartitionPrefix(const string& disk) = 0;
01410 
01419         virtual string getPartitionName(const string& disk, int partition_no) = 0;
01420 
01431         virtual int getUnusedPartitionSlots(const string& disk, list<PartitionSlotInfo>& slots) = 0;
01432 
01441         virtual int destroyPartitionTable (const string& disk, const string& label) = 0;
01442 
01453         virtual int initializeDisk( const string& disk, bool value ) = 0;
01454 
01463         virtual string defaultDiskLabel(const string& device) = 0;
01464 
01473         virtual int changeFormatVolume( const string& device, bool format, FsType fs ) = 0;
01474 
01482         virtual int changeLabelVolume( const string& device, const string& label ) = 0;
01483 
01491         virtual int changeMkfsOptVolume( const string& device, const string& opts ) = 0;
01492 
01500         virtual int changeTunefsOptVolume( const string& device, const string& opts ) = 0;
01501 
01510         virtual int changeMountPoint( const string& device, const string& mount ) = 0;
01511 
01519         virtual int getMountPoint( const string& device,
01520                                    string& SWIG_OUTPUT(mount) ) = 0;
01521 
01529         virtual int changeMountBy( const string& device, MountByType mby ) = 0;
01530 
01538         virtual int getMountBy( const string& device,
01539                                 MountByType& SWIG_OUTPUT(mby) ) = 0;
01540 
01550         virtual int changeFstabOptions( const string& device, const string& options ) = 0;
01551 
01560         virtual int getFstabOptions( const string& device,
01561                                      string& SWIG_OUTPUT(options) ) = 0;
01562 
01563 
01572         virtual int addFstabOptions( const string& device, const string& options ) = 0;
01573 
01583         virtual int removeFstabOptions( const string& device, const string& options ) = 0;
01584 
01592         virtual int setCryptPassword( const string& device, const string& pwd ) = 0;
01593 
01600         virtual int forgetCryptPassword( const string& device ) = 0;
01601 
01609         virtual int getCryptPassword( const string& device,
01610                                       string& SWIG_OUTPUT(pwd) ) = 0;
01611 
01620         virtual int verifyCryptPassword( const string& device,
01621                                          const string& pwd, bool erase ) = 0;
01622 
01629         virtual bool needCryptPassword( const string& device ) = 0;
01630 
01638         virtual int setCrypt( const string& device, bool val ) = 0;
01639 
01648         virtual int setCryptType( const string& device, bool val, EncryptType typ ) = 0;
01649 
01657         virtual int getCrypt( const string& device, bool& SWIG_OUTPUT(val) ) = 0;
01658 
01668         virtual int setIgnoreFstab( const string& device, bool val ) = 0;
01669 
01677         virtual int getIgnoreFstab( const string& device, bool& SWIG_OUTPUT(val) ) = 0;
01678 
01688         virtual int changeDescText( const string& device, const string& txt ) = 0;
01689 
01704         virtual int addFstabEntry( const string& device, const string& mount,
01705                                    const string& vfs, const string& options,
01706                                    unsigned freq, unsigned passno ) = 0;
01707 
01708 
01716         virtual int resizeVolume(const string& device, unsigned long long newSizeK) = 0;
01717 
01725         virtual int resizeVolumeNoFs(const string& device, unsigned long long newSizeK) = 0;
01726 
01733         virtual int forgetResizeVolume( const string& device ) = 0;
01734 
01749         virtual void setRecursiveRemoval( bool val ) = 0;
01750 
01756         virtual bool getRecursiveRemoval() const = 0;
01757 
01767         virtual int getRecursiveUsing(const list<string>& devices, bool itself,
01768                                       list<string>& using_devices) = 0;
01769 
01779         virtual int getRecursiveUsedBy(const list<string>& devices, bool itself,
01780                                        list<string>& usedby_devices) = 0;
01781 
01795         virtual void setZeroNewPartitions( bool val ) = 0;
01796 
01802         virtual bool getZeroNewPartitions() const = 0;
01803 
01815         virtual void setPartitionAlignment( PartAlign val ) = 0;
01816 
01822         virtual PartAlign getPartitionAlignment() const = 0;
01823 
01829         virtual void setDefaultMountBy( MountByType val ) = 0;
01830 
01836         virtual MountByType getDefaultMountBy() const = 0;
01837 
01843         virtual void setDefaultFs(FsType val) = 0;
01844 
01850         virtual FsType getDefaultFs() const = 0;
01851 
01857         virtual void setDefaultSubvolName( const string& val) = 0;
01858 
01864         virtual string getDefaultSubvolName() const = 0;
01865 
01871         virtual bool getEfiBoot() = 0;
01872 
01883         virtual void setRootPrefix( const string& root ) = 0;
01884 
01890         virtual string getRootPrefix() const = 0;
01891 
01897         virtual void setDetectMountedVolumes( bool val ) = 0;
01898 
01904         virtual bool getDetectMountedVolumes() const = 0;
01905 
01913         virtual int removeVolume( const string& device ) = 0;
01914 
01925         virtual int createLvmVg( const string& name,
01926                                  unsigned long long peSizeK, bool lvm1,
01927                                  const deque<string>& devs ) = 0;
01928 
01936         virtual int removeLvmVg( const string& name ) = 0;
01937 
01945         virtual int extendLvmVg( const string& name,
01946                                  const deque<string>& devs ) = 0;
01947 
01955         virtual int shrinkLvmVg( const string& name,
01956                                  const deque<string>& devs ) = 0;
01957 
01969         virtual int createLvmLv( const string& vg, const string& name,
01970                                  unsigned long long sizeK, unsigned stripes,
01971                                  string& SWIG_OUTPUT(device) ) = 0;
01972 
01979         virtual int removeLvmLvByDevice( const string& device ) = 0;
01980 
01988         virtual int removeLvmLv( const string& vg, const string& name ) = 0;
01989 
01999         virtual int changeLvStripeCount( const string& vg, const string& name,
02000                                          unsigned long stripes ) = 0;
02001 
02011         virtual int changeLvStripeSize( const string& vg, const string& name,
02012                                         unsigned long long stripeSizeK) = 0;
02013 
02024         virtual int createLvmLvSnapshot(const string& vg, const string& origin,
02025                                         const string& name, unsigned long long cowSizeK,
02026                                         string& SWIG_OUTPUT(device) ) = 0;
02027 
02035         virtual int removeLvmLvSnapshot(const string& vg, const string& name) = 0;
02036 
02047         virtual int getLvmLvSnapshotStateInfo(const string& vg, const string& name,
02048                                               LvmLvSnapshotStateInfo& info) = 0;
02049 
02059         virtual int createLvmLvPool(const string& vg, const string& name,
02060                                     unsigned long long sizeK,
02061                                     string& SWIG_OUTPUT(device) ) = 0;
02062 
02073         virtual int createLvmLvThin(const string& vg, const string& name,
02074                                     const string& pool,
02075                                     unsigned long long sizeK,
02076                                     string& SWIG_OUTPUT(device) ) = 0;
02077 
02087         virtual int changeLvChunkSize( const string& vg, const string& name,
02088                                        unsigned long long chunkSizeK) = 0;
02089 
02097         virtual int nextFreeMd(unsigned& SWIG_OUTPUT(nr),
02098                                string& SWIG_OUTPUT(device)) = 0;
02099 
02109         virtual int createMd(const string& name, MdType md_type, const list<string>& devices,
02110                              const list<string>& spares) = 0;
02111 
02121         virtual int createMdAny(MdType md_type, const list<string>& devices,
02122                                 const list<string>& spares,
02123                                 string& SWIG_OUTPUT(device) ) = 0;
02124 
02133         virtual int removeMd( const string& name, bool destroySb ) = 0;
02134 
02144         virtual int extendMd(const string& name, const list<string>& devices,
02145                              const list<string>& spares) = 0;
02146 
02156         virtual int updateMd(const string& name, const list<string>& devices,
02157                              const list<string>& spares) = 0;
02158 
02168         virtual int shrinkMd(const string& name, const list<string>& devices,
02169                              const list<string>& spares) = 0;
02170 
02179         virtual int changeMdType(const string& name, MdType md_type) = 0;
02180 
02189         virtual int changeMdChunk(const string& name, unsigned long chunkSizeK) = 0;
02190 
02199         virtual int changeMdParity( const string& name, MdParity ptype ) = 0;
02200 
02207         virtual int checkMd( const string& name ) = 0;
02208 
02218         virtual int getMdStateInfo(const string& name, MdStateInfo& info) = 0;
02219 
02229         virtual int getMdPartCoStateInfo(const string& name,
02230                                          MdPartCoStateInfo& info) = 0;
02231 
02244         virtual int computeMdSize(MdType md_type, const list<string>& devices,
02245                                   const list<string>& spares, unsigned long long& SWIG_OUTPUT(sizeK)) = 0;
02246 
02254         virtual list<int> getMdAllowedParity(MdType md_type, unsigned devnr) = 0;
02255 
02266         virtual int removeMdPartCo(const string& name, bool destroySb ) = 0;
02267 
02278         virtual int addNfsDevice(const string& nfsDev, const string& opts,
02279                                  unsigned long long sizeK, const string& mp,
02280                                  bool nfs4) = 0;
02281 
02291         virtual int checkNfsDevice(const string& nfsDev, const string& opts,
02292                                    bool nfs4, unsigned long long& SWIG_OUTPUT(sizeK)) = 0;
02293 
02310         virtual int createFileLoop( const string& lname, bool reuseExisting,
02311                                     unsigned long long sizeK,
02312                                     const string& mp, const string& pwd,
02313                                     string& SWIG_OUTPUT(device) ) = 0;
02314 
02332         virtual int modifyFileLoop( const string& device, const string& lname,
02333                                     bool reuseExisting,
02334                                     unsigned long long sizeK ) = 0;
02335 
02344         virtual int removeFileLoop( const string& lname, bool removeFile ) = 0;
02345 
02352         virtual int removeDmraid( const string& name ) = 0;
02353 
02361         virtual bool existSubvolume( const string& device, const string& name ) = 0;
02362 
02371         virtual int createSubvolume(const string& device, const string& name, bool nocow) = 0;
02372 
02380         virtual int removeSubvolume( const string& device, const string& name ) = 0;
02381 
02390         virtual int extendBtrfsVolume( const string& name,
02391                                        const deque<string>& devs ) = 0;
02392 
02401         virtual int shrinkBtrfsVolume( const string& name,
02402                                        const deque<string>& devs ) = 0;
02403 
02411         virtual int addTmpfsMount( const string& mp, const string& opts ) = 0;
02412 
02419         virtual int removeTmpfsMount( const string& mp ) = 0;
02420 
02426         virtual void getCommitInfos(list<CommitInfo>& infos) const = 0;
02427 
02433         virtual const string& getLastAction() const = 0;
02434 
02441         virtual const string& getExtendedErrorMessage() const = 0;
02442 
02443 // temporarily disable callback function for swig
02444 #ifndef SWIG
02445 
02451         virtual void setCallbackProgressBar(CallbackProgressBar pfnc) = 0;
02452 
02458         virtual CallbackProgressBar getCallbackProgressBar() const = 0;
02459 
02460 
02466         virtual void setCallbackShowInstallInfo(CallbackShowInstallInfo pfnc) = 0;
02467 
02473         virtual CallbackShowInstallInfo getCallbackShowInstallInfo() const = 0;
02474 
02475 
02482         virtual void setCallbackInfoPopup(CallbackInfoPopup pfnc) = 0;
02483 
02490         virtual CallbackInfoPopup getCallbackInfoPopup() const = 0;
02491 
02492 
02499         virtual void setCallbackYesNoPopup(CallbackYesNoPopup pfnc) = 0;
02500 
02507         virtual CallbackYesNoPopup getCallbackYesNoPopup() const = 0;
02508 
02509 
02515         virtual void setCallbackCommitErrorPopup(CallbackCommitErrorPopup pfnc) = 0;
02516 
02522         virtual CallbackCommitErrorPopup getCallbackCommitErrorPopup() const = 0;
02523 
02524 
02530         virtual void setCallbackPasswordPopup(CallbackPasswordPopup pfnc) = 0;
02531 
02538         virtual CallbackPasswordPopup getCallbackPasswordPopup() const = 0;
02539 
02540 #endif
02541 
02547         virtual void setCacheChanges (bool cache) = 0;
02548 
02552         virtual bool isCacheChanges () const = 0;
02553 
02557         virtual void setCommitCallbacks(const CommitCallbacks* commit_callbacks) = 0;
02558 
02563         virtual int commit() = 0;
02564 
02568         virtual string getErrorString(int error) const = 0;
02569 
02576         virtual int createBackupState( const string& name ) = 0;
02577 
02584         virtual int restoreBackupState( const string& name ) = 0;
02585 
02592         virtual bool checkBackupState(const string& name) const = 0;
02593 
02602         virtual bool equalBackupStates(const string& lhs, const string& rhs,
02603                                        bool verbose_log) const = 0;
02604 
02612         virtual int removeBackupState( const string& name ) = 0;
02613 
02621         virtual bool checkDeviceMounted(const string& device, list<string>& mps) = 0;
02622 
02633         virtual bool umountDevice( const string& device ) = 0;
02634 
02647         virtual bool umountDeviceUns( const string& device, bool unsetup ) = 0;
02648 
02659         virtual bool mountDevice( const string& device, const string& mp ) = 0;
02660 
02671         virtual int activateEncryption( const string& device, bool on ) = 0;
02672 
02684         virtual bool mountDeviceOpts( const string& device, const string& mp,
02685                                       const string& opts ) = 0;
02686 
02698         virtual bool mountDeviceRo( const string& device, const string& mp,
02699                                     const string& opts ) = 0;
02700 
02707         virtual bool checkDmMapsTo( const string& device ) = 0;
02708 
02714         virtual void removeDmTableTo( const string& device ) = 0;
02715 
02724         virtual int renameCryptDm( const string& device,
02725                                    const string& new_name ) = 0;
02726 
02738         virtual bool getFreeInfo(const string& device, bool get_resize, ResizeInfo& resize_info,
02739                                  bool get_content, ContentInfo& content_info, bool use_cache) = 0;
02740 
02748         virtual bool readFstab( const string& dir, deque<VolumeInfo>& infos) = 0;
02749 
02759         virtual void activateHld( bool val ) = 0;
02760 
02769         virtual void activateMultipath( bool val ) = 0;
02770 
02779         virtual void rescanEverything() = 0;
02780 
02789         virtual bool rescanCryptedObjects() = 0;
02790 
02794         virtual void dumpObjectList() = 0;
02795 
02799         virtual void dumpCommitInfos() const = 0;
02800 
02810         virtual int getContVolInfo(const string& dev, ContVolInfo& info) = 0;
02811 
02820         virtual int setUserdata(const string& device, const map<string, string>& userdata) = 0;
02821 
02829         virtual int getUserdata(const string& device, map<string, string>& userdata) = 0;
02830 
02831     };
02832 
02833 
02837     void initDefaultLogger( const string& logdir );
02838 
02843     typedef void (*CallbackLogDo)( int level, const string& component, const char* file,
02844                                    int line, const char* function, const string& content );
02845 
02850     typedef bool (*CallbackLogQuery)( int level, const string& component );
02851 
02855     void setLogDoCallback( CallbackLogDo pfc );
02856 
02860     CallbackLogDo getLogDoCallback();
02861 
02865     void setLogQueryCallback( CallbackLogQuery pfc );
02866 
02870     CallbackLogQuery getLogQueryCallback();
02871 
02875     struct Environment
02876     {
02877         Environment(bool readonly, const string& logdir = "/var/log/YaST2")
02878             : readonly(readonly), testmode(false), autodetect(true),
02879               instsys(false), logdir(logdir), testdir("tmp")
02880             {
02881                 storage::initDefaultLogger( logdir );
02882             }
02883 
02884         bool readonly;
02885         bool testmode;
02886         bool autodetect;
02887         bool instsys;
02888         string logdir;
02889         string testdir;
02890     };
02891 
02892 
02898     StorageInterface* createStorageInterface(const Environment& env);
02899 
02900 
02908     StorageInterface* createStorageInterfacePid(const Environment& env, int& SWIG_OUTPUT(locker_pid));
02909 
02910 
02914     void destroyStorageInterface(StorageInterface*);
02915 
02916 }
02917 
02918 
02919 #endif