Author: fehr
Date: Thu Jun 14 16:48:35 2007
New Revision: 38463
URL: http://svn.opensuse.org/viewcvs/yast?rev=38463&view=rev
Log:
implement support for user quota (fate#120106)
Modified:
trunk/storage/package/yast2-storage.changes
trunk/storage/storage/src/include/custom_part_dialogs.ycp
trunk/storage/storage/src/include/custom_part_lib.ycp
trunk/storage/storage/src/modules/FileSystems.ycp
trunk/storage/storage/src/modules/Storage.ycp
Modified: trunk/storage/package/yast2-storage.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/package/yast2-storage.changes?rev=38463&r1=38462&r2=38463&view=diff
==============================================================================
--- trunk/storage/package/yast2-storage.changes (original)
+++ trunk/storage/package/yast2-storage.changes Thu Jun 14 16:48:35 2007
@@ -2,6 +2,7 @@
Thu Jun 14 16:46:09 CEST 2007 - fehr@suse.de
- use provided fstab options when mounting filesystems
+- implement support for user quota (fate#120106)
-------------------------------------------------------------------
Wed Jun 6 13:56:50 CEST 2007 - fehr@suse.de
Modified: trunk/storage/storage/src/include/custom_part_dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/custom_part_dialogs.ycp?rev=38463&r1=38462&r2=38463&view=diff
==============================================================================
--- trunk/storage/storage/src/include/custom_part_dialogs.ycp (original)
+++ trunk/storage/storage/src/include/custom_part_dialogs.ycp Thu Jun 14 16:48:35 2007
@@ -25,6 +25,7 @@
import "Storage";
import "Partitions";
import "FileSystems";
+ import "Package";
import "Mode";
import "Arch";
import "Label";
@@ -611,7 +612,9 @@
{
arb_opt = FileSystems::RemoveCryptOpts( arb_opt );
}
-
+ if( FileSystems::CanDoQuota(new) && FileSystems::HasQuota(new) )
+ old_state["opt_quota"] = true;
+ arb_opt = FileSystems::RemoveQuotaOpts(arb_opt);
old_state[opt_list[size(opt_list)-1,`query_key]:""] = arb_opt;
y2milestone( "FstabOptions old_state=%1", old_state );
@@ -681,6 +684,11 @@
UI::ChangeWidget( `id("opt_user"), `Enabled,
new["enc_type"]:`none==`none || new["noauto"]:false );
}
+ if( UI::WidgetExists( `id("opt_quota") ))
+ {
+ UI::ChangeWidget( `id("opt_quota"), `Enabled,
+ FileSystems::CanDoQuota(new) );
+ }
foreach( any key, any value, old_state,
``{
UI::ChangeWidget( `id(key), `Value, value );
@@ -808,6 +816,15 @@
new_fstopt = new_fstopt + text;
}
});
+ if( UI::WidgetExists( `id("opt_quota") ) &&
+ UI::QueryWidget( `id("opt_quota"), `Value )==true )
+ {
+ new_fstopt = FileSystems::AddQuotaOpts(new,new_fstopt);
+ if( !old_state["opt_quota"]:false && Mode::normal() )
+ {
+ Package::InstallAll( ["quota"] );
+ }
+ }
y2milestone( "FstabOptions new_state=%1", new_state );
y2milestone( "FstabOptions old_fstopt=%1 new_fstopt=%2",
old["fstopt"]:"", new_fstopt );
@@ -1191,7 +1208,7 @@
// button text
_("Fs&tab Options")),
`VSpacing(1),
- `ComboBox(`id(`mount_point), `opt(`editable, `hstretch),
+ `ComboBox(`id(`mount_point), `opt(`editable,`hstretch,`notify),
// label text
_("&Mount Point"), mountpoints )
);
Modified: trunk/storage/storage/src/include/custom_part_lib.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/custom_part_lib.ycp?rev=38463&r1=38462&r2=38463&view=diff
==============================================================================
--- trunk/storage/storage/src/include/custom_part_lib.ycp (original)
+++ trunk/storage/storage/src/include/custom_part_lib.ycp Thu Jun 14 16:48:35 2007
@@ -669,7 +669,8 @@
UI::ReplaceWidget(`id(`mount_dlg_rp), MountDlg( new, not_used_mp));
UI::ChangeWidget( `id(`mount_point), `Value, new["mount"]:"" );
- UI::ChangeWidget(`id(`fstab_options), `Enabled, true );
+ UI::ChangeWidget( `id(`fstab_options), `Enabled,
+ size(new["mount"]:"")>0 );
UI::ChangeWidget(`id(`fs_options), `Enabled,
new["format"]:false && selected_fs[`options]:[]!=[] );
string fstopt = FileSystems::DefaultFstabOptions( new );
@@ -720,6 +721,11 @@
new = filter(string key, any value, new, ``( key != "fstopt"));
}
}
+ if( !init && ret == `mount_point )
+ {
+ string mp = (string)UI::QueryWidget(`id(`mount_point), `Value);
+ UI::ChangeWidget( `id(`fstab_options), `Enabled, size(mp)>0 );
+ }
if( init || ret == `format_true || ret == `format_false )
{
boolean format = UI::QueryWidget(`id(`format), `CurrentButton) ==
Modified: trunk/storage/storage/src/modules/FileSystems.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/modules/FileSystems.ycp?rev=38463&r1=38462&r2=38463&view=diff
==============================================================================
--- trunk/storage/storage/src/modules/FileSystems.ycp (original)
+++ trunk/storage/storage/src/modules/FileSystems.ycp Thu Jun 14 16:48:35 2007
@@ -82,14 +82,16 @@
"procuid",
"barrier=none",
"fs=floppyfss", "fs=cdfss",
- "users", "gid=users"
+ "users", "gid=users",
+ "usrquota", "grpquota"
];
define list FstabOptionRegex = [ "pri=[0-9]\+", "iocharset=.\+", "utf8=\.*",
"nls=.\+", "codepage=.\+",
"gid=[0-9]\+", "umask=[0-7]\+",
"loop=.\+", "encryption=.\+",
- "pri=[0-9]\+" ];
+ "pri=[0-9]\+",
+ "usrjquota=.\+", "grpjquota=.\+", "jqfmt=.\+" ];
define map FstabDefaultMap =
$[ "pts": $[ "spec":"devpts", "mount":"/dev/pts", "vfstype":"devpts",
@@ -262,6 +264,17 @@
`type : `boolean,
`str_opt : $[ 1 : "noauto", "default" : "" ],
`str_scan : [[ "noauto", 1 ], ["auto", 0 ]],
+ ],
+ $[
+ // button text
+ `widget : `Left(`CheckBox(`id("opt_quota"), `opt(`notify), _("Enable &Quota Support"), false)),
+ `query_key : "opt_quota",
+ // help text, richtext format
+ `help_text : _("<p><b>Enable Quota Support:</b>
+The file system is mounted with user quotas enabled.
+Default is false.</p>
+"),
+ `type : `boolean
]
];
return( options );
@@ -321,7 +334,7 @@
"),
`type : `boolean,
`str_opt : $[ 1 : "user_xattr", "default" : "" ],
- `str_scan : [[ "user_xattr", 1 ], ["no_user_xattr", 0 ]],
+ `str_scan : [[ "user_xattr", 1 ], ["nouser_xattr", 0 ]],
],
];
return( options );
@@ -1503,5 +1516,47 @@
tostring(m["freq"]:0), tostring(m["passno"]:0) ] );
}
+global define boolean CanDoQuota( map part )
+ ``{
+ list quota_fs = [ `ext2, `ext3, `reiser, `xfs ];
+ return( contains( quota_fs, part["used_fs"]:`unknown ));
+ }
+
+global define boolean HasQuota( map part )
+ ``{
+ boolean ret = false;
+ list<string> opts = splitstring( part["fstopt"]:"", "," );
+ integer i=0;
+ while( !ret && i