Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752119AbbFBU0i (ORCPT ); Tue, 2 Jun 2015 16:26:38 -0400 Received: from mail-bn1on0117.outbound.protection.outlook.com ([157.56.110.117]:25065 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751919AbbFBU0U (ORCPT ); Tue, 2 Jun 2015 16:26:20 -0400 Authentication-Results: spf=none (sender IP is 165.204.84.221) smtp.mailfrom=amd.com; alien8.de; dkim=none (message not signed) header.d=none; X-WSS-ID: 0NPC3FS-07-71C-02 X-M-MSG: From: Aravind Gopalakrishnan To: , , CC: , , Subject: [PATCH V2 5/9] edac, mce_amd_inj: Add individual permissions field for dfs_node Date: Tue, 2 Jun 2015 15:35:58 -0500 Message-ID: <1433277362-10911-6-git-send-email-Aravind.Gopalakrishnan@amd.com> X-Mailer: git-send-email 2.4.0 In-Reply-To: <1433277362-10911-1-git-send-email-Aravind.Gopalakrishnan@amd.com> References: <1433277362-10911-1-git-send-email-Aravind.Gopalakrishnan@amd.com> MIME-Version: 1.0 Content-Type: text/plain X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BN1BFFO11FD001;1:qdoi5CKg9yw29awGI5mJYGx4sXToPZgNnItHFaQX05KWtigToKJ+bhpHwWTlshBZyZbCEo8JBx35f/H6ZhKBB/kCqP4bm2x3JoRzHm76YfWSSkMz0Ju70bQJK/KJiAjufUjk33r2/SvGsBe6JLuK1Ugg+mNDQhlhbnb2bTCMAyzA1ruED5DgeZN9KfJKQ3QvPVbKVC8eyK/SalkCWqVk8iVubQbYWYks4NUe6/O54hnRgaFkoQdwLWmFwJyDQKqcG1g4Q/XYHdOtyF/ru0LQxQ== X-Forefront-Antispam-Report: CIP:165.204.84.221;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(428002)(199003)(189002)(50466002)(50226001)(5001860100001)(19580405001)(19580395003)(48376002)(47776003)(77096005)(86362001)(4001540100001)(2201001)(5001770100001)(97736004)(92566002)(2950100001)(5001830100001)(105586002)(229853001)(77156002)(68736005)(36756003)(64706001)(62966003)(53416004)(87936001)(101416001)(46102003)(189998001)(50986999)(106466001)(76176999);DIR:OUT;SFP:1102;SCL:1;SRVR:BY2PR02MB073;H:atltwp01.amd.com;FPR:;SPF:None;PTR:InfoDomainNonexistent;A:1;MX:1;LANG:en; X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR02MB073; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(520003)(5005006)(3002001);SRVR:BY2PR02MB073;BCL:0;PCL:0;RULEID:;SRVR:BY2PR02MB073; X-Forefront-PRVS: 05954A7C45 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jun 2015 20:26:17.9090 (UTC) X-MS-Exchange-CrossTenant-Id: fde4dada-be84-483f-92cc-e026cbee8e96 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=fde4dada-be84-483f-92cc-e026cbee8e96;Ip=[165.204.84.221];Helo=[atltwp01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR02MB073 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2071 Lines: 60 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 --- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/