ext2fs: use of tab vs spaces.
Consistently use a single tab after a #define as mentioned in style(9). Use tabs instead of space for indenting. Fix a typo: "hash_vesion". No functional change. MFC after: 3 days
This commit is contained in:
parent
059400366e
commit
3a54024da4
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=262623
@ -122,7 +122,7 @@ ext2_alloc(struct inode *ip, daddr_t lbn, e4fs_daddr_t bpref, int size,
|
||||
ip->i_flag |= IN_CHANGE | IN_UPDATE;
|
||||
*bnp = bno;
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
nospace:
|
||||
EXT2_UNLOCK(ump);
|
||||
ext2_fserr(fs, cred->cr_uid, "filesystem full");
|
||||
@ -397,11 +397,11 @@ ext2_valloc(struct vnode *pvp, int mode, struct ucred *cred, struct vnode **vpp)
|
||||
ip->i_blocks = 0;
|
||||
ip->i_mode = 0;
|
||||
ip->i_flags = 0;
|
||||
/* now we want to make sure that the block pointers are zeroed out */
|
||||
for (i = 0; i < NDADDR; i++)
|
||||
ip->i_db[i] = 0;
|
||||
for (i = 0; i < NIADDR; i++)
|
||||
ip->i_ib[i] = 0;
|
||||
/* now we want to make sure that the block pointers are zeroed out */
|
||||
for (i = 0; i < NDADDR; i++)
|
||||
ip->i_db[i] = 0;
|
||||
for (i = 0; i < NIADDR; i++)
|
||||
ip->i_ib[i] = 0;
|
||||
|
||||
/*
|
||||
* Set up a new generation number for this inode.
|
||||
@ -443,7 +443,7 @@ static u_long
|
||||
ext2_dirpref(struct inode *pip)
|
||||
{
|
||||
struct m_ext2fs *fs;
|
||||
int cg, prefcg, dirsize, cgsize;
|
||||
int cg, prefcg, dirsize, cgsize;
|
||||
u_int avgifree, avgbfree, avgndir, curdirsize;
|
||||
u_int minifree, minbfree, maxndir;
|
||||
u_int mincg, minndir;
|
||||
@ -452,7 +452,7 @@ ext2_dirpref(struct inode *pip)
|
||||
mtx_assert(EXT2_MTX(pip->i_ump), MA_OWNED);
|
||||
fs = pip->i_e2fs;
|
||||
|
||||
avgifree = fs->e2fs->e2fs_ficount / fs->e2fs_gcount;
|
||||
avgifree = fs->e2fs->e2fs_ficount / fs->e2fs_gcount;
|
||||
avgbfree = fs->e2fs->e2fs_fbcount / fs->e2fs_gcount;
|
||||
avgndir = fs->e2fs_total_dir / fs->e2fs_gcount;
|
||||
|
||||
@ -473,11 +473,11 @@ ext2_dirpref(struct inode *pip)
|
||||
}
|
||||
for (cg = 0; cg < prefcg; cg++)
|
||||
if (fs->e2fs_gd[cg].ext2bgd_ndirs < minndir &&
|
||||
fs->e2fs_gd[cg].ext2bgd_nifree >= avgifree &&
|
||||
fs->e2fs_gd[cg].ext2bgd_nbfree >= avgbfree) {
|
||||
mincg = cg;
|
||||
minndir = fs->e2fs_gd[cg].ext2bgd_ndirs;
|
||||
}
|
||||
fs->e2fs_gd[cg].ext2bgd_nifree >= avgifree &&
|
||||
fs->e2fs_gd[cg].ext2bgd_nbfree >= avgbfree) {
|
||||
mincg = cg;
|
||||
minndir = fs->e2fs_gd[cg].ext2bgd_ndirs;
|
||||
}
|
||||
|
||||
return (mincg);
|
||||
}
|
||||
@ -515,14 +515,14 @@ ext2_dirpref(struct inode *pip)
|
||||
for (cg = prefcg; cg < fs->e2fs_gcount; cg++)
|
||||
if (fs->e2fs_gd[cg].ext2bgd_ndirs < maxndir &&
|
||||
fs->e2fs_gd[cg].ext2bgd_nifree >= minifree &&
|
||||
fs->e2fs_gd[cg].ext2bgd_nbfree >= minbfree) {
|
||||
fs->e2fs_gd[cg].ext2bgd_nbfree >= minbfree) {
|
||||
if (fs->e2fs_contigdirs[cg] < maxcontigdirs)
|
||||
return (cg);
|
||||
}
|
||||
for (cg = 0; cg < prefcg; cg++)
|
||||
if (fs->e2fs_gd[cg].ext2bgd_ndirs < maxndir &&
|
||||
fs->e2fs_gd[cg].ext2bgd_nifree >= minifree &&
|
||||
fs->e2fs_gd[cg].ext2bgd_nbfree >= minbfree) {
|
||||
fs->e2fs_gd[cg].ext2bgd_nbfree >= minbfree) {
|
||||
if (fs->e2fs_contigdirs[cg] < maxcontigdirs)
|
||||
return (cg);
|
||||
}
|
||||
@ -567,8 +567,8 @@ ext2_blkpref(struct inode *ip, e2fs_lbn_t lbn, int indx, e2fs_daddr_t *bap,
|
||||
/* now check whether we were provided with an array that basically
|
||||
tells us previous blocks to which we want to stay closeby
|
||||
*/
|
||||
if (bap)
|
||||
for (tmp = indx - 1; tmp >= 0; tmp--)
|
||||
if (bap)
|
||||
for (tmp = indx - 1; tmp >= 0; tmp--)
|
||||
if (bap[tmp])
|
||||
return bap[tmp];
|
||||
|
||||
@ -968,33 +968,33 @@ ext2_blkfree(struct inode *ip, e4fs_daddr_t bno, long size)
|
||||
ump = ip->i_ump;
|
||||
cg = dtog(fs, bno);
|
||||
if ((u_int)bno >= fs->e2fs->e2fs_bcount) {
|
||||
printf("bad block %lld, ino %llu\n", (long long)bno,
|
||||
(unsigned long long)ip->i_number);
|
||||
ext2_fserr(fs, ip->i_uid, "bad block");
|
||||
return;
|
||||
}
|
||||
error = bread(ip->i_devvp,
|
||||
fsbtodb(fs, fs->e2fs_gd[cg].ext2bgd_b_bitmap),
|
||||
(int)fs->e2fs_bsize, NOCRED, &bp);
|
||||
if (error) {
|
||||
brelse(bp);
|
||||
return;
|
||||
}
|
||||
bbp = (char *)bp->b_data;
|
||||
bno = dtogd(fs, bno);
|
||||
if (isclr(bbp, bno)) {
|
||||
printf("block = %lld, fs = %s\n",
|
||||
(long long)bno, fs->e2fs_fsmnt);
|
||||
panic("ext2_blkfree: freeing free block");
|
||||
}
|
||||
clrbit(bbp, bno);
|
||||
printf("bad block %lld, ino %llu\n", (long long)bno,
|
||||
(unsigned long long)ip->i_number);
|
||||
ext2_fserr(fs, ip->i_uid, "bad block");
|
||||
return;
|
||||
}
|
||||
error = bread(ip->i_devvp,
|
||||
fsbtodb(fs, fs->e2fs_gd[cg].ext2bgd_b_bitmap),
|
||||
(int)fs->e2fs_bsize, NOCRED, &bp);
|
||||
if (error) {
|
||||
brelse(bp);
|
||||
return;
|
||||
}
|
||||
bbp = (char *)bp->b_data;
|
||||
bno = dtogd(fs, bno);
|
||||
if (isclr(bbp, bno)) {
|
||||
printf("block = %lld, fs = %s\n",
|
||||
(long long)bno, fs->e2fs_fsmnt);
|
||||
panic("ext2_blkfree: freeing free block");
|
||||
}
|
||||
clrbit(bbp, bno);
|
||||
EXT2_LOCK(ump);
|
||||
ext2_clusteracct(fs, bbp, cg, bno, 1);
|
||||
fs->e2fs->e2fs_fbcount++;
|
||||
fs->e2fs_gd[cg].ext2bgd_nbfree++;
|
||||
fs->e2fs_fmod = 1;
|
||||
fs->e2fs->e2fs_fbcount++;
|
||||
fs->e2fs_gd[cg].ext2bgd_nbfree++;
|
||||
fs->e2fs_fmod = 1;
|
||||
EXT2_UNLOCK(ump);
|
||||
bdwrite(bp);
|
||||
bdwrite(bp);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1100,14 +1100,14 @@ ext2_fserr(struct m_ext2fs *fs, uid_t uid, char *cp)
|
||||
int
|
||||
cg_has_sb(int i)
|
||||
{
|
||||
int a3, a5, a7;
|
||||
int a3, a5, a7;
|
||||
|
||||
if (i == 0 || i == 1)
|
||||
return 1;
|
||||
for (a3 = 3, a5 = 5, a7 = 7;
|
||||
a3 <= i || a5 <= i || a7 <= i;
|
||||
a3 *= 3, a5 *= 5, a7 *= 7)
|
||||
if (i == a3 || i == a5 || i == a7)
|
||||
return 1;
|
||||
return 0;
|
||||
if (i == 0 || i == 1)
|
||||
return 1;
|
||||
for (a3 = 3, a5 = 5, a7 = 7;
|
||||
a3 <= i || a5 <= i || a7 <= i;
|
||||
a3 *= 3, a5 *= 5, a7 *= 7)
|
||||
if (i == a3 || i == a5 || i == a7)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ ext2_balloc(struct inode *ip, e2fs_lbn_t lbn, int size, struct ucred *cred,
|
||||
* If so, increment next_alloc fields to allow ext2_blkpref
|
||||
* to make a good guess
|
||||
*/
|
||||
if (lbn == ip->i_next_alloc_block + 1) {
|
||||
if (lbn == ip->i_next_alloc_block + 1) {
|
||||
ip->i_next_alloc_block++;
|
||||
ip->i_next_alloc_goal++;
|
||||
}
|
||||
@ -167,7 +167,7 @@ ext2_balloc(struct inode *ip, e2fs_lbn_t lbn, int size, struct ucred *cred,
|
||||
EXT2_LOCK(ump);
|
||||
pref = ext2_blkpref(ip, lbn, indirs[0].in_off +
|
||||
EXT2_NDIR_BLOCKS, &ip->i_db[0], 0);
|
||||
if ((error = ext2_alloc(ip, lbn, pref, fs->e2fs_bsize, cred,
|
||||
if ((error = ext2_alloc(ip, lbn, pref, fs->e2fs_bsize, cred,
|
||||
&newb)))
|
||||
return (error);
|
||||
nb = newb;
|
||||
|
@ -27,7 +27,7 @@
|
||||
*/
|
||||
|
||||
#ifndef _FS_EXT2FS_EXT2_DINODE_H_
|
||||
#define _FS_EXT2FS_EXT2_DINODE_H_
|
||||
#define _FS_EXT2FS_EXT2_DINODE_H_
|
||||
|
||||
/*
|
||||
* Special inode numbers
|
||||
@ -55,35 +55,35 @@
|
||||
* EXT4_HUGE_FILE with some restrictions, imposed the lack of write
|
||||
* support.
|
||||
*/
|
||||
#define EXT2_SECRM 0x00000001 /* Secure deletion */
|
||||
#define EXT2_UNRM 0x00000002 /* Undelete */
|
||||
#define EXT2_COMPR 0x00000004 /* Compress file */
|
||||
#define EXT2_SYNC 0x00000008 /* Synchronous updates */
|
||||
#define EXT2_IMMUTABLE 0x00000010 /* Immutable file */
|
||||
#define EXT2_APPEND 0x00000020 /* Writes to file may only append */
|
||||
#define EXT2_NODUMP 0x00000040 /* Do not dump file */
|
||||
#define EXT2_NOATIME 0x00000080 /* Do not update atime */
|
||||
#define EXT4_INDEX 0x00001000 /* Hash-indexed directory */
|
||||
#define EXT4_IMAGIC 0x00002000 /* AFS directory */
|
||||
#define EXT4_JOURNAL_DATA 0x00004000 /* File data should be journaled */
|
||||
#define EXT4_NOTAIL 0x00008000 /* File tail should not be merged */
|
||||
#define EXT4_DIRSYNC 0x00010000 /* Dirsync behaviour */
|
||||
#define EXT4_TOPDIR 0x00020000 /* Top of directory hierarchies*/
|
||||
#define EXT4_HUGE_FILE 0x00040000 /* Set to each huge file */
|
||||
#define EXT4_EXTENTS 0x00080000 /* Inode uses extents */
|
||||
#define EXT4_EOFBLOCKS 0x00400000 /* Blocks allocated beyond EOF */
|
||||
#define EXT2_SECRM 0x00000001 /* Secure deletion */
|
||||
#define EXT2_UNRM 0x00000002 /* Undelete */
|
||||
#define EXT2_COMPR 0x00000004 /* Compress file */
|
||||
#define EXT2_SYNC 0x00000008 /* Synchronous updates */
|
||||
#define EXT2_IMMUTABLE 0x00000010 /* Immutable file */
|
||||
#define EXT2_APPEND 0x00000020 /* Writes to file may only append */
|
||||
#define EXT2_NODUMP 0x00000040 /* Do not dump file */
|
||||
#define EXT2_NOATIME 0x00000080 /* Do not update atime */
|
||||
#define EXT4_INDEX 0x00001000 /* Hash-indexed directory */
|
||||
#define EXT4_IMAGIC 0x00002000 /* AFS directory */
|
||||
#define EXT4_JOURNAL_DATA 0x00004000 /* File data should be journaled */
|
||||
#define EXT4_NOTAIL 0x00008000 /* File tail should not be merged */
|
||||
#define EXT4_DIRSYNC 0x00010000 /* Dirsync behaviour */
|
||||
#define EXT4_TOPDIR 0x00020000 /* Top of directory hierarchies*/
|
||||
#define EXT4_HUGE_FILE 0x00040000 /* Set to each huge file */
|
||||
#define EXT4_EXTENTS 0x00080000 /* Inode uses extents */
|
||||
#define EXT4_EOFBLOCKS 0x00400000 /* Blocks allocated beyond EOF */
|
||||
|
||||
/*
|
||||
* Definitions for nanosecond timestamps.
|
||||
* Ext3 inode versioning, 2006-12-13.
|
||||
*/
|
||||
#define EXT3_EPOCH_BITS 2
|
||||
#define EXT3_EPOCH_MASK ((1 << EXT3_EPOCH_BITS) - 1)
|
||||
#define EXT3_NSEC_MASK (~0UL << EXT3_EPOCH_BITS)
|
||||
#define EXT3_EPOCH_BITS 2
|
||||
#define EXT3_EPOCH_MASK ((1 << EXT3_EPOCH_BITS) - 1)
|
||||
#define EXT3_NSEC_MASK (~0UL << EXT3_EPOCH_BITS)
|
||||
|
||||
#define E2DI_HAS_XTIME(ip) (EXT2_HAS_RO_COMPAT_FEATURE(ip->i_e2fs, \
|
||||
#define E2DI_HAS_XTIME(ip) (EXT2_HAS_RO_COMPAT_FEATURE(ip->i_e2fs, \
|
||||
EXT2F_ROCOMPAT_EXTRA_ISIZE))
|
||||
#define E2DI_HAS_HUGE_FILE(ip) (EXT2_HAS_RO_COMPAT_FEATURE(ip->i_e2fs, \
|
||||
#define E2DI_HAS_HUGE_FILE(ip) (EXT2_HAS_RO_COMPAT_FEATURE(ip->i_e2fs, \
|
||||
EXT2F_ROCOMPAT_HUGE_FILE))
|
||||
|
||||
/*
|
||||
@ -94,7 +94,7 @@
|
||||
#define EXT2_DIND_BLOCK (EXT2_IND_BLOCK + 1)
|
||||
#define EXT2_TIND_BLOCK (EXT2_DIND_BLOCK + 1)
|
||||
#define EXT2_N_BLOCKS (EXT2_TIND_BLOCK + 1)
|
||||
#define EXT2_MAXSYMLINKLEN (EXT2_N_BLOCKS * sizeof(uint32_t))
|
||||
#define EXT2_MAXSYMLINKLEN (EXT2_N_BLOCKS * sizeof(uint32_t))
|
||||
|
||||
/*
|
||||
* Structure of an inode on the disk
|
||||
@ -121,16 +121,16 @@ struct ext2fs_dinode {
|
||||
uint16_t e2di_facl_high; /* 118: File EA bits 47:32 */
|
||||
uint16_t e2di_uid_high; /* 120: Owner UID top 16 bits */
|
||||
uint16_t e2di_gid_high; /* 122: Owner GID top 16 bits */
|
||||
uint16_t e2di_chksum_lo; /* 124: Lower inode checksum */
|
||||
uint16_t e2di_chksum_lo; /* 124: Lower inode checksum */
|
||||
uint16_t e2di_lx_reserved; /* 126: Unused */
|
||||
uint16_t e2di_extra_isize; /* 128: Size of this inode */
|
||||
uint16_t e2di_chksum_hi; /* 130: High inode checksum */
|
||||
uint32_t e2di_ctime_extra; /* 132: Extra change time */
|
||||
uint32_t e2di_mtime_extra; /* 136: Extra modification time */
|
||||
uint32_t e2di_atime_extra; /* 140: Extra access time */
|
||||
uint32_t e2di_crtime; /* 144: Creation (birth)time */
|
||||
uint32_t e2di_crtime_extra; /* 148: Extra creation (birth)time */
|
||||
uint32_t e2di_version_hi; /* 152: High bits of inode version */
|
||||
uint32_t e2di_ctime_extra; /* 132: Extra change time */
|
||||
uint32_t e2di_mtime_extra; /* 136: Extra modification time */
|
||||
uint32_t e2di_atime_extra; /* 140: Extra access time */
|
||||
uint32_t e2di_crtime; /* 144: Creation (birth)time */
|
||||
uint32_t e2di_crtime_extra; /* 148: Extra creation (birth)time */
|
||||
uint32_t e2di_version_hi; /* 152: High bits of inode version */
|
||||
};
|
||||
|
||||
#endif /* !_FS_EXT2FS_EXT2_DINODE_H_ */
|
||||
|
@ -27,12 +27,12 @@
|
||||
*/
|
||||
|
||||
#ifndef _FS_EXT2FS_EXT2_DIR_H_
|
||||
#define _FS_EXT2FS_EXT2_DIR_H_
|
||||
#define _FS_EXT2FS_EXT2_DIR_H_
|
||||
|
||||
/*
|
||||
* Structure of a directory entry
|
||||
*/
|
||||
#define EXT2FS_MAXNAMLEN 255
|
||||
#define EXT2FS_MAXNAMLEN 255
|
||||
|
||||
struct ext2fs_direct {
|
||||
uint32_t e2d_ino; /* inode number of entry */
|
||||
@ -72,31 +72,30 @@ struct ext2fs_direct_2 {
|
||||
/*
|
||||
* Maximal count of links to a file
|
||||
*/
|
||||
#define EXT2_LINK_MAX 32000
|
||||
#define EXT2_LINK_MAX 32000
|
||||
|
||||
/*
|
||||
* Ext2 directory file types. Only the low 3 bits are used. The
|
||||
* other bits are reserved for now.
|
||||
*/
|
||||
#define EXT2_FT_UNKNOWN 0
|
||||
#define EXT2_FT_REG_FILE 1
|
||||
#define EXT2_FT_DIR 2
|
||||
#define EXT2_FT_CHRDEV 3
|
||||
#define EXT2_FT_BLKDEV 4
|
||||
#define EXT2_FT_FIFO 5
|
||||
#define EXT2_FT_SOCK 6
|
||||
#define EXT2_FT_SYMLINK 7
|
||||
|
||||
#define EXT2_FT_MAX 8
|
||||
#define EXT2_FT_UNKNOWN 0
|
||||
#define EXT2_FT_REG_FILE 1
|
||||
#define EXT2_FT_DIR 2
|
||||
#define EXT2_FT_CHRDEV 3
|
||||
#define EXT2_FT_BLKDEV 4
|
||||
#define EXT2_FT_FIFO 5
|
||||
#define EXT2_FT_SOCK 6
|
||||
#define EXT2_FT_SYMLINK 7
|
||||
#define EXT2_FT_MAX 8
|
||||
|
||||
/*
|
||||
* EXT2_DIR_PAD defines the directory entries boundaries
|
||||
*
|
||||
* NOTE: It must be a multiple of 4
|
||||
*/
|
||||
#define EXT2_DIR_PAD 4
|
||||
#define EXT2_DIR_ROUND (EXT2_DIR_PAD - 1)
|
||||
#define EXT2_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT2_DIR_ROUND) & \
|
||||
#define EXT2_DIR_PAD 4
|
||||
#define EXT2_DIR_ROUND (EXT2_DIR_PAD - 1)
|
||||
#define EXT2_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT2_DIR_ROUND) & \
|
||||
~EXT2_DIR_ROUND)
|
||||
#endif /* !_FS_EXT2FS_EXT2_DIR_H_ */
|
||||
|
||||
|
@ -26,15 +26,15 @@
|
||||
* $FreeBSD$
|
||||
*/
|
||||
#ifndef _FS_EXT2FS_EXT2_EXTENTS_H_
|
||||
#define _FS_EXT2FS_EXT2_EXTENTS_H_
|
||||
#define _FS_EXT2FS_EXT2_EXTENTS_H_
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#define EXT4_EXT_MAGIC 0xf30a
|
||||
#define EXT4_EXT_MAGIC 0xf30a
|
||||
|
||||
#define EXT4_EXT_CACHE_NO 0
|
||||
#define EXT4_EXT_CACHE_GAP 1
|
||||
#define EXT4_EXT_CACHE_IN 2
|
||||
#define EXT4_EXT_CACHE_NO 0
|
||||
#define EXT4_EXT_CACHE_GAP 1
|
||||
#define EXT4_EXT_CACHE_IN 2
|
||||
|
||||
/*
|
||||
* Ext4 file system extent on disk.
|
||||
|
@ -72,8 +72,8 @@ int ext2_update(struct vnode *, int);
|
||||
int ext2_valloc(struct vnode *, int, struct ucred *, struct vnode **);
|
||||
int ext2_vfree(struct vnode *, ino_t, int);
|
||||
int ext2_vinit(struct mount *, struct vop_vector *, struct vnode **vpp);
|
||||
int ext2_lookup(struct vop_cachedlookup_args *);
|
||||
int ext2_readdir(struct vop_readdir_args *);
|
||||
int ext2_lookup(struct vop_cachedlookup_args *);
|
||||
int ext2_readdir(struct vop_readdir_args *);
|
||||
void ext2_print_inode(struct inode *);
|
||||
int ext2_direnter(struct inode *,
|
||||
struct vnode *, struct componentname *);
|
||||
|
@ -60,7 +60,7 @@ static int ext2_htree_check_next(struct inode *ip, uint32_t hash,
|
||||
const char *name, struct ext2fs_htree_lookup_info *info);
|
||||
static int ext2_htree_cmp_sort_entry(const void *e1, const void *e2);
|
||||
static int ext2_htree_find_leaf(struct inode *ip, const char *name,
|
||||
int namelen, uint32_t *hash, uint8_t *hash_verion,
|
||||
int namelen, uint32_t *hash, uint8_t *hash_version,
|
||||
struct ext2fs_htree_lookup_info *info);
|
||||
static uint32_t ext2_htree_get_block(struct ext2fs_htree_entry *ep);
|
||||
static uint16_t ext2_htree_get_count(struct ext2fs_htree_entry *ep);
|
||||
|
@ -248,7 +248,7 @@ ext2_truncate(struct vnode *vp, off_t length, int flags, struct ucred *cred,
|
||||
if (error && (allerror == 0))
|
||||
allerror = error;
|
||||
vnode_pager_setsize(ovp, length);
|
||||
|
||||
|
||||
/*
|
||||
* Indirect blocks first.
|
||||
*/
|
||||
|
@ -82,7 +82,7 @@ ext2_print_inode(struct inode *in)
|
||||
void
|
||||
ext2_ei2i(struct ext2fs_dinode *ei, struct inode *ip)
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
|
||||
ip->i_nlink = ei->e2di_nlink;
|
||||
/* Godmar thinks - if the link count is zero, then the inode is
|
||||
|
@ -805,7 +805,7 @@ ext2_dirbad(struct inode *ip, doff_t offset, char *how)
|
||||
mp->mnt_stat.f_mntonname, (u_long)ip->i_number,(long)offset, how);
|
||||
else
|
||||
(void)printf("%s: bad dir ino %lu at offset %ld: %s\n",
|
||||
mp->mnt_stat.f_mntonname, (u_long)ip->i_number, (long)offset, how);
|
||||
mp->mnt_stat.f_mntonname, (u_long)ip->i_number, (long)offset, how);
|
||||
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
||||
*/
|
||||
|
||||
#ifndef _FS_EXT2FS_EXT2_MOUNT_H_
|
||||
#define _FS_EXT2FS_EXT2_MOUNT_H_
|
||||
#define _FS_EXT2FS_EXT2_MOUNT_H_
|
||||
|
||||
#ifdef _KERNEL
|
||||
|
||||
@ -59,18 +59,18 @@ struct ext2mount {
|
||||
struct bufobj *um_bo;
|
||||
};
|
||||
|
||||
#define EXT2_LOCK(aa) mtx_lock(&(aa)->um_lock)
|
||||
#define EXT2_UNLOCK(aa) mtx_unlock(&(aa)->um_lock)
|
||||
#define EXT2_MTX(aa) (&(aa)->um_lock)
|
||||
#define EXT2_LOCK(aa) mtx_lock(&(aa)->um_lock)
|
||||
#define EXT2_UNLOCK(aa) mtx_unlock(&(aa)->um_lock)
|
||||
#define EXT2_MTX(aa) (&(aa)->um_lock)
|
||||
|
||||
/* Convert mount ptr to ext2fsmount ptr. */
|
||||
#define VFSTOEXT2(mp) ((struct ext2mount *)((mp)->mnt_data))
|
||||
#define VFSTOEXT2(mp) ((struct ext2mount *)((mp)->mnt_data))
|
||||
|
||||
/*
|
||||
* Macros to access file system parameters in the ufsmount structure.
|
||||
* Used by ufs_bmap.
|
||||
*/
|
||||
#define MNINDIR(ump) ((ump)->um_nindir)
|
||||
#define MNINDIR(ump) ((ump)->um_nindir)
|
||||
#define blkptrtodb(ump, b) ((b) << (ump)->um_bptrtodb)
|
||||
#define is_sequential(ump, a, b) ((b) == (a) + ump->um_seqinc)
|
||||
#endif /* _KERNEL */
|
||||
|
@ -674,7 +674,7 @@ ext2_mountfs(struct vnode *devvp, struct mount *mp)
|
||||
* Initialize filesystem stat information in mount struct.
|
||||
*/
|
||||
MNT_ILOCK(mp);
|
||||
mp->mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_EXTENDED_SHARED;
|
||||
mp->mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_EXTENDED_SHARED;
|
||||
MNT_IUNLOCK(mp);
|
||||
return (0);
|
||||
out:
|
||||
@ -688,7 +688,7 @@ ext2_mountfs(struct vnode *devvp, struct mount *mp)
|
||||
PICKUP_GIANT();
|
||||
}
|
||||
if (ump) {
|
||||
mtx_destroy(EXT2_MTX(ump));
|
||||
mtx_destroy(EXT2_MTX(ump));
|
||||
free(ump->um_e2fs->e2fs_gd, M_EXT2MNT);
|
||||
free(ump->um_e2fs->e2fs_contigdirs, M_EXT2MNT);
|
||||
free(ump->um_e2fs->e2fs, M_EXT2MNT);
|
||||
@ -723,8 +723,8 @@ ext2_unmount(struct mount *mp, int mntflags)
|
||||
ronly = fs->e2fs_ronly;
|
||||
if (ronly == 0 && ext2_cgupdate(ump, MNT_WAIT) == 0) {
|
||||
if (fs->e2fs_wasvalid)
|
||||
fs->e2fs->e2fs_state |= E2FS_ISCLEAN;
|
||||
ext2_sbupdate(ump, MNT_WAIT);
|
||||
fs->e2fs->e2fs_state |= E2FS_ISCLEAN;
|
||||
ext2_sbupdate(ump, MNT_WAIT);
|
||||
}
|
||||
|
||||
DROP_GIANT();
|
||||
|
@ -775,10 +775,10 @@ ext2_rename(struct vop_rename_args *ap)
|
||||
dp = VTOI(fdvp);
|
||||
ip = VTOI(fvp);
|
||||
if (ip->i_nlink >= EXT2_LINK_MAX) {
|
||||
VOP_UNLOCK(fvp, 0);
|
||||
error = EMLINK;
|
||||
goto abortit;
|
||||
}
|
||||
VOP_UNLOCK(fvp, 0);
|
||||
error = EMLINK;
|
||||
goto abortit;
|
||||
}
|
||||
if ((ip->i_flags & (NOUNLINK | IMMUTABLE | APPEND))
|
||||
|| (dp->i_flags & APPEND)) {
|
||||
VOP_UNLOCK(fvp, 0);
|
||||
@ -942,8 +942,8 @@ ext2_rename(struct vop_rename_args *ap)
|
||||
* of the target directory.
|
||||
*/
|
||||
if (doingdirectory && !newparent) {
|
||||
dp->i_nlink--;
|
||||
dp->i_flag |= IN_CHANGE;
|
||||
dp->i_nlink--;
|
||||
dp->i_flag |= IN_CHANGE;
|
||||
}
|
||||
vput(tdvp);
|
||||
/*
|
||||
@ -1623,7 +1623,6 @@ ext2_read(struct vop_read_args *ap)
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Vnode op for reading.
|
||||
*/
|
||||
@ -1723,7 +1722,7 @@ ext2_ind_read(struct vop_read_args *ap)
|
||||
xfersize = size;
|
||||
}
|
||||
error = uiomove((char *)bp->b_data + blkoffset,
|
||||
(int)xfersize, uio);
|
||||
(int)xfersize, uio);
|
||||
if (error)
|
||||
break;
|
||||
|
||||
@ -1960,10 +1959,10 @@ ext2_write(struct vop_write_args *ap)
|
||||
if (uio->uio_offset + xfersize > ip->i_size)
|
||||
vnode_pager_setsize(vp, uio->uio_offset + xfersize);
|
||||
|
||||
/*
|
||||
/*
|
||||
* We must perform a read-before-write if the transfer size
|
||||
* does not cover the entire buffer.
|
||||
*/
|
||||
*/
|
||||
if (fs->e2fs_bsize > xfersize)
|
||||
flags |= BA_CLRBUF;
|
||||
else
|
||||
@ -2057,9 +2056,9 @@ ext2_write(struct vop_write_args *ap)
|
||||
}
|
||||
}
|
||||
if (uio->uio_resid != resid) {
|
||||
ip->i_flag |= IN_CHANGE | IN_UPDATE;
|
||||
if (ioflag & IO_SYNC)
|
||||
error = ext2_update(vp, 1);
|
||||
}
|
||||
ip->i_flag |= IN_CHANGE | IN_UPDATE;
|
||||
if (ioflag & IO_SYNC)
|
||||
error = ext2_update(vp, 1);
|
||||
}
|
||||
return (error);
|
||||
}
|
||||
|
@ -35,7 +35,7 @@
|
||||
*/
|
||||
|
||||
#ifndef _FS_EXT2FS_EXT2FS_H_
|
||||
#define _FS_EXT2FS_EXT2FS_H_
|
||||
#define _FS_EXT2FS_EXT2FS_H_
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
@ -77,7 +77,7 @@ struct ext2fs {
|
||||
uint32_t e2fs_features_rocompat; /* RO-compatible feature set */
|
||||
uint8_t e2fs_uuid[16]; /* 128-bit uuid for volume */
|
||||
char e2fs_vname[16]; /* volume name */
|
||||
char e2fs_fsmnt[64]; /* name mounted on */
|
||||
char e2fs_fsmnt[64]; /* name mounted on */
|
||||
uint32_t e2fs_algo; /* For compression */
|
||||
uint8_t e2fs_prealloc; /* # of blocks for old prealloc */
|
||||
uint8_t e2fs_dir_prealloc; /* # of blocks for old prealloc dirs */
|
||||
@ -103,10 +103,10 @@ struct ext2fs {
|
||||
uint16_t e4fs_mmpintv; /* number of seconds to wait in MMP checking */
|
||||
uint64_t e4fs_mmpblk; /* block for multi-mount protection */
|
||||
uint32_t e4fs_raid_stripe_wid;/* blocks on all data disks (N * stride) */
|
||||
uint8_t e4fs_log_gpf; /* FLEX_BG group size */
|
||||
uint8_t e4fs_log_gpf; /* FLEX_BG group size */
|
||||
uint8_t e4fs_char_pad2;
|
||||
uint16_t e4fs_pad;
|
||||
uint32_t reserved2[162]; /* Padding to the end of the block */
|
||||
uint32_t reserved2[162]; /* Padding to the end of the block */
|
||||
};
|
||||
|
||||
/*
|
||||
@ -114,7 +114,7 @@ struct ext2fs {
|
||||
* in fs_fsmnt. MAXMNTLEN defines the amount of space allocated in
|
||||
* the super block for this name.
|
||||
*/
|
||||
#define MAXMNTLEN 512
|
||||
#define MAXMNTLEN 512
|
||||
|
||||
/*
|
||||
* In-Memory Superblock
|
||||
@ -123,25 +123,25 @@ struct ext2fs {
|
||||
struct m_ext2fs {
|
||||
struct ext2fs * e2fs;
|
||||
char e2fs_fsmnt[MAXMNTLEN];/* name mounted on */
|
||||
char e2fs_ronly; /* mounted read-only flag */
|
||||
char e2fs_fmod; /* super block modified flag */
|
||||
uint32_t e2fs_bsize; /* Block size */
|
||||
uint32_t e2fs_bshift; /* calc of logical block no */
|
||||
char e2fs_ronly; /* mounted read-only flag */
|
||||
char e2fs_fmod; /* super block modified flag */
|
||||
uint32_t e2fs_bsize; /* Block size */
|
||||
uint32_t e2fs_bshift; /* calc of logical block no */
|
||||
uint32_t e2fs_bpg; /* Number of blocks per group */
|
||||
int64_t e2fs_qbmask; /* = s_blocksize -1 */
|
||||
uint32_t e2fs_fsbtodb; /* Shift to get disk block */
|
||||
int64_t e2fs_qbmask; /* = s_blocksize -1 */
|
||||
uint32_t e2fs_fsbtodb; /* Shift to get disk block */
|
||||
uint32_t e2fs_ipg; /* Number of inodes per group */
|
||||
uint32_t e2fs_ipb; /* Number of inodes per block */
|
||||
uint32_t e2fs_itpg; /* Number of inode table per group */
|
||||
uint32_t e2fs_fsize; /* Size of fragments per block */
|
||||
uint32_t e2fs_itpg; /* Number of inode table per group */
|
||||
uint32_t e2fs_fsize; /* Size of fragments per block */
|
||||
uint32_t e2fs_fpb; /* Number of fragments per block */
|
||||
uint32_t e2fs_fpg; /* Number of fragments per group */
|
||||
uint32_t e2fs_gdbcount; /* Number of group descriptors */
|
||||
uint32_t e2fs_gcount; /* Number of groups */
|
||||
uint32_t e2fs_gdbcount; /* Number of group descriptors */
|
||||
uint32_t e2fs_gcount; /* Number of groups */
|
||||
uint32_t e2fs_isize; /* Size of inode */
|
||||
uint32_t e2fs_total_dir; /* Total number of directories */
|
||||
uint8_t *e2fs_contigdirs; /* (u) # of contig. allocated dirs */
|
||||
char e2fs_wasvalid; /* valid at mount time */
|
||||
char e2fs_wasvalid; /* valid at mount time */
|
||||
off_t e2fs_maxfilesize;
|
||||
struct ext2_gd *e2fs_gd; /* Group Descriptors */
|
||||
int32_t e2fs_contigsumsize; /* size of cluster summary array */
|
||||
@ -160,39 +160,39 @@ struct csum {
|
||||
/*
|
||||
* The second extended file system magic number
|
||||
*/
|
||||
#define E2FS_MAGIC 0xEF53
|
||||
#define E2FS_MAGIC 0xEF53
|
||||
|
||||
/*
|
||||
* Revision levels
|
||||
*/
|
||||
#define E2FS_REV0 0 /* The good old (original) format */
|
||||
#define E2FS_REV1 1 /* V2 format w/ dynamic inode sizes */
|
||||
#define E2FS_REV0 0 /* The good old (original) format */
|
||||
#define E2FS_REV1 1 /* V2 format w/ dynamic inode sizes */
|
||||
|
||||
#define E2FS_REV0_INODE_SIZE 128
|
||||
#define E2FS_REV0_INODE_SIZE 128
|
||||
|
||||
/*
|
||||
* compatible/incompatible features
|
||||
*/
|
||||
#define EXT2F_COMPAT_PREALLOC 0x0001
|
||||
#define EXT2F_COMPAT_HASJOURNAL 0x0004
|
||||
#define EXT2F_COMPAT_RESIZE 0x0010
|
||||
#define EXT2F_COMPAT_DIRHASHINDEX 0x0020
|
||||
#define EXT2F_COMPAT_PREALLOC 0x0001
|
||||
#define EXT2F_COMPAT_HASJOURNAL 0x0004
|
||||
#define EXT2F_COMPAT_RESIZE 0x0010
|
||||
#define EXT2F_COMPAT_DIRHASHINDEX 0x0020
|
||||
|
||||
#define EXT2F_ROCOMPAT_SPARSESUPER 0x0001
|
||||
#define EXT2F_ROCOMPAT_LARGEFILE 0x0002
|
||||
#define EXT2F_ROCOMPAT_BTREE_DIR 0x0004
|
||||
#define EXT2F_ROCOMPAT_HUGE_FILE 0x0008
|
||||
#define EXT2F_ROCOMPAT_GDT_CSUM 0x0010
|
||||
#define EXT2F_ROCOMPAT_DIR_NLINK 0x0020
|
||||
#define EXT2F_ROCOMPAT_EXTRA_ISIZE 0x0040
|
||||
#define EXT2F_ROCOMPAT_SPARSESUPER 0x0001
|
||||
#define EXT2F_ROCOMPAT_LARGEFILE 0x0002
|
||||
#define EXT2F_ROCOMPAT_BTREE_DIR 0x0004
|
||||
#define EXT2F_ROCOMPAT_HUGE_FILE 0x0008
|
||||
#define EXT2F_ROCOMPAT_GDT_CSUM 0x0010
|
||||
#define EXT2F_ROCOMPAT_DIR_NLINK 0x0020
|
||||
#define EXT2F_ROCOMPAT_EXTRA_ISIZE 0x0040
|
||||
|
||||
#define EXT2F_INCOMPAT_COMP 0x0001
|
||||
#define EXT2F_INCOMPAT_FTYPE 0x0002
|
||||
#define EXT2F_INCOMPAT_META_BG 0x0010
|
||||
#define EXT2F_INCOMPAT_EXTENTS 0x0040
|
||||
#define EXT2F_INCOMPAT_64BIT 0x0080
|
||||
#define EXT2F_INCOMPAT_MMP 0x0100
|
||||
#define EXT2F_INCOMPAT_FLEX_BG 0x0200
|
||||
#define EXT2F_INCOMPAT_COMP 0x0001
|
||||
#define EXT2F_INCOMPAT_FTYPE 0x0002
|
||||
#define EXT2F_INCOMPAT_META_BG 0x0010
|
||||
#define EXT2F_INCOMPAT_EXTENTS 0x0040
|
||||
#define EXT2F_INCOMPAT_64BIT 0x0080
|
||||
#define EXT2F_INCOMPAT_MMP 0x0100
|
||||
#define EXT2F_INCOMPAT_FLEX_BG 0x0200
|
||||
|
||||
/*
|
||||
* Features supported in this implementation
|
||||
@ -212,28 +212,28 @@ struct csum {
|
||||
* - EXT2F_INCOMPAT_FLEX_BG
|
||||
* - EXT2F_INCOMPAT_META_BG
|
||||
*/
|
||||
#define EXT2F_COMPAT_SUPP EXT2F_COMPAT_DIRHASHINDEX
|
||||
#define EXT2F_ROCOMPAT_SUPP (EXT2F_ROCOMPAT_SPARSESUPER | \
|
||||
#define EXT2F_COMPAT_SUPP EXT2F_COMPAT_DIRHASHINDEX
|
||||
#define EXT2F_ROCOMPAT_SUPP (EXT2F_ROCOMPAT_SPARSESUPER | \
|
||||
EXT2F_ROCOMPAT_LARGEFILE | \
|
||||
EXT2F_ROCOMPAT_EXTRA_ISIZE)
|
||||
#define EXT2F_INCOMPAT_SUPP EXT2F_INCOMPAT_FTYPE
|
||||
#define EXT4F_RO_INCOMPAT_SUPP (EXT2F_INCOMPAT_EXTENTS | \
|
||||
#define EXT2F_INCOMPAT_SUPP EXT2F_INCOMPAT_FTYPE
|
||||
#define EXT4F_RO_INCOMPAT_SUPP (EXT2F_INCOMPAT_EXTENTS | \
|
||||
EXT2F_INCOMPAT_FLEX_BG | \
|
||||
EXT2F_INCOMPAT_META_BG )
|
||||
|
||||
/* Assume that user mode programs are passing in an ext2fs superblock, not
|
||||
* a kernel struct super_block. This will allow us to call the feature-test
|
||||
* macros from user land. */
|
||||
#define EXT2_SB(sb) (sb)
|
||||
#define EXT2_SB(sb) (sb)
|
||||
|
||||
/*
|
||||
* Feature set definitions
|
||||
*/
|
||||
#define EXT2_HAS_COMPAT_FEATURE(sb,mask) \
|
||||
#define EXT2_HAS_COMPAT_FEATURE(sb,mask) \
|
||||
( EXT2_SB(sb)->e2fs->e2fs_features_compat & htole32(mask) )
|
||||
#define EXT2_HAS_RO_COMPAT_FEATURE(sb,mask) \
|
||||
#define EXT2_HAS_RO_COMPAT_FEATURE(sb,mask) \
|
||||
( EXT2_SB(sb)->e2fs->e2fs_features_rocompat & htole32(mask) )
|
||||
#define EXT2_HAS_INCOMPAT_FEATURE(sb,mask) \
|
||||
#define EXT2_HAS_INCOMPAT_FEATURE(sb,mask) \
|
||||
( EXT2_SB(sb)->e2fs->e2fs_features_incompat & htole32(mask) )
|
||||
|
||||
/*
|
||||
@ -245,8 +245,8 @@ struct csum {
|
||||
/*
|
||||
* Filesystem miscellaneous flags
|
||||
*/
|
||||
#define E2FS_SIGNED_HASH 0x0001
|
||||
#define E2FS_UNSIGNED_HASH 0x0002
|
||||
#define E2FS_SIGNED_HASH 0x0001
|
||||
#define E2FS_UNSIGNED_HASH 0x0002
|
||||
|
||||
/* ext2 file system block group descriptor */
|
||||
|
||||
@ -270,30 +270,30 @@ struct ext2_gd {
|
||||
* helps reading these metadatas
|
||||
*/
|
||||
|
||||
#define e2fs_cgload(old, new, size) memcpy((new), (old), (size));
|
||||
#define e2fs_cgsave(old, new, size) memcpy((new), (old), (size));
|
||||
#define e2fs_cgload(old, new, size) memcpy((new), (old), (size));
|
||||
#define e2fs_cgsave(old, new, size) memcpy((new), (old), (size));
|
||||
|
||||
/*
|
||||
* Macro-instructions used to manage several block sizes
|
||||
*/
|
||||
#define EXT2_MAX_BLOCK_SIZE 4096
|
||||
#define EXT2_MIN_BLOCK_LOG_SIZE 10
|
||||
#define EXT2_BLOCK_SIZE(s) ((s)->e2fs_bsize)
|
||||
#define EXT2_MIN_BLOCK_LOG_SIZE 10
|
||||
#define EXT2_BLOCK_SIZE(s) ((s)->e2fs_bsize)
|
||||
#define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof(uint32_t))
|
||||
#define EXT2_INODE_SIZE(s) (EXT2_SB(s)->e2fs_isize)
|
||||
#define EXT2_INODE_SIZE(s) (EXT2_SB(s)->e2fs_isize)
|
||||
|
||||
/*
|
||||
* Macro-instructions used to manage fragments
|
||||
*/
|
||||
#define EXT2_MIN_FRAG_SIZE 1024
|
||||
#define EXT2_MIN_FRAG_SIZE 1024
|
||||
#define EXT2_MAX_FRAG_SIZE 4096
|
||||
#define EXT2_MIN_FRAG_LOG_SIZE 10
|
||||
#define EXT2_FRAG_SIZE(s) (EXT2_SB(s)->e2fs_fsize)
|
||||
#define EXT2_FRAGS_PER_BLOCK(s) (EXT2_SB(s)->e2fs_fpb)
|
||||
#define EXT2_MIN_FRAG_LOG_SIZE 10
|
||||
#define EXT2_FRAG_SIZE(s) (EXT2_SB(s)->e2fs_fsize)
|
||||
#define EXT2_FRAGS_PER_BLOCK(s) (EXT2_SB(s)->e2fs_fpb)
|
||||
|
||||
/*
|
||||
* Macro-instructions used to manage group descriptors
|
||||
*/
|
||||
#define EXT2_BLOCKS_PER_GROUP(s) (EXT2_SB(s)->e2fs_bpg)
|
||||
#define EXT2_BLOCKS_PER_GROUP(s) (EXT2_SB(s)->e2fs_bpg)
|
||||
|
||||
#endif /* !_FS_EXT2FS_EXT2FS_H_ */
|
||||
|
@ -37,7 +37,7 @@
|
||||
*/
|
||||
|
||||
#ifndef _FS_EXT2FS_FS_H_
|
||||
#define _FS_EXT2FS_FS_H_
|
||||
#define _FS_EXT2FS_FS_H_
|
||||
|
||||
/*
|
||||
* Each disk drive contains some number of file systems.
|
||||
@ -54,15 +54,15 @@
|
||||
* The first boot and super blocks are given in absolute disk addresses.
|
||||
* The byte-offset forms are preferred, as they don't imply a sector size.
|
||||
*/
|
||||
#define SBSIZE 1024
|
||||
#define SBLOCK 2
|
||||
#define SBSIZE 1024
|
||||
#define SBLOCK 2
|
||||
|
||||
/*
|
||||
* The path name on which the file system is mounted is maintained
|
||||
* in fs_fsmnt. MAXMNTLEN defines the amount of space allocated in
|
||||
* the super block for this name.
|
||||
*/
|
||||
#define MAXMNTLEN 512
|
||||
#define MAXMNTLEN 512
|
||||
|
||||
/*
|
||||
* A summary of contiguous blocks of various sizes is maintained
|
||||
@ -72,7 +72,7 @@
|
||||
* XXX:FS_MAXCONTIG is set to 16 to conserve space. Here we set
|
||||
* EXT2_MAXCONTIG to 32 for better performance.
|
||||
*/
|
||||
#define EXT2_MAXCONTIG 32
|
||||
#define EXT2_MAXCONTIG 32
|
||||
|
||||
/*
|
||||
* Grigoriy Orlov <gluk@ptci.ru> has done some extensive work to fine
|
||||
@ -87,8 +87,8 @@
|
||||
* 16384.
|
||||
*/
|
||||
|
||||
#define AFPDIR 64
|
||||
#define AVGDIRSIZE 1048576
|
||||
#define AFPDIR 64
|
||||
#define AVGDIRSIZE 1048576
|
||||
|
||||
/*
|
||||
* Macros for access to superblock array structures
|
||||
@ -98,14 +98,14 @@
|
||||
* Turn file system block numbers into disk block addresses.
|
||||
* This maps file system blocks to device size blocks.
|
||||
*/
|
||||
#define fsbtodb(fs, b) ((daddr_t)(b) << (fs)->e2fs_fsbtodb)
|
||||
#define fsbtodb(fs, b) ((daddr_t)(b) << (fs)->e2fs_fsbtodb)
|
||||
#define dbtofsb(fs, b) ((b) >> (fs)->e2fs_fsbtodb)
|
||||
|
||||
/* get group containing inode */
|
||||
#define ino_to_cg(fs, x) (((x) - 1) / (fs->e2fs_ipg))
|
||||
#define ino_to_cg(fs, x) (((x) - 1) / (fs->e2fs_ipg))
|
||||
|
||||
/* get block containing inode from its number x */
|
||||
#define ino_to_fsba(fs, x) \
|
||||
#define ino_to_fsba(fs, x) \
|
||||
((fs)->e2fs_gd[ino_to_cg((fs), (x))].ext2bgd_i_tables + \
|
||||
(((x) - 1) % (fs)->e2fs->e2fs_ipg) / (fs)->e2fs_ipb)
|
||||
|
||||
@ -126,20 +126,20 @@
|
||||
* quantities by using shifts and masks in place of divisions
|
||||
* modulos and multiplications.
|
||||
*/
|
||||
#define blkoff(fs, loc) /* calculates (loc % fs->fs_bsize) */ \
|
||||
#define blkoff(fs, loc) /* calculates (loc % fs->fs_bsize) */ \
|
||||
((loc) & (fs)->e2fs_qbmask)
|
||||
|
||||
#define lblktosize(fs, blk) /* calculates (blk * fs->fs_bsize) */ \
|
||||
#define lblktosize(fs, blk) /* calculates (blk * fs->fs_bsize) */ \
|
||||
((blk) << (fs->e2fs_bshift))
|
||||
|
||||
#define lblkno(fs, loc) /* calculates (loc / fs->fs_bsize) */ \
|
||||
#define lblkno(fs, loc) /* calculates (loc / fs->fs_bsize) */ \
|
||||
((loc) >> (fs->e2fs_bshift))
|
||||
|
||||
/* no fragments -> logical block number equal # of frags */
|
||||
#define numfrags(fs, loc) /* calculates (loc / fs->fs_fsize) */ \
|
||||
#define numfrags(fs, loc) /* calculates (loc / fs->fs_fsize) */ \
|
||||
((loc) >> (fs->e2fs_bshift))
|
||||
|
||||
#define fragroundup(fs, size) /* calculates roundup(size, fs->fs_fsize) */ \
|
||||
#define fragroundup(fs, size) /* calculates roundup(size, fs->fs_fsize) */ \
|
||||
roundup(size, fs->e2fs_fsize)
|
||||
/* was (((size) + (fs)->fs_qfmask) & (fs)->fs_fmask) */
|
||||
|
||||
@ -147,7 +147,7 @@
|
||||
* Determining the size of a file block in the file system.
|
||||
* easy w/o fragments
|
||||
*/
|
||||
#define blksize(fs, ip, lbn) ((fs)->e2fs_fsize)
|
||||
#define blksize(fs, ip, lbn) ((fs)->e2fs_fsize)
|
||||
|
||||
/*
|
||||
* INOPB is the number of inodes in a secondary storage block.
|
||||
|
@ -28,18 +28,18 @@
|
||||
*/
|
||||
|
||||
#ifndef _FS_EXT2FS_HTREE_H_
|
||||
#define _FS_EXT2FS_HTREE_H_
|
||||
#define _FS_EXT2FS_HTREE_H_
|
||||
|
||||
/* EXT3 HTree directory indexing */
|
||||
|
||||
#define EXT2_HTREE_LEGACY 0
|
||||
#define EXT2_HTREE_HALF_MD4 1
|
||||
#define EXT2_HTREE_TEA 2
|
||||
#define EXT2_HTREE_LEGACY_UNSIGNED 3
|
||||
#define EXT2_HTREE_HALF_MD4_UNSIGNED 4
|
||||
#define EXT2_HTREE_TEA_UNSIGNED 5
|
||||
#define EXT2_HTREE_LEGACY 0
|
||||
#define EXT2_HTREE_HALF_MD4 1
|
||||
#define EXT2_HTREE_TEA 2
|
||||
#define EXT2_HTREE_LEGACY_UNSIGNED 3
|
||||
#define EXT2_HTREE_HALF_MD4_UNSIGNED 4
|
||||
#define EXT2_HTREE_TEA_UNSIGNED 5
|
||||
|
||||
#define EXT2_HTREE_EOF 0x7FFFFFFF
|
||||
#define EXT2_HTREE_EOF 0x7FFFFFFF
|
||||
|
||||
struct ext2fs_fake_direct {
|
||||
uint32_t e2d_ino; /* inode number of entry */
|
||||
|
@ -150,7 +150,7 @@ struct inode {
|
||||
#define IN_HASHED 0x0020 /* Inode is on hash list */
|
||||
#define IN_LAZYMOD 0x0040 /* Modified, but don't write yet. */
|
||||
#define IN_SPACECOUNTED 0x0080 /* Blocks to be freed in free count. */
|
||||
#define IN_LAZYACCESS 0x0100 /* Process IN_ACCESS after the
|
||||
#define IN_LAZYACCESS 0x0100 /* Process IN_ACCESS after the
|
||||
suspension finished */
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user