libstorage
StorageInterface.h
1 /*
2  * Copyright (c) [2004-2015] Novell, Inc.
3  * Copyright (c) [2015] SUSE LLC
4  *
5  * All Rights Reserved.
6  *
7  * This program is free software; you can redistribute it and/or modify it
8  * under the terms of version 2 of the GNU General Public License as published
9  * by the Free Software Foundation.
10  *
11  * This program is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14  * more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, contact Novell, Inc.
18  *
19  * To contact Novell about this file by physical or electronic mail, you may
20  * find current contact information at www.novell.com.
21  */
22 
23 
24 #ifndef STORAGE_INTERFACE_H
25 #define STORAGE_INTERFACE_H
26 
27 
28 #include <string>
29 #include <vector>
30 #include <deque>
31 #include <list>
32 #include <map>
33 
34 using std::string;
35 using std::vector;
36 using std::deque;
37 using std::list;
38 using std::map;
39 
40 
41 #include "storage/StorageVersion.h"
42 #include "storage/StorageSwig.h"
43 
44 
142 namespace storage
143 {
144  enum FsType { FSUNKNOWN, REISERFS, EXT2, EXT3, EXT4, BTRFS, VFAT, XFS, JFS, HFS, NTFS,
145  SWAP, HFSPLUS, NFS, NFS4, TMPFS, ISO9660, UDF, FSNONE };
146 
147  enum PartitionType { PRIMARY, EXTENDED, LOGICAL, PTYPE_ANY };
148 
149  enum MountByType { MOUNTBY_DEVICE, MOUNTBY_UUID, MOUNTBY_LABEL, MOUNTBY_ID, MOUNTBY_PATH };
150 
151  enum EncryptType { ENC_NONE, ENC_TWOFISH, ENC_TWOFISH_OLD,
152  ENC_TWOFISH256_OLD, ENC_LUKS, ENC_UNKNOWN };
153 
154  enum MdType { RAID_UNK, RAID0, RAID1, RAID5, RAID6, RAID10, MULTIPATH };
155 
156  enum MdParity { PAR_DEFAULT, LEFT_ASYMMETRIC, LEFT_SYMMETRIC,
157  RIGHT_ASYMMETRIC, RIGHT_SYMMETRIC, PAR_FIRST, PAR_LAST,
158  LEFT_ASYMMETRIC_6, LEFT_SYMMETRIC_6, RIGHT_ASYMMETRIC_6,
159  RIGHT_SYMMETRIC_6, PAR_FIRST_6,
160  PAR_NEAR_2, PAR_OFFSET_2, PAR_FAR_2,
161  PAR_NEAR_3, PAR_OFFSET_3, PAR_FAR_3 };
162 
163  enum MdArrayState { UNKNOWN, CLEAR, INACTIVE, SUSPENDED, READONLY, READ_AUTO,
164  CLEAN, ACTIVE, WRITE_PENDING, ACTIVE_IDLE };
165 
166  enum UsedByType { UB_NONE, UB_LVM, UB_MD, UB_MDPART, UB_DM, UB_DMRAID, UB_DMMULTIPATH, UB_BTRFS };
167 
168  enum CType { CUNKNOWN, DISK, MD, LOOP, LVM, DM, DMRAID, NFSC, DMMULTIPATH, MDPART, BTRFSC, TMPFSC };
169 
170  enum Transport { TUNKNOWN, SBP, ATA, FC, ISCSI, SAS, SATA, SPI, USB, FCOE };
171 
172  enum MultipathAutostart { MPAS_UNDECIDED, MPAS_ON, MPAS_OFF };
173 
174  enum PartAlign { ALIGN_OPTIMAL, ALIGN_CYLINDER };
175 
176 
181  typedef void (*CallbackProgressBar)(const string& id, unsigned cur, unsigned max);
182 
187  typedef void (*CallbackShowInstallInfo)(const string& id);
188 
193  typedef void (*CallbackInfoPopup)(const string& text);
194 
201  typedef bool (*CallbackYesNoPopup)(const string& text);
202 
208  typedef bool (*CallbackCommitErrorPopup)(int error, const string& last_action,
209  const string& extended_message);
210 
216  typedef bool (*CallbackPasswordPopup)(const string& device, int attempts, string& password);
217 
218 
224  {
225  public:
226 
227  virtual ~CommitCallbacks() {}
228 
229  virtual void post_root_filesystem_create() const {}
230  virtual void post_root_mount() const {}
231  virtual void post_root_fstab_add() const {}
232 
233  };
234 
235 
240  {
241  FsCapabilities() {}
242  bool isExtendable;
243  bool isExtendableWhileMounted;
244  bool isReduceable;
245  bool isReduceableWhileMounted;
246  bool supportsUuid;
247  bool supportsLabel;
248  bool labelWhileMounted;
249  unsigned int labelLength;
250  bool canFormat;
251  unsigned long long minimalFsSizeK;
252  };
253 
258  {
259  DlabelCapabilities() {}
260  unsigned maxPrimary;
261  bool extendedPossible;
262  unsigned maxLogical;
263  unsigned long long maxSectors;
264  };
265 
266 
267  struct UsedByInfo
268  {
269  UsedByInfo() : type(UB_NONE) {} // only for swig bindings
270  UsedByInfo(UsedByType type, const string& device) : type(type), device(device) {}
271  UsedByType type;
272  string device;
273  };
274 
275 
276  struct ResizeInfo
277  {
278  ResizeInfo() : df_freeK(0), resize_freeK(0), usedK(0), resize_ok(false) {}
279  unsigned long long df_freeK;
280  unsigned long long resize_freeK;
281  unsigned long long usedK;
282  bool resize_ok;
283  };
284 
285 
286  struct ContentInfo
287  {
288  ContentInfo() : windows(false), efi(false), homes(0) {}
289  bool windows;
290  bool efi;
291  unsigned homes;
292  };
293 
294 
295  struct DeviceInfo
296  {
297  DeviceInfo() {}
298 
299  string device;
300  string name;
301 
302  string udevPath;
303  list<string> udevId;
304 
305  list<UsedByInfo> usedBy;
306 
307  map<string, string> userdata;
308  };
309 
310 
314  struct ContainerInfo : public DeviceInfo
315  {
316  ContainerInfo() {}
317  CType type;
318  bool readonly;
319  };
320 
324  struct DiskInfo
325  {
326  DiskInfo() {}
327  unsigned long long sizeK;
328  unsigned long long cylSize;
329  unsigned long cyl;
330  unsigned long heads;
331  unsigned long sectors;
332  unsigned int sectorSize;
333  string disklabel;
334  string orig_disklabel;
335  unsigned maxPrimary;
336  bool extendedPossible;
337  unsigned maxLogical;
338  bool initDisk;
339  Transport transport;
340  bool has_fake_partition;
341  };
342 
346  struct LvmVgInfo
347  {
348  LvmVgInfo() {}
349  unsigned long long sizeK;
350  unsigned long long peSizeK;
351  unsigned long peCount;
352  unsigned long peFree;
353  string uuid;
354  bool lvm2;
355  bool create;
356  list<string> devices;
357  list<string> devices_add;
358  list<string> devices_rem;
359  };
360 
365  {
366  DmPartCoInfo() {}
367  DiskInfo d;
368  list<string> devices;
369  unsigned long minor;
370  };
371 
373  {
374  DmraidCoInfo() {}
375  DmPartCoInfo p;
376  };
377 
379  {
380  DmmultipathCoInfo() {}
381  DmPartCoInfo p;
382  string vendor;
383  string model;
384  };
385 
389  struct VolumeInfo : public DeviceInfo
390  {
391  VolumeInfo() {}
392  unsigned long long sizeK;
393  unsigned long major;
394  unsigned long minor;
395  string mount;
396  string crypt_device;
397  MountByType mount_by;
398  bool ignore_fstab;
399  string fstab_options;
400  string uuid;
401  string label;
402  string mkfs_options;
403  string tunefs_options;
404  string loop;
405  string dtxt;
406  EncryptType encryption;
407  string crypt_pwd;
408  FsType fs;
409  FsType detected_fs;
410  bool format;
411  bool create;
412  bool is_mounted;
413  bool resize;
414  bool ignore_fs;
415  unsigned long long origSizeK;
416  };
417 
421  struct RegionInfo
422  {
423  RegionInfo() : start(0), len(0) {}
424  RegionInfo(unsigned long long start, unsigned long long len) : start(start), len(len) {}
425  unsigned long long start;
426  unsigned long long len;
427  };
428 
430  {
431  PartitionAddInfo() {}
432  unsigned nr;
433  RegionInfo cylRegion;
434  PartitionType partitionType;
435  unsigned id;
436  bool boot;
437  };
438 
443  {
444  PartitionInfo() {}
445  PartitionInfo& operator=( const PartitionAddInfo& rhs );
446  VolumeInfo v;
447  unsigned nr;
448  RegionInfo cylRegion;
449  PartitionType partitionType;
450  unsigned id;
451  bool boot;
452  };
453 
457  struct LvmLvInfo
458  {
459  LvmLvInfo() {}
460  VolumeInfo v;
461  unsigned stripes;
462  unsigned stripeSizeK;
463  string uuid;
464  string status;
465  string dm_table;
466  string dm_target;
467  string origin;
468  string used_pool;
469  bool pool;
470  };
471 
476  {
478  bool active;
479  double allocated;
480  };
481 
485  struct MdInfo
486  {
487  MdInfo() {}
488  VolumeInfo v;
489  unsigned nr;
490  unsigned type;
491  unsigned parity;
492  string uuid;
493  string sb_ver;
494  unsigned long chunkSizeK;
495  list<string> devices;
496  list<string> spares;
497  bool inactive;
498  };
499 
503  struct MdStateInfo
504  {
505  MdStateInfo() {}
506  MdArrayState state;
507  };
508 
514  {
515  MdPartCoInfo() {}
516  DiskInfo d;
517  unsigned type; // RAID level
518  unsigned nr; // MD device number
519  unsigned parity; // Parity (not for all RAID level)
520  string uuid; // MD Device UUID
521  string sb_ver; // Metadata version
522  unsigned long chunkSizeK; // Chunksize (strip size)
523  list<string> devices;
524  list<string> spares;
525  };
526 
528  {
529  MdPartCoStateInfo() {}
530  MdArrayState state;
531  };
532 
536  struct MdPartInfo
537  {
538  MdPartInfo() {}
539  VolumeInfo v;
541  bool part;
542  };
543 
547  struct NfsInfo
548  {
549  NfsInfo() {}
550  VolumeInfo v;
551  };
552 
556  struct LoopInfo
557  {
558  LoopInfo() {}
559  VolumeInfo v;
560  bool reuseFile;
561  unsigned nr;
562  string file;
563  };
564 
565 
570  {
571  SubvolumeInfo()
572  : path(), nocow(false), created(false), deleted(false) {}
573  SubvolumeInfo(const string& path, bool nocow, bool created, bool deleted)
574  : path(path), nocow(nocow), created(created), deleted(deleted) {}
575 
576  string path;
577  bool nocow;
578 
579  bool created;
580  bool deleted;
581  };
582 
583 
587  struct BtrfsInfo
588  {
589  BtrfsInfo() {}
590  VolumeInfo v;
591  list<string> devices;
592  list<string> devices_add;
593  list<string> devices_rem;
594  vector<SubvolumeInfo> subvolumes;
595  };
596 
597 
601  struct TmpfsInfo
602  {
603  TmpfsInfo() {}
604  VolumeInfo v;
605  };
606 
610  struct DmInfo
611  {
612  DmInfo() {}
613  VolumeInfo v;
614  unsigned nr;
615  string table;
616  string target;
617  };
618 
622  struct DmPartInfo
623  {
624  DmPartInfo() {}
625  VolumeInfo v;
627  bool part;
628  string table;
629  string target;
630  };
631 
635  struct DmraidInfo
636  {
637  DmraidInfo() {}
638  DmPartInfo p;
639  };
640 
645  {
646  DmmultipathInfo() {}
647  DmPartInfo p;
648  };
649 
653  struct ContVolInfo
654  {
655  ContVolInfo() : ctype(CUNKNOWN), num(-1) {}
656  CType ctype;
657  string cname;
658  string cdevice;
659  string vname;
660  string vdevice;
661  int num;
662  };
663 
668  {
669  PartitionSlotInfo() {}
670  RegionInfo cylRegion;
671  unsigned nr;
672  string device;
673  bool primarySlot;
674  bool primaryPossible;
675  bool extendedSlot;
676  bool extendedPossible;
677  bool logicalSlot;
678  bool logicalPossible;
679  };
680 
684  struct CommitInfo
685  {
686  CommitInfo() {}
687  bool destructive;
688  string text;
689  };
690 
691 
695  enum ErrorCodes
696  {
697  STORAGE_NO_ERROR = 0,
698 
699  DISK_PARTITION_OVERLAPS_EXISTING = -1000,
700  DISK_PARTITION_EXCEEDS_DISK = -1001,
701  DISK_CREATE_PARTITION_EXT_ONLY_ONCE = -1002,
702  DISK_CREATE_PARTITION_EXT_IMPOSSIBLE = -1003,
703  DISK_PARTITION_NO_FREE_NUMBER = -1004,
704  DISK_CREATE_PARTITION_INVALID_VOLUME = -1005,
705  DISK_CREATE_PARTITION_INVALID_TYPE = -1006,
706  DISK_CREATE_PARTITION_PARTED_FAILED = -1007,
707  DISK_PARTITION_NOT_FOUND = -1008,
708  DISK_CREATE_PARTITION_LOGICAL_NO_EXT = -1009,
709  DISK_PARTITION_LOGICAL_OUTSIDE_EXT = -1010,
710  DISK_SET_TYPE_INVALID_VOLUME = -1011,
711  DISK_SET_TYPE_PARTED_FAILED = -1012,
712  DISK_SET_LABEL_PARTED_FAILED = -1013,
713  DISK_REMOVE_PARTITION_PARTED_FAILED = -1014,
714  DISK_REMOVE_PARTITION_INVALID_VOLUME = -1015,
715  DISK_REMOVE_PARTITION_LIST_ERASE = -1016,
716  DISK_DESTROY_TABLE_INVALID_LABEL = -1017,
717  DISK_PARTITION_ZERO_SIZE = -1018,
718  DISK_CHANGE_READONLY = -1019,
719  DISK_RESIZE_PARTITION_INVALID_VOLUME = -1020,
720  DISK_RESIZE_PARTITION_PARTED_FAILED = -1021,
721  DISK_RESIZE_NO_SPACE = -1022,
722  DISK_CHECK_RESIZE_INVALID_VOLUME = -1023,
723  DISK_REMOVE_PARTITION_CREATE_NOT_FOUND = -1024,
724  DISK_COMMIT_NOTHING_TODO = -1025,
725  DISK_CREATE_PARTITION_NO_SPACE = -1026,
726  DISK_REMOVE_USED_BY = -1027,
727  DISK_INIT_NOT_POSSIBLE = -1028,
728  DISK_INVALID_PARTITION_ID = -1029,
729 
730  STORAGE_DISK_NOT_FOUND = -2000,
731  STORAGE_VOLUME_NOT_FOUND = -2001,
732  STORAGE_REMOVE_PARTITION_INVALID_CONTAINER = -2002,
733  STORAGE_CHANGE_PARTITION_ID_INVALID_CONTAINER = -2003,
734  STORAGE_CHANGE_READONLY = -2004,
735  STORAGE_DISK_USED_BY = -2005,
736  STORAGE_LVM_VG_EXISTS = -2006,
737  STORAGE_LVM_VG_NOT_FOUND = -2007,
738  STORAGE_LVM_INVALID_DEVICE = -2008,
739  STORAGE_CONTAINER_NOT_FOUND = -2009,
740  STORAGE_VG_INVALID_NAME = -2010,
741  STORAGE_REMOVE_USED_VOLUME = -2011,
742  STORAGE_REMOVE_USING_UNKNOWN_TYPE = -2012,
743  STORAGE_NOT_YET_IMPLEMENTED = -2013,
744  STORAGE_MD_INVALID_NAME = -2014,
745  STORAGE_MD_NOT_FOUND = -2015,
746  STORAGE_MEMORY_EXHAUSTED = -2016,
747  STORAGE_LOOP_NOT_FOUND = -2017,
748  STORAGE_CREATED_LOOP_NOT_FOUND = -2018,
749  STORAGE_CHANGE_AREA_INVALID_CONTAINER = -2023,
750  STORAGE_BACKUP_STATE_NOT_FOUND = -2024,
751  STORAGE_INVALID_FSTAB_VALUE = -2025,
752  STORAGE_NO_FSTAB_PTR = -2026,
753  STORAGE_DEVICE_NODE_NOT_FOUND = -2027,
754  STORAGE_DMRAID_CO_NOT_FOUND = -2028,
755  STORAGE_RESIZE_INVALID_CONTAINER = -2029,
756  STORAGE_DMMULTIPATH_CO_NOT_FOUND = -2030,
757  STORAGE_ZERO_DEVICE_FAILED = -2031,
758  STORAGE_INVALID_BACKUP_STATE_NAME = -2032,
759  STORAGE_MDPART_CO_NOT_FOUND = -2033,
760  STORAGE_DEVICE_NOT_FOUND = -2034,
761  STORAGE_BTRFS_CO_NOT_FOUND = -2035,
762  STORAGE_TMPFS_CO_NOT_FOUND = -2036,
763  STORAGE_VOLUME_NOT_ENCRYPTED = -2037,
764  STORAGE_DM_RENAME_FAILED = -2038,
765 
766  VOLUME_COMMIT_UNKNOWN_STAGE = -3000,
767  VOLUME_FSTAB_EMPTY_MOUNT = -3001,
768  VOLUME_UMOUNT_FAILED = -3002,
769  VOLUME_MOUNT_FAILED = -3003,
770  VOLUME_FORMAT_UNKNOWN_FS = -3005,
771  VOLUME_FORMAT_FS_UNDETECTED = -3006,
772  VOLUME_FORMAT_FS_TOO_SMALL = -3007,
773  VOLUME_FORMAT_FAILED = -3008,
774  VOLUME_TUNE2FS_FAILED = -3009,
775  VOLUME_MKLABEL_FS_UNABLE = -3010,
776  VOLUME_MKLABEL_FAILED = -3011,
777  VOLUME_LOSETUP_NO_LOOP = -3012,
778  VOLUME_LOSETUP_FAILED = -3013,
779  VOLUME_CRYPT_NO_PWD = -3014,
780  VOLUME_CRYPT_PWD_TOO_SHORT = -3015,
781  VOLUME_CRYPT_NOT_DETECTED = -3016,
782  VOLUME_FORMAT_EXTENDED_UNSUPPORTED = -3017,
783  VOLUME_MOUNT_EXTENDED_UNSUPPORTED = -3018,
784  VOLUME_MOUNT_POINT_INVALID = -3019,
785  VOLUME_MOUNTBY_NOT_ENCRYPTED = -3020,
786  VOLUME_MOUNTBY_UNSUPPORTED_BY_FS = -3021,
787  VOLUME_LABEL_NOT_SUPPORTED = -3022,
788  VOLUME_LABEL_TOO_LONG = -3023,
789  VOLUME_LABEL_WHILE_MOUNTED = -3024,
790  VOLUME_RESIZE_UNSUPPORTED_BY_FS = -3025,
791  VOLUME_RESIZE_UNSUPPORTED_BY_CONTAINER = -3026,
792  VOLUME_RESIZE_FAILED = -3027,
793  VOLUME_ALREADY_IN_USE = -3028,
794  VOLUME_LOUNSETUP_FAILED = -3029,
795  VOLUME_DEVICE_NOT_PRESENT = -3030,
796  VOLUME_DEVICE_NOT_BLOCK = -3031,
797  VOLUME_MOUNTBY_UNSUPPORTED_BY_VOLUME = -3032,
798  VOLUME_CRYPTFORMAT_FAILED = -3033,
799  VOLUME_CRYPTSETUP_FAILED = -3034,
800  VOLUME_CRYPTUNSETUP_FAILED = -3035,
801  VOLUME_FORMAT_NOT_IMPLEMENTED = -3036,
802  VOLUME_FORMAT_IMPOSSIBLE = -3037,
803  VOLUME_CRYPT_NFS_IMPOSSIBLE = -3038,
804  VOLUME_REMOUNT_FAILED = -3039,
805  VOLUME_TUNEREISERFS_FAILED = -3040,
806  VOLUME_UMOUNT_NOT_MOUNTED = -3041,
807  VOLUME_BTRFS_ADD_FAILED = -3042,
808  VOLUME_CANNOT_TMP_MOUNT = -3043,
809  VOLUME_CANNOT_TMP_UMOUNT = -3044,
810  VOLUME_BTRFS_SUBVOL_INIT_FAILED = -3045,
811  VOLUME_BTRFS_SUBVOL_SETDEFAULT = -3046,
812 
813  LVM_CREATE_PV_FAILED = -4000,
814  LVM_PV_ALREADY_CONTAINED = -4001,
815  LVM_PV_DEVICE_UNKNOWN = -4002,
816  LVM_PV_DEVICE_USED = -4003,
817  LVM_VG_HAS_NONE_PV = -4004,
818  LVM_LV_INVALID_NAME = -4005,
819  LVM_LV_DUPLICATE_NAME = -4006,
820  LVM_LV_NO_SPACE = -4007,
821  LVM_LV_UNKNOWN_NAME = -4008,
822  LVM_LV_NOT_IN_LIST = -4009,
823  LVM_VG_CREATE_FAILED = -4010,
824  LVM_VG_EXTEND_FAILED = -4011,
825  LVM_VG_REDUCE_FAILED = -4012,
826  LVM_VG_REMOVE_FAILED = -4013,
827  LVM_LV_CREATE_FAILED = -4014,
828  LVM_LV_REMOVE_FAILED = -4015,
829  LVM_LV_RESIZE_FAILED = -4016,
830  LVM_PV_STILL_ADDED = -4017,
831  LVM_PV_REMOVE_NOT_FOUND = -4018,
832  LVM_CREATE_LV_INVALID_VOLUME = -4019,
833  LVM_REMOVE_LV_INVALID_VOLUME = -4020,
834  LVM_RESIZE_LV_INVALID_VOLUME = -4021,
835  LVM_CHANGE_READONLY = -4022,
836  LVM_CHECK_RESIZE_INVALID_VOLUME = -4023,
837  LVM_COMMIT_NOTHING_TODO = -4024,
838  LVM_LV_REMOVE_USED_BY = -4025,
839  LVM_LV_ALREADY_ON_DISK = -4026,
840  LVM_LV_NO_STRIPE_SIZE = -4027,
841  LVM_LV_UNKNOWN_ORIGIN = -4028,
842  LVM_LV_NOT_ON_DISK = -4029,
843  LVM_LV_NOT_SNAPSHOT = -4030,
844  LVM_LV_HAS_SNAPSHOTS = -4031,
845  LVM_LV_IS_SNAPSHOT = -4032,
846  LVM_LIST_EMPTY = -4033,
847  LVM_LV_NO_POOL_OR_SNAP = -4034,
848  LVM_LV_NO_POOL = -4035,
849  LVM_LV_UNKNOWN_POOL = -4036,
850  LVM_LV_INVALID_CHUNK_SIZE = -4037,
851  LVM_LV_POOL_NO_FORMAT = -4038,
852  LVM_LV_POOL_NO_MOUNT = -4039,
853 
854  FSTAB_ENTRY_NOT_FOUND = -5000,
855  FSTAB_CHANGE_PREFIX_IMPOSSIBLE = -5001,
856  FSTAB_REMOVE_ENTRY_NOT_FOUND = -5002,
857  FSTAB_UPDATE_ENTRY_NOT_FOUND = -5003,
858  FSTAB_ADD_ENTRY_FOUND = -5004,
859 
860  MD_CHANGE_READONLY = -6000,
861  MD_DUPLICATE_NUMBER = -6001,
862  MD_TOO_FEW_DEVICES = -6002,
863  MD_DEVICE_UNKNOWN = -6003,
864  MD_DEVICE_USED = -6004,
865  MD_CREATE_INVALID_VOLUME = -6005,
866  MD_REMOVE_FAILED = -6006,
867  MD_NOT_IN_LIST = -6007,
868  MD_CREATE_FAILED = -6008,
869  MD_UNKNOWN_NUMBER = -6009,
870  MD_REMOVE_USED_BY = -6010,
871  MD_NUMBER_TOO_LARGE = -6011,
872  MD_REMOVE_INVALID_VOLUME = -6012,
873  MD_REMOVE_CREATE_NOT_FOUND = -6013,
874  MD_NO_RESIZE_ON_DISK = -6014,
875  MD_ADD_DUPLICATE = -6015,
876  MD_REMOVE_NONEXISTENT = -6016,
877  MD_NO_CHANGE_ON_DISK = -6017,
878  MD_NO_CREATE_UNKNOWN = -6018,
879  MD_STATE_NOT_ON_DISK = -6019,
880  MD_PARTITION_NOT_FOUND = -6020,
881  MD_INVALID_PARITY = -6021,
882  MD_TOO_MANY_SPARES = -6022,
883  MD_GET_STATE_FAILED = -6023,
884  MD_DUPLICATE_NAME = -6024,
885 
886  MDPART_CHANGE_READONLY = -6100,
887  MDPART_INTERNAL_ERR = -6101,
888  MDPART_INVALID_VOLUME = -6102,
889  MDPART_PARTITION_NOT_FOUND = -6103,
890  MDPART_REMOVE_PARTITION_LIST_ERASE = -6104,
891  MDPART_COMMIT_NOTHING_TODO = -6105,
892  MDPART_NO_REMOVE = -6106,
893  MDPART_DEVICE_NOT_FOUND = -6107,
894 
895  LOOP_CHANGE_READONLY = -7000,
896  LOOP_DUPLICATE_FILE = -7001,
897  LOOP_UNKNOWN_FILE = -7002,
898  LOOP_REMOVE_USED_BY = -7003,
899  LOOP_FILE_CREATE_FAILED = -7004,
900  LOOP_CREATE_INVALID_VOLUME = -7005,
901  LOOP_REMOVE_FILE_FAILED = -7006,
902  LOOP_REMOVE_INVALID_VOLUME = -7007,
903  LOOP_NOT_IN_LIST = -7008,
904  LOOP_REMOVE_CREATE_NOT_FOUND = -7009,
905  LOOP_MODIFY_EXISTING = -7010,
906 
907  PEC_PE_SIZE_INVALID = -9000,
908  PEC_PV_NOT_FOUND = -9001,
909  PEC_REMOVE_PV_IN_USE = -9002,
910  PEC_REMOVE_PV_SIZE_NEEDED = -9003,
911  PEC_LV_NO_SPACE_STRIPED = -9004,
912  PEC_LV_NO_SPACE_SINGLE = -9005,
913  PEC_LV_PE_DEV_NOT_FOUND = -9006,
914 
915  DM_CHANGE_READONLY = -10000,
916  DM_UNKNOWN_TABLE = -10001,
917  DM_REMOVE_USED_BY = -10002,
918  DM_REMOVE_CREATE_NOT_FOUND = -10003,
919  DM_REMOVE_INVALID_VOLUME = -10004,
920  DM_REMOVE_FAILED = -10005,
921  DM_NOT_IN_LIST = -10006,
922 
923  DASD_NOT_POSSIBLE = -11000,
924  DASD_DASDFMT_FAILED = -11002,
925 
926  DMPART_CHANGE_READONLY = -12001,
927  DMPART_INTERNAL_ERR = -12002,
928  DMPART_INVALID_VOLUME = -12003,
929  DMPART_PARTITION_NOT_FOUND = -12004,
930  DMPART_REMOVE_PARTITION_LIST_ERASE = -12005,
931  DMPART_COMMIT_NOTHING_TODO = -12006,
932  DMPART_NO_REMOVE = -12007,
933 
934  DMRAID_REMOVE_FAILED = -13001,
935 
936  NFS_VOLUME_NOT_FOUND = -14001,
937  NFS_CHANGE_READONLY = -14002,
938  NFS_REMOVE_VOLUME_CREATE_NOT_FOUND = -14003,
939  NFS_REMOVE_VOLUME_LIST_ERASE = -14004,
940  NFS_REMOVE_INVALID_VOLUME = -14005,
941 
942  BTRFS_COMMIT_INVALID_VOLUME = -15001,
943  BTRFS_CANNOT_TMP_MOUNT = -15002,
944  BTRFS_CANNOT_TMP_UMOUNT = -15003,
945  BTRFS_DELETE_SUBVOL_FAIL = -15004,
946  BTRFS_CREATE_SUBVOL_FAIL = -15005,
947  BTRFS_VOLUME_NOT_FOUND = -15006,
948  BTRFS_SUBVOL_EXISTS = -15007,
949  BTRFS_SUBVOL_NON_EXISTS = -15008,
950  BTRFS_REMOVE_NOT_FOUND = -15009,
951  BTRFS_REMOVE_NO_BTRFS = -15010,
952  BTRFS_REMOVE_INVALID_VOLUME = -15011,
953  BTRFS_CHANGE_READONLY = -15012,
954  BTRFS_DEV_ALREADY_CONTAINED = -15013,
955  BTRFS_DEVICE_UNKNOWN = -15014,
956  BTRFS_DEVICE_USED = -15015,
957  BTRFS_HAS_NONE_DEV = -15016,
958  BTRFS_DEV_NOT_FOUND = -15017,
959  BTRFS_EXTEND_FAIL = -15018,
960  BTRFS_REDUCE_FAIL = -15019,
961  BTRFS_LIST_EMPTY = -15020,
962  BTRFS_RESIZE_INVALID_VOLUME = -15021,
963  BTRFS_MULTIDEV_SHRINK_UNSUPPORTED = -15022,
964 
965  TMPFS_REMOVE_INVALID_VOLUME = -16001,
966  TMPFS_REMOVE_NO_TMPFS = -16002,
967  TMPFS_REMOVE_NOT_FOUND = -16003,
968 
969  CHATTR_FAILED = -17001,
970  QUOTA_RESTART_FAILED = -17002,
971 
972  CONTAINER_INTERNAL_ERROR = -99000,
973  CONTAINER_INVALID_VIRTUAL_CALL = -99001,
974 
975  };
976 
977 
982  {
983  public:
984 
985  StorageInterface () {}
986  virtual ~StorageInterface () {}
987 
991  virtual void getContainers( deque<ContainerInfo>& infos) = 0;
992 
1000  virtual int getDiskInfo( const string& disk, DiskInfo& info) = 0;
1001 
1010  virtual int getContDiskInfo( const string& disk, ContainerInfo& cinfo,
1011  DiskInfo& info ) = 0;
1012 
1020  virtual int getLvmVgInfo( const string& name, LvmVgInfo& info) = 0;
1021 
1030  virtual int getContLvmVgInfo( const string& name, ContainerInfo& cinfo,
1031  LvmVgInfo& info) = 0;
1032 
1040  virtual int getDmraidCoInfo( const string& name, DmraidCoInfo& info) = 0;
1041 
1050  virtual int getContDmraidCoInfo( const string& name, ContainerInfo& cinfo,
1051  DmraidCoInfo& info) = 0;
1052 
1060  virtual int getDmmultipathCoInfo( const string& name, DmmultipathCoInfo& info) = 0;
1061 
1070  virtual int getContDmmultipathCoInfo( const string& name, ContainerInfo& cinfo,
1071  DmmultipathCoInfo& info) = 0;
1072 
1080  virtual int getMdPartCoInfo( const string& name, MdPartCoInfo& info) = 0;
1081 
1082 
1091  virtual int getContMdPartCoInfo( const string& name, ContainerInfo& cinfo,
1092  MdPartCoInfo& info) = 0;
1093 
1099  virtual void setMultipathAutostart(MultipathAutostart multipath_autostart) = 0;
1100 
1106  virtual MultipathAutostart getMultipathAutostart() const = 0;
1107 
1113  virtual void getVolumes( deque<VolumeInfo>& infos) = 0;
1114 
1122  virtual int getVolume( const string& device, VolumeInfo& info) = 0;
1123 
1131  virtual int getPartitionInfo( const string& disk,
1132  deque<PartitionInfo>& plist ) = 0;
1133 
1141  virtual int getLvmLvInfo( const string& name,
1142  deque<LvmLvInfo>& plist ) = 0;
1143 
1150  virtual int getMdInfo( deque<MdInfo>& plist ) = 0;
1151 
1159  virtual int getMdPartInfo( const string& device,
1160  deque<MdPartInfo>& plist ) = 0;
1161 
1168  virtual int getNfsInfo( deque<NfsInfo>& plist ) = 0;
1169 
1176  virtual int getLoopInfo( deque<LoopInfo>& plist ) = 0;
1177 
1184  virtual int getDmInfo( deque<DmInfo>& plist ) = 0;
1185 
1192  virtual int getBtrfsInfo( deque<BtrfsInfo>& plist ) = 0;
1193 
1200  virtual int getTmpfsInfo( deque<TmpfsInfo>& plist ) = 0;
1201 
1209  virtual int getDmraidInfo( const string& name,
1210  deque<DmraidInfo>& plist ) = 0;
1211 
1219  virtual int getDmmultipathInfo( const string& name,
1220  deque<DmmultipathInfo>& plist ) = 0;
1221 
1225  virtual bool getFsCapabilities (FsType fstype, FsCapabilities& fscapabilities) const = 0;
1226 
1230  virtual bool getDlabelCapabilities(const string& dlabel,
1231  DlabelCapabilities& dlabelcapabilities) const = 0;
1232 
1236  virtual list<string> getAllUsedFs() const = 0;
1237 
1249  virtual int createPartition(const string& disk, PartitionType type,
1250  const RegionInfo& cylRegion,
1251  string& SWIG_OUTPUT(device)) = 0;
1252 
1261  virtual int resizePartition( const string& device,
1262  unsigned long sizeCyl ) = 0;
1263 
1272  virtual int resizePartitionNoFs( const string& device,
1273  unsigned long sizeCyl ) = 0;
1274 
1284  virtual int updatePartitionArea(const string& device, const RegionInfo& cylRegion) = 0;
1285 
1294  virtual int freeCylindersAroundPartition(const string& device,
1295  unsigned long& SWIG_OUTPUT(freeCylsBefore),
1296  unsigned long& SWIG_OUTPUT(freeCylsAfter)) = 0;
1297 
1311  virtual int nextFreePartition( const string& disk, PartitionType type,
1312  unsigned & SWIG_OUTPUT(nr),
1313  string& SWIG_OUTPUT(device) ) = 0;
1314 
1326  virtual int createPartitionKb(const string& disk, PartitionType type,
1327  const RegionInfo& kRegion,
1328  string& SWIG_OUTPUT(device)) = 0;
1329 
1340  virtual int createPartitionAny( const string& disk,
1341  unsigned long long sizeK,
1342  string& SWIG_OUTPUT(device) ) = 0;
1343 
1354  virtual int createPartitionMax( const string& disk, PartitionType type,
1355  string& SWIG_OUTPUT(device) ) = 0;
1356 
1364  virtual unsigned long long cylinderToKb( const string& disk,
1365  unsigned long sizeCyl) = 0;
1366 
1374  virtual unsigned long kbToCylinder( const string& disk,
1375  unsigned long long sizeK) = 0;
1376 
1383  virtual int removePartition (const string& partition) = 0;
1384 
1392  virtual int changePartitionId (const string& partition, unsigned id) = 0;
1393 
1400  virtual int forgetChangePartitionId (const string& partition ) = 0;
1401 
1409  virtual string getPartitionPrefix(const string& disk) = 0;
1410 
1419  virtual string getPartitionName(const string& disk, int partition_no) = 0;
1420 
1431  virtual int getUnusedPartitionSlots(const string& disk, list<PartitionSlotInfo>& slots) = 0;
1432 
1441  virtual int destroyPartitionTable (const string& disk, const string& label) = 0;
1442 
1453  virtual int initializeDisk( const string& disk, bool value ) = 0;
1454 
1463  virtual string defaultDiskLabel(const string& device) = 0;
1464 
1473  virtual int changeFormatVolume( const string& device, bool format, FsType fs ) = 0;
1474 
1482  virtual int changeLabelVolume( const string& device, const string& label ) = 0;
1483 
1491  virtual int changeMkfsOptVolume( const string& device, const string& opts ) = 0;
1492 
1500  virtual int changeTunefsOptVolume( const string& device, const string& opts ) = 0;
1501 
1510  virtual int changeMountPoint( const string& device, const string& mount ) = 0;
1511 
1519  virtual int getMountPoint( const string& device,
1520  string& SWIG_OUTPUT(mount) ) = 0;
1521 
1529  virtual int changeMountBy( const string& device, MountByType mby ) = 0;
1530 
1538  virtual int getMountBy( const string& device,
1539  MountByType& SWIG_OUTPUT(mby) ) = 0;
1540 
1550  virtual int changeFstabOptions( const string& device, const string& options ) = 0;
1551 
1560  virtual int getFstabOptions( const string& device,
1561  string& SWIG_OUTPUT(options) ) = 0;
1562 
1563 
1572  virtual int addFstabOptions( const string& device, const string& options ) = 0;
1573 
1583  virtual int removeFstabOptions( const string& device, const string& options ) = 0;
1584 
1592  virtual int setCryptPassword( const string& device, const string& pwd ) = 0;
1593 
1600  virtual int forgetCryptPassword( const string& device ) = 0;
1601 
1609  virtual int getCryptPassword( const string& device,
1610  string& SWIG_OUTPUT(pwd) ) = 0;
1611 
1620  virtual int verifyCryptPassword( const string& device,
1621  const string& pwd, bool erase ) = 0;
1622 
1629  virtual bool needCryptPassword( const string& device ) = 0;
1630 
1638  virtual int setCrypt( const string& device, bool val ) = 0;
1639 
1648  virtual int setCryptType( const string& device, bool val, EncryptType typ ) = 0;
1649 
1657  virtual int getCrypt( const string& device, bool& SWIG_OUTPUT(val) ) = 0;
1658 
1668  virtual int setIgnoreFstab( const string& device, bool val ) = 0;
1669 
1677  virtual int getIgnoreFstab( const string& device, bool& SWIG_OUTPUT(val) ) = 0;
1678 
1688  virtual int changeDescText( const string& device, const string& txt ) = 0;
1689 
1704  virtual int addFstabEntry( const string& device, const string& mount,
1705  const string& vfs, const string& options,
1706  unsigned freq, unsigned passno ) = 0;
1707 
1708 
1716  virtual int resizeVolume(const string& device, unsigned long long newSizeK) = 0;
1717 
1725  virtual int resizeVolumeNoFs(const string& device, unsigned long long newSizeK) = 0;
1726 
1733  virtual int forgetResizeVolume( const string& device ) = 0;
1734 
1749  virtual void setRecursiveRemoval( bool val ) = 0;
1750 
1756  virtual bool getRecursiveRemoval() const = 0;
1757 
1767  virtual int getRecursiveUsing(const list<string>& devices, bool itself,
1768  list<string>& using_devices) = 0;
1769 
1779  virtual int getRecursiveUsedBy(const list<string>& devices, bool itself,
1780  list<string>& usedby_devices) = 0;
1781 
1795  virtual void setZeroNewPartitions( bool val ) = 0;
1796 
1802  virtual bool getZeroNewPartitions() const = 0;
1803 
1815  virtual void setPartitionAlignment( PartAlign val ) = 0;
1816 
1822  virtual PartAlign getPartitionAlignment() const = 0;
1823 
1829  virtual void setDefaultMountBy( MountByType val ) = 0;
1830 
1836  virtual MountByType getDefaultMountBy() const = 0;
1837 
1843  virtual void setDefaultFs(FsType val) = 0;
1844 
1850  virtual FsType getDefaultFs() const = 0;
1851 
1857  virtual void setDefaultSubvolName( const string& val) = 0;
1858 
1864  virtual string getDefaultSubvolName() const = 0;
1865 
1871  virtual bool getEfiBoot() = 0;
1872 
1883  virtual void setRootPrefix( const string& root ) = 0;
1884 
1890  virtual string getRootPrefix() const = 0;
1891 
1897  virtual void setDetectMountedVolumes( bool val ) = 0;
1898 
1904  virtual bool getDetectMountedVolumes() const = 0;
1905 
1913  virtual int removeVolume( const string& device ) = 0;
1914 
1925  virtual int createLvmVg( const string& name,
1926  unsigned long long peSizeK, bool lvm1,
1927  const deque<string>& devs ) = 0;
1928 
1936  virtual int removeLvmVg( const string& name ) = 0;
1937 
1945  virtual int extendLvmVg( const string& name,
1946  const deque<string>& devs ) = 0;
1947 
1955  virtual int shrinkLvmVg( const string& name,
1956  const deque<string>& devs ) = 0;
1957 
1969  virtual int createLvmLv( const string& vg, const string& name,
1970  unsigned long long sizeK, unsigned stripes,
1971  string& SWIG_OUTPUT(device) ) = 0;
1972 
1979  virtual int removeLvmLvByDevice( const string& device ) = 0;
1980 
1988  virtual int removeLvmLv( const string& vg, const string& name ) = 0;
1989 
1999  virtual int changeLvStripeCount( const string& vg, const string& name,
2000  unsigned long stripes ) = 0;
2001 
2011  virtual int changeLvStripeSize( const string& vg, const string& name,
2012  unsigned long long stripeSizeK) = 0;
2013 
2024  virtual int createLvmLvSnapshot(const string& vg, const string& origin,
2025  const string& name, unsigned long long cowSizeK,
2026  string& SWIG_OUTPUT(device) ) = 0;
2027 
2035  virtual int removeLvmLvSnapshot(const string& vg, const string& name) = 0;
2036 
2047  virtual int getLvmLvSnapshotStateInfo(const string& vg, const string& name,
2048  LvmLvSnapshotStateInfo& info) = 0;
2049 
2059  virtual int createLvmLvPool(const string& vg, const string& name,
2060  unsigned long long sizeK,
2061  string& SWIG_OUTPUT(device) ) = 0;
2062 
2073  virtual int createLvmLvThin(const string& vg, const string& name,
2074  const string& pool,
2075  unsigned long long sizeK,
2076  string& SWIG_OUTPUT(device) ) = 0;
2077 
2087  virtual int changeLvChunkSize( const string& vg, const string& name,
2088  unsigned long long chunkSizeK) = 0;
2089 
2097  virtual int nextFreeMd(unsigned& SWIG_OUTPUT(nr),
2098  string& SWIG_OUTPUT(device)) = 0;
2099 
2109  virtual int createMd(const string& name, MdType md_type, const list<string>& devices,
2110  const list<string>& spares) = 0;
2111 
2121  virtual int createMdAny(MdType md_type, const list<string>& devices,
2122  const list<string>& spares,
2123  string& SWIG_OUTPUT(device) ) = 0;
2124 
2133  virtual int removeMd( const string& name, bool destroySb ) = 0;
2134 
2144  virtual int extendMd(const string& name, const list<string>& devices,
2145  const list<string>& spares) = 0;
2146 
2156  virtual int updateMd(const string& name, const list<string>& devices,
2157  const list<string>& spares) = 0;
2158 
2168  virtual int shrinkMd(const string& name, const list<string>& devices,
2169  const list<string>& spares) = 0;
2170 
2179  virtual int changeMdType(const string& name, MdType md_type) = 0;
2180 
2189  virtual int changeMdChunk(const string& name, unsigned long chunkSizeK) = 0;
2190 
2199  virtual int changeMdParity( const string& name, MdParity ptype ) = 0;
2200 
2207  virtual int checkMd( const string& name ) = 0;
2208 
2218  virtual int getMdStateInfo(const string& name, MdStateInfo& info) = 0;
2219 
2229  virtual int getMdPartCoStateInfo(const string& name,
2230  MdPartCoStateInfo& info) = 0;
2231 
2244  virtual int computeMdSize(MdType md_type, const list<string>& devices,
2245  const list<string>& spares, unsigned long long& SWIG_OUTPUT(sizeK)) = 0;
2246 
2254  virtual list<int> getMdAllowedParity(MdType md_type, unsigned devnr) = 0;
2255 
2266  virtual int removeMdPartCo(const string& name, bool destroySb ) = 0;
2267 
2278  virtual int addNfsDevice(const string& nfsDev, const string& opts,
2279  unsigned long long sizeK, const string& mp,
2280  bool nfs4) = 0;
2281 
2291  virtual int checkNfsDevice(const string& nfsDev, const string& opts,
2292  bool nfs4, unsigned long long& SWIG_OUTPUT(sizeK)) = 0;
2293 
2310  virtual int createFileLoop( const string& lname, bool reuseExisting,
2311  unsigned long long sizeK,
2312  const string& mp, const string& pwd,
2313  string& SWIG_OUTPUT(device) ) = 0;
2314 
2332  virtual int modifyFileLoop( const string& device, const string& lname,
2333  bool reuseExisting,
2334  unsigned long long sizeK ) = 0;
2335 
2344  virtual int removeFileLoop( const string& lname, bool removeFile ) = 0;
2345 
2352  virtual int removeDmraid( const string& name ) = 0;
2353 
2361  virtual bool existSubvolume( const string& device, const string& name ) = 0;
2362 
2371  virtual int createSubvolume(const string& device, const string& name, bool nocow) = 0;
2372 
2380  virtual int removeSubvolume( const string& device, const string& name ) = 0;
2381 
2390  virtual int extendBtrfsVolume( const string& name,
2391  const deque<string>& devs ) = 0;
2392 
2401  virtual int shrinkBtrfsVolume( const string& name,
2402  const deque<string>& devs ) = 0;
2403 
2411  virtual int addTmpfsMount( const string& mp, const string& opts ) = 0;
2412 
2419  virtual int removeTmpfsMount( const string& mp ) = 0;
2420 
2426  virtual void getCommitInfos(list<CommitInfo>& infos) const = 0;
2427 
2433  virtual const string& getLastAction() const = 0;
2434 
2441  virtual const string& getExtendedErrorMessage() const = 0;
2442 
2443 // temporarily disable callback function for swig
2444 #ifndef SWIG
2445 
2451  virtual void setCallbackProgressBar(CallbackProgressBar pfnc) = 0;
2452 
2458  virtual CallbackProgressBar getCallbackProgressBar() const = 0;
2459 
2460 
2466  virtual void setCallbackShowInstallInfo(CallbackShowInstallInfo pfnc) = 0;
2467 
2473  virtual CallbackShowInstallInfo getCallbackShowInstallInfo() const = 0;
2474 
2475 
2482  virtual void setCallbackInfoPopup(CallbackInfoPopup pfnc) = 0;
2483 
2490  virtual CallbackInfoPopup getCallbackInfoPopup() const = 0;
2491 
2492 
2499  virtual void setCallbackYesNoPopup(CallbackYesNoPopup pfnc) = 0;
2500 
2507  virtual CallbackYesNoPopup getCallbackYesNoPopup() const = 0;
2508 
2509 
2515  virtual void setCallbackCommitErrorPopup(CallbackCommitErrorPopup pfnc) = 0;
2516 
2522  virtual CallbackCommitErrorPopup getCallbackCommitErrorPopup() const = 0;
2523 
2524 
2530  virtual void setCallbackPasswordPopup(CallbackPasswordPopup pfnc) = 0;
2531 
2538  virtual CallbackPasswordPopup getCallbackPasswordPopup() const = 0;
2539 
2540 #endif
2541 
2547  virtual void setCacheChanges (bool cache) = 0;
2548 
2552  virtual bool isCacheChanges () const = 0;
2553 
2557  virtual void setCommitCallbacks(const CommitCallbacks* commit_callbacks) = 0;
2558 
2563  virtual int commit() = 0;
2564 
2568  virtual string getErrorString(int error) const = 0;
2569 
2576  virtual int createBackupState( const string& name ) = 0;
2577 
2584  virtual int restoreBackupState( const string& name ) = 0;
2585 
2592  virtual bool checkBackupState(const string& name) const = 0;
2593 
2602  virtual bool equalBackupStates(const string& lhs, const string& rhs,
2603  bool verbose_log) const = 0;
2604 
2612  virtual int removeBackupState( const string& name ) = 0;
2613 
2621  virtual bool checkDeviceMounted(const string& device, list<string>& mps) = 0;
2622 
2633  virtual bool umountDevice( const string& device ) = 0;
2634 
2647  virtual bool umountDeviceUns( const string& device, bool unsetup ) = 0;
2648 
2659  virtual bool mountDevice( const string& device, const string& mp ) = 0;
2660 
2671  virtual int activateEncryption( const string& device, bool on ) = 0;
2672 
2684  virtual bool mountDeviceOpts( const string& device, const string& mp,
2685  const string& opts ) = 0;
2686 
2698  virtual bool mountDeviceRo( const string& device, const string& mp,
2699  const string& opts ) = 0;
2700 
2707  virtual bool checkDmMapsTo( const string& device ) = 0;
2708 
2714  virtual void removeDmTableTo( const string& device ) = 0;
2715 
2724  virtual int renameCryptDm( const string& device,
2725  const string& new_name ) = 0;
2726 
2738  virtual bool getFreeInfo(const string& device, bool get_resize, ResizeInfo& resize_info,
2739  bool get_content, ContentInfo& content_info, bool use_cache) = 0;
2740 
2748  virtual bool readFstab( const string& dir, deque<VolumeInfo>& infos) = 0;
2749 
2759  virtual void activateHld( bool val ) = 0;
2760 
2769  virtual void activateMultipath( bool val ) = 0;
2770 
2779  virtual void rescanEverything() = 0;
2780 
2789  virtual bool rescanCryptedObjects() = 0;
2790 
2794  virtual void dumpObjectList() = 0;
2795 
2799  virtual void dumpCommitInfos() const = 0;
2800 
2810  virtual int getContVolInfo(const string& dev, ContVolInfo& info) = 0;
2811 
2820  virtual int setUserdata(const string& device, const map<string, string>& userdata) = 0;
2821 
2829  virtual int getUserdata(const string& device, map<string, string>& userdata) = 0;
2830 
2831  };
2832 
2833 
2837  void initDefaultLogger( const string& logdir );
2838 
2843  typedef void (*CallbackLogDo)( int level, const string& component, const char* file,
2844  int line, const char* function, const string& content );
2845 
2850  typedef bool (*CallbackLogQuery)( int level, const string& component );
2851 
2855  void setLogDoCallback( CallbackLogDo pfc );
2856 
2860  CallbackLogDo getLogDoCallback();
2861 
2865  void setLogQueryCallback( CallbackLogQuery pfc );
2866 
2870  CallbackLogQuery getLogQueryCallback();
2871 
2876  {
2877  Environment(bool readonly, const string& logdir = "/var/log/YaST2")
2878  : readonly(readonly), testmode(false), autodetect(true),
2879  instsys(false), logdir(logdir), testdir("tmp")
2880  {
2881  storage::initDefaultLogger( logdir );
2882  }
2883 
2884  bool readonly;
2885  bool testmode;
2886  bool autodetect;
2887  bool instsys;
2888  string logdir;
2889  string testdir;
2890  };
2891 
2892 
2898  StorageInterface* createStorageInterface(const Environment& env);
2899 
2900 
2908  StorageInterface* createStorageInterfacePid(const Environment& env, int& SWIG_OUTPUT(locker_pid));
2909 
2910 
2914  void destroyStorageInterface(StorageInterface*);
2915 
2916 }
2917 
2918 
2919 #endif
virtual void activateMultipath(bool val)=0
virtual int nextFreeMd(unsigned &SWIG_OUTPUT(nr), string &SWIG_OUTPUT(device))=0
virtual int addFstabEntry(const string &device, const string &mount, const string &vfs, const string &options, unsigned freq, unsigned passno)=0
virtual int createMd(const string &name, MdType md_type, const list< string > &devices, const list< string > &spares)=0
virtual int extendMd(const string &name, const list< string > &devices, const list< string > &spares)=0
Definition: StorageInterface.h:644
virtual int resizePartition(const string &device, unsigned long sizeCyl)=0
Definition: StorageInterface.h:667
virtual int createMdAny(MdType md_type, const list< string > &devices, const list< string > &spares, string &SWIG_OUTPUT(device))=0
virtual bool checkDeviceMounted(const string &device, list< string > &mps)=0
virtual int addTmpfsMount(const string &mp, const string &opts)=0
virtual int removeLvmVg(const string &name)=0
virtual void getVolumes(deque< VolumeInfo > &infos)=0
virtual int getNfsInfo(deque< NfsInfo > &plist)=0
virtual int removeMdPartCo(const string &name, bool destroySb)=0
Definition: StorageInterface.h:239
virtual void setCallbackShowInstallInfo(CallbackShowInstallInfo pfnc)=0
virtual int getLoopInfo(deque< LoopInfo > &plist)=0
virtual int removeBackupState(const string &name)=0
virtual int forgetResizeVolume(const string &device)=0
virtual bool checkBackupState(const string &name) const =0
virtual int getLvmLvInfo(const string &name, deque< LvmLvInfo > &plist)=0
virtual int createPartition(const string &disk, PartitionType type, const RegionInfo &cylRegion, string &SWIG_OUTPUT(device))=0
virtual int setCryptPassword(const string &device, const string &pwd)=0
virtual int changeMountBy(const string &device, MountByType mby)=0
virtual PartAlign getPartitionAlignment() const =0
Definition: StorageInterface.h:286
virtual int createBackupState(const string &name)=0
virtual int checkMd(const string &name)=0
virtual void setCallbackCommitErrorPopup(CallbackCommitErrorPopup pfnc)=0
Definition: StorageInterface.h:547
virtual int getDmInfo(deque< DmInfo > &plist)=0
virtual const string & getLastAction() const =0
virtual bool readFstab(const string &dir, deque< VolumeInfo > &infos)=0
virtual int changeFormatVolume(const string &device, bool format, FsType fs)=0
virtual int getDmmultipathInfo(const string &name, deque< DmmultipathInfo > &plist)=0
virtual bool mountDeviceOpts(const string &device, const string &mp, const string &opts)=0
Definition: StorageInterface.h:513
virtual int getContMdPartCoInfo(const string &name, ContainerInfo &cinfo, MdPartCoInfo &info)=0
Definition: StorageInterface.h:635
virtual void activateHld(bool val)=0
virtual int addNfsDevice(const string &nfsDev, const string &opts, unsigned long long sizeK, const string &mp, bool nfs4)=0
virtual int changeMountPoint(const string &device, const string &mount)=0
Definition: StorageInterface.h:503
virtual int shrinkMd(const string &name, const list< string > &devices, const list< string > &spares)=0
virtual int getMdStateInfo(const string &name, MdStateInfo &info)=0
Definition: StorageInterface.h:2875
Definition: StorageInterface.h:622
Definition: StorageInterface.h:587
virtual void setZeroNewPartitions(bool val)=0
virtual int resizeVolumeNoFs(const string &device, unsigned long long newSizeK)=0
virtual MountByType getDefaultMountBy() const =0
virtual int changeDescText(const string &device, const string &txt)=0
virtual CallbackProgressBar getCallbackProgressBar() const =0
virtual int changePartitionId(const string &partition, unsigned id)=0
virtual int updatePartitionArea(const string &device, const RegionInfo &cylRegion)=0
virtual void getContainers(deque< ContainerInfo > &infos)=0
virtual int createPartitionMax(const string &disk, PartitionType type, string &SWIG_OUTPUT(device))=0
virtual int getUnusedPartitionSlots(const string &disk, list< PartitionSlotInfo > &slots)=0
Definition: StorageInterface.h:429
virtual int getContDmraidCoInfo(const string &name, ContainerInfo &cinfo, DmraidCoInfo &info)=0
virtual int createFileLoop(const string &lname, bool reuseExisting, unsigned long long sizeK, const string &mp, const string &pwd, string &SWIG_OUTPUT(device))=0
virtual int getUserdata(const string &device, map< string, string > &userdata)=0
Definition: StorageInterface.h:276
Definition: StorageInterface.h:421
virtual int shrinkLvmVg(const string &name, const deque< string > &devs)=0
virtual int setIgnoreFstab(const string &device, bool val)=0
Definition: StorageInterface.h:346
virtual unsigned long kbToCylinder(const string &disk, unsigned long long sizeK)=0
Definition: StorageInterface.h:485
virtual bool umountDevice(const string &device)=0
virtual int createPartitionKb(const string &disk, PartitionType type, const RegionInfo &kRegion, string &SWIG_OUTPUT(device))=0
virtual void setCallbackYesNoPopup(CallbackYesNoPopup pfnc)=0
virtual int changeLabelVolume(const string &device, const string &label)=0
virtual int getMdPartInfo(const string &device, deque< MdPartInfo > &plist)=0
virtual int createLvmLvPool(const string &vg, const string &name, unsigned long long sizeK, string &SWIG_OUTPUT(device))=0
virtual int removeMd(const string &name, bool destroySb)=0
virtual int changeLvChunkSize(const string &vg, const string &name, unsigned long long chunkSizeK)=0
Definition: StorageInterface.h:378
Definition: StorageInterface.h:364
virtual int getLvmLvSnapshotStateInfo(const string &vg, const string &name, LvmLvSnapshotStateInfo &info)=0
virtual int changeMdParity(const string &name, MdParity ptype)=0
virtual bool getDetectMountedVolumes() const =0
Definition: StorageInterface.h:295
virtual int nextFreePartition(const string &disk, PartitionType type, unsigned &SWIG_OUTPUT(nr), string &SWIG_OUTPUT(device))=0
virtual void dumpCommitInfos() const =0
Definition: StorageInterface.h:684
virtual int forgetChangePartitionId(const string &partition)=0
virtual bool getDlabelCapabilities(const string &dlabel, DlabelCapabilities &dlabelcapabilities) const =0
virtual int addFstabOptions(const string &device, const string &options)=0
virtual int setUserdata(const string &device, const map< string, string > &userdata)=0
virtual int getContLvmVgInfo(const string &name, ContainerInfo &cinfo, LvmVgInfo &info)=0
virtual int getContDiskInfo(const string &disk, ContainerInfo &cinfo, DiskInfo &info)=0
virtual int resizePartitionNoFs(const string &device, unsigned long sizeCyl)=0
virtual int setCrypt(const string &device, bool val)=0
Abstract class defining the interface for libstorage.
Definition: StorageInterface.h:981
virtual bool getFreeInfo(const string &device, bool get_resize, ResizeInfo &resize_info, bool get_content, ContentInfo &content_info, bool use_cache)=0
Definition: StorageInterface.h:653
virtual int changeLvStripeSize(const string &vg, const string &name, unsigned long long stripeSizeK)=0
virtual int getDmraidCoInfo(const string &name, DmraidCoInfo &info)=0
virtual int getTmpfsInfo(deque< TmpfsInfo > &plist)=0
virtual int getVolume(const string &device, VolumeInfo &info)=0
Definition: StorageInterface.h:223
virtual CallbackInfoPopup getCallbackInfoPopup() const =0
virtual int shrinkBtrfsVolume(const string &name, const deque< string > &devs)=0
virtual int getMountPoint(const string &device, string &SWIG_OUTPUT(mount))=0
virtual int initializeDisk(const string &disk, bool value)=0
virtual int getContVolInfo(const string &dev, ContVolInfo &info)=0
Definition: StorageInterface.h:527
virtual void setRootPrefix(const string &root)=0
virtual int changeMdType(const string &name, MdType md_type)=0
virtual string getRootPrefix() const =0
virtual int createLvmLvThin(const string &vg, const string &name, const string &pool, unsigned long long sizeK, string &SWIG_OUTPUT(device))=0
virtual void setDefaultSubvolName(const string &val)=0
virtual int getContDmmultipathCoInfo(const string &name, ContainerInfo &cinfo, DmmultipathCoInfo &info)=0
virtual int extendBtrfsVolume(const string &name, const deque< string > &devs)=0
virtual int resizeVolume(const string &device, unsigned long long newSizeK)=0
Definition: StorageInterface.h:536
Definition: StorageInterface.h:372
virtual void dumpObjectList()=0
virtual CallbackPasswordPopup getCallbackPasswordPopup() const =0
virtual void setCallbackProgressBar(CallbackProgressBar pfnc)=0
virtual bool rescanCryptedObjects()=0
Definition: StorageInterface.h:442
virtual int getMdInfo(deque< MdInfo > &plist)=0
virtual list< int > getMdAllowedParity(MdType md_type, unsigned devnr)=0
virtual string getPartitionName(const string &disk, int partition_no)=0
virtual int extendLvmVg(const string &name, const deque< string > &devs)=0
virtual int removePartition(const string &partition)=0
Definition: StorageInterface.h:556
virtual bool getZeroNewPartitions() const =0
virtual int activateEncryption(const string &device, bool on)=0
Definition: StorageInterface.h:475
virtual int removeLvmLvByDevice(const string &device)=0
virtual void removeDmTableTo(const string &device)=0
virtual int getCrypt(const string &device, bool &SWIG_OUTPUT(val))=0
virtual void setCallbackInfoPopup(CallbackInfoPopup pfnc)=0
virtual int changeMdChunk(const string &name, unsigned long chunkSizeK)=0
virtual CallbackCommitErrorPopup getCallbackCommitErrorPopup() const =0
virtual int setCryptType(const string &device, bool val, EncryptType typ)=0
virtual FsType getDefaultFs() const =0
virtual int createLvmVg(const string &name, unsigned long long peSizeK, bool lvm1, const deque< string > &devs)=0
virtual string getPartitionPrefix(const string &disk)=0
virtual int getMdPartCoInfo(const string &name, MdPartCoInfo &info)=0
virtual bool equalBackupStates(const string &lhs, const string &rhs, bool verbose_log) const =0
Definition: StorageInterface.h:314
virtual int getDiskInfo(const string &disk, DiskInfo &info)=0
virtual string defaultDiskLabel(const string &device)=0
virtual int createLvmLv(const string &vg, const string &name, unsigned long long sizeK, unsigned stripes, string &SWIG_OUTPUT(device))=0
virtual int createPartitionAny(const string &disk, unsigned long long sizeK, string &SWIG_OUTPUT(device))=0
virtual void rescanEverything()=0
virtual const string & getExtendedErrorMessage() const =0
virtual string getErrorString(int error) const =0
virtual bool getRecursiveRemoval() const =0
virtual int changeMkfsOptVolume(const string &device, const string &opts)=0
virtual int commit()=0
virtual void setPartitionAlignment(PartAlign val)=0
Definition: StorageInterface.h:610
virtual unsigned long long cylinderToKb(const string &disk, unsigned long sizeCyl)=0
Definition: StorageInterface.h:601
virtual string getDefaultSubvolName() const =0
virtual int getLvmVgInfo(const string &name, LvmVgInfo &info)=0
virtual bool checkDmMapsTo(const string &device)=0
virtual int removeVolume(const string &device)=0
virtual void setDefaultMountBy(MountByType val)=0
virtual int destroyPartitionTable(const string &disk, const string &label)=0
virtual bool needCryptPassword(const string &device)=0
virtual int getMdPartCoStateInfo(const string &name, MdPartCoStateInfo &info)=0
virtual bool getEfiBoot()=0
virtual bool getFsCapabilities(FsType fstype, FsCapabilities &fscapabilities) const =0
virtual CallbackShowInstallInfo getCallbackShowInstallInfo() const =0
virtual int getDmraidInfo(const string &name, deque< DmraidInfo > &plist)=0
virtual void setDefaultFs(FsType val)=0
virtual int getPartitionInfo(const string &disk, deque< PartitionInfo > &plist)=0
virtual int computeMdSize(MdType md_type, const list< string > &devices, const list< string > &spares, unsigned long long &SWIG_OUTPUT(sizeK))=0
virtual int createSubvolume(const string &device, const string &name, bool nocow)=0
virtual void setCommitCallbacks(const CommitCallbacks *commit_callbacks)=0
Definition: StorageInterface.h:457
virtual int removeSubvolume(const string &device, const string &name)=0
virtual int forgetCryptPassword(const string &device)=0
virtual MultipathAutostart getMultipathAutostart() const =0
virtual int updateMd(const string &name, const list< string > &devices, const list< string > &spares)=0
virtual int removeLvmLv(const string &vg, const string &name)=0
virtual int renameCryptDm(const string &device, const string &new_name)=0
virtual int getMountBy(const string &device, MountByType &SWIG_OUTPUT(mby))=0
virtual int modifyFileLoop(const string &device, const string &lname, bool reuseExisting, unsigned long long sizeK)=0
virtual int getBtrfsInfo(deque< BtrfsInfo > &plist)=0
virtual int removeFileLoop(const string &lname, bool removeFile)=0
virtual bool existSubvolume(const string &device, const string &name)=0
virtual int verifyCryptPassword(const string &device, const string &pwd, bool erase)=0
virtual int changeLvStripeCount(const string &vg, const string &name, unsigned long stripes)=0
Definition: StorageInterface.h:389
virtual int getDmmultipathCoInfo(const string &name, DmmultipathCoInfo &info)=0
virtual int changeTunefsOptVolume(const string &device, const string &opts)=0
virtual int getRecursiveUsing(const list< string > &devices, bool itself, list< string > &using_devices)=0
virtual bool isCacheChanges() const =0
virtual void setDetectMountedVolumes(bool val)=0
virtual int freeCylindersAroundPartition(const string &device, unsigned long &SWIG_OUTPUT(freeCylsBefore), unsigned long &SWIG_OUTPUT(freeCylsAfter))=0
virtual int checkNfsDevice(const string &nfsDev, const string &opts, bool nfs4, unsigned long long &SWIG_OUTPUT(sizeK))=0
virtual int removeDmraid(const string &name)=0
virtual int getFstabOptions(const string &device, string &SWIG_OUTPUT(options))=0
Definition: StorageInterface.h:257
virtual int removeTmpfsMount(const string &mp)=0
virtual int getIgnoreFstab(const string &device, bool &SWIG_OUTPUT(val))=0
virtual int restoreBackupState(const string &name)=0
Definition: StorageInterface.h:324
virtual void getCommitInfos(list< CommitInfo > &infos) const =0
Definition: StorageInterface.h:267
virtual int getCryptPassword(const string &device, string &SWIG_OUTPUT(pwd))=0
virtual bool mountDevice(const string &device, const string &mp)=0
virtual void setMultipathAutostart(MultipathAutostart multipath_autostart)=0
virtual void setCacheChanges(bool cache)=0
virtual bool mountDeviceRo(const string &device, const string &mp, const string &opts)=0
virtual void setCallbackPasswordPopup(CallbackPasswordPopup pfnc)=0
Definition: StorageInterface.h:569
virtual int removeFstabOptions(const string &device, const string &options)=0
virtual int removeLvmLvSnapshot(const string &vg, const string &name)=0
virtual void setRecursiveRemoval(bool val)=0
virtual int createLvmLvSnapshot(const string &vg, const string &origin, const string &name, unsigned long long cowSizeK, string &SWIG_OUTPUT(device))=0
virtual CallbackYesNoPopup getCallbackYesNoPopup() const =0
virtual bool umountDeviceUns(const string &device, bool unsetup)=0
virtual list< string > getAllUsedFs() const =0
virtual int getRecursiveUsedBy(const list< string > &devices, bool itself, list< string > &usedby_devices)=0
virtual int changeFstabOptions(const string &device, const string &options)=0