]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - fs/aufs/sysaufs.h
UBUNTU: ubuntu: vbox -- update to 5.2.6-dfsg-5
[mirror_ubuntu-bionic-kernel.git] / fs / aufs / sysaufs.h
CommitLineData
0006ebb4
SF
1/*
2 * Copyright (C) 2005-2017 Junjiro R. Okajima
3 *
4 * This program, aufs is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18/*
19 * sysfs interface and mount lifetime management
20 */
21
22#ifndef __SYSAUFS_H__
23#define __SYSAUFS_H__
24
25#ifdef __KERNEL__
26
27#include <linux/sysfs.h>
28#include "module.h"
29
30struct super_block;
31struct au_sbinfo;
32
33struct sysaufs_si_attr {
34 struct attribute attr;
35 int (*show)(struct seq_file *seq, struct super_block *sb);
36};
37
38/* ---------------------------------------------------------------------- */
39
40/* sysaufs.c */
41extern unsigned long sysaufs_si_mask;
42extern struct kset *sysaufs_kset;
43extern struct attribute *sysaufs_si_attrs[];
44int sysaufs_si_init(struct au_sbinfo *sbinfo);
45int __init sysaufs_init(void);
46void sysaufs_fin(void);
47
48/* ---------------------------------------------------------------------- */
49
50/* some people doesn't like to show a pointer in kernel */
51static inline unsigned long sysaufs_si_id(struct au_sbinfo *sbinfo)
52{
53 return sysaufs_si_mask ^ (unsigned long)sbinfo;
54}
55
56#define SysaufsSiNamePrefix "si_"
57#define SysaufsSiNameLen (sizeof(SysaufsSiNamePrefix) + 16)
58static inline void sysaufs_name(struct au_sbinfo *sbinfo, char *name)
59{
60 snprintf(name, SysaufsSiNameLen, SysaufsSiNamePrefix "%lx",
61 sysaufs_si_id(sbinfo));
62}
63
64struct au_branch;
65#ifdef CONFIG_SYSFS
66/* sysfs.c */
67extern struct attribute_group *sysaufs_attr_group;
68
69int sysaufs_si_xi_path(struct seq_file *seq, struct super_block *sb);
70ssize_t sysaufs_si_show(struct kobject *kobj, struct attribute *attr,
71 char *buf);
72long au_brinfo_ioctl(struct file *file, unsigned long arg);
73#ifdef CONFIG_COMPAT
74long au_brinfo_compat_ioctl(struct file *file, unsigned long arg);
75#endif
76
77void sysaufs_br_init(struct au_branch *br);
78void sysaufs_brs_add(struct super_block *sb, aufs_bindex_t bindex);
79void sysaufs_brs_del(struct super_block *sb, aufs_bindex_t bindex);
80
81#define sysaufs_brs_init() do {} while (0)
82
83#else
84#define sysaufs_attr_group NULL
85
86AuStubInt0(sysaufs_si_xi_path, struct seq_file *seq, struct super_block *sb)
87AuStub(ssize_t, sysaufs_si_show, return 0, struct kobject *kobj,
88 struct attribute *attr, char *buf)
89AuStubVoid(sysaufs_br_init, struct au_branch *br)
90AuStubVoid(sysaufs_brs_add, struct super_block *sb, aufs_bindex_t bindex)
91AuStubVoid(sysaufs_brs_del, struct super_block *sb, aufs_bindex_t bindex)
92
93static inline void sysaufs_brs_init(void)
94{
95 sysaufs_brs = 0;
96}
97
98#endif /* CONFIG_SYSFS */
99
100#endif /* __KERNEL__ */
101#endif /* __SYSAUFS_H__ */