summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/fs/ext2fs/ext2_alloc.c19
-rw-r--r--sys/fs/ext2fs/ext2_balloc.c6
-rw-r--r--sys/fs/ext2fs/ext2_bmap.c21
-rw-r--r--sys/fs/ext2fs/ext2_extern.h14
-rw-r--r--sys/fs/ext2fs/ext2_inode.c22
-rw-r--r--sys/fs/ext2fs/ext2_subr.c2
-rw-r--r--sys/fs/ext2fs/ext2_vnops.c2
-rw-r--r--sys/fs/ext2fs/inode.h6
8 files changed, 48 insertions, 44 deletions
diff --git a/sys/fs/ext2fs/ext2_alloc.c b/sys/fs/ext2fs/ext2_alloc.c
index 9bc4714..b8ea159 100644
--- a/sys/fs/ext2fs/ext2_alloc.c
+++ b/sys/fs/ext2fs/ext2_alloc.c
@@ -80,8 +80,8 @@ static daddr_t ext2_mapsearch(struct m_ext2fs *, char *, daddr_t);
* available block is located.
*/
int
-ext2_alloc(struct inode *ip, int32_t lbn, int32_t bpref, int size,
- struct ucred *cred, int32_t *bnp)
+ext2_alloc(struct inode *ip, daddr_t lbn, e4fs_daddr_t bpref, int size,
+ struct ucred *cred, e4fs_daddr_t *bnp)
{
struct m_ext2fs *fs;
struct ext2mount *ump;
@@ -166,7 +166,8 @@ ext2_reallocblks(struct vop_reallocblks_args *ap)
struct cluster_save *buflist;
struct indir start_ap[NIADDR + 1], end_ap[NIADDR + 1], *idp;
e2fs_lbn_t start_lbn, end_lbn;
- int32_t soff, newblk, blkno;
+ int soff;
+ e2fs_daddr_t newblk, blkno;
int i, len, start_lvl, end_lvl, pref, ssize;
if (doreallocblks == 0)
@@ -250,7 +251,7 @@ ext2_reallocblks(struct vop_reallocblks_args *ap)
/*
* Search the block map looking for an allocation of the desired size.
*/
- if ((newblk = (int32_t)ext2_hashalloc(ip, dtog(fs, pref), pref,
+ if ((newblk = (e2fs_daddr_t)ext2_hashalloc(ip, dtog(fs, pref), pref,
len, ext2_clusteralloc)) == 0){
EXT2_UNLOCK(ump);
goto fail;
@@ -550,9 +551,9 @@ ext2_dirpref(struct inode *pip)
* of the above. Then, blocknr tells us the number of the block
* that will hold the pointer
*/
-int32_t
-ext2_blkpref(struct inode *ip, e2fs_lbn_t lbn, int indx, int32_t *bap,
- int32_t blocknr)
+e4fs_daddr_t
+ext2_blkpref(struct inode *ip, e2fs_lbn_t lbn, int indx, e2fs_daddr_t *bap,
+ e2fs_daddr_t blocknr)
{
int tmp;
mtx_assert(EXT2_MTX(ip->i_ump), MA_OWNED);
@@ -575,7 +576,7 @@ ext2_blkpref(struct inode *ip, e2fs_lbn_t lbn, int indx, int32_t *bap,
follow the rule that a block should be allocated near its inode
*/
return blocknr ? blocknr :
- (int32_t)(ip->i_block_group *
+ (e2fs_daddr_t)(ip->i_block_group *
EXT2_BLOCKS_PER_GROUP(ip->i_e2fs)) +
ip->i_e2fs->e2fs->e2fs_first_dblock;
}
@@ -955,7 +956,7 @@ gotit:
*
*/
void
-ext2_blkfree(struct inode *ip, int32_t bno, long size)
+ext2_blkfree(struct inode *ip, e4fs_daddr_t bno, long size)
{
struct m_ext2fs *fs;
struct buf *bp;
diff --git a/sys/fs/ext2fs/ext2_balloc.c b/sys/fs/ext2fs/ext2_balloc.c
index d1efc68..9e48f56 100644
--- a/sys/fs/ext2fs/ext2_balloc.c
+++ b/sys/fs/ext2fs/ext2_balloc.c
@@ -65,8 +65,8 @@ ext2_balloc(struct inode *ip, e2fs_lbn_t lbn, int size, struct ucred *cred,
struct buf *bp, *nbp;
struct vnode *vp = ITOV(ip);
struct indir indirs[NIADDR + 2];
- uint32_t nb, newb;
- int32_t *bap, pref;
+ e4fs_daddr_t nb, newb;
+ e2fs_daddr_t *bap, pref;
int osize, nsize, num, i, error;
*bpp = NULL;
@@ -195,7 +195,7 @@ ext2_balloc(struct inode *ip, e2fs_lbn_t lbn, int size, struct ucred *cred,
brelse(bp);
return (error);
}
- bap = (int32_t *)bp->b_data;
+ bap = (e2fs_daddr_t *)bp->b_data;
nb = bap[indirs[i].in_off];
if (i == num)
break;
diff --git a/sys/fs/ext2fs/ext2_bmap.c b/sys/fs/ext2fs/ext2_bmap.c
index 73cc0c5..29cd7af 100644
--- a/sys/fs/ext2fs/ext2_bmap.c
+++ b/sys/fs/ext2fs/ext2_bmap.c
@@ -62,7 +62,7 @@ static int ext4_bmapext(struct vnode *, int32_t, int64_t *, int *, int *);
int
ext2_bmap(struct vop_bmap_args *ap)
{
- int64_t blkno;
+ daddr_t blkno;
int error;
/*
@@ -139,7 +139,7 @@ ext4_bmapext(struct vnode *vp, int32_t bn, int64_t *bnp, int *runp, int *runb)
*/
int
-ext2_bmaparray(struct vnode *vp, int32_t bn, int64_t *bnp, int *runp, int *runb)
+ext2_bmaparray(struct vnode *vp, daddr_t bn, daddr_t *bnp, int *runp, int *runb)
{
struct inode *ip;
struct buf *bp;
@@ -182,7 +182,7 @@ ext2_bmaparray(struct vnode *vp, int32_t bn, int64_t *bnp, int *runp, int *runb)
if (*bnp == 0) {
*bnp = -1;
} else if (runp) {
- int32_t bnb = bn;
+ daddr_t bnb = bn;
for (++bn; bn < NDADDR && *runp < maxrun &&
is_sequential(ump, ip->i_db[bn - 1], ip->i_db[bn]);
++bn, ++*runp);
@@ -190,7 +190,7 @@ ext2_bmaparray(struct vnode *vp, int32_t bn, int64_t *bnp, int *runp, int *runb)
if (runb && (bn > 0)) {
for (--bn; (bn >= 0) && (*runb < maxrun) &&
is_sequential(ump, ip->i_db[bn],
- ip->i_db[bn+1]);
+ ip->i_db[bn + 1]);
--bn, ++*runb);
}
}
@@ -239,19 +239,20 @@ ext2_bmaparray(struct vnode *vp, int32_t bn, int64_t *bnp, int *runp, int *runb)
}
}
- daddr = ((int32_t *)bp->b_data)[ap->in_off];
+ daddr = ((e2fs_daddr_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,
- ((int32_t *)bp->b_data)[bn - 1],
- ((int32_t *)bp->b_data)[bn]);
+ ((e2fs_daddr_t *)bp->b_data)[bn - 1],
+ ((e2fs_daddr_t *)bp->b_data)[bn]);
++bn, ++*runp);
bn = ap->in_off;
if (runb && bn) {
for (--bn; bn >= 0 && *runb < maxrun &&
- is_sequential(ump, ((int32_t *)bp->b_data)[bn],
- ((int32_t *)bp->b_data)[bn+1]);
+ is_sequential(ump,
+ ((e2fs_daddr_t *)bp->b_data)[bn],
+ ((e2fs_daddr_t *)bp->b_data)[bn + 1]);
--bn, ++*runb);
}
}
@@ -287,7 +288,7 @@ ext2_bmaparray(struct vnode *vp, int32_t bn, int64_t *bnp, int *runp, int *runb)
* once with the offset into the page itself.
*/
int
-ext2_getlbns(struct vnode *vp, int32_t bn, struct indir *ap, int *nump)
+ext2_getlbns(struct vnode *vp, daddr_t bn, struct indir *ap, int *nump)
{
long blockcnt;
e2fs_lbn_t metalbn, realbn;
diff --git a/sys/fs/ext2fs/ext2_extern.h b/sys/fs/ext2fs/ext2_extern.h
index 859a978..b6a7dfca 100644
--- a/sys/fs/ext2fs/ext2_extern.h
+++ b/sys/fs/ext2fs/ext2_extern.h
@@ -49,24 +49,24 @@ struct vfsconf;
struct vnode;
int ext2_add_entry(struct vnode *, struct ext2fs_direct_2 *);
-int ext2_alloc(struct inode *,
- int32_t, int32_t, int, struct ucred *, int32_t *);
+int ext2_alloc(struct inode *, daddr_t, e4fs_daddr_t, int,
+ struct ucred *, e4fs_daddr_t *);
int ext2_balloc(struct inode *,
e2fs_lbn_t, int, struct ucred *, struct buf **, int);
int ext2_blkatoff(struct vnode *, off_t, char **, struct buf **);
-void ext2_blkfree(struct inode *, int32_t, long);
-int32_t ext2_blkpref(struct inode *, e2fs_lbn_t, int, int32_t *, int32_t);
+void ext2_blkfree(struct inode *, e4fs_daddr_t, long);
+e4fs_daddr_t ext2_blkpref(struct inode *, e2fs_lbn_t, int, e2fs_daddr_t *,
+ e2fs_daddr_t);
int ext2_bmap(struct vop_bmap_args *);
-int ext2_bmaparray(struct vnode *, int32_t, int64_t *, int *, int *);
+int ext2_bmaparray(struct vnode *, daddr_t, daddr_t *, int *, int *);
void ext2_clusteracct(struct m_ext2fs *, char *, int, daddr_t, int);
void ext2_dirbad(struct inode *ip, doff_t offset, char *how);
void ext2_ei2i(struct ext2fs_dinode *, struct inode *);
-int ext2_getlbns(struct vnode *, int32_t, struct indir *, int *);
+int ext2_getlbns(struct vnode *, daddr_t, struct indir *, int *);
void ext2_i2ei(struct inode *, struct ext2fs_dinode *);
void ext2_itimes(struct vnode *vp);
int ext2_reallocblks(struct vop_reallocblks_args *);
int ext2_reclaim(struct vop_reclaim_args *);
-void ext2_setblock(struct m_ext2fs *, 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 **);
diff --git a/sys/fs/ext2fs/ext2_inode.c b/sys/fs/ext2fs/ext2_inode.c
index d1e872c..11180f0 100644
--- a/sys/fs/ext2fs/ext2_inode.c
+++ b/sys/fs/ext2fs/ext2_inode.c
@@ -54,8 +54,8 @@
#include <fs/ext2fs/fs.h>
#include <fs/ext2fs/ext2_extern.h>
-static int ext2_indirtrunc(struct inode *, int32_t, int32_t, int32_t, int,
- long *);
+static int ext2_indirtrunc(struct inode *, daddr_t, daddr_t,
+ daddr_t, int, e4fs_daddr_t *);
/*
* Update the access, modified, and inode change times as specified by the
@@ -119,7 +119,7 @@ ext2_truncate(struct vnode *vp, off_t length, int flags, struct ucred *cred,
struct m_ext2fs *fs;
struct buf *bp;
int offset, size, level;
- long count, nblocks, blocksreleased = 0;
+ e4fs_daddr_t count, nblocks, blocksreleased = 0;
int error, i, allerror;
off_t osize;
@@ -356,16 +356,16 @@ done:
*/
static int
-ext2_indirtrunc(struct inode *ip, int32_t lbn, int32_t dbn, int32_t lastbn,
- int level, long *countp)
+ext2_indirtrunc(struct inode *ip, daddr_t lbn, daddr_t dbn,
+ daddr_t lastbn, int level, e4fs_daddr_t *countp)
{
struct buf *bp;
struct m_ext2fs *fs = ip->i_e2fs;
struct vnode *vp;
- int32_t *bap, *copy, nb, nlbn, last;
- long blkcount, factor;
- int i, nblocks, blocksreleased = 0;
- int error = 0, allerror = 0;
+ e2fs_daddr_t *bap, *copy;
+ int i, nblocks, error = 0, allerror = 0;
+ e2fs_lbn_t nb, nlbn, last;
+ e4fs_daddr_t blkcount, factor, blocksreleased = 0;
/*
* Calculate index in current block of last
@@ -405,11 +405,11 @@ ext2_indirtrunc(struct inode *ip, int32_t lbn, int32_t dbn, int32_t lastbn,
return (error);
}
- bap = (int32_t *)bp->b_data;
+ bap = (e2fs_daddr_t *)bp->b_data;
copy = malloc(fs->e2fs_bsize, M_TEMP, M_WAITOK);
bcopy((caddr_t)bap, (caddr_t)copy, (u_int)fs->e2fs_bsize);
bzero((caddr_t)&bap[last + 1],
- (u_int)(NINDIR(fs) - (last + 1)) * sizeof(int32_t));
+ (NINDIR(fs) - (last + 1)) * sizeof(e2fs_daddr_t));
if (last == -1)
bp->b_flags |= B_INVAL;
if (DOINGASYNC(vp)) {
diff --git a/sys/fs/ext2fs/ext2_subr.c b/sys/fs/ext2fs/ext2_subr.c
index cd4a06b..7ff7079 100644
--- a/sys/fs/ext2fs/ext2_subr.c
+++ b/sys/fs/ext2fs/ext2_subr.c
@@ -135,7 +135,7 @@ void
ext2_checkoverlap(struct buf *bp, struct inode *ip)
{
struct buf *ebp, *ep;
- int32_t start, last;
+ e4fs_daddr_t start, last;
struct vnode *vp;
ebp = &buf[nbuf];
diff --git a/sys/fs/ext2fs/ext2_vnops.c b/sys/fs/ext2fs/ext2_vnops.c
index e26a31d..c5be7d0 100644
--- a/sys/fs/ext2fs/ext2_vnops.c
+++ b/sys/fs/ext2fs/ext2_vnops.c
@@ -1329,7 +1329,7 @@ ext2_strategy(struct vop_strategy_args *ap)
struct vnode *vp = ap->a_vp;
struct inode *ip;
struct bufobj *bo;
- int64_t blkno;
+ daddr_t blkno;
int error;
ip = VTOI(vp);
diff --git a/sys/fs/ext2fs/inode.h b/sys/fs/ext2fs/inode.h
index 4ffb2bb..e2016c5 100644
--- a/sys/fs/ext2fs/inode.h
+++ b/sys/fs/ext2fs/inode.h
@@ -54,9 +54,11 @@
#define NIADDR 3 /* Indirect addresses in inode. */
/*
- * The size of physical and logical block numbers and time fields in UFS.
+ * The size of physical and logical block numbers in EXT2FS.
*/
-typedef int32_t e2fs_lbn_t;
+typedef uint32_t e2fs_daddr_t;
+typedef int64_t e2fs_lbn_t;
+typedef int64_t e4fs_daddr_t;
/*
* The inode is used to describe each active (or recently active) file in the
OpenPOWER on IntegriCloud