sysfs, kernfs: make super_blocks bind to different kernfs_roots
[platform/adaptation/renesas_rcar/renesas_kernel.git] / fs / sysfs / sysfs.h
1 /*
2  * fs/sysfs/sysfs.h - sysfs internal header file
3  *
4  * Copyright (c) 2001-3 Patrick Mochel
5  * Copyright (c) 2007 SUSE Linux Products GmbH
6  * Copyright (c) 2007 Tejun Heo <teheo@suse.de>
7  *
8  * This file is released under the GPLv2.
9  */
10
11 #ifndef __SYSFS_INTERNAL_H
12 #define __SYSFS_INTERNAL_H
13
14 #include "../kernfs/kernfs-internal.h"
15 #include <linux/sysfs.h>
16
17 /*
18  * mount.c
19  */
20
21 struct sysfs_super_info {
22         /*
23          * The root associated with this super_block.  Each super_block is
24          * identified by the root and ns it's associated with.
25          */
26         struct kernfs_root      *root;
27
28         /*
29          * Each sb is associated with one namespace tag, currently the network
30          * namespace of the task which mounted this sysfs instance.  If multiple
31          * tags become necessary, make the following an array and compare
32          * sysfs_dirent tag against every entry.
33          */
34         const void              *ns;
35 };
36 #define sysfs_info(SB) ((struct sysfs_super_info *)(SB->s_fs_info))
37 extern struct sysfs_dirent *sysfs_root_sd;
38 extern struct kmem_cache *sysfs_dir_cachep;
39
40 /*
41  * dir.c
42  */
43 extern spinlock_t sysfs_symlink_target_lock;
44
45 void sysfs_warn_dup(struct sysfs_dirent *parent, const char *name);
46
47 /*
48  * file.c
49  */
50 int sysfs_add_file(struct sysfs_dirent *dir_sd,
51                    const struct attribute *attr, bool is_bin);
52 int sysfs_add_file_mode_ns(struct sysfs_dirent *dir_sd,
53                            const struct attribute *attr, bool is_bin,
54                            umode_t amode, const void *ns);
55
56 /*
57  * symlink.c
58  */
59 int sysfs_create_link_sd(struct sysfs_dirent *sd, struct kobject *target,
60                          const char *name);
61
62 #endif  /* __SYSFS_INTERNAL_H */