Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sysfs, kernfs: add skeletons for kernfs

Core sysfs implementation will be separated into kernfs so that it can
be used by other non-kobject users.

This patch creates fs/kernfs/ directory and makes boilerplate changes.
kernfs interface will be directly based on sysfs_dirent and its
forward declaration is moved to include/linux/kernfs.h which is
included from include/linux/sysfs.h. sysfs core implementation will
be gradually separated out and moved to kernfs.

This patch doesn't introduce any functional changes.

v2: mount.c added.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: linux-fsdevel@vger.kernel.org
Cc: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Tejun Heo and committed by
Greg Kroah-Hartman
b8441ed2 ae2108ad

+64 -3
+1 -1
fs/Makefile
··· 53 53 obj-y += quota/ 54 54 55 55 obj-$(CONFIG_PROC_FS) += proc/ 56 - obj-$(CONFIG_SYSFS) += sysfs/ 56 + obj-$(CONFIG_SYSFS) += sysfs/ kernfs/ 57 57 obj-$(CONFIG_CONFIGFS_FS) += configfs/ 58 58 obj-y += devpts/ 59 59
+5
fs/kernfs/Makefile
··· 1 + # 2 + # Makefile for the kernfs pseudo filesystem 3 + # 4 + 5 + obj-y := mount.o inode.o dir.o file.o symlink.o
+9
fs/kernfs/dir.c
··· 1 + /* 2 + * fs/kernfs/dir.c - kernfs directory implementation 3 + * 4 + * Copyright (c) 2001-3 Patrick Mochel 5 + * Copyright (c) 2007 SUSE Linux Products GmbH 6 + * Copyright (c) 2007, 2013 Tejun Heo <tj@kernel.org> 7 + * 8 + * This file is released under the GPLv2. 9 + */
+9
fs/kernfs/file.c
··· 1 + /* 2 + * fs/kernfs/file.c - kernfs file implementation 3 + * 4 + * Copyright (c) 2001-3 Patrick Mochel 5 + * Copyright (c) 2007 SUSE Linux Products GmbH 6 + * Copyright (c) 2007, 2013 Tejun Heo <tj@kernel.org> 7 + * 8 + * This file is released under the GPLv2. 9 + */
+9
fs/kernfs/inode.c
··· 1 + /* 2 + * fs/kernfs/inode.c - kernfs inode implementation 3 + * 4 + * Copyright (c) 2001-3 Patrick Mochel 5 + * Copyright (c) 2007 SUSE Linux Products GmbH 6 + * Copyright (c) 2007, 2013 Tejun Heo <tj@kernel.org> 7 + * 8 + * This file is released under the GPLv2. 9 + */
+9
fs/kernfs/mount.c
··· 1 + /* 2 + * fs/kernfs/mount.c - kernfs mount implementation 3 + * 4 + * Copyright (c) 2001-3 Patrick Mochel 5 + * Copyright (c) 2007 SUSE Linux Products GmbH 6 + * Copyright (c) 2007, 2013 Tejun Heo <tj@kernel.org> 7 + * 8 + * This file is released under the GPLv2. 9 + */
+9
fs/kernfs/symlink.c
··· 1 + /* 2 + * fs/kernfs/symlink.c - kernfs symlink implementation 3 + * 4 + * Copyright (c) 2001-3 Patrick Mochel 5 + * Copyright (c) 2007 SUSE Linux Products GmbH 6 + * Copyright (c) 2007, 2013 Tejun Heo <tj@kernel.org> 7 + * 8 + * This file is released under the GPLv2. 9 + */
+12
include/linux/kernfs.h
··· 1 + /* 2 + * kernfs.h - pseudo filesystem decoupled from vfs locking 3 + * 4 + * This file is released under the GPLv2. 5 + */ 6 + 7 + #ifndef __LINUX_KERNFS_H 8 + #define __LINUX_KERNFS_H 9 + 10 + struct sysfs_dirent; 11 + 12 + #endif /* __LINUX_KERNFS_H */
+1 -2
include/linux/sysfs.h
··· 12 12 #ifndef _SYSFS_H_ 13 13 #define _SYSFS_H_ 14 14 15 + #include <linux/kernfs.h> 15 16 #include <linux/compiler.h> 16 17 #include <linux/errno.h> 17 18 #include <linux/list.h> ··· 175 174 ssize_t (*show)(struct kobject *, struct attribute *, char *); 176 175 ssize_t (*store)(struct kobject *, struct attribute *, const char *, size_t); 177 176 }; 178 - 179 - struct sysfs_dirent; 180 177 181 178 #ifdef CONFIG_SYSFS 182 179