Author: aschnell
Date: Thu Oct 9 20:05:25 2008
New Revision: 52058
URL: http://svn.opensuse.org/viewcvs/yast?rev=52058&view=rev
Log:
- make default disk label depend on EFI (bnc #433166)
Modified:
trunk/storage/libstorage/src/Disk.cc
trunk/storage/libstorage/src/Disk.h
trunk/storage/libstorage/src/Storage.cc
trunk/storage/libstorage/src/Storage.h
trunk/storage/libstorage/src/StorageInterface.h
trunk/storage/package/yast2-storage.changes
trunk/storage/storage/src/modules/Partitions.ycp
trunk/storage/storage/src/modules/Storage.ycp
Modified: trunk/storage/libstorage/src/Disk.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Disk.cc?rev=52058&r1=52057&r2=52058&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Disk.cc (original)
+++ trunk/storage/libstorage/src/Disk.cc Thu Oct 9 20:05:25 2008
@@ -431,7 +431,7 @@
if( detected_label.empty() )
detected_label = dlabel;
if( dlabel.empty() )
- dlabel = defaultLabel(size_k);
+ dlabel = defaultLabel(getStorage(), size_k);
setLabelData( dlabel );
if (label == "unsupported")
@@ -1013,10 +1013,13 @@
#define EB (1024ULL * 1024ULL * 1024ULL * 1024ULL)
#define PB (1024ULL * 1024ULL * 1024ULL * 1024ULL * 1024ULL)
-string Disk::defaultLabel( unsigned long long size_k )
- {
+string
+Disk::defaultLabel(const Storage& storage, unsigned long long size_k)
+{
string ret = "msdos";
- if( Storage::arch()=="ia64" )
+ if (storage.efiBoot())
+ ret = "gpt";
+ else if( Storage::arch()=="ia64" )
ret = "gpt";
else if( Storage::arch()=="sparc" )
ret = "sun";
@@ -1026,9 +1029,9 @@
ret = "amiga";
if( size_k>2*TB )
ret = "gpt";
- y2milestone( "size_k:%llu ret:%s", size_k, ret.c_str() );
- return( ret );
- }
+ y2mil("efiboot:" << storage.efiBoot() << " size_k:" << size_k << " ret:" << ret);
+ return ret;
+}
Disk::label_info Disk::labels[] = {
{ "msdos", true, 4, 63, 2*TB },
Modified: trunk/storage/libstorage/src/Disk.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Disk.h?rev=52058&r1=52057&r2=52058&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Disk.h (original)
+++ trunk/storage/libstorage/src/Disk.h Thu Oct 9 20:05:25 2008
@@ -202,7 +202,7 @@
bool haveBsdPart( const std::list& pl) const;
void setLabelData( const string& );
- static string defaultLabel( unsigned long long size_k );
+ static string defaultLabel( const Storage&, unsigned long long size_k );
static label_info labels[];
static string p_disks[];
Modified: trunk/storage/libstorage/src/Storage.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Storage.cc?rev=52058&r1=52057&r2=52058&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Storage.cc (original)
+++ trunk/storage/libstorage/src/Storage.cc Thu Oct 9 20:05:25 2008
@@ -80,6 +80,7 @@
char * tenv = getenv( "YAST_IS_RUNNING" );
inst_sys = tenv!=NULL && strcmp(tenv,"instsys")==0;
root_mounted = !inst_sys;
+ efiboot = false;
hald_pid = 0;
if( !testmode )
testmode = getenv( "YAST2_STORAGE_TMODE" )!=NULL;
@@ -154,6 +155,7 @@
if( autodetect )
{
detectArch();
+ efiboot = (arch() == "ia64");
}
if( testmode )
{
@@ -901,6 +903,12 @@
defaultMountBy = val;
}
+void Storage::setEfiBoot(bool val)
+{
+ y2milestone("val:%d", val);
+ efiboot = val;
+}
+
void Storage::setRootPrefix( const string& root )
{
y2milestone( "root:%s", root.c_str() );
@@ -1764,17 +1772,19 @@
return( ret );
}
+
string
Storage::defaultDiskLabel() const
- {
- return( Disk::defaultLabel(0) );
- }
+{
+ return Disk::defaultLabel(this, 0);
+}
string
Storage::defaultDiskLabelSize( unsigned long long size_k ) const
- {
- return( Disk::defaultLabel(size_k) );
- }
+{
+ return Disk::defaultLabel(this, size_k);
+}
+
unsigned long long
Storage::maxSizeLabelK( const string& label ) const
Modified: trunk/storage/libstorage/src/Storage.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Storage.h?rev=52058&r1=52057&r2=52058&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Storage.h (original)
+++ trunk/storage/libstorage/src/Storage.h Thu Oct 9 20:05:25 2008
@@ -221,6 +221,7 @@
const string& root() const { return( rootprefix ); }
string prependRoot(const string& mp) const;
const string& tmpDir() const;
+ bool efiBoot() const { return efiboot; }
static const string& arch() { return( proc_arch ); }
static bool isPPCMac() { return( is_ppc_mac ); }
static bool isPPCPegasos() { return( is_ppc_pegasos ); }
@@ -360,7 +361,10 @@
MountByType getDefaultMountBy() const { return defaultMountBy; }
void setDetectMountedVolumes( bool val=true );
bool getDetectMountedVolumes() const { return detectMounted; }
+ void setEfiBoot(bool val);
+ bool getEfiBoot() const { return efiboot; }
void setRootPrefix( const string& root );
+ string getRootPrefix() const { return rootprefix; }
int removeVolume( const string& device );
int removeUsing( const string& device, const storage::usedBy& uby );
bool checkDeviceMounted( const string& device, string& mp );
@@ -1726,6 +1730,7 @@
string rootprefix;
string logdir;
unsigned hald_pid;
+ bool efiboot;
static string proc_arch;
static bool is_ppc_mac;
static bool is_ppc_pegasos;
Modified: trunk/storage/libstorage/src/StorageInterface.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/StorageInterface.h?rev=52058&r1=52057&r2=52058&view=diff
==============================================================================
--- trunk/storage/libstorage/src/StorageInterface.h (original)
+++ trunk/storage/libstorage/src/StorageInterface.h Thu Oct 9 20:05:25 2008
@@ -1412,7 +1412,24 @@
virtual MountByType getDefaultMountBy() const = 0;
/**
+ * Set value for EFI boot.
+ *
+ * Currently this value affects the default disk label.
+ *
+ * @param val new efi boot value
+ */
+ virtual void setEfiBoot(bool val) = 0;
+
+ /**
+ * Get value for EFI boot.
+ *
+ * @return value for efi boot
+ */
+ virtual bool getEfiBoot() const = 0;
+
+ /**
* Set value for root prefix.
+ *
* This value is appended to all mount points of volumes, when
* changes are commited. Config files fstab, cryptotab, raidtab and
* mdadm.conf are also created relative to this prefix.
@@ -1423,6 +1440,13 @@
virtual void setRootPrefix( const string& root ) = 0;
/**
+ * Get value for root prefix.
+ *
+ * @return value for root prefix
+ */
+ virtual string getRootPrefix() const = 0;
+
+ /**
* Determine of libstorage should detect mounted volumes.
*
* @param val flag if mounted volumes should be detected
Modified: trunk/storage/package/yast2-storage.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/package/yast2-storage.changes?rev=52058&r1=52057&r2=52058&view=diff
==============================================================================
--- trunk/storage/package/yast2-storage.changes (original)
+++ trunk/storage/package/yast2-storage.changes Thu Oct 9 20:05:25 2008
@@ -5,7 +5,8 @@
- don't reset mount point (bnc #432954)
- fixed creating encrypted logical volumes (bnc #433462)
- include file system type in tables (bnc #428142)
-- make EFI require GPT (bnc #433166)
+- make EFI require GPT and make default disk label depend on EFI
+ (bnc #433166)
- 2.17.36
-------------------------------------------------------------------
Modified: trunk/storage/storage/src/modules/Partitions.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/modules/Partitions.ycp?rev=52058&r1=52057&r2=52058&view=diff
==============================================================================
--- trunk/storage/storage/src/modules/Partitions.ycp (original)
+++ trunk/storage/storage/src/modules/Partitions.ycp Thu Oct 9 20:05:25 2008
@@ -101,6 +101,8 @@
global boolean EfiBoot()
{
+ // TODO: move to libstorage
+
boolean ret = false;
if (Arch::ia64())
Modified: trunk/storage/storage/src/modules/Storage.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/modules/Storage.ycp?rev=52058&r1=52057&r2=52058&view=diff
==============================================================================
--- trunk/storage/storage/src/modules/Storage.ycp (original)
+++ trunk/storage/storage/src/modules/Storage.ycp Thu Oct 9 20:05:25 2008
@@ -337,13 +337,15 @@
y2error("Storage::CreateInterface failed");
return false;
}
-
+
if (Stage::initial())
{
LibStorage::StorageInterface::setDetectMountedVolumes(sint, false);
LibStorage::StorageInterface::setRootPrefix(sint, Installation::destdir);
}
+ LibStorage::StorageInterface::setEfiBoot(sint, Partitions::EfiBoot());
+
conts = getContainers();
y2milestone("InitLibstorage conts:%1", conts);
FileSystems::InitSlib(sint);
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org