diff mbox series

[1/2] common: add a helper for setting module param

Message ID 20200410012059.27210-1-cgxu519@mykernel.net (mailing list archive)
State New, archived
Headers show
Series [1/2] common: add a helper for setting module param | expand

Commit Message

Chengguang Xu April 10, 2020, 1:20 a.m. UTC
Add a new helper _set_fs_module_param for setting
module param.

Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>
---
 common/module | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Eryu Guan April 12, 2020, 11:21 a.m. UTC | #1
On Fri, Apr 10, 2020 at 09:20:58AM +0800, Chengguang Xu wrote:
> Add a new helper _set_fs_module_param for setting
> module param.
> 
> Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>

I think this could go with the test, so a single patch introduces both
test case and the needed helper functions, and usually that's easier to
review, as we could know how the helper be used from the context.

Thanks,
Eryu

> ---
>  common/module | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/common/module b/common/module
> index 39e4e793..148e8c8f 100644
> --- a/common/module
> +++ b/common/module
> @@ -81,3 +81,12 @@ _get_fs_module_param()
>  {
>  	cat /sys/module/${FSTYP}/parameters/${1} 2>/dev/null
>  }
> + # Set the value of a filesystem module parameter
> + # at /sys/module/$FSTYP/parameters/$PARAM
> + #
> + # Usage example:
> + #   _set_fs_module_param param value
> + _set_fs_module_param()
> +{
> +	echo ${2} > /sys/module/${FSTYP}/parameters/${1} 2>/dev/null
> +}
> -- 
> 2.20.1
> 
>
Chengguang Xu April 13, 2020, 1:51 a.m. UTC | #2
---- 在 星期日, 2020-04-12 19:20:34 Eryu Guan <guan@eryu.me> 撰写 ----
 > On Fri, Apr 10, 2020 at 09:20:58AM +0800, Chengguang Xu wrote:
 > > Add a new helper _set_fs_module_param for setting
 > > module param.
 > > 
 > > Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>
 > 
 > I think this could go with the test, so a single patch introduces both
 > test case and the needed helper functions, and usually that's easier to
 > review, as we could know how the helper be used from the context.
 > 

Hi Eryu,

OK, I'll put it into test patch in V2.

Thanks,
cgxu
diff mbox series

Patch

diff --git a/common/module b/common/module
index 39e4e793..148e8c8f 100644
--- a/common/module
+++ b/common/module
@@ -81,3 +81,12 @@  _get_fs_module_param()
 {
 	cat /sys/module/${FSTYP}/parameters/${1} 2>/dev/null
 }
+ # Set the value of a filesystem module parameter
+ # at /sys/module/$FSTYP/parameters/$PARAM
+ #
+ # Usage example:
+ #   _set_fs_module_param param value
+ _set_fs_module_param()
+{
+	echo ${2} > /sys/module/${FSTYP}/parameters/${1} 2>/dev/null
+}