[yast-commit] r41367 - in /branches/SuSE-SLE-10-SP1-Branch/storage: libstorage/src/ package/ storage/src/include/ storage/src/modules/
Author: fehr Date: Thu Oct 11 13:27:21 2007 New Revision: 41367 URL: http://svn.opensuse.org/viewcvs/yast?rev=41367&view=rev Log: improve discrimination between EFI and win partitions (#287289) Modified: branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Storage.cc branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Storage.h branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/StorageInterface.h branches/SuSE-SLE-10-SP1-Branch/storage/package/yast2-storage.changes branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/include/do_proposal_flexible.ycp branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/modules/Storage.ycp Modified: branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Storage.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Storage.cc?rev=41367&r1=41366&r2=41367&view=diff ============================================================================== --- branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Storage.cc (original) +++ branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Storage.cc Thu Oct 11 13:27:21 2007 @@ -5049,7 +5049,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(); @@ -5059,7 +5060,7 @@ if( findVolume( device, vol ) ) { if( use_cache && getFreeInf( vol->device(), df_free, resize_free, - used, win, ret )) + used, win, efi, ret )) { } else @@ -5132,6 +5133,9 @@ win = access( f.c_str(), R_OK )==0; i++; } + efi = vol->getFs()==VFAT && checkDir( mp + "/efi" ); + if( efi ) + win = false; } if( needUmount ) { @@ -5146,7 +5150,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 ) @@ -5158,19 +5163,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<string,FreeInfo>::iterator i = freeInfo.find( device ); bool ret = i!=freeInfo.end(); @@ -5180,12 +5187,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: branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Storage.h URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Storage.h?rev=41367&r1=41366&r2=41367&view=diff ============================================================================== --- branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Storage.h (original) +++ branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Storage.h Thu Oct 11 13:27:21 2007 @@ -124,12 +124,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: @@ -280,7 +283,8 @@ bool readFstab( const string& dir, deque<storage::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 ); @@ -1292,10 +1296,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: branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/StorageInterface.h URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/StorageInterface.h?rev=41367&r1=41366&r2=41367&view=diff ============================================================================== --- branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/StorageInterface.h (original) +++ branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/StorageInterface.h Thu Oct 11 13:27:21 2007 @@ -1860,7 +1860,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: branches/SuSE-SLE-10-SP1-Branch/storage/package/yast2-storage.changes URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/package/yast2-storage.changes?rev=41367&r1=41366&r2=41367&view=diff ============================================================================== --- branches/SuSE-SLE-10-SP1-Branch/storage/package/yast2-storage.changes (original) +++ branches/SuSE-SLE-10-SP1-Branch/storage/package/yast2-storage.changes Thu Oct 11 13:27:21 2007 @@ -8,6 +8,7 @@ - overwrite newly created md devices as partitions (#266538) - handle EVMS over md correctly in GetUsedEvmsDisks (#266538) - fixed crash during detection caused by empty key-value-pair (#278169) +- improve discrimination between EFI and win partitions (#287289) ------------------------------------------------------------------- Mon Oct 8 10:49:37 CEST 2007 - fehr@suse.de Modified: branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/include/do_proposal_flexible.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/include/do_proposal_flexible.ycp?rev=41367&r1=41366&r2=41367&view=diff ============================================================================== --- branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/include/do_proposal_flexible.ycp (original) +++ branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/include/do_proposal_flexible.ycp Thu Oct 11 13:27:21 2007 @@ -1634,7 +1634,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; @@ -2519,7 +2520,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: branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/modules/Storage.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/modules/Storage.ycp?rev=41367&r1=41366&r2=41367&view=diff ============================================================================== --- branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/modules/Storage.ycp (original) +++ branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/modules/Storage.ycp Thu Oct 11 13:27:21 2007 @@ -694,11 +694,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 @@ -781,6 +782,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), @@ -3014,6 +3016,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. @@ -3046,7 +3056,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
participants (1)
-
fehr@svn.opensuse.org