![](https://seccdn.libravatar.org/avatar/ca8d90c49f67ad61282a8e30ff67a25e.jpg?s=120&d=mm&r=g)
Author: aschnell Date: Fri Apr 4 11:24:02 2008 New Revision: 46082 URL: http://svn.opensuse.org/viewcvs/yast?rev=46082&view=rev Log: - extended libstorage to handle tune2fs options 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=46082&r1=46081&r2=46082&view=diff ============================================================================== --- trunk/storage/libstorage/src/Storage.cc (original) +++ trunk/storage/libstorage/src/Storage.cc Fri Apr 4 11:24:02 2008 @@ -1920,6 +1920,34 @@ } int +Storage::changeTunefsOptVolume( const string& device, const string& opts ) + { + int ret = 0; + assertInit(); + y2milestone( "device:%s opts:%s", device.c_str(), opts.c_str() ); + VolIterator vol; + ContIterator cont; + if( readonly ) + { + ret = STORAGE_CHANGE_READONLY; + } + else if( findVolume( device, cont, vol ) ) + { + ret = vol->setTunefsOption( opts ); + } + else + { + ret = STORAGE_VOLUME_NOT_FOUND; + } + if( ret==0 ) + { + ret = checkCache(); + } + y2milestone( "ret:%d", ret ); + return( ret ); + } + +int Storage::changeDescText( const string& device, const string& txt ) { int ret = 0; Modified: trunk/storage/libstorage/src/Storage.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Storage.h?rev=46082&r1=46081&r2=46082&view=diff ============================================================================== --- trunk/storage/libstorage/src/Storage.h (original) +++ trunk/storage/libstorage/src/Storage.h Fri Apr 4 11:24:02 2008 @@ -325,6 +325,7 @@ int changeLabelVolume( const string& device, const string& label ); int eraseLabelVolume( const string& device ); int changeMkfsOptVolume( const string& device, const string& opts ); + int changeTunefsOptVolume( const string& device, const string& opts ); int changeDescText( const string& device, const string& txt ); int changeMountPoint( const string& device, const string& mount ); int getMountPoint( const string& device, string& mount ); Modified: trunk/storage/libstorage/src/StorageInterface.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/StorageInterface.h?rev=46082&r1=46081&r2=46082&view=diff ============================================================================== --- trunk/storage/libstorage/src/StorageInterface.h (original) +++ trunk/storage/libstorage/src/StorageInterface.h Fri Apr 4 11:24:02 2008 @@ -250,6 +250,7 @@ string uuid; string label; string mkfs_options; + string tunefs_options; string loop; string dtxt; EncryptType encryption; @@ -1116,6 +1117,15 @@ virtual int changeMkfsOptVolume( const string& device, const string& opts ) = 0; /** + * Sets the value of tunefs options. + * + * @param device name of volume, e.g. /dev/hda1 + * @param opts options for tunefs command + * @return zero if all is ok, a negative number to indicate an error + */ + virtual int changeTunefsOptVolume( const string& device, const string& opts ) = 0; + + /** * Changes the mount point of a volume * * @param device name of volume, e.g. /dev/hda1 Modified: trunk/storage/libstorage/src/Volume.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Volume.cc?rev=46082&r1=46081&r2=46082&view=diff ============================================================================== --- trunk/storage/libstorage/src/Volume.cc (original) +++ trunk/storage/libstorage/src/Volume.cc Fri Apr 4 11:24:02 2008 @@ -481,6 +481,7 @@ { fs = detected_fs; mkfs_opt = ""; + tunefs_opt = ""; } else { @@ -799,7 +800,7 @@ } if( ret==0 && fs==EXT3 ) { - string cmd = "/sbin/tune2fs -c 500 -i 2m " + mountDevice(); + string cmd = "/sbin/tune2fs " + tunefs_opt + " " + mountDevice(); SystemCmd c( cmd ); if( c.retcode()!=0 ) ret = VOLUME_TUNE2FS_FAILED; @@ -2678,6 +2679,7 @@ info.format = format; info.create = create; info.mkfs_options = mkfs_opt; + info.tunefs_options = tunefs_opt; info.dtxt = dtxt; info.loop = loop_dev; info.is_mounted = is_mounted; @@ -2835,6 +2837,10 @@ if( v.mkfs_opt.length()>0 ) { s << " mkfsopt:" << v.mkfs_opt; + } + if( v.tunefs_opt.length()>0 ) + { + s << " tunefsopt:" << v.tunefs_opt; } if( v.dtxt.length()>0 ) { @@ -2960,6 +2966,8 @@ ret += " orig_fstopt:" + orig_fstab_opt + "-->" + rhs.orig_fstab_opt; if( mkfs_opt!=rhs.mkfs_opt ) ret += " mkfsopt:" + mkfs_opt + "-->" + rhs.mkfs_opt; + if( tunefs_opt!=rhs.tunefs_opt ) + ret += " tunefsopt:" + tunefs_opt + "-->" + rhs.tunefs_opt; if( dtxt!=rhs.dtxt ) ret += " dtxt:" + dtxt + "-->" + rhs.dtxt; if( is_loop!=rhs.is_loop ) @@ -3005,7 +3013,7 @@ fs==rhs.fs && mount_by==rhs.mount_by && uuid==rhs.uuid && label==rhs.label && mp==rhs.mp && fstab_opt==rhs.fstab_opt && mkfs_opt==rhs.mkfs_opt && - dtxt==rhs.dtxt && + tunefs_opt==rhs.tunefs_opt && dtxt==rhs.dtxt && is_loop==rhs.is_loop && loop_active==rhs.loop_active && is_mounted==rhs.is_mounted && encryption==rhs.encryption && loop_dev==rhs.loop_dev && fstab_loop_dev==rhs.fstab_loop_dev && @@ -3041,6 +3049,7 @@ fstab_opt = rhs.fstab_opt; orig_fstab_opt = rhs.orig_fstab_opt; mkfs_opt = rhs.mkfs_opt; + tunefs_opt = rhs.tunefs_opt; dtxt = rhs.dtxt; is_loop = rhs.is_loop; loop_active = rhs.loop_active; Modified: trunk/storage/libstorage/src/Volume.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Volume.h?rev=46082&r1=46081&r2=46082&view=diff ============================================================================== --- trunk/storage/libstorage/src/Volume.h (original) +++ trunk/storage/libstorage/src/Volume.h Fri Apr 4 11:24:02 2008 @@ -99,6 +99,8 @@ bool needFstabUpdate() const; const string& getMkfsOption() const { return mkfs_opt; } int setMkfsOption( const string& val ) { mkfs_opt=val; return 0; } + const string& getTunefsOption() const { return tunefs_opt; } + int setTunefsOption( const string& val ) { tunefs_opt=val; return 0; } const string& getDescText() const { return dtxt; } int setDescText( const string& val ) { dtxt=val; return 0; } const std::list<string>& altNames() const { return( alt_names ); } @@ -252,6 +254,7 @@ string fstab_opt; string orig_fstab_opt; string mkfs_opt; + string tunefs_opt; bool is_loop; bool is_mounted; bool ignore_fstab; Modified: trunk/storage/package/yast2-storage.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/package/yast2-storage.changes?rev=46082&r1=46081&r2=46082&view=diff ============================================================================== --- trunk/storage/package/yast2-storage.changes (original) +++ trunk/storage/package/yast2-storage.changes Fri Apr 4 11:24:02 2008 @@ -1,4 +1,9 @@ ------------------------------------------------------------------- +Fri Apr 04 11:21:09 CEST 2008 - aschnell@suse.de + +- extended libstorage to handle tune2fs options + +------------------------------------------------------------------- Thu Apr 03 19:47:06 CEST 2008 - aschnell@suse.de - removed obsolete .run.swapon_s SCR agent -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org