aboutsummaryrefslogtreecommitdiffstats
path: root/fs/kernfs/kernfs-internal.h
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2013-11-28 14:54:31 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-11-29 20:55:10 -0500
commitae6621b0716852146e4655fef7f74a181faa6c81 (patch)
tree04b4e642dee773bc6acb4da51c56f0d19090de3e /fs/kernfs/kernfs-internal.h
parentccf73cf336dc55bc52748205dee998d2fd4a8808 (diff)
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>
Diffstat (limited to 'fs/kernfs/kernfs-internal.h')
-rw-r--r--fs/kernfs/kernfs-internal.h115
1 files changed, 115 insertions, 0 deletions
diff --git a/fs/kernfs/kernfs-internal.h b/fs/kernfs/kernfs-internal.h
new file mode 100644
index 000000000000..5a2c3a17d7cb
--- /dev/null
+++ b/fs/kernfs/kernfs-internal.h
@@ -0,0 +1,115 @@
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
20struct sysfs_open_dirent;
21
22/* type-specific structures for sysfs_dirent->s_* union members */
23struct 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
29struct sysfs_elem_symlink {
30 struct sysfs_dirent *target_sd;
31};
32
33struct sysfs_elem_attr {
34 const struct kernfs_ops *ops;
35 struct sysfs_open_dirent *open;
36 loff_t size;
37};
38
39struct 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 */
53struct 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
101static 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 */
109struct sysfs_addrm_cxt {
110 struct sysfs_dirent *removed;
111};
112
113#include "../sysfs/sysfs.h"
114
115#endif /* __KERNFS_INTERNAL_H */