mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-15 10:17:20 +00:00
Move ffs_isfreeblock() to ffs_alloc.c and make it static.
Sponsored by: DARPA & NAI Labs.
This commit is contained in:
parent
3c7d68acc8
commit
17b1994bbe
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=100925
@ -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.
|
||||
*
|
||||
|
@ -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 *,
|
||||
|
@ -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
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user