blob: 2b217cef90be1ec9fa24c9798740dcaef1683f14 [file] [log] [blame]
Tejun Heo6d66f5c2007-09-20 17:31:38 +09001/*
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
Tejun Heoae6621b2013-11-28 14:54:31 -050011#ifndef __SYSFS_INTERNAL_H
12#define __SYSFS_INTERNAL_H
David P. Quigleyddd29ec2009-09-09 14:25:37 -040013
Tejun Heoae6621b2013-11-28 14:54:31 -050014#include "../kernfs/kernfs-internal.h"
15#include <linux/sysfs.h>
Tejun Heofb6896d2007-06-14 04:27:24 +090016
Tejun Heo59f69012007-09-20 16:05:10 +090017/*
18 * mount.c
19 */
Serge E. Hallynbe867b12010-05-03 16:23:15 -050020
Eric W. Biederman9e7fdd22010-03-30 11:31:24 -070021struct sysfs_super_info {
Tejun Heo51a35e92013-11-28 14:54:37 -050022 /*
23 * Each sb is associated with one namespace tag, currently the network
24 * namespace of the task which mounted this sysfs instance. If multiple
25 * tags become necessary, make the following an array and compare
26 * sysfs_dirent tag against every entry.
27 */
28 const void *ns;
Eric W. Biederman9e7fdd22010-03-30 11:31:24 -070029};
30#define sysfs_info(SB) ((struct sysfs_super_info *)(SB->s_fs_info))
Tejun Heo061447a2013-11-28 14:54:39 -050031extern struct sysfs_dirent *sysfs_root_sd;
Christoph Lametere18b8902006-12-06 20:33:20 -080032extern struct kmem_cache *sysfs_dir_cachep;
Linus Torvalds1da177e2005-04-16 15:20:36 -070033
Tejun Heo59f69012007-09-20 16:05:10 +090034/*
35 * dir.c
36 */
Tejun Heo0cae60f2013-10-30 10:28:36 -040037extern spinlock_t sysfs_symlink_target_lock;
Tejun Heo59f69012007-09-20 16:05:10 +090038
Tejun Heod1c14592013-10-24 11:49:11 -040039void sysfs_warn_dup(struct sysfs_dirent *parent, const char *name);
Tejun Heo59f69012007-09-20 16:05:10 +090040
Tejun Heo59f69012007-09-20 16:05:10 +090041/*
Tejun Heo59f69012007-09-20 16:05:10 +090042 * file.c
43 */
Tejun Heo59f69012007-09-20 16:05:10 +090044int sysfs_add_file(struct sysfs_dirent *dir_sd,
Tejun Heoa7dc66d2013-11-28 14:54:23 -050045 const struct attribute *attr, bool is_bin);
Tejun Heo58292cbe2013-09-11 22:29:04 -040046int sysfs_add_file_mode_ns(struct sysfs_dirent *dir_sd,
Tejun Heoa7dc66d2013-11-28 14:54:23 -050047 const struct attribute *attr, bool is_bin,
Tejun Heo58292cbe2013-09-11 22:29:04 -040048 umode_t amode, const void *ns);
Tejun Heo73d97142013-10-01 17:42:07 -040049
Tejun Heo59f69012007-09-20 16:05:10 +090050/*
Tejun Heo59f69012007-09-20 16:05:10 +090051 * symlink.c
52 */
Rafael J. Wysocki0bb8f3d2013-01-25 21:51:13 +010053int sysfs_create_link_sd(struct sysfs_dirent *sd, struct kobject *target,
54 const char *name);
Tejun Heoae6621b2013-11-28 14:54:31 -050055
56#endif /* __SYSFS_INTERNAL_H */