[PATCH v2 5/7] libfs: add file creation functions

2020-04-21 Thread Emanuele Giuseppe Esposito
parameter to the creation functions, but pushes all error recovery into fs/libfs.c. Signed-off-by: Emanuele Giuseppe Esposito --- fs/libfs.c | 226 + include/linux/fs.h | 18 2 files changed, 244 insertions(+) diff --git a/fs/libfs.c b/fs

[PATCH v2 3/7] libfs: introduce new_inode_current_time

2020-04-21 Thread Emanuele Giuseppe Esposito
It is a common special case for new_inode to initialize the time to the current time and the inode to get_next_ino(). Introduce a core function that does it. Signed-off-by: Emanuele Giuseppe Esposito --- fs/libfs.c | 20 include/linux/fs.h | 1 + 2 files changed

[PATCH v2 6/7] debugfs: switch to simplefs inode creation API

2020-04-21 Thread Emanuele Giuseppe Esposito
The only difference, compared to the pre-existing code, is that symlink creation now triggers fsnotify_create. This was a bug in the debugfs code, since for example vfs_symlink does call fsnotify_create. Signed-off-by: Emanuele Giuseppe Esposito --- fs/debugfs/inode.c | 144

[PATCH v2 7/7] tracefs: switch to simplefs inode creation API

2020-04-21 Thread Emanuele Giuseppe Esposito
There is no semantic change intended; the code in the libfs.c functions in fact was derived from debugfs and tracefs code. Signed-off-by: Emanuele Giuseppe Esposito --- fs/tracefs/inode.c | 86 -- 1 file changed, 7 insertions(+), 79 deletions(-) diff

[PATCH v2 4/7] libfs: add alloc_anon_inode wrapper

2020-04-21 Thread Emanuele Giuseppe Esposito
libfs.c has many functions that are useful to implement dentry and inode operations, but not many at the filesystem level. Start adding file creation wrappers, the simplest returns an anonymous inode. There is no functional change intended. Signed-off-by: Emanuele Giuseppe Esposito --- drivers

[PATCH v2 0/7] libfs: group and simplify linux fs code

2020-04-21 Thread Emanuele Giuseppe Esposito
duces the dentry and inode creation functions. Patch 6-7 can then adopt them in debugfs and tracefs. Signed-off-by: Emanuele Giuseppe Esposito v1->v2: rename simple_new_inode in new_inode_current_time, more detailed explanations, put all common code in fs/libfs.c Emanuele Giuseppe Esposito (7

[PATCH v2 2/7] libfs: wrap simple_pin_fs/simple_release_fs arguments in a struct

2020-04-21 Thread Emanuele Giuseppe Esposito
Simplify passing the count and mount to simple_pin_fs and simple_release_fs by wrapping them in the simple_fs struct, in preparation for adding more high level operations to fs/libfs.c There is no functional change intended. Signed-off-by: Emanuele Giuseppe Esposito --- drivers/gpu/drm

[PATCH v2 1/7] apparmor: just use vfs_kern_mount to make .null

2020-04-21 Thread Emanuele Giuseppe Esposito
0 on entry and on exit). There is no functional change intended. Signed-off-by: Emanuele Giuseppe Esposito --- security/apparmor/apparmorfs.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c index

Re: [PATCH 2/8] fs: extract simple_pin/release_fs to separate files

2020-04-21 Thread Emanuele Giuseppe Esposito
On 4/21/20 1:19 PM, Frederic Barrat wrote: diff --git a/drivers/misc/cxl/Kconfig b/drivers/misc/cxl/Kconfig index 39eec9031487..a62795079d9c 100644 --- a/drivers/misc/cxl/Kconfig +++ b/drivers/misc/cxl/Kconfig @@ -19,6 +19,7 @@ config CXL   select CXL_BASE   select CXL_AFU_DRIVER_OPS

Re: [PATCH 1/8] apparmor: just use vfs_kern_mount to make .null

2020-04-20 Thread Emanuele Giuseppe Esposito
On 4/16/20 8:44 AM, Luis Chamberlain wrote: On Tue, Apr 14, 2020 at 02:42:55PM +0200, Emanuele Giuseppe Esposito wrote: aa_mk_null_file is using simple_pin_fs/simple_release_fs with local variables as arguments, for what would amount to a simple vfs_kern_mount/mntput pair if everything was

Re: [PATCH 0/8] Simplefs: group and simplify linux fs code

2020-04-20 Thread Emanuele Giuseppe Esposito
On 4/16/20 8:59 AM, Luis Chamberlain wrote: On Tue, Apr 14, 2020 at 02:42:54PM +0200, Emanuele Giuseppe Esposito wrote: This series of patches introduce wrappers for functions, arguments simplification in functions calls and most importantly groups duplicated code in a single header

