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

📄 fs.h

📁 基于组件方式开发操作系统的OSKIT源代码
💻 H
📖 第 1 页 / 共 3 页
字号:
	unsigned long		i_blksize;	unsigned long		i_blocks;	unsigned long		i_version;	unsigned long		i_nrpages;	struct semaphore	i_sem;	struct semaphore	i_atomic_write;	struct inode_operations	*i_op;	struct super_block	*i_sb;	struct wait_queue	*i_wait;	struct file_lock	*i_flock;	struct vm_area_struct	*i_mmap;	struct page		*i_pages;	struct dquot		*i_dquot[MAXQUOTAS];	unsigned long		i_state;	unsigned int		i_flags;	unsigned char		i_pipe;	unsigned char		i_sock;	int			i_writecount;	unsigned int		i_attr_flags;	__u32			i_generation;#ifndef OSKIT_DEV/* OSKIT_DEV doesn't need fs stuff, might as well save compile time. */	union {		struct pipe_inode_info		pipe_i;		struct minix_inode_info		minix_i;		struct ext2_inode_info		ext2_i;		struct hpfs_inode_info		hpfs_i;		struct ntfs_inode_info          ntfs_i;		struct msdos_inode_info		msdos_i;		struct umsdos_inode_info	umsdos_i;		struct iso_inode_info		isofs_i;		struct nfs_inode_info		nfs_i;		struct sysv_inode_info		sysv_i;		struct affs_inode_info		affs_i;		struct ufs_inode_info		ufs_i;		struct efs_inode_info		efs_i;		struct romfs_inode_info		romfs_i;		struct coda_inode_info		coda_i;		struct smb_inode_info		smbfs_i;		struct hfs_inode_info		hfs_i;		struct adfs_inode_info		adfs_i;		struct qnx4_inode_info		qnx4_i;		struct socket			socket_i;		void				*generic_ip;	} u;#endif /* OSKIT_DEV */#ifdef OSKIT_DEV	void *i_emul_data;#endif};/* Inode state bits.. */#define I_DIRTY		1#define I_LOCK		2#define I_FREEING	4extern void __mark_inode_dirty(struct inode *);static inline void mark_inode_dirty(struct inode *inode){	if (!(inode->i_state & I_DIRTY))		__mark_inode_dirty(inode);}struct fown_struct {	int pid;		/* pid or -pgrp where SIGIO should be sent */	uid_t uid, euid;	/* uid/euid of process setting the owner */	int signum;		/* posix.1b rt signal to be delivered on IO */};struct file {	struct file		*f_next, **f_pprev;	struct dentry		*f_dentry;	struct file_operations	*f_op;	mode_t			f_mode;	loff_t			f_pos;	unsigned int 		f_count, f_flags;	unsigned long 		f_reada, f_ramax, f_raend, f_ralen, f_rawin;	struct fown_struct	f_owner;	unsigned int		f_uid, f_gid;	int			f_error;	unsigned long		f_version;	/* needed for tty driver, and maybe others */	void			*private_data;#ifdef OSKIT_DEV	/*	 * Need a place to stash the inode since the device only stuff does	 * not use the buffer cache, and thats how the inode is now tracked.	 * (file->f_dentry->d_inode). 	 */	struct inode		*f_inode;#endif};extern int init_private_file(struct file *, struct dentry *, int);#define FL_POSIX	1#define FL_FLOCK	2#define FL_BROKEN	4	/* broken flock() emulation */#define FL_ACCESS	8	/* for processes suspended by mandatory locking */#define FL_LOCKD	16	/* lock held by rpc.lockd *//* * The POSIX file lock owner is determined by * the "struct files_struct" in the thread group * (or NULL for no owner - BSD locks). * * Lockd stuffs a "host" pointer into this. */typedef struct files_struct *fl_owner_t;struct file_lock {	struct file_lock *fl_next;	/* singly linked list for this inode  */	struct file_lock *fl_nextlink;	/* doubly linked list of all locks */	struct file_lock *fl_prevlink;	/* used to simplify lock removal */	struct file_lock *fl_nextblock; /* circular list of blocked processes */	struct file_lock *fl_prevblock;	fl_owner_t fl_owner;	unsigned int fl_pid;	struct wait_queue *fl_wait;	struct file *fl_file;	unsigned char fl_flags;	unsigned char fl_type;	off_t fl_start;	off_t fl_end;	void (*fl_notify)(struct file_lock *);	/* unblock callback */	union {#ifndef OSKIT		struct nfs_lock_info	nfs_fl;#endif	} fl_u;};extern struct file_lock			*file_lock_table;#include <linux/fcntl.h>extern int fcntl_getlk(unsigned int fd, struct flock *l);extern int fcntl_setlk(unsigned int fd, unsigned int cmd, struct flock *l);/* fs/locks.c */extern void locks_remove_posix(struct file *, fl_owner_t id);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 *, unsigned int);extern void posix_block_lock(struct file_lock *, struct file_lock *);extern void posix_unblock_lock(struct file_lock *);struct fasync_struct {	int    magic;	int    fa_fd;	struct fasync_struct	*fa_next; /* singly linked list */	struct file 		*fa_file;};#define FASYNC_MAGIC 0x4601extern int fasync_helper(int, struct file *, int, struct fasync_struct **);#ifndef OSKIT_DEV/* OSKIT_DEV doesn't need superblock stuff, might as well save compile time. */#include <linux/minix_fs_sb.h>#include <linux/ext2_fs_sb.h>#include <linux/hpfs_fs_sb.h>#include <linux/ntfs_fs_sb.h>#include <linux/msdos_fs_sb.h>#include <linux/iso_fs_sb.h>#ifdef OSKIT/* This is to prevent us from having to pull in a bunch of rpc crap. */struct nfs_sb_info {};#else#include <linux/nfs_fs_sb.h>#endif /* OSKIT */#include <linux/sysv_fs_sb.h>#include <linux/affs_fs_sb.h>#include <linux/ufs_fs_sb.h>#include <linux/efs_fs_sb.h>#include <linux/romfs_fs_sb.h>#include <linux/smb_fs_sb.h>#include <linux/hfs_fs_sb.h>#include <linux/adfs_fs_sb.h>#include <linux/qnx4_fs_sb.h>extern struct list_head super_blocks;#define sb_entry(list)	list_entry((list), struct super_block, s_list)struct super_block {	struct list_head	s_list;		/* Keep this first */	kdev_t			s_dev;	unsigned long		s_blocksize;	unsigned char		s_blocksize_bits;	unsigned char		s_lock;	unsigned char		s_rd_only;	unsigned char		s_dirt;	struct file_system_type	*s_type;	struct super_operations	*s_op;	struct dquot_operations	*dq_op;	unsigned long		s_flags;	unsigned long		s_magic;	unsigned long		s_time;	struct dentry		*s_root;	struct wait_queue	*s_wait;	struct inode		*s_ibasket;	short int		s_ibasket_count;	short int		s_ibasket_max;	struct list_head	s_dirty;	/* dirty inodes */	union {		struct minix_sb_info	minix_sb;		struct ext2_sb_info	ext2_sb;		struct hpfs_sb_info	hpfs_sb;		struct ntfs_sb_info     ntfs_sb;		struct msdos_sb_info	msdos_sb;		struct isofs_sb_info	isofs_sb;		struct nfs_sb_info	nfs_sb;		struct sysv_sb_info	sysv_sb;		struct affs_sb_info	affs_sb;		struct ufs_sb_info	ufs_sb;		struct efs_sb_info	efs_sb;		struct romfs_sb_info	romfs_sb;		struct smb_sb_info	smbfs_sb;		struct hfs_sb_info	hfs_sb;		struct adfs_sb_info	adfs_sb;		struct qnx4_sb_info	qnx4_sb;	   		void			*generic_sbp;	} u;	/*	 * 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 */};#endif /* OSKIT_DEV */#ifdef OSKIT_FS/* Make this helper function in super.c external. */int d_umount(struct super_block * sb);#endif/* * VFS helper functions.. */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 *);/* * 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, off_t, ino_t);	struct file_operations {	loff_t (*llseek) (struct file *, loff_t, int);	ssize_t (*read) (struct file *, char *, size_t, loff_t *);	ssize_t (*write) (struct file *, const char *, 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);	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 (*fasync) (int, struct file *, int);	int (*check_media_change) (kdev_t dev);	int (*revalidate) (kdev_t dev);	int (*lock) (struct file *, int, struct file_lock *);};struct inode_operations {	struct file_operations * default_file_ops;	int (*create) (struct inode *,struct dentry *,int);	struct dentry * (*lookup) (struct inode *,struct dentry *);	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,int);	int (*rename) (struct inode *, struct dentry *,			struct inode *, struct dentry *);	int (*readlink) (struct dentry *, char *,int);	struct dentry * (*follow_link) (struct dentry *, struct dentry *, unsigned int);	int (*readpage) (struct file *, struct page *);	int (*writepage) (struct file *, struct page *);	int (*bmap) (struct inode *,int);	void (*truncate) (struct inode *);	int (*permission) (struct inode *, int);	int (*smap) (struct inode *,int);	int (*updatepage) (struct file *, struct page *, unsigned long, unsigned int, int);	int (*revalidate) (struct dentry *);};struct super_operations {	void (*read_inode) (struct inode *);	void (*write_inode) (struct inode *);	void (*put_inode) (struct inode *);	void (*delete_inode) (struct inode *);	int (*notify_change) (struct dentry *, struct iattr *);	void (*put_super) (struct super_block *);	void (*write_super) (struct super_block *);	int (*statfs) (struct super_block *, struct statfs *, int);	int (*remount_fs) (struct super_block *, int *, char *);	void (*clear_inode) (struct inode *);	void (*umount_begin) (struct super_block *);};struct dquot_operations {	void (*initialize) (struct inode *, short);	void (*drop) (struct inode *);	int (*alloc_block) (const struct inode *, unsigned long, uid_t, char);	int (*alloc_inode) (const struct inode *, unsigned long, uid_t);	void (*free_block) (const struct inode *, unsigned long);	void (*free_inode) (const struct inode *, unsigned long);	int (*transfer) (struct dentry *, struct iattr *, uid_t);};struct file_system_type {	const char *name;	int fs_flags;	struct super_block *(*read_super) (struct super_block *, void *, int);	struct file_system_type * next;};extern int register_filesystem(struct file_system_type *);extern int unregister_filesystem(struct file_system_type *);/* Return value for VFS lock functions - tells locks.c to lock conventionally * REALLY kosha for root NFS and nfs_lock */ #define LOCK_USE_CLNT 1#define FLOCK_VERIFY_READ  1#define FLOCK_VERIFY_WRITE 2extern int locks_mandatory_locked(struct inode *inode);extern int locks_mandatory_area(int read_write, struct inode *inode,				struct file *filp, loff_t offset,				size_t count);/* This refers to the super_block, but we do not need this stuff anyway. */extern inline int locks_verify_locked(struct inode *inode){#ifndef OSKIT	/* Candidates for mandatory locking have the setgid bit set	 * but no group execute bit -  an otherwise meaningless combination.	 */	if (IS_MANDLOCK(inode) &&	    (inode->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID)		return (locks_mandatory_locked(inode));#endif	return (0);

⌨️ 快捷键说明

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