Commit ae6621b0716852146e4655fef7f74a181faa6c81
Committed by
Greg Kroah-Hartman
1 parent
ccf73cf336
Exists in
master
and in
16 other branches
sysfs, kernfs: move internal decls to fs/kernfs/kernfs-internal.h
Move data structure, constant and basic accessor declarations from fs/sysfs/sysfs.h to fs/kernfs/kernfs-internal.h. The two files currently include each other. Once kernfs / sysfs separation is complete, the cross inclusions will be removed. Inclusion protectors are added to fs/sysfs/sysfs.h to allow cross-inclusion. This patch doesn't introduce any functional changes. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Showing 2 changed files with 121 additions and 96 deletions Side-by-side Diff
fs/kernfs/kernfs-internal.h
1 | +/* | |
2 | + * fs/kernfs/kernfs-internal.h - kernfs internal header file | |
3 | + * | |
4 | + * Copyright (c) 2001-3 Patrick Mochel | |
5 | + * Copyright (c) 2007 SUSE Linux Products GmbH | |
6 | + * Copyright (c) 2007, 2013 Tejun Heo <teheo@suse.de> | |
7 | + * | |
8 | + * This file is released under the GPLv2. | |
9 | + */ | |
10 | + | |
11 | +#ifndef __KERNFS_INTERNAL_H | |
12 | +#define __KERNFS_INTERNAL_H | |
13 | + | |
14 | +#include <linux/lockdep.h> | |
15 | +#include <linux/fs.h> | |
16 | +#include <linux/rbtree.h> | |
17 | + | |
18 | +#include <linux/kernfs.h> | |
19 | + | |
20 | +struct sysfs_open_dirent; | |
21 | + | |
22 | +/* type-specific structures for sysfs_dirent->s_* union members */ | |
23 | +struct sysfs_elem_dir { | |
24 | + unsigned long subdirs; | |
25 | + /* children rbtree starts here and goes through sd->s_rb */ | |
26 | + struct rb_root children; | |
27 | +}; | |
28 | + | |
29 | +struct sysfs_elem_symlink { | |
30 | + struct sysfs_dirent *target_sd; | |
31 | +}; | |
32 | + | |
33 | +struct sysfs_elem_attr { | |
34 | + const struct kernfs_ops *ops; | |
35 | + struct sysfs_open_dirent *open; | |
36 | + loff_t size; | |
37 | +}; | |
38 | + | |
39 | +struct sysfs_inode_attrs { | |
40 | + struct iattr ia_iattr; | |
41 | + void *ia_secdata; | |
42 | + u32 ia_secdata_len; | |
43 | +}; | |
44 | + | |
45 | +/* | |
46 | + * sysfs_dirent - the building block of sysfs hierarchy. Each and | |
47 | + * every sysfs node is represented by single sysfs_dirent. | |
48 | + * | |
49 | + * As long as s_count reference is held, the sysfs_dirent itself is | |
50 | + * accessible. Dereferencing s_elem or any other outer entity | |
51 | + * requires s_active reference. | |
52 | + */ | |
53 | +struct sysfs_dirent { | |
54 | + atomic_t s_count; | |
55 | + atomic_t s_active; | |
56 | +#ifdef CONFIG_DEBUG_LOCK_ALLOC | |
57 | + struct lockdep_map dep_map; | |
58 | +#endif | |
59 | + struct sysfs_dirent *s_parent; | |
60 | + const char *s_name; | |
61 | + | |
62 | + struct rb_node s_rb; | |
63 | + | |
64 | + union { | |
65 | + struct completion *completion; | |
66 | + struct sysfs_dirent *removed_list; | |
67 | + } u; | |
68 | + | |
69 | + const void *s_ns; /* namespace tag */ | |
70 | + unsigned int s_hash; /* ns + name hash */ | |
71 | + union { | |
72 | + struct sysfs_elem_dir s_dir; | |
73 | + struct sysfs_elem_symlink s_symlink; | |
74 | + struct sysfs_elem_attr s_attr; | |
75 | + }; | |
76 | + | |
77 | + void *priv; | |
78 | + | |
79 | + unsigned short s_flags; | |
80 | + umode_t s_mode; | |
81 | + unsigned int s_ino; | |
82 | + struct sysfs_inode_attrs *s_iattr; | |
83 | +}; | |
84 | + | |
85 | +#define SD_DEACTIVATED_BIAS INT_MIN | |
86 | + | |
87 | +#define SYSFS_TYPE_MASK 0x000f | |
88 | +#define SYSFS_DIR 0x0001 | |
89 | +#define SYSFS_KOBJ_ATTR 0x0002 | |
90 | +#define SYSFS_KOBJ_LINK 0x0004 | |
91 | +#define SYSFS_COPY_NAME (SYSFS_DIR | SYSFS_KOBJ_LINK) | |
92 | +#define SYSFS_ACTIVE_REF SYSFS_KOBJ_ATTR | |
93 | + | |
94 | +#define SYSFS_FLAG_MASK ~SYSFS_TYPE_MASK | |
95 | +#define SYSFS_FLAG_REMOVED 0x0010 | |
96 | +#define SYSFS_FLAG_NS 0x0020 | |
97 | +#define SYSFS_FLAG_HAS_SEQ_SHOW 0x0040 | |
98 | +#define SYSFS_FLAG_HAS_MMAP 0x0080 | |
99 | +#define SYSFS_FLAG_LOCKDEP 0x0100 | |
100 | + | |
101 | +static inline unsigned int sysfs_type(struct sysfs_dirent *sd) | |
102 | +{ | |
103 | + return sd->s_flags & SYSFS_TYPE_MASK; | |
104 | +} | |
105 | + | |
106 | +/* | |
107 | + * Context structure to be used while adding/removing nodes. | |
108 | + */ | |
109 | +struct sysfs_addrm_cxt { | |
110 | + struct sysfs_dirent *removed; | |
111 | +}; | |
112 | + | |
113 | +#include "../sysfs/sysfs.h" | |
114 | + | |
115 | +#endif /* __KERNFS_INTERNAL_H */ |
fs/sysfs/sysfs.h
... | ... | @@ -8,105 +8,13 @@ |
8 | 8 | * This file is released under the GPLv2. |
9 | 9 | */ |
10 | 10 | |
11 | -#include <linux/lockdep.h> | |
12 | -#include <linux/kobject_ns.h> | |
13 | -#include <linux/fs.h> | |
14 | -#include <linux/rbtree.h> | |
11 | +#ifndef __SYSFS_INTERNAL_H | |
12 | +#define __SYSFS_INTERNAL_H | |
15 | 13 | |
16 | -struct sysfs_open_dirent; | |
14 | +#include "../kernfs/kernfs-internal.h" | |
15 | +#include <linux/sysfs.h> | |
17 | 16 | |
18 | -/* type-specific structures for sysfs_dirent->s_* union members */ | |
19 | -struct sysfs_elem_dir { | |
20 | - unsigned long subdirs; | |
21 | - /* children rbtree starts here and goes through sd->s_rb */ | |
22 | - struct rb_root children; | |
23 | -}; | |
24 | - | |
25 | -struct sysfs_elem_symlink { | |
26 | - struct sysfs_dirent *target_sd; | |
27 | -}; | |
28 | - | |
29 | -struct sysfs_elem_attr { | |
30 | - const struct kernfs_ops *ops; | |
31 | - struct sysfs_open_dirent *open; | |
32 | - loff_t size; | |
33 | -}; | |
34 | - | |
35 | -struct sysfs_inode_attrs { | |
36 | - struct iattr ia_iattr; | |
37 | - void *ia_secdata; | |
38 | - u32 ia_secdata_len; | |
39 | -}; | |
40 | - | |
41 | 17 | /* |
42 | - * sysfs_dirent - the building block of sysfs hierarchy. Each and | |
43 | - * every sysfs node is represented by single sysfs_dirent. | |
44 | - * | |
45 | - * As long as s_count reference is held, the sysfs_dirent itself is | |
46 | - * accessible. Dereferencing s_elem or any other outer entity | |
47 | - * requires s_active reference. | |
48 | - */ | |
49 | -struct sysfs_dirent { | |
50 | - atomic_t s_count; | |
51 | - atomic_t s_active; | |
52 | -#ifdef CONFIG_DEBUG_LOCK_ALLOC | |
53 | - struct lockdep_map dep_map; | |
54 | -#endif | |
55 | - struct sysfs_dirent *s_parent; | |
56 | - const char *s_name; | |
57 | - | |
58 | - struct rb_node s_rb; | |
59 | - | |
60 | - union { | |
61 | - struct completion *completion; | |
62 | - struct sysfs_dirent *removed_list; | |
63 | - } u; | |
64 | - | |
65 | - const void *s_ns; /* namespace tag */ | |
66 | - unsigned int s_hash; /* ns + name hash */ | |
67 | - union { | |
68 | - struct sysfs_elem_dir s_dir; | |
69 | - struct sysfs_elem_symlink s_symlink; | |
70 | - struct sysfs_elem_attr s_attr; | |
71 | - }; | |
72 | - | |
73 | - void *priv; | |
74 | - | |
75 | - unsigned short s_flags; | |
76 | - umode_t s_mode; | |
77 | - unsigned int s_ino; | |
78 | - struct sysfs_inode_attrs *s_iattr; | |
79 | -}; | |
80 | - | |
81 | -#define SD_DEACTIVATED_BIAS INT_MIN | |
82 | - | |
83 | -#define SYSFS_TYPE_MASK 0x000f | |
84 | -#define SYSFS_DIR 0x0001 | |
85 | -#define SYSFS_KOBJ_ATTR 0x0002 | |
86 | -#define SYSFS_KOBJ_LINK 0x0004 | |
87 | -#define SYSFS_COPY_NAME (SYSFS_DIR | SYSFS_KOBJ_LINK) | |
88 | -#define SYSFS_ACTIVE_REF SYSFS_KOBJ_ATTR | |
89 | - | |
90 | -#define SYSFS_FLAG_MASK ~SYSFS_TYPE_MASK | |
91 | -#define SYSFS_FLAG_REMOVED 0x0010 | |
92 | -#define SYSFS_FLAG_NS 0x0020 | |
93 | -#define SYSFS_FLAG_HAS_SEQ_SHOW 0x0040 | |
94 | -#define SYSFS_FLAG_HAS_MMAP 0x0080 | |
95 | -#define SYSFS_FLAG_LOCKDEP 0x0100 | |
96 | - | |
97 | -static inline unsigned int sysfs_type(struct sysfs_dirent *sd) | |
98 | -{ | |
99 | - return sd->s_flags & SYSFS_TYPE_MASK; | |
100 | -} | |
101 | - | |
102 | -/* | |
103 | - * Context structure to be used while adding/removing nodes. | |
104 | - */ | |
105 | -struct sysfs_addrm_cxt { | |
106 | - struct sysfs_dirent *removed; | |
107 | -}; | |
108 | - | |
109 | -/* | |
110 | 18 | * mount.c |
111 | 19 | */ |
112 | 20 | |
... | ... | @@ -175,4 +83,6 @@ |
175 | 83 | extern const struct inode_operations sysfs_symlink_inode_operations; |
176 | 84 | int sysfs_create_link_sd(struct sysfs_dirent *sd, struct kobject *target, |
177 | 85 | const char *name); |
86 | + | |
87 | +#endif /* __SYSFS_INTERNAL_H */ |