Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations
inode.c File Reference
#include <linux/module.h>
#include <linux/fs.h>
#include <linux/mount.h>
#include <linux/pagemap.h>
#include <linux/init.h>
#include <linux/kobject.h>
#include <linux/namei.h>
#include <linux/debugfs.h>
#include <linux/fsnotify.h>
#include <linux/string.h>
#include <linux/seq_file.h>
#include <linux/parser.h>
#include <linux/magic.h>
#include <linux/slab.h>

Go to the source code of this file.

Data Structures

struct  debugfs_mount_opts
 
struct  debugfs_fs_info
 

Macros

#define DEBUGFS_DEFAULT_MODE   0700
 

Enumerations

enum  { Opt_uid, Opt_gid, Opt_mode, Opt_err }
 

Functions

: a pointer to a string containing the name of the file to create.

debugfs_create_file - create a file in the debugfs filesystem

: the permission that the file should have. : a pointer to the parent dentry for this file. This should be a directory dentry if set. If this paramater is NULL, then the file will be created in the root of the debugfs filesystem. : a pointer to something that the caller will want to get to later on. The inode.i_private pointer will point to this value on the open() call. : a pointer to a struct file_operations that should be used for this file.

This is the basic "create a file" function for debugfs. It allows for a wide range of flexibility in creating a file, or a directory (if you want to create a directory, the debugfs_create_dir() function is recommended to be used instead.)

This function will return a pointer to a dentry if it succeeds. This pointer must be passed to the debugfs_remove() function when the file is to be removed (no automatic cleanup happens if your module is unloaded, you are responsible here.) If an error occurs, NULL will be returned.

If debugfs is not enabled in the kernel, the value -ENODEV will be returned.

struct dentrydebugfs_create_file (const char *name, umode_t mode, struct dentry *parent, void *data, const struct file_operations *fops)
 
 EXPORT_SYMBOL_GPL (debugfs_create_file)
 
: a pointer to a string containing the name of the directory to

debugfs_create_dir - create a directory in the debugfs filesystem

   create.

: a pointer to the parent dentry for this file. This should be a directory dentry if set. If this paramater is NULL, then the directory will be created in the root of the debugfs filesystem.

This function creates a directory in debugfs with the given name.

This function will return a pointer to a dentry if it succeeds. This pointer must be passed to the debugfs_remove() function when the file is to be removed (no automatic cleanup happens if your module is unloaded, you are responsible here.) If an error occurs, NULL will be returned.

If debugfs is not enabled in the kernel, the value -ENODEV will be returned.

struct dentrydebugfs_create_dir (const char *name, struct dentry *parent)
 
 EXPORT_SYMBOL_GPL (debugfs_create_dir)
 

: a pointer to a string containing the name of the symbolic link to

debugfs_create_symlink- create a symbolic link in the debugfs filesystem

   create.

: a pointer to the parent dentry for this symbolic link. This should be a directory dentry if set. If this paramater is NULL, then the symbolic link will be created in the root of the debugfs filesystem. : a pointer to a string containing the path to the target of the symbolic link.

This function creates a symbolic link with the given name in debugfs that links to the given target path.

This function will return a pointer to a dentry if it succeeds. This pointer must be passed to the debugfs_remove() function when the symbolic link is to be removed (no automatic cleanup happens if your module is unloaded, you are responsible here.) If an error occurs, NULL will be returned.

If debugfs is not enabled in the kernel, the value -ENODEV will be returned.

struct dentrydebugfs_create_symlink (const char *name, struct dentry *parent, const char *target)
 
 EXPORT_SYMBOL_GPL (debugfs_create_symlink)
 
void debugfs_remove (struct dentry *dentry)
 
 EXPORT_SYMBOL_GPL (debugfs_remove)
 
void debugfs_remove_recursive (struct dentry *dentry)
 
 EXPORT_SYMBOL_GPL (debugfs_remove_recursive)
 
struct dentrydebugfs_rename (struct dentry *old_dir, struct dentry *old_dentry, struct dentry *new_dir, const char *new_name)
 
 EXPORT_SYMBOL_GPL (debugfs_rename)
 
bool debugfs_initialized (void)
 
 EXPORT_SYMBOL_GPL (debugfs_initialized)
 
 core_initcall (debugfs_init)
 

Macro Definition Documentation

#define DEBUGFS_DEFAULT_MODE   0700

Definition at line 31 of file inode.c.

Enumeration Type Documentation

anonymous enum
Enumerator:
Opt_uid 
Opt_gid 
Opt_mode 
Opt_err 

Definition at line 136 of file inode.c.

Function Documentation

core_initcall ( debugfs_init  )
struct dentry* debugfs_create_dir ( const char name,
struct dentry parent 
)
read

Definition at line 417 of file inode.c.

struct dentry* debugfs_create_file ( const char name,
umode_t  mode,
struct dentry parent,
void data,
const struct file_operations fops 
)
read

Definition at line 383 of file inode.c.

struct dentry* debugfs_create_symlink ( const char name,
struct dentry parent,
const char target 
)
read

Definition at line 447 of file inode.c.

bool debugfs_initialized ( void  )

debugfs_initialized - Tells whether debugfs has been registered

Definition at line 672 of file inode.c.

void debugfs_remove ( struct dentry dentry)

debugfs_remove - removes a file or directory from the debugfs filesystem : a pointer to a the dentry of the file or directory to be removed.

This function removes a file or directory in debugfs that was previously created with a call to another debugfs function (like debugfs_create_file() or variants thereof.)

This function is required to be called in order for the file to be removed, no automatic cleanup of files will happen when a module is removed, you are responsible here.

Definition at line 503 of file inode.c.

void debugfs_remove_recursive ( struct dentry dentry)

debugfs_remove_recursive - recursively removes a directory : a pointer to a the dentry of the directory to be removed.

This function recursively removes a directory tree in debugfs that was previously created with a call to another debugfs function (like debugfs_create_file() or variants thereof.)

This function is required to be called in order for the file to be removed, no automatic cleanup of files will happen when a module is removed, you are responsible here.

Definition at line 535 of file inode.c.

struct dentry* debugfs_rename ( struct dentry old_dir,
struct dentry old_dentry,
struct dentry new_dir,
const char new_name 
)
read

debugfs_rename - rename a file/directory in the debugfs filesystem : a pointer to the parent dentry for the renamed object. This should be a directory dentry. : dentry of an object to be renamed. : a pointer to the parent dentry where the object should be moved. This should be a directory dentry. : a pointer to a string containing the target name.

This function renames a file/directory in debugfs. The target must not exist for rename to succeed.

This function will return a pointer to old_dentry (which is updated to reflect renaming) if it succeeds. If an error occurs, NULL will be returned.

If debugfs is not enabled in the kernel, the value -ENODEV will be returned.

Definition at line 625 of file inode.c.

EXPORT_SYMBOL_GPL ( debugfs_create_file  )
EXPORT_SYMBOL_GPL ( debugfs_create_dir  )
EXPORT_SYMBOL_GPL ( debugfs_create_symlink  )
EXPORT_SYMBOL_GPL ( debugfs_remove  )
EXPORT_SYMBOL_GPL ( debugfs_remove_recursive  )
EXPORT_SYMBOL_GPL ( debugfs_rename  )
EXPORT_SYMBOL_GPL ( debugfs_initialized  )