Skip to content

Commit

Permalink
sysfs, kernfs: add skeletons for kernfs
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
htejun authored and gregkh committed Nov 27, 2013
1 parent ae2108a commit b8441ed
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 3 deletions.
2 changes: 1 addition & 1 deletion fs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ obj-$(CONFIG_FHANDLE) += fhandle.o
obj-y += quota/

obj-$(CONFIG_PROC_FS) += proc/
obj-$(CONFIG_SYSFS) += sysfs/
obj-$(CONFIG_SYSFS) += sysfs/ kernfs/
obj-$(CONFIG_CONFIGFS_FS) += configfs/
obj-y += devpts/

Expand Down
5 changes: 5 additions & 0 deletions fs/kernfs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#
# Makefile for the kernfs pseudo filesystem
#

obj-y := mount.o inode.o dir.o file.o symlink.o
9 changes: 9 additions & 0 deletions fs/kernfs/dir.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* fs/kernfs/dir.c - kernfs directory implementation
*
* Copyright (c) 2001-3 Patrick Mochel
* Copyright (c) 2007 SUSE Linux Products GmbH
* Copyright (c) 2007, 2013 Tejun Heo <tj@kernel.org>
*
* This file is released under the GPLv2.
*/
9 changes: 9 additions & 0 deletions fs/kernfs/file.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* fs/kernfs/file.c - kernfs file implementation
*
* Copyright (c) 2001-3 Patrick Mochel
* Copyright (c) 2007 SUSE Linux Products GmbH
* Copyright (c) 2007, 2013 Tejun Heo <tj@kernel.org>
*
* This file is released under the GPLv2.
*/
9 changes: 9 additions & 0 deletions fs/kernfs/inode.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* fs/kernfs/inode.c - kernfs inode implementation
*
* Copyright (c) 2001-3 Patrick Mochel
* Copyright (c) 2007 SUSE Linux Products GmbH
* Copyright (c) 2007, 2013 Tejun Heo <tj@kernel.org>
*
* This file is released under the GPLv2.
*/
9 changes: 9 additions & 0 deletions fs/kernfs/mount.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* fs/kernfs/mount.c - kernfs mount implementation
*
* Copyright (c) 2001-3 Patrick Mochel
* Copyright (c) 2007 SUSE Linux Products GmbH
* Copyright (c) 2007, 2013 Tejun Heo <tj@kernel.org>
*
* This file is released under the GPLv2.
*/
9 changes: 9 additions & 0 deletions fs/kernfs/symlink.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* fs/kernfs/symlink.c - kernfs symlink implementation
*
* Copyright (c) 2001-3 Patrick Mochel
* Copyright (c) 2007 SUSE Linux Products GmbH
* Copyright (c) 2007, 2013 Tejun Heo <tj@kernel.org>
*
* This file is released under the GPLv2.
*/
12 changes: 12 additions & 0 deletions include/linux/kernfs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* kernfs.h - pseudo filesystem decoupled from vfs locking
*
* This file is released under the GPLv2.
*/

#ifndef __LINUX_KERNFS_H
#define __LINUX_KERNFS_H

struct sysfs_dirent;

#endif /* __LINUX_KERNFS_H */
3 changes: 1 addition & 2 deletions include/linux/sysfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#ifndef _SYSFS_H_
#define _SYSFS_H_

#include <linux/kernfs.h>
#include <linux/compiler.h>
#include <linux/errno.h>
#include <linux/list.h>
Expand Down Expand Up @@ -175,8 +176,6 @@ struct sysfs_ops {
ssize_t (*store)(struct kobject *, struct attribute *, const char *, size_t);
};

struct sysfs_dirent;

#ifdef CONFIG_SYSFS

int sysfs_schedule_callback(struct kobject *kobj, void (*func)(void *),
Expand Down

0 comments on commit b8441ed

Please sign in to comment.