Author: fehr
Date: Mon Jul 16 18:15:42 2007
New Revision: 39451
URL: http://svn.opensuse.org/viewcvs/yast?rev=39451&view=rev
Log:
- do internal mounts readonly where possible
- version 2.15.18
Modified:
trunk/storage/libstorage/src/Storage.cc
trunk/storage/libstorage/src/Storage.h
trunk/storage/libstorage/src/StorageInterface.h
trunk/storage/libstorage/src/Volume.cc
trunk/storage/libstorage/src/Volume.h
trunk/storage/package/yast2-storage.changes
Modified: trunk/storage/libstorage/src/Storage.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Storage.cc?rev=39451&r1=39450&r2=39451&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Storage.cc (original)
+++ trunk/storage/libstorage/src/Storage.cc Mon Jul 16 18:15:42 2007
@@ -223,7 +223,7 @@
ProcPart* ppart = new ProcPart;
if( EvmsCo::canDoEvms() )
{
- char * file = "/etc/evms.conf";
+ const char * file = "/etc/evms.conf";
if( access( file, R_OK )==0 )
{
SystemCmd cmd( (string)"grep exclude " + file );
@@ -5580,11 +5580,11 @@
}
bool
-Storage::mountDevice( const string& device, const string& mp )
+Storage::mountDev( const string& device, const string& mp, bool ro )
{
bool ret = true;
assertInit();
- y2milestone( "device:%s mp:%s", device.c_str(), mp.c_str() );
+ y2milestone( "device:%s mp:%s ro:%d", device.c_str(), mp.c_str(), ro );
VolIterator vol;
if( !readonly && findVolume( device, vol ) )
{
@@ -5594,7 +5594,7 @@
}
if( ret )
{
- ret = vol->mount( mp )==0;
+ ret = vol->mount( mp, ro )==0;
}
if( !ret )
vol->crUnsetup();
@@ -5664,7 +5664,7 @@
unlink( mdir.c_str() );
rmdir( mdir.c_str() );
if( vol->getFs()!=FSUNKNOWN && mkdir( mdir.c_str(), 0700 )==0 &&
- mountDevice( device, mdir ) )
+ mountDev( device, mdir ) )
{
needUmount = true;
mp = mdir;
@@ -5714,8 +5714,8 @@
ret = false;
}
win = false;
- char * files[] = { "boot.ini", "msdos.sys", "io.sys",
- "config.sys", "MSDOS.SYS", "IO.SYS" };
+ const char * files[] = { "boot.ini", "msdos.sys", "io.sys",
+ "config.sys", "MSDOS.SYS", "IO.SYS" };
string f;
unsigned i=0;
while( !win && ihttp://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Storage.h?rev=39451&r1=39450&r2=39451&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Storage.h (original)
+++ trunk/storage/libstorage/src/Storage.h Mon Jul 16 18:15:42 2007
@@ -355,7 +355,11 @@
int removeUsing( const string& device, const storage::usedBy& uby );
bool checkDeviceMounted( const string& device, string& mp );
bool umountDevice( const string& device );
- bool mountDevice( const string& device, const string& mp );
+ bool mountDev( const string& device, const string& mp, bool ro=true );
+ bool mountDevice( const string& device, const string& mp )
+ { return( mountDev( device, mp, false )); }
+ bool mountDeviceRo( const string& device, const string& mp )
+ { return( mountDev( device, mp, true )); }
bool readFstab( const string& dir, dequestorage::VolumeInfo& infos);
bool getFreeInfo( const string& device, unsigned long long& resize_free,
unsigned long long& df_free,
Modified: trunk/storage/libstorage/src/StorageInterface.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/StorageInterface.h?rev=39451&r1=39450&r2=39451&view=diff
==============================================================================
--- trunk/storage/libstorage/src/StorageInterface.h (original)
+++ trunk/storage/libstorage/src/StorageInterface.h Mon Jul 16 18:15:42 2007
@@ -1950,6 +1950,17 @@
virtual bool mountDevice( const string& device, const string& mp ) = 0;
/**
+ * Mount the given device readonly and do what is necessary to access
+ * volume (e.g. do losetup if loop is set up)
+ * The function mounts at once, /etc/fstab is unaffected
+ *
+ * @param device device name to mount
+ * @param mp mount point to mount to
+ * @return bool if mount succeeded
+ */
+ virtual bool mountDeviceRo( const string& device, const string& mp ) = 0;
+
+ /**
* Check if there are dm maps to a given device
*
* @param device device name for which dm maps should be checked
Modified: trunk/storage/libstorage/src/Volume.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Volume.cc?rev=39451&r1=39450&r2=39451&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Volume.cc (original)
+++ trunk/storage/libstorage/src/Volume.cc Mon Jul 16 18:15:42 2007
@@ -2040,11 +2040,11 @@
return( ret );
}
-int Volume::mount( const string& m )
+int Volume::mount( const string& m, bool ro )
{
SystemCmd cmd;
- y2milestone( "device:%s mp:%s", dev.c_str(), m.c_str() );
+ y2milestone( "device:%s mp:%s ro:%d", dev.c_str(), m.c_str(), ro );
string cmdline;
if( fs != SWAP )
{
@@ -2072,6 +2072,8 @@
cmd.execute( cmdline );
}
cmdline = "mount ";
+ if( ro )
+ cmdline += "-r ";
const char * ign_opt[] = { "defaults", "" };
const char * ign_beg[] = { "loop", "encryption=", "phash=",
"itercountk=" };
Modified: trunk/storage/libstorage/src/Volume.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Volume.h?rev=39451&r1=39450&r2=39451&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Volume.h (original)
+++ trunk/storage/libstorage/src/Volume.h Mon Jul 16 18:15:42 2007
@@ -133,7 +133,7 @@
int prepareRemove();
int umount( const string& mp="" );
int crUnsetup( bool force=false );
- int mount( const string& mp="" );
+ int mount( const string& mp="", bool ro=false );
int canResize( unsigned long long newSizeK ) const;
int doMount();
int doFormat();
Modified: trunk/storage/package/yast2-storage.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/package/yast2-storage.changes?rev=39451&r1=39450&r2=39451&view=diff
==============================================================================
--- trunk/storage/package/yast2-storage.changes (original)
+++ trunk/storage/package/yast2-storage.changes Mon Jul 16 18:15:42 2007
@@ -2,6 +2,8 @@
Mon Jul 16 12:11:50 CEST 2007 - fehr@suse.de
- mount ntfs rw as default, use ntfs-3g driver for ntfs (#247750)
+- do internal mounts readonly where possible
+- version 2.15.18
-------------------------------------------------------------------
Thu Jul 5 15:34:35 CEST 2007 - fehr@suse.de
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org