Use explicitly-sized types where necessary to make ext2fs work again
after the change to a 64-bit daddr_t.
This commit is contained in:
parent
ed6ca8732c
commit
39e24f84ac
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=96877
@ -96,13 +96,13 @@ ext2_discard_prealloc(ip)
|
||||
int
|
||||
ext2_alloc(ip, lbn, bpref, size, cred, bnp)
|
||||
struct inode *ip;
|
||||
daddr_t lbn, bpref;
|
||||
int32_t lbn, bpref;
|
||||
int size;
|
||||
struct ucred *cred;
|
||||
daddr_t *bnp;
|
||||
int32_t *bnp;
|
||||
{
|
||||
struct ext2_sb_info *fs;
|
||||
daddr_t bno;
|
||||
int32_t bno;
|
||||
|
||||
*bnp = 0;
|
||||
fs = ip->i_e2fs;
|
||||
@ -150,11 +150,11 @@ ext2_alloc(ip, lbn, bpref, size, cred, bnp)
|
||||
&ip->i_prealloc_count,
|
||||
&ip->i_prealloc_block);
|
||||
else
|
||||
bno = (daddr_t)ext2_new_block(ITOV(ip)->v_mount,
|
||||
bno = (int32_t)ext2_new_block(ITOV(ip)->v_mount,
|
||||
bpref, 0, 0);
|
||||
}
|
||||
#else
|
||||
bno = (daddr_t)ext2_new_block(ITOV(ip)->v_mount, bpref, 0, 0);
|
||||
bno = (int32_t)ext2_new_block(ITOV(ip)->v_mount, bpref, 0, 0);
|
||||
#endif
|
||||
|
||||
if (bno > 0) {
|
||||
@ -212,9 +212,9 @@ return ENOSPC;
|
||||
struct inode *ip;
|
||||
struct vnode *vp;
|
||||
struct buf *sbp, *ebp;
|
||||
daddr_t *bap, *sbap, *ebap;
|
||||
int32_t *bap, *sbap, *ebap;
|
||||
struct cluster_save *buflist;
|
||||
daddr_t start_lbn, end_lbn, soff, eoff, newblk, blkno;
|
||||
int32_t start_lbn, end_lbn, soff, eoff, newblk, blkno;
|
||||
struct indir start_ap[NIADDR + 1], end_ap[NIADDR + 1], *idp;
|
||||
int i, len, start_lvl, end_lvl, pref, ssize;
|
||||
|
||||
@ -257,7 +257,7 @@ return ENOSPC;
|
||||
brelse(sbp);
|
||||
return (ENOSPC);
|
||||
}
|
||||
sbap = (daddr_t *)sbp->b_data;
|
||||
sbap = (int32_t *)sbp->b_data;
|
||||
soff = idp->in_off;
|
||||
}
|
||||
/*
|
||||
@ -277,12 +277,12 @@ return ENOSPC;
|
||||
ssize = len - (idp->in_off + 1);
|
||||
if (bread(vp, idp->in_lbn, (int)fs->s_blocksize, NOCRED, &ebp))
|
||||
goto fail;
|
||||
ebap = (daddr_t *)ebp->b_data;
|
||||
ebap = (int32_t *)ebp->b_data;
|
||||
}
|
||||
/*
|
||||
* Search the block map looking for an allocation of the desired size.
|
||||
*/
|
||||
if ((newblk = (daddr_t)ext2_hashalloc(ip, dtog(fs, pref), (long)pref,
|
||||
if ((newblk = (int32_t)ext2_hashalloc(ip, dtog(fs, pref), (long)pref,
|
||||
len, (u_long (*)())ext2_clusteralloc)) == 0)
|
||||
goto fail;
|
||||
/*
|
||||
@ -432,13 +432,13 @@ printf("ext2_valloc: allocated inode %d\n", ino);
|
||||
* of the above. Then, blocknr tells us the number of the block
|
||||
* that will hold the pointer
|
||||
*/
|
||||
daddr_t
|
||||
int32_t
|
||||
ext2_blkpref(ip, lbn, indx, bap, blocknr)
|
||||
struct inode *ip;
|
||||
daddr_t lbn;
|
||||
int32_t lbn;
|
||||
int indx;
|
||||
daddr_t *bap;
|
||||
daddr_t blocknr;
|
||||
int32_t *bap;
|
||||
int32_t blocknr;
|
||||
{
|
||||
int tmp;
|
||||
|
||||
@ -460,7 +460,7 @@ ext2_blkpref(ip, lbn, indx, bap, blocknr)
|
||||
follow the rule that a block should be allocated near its inode
|
||||
*/
|
||||
return blocknr ? blocknr :
|
||||
(daddr_t)(ip->i_block_group *
|
||||
(int32_t)(ip->i_block_group *
|
||||
EXT2_BLOCKS_PER_GROUP(ip->i_e2fs)) +
|
||||
ip->i_e2fs->s_es->s_first_data_block;
|
||||
}
|
||||
@ -473,7 +473,7 @@ ext2_blkpref(ip, lbn, indx, bap, blocknr)
|
||||
void
|
||||
ext2_blkfree(ip, bno, size)
|
||||
struct inode *ip;
|
||||
daddr_t bno;
|
||||
int32_t bno;
|
||||
long size;
|
||||
{
|
||||
struct ext2_sb_info *fs;
|
||||
|
@ -62,18 +62,18 @@
|
||||
int
|
||||
ext2_balloc(ip, bn, size, cred, bpp, flags)
|
||||
struct inode *ip;
|
||||
daddr_t bn;
|
||||
int32_t bn;
|
||||
int size;
|
||||
struct ucred *cred;
|
||||
struct buf **bpp;
|
||||
int flags;
|
||||
{
|
||||
struct ext2_sb_info *fs;
|
||||
daddr_t nb;
|
||||
int32_t nb;
|
||||
struct buf *bp, *nbp;
|
||||
struct vnode *vp = ITOV(ip);
|
||||
struct indir indirs[NIADDR + 2];
|
||||
daddr_t newb, lbn, *bap, pref;
|
||||
int32_t newb, lbn, *bap, pref;
|
||||
int osize, nsize, num, i, error;
|
||||
/*
|
||||
ext2_debug("ext2_balloc called (%d, %d, %d)\n",
|
||||
@ -174,7 +174,7 @@ ext2_debug("ext2_balloc called (%d, %d, %d)\n",
|
||||
nb = ip->i_ib[indirs[0].in_off];
|
||||
if (nb == 0) {
|
||||
#if 0
|
||||
pref = ext2_blkpref(ip, lbn, 0, (daddr_t *)0, 0);
|
||||
pref = ext2_blkpref(ip, lbn, 0, (int32_t *)0, 0);
|
||||
#else
|
||||
/* see the comment by ext2_blkpref. What we do here is
|
||||
to pretend that it'd be good for a block holding indirect
|
||||
@ -218,7 +218,7 @@ ext2_debug("ext2_balloc called (%d, %d, %d)\n",
|
||||
brelse(bp);
|
||||
return (error);
|
||||
}
|
||||
bap = (daddr_t *)bp->b_data;
|
||||
bap = (int32_t *)bp->b_data;
|
||||
nb = bap[indirs[i].in_off];
|
||||
if (i == num)
|
||||
break;
|
||||
@ -238,7 +238,7 @@ ext2_debug("ext2_balloc called (%d, %d, %d)\n",
|
||||
pref = ext2_blkpref(ip, lbn, indirs[i].in_off, bap,
|
||||
bp->b_lblkno);
|
||||
#else
|
||||
pref = ext2_blkpref(ip, lbn, 0, (daddr_t *)0, 0);
|
||||
pref = ext2_blkpref(ip, lbn, 0, (int32_t *)0, 0);
|
||||
#endif
|
||||
if ((error =
|
||||
ext2_alloc(ip, lbn, pref, (int)fs->s_blocksize, cred, &newb)) != 0) {
|
||||
|
@ -69,7 +69,7 @@ ext2_bmap(ap)
|
||||
int *a_runb;
|
||||
} */ *ap;
|
||||
{
|
||||
daddr_t blkno;
|
||||
int32_t blkno;
|
||||
int error;
|
||||
|
||||
/*
|
||||
@ -104,8 +104,8 @@ ext2_bmap(ap)
|
||||
int
|
||||
ext2_bmaparray(vp, bn, bnp, runp, runb)
|
||||
struct vnode *vp;
|
||||
daddr_t bn;
|
||||
daddr_t *bnp;
|
||||
int32_t bn;
|
||||
int32_t *bnp;
|
||||
int *runp;
|
||||
int *runb;
|
||||
{
|
||||
@ -115,7 +115,7 @@ ext2_bmaparray(vp, bn, bnp, runp, runb)
|
||||
struct mount *mp;
|
||||
struct vnode *devvp;
|
||||
struct indir a[NIADDR+1], *ap;
|
||||
daddr_t daddr;
|
||||
int32_t daddr;
|
||||
long metalbn;
|
||||
int error, num, maxrun = 0;
|
||||
int *nump;
|
||||
@ -148,7 +148,7 @@ ext2_bmaparray(vp, bn, bnp, runp, runb)
|
||||
if (*bnp == 0) {
|
||||
*bnp = -1;
|
||||
} else if (runp) {
|
||||
daddr_t bnb = bn;
|
||||
int32_t bnb = bn;
|
||||
for (++bn; bn < NDADDR && *runp < maxrun &&
|
||||
is_sequential(ump, ip->i_db[bn - 1], ip->i_db[bn]);
|
||||
++bn, ++*runp);
|
||||
@ -205,19 +205,19 @@ ext2_bmaparray(vp, bn, bnp, runp, runb)
|
||||
}
|
||||
}
|
||||
|
||||
daddr = ((daddr_t *)bp->b_data)[ap->in_off];
|
||||
daddr = ((int32_t *)bp->b_data)[ap->in_off];
|
||||
if (num == 1 && daddr && runp) {
|
||||
for (bn = ap->in_off + 1;
|
||||
bn < MNINDIR(ump) && *runp < maxrun &&
|
||||
is_sequential(ump,
|
||||
((daddr_t *)bp->b_data)[bn - 1],
|
||||
((daddr_t *)bp->b_data)[bn]);
|
||||
((int32_t *)bp->b_data)[bn - 1],
|
||||
((int32_t *)bp->b_data)[bn]);
|
||||
++bn, ++*runp);
|
||||
bn = ap->in_off;
|
||||
if (runb && bn) {
|
||||
for(--bn; bn >= 0 && *runb < maxrun &&
|
||||
is_sequential(ump, ((daddr_t *)bp->b_data)[bn],
|
||||
((daddr_t *)bp->b_data)[bn+1]);
|
||||
is_sequential(ump, ((int32_t *)bp->b_data)[bn],
|
||||
((int32_t *)bp->b_data)[bn+1]);
|
||||
--bn, ++*runb);
|
||||
}
|
||||
}
|
||||
@ -255,7 +255,7 @@ ext2_bmaparray(vp, bn, bnp, runp, runb)
|
||||
int
|
||||
ext2_getlbns(vp, bn, ap, nump)
|
||||
struct vnode *vp;
|
||||
daddr_t bn;
|
||||
int32_t bn;
|
||||
struct indir *ap;
|
||||
int *nump;
|
||||
{
|
||||
|
@ -51,17 +51,17 @@ struct vfsconf;
|
||||
struct vnode;
|
||||
|
||||
int ext2_alloc(struct inode *,
|
||||
daddr_t, daddr_t, int, struct ucred *, daddr_t *);
|
||||
int32_t, int32_t, int, struct ucred *, int32_t *);
|
||||
int ext2_balloc(struct inode *,
|
||||
daddr_t, int, struct ucred *, struct buf **, int);
|
||||
int32_t, int, struct ucred *, struct buf **, int);
|
||||
int ext2_blkatoff(struct vnode *, off_t, char **, struct buf **);
|
||||
void ext2_blkfree(struct inode *, daddr_t, long);
|
||||
daddr_t ext2_blkpref(struct inode *, daddr_t, int, daddr_t *, daddr_t);
|
||||
void ext2_blkfree(struct inode *, int32_t, long);
|
||||
int32_t ext2_blkpref(struct inode *, int32_t, int, int32_t *, int32_t);
|
||||
int ext2_bmap(struct vop_bmap_args *);
|
||||
int ext2_bmaparray(struct vnode *, daddr_t, daddr_t *, int *, int *);
|
||||
int ext2_bmaparray(struct vnode *, int32_t, int32_t *, int *, int *);
|
||||
void ext2_dirbad(struct inode *ip, doff_t offset, char *how);
|
||||
void ext2_ei2i(struct ext2_inode *, struct inode *);
|
||||
int ext2_getlbns(struct vnode *, daddr_t, struct indir *, int *);
|
||||
int ext2_getlbns(struct vnode *, int32_t, struct indir *, int *);
|
||||
void ext2_i2ei(struct inode *, struct ext2_inode *);
|
||||
int ext2_ihashget(dev_t, ino_t, int, struct vnode **);
|
||||
void ext2_ihashinit(void);
|
||||
@ -72,7 +72,7 @@ void ext2_ihashrem(struct inode *);
|
||||
void ext2_itimes(struct vnode *vp);
|
||||
int ext2_reallocblks(struct vop_reallocblks_args *);
|
||||
int ext2_reclaim(struct vop_reclaim_args *);
|
||||
void ext2_setblock(struct ext2_sb_info *, u_char *, daddr_t);
|
||||
void ext2_setblock(struct ext2_sb_info *, u_char *, int32_t);
|
||||
int ext2_truncate(struct vnode *, off_t, int, struct ucred *, struct thread *);
|
||||
int ext2_update(struct vnode *, int);
|
||||
int ext2_valloc(struct vnode *, int, struct ucred *, struct vnode **);
|
||||
|
@ -58,7 +58,7 @@
|
||||
#include <gnu/ext2fs/fs.h>
|
||||
#include <gnu/ext2fs/ext2_extern.h>
|
||||
|
||||
static int ext2_indirtrunc(struct inode *, daddr_t, daddr_t, daddr_t, int,
|
||||
static int ext2_indirtrunc(struct inode *, int32_t, int32_t, int32_t, int,
|
||||
long *);
|
||||
|
||||
/*
|
||||
@ -124,10 +124,10 @@ ext2_truncate(vp, length, flags, cred, td)
|
||||
struct thread *td;
|
||||
{
|
||||
struct vnode *ovp = vp;
|
||||
daddr_t lastblock;
|
||||
int32_t lastblock;
|
||||
struct inode *oip;
|
||||
daddr_t bn, lbn, lastiblock[NIADDR], indir_lbn[NIADDR];
|
||||
daddr_t oldblks[NDADDR + NIADDR], newblks[NDADDR + NIADDR];
|
||||
int32_t bn, lbn, lastiblock[NIADDR], indir_lbn[NIADDR];
|
||||
int32_t oldblks[NDADDR + NIADDR], newblks[NDADDR + NIADDR];
|
||||
struct ext2_sb_info *fs;
|
||||
struct buf *bp;
|
||||
int offset, size, level;
|
||||
@ -360,15 +360,15 @@ printf("ext2_truncate called %d to %d\n", VTOI(ovp)->i_number, length);
|
||||
static int
|
||||
ext2_indirtrunc(ip, lbn, dbn, lastbn, level, countp)
|
||||
struct inode *ip;
|
||||
daddr_t lbn, lastbn;
|
||||
daddr_t dbn;
|
||||
int32_t lbn, lastbn;
|
||||
int32_t dbn;
|
||||
int level;
|
||||
long *countp;
|
||||
{
|
||||
struct buf *bp;
|
||||
struct ext2_sb_info *fs = ip->i_e2fs;
|
||||
struct vnode *vp;
|
||||
daddr_t *bap, *copy, nb, nlbn, last;
|
||||
int32_t *bap, *copy, nb, nlbn, last;
|
||||
long blkcount, factor;
|
||||
int i, nblocks, blocksreleased = 0;
|
||||
int error = 0, allerror = 0;
|
||||
@ -411,11 +411,11 @@ ext2_indirtrunc(ip, lbn, dbn, lastbn, level, countp)
|
||||
return (error);
|
||||
}
|
||||
|
||||
bap = (daddr_t *)bp->b_data;
|
||||
MALLOC(copy, daddr_t *, fs->s_blocksize, M_TEMP, M_WAITOK);
|
||||
bap = (int32_t *)bp->b_data;
|
||||
MALLOC(copy, int32_t *, fs->s_blocksize, M_TEMP, M_WAITOK);
|
||||
bcopy((caddr_t)bap, (caddr_t)copy, (u_int)fs->s_blocksize);
|
||||
bzero((caddr_t)&bap[last + 1],
|
||||
(u_int)(NINDIR(fs) - (last + 1)) * sizeof (daddr_t));
|
||||
(u_int)(NINDIR(fs) - (last + 1)) * sizeof (int32_t));
|
||||
if (last == -1)
|
||||
bp->b_flags |= B_INVAL;
|
||||
error = bwrite(bp);
|
||||
@ -433,7 +433,7 @@ ext2_indirtrunc(ip, lbn, dbn, lastbn, level, countp)
|
||||
continue;
|
||||
if (level > SINGLE) {
|
||||
if ((error = ext2_indirtrunc(ip, nlbn,
|
||||
fsbtodb(fs, nb), (daddr_t)-1, level - 1, &blkcount)) != 0)
|
||||
fsbtodb(fs, nb), (int32_t)-1, level - 1, &blkcount)) != 0)
|
||||
allerror = error;
|
||||
blocksreleased += blkcount;
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ ext2_blkatoff(vp, offset, res, bpp)
|
||||
struct inode *ip;
|
||||
struct ext2_sb_info *fs;
|
||||
struct buf *bp;
|
||||
daddr_t lbn;
|
||||
int32_t lbn;
|
||||
int bsize, error;
|
||||
|
||||
ip = VTOI(vp);
|
||||
@ -102,7 +102,7 @@ ext2_checkoverlap(bp, ip)
|
||||
struct inode *ip;
|
||||
{
|
||||
struct buf *ebp, *ep;
|
||||
daddr_t start, last;
|
||||
int32_t start, last;
|
||||
struct vnode *vp;
|
||||
|
||||
ebp = &buf[nbuf];
|
||||
|
@ -1556,7 +1556,7 @@ ext2_strategy(ap)
|
||||
struct buf *bp = ap->a_bp;
|
||||
struct vnode *vp = ap->a_vp;
|
||||
struct inode *ip;
|
||||
daddr_t blkno;
|
||||
int32_t blkno;
|
||||
int error;
|
||||
|
||||
ip = VTOI(vp);
|
||||
|
@ -101,8 +101,8 @@ struct inode {
|
||||
int32_t i_mtimensec; /* Last modified time. */
|
||||
int32_t i_ctime; /* Last inode change time. */
|
||||
int32_t i_ctimensec; /* Last inode change time. */
|
||||
daddr_t i_db[NDADDR]; /* Direct disk blocks. */
|
||||
daddr_t i_ib[NIADDR]; /* Indirect disk blocks. */
|
||||
int32_t i_db[NDADDR]; /* Direct disk blocks. */
|
||||
int32_t i_ib[NIADDR]; /* Indirect disk blocks. */
|
||||
u_int32_t i_flags; /* Status flags (chflags). */
|
||||
int32_t i_blocks; /* Blocks actually held. */
|
||||
int32_t i_gen; /* Generation number. */
|
||||
@ -119,7 +119,7 @@ struct inode {
|
||||
*/
|
||||
#define i_shortlink i_db
|
||||
#define i_rdev i_db[0]
|
||||
#define MAXSYMLINKLEN ((NDADDR + NIADDR) * sizeof(daddr_t))
|
||||
#define MAXSYMLINKLEN ((NDADDR + NIADDR) * sizeof(int32_t))
|
||||
|
||||
/* File permissions. */
|
||||
#define IEXEC 0000100 /* Executable. */
|
||||
@ -153,10 +153,10 @@ struct inode {
|
||||
#ifdef _KERNEL
|
||||
/*
|
||||
* Structure used to pass around logical block paths generated by
|
||||
* ufs_getlbns and used by truncate and bmap code.
|
||||
* ext2_getlbns and used by truncate and bmap code.
|
||||
*/
|
||||
struct indir {
|
||||
daddr_t in_lbn; /* Logical block number. */
|
||||
int32_t in_lbn; /* Logical block number. */
|
||||
int in_off; /* Offset in buffer. */
|
||||
int in_exists; /* Flag if the block exists. */
|
||||
};
|
||||
|
@ -96,13 +96,13 @@ ext2_discard_prealloc(ip)
|
||||
int
|
||||
ext2_alloc(ip, lbn, bpref, size, cred, bnp)
|
||||
struct inode *ip;
|
||||
daddr_t lbn, bpref;
|
||||
int32_t lbn, bpref;
|
||||
int size;
|
||||
struct ucred *cred;
|
||||
daddr_t *bnp;
|
||||
int32_t *bnp;
|
||||
{
|
||||
struct ext2_sb_info *fs;
|
||||
daddr_t bno;
|
||||
int32_t bno;
|
||||
|
||||
*bnp = 0;
|
||||
fs = ip->i_e2fs;
|
||||
@ -150,11 +150,11 @@ ext2_alloc(ip, lbn, bpref, size, cred, bnp)
|
||||
&ip->i_prealloc_count,
|
||||
&ip->i_prealloc_block);
|
||||
else
|
||||
bno = (daddr_t)ext2_new_block(ITOV(ip)->v_mount,
|
||||
bno = (int32_t)ext2_new_block(ITOV(ip)->v_mount,
|
||||
bpref, 0, 0);
|
||||
}
|
||||
#else
|
||||
bno = (daddr_t)ext2_new_block(ITOV(ip)->v_mount, bpref, 0, 0);
|
||||
bno = (int32_t)ext2_new_block(ITOV(ip)->v_mount, bpref, 0, 0);
|
||||
#endif
|
||||
|
||||
if (bno > 0) {
|
||||
@ -212,9 +212,9 @@ return ENOSPC;
|
||||
struct inode *ip;
|
||||
struct vnode *vp;
|
||||
struct buf *sbp, *ebp;
|
||||
daddr_t *bap, *sbap, *ebap;
|
||||
int32_t *bap, *sbap, *ebap;
|
||||
struct cluster_save *buflist;
|
||||
daddr_t start_lbn, end_lbn, soff, eoff, newblk, blkno;
|
||||
int32_t start_lbn, end_lbn, soff, eoff, newblk, blkno;
|
||||
struct indir start_ap[NIADDR + 1], end_ap[NIADDR + 1], *idp;
|
||||
int i, len, start_lvl, end_lvl, pref, ssize;
|
||||
|
||||
@ -257,7 +257,7 @@ return ENOSPC;
|
||||
brelse(sbp);
|
||||
return (ENOSPC);
|
||||
}
|
||||
sbap = (daddr_t *)sbp->b_data;
|
||||
sbap = (int32_t *)sbp->b_data;
|
||||
soff = idp->in_off;
|
||||
}
|
||||
/*
|
||||
@ -277,12 +277,12 @@ return ENOSPC;
|
||||
ssize = len - (idp->in_off + 1);
|
||||
if (bread(vp, idp->in_lbn, (int)fs->s_blocksize, NOCRED, &ebp))
|
||||
goto fail;
|
||||
ebap = (daddr_t *)ebp->b_data;
|
||||
ebap = (int32_t *)ebp->b_data;
|
||||
}
|
||||
/*
|
||||
* Search the block map looking for an allocation of the desired size.
|
||||
*/
|
||||
if ((newblk = (daddr_t)ext2_hashalloc(ip, dtog(fs, pref), (long)pref,
|
||||
if ((newblk = (int32_t)ext2_hashalloc(ip, dtog(fs, pref), (long)pref,
|
||||
len, (u_long (*)())ext2_clusteralloc)) == 0)
|
||||
goto fail;
|
||||
/*
|
||||
@ -432,13 +432,13 @@ printf("ext2_valloc: allocated inode %d\n", ino);
|
||||
* of the above. Then, blocknr tells us the number of the block
|
||||
* that will hold the pointer
|
||||
*/
|
||||
daddr_t
|
||||
int32_t
|
||||
ext2_blkpref(ip, lbn, indx, bap, blocknr)
|
||||
struct inode *ip;
|
||||
daddr_t lbn;
|
||||
int32_t lbn;
|
||||
int indx;
|
||||
daddr_t *bap;
|
||||
daddr_t blocknr;
|
||||
int32_t *bap;
|
||||
int32_t blocknr;
|
||||
{
|
||||
int tmp;
|
||||
|
||||
@ -460,7 +460,7 @@ ext2_blkpref(ip, lbn, indx, bap, blocknr)
|
||||
follow the rule that a block should be allocated near its inode
|
||||
*/
|
||||
return blocknr ? blocknr :
|
||||
(daddr_t)(ip->i_block_group *
|
||||
(int32_t)(ip->i_block_group *
|
||||
EXT2_BLOCKS_PER_GROUP(ip->i_e2fs)) +
|
||||
ip->i_e2fs->s_es->s_first_data_block;
|
||||
}
|
||||
@ -473,7 +473,7 @@ ext2_blkpref(ip, lbn, indx, bap, blocknr)
|
||||
void
|
||||
ext2_blkfree(ip, bno, size)
|
||||
struct inode *ip;
|
||||
daddr_t bno;
|
||||
int32_t bno;
|
||||
long size;
|
||||
{
|
||||
struct ext2_sb_info *fs;
|
||||
|
@ -62,18 +62,18 @@
|
||||
int
|
||||
ext2_balloc(ip, bn, size, cred, bpp, flags)
|
||||
struct inode *ip;
|
||||
daddr_t bn;
|
||||
int32_t bn;
|
||||
int size;
|
||||
struct ucred *cred;
|
||||
struct buf **bpp;
|
||||
int flags;
|
||||
{
|
||||
struct ext2_sb_info *fs;
|
||||
daddr_t nb;
|
||||
int32_t nb;
|
||||
struct buf *bp, *nbp;
|
||||
struct vnode *vp = ITOV(ip);
|
||||
struct indir indirs[NIADDR + 2];
|
||||
daddr_t newb, lbn, *bap, pref;
|
||||
int32_t newb, lbn, *bap, pref;
|
||||
int osize, nsize, num, i, error;
|
||||
/*
|
||||
ext2_debug("ext2_balloc called (%d, %d, %d)\n",
|
||||
@ -174,7 +174,7 @@ ext2_debug("ext2_balloc called (%d, %d, %d)\n",
|
||||
nb = ip->i_ib[indirs[0].in_off];
|
||||
if (nb == 0) {
|
||||
#if 0
|
||||
pref = ext2_blkpref(ip, lbn, 0, (daddr_t *)0, 0);
|
||||
pref = ext2_blkpref(ip, lbn, 0, (int32_t *)0, 0);
|
||||
#else
|
||||
/* see the comment by ext2_blkpref. What we do here is
|
||||
to pretend that it'd be good for a block holding indirect
|
||||
@ -218,7 +218,7 @@ ext2_debug("ext2_balloc called (%d, %d, %d)\n",
|
||||
brelse(bp);
|
||||
return (error);
|
||||
}
|
||||
bap = (daddr_t *)bp->b_data;
|
||||
bap = (int32_t *)bp->b_data;
|
||||
nb = bap[indirs[i].in_off];
|
||||
if (i == num)
|
||||
break;
|
||||
@ -238,7 +238,7 @@ ext2_debug("ext2_balloc called (%d, %d, %d)\n",
|
||||
pref = ext2_blkpref(ip, lbn, indirs[i].in_off, bap,
|
||||
bp->b_lblkno);
|
||||
#else
|
||||
pref = ext2_blkpref(ip, lbn, 0, (daddr_t *)0, 0);
|
||||
pref = ext2_blkpref(ip, lbn, 0, (int32_t *)0, 0);
|
||||
#endif
|
||||
if ((error =
|
||||
ext2_alloc(ip, lbn, pref, (int)fs->s_blocksize, cred, &newb)) != 0) {
|
||||
|
@ -69,7 +69,7 @@ ext2_bmap(ap)
|
||||
int *a_runb;
|
||||
} */ *ap;
|
||||
{
|
||||
daddr_t blkno;
|
||||
int32_t blkno;
|
||||
int error;
|
||||
|
||||
/*
|
||||
@ -104,8 +104,8 @@ ext2_bmap(ap)
|
||||
int
|
||||
ext2_bmaparray(vp, bn, bnp, runp, runb)
|
||||
struct vnode *vp;
|
||||
daddr_t bn;
|
||||
daddr_t *bnp;
|
||||
int32_t bn;
|
||||
int32_t *bnp;
|
||||
int *runp;
|
||||
int *runb;
|
||||
{
|
||||
@ -115,7 +115,7 @@ ext2_bmaparray(vp, bn, bnp, runp, runb)
|
||||
struct mount *mp;
|
||||
struct vnode *devvp;
|
||||
struct indir a[NIADDR+1], *ap;
|
||||
daddr_t daddr;
|
||||
int32_t daddr;
|
||||
long metalbn;
|
||||
int error, num, maxrun = 0;
|
||||
int *nump;
|
||||
@ -148,7 +148,7 @@ ext2_bmaparray(vp, bn, bnp, runp, runb)
|
||||
if (*bnp == 0) {
|
||||
*bnp = -1;
|
||||
} else if (runp) {
|
||||
daddr_t bnb = bn;
|
||||
int32_t bnb = bn;
|
||||
for (++bn; bn < NDADDR && *runp < maxrun &&
|
||||
is_sequential(ump, ip->i_db[bn - 1], ip->i_db[bn]);
|
||||
++bn, ++*runp);
|
||||
@ -205,19 +205,19 @@ ext2_bmaparray(vp, bn, bnp, runp, runb)
|
||||
}
|
||||
}
|
||||
|
||||
daddr = ((daddr_t *)bp->b_data)[ap->in_off];
|
||||
daddr = ((int32_t *)bp->b_data)[ap->in_off];
|
||||
if (num == 1 && daddr && runp) {
|
||||
for (bn = ap->in_off + 1;
|
||||
bn < MNINDIR(ump) && *runp < maxrun &&
|
||||
is_sequential(ump,
|
||||
((daddr_t *)bp->b_data)[bn - 1],
|
||||
((daddr_t *)bp->b_data)[bn]);
|
||||
((int32_t *)bp->b_data)[bn - 1],
|
||||
((int32_t *)bp->b_data)[bn]);
|
||||
++bn, ++*runp);
|
||||
bn = ap->in_off;
|
||||
if (runb && bn) {
|
||||
for(--bn; bn >= 0 && *runb < maxrun &&
|
||||
is_sequential(ump, ((daddr_t *)bp->b_data)[bn],
|
||||
((daddr_t *)bp->b_data)[bn+1]);
|
||||
is_sequential(ump, ((int32_t *)bp->b_data)[bn],
|
||||
((int32_t *)bp->b_data)[bn+1]);
|
||||
--bn, ++*runb);
|
||||
}
|
||||
}
|
||||
@ -255,7 +255,7 @@ ext2_bmaparray(vp, bn, bnp, runp, runb)
|
||||
int
|
||||
ext2_getlbns(vp, bn, ap, nump)
|
||||
struct vnode *vp;
|
||||
daddr_t bn;
|
||||
int32_t bn;
|
||||
struct indir *ap;
|
||||
int *nump;
|
||||
{
|
||||
|
@ -51,17 +51,17 @@ struct vfsconf;
|
||||
struct vnode;
|
||||
|
||||
int ext2_alloc(struct inode *,
|
||||
daddr_t, daddr_t, int, struct ucred *, daddr_t *);
|
||||
int32_t, int32_t, int, struct ucred *, int32_t *);
|
||||
int ext2_balloc(struct inode *,
|
||||
daddr_t, int, struct ucred *, struct buf **, int);
|
||||
int32_t, int, struct ucred *, struct buf **, int);
|
||||
int ext2_blkatoff(struct vnode *, off_t, char **, struct buf **);
|
||||
void ext2_blkfree(struct inode *, daddr_t, long);
|
||||
daddr_t ext2_blkpref(struct inode *, daddr_t, int, daddr_t *, daddr_t);
|
||||
void ext2_blkfree(struct inode *, int32_t, long);
|
||||
int32_t ext2_blkpref(struct inode *, int32_t, int, int32_t *, int32_t);
|
||||
int ext2_bmap(struct vop_bmap_args *);
|
||||
int ext2_bmaparray(struct vnode *, daddr_t, daddr_t *, int *, int *);
|
||||
int ext2_bmaparray(struct vnode *, int32_t, int32_t *, int *, int *);
|
||||
void ext2_dirbad(struct inode *ip, doff_t offset, char *how);
|
||||
void ext2_ei2i(struct ext2_inode *, struct inode *);
|
||||
int ext2_getlbns(struct vnode *, daddr_t, struct indir *, int *);
|
||||
int ext2_getlbns(struct vnode *, int32_t, struct indir *, int *);
|
||||
void ext2_i2ei(struct inode *, struct ext2_inode *);
|
||||
int ext2_ihashget(dev_t, ino_t, int, struct vnode **);
|
||||
void ext2_ihashinit(void);
|
||||
@ -72,7 +72,7 @@ void ext2_ihashrem(struct inode *);
|
||||
void ext2_itimes(struct vnode *vp);
|
||||
int ext2_reallocblks(struct vop_reallocblks_args *);
|
||||
int ext2_reclaim(struct vop_reclaim_args *);
|
||||
void ext2_setblock(struct ext2_sb_info *, u_char *, daddr_t);
|
||||
void ext2_setblock(struct ext2_sb_info *, u_char *, int32_t);
|
||||
int ext2_truncate(struct vnode *, off_t, int, struct ucred *, struct thread *);
|
||||
int ext2_update(struct vnode *, int);
|
||||
int ext2_valloc(struct vnode *, int, struct ucred *, struct vnode **);
|
||||
|
@ -58,7 +58,7 @@
|
||||
#include <gnu/ext2fs/fs.h>
|
||||
#include <gnu/ext2fs/ext2_extern.h>
|
||||
|
||||
static int ext2_indirtrunc(struct inode *, daddr_t, daddr_t, daddr_t, int,
|
||||
static int ext2_indirtrunc(struct inode *, int32_t, int32_t, int32_t, int,
|
||||
long *);
|
||||
|
||||
/*
|
||||
@ -124,10 +124,10 @@ ext2_truncate(vp, length, flags, cred, td)
|
||||
struct thread *td;
|
||||
{
|
||||
struct vnode *ovp = vp;
|
||||
daddr_t lastblock;
|
||||
int32_t lastblock;
|
||||
struct inode *oip;
|
||||
daddr_t bn, lbn, lastiblock[NIADDR], indir_lbn[NIADDR];
|
||||
daddr_t oldblks[NDADDR + NIADDR], newblks[NDADDR + NIADDR];
|
||||
int32_t bn, lbn, lastiblock[NIADDR], indir_lbn[NIADDR];
|
||||
int32_t oldblks[NDADDR + NIADDR], newblks[NDADDR + NIADDR];
|
||||
struct ext2_sb_info *fs;
|
||||
struct buf *bp;
|
||||
int offset, size, level;
|
||||
@ -360,15 +360,15 @@ printf("ext2_truncate called %d to %d\n", VTOI(ovp)->i_number, length);
|
||||
static int
|
||||
ext2_indirtrunc(ip, lbn, dbn, lastbn, level, countp)
|
||||
struct inode *ip;
|
||||
daddr_t lbn, lastbn;
|
||||
daddr_t dbn;
|
||||
int32_t lbn, lastbn;
|
||||
int32_t dbn;
|
||||
int level;
|
||||
long *countp;
|
||||
{
|
||||
struct buf *bp;
|
||||
struct ext2_sb_info *fs = ip->i_e2fs;
|
||||
struct vnode *vp;
|
||||
daddr_t *bap, *copy, nb, nlbn, last;
|
||||
int32_t *bap, *copy, nb, nlbn, last;
|
||||
long blkcount, factor;
|
||||
int i, nblocks, blocksreleased = 0;
|
||||
int error = 0, allerror = 0;
|
||||
@ -411,11 +411,11 @@ ext2_indirtrunc(ip, lbn, dbn, lastbn, level, countp)
|
||||
return (error);
|
||||
}
|
||||
|
||||
bap = (daddr_t *)bp->b_data;
|
||||
MALLOC(copy, daddr_t *, fs->s_blocksize, M_TEMP, M_WAITOK);
|
||||
bap = (int32_t *)bp->b_data;
|
||||
MALLOC(copy, int32_t *, fs->s_blocksize, M_TEMP, M_WAITOK);
|
||||
bcopy((caddr_t)bap, (caddr_t)copy, (u_int)fs->s_blocksize);
|
||||
bzero((caddr_t)&bap[last + 1],
|
||||
(u_int)(NINDIR(fs) - (last + 1)) * sizeof (daddr_t));
|
||||
(u_int)(NINDIR(fs) - (last + 1)) * sizeof (int32_t));
|
||||
if (last == -1)
|
||||
bp->b_flags |= B_INVAL;
|
||||
error = bwrite(bp);
|
||||
@ -433,7 +433,7 @@ ext2_indirtrunc(ip, lbn, dbn, lastbn, level, countp)
|
||||
continue;
|
||||
if (level > SINGLE) {
|
||||
if ((error = ext2_indirtrunc(ip, nlbn,
|
||||
fsbtodb(fs, nb), (daddr_t)-1, level - 1, &blkcount)) != 0)
|
||||
fsbtodb(fs, nb), (int32_t)-1, level - 1, &blkcount)) != 0)
|
||||
allerror = error;
|
||||
blocksreleased += blkcount;
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ ext2_blkatoff(vp, offset, res, bpp)
|
||||
struct inode *ip;
|
||||
struct ext2_sb_info *fs;
|
||||
struct buf *bp;
|
||||
daddr_t lbn;
|
||||
int32_t lbn;
|
||||
int bsize, error;
|
||||
|
||||
ip = VTOI(vp);
|
||||
@ -102,7 +102,7 @@ ext2_checkoverlap(bp, ip)
|
||||
struct inode *ip;
|
||||
{
|
||||
struct buf *ebp, *ep;
|
||||
daddr_t start, last;
|
||||
int32_t start, last;
|
||||
struct vnode *vp;
|
||||
|
||||
ebp = &buf[nbuf];
|
||||
|
@ -1556,7 +1556,7 @@ ext2_strategy(ap)
|
||||
struct buf *bp = ap->a_bp;
|
||||
struct vnode *vp = ap->a_vp;
|
||||
struct inode *ip;
|
||||
daddr_t blkno;
|
||||
int32_t blkno;
|
||||
int error;
|
||||
|
||||
ip = VTOI(vp);
|
||||
|
@ -101,8 +101,8 @@ struct inode {
|
||||
int32_t i_mtimensec; /* Last modified time. */
|
||||
int32_t i_ctime; /* Last inode change time. */
|
||||
int32_t i_ctimensec; /* Last inode change time. */
|
||||
daddr_t i_db[NDADDR]; /* Direct disk blocks. */
|
||||
daddr_t i_ib[NIADDR]; /* Indirect disk blocks. */
|
||||
int32_t i_db[NDADDR]; /* Direct disk blocks. */
|
||||
int32_t i_ib[NIADDR]; /* Indirect disk blocks. */
|
||||
u_int32_t i_flags; /* Status flags (chflags). */
|
||||
int32_t i_blocks; /* Blocks actually held. */
|
||||
int32_t i_gen; /* Generation number. */
|
||||
@ -119,7 +119,7 @@ struct inode {
|
||||
*/
|
||||
#define i_shortlink i_db
|
||||
#define i_rdev i_db[0]
|
||||
#define MAXSYMLINKLEN ((NDADDR + NIADDR) * sizeof(daddr_t))
|
||||
#define MAXSYMLINKLEN ((NDADDR + NIADDR) * sizeof(int32_t))
|
||||
|
||||
/* File permissions. */
|
||||
#define IEXEC 0000100 /* Executable. */
|
||||
@ -153,10 +153,10 @@ struct inode {
|
||||
#ifdef _KERNEL
|
||||
/*
|
||||
* Structure used to pass around logical block paths generated by
|
||||
* ufs_getlbns and used by truncate and bmap code.
|
||||
* ext2_getlbns and used by truncate and bmap code.
|
||||
*/
|
||||
struct indir {
|
||||
daddr_t in_lbn; /* Logical block number. */
|
||||
int32_t in_lbn; /* Logical block number. */
|
||||
int in_off; /* Offset in buffer. */
|
||||
int in_exists; /* Flag if the block exists. */
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user