Author: fehr
Date: Tue Jul 3 16:52:34 2007
New Revision: 39148
URL: http://svn.opensuse.org/viewcvs/yast?rev=39148&view=rev
Log:
improve discrimination between EFI and win partitions (#287289)
Modified:
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/include/do_proposal_flexible.ycp
trunk/storage/storage/src/modules/Storage.ycp
Modified: trunk/storage/libstorage/src/Storage.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Storage.cc?rev=39148&r1=39147&r2=39148&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Storage.cc (original)
+++ trunk/storage/libstorage/src/Storage.cc Tue Jul 3 16:52:34 2007
@@ -5639,7 +5639,8 @@
bool
Storage::getFreeInfo( const string& device, unsigned long long& resize_free,
unsigned long long& df_free,
- unsigned long long& used, bool& win, bool use_cache )
+ unsigned long long& used, bool& win, bool& efi,
+ bool use_cache )
{
bool ret = false;
assertInit();
@@ -5649,7 +5650,7 @@
if( findVolume( device, vol ) )
{
if( use_cache && getFreeInf( vol->device(), df_free, resize_free,
- used, win, ret ))
+ used, win, efi, ret ))
{
}
else
@@ -5723,6 +5724,9 @@
win = access( f.c_str(), R_OK )==0;
i++;
}
+ efi = vol->getFs()==VFAT && checkDir( mp + "/efi" );
+ if( efi )
+ win = false;
}
if( needUmount )
{
@@ -5737,7 +5741,8 @@
if( !ret )
vol->crUnsetup();
}
- setFreeInfo( vol->device(), df_free, resize_free, used, win, ret );
+ setFreeInfo( vol->device(), df_free, resize_free, used, win, efi,
+ ret );
}
}
if( ret )
@@ -5749,19 +5754,21 @@
void Storage::setFreeInfo( const string& device, unsigned long long df_free,
unsigned long long resize_free,
- unsigned long long used, bool win, bool resize_ok )
+ unsigned long long used, bool win, bool efi,
+ bool resize_ok )
{
- y2milestone( "device:%s df_free:%llu resize_free:%llu used:%llu win:%d",
- device.c_str(), df_free, resize_free, used, win );
+ y2milestone( "device:%s df_free:%llu resize_free:%llu used:%llu win:%d efi:%d",
+ device.c_str(), df_free, resize_free, used, win, efi );
- FreeInfo inf( df_free, resize_free, used, win, resize_ok );
+ FreeInfo inf( df_free, resize_free, used, win, efi, resize_ok );
freeInfo[device] = inf;
}
bool
Storage::getFreeInf( const string& device, unsigned long long& df_free,
unsigned long long& resize_free,
- unsigned long long& used, bool& win, bool& resize_ok )
+ unsigned long long& used, bool& win, bool& efi,
+ bool& resize_ok )
{
map::iterator i = freeInfo.find( device );
bool ret = i!=freeInfo.end();
@@ -5771,12 +5778,13 @@
resize_free = i->second.resize_free;
used = i->second.used;
win = i->second.win;
+ efi = i->second.efi;
resize_ok = i->second.rok;
}
y2milestone( "device:%s ret:%d", device.c_str(), ret );
if( ret )
- y2milestone( "df_free:%llu resize_free:%llu used:%llu win:%d resize_ok:%d",
- df_free, resize_free, used, win, resize_ok );
+ y2milestone( "df_free:%llu resize_free:%llu used:%llu win:%d efi:%d resize_ok:%d",
+ df_free, resize_free, used, win, efi, resize_ok );
return( ret );
}
Modified: trunk/storage/libstorage/src/Storage.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Storage.h?rev=39148&r1=39147&r2=39148&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Storage.h (original)
+++ trunk/storage/libstorage/src/Storage.h Tue Jul 3 16:52:34 2007
@@ -184,12 +184,15 @@
unsigned long long df_free;
unsigned long long used;
bool win;
+ bool efi;
bool rok;
- FreeInfo() { resize_free=df_free=used=0; win=rok=false; }
+ FreeInfo() { resize_free=df_free=used=0; efi=win=rok=false; }
FreeInfo( unsigned long long df,
unsigned long long resize,
- unsigned long long usd, bool w=false, bool r=true )
- { resize_free=resize; df_free=df; used=usd; win=w; rok=r; }
+ unsigned long long usd, bool w=false, bool e=false,
+ bool r=true )
+ { resize_free=resize; df_free=df; used=usd; win=w;
+ efi=e, rok=r; }
};
public:
@@ -356,7 +359,8 @@
bool readFstab( const string& dir, dequestorage::VolumeInfo& infos);
bool getFreeInfo( const string& device, unsigned long long& resize_free,
unsigned long long& df_free,
- unsigned long long& used, bool& win, bool use_cache );
+ unsigned long long& used, bool& win, bool& efi,
+ bool use_cache );
int createBackupState( const string& name );
int removeBackupState( const string& name );
int restoreBackupState( const string& name );
@@ -1614,10 +1618,12 @@
void deleteBackups();
void setFreeInfo( const string& device, unsigned long long df_free,
unsigned long long resize_free,
- unsigned long long used, bool win, bool resize_ok );
+ unsigned long long used, bool win, bool efi,
+ bool resize_ok );
bool getFreeInf( const string& device, unsigned long long& df_free,
unsigned long long& resize_free,
- unsigned long long& used, bool& win, bool& resize_ok );
+ unsigned long long& used, bool& win, bool& efi,
+ bool& resize_ok );
// protected internal member variables
bool readonly;
Modified: trunk/storage/libstorage/src/StorageInterface.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/StorageInterface.h?rev=39148&r1=39147&r2=39148&view=diff
==============================================================================
--- trunk/storage/libstorage/src/StorageInterface.h (original)
+++ trunk/storage/libstorage/src/StorageInterface.h Tue Jul 3 16:52:34 2007
@@ -1979,7 +1979,7 @@
unsigned long long& resize_free,
unsigned long long& df_free,
unsigned long long& used,
- bool& win, bool use_cache ) = 0;
+ bool& win, bool& efi, bool use_cache ) = 0;
/**
* Read fstab and cryptotab, if existent, from a specified directory and
Modified: trunk/storage/package/yast2-storage.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/package/yast2-storage.changes?rev=39148&r1=39147&r2=39148&view=diff
==============================================================================
--- trunk/storage/package/yast2-storage.changes (original)
+++ trunk/storage/package/yast2-storage.changes Tue Jul 3 16:52:34 2007
@@ -1,4 +1,9 @@
-------------------------------------------------------------------
+Tue Jul 3 16:50:38 CEST 2007 - fehr@suse.de
+
+- improve discrimination between EFI and win partitions (#287289)
+
+-------------------------------------------------------------------
Mon Jul 2 19:36:31 CEST 2007 - fehr@suse.de
- prevent some rpmlint warnings
Modified: trunk/storage/storage/src/include/do_proposal_flexible.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/do_proposal_flexible.ycp?rev=39148&r1=39147&r2=39148&view=diff
==============================================================================
--- trunk/storage/storage/src/include/do_proposal_flexible.ycp (original)
+++ trunk/storage/storage/src/include/do_proposal_flexible.ycp Tue Jul 3 16:52:34 2007
@@ -1661,7 +1661,8 @@
{
win = p["winfo"]:$[];
y2milestone( "try_resize_windows win=%1", win );
- if( win != nil && win["ok"]:false && p["size_k"]:0 > 1024*1024 )
+ if( win != nil && win["ok"]:false && p["size_k"]:0 > 1024*1024 &&
+ !win["efi"]:false )
{
p["winfo"] = win;
p["resize"] = true;
@@ -2558,7 +2559,7 @@
if( ret )
{
if( assert_cons_fs )
- ret = p["winfo","ok"]:false;
+ ret = p["winfo","ok"]:false && !p["winfo","efi"]:false;
else
ret = size(p["winfo"]:$[])>0;
}
Modified: trunk/storage/storage/src/modules/Storage.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/modules/Storage.ycp?rev=39148&r1=39147&r2=39148&view=diff
==============================================================================
--- trunk/storage/storage/src/modules/Storage.ycp (original)
+++ trunk/storage/storage/src/modules/Storage.ycp Tue Jul 3 16:52:34 2007
@@ -743,11 +743,12 @@
integer resize_free = 0;
integer df_free = 0;
boolean win_disk = false;
+ boolean efi = false;
boolean r = false;
r = LibStorage::StorageInterface::getFreeInfo( sint, device, resize_free,
df_free, used, win_disk,
- used_fs==`ntfs );
+ efi, used_fs==`ntfs );
resize_free = resize_free * 1024; // Byte
df_free = df_free * 1024; // Byte
@@ -830,6 +831,7 @@
"df_free" : df_free,
"used":used,
"win_disk":win_disk,
+ "efi":efi,
"linux_size":linux_size,
"max_win_size":used + resize_free + add_free - min_linux_size,
"ntfs" : (used_fs == `ntfs),
@@ -3166,6 +3168,14 @@
return( ret );
}
+define boolean IsEfiPartition( map p )
+ {
+ map m = GetFreeSpace( p["device"]:"", 0, p["used_fs"]:`none, false );
+ boolean ret = m["efi"]:false;
+ y2milestone( "IsEfiPartition ret:%1", ret );
+ return( ret );
+ }
+
/**
* Search in the list partitions for windows partitions and add the key
* "mount" to the found windows partitions.
@@ -3198,7 +3208,7 @@
((partnum<=max_prim)==primary) &&
foreign_nr < 24 &&
Partitions::IsDosWinNtPartition(fsid) &&
- (!Arch::ia64() || partition["size_k"]:0 >= 1024*1024) &&
+ (!Arch::ia64() || !IsEfiPartition(partition)) &&
contains( [`vfat, `ntfs], partition["used_fs"]:`none ))
{
new_partition["fstopt"] =
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org