Re: [PATCH 4/8] fs: introduce simple_new_inode

2020-04-20 Thread Emanuele Giuseppe Esposito
On 4/14/20 3:01 PM, Greg Kroah-Hartman wrote: On Tue, Apr 14, 2020 at 02:42:58PM +0200, Emanuele Giuseppe Esposito wrote: It is a common special case for new_inode to initialize the time to the current time and the inode to get_next_ino(). Introduce a core function that does it and use it

Re: [PATCH 6/8] simplefs: add file creation functions

2020-04-20 Thread Emanuele Giuseppe Esposito
On 4/14/20 2:56 PM, Greg Kroah-Hartman wrote: On Tue, Apr 14, 2020 at 02:43:00PM +0200, Emanuele Giuseppe Esposito wrote: A bunch of code is duplicated between debugfs and tracefs, unify it to the simplefs library. The code is very similar, except that dentry and inode creation are unified

[PATCH 7/8] debugfs: switch to simplefs inode creation API

2020-04-14 Thread Emanuele Giuseppe Esposito
The only difference, compared to the pre-existing code, is that symlink creation now triggers fsnotify_create. This was a bug in the debugfs code, since for example vfs_symlink does call fsnotify_create. Signed-off-by: Emanuele Giuseppe Esposito --- fs/debugfs/inode.c | 144

[PATCH 4/8] fs: introduce simple_new_inode

2020-04-14 Thread Emanuele Giuseppe Esposito
It is a common special case for new_inode to initialize the time to the current time and the inode to get_next_ino(). Introduce a core function that does it and use it throughout Linux. Signed-off-by: Emanuele Giuseppe Esposito --- arch/powerpc/platforms/cell/spufs/inode.c | 4 +--- arch/s390

[PATCH 3/8] fs: wrap simple_pin_fs/simple_release_fs arguments in a struct

2020-04-14 Thread Emanuele Giuseppe Esposito
Simplify passing the count and mount to simple_pin_fs and simple_release_fs, in preparation for adding more high level operations to the simplefs API. Signed-off-by: Emanuele Giuseppe Esposito --- drivers/gpu/drm/drm_drv.c | 11 +-- drivers/misc/cxl/api.c | 13

[PATCH 8/8] tracefs: switch to simplefs inode creation API

2020-04-14 Thread Emanuele Giuseppe Esposito
There is no semantic change intended; the code in the simplefs.c functions in fact was derived from debugfs and tracefs code. Signed-off-by: Emanuele Giuseppe Esposito --- fs/tracefs/inode.c | 86 -- 1 file changed, 7 insertions(+), 79 deletions

[PATCH 6/8] simplefs: add file creation functions

2020-04-14 Thread Emanuele Giuseppe Esposito
parameter to the creation functions, but pushes all error recovery into fs/simplefs.c. Signed-off-by: Emanuele Giuseppe Esposito --- fs/simplefs.c| 150 +++ include/linux/simplefs.h | 19 + 2 files changed, 169 insertions(+) diff --git a/fs

[PATCH 5/8] simplefs: add alloc_anon_inode wrapper

2020-04-14 Thread Emanuele Giuseppe Esposito
Start adding file creation wrappers, the simplest returns an anonymous inode. Signed-off-by: Emanuele Giuseppe Esposito --- drivers/gpu/drm/drm_drv.c | 2 +- drivers/misc/cxl/api.c | 2 +- drivers/scsi/cxlflash/ocxl_hw.c | 2 +- fs/simplefs.c | 6 ++ include

[PATCH 1/8] apparmor: just use vfs_kern_mount to make .null

2020-04-14 Thread Emanuele Giuseppe Esposito
aa_mk_null_file is using simple_pin_fs/simple_release_fs with local variables as arguments, for what would amount to a simple vfs_kern_mount/mntput pair if everything was inlined. Just use the normal filesystem API since the reference counting is not needed here. Signed-off-by: Emanuele Giuseppe

[PATCH 2/8] fs: extract simple_pin/release_fs to separate files

2020-04-14 Thread Emanuele Giuseppe Esposito
We will augment this family of functions with inode management. To avoid littering include/linux/fs.h and fs/libfs.c, move them to a separate header, with a Kconfig symbol to enable them. Signed-off-by: Emanuele Giuseppe Esposito --- drivers/gpu/drm/Kconfig | 1 + drivers/gpu/drm

[PATCH 0/8] Simplefs: group and simplify linux fs code

2020-04-14 Thread Emanuele Giuseppe Esposito
This series of patches introduce wrappers for functions, arguments simplification in functions calls and most importantly groups duplicated code in a single header, simplefs, to avoid redundancy in the linux fs, especially debugfs and tracefs. Signed-off-by: Emanuele Giuseppe Esposito Emanuele