Skip to content

Commit dd8a5b0

Browse files
htejungregkh
authored andcommitted
sysfs, kernfs: move sysfs_open_file to include/linux/kernfs.h
sysfs_open_file will be used as the primary handle for kernfs methods. Move its definition from fs/sysfs/file.c to include/linux/kernfs.h and mark the public and private fields. This is pure relocation. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent c6fb449 commit dd8a5b0

2 files changed

Lines changed: 18 additions & 11 deletions

File tree

‎fs/sysfs/file.c‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,6 @@ struct sysfs_open_dirent {
4747
struct list_head files; /* goes through sysfs_open_file.list */
4848
};
4949

50-
struct sysfs_open_file {
51-
struct sysfs_dirent *sd;
52-
struct file *file;
53-
struct mutex mutex;
54-
int event;
55-
struct list_head list;
56-
57-
bool mmapped;
58-
const struct vm_operations_struct *vm_ops;
59-
};
60-
6150
static bool sysfs_is_bin(struct sysfs_dirent *sd)
6251
{
6352
return sysfs_type(sd) == SYSFS_KOBJ_BIN_ATTR;

‎include/linux/kernfs.h‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,30 @@
99

1010
#include <linux/kernel.h>
1111
#include <linux/err.h>
12+
#include <linux/list.h>
13+
#include <linux/mutex.h>
1214

1315
struct file;
1416
struct iattr;
17+
struct seq_file;
18+
struct vm_area_struct;
1519

1620
struct sysfs_dirent;
1721

22+
struct sysfs_open_file {
23+
/* published fields */
24+
struct sysfs_dirent *sd;
25+
struct file *file;
26+
27+
/* private fields, do not use outside kernfs proper */
28+
struct mutex mutex;
29+
int event;
30+
struct list_head list;
31+
32+
bool mmapped;
33+
const struct vm_operations_struct *vm_ops;
34+
};
35+
1836
#ifdef CONFIG_SYSFS
1937

2038
struct sysfs_dirent *kernfs_create_dir_ns(struct sysfs_dirent *parent,

0 commit comments

Comments
 (0)