Skip to content

Commit b8441ed

Browse files
htejungregkh
authored andcommitted
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>
1 parent ae2108a commit b8441ed

9 files changed

Lines changed: 64 additions & 3 deletions

File tree

‎fs/Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ obj-$(CONFIG_FHANDLE) += fhandle.o
5353
obj-y += quota/
5454

5555
obj-$(CONFIG_PROC_FS) += proc/
56-
obj-$(CONFIG_SYSFS) += sysfs/
56+
obj-$(CONFIG_SYSFS) += sysfs/ kernfs/
5757
obj-$(CONFIG_CONFIGFS_FS) += configfs/
5858
obj-y += devpts/
5959

‎fs/kernfs/Makefile‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#
2+
# Makefile for the kernfs pseudo filesystem
3+
#
4+
5+
obj-y := mount.o inode.o dir.o file.o symlink.o

‎fs/kernfs/dir.c‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
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+
*/

‎fs/kernfs/file.c‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
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+
*/

‎fs/kernfs/inode.c‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
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+
*/

‎fs/kernfs/mount.c‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
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+
*/

‎fs/kernfs/symlink.c‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
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+
*/

‎include/linux/kernfs.h‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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 */

‎include/linux/sysfs.h‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#ifndef _SYSFS_H_
1313
#define _SYSFS_H_
1414

15+
#include <linux/kernfs.h>
1516
#include <linux/compiler.h>
1617
#include <linux/errno.h>
1718
#include <linux/list.h>
@@ -175,8 +176,6 @@ struct sysfs_ops {
175176
ssize_t (*store)(struct kobject *, struct attribute *, const char *, size_t);
176177
};
177178

178-
struct sysfs_dirent;
179-
180179
#ifdef CONFIG_SYSFS
181180

182181
int sysfs_schedule_callback(struct kobject *kobj, void (*func)(void *),

0 commit comments

Comments
 (0)