Move ffs_isfreeblock() to ffs_alloc.c and make it static.

Sponsored by: DARPA & NAI Labs.
This commit is contained in:
phk 2002-07-30 11:54:48 +00:00
parent a92e2554ad
commit 4aae061a5c
3 changed files with 25 additions and 26 deletions

View File

@ -1643,6 +1643,31 @@ ffs_nodealloccg(ip, cg, ipref, mode)
return (cg * fs->fs_ipg + ipref);
}
/*
* check if a block is free
*/
static int
ffs_isfreeblock(struct fs *fs, unsigned char *cp, ufs1_daddr_t h)
struct fs *fs;
unsigned char *cp;
ufs1_daddr_t h;
{
switch ((int)fs->fs_frag) {
case 8:
return (cp[h] == 0);
case 4:
return ((cp[h >> 1] & (0x0f << ((h & 0x1) << 2))) == 0);
case 2:
return ((cp[h >> 2] & (0x03 << ((h & 0x3) << 1))) == 0);
case 1:
return ((cp[h >> 3] & (0x01 << (h & 0x7))) == 0);
default:
panic("ffs_isfreeblock");
}
return (0);
}
/*
* Free a block or fragment.
*

View File

@ -70,7 +70,6 @@ int ffs_flushfiles(struct mount *, int, struct thread *);
void ffs_fragacct(struct fs *, int, int32_t [], int);
int ffs_freefile(struct fs *, struct vnode *, ino_t, int );
int ffs_isblock(struct fs *, u_char *, ufs1_daddr_t);
int ffs_isfreeblock(struct fs *, unsigned char *, ufs1_daddr_t);
void ffs_load_inode(struct buf *, struct inode *, struct malloc_type *,
struct fs *, ino_t);
int ffs_mountfs(struct vnode *, struct mount *, struct thread *,

View File

@ -239,31 +239,6 @@ ffs_isblock(fs, cp, h)
return (0);
}
/*
* check if a block is free
*/
int
ffs_isfreeblock(fs, cp, h)
struct fs *fs;
unsigned char *cp;
ufs1_daddr_t h;
{
switch ((int)fs->fs_frag) {
case 8:
return (cp[h] == 0);
case 4:
return ((cp[h >> 1] & (0x0f << ((h & 0x1) << 2))) == 0);
case 2:
return ((cp[h >> 2] & (0x03 << ((h & 0x3) << 1))) == 0);
case 1:
return ((cp[h >> 3] & (0x01 << (h & 0x7))) == 0);
default:
panic("ffs_isfreeblock");
}
return (0);
}
/*
* take a block out of the map
*/