⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fs.h

📁 Axis 221 camera embedded programing interface
💻 H
📖 第 1 页 / 共 5 页
字号:
 * read, write, poll, fsync, readv, writev, unlocked_ioctl and compat_ioctl * can be called without the big kernel lock held in all filesystems. */struct file_operations {	struct module *owner;	loff_t (*llseek) (struct file *, loff_t, int);	ssize_t (*read) (struct file *, char __user *, size_t, loff_t *);	ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *);	ssize_t (*aio_read) (struct kiocb *, const struct iovec *, unsigned long, loff_t);	ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t);	int (*readdir) (struct file *, void *, filldir_t);	unsigned int (*poll) (struct file *, struct poll_table_struct *);	int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned long);	long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);	long (*compat_ioctl) (struct file *, unsigned int, unsigned long);	int (*mmap) (struct file *, struct vm_area_struct *);	int (*open) (struct inode *, struct file *);	int (*flush) (struct file *, fl_owner_t id);	int (*release) (struct inode *, struct file *);	int (*fsync) (struct file *, struct dentry *, int datasync);	int (*aio_fsync) (struct kiocb *, int datasync);	int (*fasync) (int, struct file *, int);	int (*lock) (struct file *, int, struct file_lock *);	ssize_t (*sendfile) (struct file *, loff_t *, size_t, read_actor_t, void *);	ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int);	unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);	int (*check_flags)(int);	int (*dir_notify)(struct file *filp, unsigned long arg);	int (*flock) (struct file *, int, struct file_lock *);	ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int);	ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int);};struct inode_operations {	int (*create) (struct inode *,struct dentry *,int, struct nameidata *);	struct dentry * (*lookup) (struct inode *,struct dentry *, struct nameidata *);	int (*link) (struct dentry *,struct inode *,struct dentry *);	int (*unlink) (struct inode *,struct dentry *);	int (*symlink) (struct inode *,struct dentry *,const char *);	int (*mkdir) (struct inode *,struct dentry *,int);	int (*rmdir) (struct inode *,struct dentry *);	int (*mknod) (struct inode *,struct dentry *,int,dev_t);	int (*rename) (struct inode *, struct dentry *,			struct inode *, struct dentry *);	int (*readlink) (struct dentry *, char __user *,int);	void * (*follow_link) (struct dentry *, struct nameidata *);	void (*put_link) (struct dentry *, struct nameidata *, void *);	void (*truncate) (struct inode *);	int (*permission) (struct inode *, int, struct nameidata *);	int (*setattr) (struct dentry *, struct iattr *);	int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *);	int (*setxattr) (struct dentry *, const char *,const void *,size_t,int);	ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t);	ssize_t (*listxattr) (struct dentry *, char *, size_t);	int (*removexattr) (struct dentry *, const char *);	void (*truncate_range)(struct inode *, loff_t, loff_t);};struct seq_file;ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector,				unsigned long nr_segs, unsigned long fast_segs,				struct iovec *fast_pointer,				struct iovec **ret_pointer);extern ssize_t vfs_read(struct file *, char __user *, size_t, loff_t *);extern ssize_t vfs_write(struct file *, const char __user *, size_t, loff_t *);extern ssize_t vfs_readv(struct file *, const struct iovec __user *,		unsigned long, loff_t *);extern ssize_t vfs_writev(struct file *, const struct iovec __user *,		unsigned long, loff_t *);/* * NOTE: write_inode, delete_inode, clear_inode, put_inode can be called * without the big kernel lock held in all filesystems. */struct super_operations {   	struct inode *(*alloc_inode)(struct super_block *sb);	void (*destroy_inode)(struct inode *);	void (*read_inode) (struct inode *);     	void (*dirty_inode) (struct inode *);	int (*write_inode) (struct inode *, int);	void (*put_inode) (struct inode *);	void (*drop_inode) (struct inode *);	void (*delete_inode) (struct inode *);	void (*put_super) (struct super_block *);	void (*write_super) (struct super_block *);	int (*sync_fs)(struct super_block *sb, int wait);	void (*write_super_lockfs) (struct super_block *);	void (*unlockfs) (struct super_block *);	int (*statfs) (struct dentry *, struct kstatfs *);	int (*remount_fs) (struct super_block *, int *, char *);	void (*clear_inode) (struct inode *);	void (*umount_begin) (struct vfsmount *, int);	int (*show_options)(struct seq_file *, struct vfsmount *);	int (*show_stats)(struct seq_file *, struct vfsmount *);#ifdef CONFIG_QUOTA	ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t);	ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t);#endif};/* Inode state bits.  Protected by inode_lock. */#define I_DIRTY_SYNC		1 /* Not dirty enough for O_DATASYNC */#define I_DIRTY_DATASYNC	2 /* Data-related inode changes pending */#define I_DIRTY_PAGES		4 /* Data-related inode changes pending */#define __I_LOCK		3#define I_LOCK			(1 << __I_LOCK)#define I_FREEING		16#define I_CLEAR			32#define I_NEW			64#define I_WILL_FREE		128#define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES)extern void __mark_inode_dirty(struct inode *, int);static inline void mark_inode_dirty(struct inode *inode){	__mark_inode_dirty(inode, I_DIRTY);}static inline void mark_inode_dirty_sync(struct inode *inode){	__mark_inode_dirty(inode, I_DIRTY_SYNC);}static inline void inc_nlink(struct inode *inode){	inode->i_nlink++;}static inline void inode_inc_link_count(struct inode *inode){	inc_nlink(inode);	mark_inode_dirty(inode);}static inline void drop_nlink(struct inode *inode){	inode->i_nlink--;}static inline void clear_nlink(struct inode *inode){	inode->i_nlink = 0;}static inline void inode_dec_link_count(struct inode *inode){	drop_nlink(inode);	mark_inode_dirty(inode);}extern void touch_atime(struct vfsmount *mnt, struct dentry *dentry);static inline void file_accessed(struct file *file){	if (!(file->f_flags & O_NOATIME))		touch_atime(file->f_path.mnt, file->f_path.dentry);}int sync_inode(struct inode *inode, struct writeback_control *wbc);/** * struct export_operations - for nfsd to communicate with file systems * @decode_fh:      decode a file handle fragment and return a &struct dentry * @encode_fh:      encode a file handle fragment from a dentry * @get_name:       find the name for a given inode in a given directory * @get_parent:     find the parent of a given directory * @get_dentry:     find a dentry for the inode given a file handle sub-fragment * @find_exported_dentry: *	set by the exporting module to a standard helper function. * * Description: *    The export_operations structure provides a means for nfsd to communicate *    with a particular exported file system  - particularly enabling nfsd and *    the filesystem to co-operate when dealing with file handles. * *    export_operations contains two basic operation for dealing with file *    handles, decode_fh() and encode_fh(), and allows for some other *    operations to be defined which standard helper routines use to get *    specific information from the filesystem. * *    nfsd encodes information use to determine which filesystem a filehandle *    applies to in the initial part of the file handle.  The remainder, termed *    a file handle fragment, is controlled completely by the filesystem.  The *    standard helper routines assume that this fragment will contain one or *    two sub-fragments, one which identifies the file, and one which may be *    used to identify the (a) directory containing the file. * *    In some situations, nfsd needs to get a dentry which is connected into a *    specific part of the file tree.  To allow for this, it passes the *    function acceptable() together with a @context which can be used to see *    if the dentry is acceptable.  As there can be multiple dentrys for a *    given file, the filesystem should check each one for acceptability before *    looking for the next.  As soon as an acceptable one is found, it should *    be returned. * * decode_fh: *    @decode_fh is given a &struct super_block (@sb), a file handle fragment *    (@fh, @fh_len) and an acceptability testing function (@acceptable, *    @context).  It should return a &struct dentry which refers to the same *    file that the file handle fragment refers to,  and which passes the *    acceptability test.  If it cannot, it should return a %NULL pointer if *    the file was found but no acceptable &dentries were available, or a *    %ERR_PTR error code indicating why it couldn't be found (e.g. %ENOENT or *    %ENOMEM). * * encode_fh: *    @encode_fh should store in the file handle fragment @fh (using at most *    @max_len bytes) information that can be used by @decode_fh to recover the *    file refered to by the &struct dentry @de.  If the @connectable 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 number of bytes *    stored or a negative error code such as %-ENOSPC * * get_name: *    @get_name should find a name for the given @child in the given @parent *    directory.  The name should be stored in the @name (with 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.  @get_name will be called without @parent->i_mutex held. * * get_parent: *    @get_parent should find the parent directory for the given @child 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. * * get_dentry: *    Given a &super_block (@sb) and a pointer to a file-system specific inode *    identifier, possibly an inode number, (@inump) get_dentry() should find *    the identified inode and return a dentry for that inode.  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 dentrys by *    following the d_alias links.  If a new dentry was created using *    d_alloc_root, DCACHE_NFSD_DISCONNECTED should be set, and the dentry *    should be d_rehash()ed. * *    If the inode cannot be found, either a %NULL pointer or an %ERR_PTR code *    can be returned.  The @inump will be whatever was passed to *    nfsd_find_fh_dentry() in either the @obj or @parent parameters. * * Locking rules: *    get_parent is called with child->d_inode->i_mutex down *    get_name is not (which is possibly inconsistent) */struct export_operations {	struct dentry *(*decode_fh)(struct super_block *sb, __u32 *fh, int fh_len, int fh_type,			 int (*acceptable)(void *context, struct dentry *de),			 void *context);	int (*encode_fh)(struct dentry *de, __u32 *fh, int *max_len,			 int connectable);	/* the following are only called from the filesystem itself */	int (*get_name)(struct dentry *parent, char *name,			struct dentry *child);	struct dentry * (*get_parent)(struct dentry *child);	struct dentry * (*get_dentry)(struct super_block *sb, void *inump);	/* This is set by the exporting module to a standard helper */	struct dentry * (*find_exported_dentry)(		struct super_block *sb, void *obj, void *parent,		int (*acceptable)(void *context, struct dentry *de),		void *context);};extern struct dentry *find_exported_dentry(struct super_block *sb, void *obj, void *parent,		     int (*acceptable)(void *context, struct dentry *de),		     void *context);struct file_system_type {	const char *name;	int fs_flags;	int (*get_sb) (struct file_system_type *, int,		       const char *, void *, struct vfsmount *);	void (*kill_sb) (struct super_block *);	struct module *owner;	struct file_system_type * next;	struct list_head fs_supers;	struct lock_class_key s_lock_key;	struct lock_class_key s_umount_key;};extern int get_sb_bdev(struct file_system_type *fs_type,	int flags, const char *dev_name, void *data,	int (*fill_super)(struct super_block *, void *, int),	struct vfsmount *mnt);extern int get_sb_single(struct file_system_type *fs_type,	int flags, void *data,	int (*fill_super)(struct super_block *, void *, int),	struct vfsmount *mnt);extern int get_sb_nodev(struct file_system_type *fs_type,	int flags, void *data,	int (*fill_super)(struct super_block *, void *, int),	struct vfsmount *mnt);void generic_shutdown_super(struct super_block *sb);void kill_block_super(struct super_block *sb);void kill_anon_super(struct super_block *sb);void kill_litter_super(struct super_block *sb);void deactivate_super(struct super_block *sb);int set_anon_super(struct super_block *s, void *data);struct super_block *sget(struct file_system_type *type,			int (*test)(struct super_block *,void *),			int (*set)(struct super_block *,void *),			void *data);extern int get_sb_pseudo(struct file_system_type *, char *,	struct super_operations *ops, unsigned long,	struct vfsmount *mnt);extern int simple_set_mnt(struct vfsmount *mnt, struct super_block *sb);int __put_super(struct super_block *sb);int __put_super_and_need_restart(struct super_block *sb);void unnamed_dev_init(void);/* Alas, no aliases. Too much hassle with bringing module.h everywhere */#define fops_get(fops) \	(((fops) && try_module_get((fops)->owner) ? (fops) : NULL))#define fops_put(fops) \	do { if (fops) module_put((fops)->owner); } while(0)extern int register_filesystem(struct file_system_type *);extern int unregister_filesystem(struct file_system_type *);extern struct vfsmount *kern_mount(struct file_system_type *);extern int may_umount_tree(struct vfsmount *);extern int may_umount(struct vfsmount *);extern void umount_tree(struct vfsmount *, int, struct list_head *);extern void release_mounts(struct list_head *);extern long do_mount(char *, char *, char *, unsigned long, void *);extern struct vfsmount *copy_tree(struct vfsmount *, struct dentry *, int);extern void mnt_set_mountpoint(struct vfsmount *, struct dentry *,				  struct vfsmount *);extern int vfs_statfs(struct dentry *, struct kstatfs *);/* /sys/fs */extern struct subsystem fs_subsys;#define FLOCK_VERIFY_READ  1#define FLOCK_VERIFY_WRITE 2extern int locks_mandatory_locked(struct inode *);extern int locks_mandatory_area(int, struct inode *, struct file *, loff_t, size_t);/* * Candidates for mandatory locking have the setgid bit set * but no group execute bit -  an otherwise meaningless combination. */#define MANDATORY_LOCK(inode) \	(IS_MANDLOCK(inode) && ((inode)->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID)static inline int locks_verify_locked(struct inode *inode)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -