📄 ufs_fs.h
字号:
__u32 fs_bshift; /* ``lblkno'' calc of logical blkno */ __u32 fs_fshift; /* ``numfrags'' calc number of frags *//* these are configuration parameters */ __u32 fs_maxcontig; /* max number of contiguous blks */ __u32 fs_maxbpg; /* max number of blks per cyl group *//* these fields can be computed from the others */ __u32 fs_fragshift; /* block to frag shift */ __u32 fs_fsbtodb; /* fsbtodb and dbtofsb shift constant */ __u32 fs_sbsize; /* actual size of super block */ __u32 fs_csmask; /* csum block offset */ __u32 fs_csshift; /* csum block number */ __u32 fs_nindir; /* value of NINDIR */ __u32 fs_inopb; /* value of INOPB */ __u32 fs_nspf; /* value of NSPF *//* yet another configuration parameter */ __u32 fs_optim; /* optimization preference, see below *//* these fields are derived from the hardware */ union { struct { __u32 fs_npsect; /* # sectors/track including spares */ } fs_sun; struct { __s32 fs_state; /* file system state time stamp */ } fs_sunx86; } fs_u1; __u32 fs_interleave; /* hardware sector interleave */ __u32 fs_trackskew; /* sector 0 skew, per track *//* a unique id for this filesystem (currently unused and unmaintained) *//* In 4.3 Tahoe this space is used by fs_headswitch and fs_trkseek *//* Neither of those fields is used in the Tahoe code right now but *//* there could be problems if they are. */ __u32 fs_id[2]; /* file system id *//* sizes determined by number of cylinder groups and their sizes */ __u32 fs_csaddr; /* blk addr of cyl grp summary area */ __u32 fs_cssize; /* size of cyl grp summary area */ __u32 fs_cgsize; /* cylinder group size *//* these fields are derived from the hardware */ __u32 fs_ntrak; /* tracks per cylinder */ __u32 fs_nsect; /* sectors per track */ __u32 fs_spc; /* sectors per cylinder *//* this comes from the disk driver partitioning */ __u32 fs_ncyl; /* cylinders in file system *//* these fields can be computed from the others */ __u32 fs_cpg; /* cylinders per group */ __u32 fs_ipg; /* inodes per group */ __u32 fs_fpg; /* blocks per group * fs_frag *//* this data must be re-computed after crashes */ struct ufs_csum fs_cstotal; /* cylinder summary information *//* these fields are cleared at mount time */ __s8 fs_fmod; /* super block modified flag */ __s8 fs_clean; /* file system is clean flag */ __s8 fs_ronly; /* mounted read-only flag */ __s8 fs_flags; /* currently unused flag */ __s8 fs_fsmnt[UFS_MAXMNTLEN]; /* name mounted on *//* these fields retain the current block allocation info */ __u32 fs_cgrotor; /* last cg searched */ __u32 fs_csp[UFS_MAXCSBUFS]; /* list of fs_cs info buffers */ __u32 fs_maxcluster; __u32 fs_cpc; /* cyl per cycle in postbl */ __u16 fs_opostbl[16][8]; /* old rotation block list head */ union { struct { __s32 fs_sparecon[53];/* reserved for future constants */ __s32 fs_reclaim; __s32 fs_sparecon2[1]; __s32 fs_state; /* file system state time stamp */ __u32 fs_qbmask[2]; /* ~usb_bmask */ __u32 fs_qfmask[2]; /* ~usb_fmask */ } fs_sun; struct { __s32 fs_sparecon[53];/* reserved for future constants */ __s32 fs_reclaim; __s32 fs_sparecon2[1]; __u32 fs_npsect; /* # sectors/track including spares */ __u32 fs_qbmask[2]; /* ~usb_bmask */ __u32 fs_qfmask[2]; /* ~usb_fmask */ } fs_sunx86; struct { __s32 fs_sparecon[50];/* reserved for future constants */ __s32 fs_contigsumsize;/* size of cluster summary array */ __s32 fs_maxsymlinklen;/* max length of an internal symlink */ __s32 fs_inodefmt; /* format of on-disk inodes */ __u32 fs_maxfilesize[2]; /* max representable file size */ __u32 fs_qbmask[2]; /* ~usb_bmask */ __u32 fs_qfmask[2]; /* ~usb_fmask */ __s32 fs_state; /* file system state time stamp */ } fs_44; } fs_u2; __s32 fs_postblformat; /* format of positional layout tables */ __s32 fs_nrpos; /* number of rotational positions */ __s32 fs_postbloff; /* (__s16) rotation block list head */ __s32 fs_rotbloff; /* (__u8) blocks for each rotation */ __s32 fs_magic; /* magic number */ __u8 fs_space[1]; /* list of blocks for each rotation */};/* * Preference for optimization. */#define UFS_OPTTIME 0 /* minimize allocation time */#define UFS_OPTSPACE 1 /* minimize disk fragmentation *//* * Rotational layout table format types */#define UFS_42POSTBLFMT -1 /* 4.2BSD rotational table format */#define UFS_DYNAMICPOSTBLFMT 1 /* dynamic rotational table format *//* * Convert cylinder group to base address of its global summary info. */#define fs_cs(indx) \ u.ufs_sb.s_csp[(indx) >> uspi->s_csshift][(indx) & ~uspi->s_csmask]/* * Cylinder group block for a file system. * * Writable fields in the cylinder group are protected by the associated * super block lock fs->fs_lock. */#define CG_MAGIC 0x090255#define ufs_cg_chkmagic(sb, ucg) \ (fs32_to_cpu((sb), (ucg)->cg_magic) == CG_MAGIC)/* * size of this structure is 172 B */struct ufs_cylinder_group { __u32 cg_link; /* linked list of cyl groups */ __u32 cg_magic; /* magic number */ __u32 cg_time; /* time last written */ __u32 cg_cgx; /* we are the cgx'th cylinder group */ __u16 cg_ncyl; /* number of cyl's this cg */ __u16 cg_niblk; /* number of inode blocks this cg */ __u32 cg_ndblk; /* number of data blocks this cg */ struct ufs_csum cg_cs; /* cylinder summary information */ __u32 cg_rotor; /* position of last used block */ __u32 cg_frotor; /* position of last used frag */ __u32 cg_irotor; /* position of last used inode */ __u32 cg_frsum[UFS_MAXFRAG]; /* counts of available frags */ __u32 cg_btotoff; /* (__u32) block totals per cylinder */ __u32 cg_boff; /* (short) free block positions */ __u32 cg_iusedoff; /* (char) used inode map */ __u32 cg_freeoff; /* (u_char) free block map */ __u32 cg_nextfreeoff; /* (u_char) next available space */ union { struct { __u32 cg_clustersumoff; /* (u_int32) counts of avail clusters */ __u32 cg_clusteroff; /* (u_int8) free cluster map */ __u32 cg_nclusterblks; /* number of clusters this cg */ __u32 cg_sparecon[13]; /* reserved for future use */ } cg_44; __u32 cg_sparecon[16]; /* reserved for future use */ } cg_u; __u8 cg_space[1]; /* space for cylinder group maps *//* actually longer */};/* * structure of an on-disk inode */struct ufs_inode { __u16 ui_mode; /* 0x0 */ __u16 ui_nlink; /* 0x2 */ union { struct { __u16 ui_suid; /* 0x4 */ __u16 ui_sgid; /* 0x6 */ } oldids; __u32 ui_inumber; /* 0x4 lsf: inode number */ __u32 ui_author; /* 0x4 GNU HURD: author */ } ui_u1; __u64 ui_size; /* 0x8 */ struct ufs_timeval ui_atime; /* 0x10 access */ struct ufs_timeval ui_mtime; /* 0x18 modification */ struct ufs_timeval ui_ctime; /* 0x20 creation */ union { struct { __u32 ui_db[UFS_NDADDR];/* 0x28 data blocks */ __u32 ui_ib[UFS_NINDIR];/* 0x58 indirect blocks */ } ui_addr; __u8 ui_symlink[4*(UFS_NDADDR+UFS_NINDIR)];/* 0x28 fast symlink */ } ui_u2; __u32 ui_flags; /* 0x64 immutable, append-only... */ __u32 ui_blocks; /* 0x68 blocks in use */ __u32 ui_gen; /* 0x6c like ext2 i_version, for NFS support */ union { struct { __u32 ui_shadow; /* 0x70 shadow inode with security data */ __u32 ui_uid; /* 0x74 long EFT version of uid */ __u32 ui_gid; /* 0x78 long EFT version of gid */ __u32 ui_oeftflag; /* 0x7c reserved */ } ui_sun; struct { __u32 ui_uid; /* 0x70 File owner */ __u32 ui_gid; /* 0x74 File group */ __s32 ui_spare[2]; /* 0x78 reserved */ } ui_44; struct { __u32 ui_uid; /* 0x70 */ __u32 ui_gid; /* 0x74 */ __u16 ui_modeh; /* 0x78 mode high bits */ __u16 ui_spare; /* 0x7A unused */ __u32 ui_trans; /* 0x7c filesystem translator */ } ui_hurd; } ui_u3;};/* FreeBSD has these in sys/stat.h *//* ui_flags that can be set by a file owner */#define UFS_UF_SETTABLE 0x0000ffff#define UFS_UF_NODUMP 0x00000001 /* do not dump */#define UFS_UF_IMMUTABLE 0x00000002 /* immutable (can't "change") */#define UFS_UF_APPEND 0x00000004 /* append-only */#define UFS_UF_OPAQUE 0x00000008 /* directory is opaque (unionfs) */#define UFS_UF_NOUNLINK 0x00000010 /* can't be removed or renamed *//* ui_flags that only root can set */#define UFS_SF_SETTABLE 0xffff0000#define UFS_SF_ARCHIVED 0x00010000 /* archived */#define UFS_SF_IMMUTABLE 0x00020000 /* immutable (can't "change") */#define UFS_SF_APPEND 0x00040000 /* append-only */#define UFS_SF_NOUNLINK 0x00100000 /* can't be removed or renamed */#ifdef __KERNEL__/* balloc.c */extern void ufs_free_fragments (struct inode *, unsigned, unsigned);extern void ufs_free_blocks (struct inode *, unsigned, unsigned);extern unsigned ufs_new_fragments (struct inode *, u32 *, unsigned, unsigned, unsigned, int *);/* cylinder.c */extern struct ufs_cg_private_info * ufs_load_cylinder (struct super_block *, unsigned);extern void ufs_put_cylinder (struct super_block *, unsigned);/* dir.c */extern struct inode_operations ufs_dir_inode_operations;extern int ufs_check_dir_entry (const char *, struct inode *, struct ufs_dir_entry *, struct buffer_head *, unsigned long);extern int ufs_add_link (struct dentry *, struct inode *);extern ino_t ufs_inode_by_name(struct inode *, struct dentry *);extern int ufs_make_empty(struct inode *, struct inode *);extern struct ufs_dir_entry * ufs_find_entry (struct dentry *, struct buffer_head **);extern int ufs_delete_entry (struct inode *, struct ufs_dir_entry *, struct buffer_head *);extern int ufs_empty_dir (struct inode *);extern struct ufs_dir_entry * ufs_dotdot (struct inode *, struct buffer_head **);extern void ufs_set_link(struct inode *, struct ufs_dir_entry *, struct buffer_head *, struct inode *);/* file.c */extern struct inode_operations ufs_file_inode_operations;extern struct file_operations ufs_file_operations;extern struct address_space_operations ufs_aops;/* ialloc.c */extern void ufs_free_inode (struct inode *inode);extern struct inode * ufs_new_inode (const struct inode *, int);/* inode.c */extern int ufs_frag_map (struct inode *, int);extern void ufs_read_inode (struct inode *);extern void ufs_put_inode (struct inode *);extern void ufs_write_inode (struct inode *, int);extern int ufs_sync_inode (struct inode *);extern void ufs_delete_inode (struct inode *);extern struct buffer_head * ufs_getfrag (struct inode *, unsigned, int, int *);extern struct buffer_head * ufs_bread (struct inode *, unsigned, int, int *);/* namei.c */extern struct file_operations ufs_dir_operations; /* super.c */extern struct file_system_type ufs_fs_type;extern void ufs_warning (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4)));extern void ufs_error (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4)));extern void ufs_panic (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4)));extern void ufs_write_super (struct super_block *);/* symlink.c */extern struct inode_operations ufs_fast_symlink_inode_operations;/* truncate.c */extern void ufs_truncate (struct inode *);#endif /* __KERNEL__ */#endif /* __LINUX_UFS_FS_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -