fs.h
来自「此工具是arm-linux-GCC交叉编译工具(cross-3.4.4)」· C头文件 代码 · 共 1,770 行 · 第 1/5 页
H
1,770 行
extern void locks_remove_flock(struct file *);extern struct file_lock *posix_test_lock(struct file *, struct file_lock *);extern int posix_lock_file(struct file *, struct file_lock *);extern int posix_lock_file_wait(struct file *, struct file_lock *);extern void posix_block_lock(struct file_lock *, struct file_lock *);extern void posix_unblock_lock(struct file *, struct file_lock *);extern int posix_locks_deadlock(struct file_lock *, struct file_lock *);extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl);extern int __break_lease(struct inode *inode, unsigned int flags);extern void lease_get_mtime(struct inode *, struct timespec *time);extern int setlease(struct file *, long, struct file_lock **);extern int lease_modify(struct file_lock **, int);extern int lock_may_read(struct inode *, loff_t start, unsigned long count);extern int lock_may_write(struct inode *, loff_t start, unsigned long count);extern void steal_locks(fl_owner_t from);struct fasync_struct { int magic; int fa_fd; struct fasync_struct *fa_next; /* singly linked list */ struct file *fa_file;};#define FASYNC_MAGIC 0x4601/* SMP safe fasync helpers: */extern int fasync_helper(int, struct file *, int, struct fasync_struct **);/* can be called from interrupts */extern void kill_fasync(struct fasync_struct **, int, int);/* only for net: no internal synchronization */extern void __kill_fasync(struct fasync_struct *, int, int);extern int f_setown(struct file *filp, unsigned long arg, int force);extern void f_delown(struct file *filp);extern int send_sigurg(struct fown_struct *fown);/* * Umount options */#define MNT_FORCE 0x00000001 /* Attempt to forcibily umount */#define MNT_DETACH 0x00000002 /* Just detach from the tree */#define MNT_EXPIRE 0x00000004 /* Mark for expiry */extern struct list_head super_blocks;extern spinlock_t sb_lock;#define sb_entry(list) list_entry((list), struct super_block, s_list)#define S_BIAS (1<<30)struct super_block { struct list_head s_list; /* Keep this first */ dev_t s_dev; /* search index; _not_ kdev_t */ unsigned long s_blocksize; unsigned long s_old_blocksize; unsigned char s_blocksize_bits; unsigned char s_dirt; unsigned long long s_maxbytes; /* Max file size */ struct file_system_type *s_type; struct super_operations *s_op; struct dquot_operations *dq_op; struct quotactl_ops *s_qcop; struct export_operations *s_export_op; unsigned long s_flags; unsigned long s_magic; struct dentry *s_root; struct rw_semaphore s_umount; struct semaphore s_lock; int s_count; int s_syncing; int s_need_sync_fs; atomic_t s_active; void *s_security; struct xattr_handler **s_xattr; struct list_head s_inodes; /* all inodes */ struct list_head s_dirty; /* dirty inodes */ struct list_head s_io; /* parked for writeback */ struct hlist_head s_anon; /* anonymous dentries for (nfs) exporting */ struct list_head s_files; struct block_device *s_bdev; struct list_head s_instances; struct quota_info s_dquot; /* Diskquota specific options */ int s_frozen; wait_queue_head_t s_wait_unfrozen; char s_id[32]; /* Informational name */ void *s_fs_info; /* Filesystem private info */ /* * The next field is for VFS *only*. No filesystems have any business * even looking at it. You had been warned. */ struct semaphore s_vfs_rename_sem; /* Kludge */ /* Granuality of c/m/atime in ns. Cannot be worse than a second */ u32 s_time_gran;};extern struct timespec current_fs_time(struct super_block *sb);/* * Snapshotting support. */enum { SB_UNFROZEN = 0, SB_FREEZE_WRITE = 1, SB_FREEZE_TRANS = 2,};#define vfs_check_frozen(sb, level) \ wait_event((sb)->s_wait_unfrozen, ((sb)->s_frozen < (level)))static inline void get_fs_excl(void){ atomic_inc(¤t->fs_excl);}static inline void put_fs_excl(void){ atomic_dec(¤t->fs_excl);}static inline int has_fs_excl(void){ return atomic_read(¤t->fs_excl);}/* * Superblock locking. */static inline void lock_super(struct super_block * sb){ get_fs_excl(); down(&sb->s_lock);}static inline void unlock_super(struct super_block * sb){ put_fs_excl(); up(&sb->s_lock);}/* * VFS helper functions.. */extern int vfs_create(struct inode *, struct dentry *, int, struct nameidata *);extern int vfs_mkdir(struct inode *, struct dentry *, int);extern int vfs_mknod(struct inode *, struct dentry *, int, dev_t);extern int vfs_symlink(struct inode *, struct dentry *, const char *, int);extern int vfs_link(struct dentry *, struct inode *, struct dentry *);extern int vfs_rmdir(struct inode *, struct dentry *);extern int vfs_unlink(struct inode *, struct dentry *);extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);/* * VFS dentry helper functions. */extern void dentry_unhash(struct dentry *dentry);/* * File types * * NOTE! These match bits 12..15 of stat.st_mode * (ie "(i_mode >> 12) & 15"). */#define DT_UNKNOWN 0#define DT_FIFO 1#define DT_CHR 2#define DT_DIR 4#define DT_BLK 6#define DT_REG 8#define DT_LNK 10#define DT_SOCK 12#define DT_WHT 14#define OSYNC_METADATA (1<<0)#define OSYNC_DATA (1<<1)#define OSYNC_INODE (1<<2)int generic_osync_inode(struct inode *, struct address_space *, int);/* * This is the "filldir" function type, used by readdir() to let * the kernel specify what kind of dirent layout it wants to have. * This allows the kernel to read directories into kernel space or * to have different dirent layouts depending on the binary type. */typedef int (*filldir_t)(void *, const char *, int, loff_t, ino_t, unsigned);struct block_device_operations { int (*open) (struct inode *, struct file *); int (*release) (struct inode *, struct file *); int (*ioctl) (struct inode *, struct file *, unsigned, unsigned long); long (*unlocked_ioctl) (struct file *, unsigned, unsigned long); long (*compat_ioctl) (struct file *, unsigned, unsigned long); int (*direct_access) (struct block_device *, sector_t, unsigned long *); int (*media_changed) (struct gendisk *); int (*revalidate_disk) (struct gendisk *); struct module *owner;};/* * "descriptor" for what we're up to with a read for sendfile(). * This allows us to use the same read code yet * have multiple different users of the data that * we read from a file. * * The simplest case just copies the data to user * mode. */typedef struct { size_t written; size_t count; union { char __user * buf; void *data; } arg; int error;} read_descriptor_t;typedef int (*read_actor_t)(read_descriptor_t *, struct page *, unsigned long, unsigned long);/* These macros are for out of kernel modules to test that * the kernel supports the unlocked_ioctl and compat_ioctl * fields in struct file_operations. */#define HAVE_COMPAT_IOCTL 1#define HAVE_UNLOCKED_IOCTL 1/* * NOTE: * 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 (*aio_read) (struct kiocb *, char __user *, size_t, loff_t); ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *); ssize_t (*aio_write) (struct kiocb *, const char __user *, size_t, 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 *); 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 (*readv) (struct file *, const struct iovec *, unsigned long, loff_t *); ssize_t (*writev) (struct file *, const struct iovec *, unsigned long, loff_t *); 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 *);};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 *);};struct seq_file;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 super_block *, struct kstatfs *); int (*remount_fs) (struct super_block *, int *, char *); void (*clear_inode) (struct inode *); void (*umount_begin) (struct super_block *); int (*show_options)(struct seq_file *, struct vfsmount *); 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);};/* 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);}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?