Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations
exportfs.h File Reference
#include <linux/types.h>

Go to the source code of this file.

Data Structures

struct  fid
 
struct  export_operations
 

Macros

#define MAX_HANDLE_SZ   128
 

Enumerations

enum  fid_type {
  FILEID_ROOT = 0, FILEID_INO32_GEN = 1, FILEID_INO32_GEN_PARENT = 2, FILEID_BTRFS_WITHOUT_PARENT = 0x4d,
  FILEID_BTRFS_WITH_PARENT = 0x4e, FILEID_BTRFS_WITH_PARENT_ROOT = 0x4f, FILEID_UDF_WITHOUT_PARENT = 0x51, FILEID_UDF_WITH_PARENT = 0x52,
  FILEID_NILFS_WITHOUT_PARENT = 0x61, FILEID_NILFS_WITH_PARENT = 0x62
}
 

Functions

(with the

struct export_operations - for nfsd to communicate with file systems : encode a file handle fragment from a dentry : find the implied object and get a dentry for it : find the implied object's parent and get a dentry for it : find the name for a given inode in a given directory : find the parent of a given directory : commit metadata changes to stable storage

See Documentation/filesystems/nfs/Exporting for details on how to use this interface correctly.

encode_fh: should store in the file handle fragment (using at most bytes) information that can be used by to recover the file referred to by the &struct dentry . If the flag is set, the encode_fh() should store sufficient information so that a good attempt can be made to find not only the file but also it's place in the filesystem. This typically means storing a reference to de->d_parent in the filehandle fragment. encode_fh() should return the fileid_type on success and on error returns 255 (if the space needed to encode fh is greater than *4 bytes). On error contains the minimum size(in 4 byte unit) needed to encode the file handle.

fh_to_dentry: is given a &struct super_block () and a file handle fragment (, ). It should return a &struct dentry which refers to the same file that the file handle fragment refers to. If it cannot, it should return a NULL pointer if the file was found but no acceptable &dentries were available, or an ERR_PTR error code indicating why it couldn't be found (e.g. ENOENT or ENOMEM). Any suitable dentry can be returned including, if necessary, a new dentry created with d_alloc_root. The caller can then find any other extant dentries by following the d_alias links.

fh_to_parent: Same as , except that it returns a pointer to the parent dentry if it was encoded into the filehandle fragment by .

get_name: should find a name for the given in the given directory. The name should be stored in the understanding that it is already pointing to a a NAME_MAX+1 sized buffer. get_name() should return %0 on success, a negative error code or error. will be called without ->i_mutex held.

get_parent: should find the parent directory for the given which is also a directory. In the event that it cannot be found, or storage space cannot be allocated, a ERR_PTR should be returned.

commit_metadata: should commit metadata changes to stable storage.

Locking rules: get_parent is called with child->d_inode->i_mutex down get_name is not (which is possibly inconsistent)

int exportfs_encode_fh (struct dentry *dentry, struct fid *fid, int *max_len, int connectable)
 
struct dentryexportfs_decode_fh (struct vfsmount *mnt, struct fid *fid, int fh_len, int fileid_type, int(*acceptable)(void *, struct dentry *), void *context)
 
struct dentrygeneric_fh_to_dentry (struct super_block *sb, struct fid *fid, int fh_len, int fh_type, struct inode *(*get_inode)(struct super_block *sb, u64 ino, u32 gen))
 
struct dentrygeneric_fh_to_parent (struct super_block *sb, struct fid *fid, int fh_len, int fh_type, struct inode *(*get_inode)(struct super_block *sb, u64 ino, u32 gen))
 

Macro Definition Documentation

#define MAX_HANDLE_SZ   128

Definition at line 12 of file exportfs.h.

Enumeration Type Documentation

enum fid_type
Enumerator:
FILEID_ROOT 
FILEID_INO32_GEN 
FILEID_INO32_GEN_PARENT 
FILEID_BTRFS_WITHOUT_PARENT 
FILEID_BTRFS_WITH_PARENT 
FILEID_BTRFS_WITH_PARENT_ROOT 
FILEID_UDF_WITHOUT_PARENT 
FILEID_UDF_WITH_PARENT 
FILEID_NILFS_WITHOUT_PARENT 
FILEID_NILFS_WITH_PARENT 

Definition at line 22 of file exportfs.h.

Function Documentation

struct dentry* exportfs_decode_fh ( struct vfsmount mnt,
struct fid fid,
int  fh_len,
int  fileid_type,
int(*)(void *, struct dentry *)  acceptable,
void context 
)
read

Definition at line 370 of file expfs.c.

int exportfs_encode_fh ( struct dentry dentry,
struct fid fid,
int max_len,
int  connectable 
)

Definition at line 344 of file expfs.c.

struct dentry* generic_fh_to_dentry ( struct super_block sb,
struct fid fid,
int  fh_len,
int  fh_type,
struct inode *(*)(struct super_block *sb, u64 ino, u32 gen get_inode 
)
read

generic_fh_to_dentry - generic helper for the fh_to_dentry export operation : filesystem to do the file handle conversion on : file handle to convert : length of the file handle in bytes : type of file handle : filesystem callback to retrieve inode

This function decodes as long as it has one of the well-known Linux filehandle types and calls on it to retrieve the inode for the object specified in the file handle.

Definition at line 856 of file libfs.c.

struct dentry* generic_fh_to_parent ( struct super_block sb,
struct fid fid,
int  fh_len,
int  fh_type,
struct inode *(*)(struct super_block *sb, u64 ino, u32 gen get_inode 
)
read

generic_fh_to_parent - generic helper for the fh_to_parent export operation : filesystem to do the file handle conversion on : file handle to convert : length of the file handle in bytes : type of file handle : filesystem callback to retrieve inode

This function decodes as long as it has one of the well-known Linux filehandle types and calls on it to retrieve the inode for the parent object specified in the file handle if it is specified in the file handle, or NULL otherwise.

Definition at line 889 of file libfs.c.