lkml.org 
[lkml]   [2015]   [Jun]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH V2 5/9] edac, mce_amd_inj: Add individual permissions field for dfs_node
Date
Using dfs_fls[] array to encapsulate the permissions necessary for
each file. While creating the file, we iterate over each of them
and use the perm field.

In a later patch, we will add a README file that needs different
permissions. Hence the move here to add a perm field.

Signed-off-by: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>
---
drivers/edac/mce_amd_inj.c | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/drivers/edac/mce_amd_inj.c b/drivers/edac/mce_amd_inj.c
index 377fd6c..ad18913 100644
--- a/drivers/edac/mce_amd_inj.c
+++ b/drivers/edac/mce_amd_inj.c
@@ -294,13 +294,20 @@ static struct dfs_node {
char *name;
struct dentry *d;
const struct file_operations *fops;
+ umode_t perm;
} dfs_fls[] = {
- { .name = "status", .fops = &status_fops },
- { .name = "misc", .fops = &misc_fops },
- { .name = "addr", .fops = &addr_fops },
- { .name = "bank", .fops = &bank_fops },
- { .name = "flags", .fops = &flags_fops },
- { .name = "cpu", .fops = &extcpu_fops },
+ { .name = "status", .fops = &status_fops,
+ .perm = S_IRUSR | S_IWUSR },
+ { .name = "misc", .fops = &misc_fops,
+ .perm = S_IRUSR | S_IWUSR },
+ { .name = "addr", .fops = &addr_fops,
+ .perm = S_IRUSR | S_IWUSR },
+ { .name = "bank", .fops = &bank_fops,
+ .perm = S_IRUSR | S_IWUSR },
+ { .name = "flags", .fops = &flags_fops,
+ .perm = S_IRUSR | S_IWUSR },
+ { .name = "cpu", .fops = &extcpu_fops,
+ .perm = S_IRUSR | S_IWUSR },
};

static int __init init_mce_inject(void)
@@ -317,7 +324,7 @@ static int __init init_mce_inject(void)

for (i = 0; i < ARRAY_SIZE(dfs_fls); i++) {
dfs_fls[i].d = debugfs_create_file(dfs_fls[i].name,
- S_IRUSR | S_IWUSR,
+ dfs_fls[i].perm,
dfs_inj,
&i_mce,
dfs_fls[i].fops);
--
2.4.0


\
 
 \ /
  Last update: 2015-06-02 23:21    [W:0.111 / U:0.524 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site