Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Functions | Variables
file.c File Reference
#include <linux/module.h>
#include <linux/kobject.h>
#include <linux/kallsyms.h>
#include <linux/slab.h>
#include <linux/fsnotify.h>
#include <linux/namei.h>
#include <linux/poll.h>
#include <linux/list.h>
#include <linux/mutex.h>
#include <linux/limits.h>
#include <asm/uaccess.h>
#include "sysfs.h"

Go to the source code of this file.

Data Structures

struct  sysfs_open_dirent
 
struct  sysfs_buffer
 
struct  sysfs_schedule_callback_struct
 

Functions

void sysfs_notify_dirent (struct sysfs_dirent *sd)
 
 EXPORT_SYMBOL_GPL (sysfs_notify_dirent)
 
void sysfs_notify (struct kobject *k, const char *dir, const char *attr)
 
 EXPORT_SYMBOL_GPL (sysfs_notify)
 
int sysfs_attr_ns (struct kobject *kobj, const struct attribute *attr, const void **pns)
 
int sysfs_add_file_mode (struct sysfs_dirent *dir_sd, const struct attribute *attr, int type, umode_t amode)
 
int sysfs_add_file (struct sysfs_dirent *dir_sd, const struct attribute *attr, int type)
 
int sysfs_create_file (struct kobject *kobj, const struct attribute *attr)
 
int sysfs_create_files (struct kobject *kobj, const struct attribute **ptr)
 
int sysfs_add_file_to_group (struct kobject *kobj, const struct attribute *attr, const char *group)
 
 EXPORT_SYMBOL_GPL (sysfs_add_file_to_group)
 
int sysfs_chmod_file (struct kobject *kobj, const struct attribute *attr, umode_t mode)
 
 EXPORT_SYMBOL_GPL (sysfs_chmod_file)
 
void sysfs_remove_file (struct kobject *kobj, const struct attribute *attr)
 
void sysfs_remove_files (struct kobject *kobj, const struct attribute **ptr)
 
void sysfs_remove_file_from_group (struct kobject *kobj, const struct attribute *attr, const char *group)
 
 EXPORT_SYMBOL_GPL (sysfs_remove_file_from_group)
 
int sysfs_schedule_callback (struct kobject *kobj, void(*func)(void *), void *data, struct module *owner)
 
 EXPORT_SYMBOL_GPL (sysfs_schedule_callback)
 
 EXPORT_SYMBOL_GPL (sysfs_create_file)
 
 EXPORT_SYMBOL_GPL (sysfs_remove_file)
 
 EXPORT_SYMBOL_GPL (sysfs_remove_files)
 
 EXPORT_SYMBOL_GPL (sysfs_create_files)
 

Variables

struct file_operations sysfs_file_operations
 

Function Documentation

EXPORT_SYMBOL_GPL ( sysfs_notify_dirent  )
EXPORT_SYMBOL_GPL ( sysfs_notify  )
EXPORT_SYMBOL_GPL ( sysfs_add_file_to_group  )
EXPORT_SYMBOL_GPL ( sysfs_chmod_file  )
EXPORT_SYMBOL_GPL ( sysfs_remove_file_from_group  )
EXPORT_SYMBOL_GPL ( sysfs_schedule_callback  )
EXPORT_SYMBOL_GPL ( sysfs_create_file  )
EXPORT_SYMBOL_GPL ( sysfs_remove_file  )
EXPORT_SYMBOL_GPL ( sysfs_remove_files  )
EXPORT_SYMBOL_GPL ( sysfs_create_files  )
int sysfs_add_file ( struct sysfs_dirent dir_sd,
const struct attribute attr,
int  type 
)

Definition at line 558 of file file.c.

int sysfs_add_file_mode ( struct sysfs_dirent dir_sd,
const struct attribute attr,
int  type,
umode_t  amode 
)

Definition at line 526 of file file.c.

int sysfs_add_file_to_group ( struct kobject kobj,
const struct attribute attr,
const char group 
)

sysfs_add_file_to_group - add an attribute file to a pre-existing group. : object we're acting for. : attribute descriptor. : group name.

Definition at line 598 of file file.c.

int sysfs_attr_ns ( struct kobject kobj,
const struct attribute attr,
const void **  pns 
)

Definition at line 488 of file file.c.

int sysfs_chmod_file ( struct kobject kobj,
const struct attribute attr,
umode_t  mode 
)

sysfs_chmod_file - update the modified mode value on an object attribute. : object we're acting for. : attribute descriptor. : file permissions.

Definition at line 626 of file file.c.

int sysfs_create_file ( struct kobject kobj,
const struct attribute attr 
)

sysfs_create_file - create an attribute file for an object. : object we're creating for. : attribute descriptor.

Definition at line 571 of file file.c.

int sysfs_create_files ( struct kobject kobj,
const struct attribute **  ptr 
)

Definition at line 579 of file file.c.

void sysfs_notify ( struct kobject k,
const char dir,
const char attr 
)

Definition at line 462 of file file.c.

void sysfs_notify_dirent ( struct sysfs_dirent sd)

Definition at line 445 of file file.c.

void sysfs_remove_file ( struct kobject kobj,
const struct attribute attr 
)

sysfs_remove_file - remove an object attribute. : object we're acting for. : attribute descriptor.

Hash the attribute name and kill the victim.

Definition at line 664 of file file.c.

void sysfs_remove_file_from_group ( struct kobject kobj,
const struct attribute attr,
const char group 
)

sysfs_remove_file_from_group - remove an attribute file from a group. : object we're acting for. : attribute descriptor. : group name.

Definition at line 687 of file file.c.

void sysfs_remove_files ( struct kobject kobj,
const struct attribute **  ptr 
)

Definition at line 674 of file file.c.

int sysfs_schedule_callback ( struct kobject kobj,
void(*)(void *)  func,
void data,
struct module owner 
)

sysfs_schedule_callback - helper to schedule a callback for a kobject : object we're acting for. : callback function to invoke later. : argument to pass to . : module owning the callback code

sysfs attribute methods must not unregister themselves or their parent kobject (which would amount to the same thing). Attempts to do so will deadlock, since unregistration is mutually exclusive with driver callbacks.

Instead methods can call this routine, which will attempt to allocate and schedule a workqueue request to call back with as its argument in the workqueue's process context. will be pinned until returns.

Returns 0 if the request was submitted, -ENOMEM if storage could not be allocated, -ENODEV if a reference to isn't available, -EAGAIN if a callback has already been scheduled for .

Definition at line 750 of file file.c.

Variable Documentation

struct file_operations sysfs_file_operations
Initial value:
= {
.read = sysfs_read_file,
.write = sysfs_write_file,
.open = sysfs_open_file,
.release = sysfs_release,
.poll = sysfs_poll,
}

Definition at line 479 of file file.c.