diff options
Diffstat (limited to 'sys/fs/ext2fs/ext2_lookup.c')
-rw-r--r-- | sys/fs/ext2fs/ext2_lookup.c | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/sys/fs/ext2fs/ext2_lookup.c b/sys/fs/ext2fs/ext2_lookup.c index 819077c..922cb58 100644 --- a/sys/fs/ext2fs/ext2_lookup.c +++ b/sys/fs/ext2fs/ext2_lookup.c @@ -238,7 +238,7 @@ ext2_readdir(struct vop_readdir_args *ap) nextentry: offset += dp->e2d_reclen; dp = (struct ext2fs_direct_2 *)((caddr_t)dp + - dp->e2d_reclen); + dp->e2d_reclen); } bqrelse(bp); uio->uio_offset = offset; @@ -324,7 +324,7 @@ ext2_lookup_ino(struct vnode *vdp, struct vnode **vpp, struct componentname *cnp int ltype; int entry_found = 0; - int DIRBLKSIZ = VTOI(vdp)->i_e2fs->e2fs_bsize; + int DIRBLKSIZ = VTOI(vdp)->i_e2fs->e2fs_bsize; if (vpp != NULL) *vpp = NULL; @@ -350,11 +350,11 @@ restart: (flags & ISLASTCN)) { ss.slotstatus = NONE; ss.slotneeded = EXT2_DIR_REC_LEN(cnp->cn_namelen); - /* was - ss.slotneeded = (sizeof(struct direct) - MAXNAMLEN + - cnp->cn_namelen + 3) &~ 3; */ + /* + * was ss.slotneeded = (sizeof(struct direct) - MAXNAMLEN + + * cnp->cn_namelen + 3) &~ 3; + */ } - /* * Try to lookup dir entry using htree directory index. * @@ -365,11 +365,11 @@ restart: numdirpasses = 1; entryoffsetinblock = 0; switch (ext2_htree_lookup(dp, cnp->cn_nameptr, cnp->cn_namelen, - &bp, &entryoffsetinblock, &i_offset, &prevoff, - &enduseful, &ss)) { + &bp, &entryoffsetinblock, &i_offset, &prevoff, + &enduseful, &ss)) { case 0: ep = (struct ext2fs_direct_2 *)((char *)bp->b_data + - (i_offset & bmask)); + (i_offset & bmask)); goto foundentry; case ENOENT: i_offset = roundup2(dp->i_size, DIRBLKSIZ); @@ -433,16 +433,16 @@ searchloop: ss.slotfreespace = 0; } error = ext2_search_dirblock(dp, bp->b_data, &entry_found, - cnp->cn_nameptr, cnp->cn_namelen, - &entryoffsetinblock, &i_offset, &prevoff, - &enduseful, &ss); + cnp->cn_nameptr, cnp->cn_namelen, + &entryoffsetinblock, &i_offset, &prevoff, + &enduseful, &ss); if (error != 0) { brelse(bp); return (error); } if (entry_found) { ep = (struct ext2fs_direct_2 *)((char *)bp->b_data + - (entryoffsetinblock & bmask)); + (entryoffsetinblock & bmask)); foundentry: ino = ep->e2d_ino; goto found; @@ -527,9 +527,9 @@ found: * of this entry. */ if (entryoffsetinblock + EXT2_DIR_REC_LEN(ep->e2d_namlen) - > dp->i_size) { + > dp->i_size) { ext2_dirbad(dp, i_offset, "i_size too small"); - dp->i_size = entryoffsetinblock+EXT2_DIR_REC_LEN(ep->e2d_namlen); + dp->i_size = entryoffsetinblock + EXT2_DIR_REC_LEN(ep->e2d_namlen); dp->i_flag |= IN_CHANGE | IN_UPDATE; } brelse(bp); @@ -678,7 +678,7 @@ found: if (ltype != VOP_ISLOCKED(vdp)) { if (ltype == LK_EXCLUSIVE) vn_lock(vdp, LK_UPGRADE | LK_RETRY); - else /* if (ltype == LK_SHARED) */ + else /* if (ltype == LK_SHARED) */ vn_lock(vdp, LK_DOWNGRADE | LK_RETRY); } *vpp = vdp; @@ -699,9 +699,9 @@ found: int ext2_search_dirblock(struct inode *ip, void *data, int *foundp, - const char *name, int namelen, int *entryoffsetinblockp, - doff_t *offp, doff_t *prevoffp, doff_t *endusefulp, - struct ext2fs_searchslot *ssp) + const char *name, int namelen, int *entryoffsetinblockp, + doff_t *offp, doff_t *prevoffp, doff_t *endusefulp, + struct ext2fs_searchslot *ssp) { struct vnode *vdp; struct ext2fs_direct_2 *ep, *top; @@ -713,7 +713,7 @@ ext2_search_dirblock(struct inode *ip, void *data, int *foundp, ep = (struct ext2fs_direct_2 *)((char *)data + offset); top = (struct ext2fs_direct_2 *)((char *)data + - bsize - EXT2_DIR_REC_LEN(0)); + bsize - EXT2_DIR_REC_LEN(0)); while (ep < top) { /* @@ -725,6 +725,7 @@ ext2_search_dirblock(struct inode *ip, void *data, int *foundp, if (ep->e2d_reclen == 0 || (dirchk && ext2_dirbadentry(vdp, ep, offset))) { int i; + ext2_dirbad(ip, *offp, "mangled entry"); i = bsize - (offset & (bsize - 1)); *offp += i; @@ -755,13 +756,12 @@ ext2_search_dirblock(struct inode *ip, void *data, int *foundp, if (ssp->slotfreespace >= ssp->slotneeded) { ssp->slotstatus = COMPACT; ssp->slotsize = *offp + - ep->e2d_reclen - - ssp->slotoffset; + ep->e2d_reclen - + ssp->slotoffset; } } } } - /* * Check for a name match. */ @@ -823,9 +823,9 @@ static int ext2_dirbadentry(struct vnode *dp, struct ext2fs_direct_2 *de, int entryoffsetinblock) { - int DIRBLKSIZ = VTOI(dp)->i_e2fs->e2fs_bsize; + int DIRBLKSIZ = VTOI(dp)->i_e2fs->e2fs_bsize; - char * error_msg = NULL; + char *error_msg = NULL; if (de->e2d_reclen < EXT2_DIR_REC_LEN(1)) error_msg = "rec_len is smaller than minimal"; @@ -1199,9 +1199,9 @@ ext2_checkpath(struct inode *source, struct inode *target, struct ucred *cred) break; } error = vn_rdwr(UIO_READ, vp, (caddr_t)&dirbuf, - sizeof(struct dirtemplate), (off_t)0, UIO_SYSSPACE, - IO_NODELOCKED | IO_NOMACCHECK, cred, NOCRED, NULL, - NULL); + sizeof(struct dirtemplate), (off_t)0, UIO_SYSSPACE, + IO_NODELOCKED | IO_NOMACCHECK, cred, NOCRED, NULL, + NULL); if (error != 0) break; namlen = dirbuf.dotdot_type; /* like ufs little-endian */ |