Linux Kernel
3.7.1
|
#include <linux/fs.h>
#include <linux/mount.h>
#include <linux/module.h>
#include <linux/kobject.h>
#include <linux/namei.h>
#include <linux/idr.h>
#include <linux/completion.h>
#include <linux/mutex.h>
#include <linux/slab.h>
#include <linux/security.h>
#include <linux/hash.h>
#include "sysfs.h"
Go to the source code of this file.
Macros | |
#define | to_sysfs_dirent(X) rb_entry((X), struct sysfs_dirent, s_rb); |
Functions | |
DEFINE_MUTEX (sysfs_mutex) | |
DEFINE_SPINLOCK (sysfs_assoc_lock) | |
under @parent_sd. | |
LOCKING: mutex_lock(sysfs_mutex) RETURNS: Pointer to sysfs_dirent if found, NULL if not. | |
struct sysfs_dirent * | sysfs_find_dirent (struct sysfs_dirent *parent_sd, const void *ns, const unsigned char *name) |
: Null terminated string to hash | |
sysfs_name_hash : Namespace tag to hash Returns 31 bit hash of ns + name (so it fits in an off_t ) | |
struct dentry_operations | sysfs_dentry_ops |
struct sysfs_dirent * | sysfs_get_active (struct sysfs_dirent *sd) |
void | sysfs_put_active (struct sysfs_dirent *sd) |
void | release_sysfs_dirent (struct sysfs_dirent *sd) |
struct sysfs_dirent * | sysfs_new_dirent (const char *name, umode_t mode, int type) |
void | sysfs_addrm_start (struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *parent_sd) |
int | __sysfs_add_one (struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd) |
int | sysfs_add_one (struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd) |
void | sysfs_remove_one (struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd) |
void | sysfs_addrm_finish (struct sysfs_addrm_cxt *acxt) |
under @parent_sd and get | |
LOCKING: Kernel thread context (may sleep). Grabs sysfs_mutex. RETURNS: Pointer to sysfs_dirent if found, NULL if not. | |
struct inode_operations | sysfs_dir_inode_operations |
struct file_operations | sysfs_dir_operations |
struct sysfs_dirent * | sysfs_get_dirent (struct sysfs_dirent *parent_sd, const void *ns, const unsigned char *name) |
EXPORT_SYMBOL_GPL (sysfs_get_dirent) | |
int | sysfs_create_subdir (struct kobject *kobj, const char *name, struct sysfs_dirent **p_sd) |
int | sysfs_create_dir (struct kobject *kobj) |
void | sysfs_remove_subdir (struct sysfs_dirent *sd) |
void | sysfs_remove_dir (struct kobject *kobj) |
int | sysfs_rename (struct sysfs_dirent *sd, struct sysfs_dirent *new_parent_sd, const void *new_ns, const char *new_name) |
int | sysfs_rename_dir (struct kobject *kobj, const char *new_name) |
int | sysfs_move_dir (struct kobject *kobj, struct kobject *new_parent_kobj) |
#define to_sysfs_dirent | ( | X | ) | rb_entry((X), struct sysfs_dirent, s_rb); |
int __sysfs_add_one | ( | struct sysfs_addrm_cxt * | acxt, |
struct sysfs_dirent * | sd | ||
) |
__sysfs_add_one - add sysfs_dirent to parent without warning : addrm context to use : sysfs_dirent to be added
Get ->parent_sd and set sd->s_parent to it and increment nlink of parent inode if is a directory and link into the children list of the parent.
This function should be called between calls to sysfs_addrm_start() and sysfs_addrm_finish() and should be passed the same as passed to sysfs_addrm_start().
LOCKING: Determined by sysfs_addrm_start().
RETURNS: 0 on success, -EEXIST if entry with the given name already exists.
DEFINE_MUTEX | ( | sysfs_mutex | ) |
DEFINE_SPINLOCK | ( | sysfs_assoc_lock | ) |
EXPORT_SYMBOL_GPL | ( | sysfs_get_dirent | ) |
void release_sysfs_dirent | ( | struct sysfs_dirent * | sd | ) |
int sysfs_add_one | ( | struct sysfs_addrm_cxt * | acxt, |
struct sysfs_dirent * | sd | ||
) |
sysfs_add_one - add sysfs_dirent to parent : addrm context to use : sysfs_dirent to be added
Get ->parent_sd and set sd->s_parent to it and increment nlink of parent inode if is a directory and link into the children list of the parent.
This function should be called between calls to sysfs_addrm_start() and sysfs_addrm_finish() and should be passed the same as passed to sysfs_addrm_start().
LOCKING: Determined by sysfs_addrm_start().
RETURNS: 0 on success, -EEXIST if entry with the given name already exists.
void sysfs_addrm_finish | ( | struct sysfs_addrm_cxt * | acxt | ) |
sysfs_addrm_finish - finish up sysfs_dirent add/remove : addrm context to finish up
Finish up sysfs_dirent add/remove. Resources acquired by sysfs_addrm_start() are released and removed sysfs_dirents are cleaned up.
LOCKING: sysfs_mutex is released.
void sysfs_addrm_start | ( | struct sysfs_addrm_cxt * | acxt, |
struct sysfs_dirent * | parent_sd | ||
) |
sysfs_addrm_start - prepare for sysfs_dirent add/remove : pointer to sysfs_addrm_cxt to be used : parent sysfs_dirent
This function is called when the caller is about to add or remove sysfs_dirent under . This function acquires sysfs_mutex. is used to keep and pass context to other addrm functions.
LOCKING: Kernel thread context (may sleep). sysfs_mutex is locked on return.
|
read |
|
read |
sysfs_get_active - get an active reference to sysfs_dirent : sysfs_dirent to get an active reference to
Get an active reference of . This function is noop if is NULL.
RETURNS: Pointer to on success, NULL on failure.
|
read |
void sysfs_put_active | ( | struct sysfs_dirent * | sd | ) |
sysfs_put_active - put an active reference to sysfs_dirent : sysfs_dirent to put an active reference to
Put an active reference to . This function is noop if is NULL.
void sysfs_remove_one | ( | struct sysfs_addrm_cxt * | acxt, |
struct sysfs_dirent * | sd | ||
) |
sysfs_remove_one - remove sysfs_dirent from parent : addrm context to use : sysfs_dirent to be removed
Mark removed and drop nlink of parent inode if is a directory. is unlinked from the children list.
This function should be called between calls to sysfs_addrm_start() and sysfs_addrm_finish() and should be passed the same as passed to sysfs_addrm_start().
LOCKING: Determined by sysfs_addrm_start().
void sysfs_remove_subdir | ( | struct sysfs_dirent * | sd | ) |
int sysfs_rename | ( | struct sysfs_dirent * | sd, |
struct sysfs_dirent * | new_parent_sd, | ||
const void * | new_ns, | ||
const char * | new_name | ||
) |
struct dentry_operations sysfs_dentry_ops |
struct inode_operations sysfs_dir_inode_operations |
struct file_operations sysfs_dir_operations |