Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp425140rwd; Thu, 1 Jun 2023 02:05:35 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5FlHgZP7dCnfM2JTs5G/UW5WgfKZAlqqAFspkm+rKU65rCoMnucNAS41VEiNsExbpy5zWX X-Received: by 2002:a05:6a00:1a0f:b0:64c:c5c0:6e01 with SMTP id g15-20020a056a001a0f00b0064cc5c06e01mr10237883pfv.31.1685610335414; Thu, 01 Jun 2023 02:05:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1685610335; cv=pass; d=google.com; s=arc-20160816; b=HLFLPbQdrzyUuUjgnJv/uazVu/SG182H1Z/L6xUbmThJNxjxZm6iz+kWJOXlnRuqfL CYkrCX/Rrv7U2euB5u+80HVKepR9wsdZEg4blQDiYLOBua3ZYey9a+8P2oBeaTUiz6wN DqoJH+f4800OAIugqVnqmXuqdAcCMv8yVjav+FmB9yUAWr8ylo9QfEOd0KjfeMIqmNpF cfcE0a8FdwealoaZF5uYU4wpDHy4k1tCtocj2VFbrs+Q9BNPIMvJDQ/TaByyTNXyp6sc /pjBC/68yqV9zbh3BeSTnuHnA3SzFR7fpggutf1DW8V1o4uiwPDjZQMATta8i2z7TA4m zhlg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=VqnypT5cV3uH674kkDeSLFcG0cpa0F83Tc9rmS5VldI=; b=cmUzl/HSTKXYcTSDA+oeJQJZGUFjGidDp3eWov2OpRMxEmWRKd0tu9fNm6ixqwuowu D/Oj8oxmxTAcQuAKxLIjdz1wHXLH5da36BDcVnkIBktXxLmGB9BcSG4P9acLyaeEBxNj MSTZAMuSPr3BFJo1r0FUe8A8nugBheAiGGEu4zzv5cGbRgWgkEBiOM9/DWP2JeRvBLiO wDxZ9uYlaf+jagOIXcm6Ktqc6ex8EcMU35O33OgVL4J7kCMPjFj311wmHpJriT0xOfs5 nyK/NUWO1gSusqenBU8CR6MVTpiG835MMwGVgRb/P2120AIaG7a/9cIrHE1sYLIupV3r n4Rw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vmware.com header.s=selector2 header.b=uxaBZCGr; arc=pass (i=1 spf=pass spfdomain=vmware.com dkim=pass dkdomain=vmware.com dmarc=pass fromdomain=vmware.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=vmware.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y1-20020aa78f21000000b00643b6fa7d34si3947180pfr.214.2023.06.01.02.05.21; Thu, 01 Jun 2023 02:05:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@vmware.com header.s=selector2 header.b=uxaBZCGr; arc=pass (i=1 spf=pass spfdomain=vmware.com dkim=pass dkdomain=vmware.com dmarc=pass fromdomain=vmware.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=vmware.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232467AbjFAJBV (ORCPT + 99 others); Thu, 1 Jun 2023 05:01:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232464AbjFAJBQ (ORCPT ); Thu, 1 Jun 2023 05:01:16 -0400 Received: from DM4PR02CU002.outbound.protection.outlook.com (mail-centralusazon11013010.outbound.protection.outlook.com [52.101.64.10]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1032BE7; Thu, 1 Jun 2023 02:01:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kLMmGwbsq6VOTiV4DpuJxcT9mHeDxDR5gafxwCeKKzv/v8aXXabPgxX9+mnVHuWnsHO1uM2OwzFfjCRHwIn/wXZ2cXKsCeM6SxZfeB1lhkb8796qSudl/vFtBhvscL6ylvc6iIUPukvwfkzljQ/i5c+d2lIkfcPnl5pbjlbNSSXh8zaVTLfrxi1UAHneQAOdUxoD8xdlgQxY2vIQRkXoxJLbWrJNeZDrUJC2HU8oAM89AlNrcgsE1eTNo6+5L0LWzRdBMke2QuvD6kn/BJGGGl2wNbzadZhk5Mk71FMPhO6zA1EwCgKRG78txepM5c7LQ6IXGZBTksQAo75Lc8eEcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=VqnypT5cV3uH674kkDeSLFcG0cpa0F83Tc9rmS5VldI=; b=dB/hEWEhFhlTjGsfhiXC6EW/K2QglIZYtwFYU40AZ/1I6LJA3tGK8PTX3FN5M9SAgZXDtygAdpZvpSgnrZr0V/nSkqu3Xkuq+rFUbhT+kMsb8Eib7hdvit/YjRorCAhuFKRu7f/eD73KQk+wMoQv3xDL0L7t5rvem5RKDtaGMirhTzCD2aHYPrm7tEYNIGaZ+nsQBvSbVDbXfumWZNM+waOEsjTuFUt3j/KyTm0o2VgLu8YhogB+rjAOuHn6sMAIUqXBmI5Jaof0Fp71XaV+NIi+Tkni+6cjqHiIfxYFOrawcy1HR/8Qb2SL2vHAjNybW92eD1WcH0H4eGgqTxZo8A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vmware.com; dmarc=pass action=none header.from=vmware.com; dkim=pass header.d=vmware.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vmware.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VqnypT5cV3uH674kkDeSLFcG0cpa0F83Tc9rmS5VldI=; b=uxaBZCGrKdTxpPNs99cdo6QzdNIzi27DrtD98ZHS5F1bFMH+2AQPg09G646xzXLoafYeEXql6sytyjqRSOEXR59Zfo9IP58rtpPy4g0RgWUzhzwZiBw9cNcSxF6BTUSykrrx0YNmObbJ/ZQENeTQHhqZ0hZB9cvZeWl6IMP4jDk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vmware.com; Received: from PH0PR05MB8703.namprd05.prod.outlook.com (2603:10b6:510:bd::5) by MW4PR05MB8617.namprd05.prod.outlook.com (2603:10b6:303:120::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.22; Thu, 1 Jun 2023 09:01:06 +0000 Received: from PH0PR05MB8703.namprd05.prod.outlook.com ([fe80::5631:475a:58d4:cf66]) by PH0PR05MB8703.namprd05.prod.outlook.com ([fe80::5631:475a:58d4:cf66%6]) with mapi id 15.20.6455.020; Thu, 1 Jun 2023 09:01:06 +0000 From: Ajay Kaher To: rostedt@goodmis.org, mhiramat@kernel.org, shuah@kernel.org Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, chinglinyu@google.com, namit@vmware.com, srivatsa@csail.mit.edu, amakhalov@vmware.com, vsirnapalli@vmware.com, tkundu@vmware.com, er.ajay.kaher@gmail.com, Ajay Kaher Subject: [PATCH v3 02/10] eventfs: introducing struct tracefs_inode Date: Thu, 1 Jun 2023 14:30:05 +0530 Message-Id: <1685610013-33478-3-git-send-email-akaher@vmware.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1685610013-33478-1-git-send-email-akaher@vmware.com> References: <1685610013-33478-1-git-send-email-akaher@vmware.com> Content-Type: text/plain X-ClientProxiedBy: SJ0PR03CA0181.namprd03.prod.outlook.com (2603:10b6:a03:2ef::6) To PH0PR05MB8703.namprd05.prod.outlook.com (2603:10b6:510:bd::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR05MB8703:EE_|MW4PR05MB8617:EE_ X-MS-Office365-Filtering-Correlation-Id: 47556847-b537-4ddf-54e1-08db627ebc14 X-LD-Processed: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ccznUqMGkyOV08tSwKhasf+jUfAWAxQu+xJWqN/JqjjRb4QljVZjNI9dYotGfEToTmmQsPragMRLMS8033oBbygvLUDLrdiZQST3JNKXDm6mhAZ3VEv1WSmc1UZfZPq/OqQu+3nCF+Fw3hHA6TYiQOsrNqfjJ5S3k+Jn/nkv4w4SZZ0MHdsZyPrRVkUgA06467nFKyJaA3o4o1YHvF16BdEf2n+rOupOCnFVRLVQgwfXSw5NdzQLSZW7syWMEV5G1zaSzkwL9QrSDELxdZNinNFGOTtHA+cZsPl06pA+uMDgv5tf1lFaGYzZJaiQ9ZZnoZxzXLqaZIbw4rvEwAIE1bj8rIiuA/TDIqgkCB6l/5SFCYl4USjFDCCM5Bv0T47/mxBE/bfvTy0iOuAXR+YIwdJy0FvnVBbFokffTMk8UpL2yIF4OmReR3eayt84waEi0dWAA6wbLrSoP4r8UKLujWm/43Zb59fcx1l3C3Q8a/Xzcqcqub5MKJNqy6oYHJFtHrSF+CroakQw/X9+sPL/LHqBJdvemeNKw45KxJ0z32OOoHY94bhjElPpjjUB2oMuJMUN0EKPXvt8Xxtdvt05ncUkjx1KemPo424o385lwQyV8nU+MJ59IdeOmmK2va0H X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR05MB8703.namprd05.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(396003)(39860400002)(346002)(136003)(376002)(366004)(451199021)(52116002)(6486002)(186003)(5660300002)(41300700001)(107886003)(36756003)(8676002)(38100700002)(8936002)(26005)(6506007)(38350700002)(83380400001)(4326008)(66946007)(2906002)(66556008)(478600001)(66476007)(2616005)(6512007)(86362001)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?/bpdYTwVCv3niqn7AdXnfXaq8Z+nhpuZP/Bx5d2/zbthkRZFm1jH6jOktJ8H?= =?us-ascii?Q?IC3BSNMfdnhQjDryxMEBttHbk7xKSvqdyXBawF+U6K/Cmr1tHzVfKXsyfxbP?= =?us-ascii?Q?9gm7LNJ67HvNYFJMOZ9HR1F5PJ1Y+Yj7SOdMLAH2M4nKnuTtTi+oHnVJWaXU?= =?us-ascii?Q?J4igtg9ohMjlhJkhjJazH7heB3KAcEn6nSMglYrcIdbSFCeSeLNxAUJh7U9a?= =?us-ascii?Q?XuCGYro8speb0iUdZAjwpXRAxeNG7Na6bAUjoA8x4WE1lVT1nANKSsYo01VA?= =?us-ascii?Q?D8HzvwGhHyaUucpjXkcTRbN094q2nyms1sKxXCG8UVSZTgoAAaCdDdO3XBaN?= =?us-ascii?Q?k6O0yc+d5qgOCpzgRPxZj8wdtKlNGgCTVGjUQ65ujaIaI8fjau5jn6gM2W26?= =?us-ascii?Q?BZtojZ35JqWYeN5NJo0hUlN4c55Xz2j5UK5Hcfdhw8VKVxapBh4S7rc1L/TD?= =?us-ascii?Q?7vcTLQ/Ji8qBUyT2y+z8s+nfaHAgBIv3gDKegz/sS0rMhoOKbj5TmfF8hmCK?= =?us-ascii?Q?3W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eaIJNNhUC?= =?us-ascii?Q?me4qezo4QKqN2c9grG2PC7gXO8/e0/wpJ3glpTgWaZxL83fcXXwWeHZavgdv?= =?us-ascii?Q?fv3QQAlV/aoLXOvannKcZoSai4Q4BUU3p3EiKiY4j8HGdRDyYvufTOVK8l7v?= =?us-ascii?Q?1Rg7SYtuI+ufFvVTAqcOGg4I65JaOfuPcdtlM784?= X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-Network-Message-Id: 47556847-b537-4ddf-54e1-08db627ebc14 X-MS-Exchange-CrossTenant-AuthSource: PH0PR05MB8703.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2023 09:01:06.5827 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: wRNCnwg03jRRB4JTf6SyEIxb7iaKczufgujwkMCvR72sXqnvRwM/B20717GwsvpAk+PWya7q1jgf5ZHOOBb/zA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR05MB8617 X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Introduce tracefs_inode structure, this will help eventfs to keep track of inode, flags and pointer to private date. Rename function names and remove the static qualifier for functions that should be exposed. Signed-off-by: Ajay Kaher Co-developed-by: Steven Rostedt (VMware) Signed-off-by: Steven Rostedt (VMware) Tested-by: Ching-lin Yu --- fs/tracefs/inode.c | 21 +++++++++++---------- fs/tracefs/internal.h | 25 +++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 10 deletions(-) create mode 100644 fs/tracefs/internal.h diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c index 57ac8aa4a..7df1752e8 100644 --- a/fs/tracefs/inode.c +++ b/fs/tracefs/inode.c @@ -21,6 +21,7 @@ #include #include #include +#include "internal.h" #define TRACEFS_DEFAULT_MODE 0700 @@ -127,7 +128,7 @@ static const struct inode_operations tracefs_dir_inode_operations = { .rmdir = tracefs_syscall_rmdir, }; -static struct inode *tracefs_get_inode(struct super_block *sb) +struct inode *tracefs_get_inode(struct super_block *sb) { struct inode *inode = new_inode(sb); if (inode) { @@ -399,7 +400,7 @@ static struct file_system_type trace_fs_type = { }; MODULE_ALIAS_FS("tracefs"); -static struct dentry *start_creating(const char *name, struct dentry *parent) +struct dentry *tracefs_start_creating(const char *name, struct dentry *parent) { struct dentry *dentry; int error; @@ -437,7 +438,7 @@ static struct dentry *start_creating(const char *name, struct dentry *parent) return dentry; } -static struct dentry *failed_creating(struct dentry *dentry) +struct dentry *tracefs_failed_creating(struct dentry *dentry) { inode_unlock(d_inode(dentry->d_parent)); dput(dentry); @@ -445,7 +446,7 @@ static struct dentry *failed_creating(struct dentry *dentry) return NULL; } -static struct dentry *end_creating(struct dentry *dentry) +struct dentry *tracefs_end_creating(struct dentry *dentry) { inode_unlock(d_inode(dentry->d_parent)); return dentry; @@ -490,14 +491,14 @@ struct dentry *tracefs_create_file(const char *name, umode_t mode, if (!(mode & S_IFMT)) mode |= S_IFREG; BUG_ON(!S_ISREG(mode)); - dentry = start_creating(name, parent); + dentry = tracefs_start_creating(name, parent); if (IS_ERR(dentry)) return NULL; inode = tracefs_get_inode(dentry->d_sb); if (unlikely(!inode)) - return failed_creating(dentry); + return tracefs_failed_creating(dentry); inode->i_mode = mode; inode->i_fop = fops ? fops : &tracefs_file_operations; @@ -506,13 +507,13 @@ struct dentry *tracefs_create_file(const char *name, umode_t mode, inode->i_gid = d_inode(dentry->d_parent)->i_gid; d_instantiate(dentry, inode); fsnotify_create(d_inode(dentry->d_parent), dentry); - return end_creating(dentry); + return tracefs_end_creating(dentry); } static struct dentry *__create_dir(const char *name, struct dentry *parent, const struct inode_operations *ops) { - struct dentry *dentry = start_creating(name, parent); + struct dentry *dentry = tracefs_start_creating(name, parent); struct inode *inode; if (IS_ERR(dentry)) @@ -520,7 +521,7 @@ static struct dentry *__create_dir(const char *name, struct dentry *parent, inode = tracefs_get_inode(dentry->d_sb); if (unlikely(!inode)) - return failed_creating(dentry); + return tracefs_failed_creating(dentry); /* Do not set bits for OTH */ inode->i_mode = S_IFDIR | S_IRWXU | S_IRUSR| S_IRGRP | S_IXUSR | S_IXGRP; @@ -534,7 +535,7 @@ static struct dentry *__create_dir(const char *name, struct dentry *parent, d_instantiate(dentry, inode); inc_nlink(d_inode(dentry->d_parent)); fsnotify_mkdir(d_inode(dentry->d_parent), dentry); - return end_creating(dentry); + return tracefs_end_creating(dentry); } /** diff --git a/fs/tracefs/internal.h b/fs/tracefs/internal.h new file mode 100644 index 000000000..6776b4693 --- /dev/null +++ b/fs/tracefs/internal.h @@ -0,0 +1,25 @@ +#ifndef _TRACEFS_INTERNAL_H +#define _TRACEFS_INTERNAL_H + +enum { + TRACEFS_EVENT_INODE = BIT(1), +}; + +struct tracefs_inode { + unsigned long flags; + void *private; + struct inode vfs_inode; +}; + +static inline struct tracefs_inode *get_tracefs(const struct inode *inode) +{ + return container_of(inode, struct tracefs_inode, vfs_inode); +} + +struct dentry *tracefs_start_creating(const char *name, struct dentry *parent); +struct dentry *tracefs_end_creating(struct dentry *dentry); +struct dentry *tracefs_failed_creating(struct dentry *dentry); +struct inode *tracefs_get_inode(struct super_block *sb); + +#endif /* _TRACEFS_INTERNAL_H */ + -- 2.40.0