mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-19 10:53:58 +00:00
Style fixes and assertions improvements.
MFC after: 1 month
This commit is contained in:
parent
8d169d9ff0
commit
7aef754274
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=237075
@ -242,8 +242,10 @@ fd_last_used(struct filedesc *fdp, int size)
|
|||||||
static int
|
static int
|
||||||
fdisused(struct filedesc *fdp, int fd)
|
fdisused(struct filedesc *fdp, int fd)
|
||||||
{
|
{
|
||||||
|
|
||||||
KASSERT(fd >= 0 && fd < fdp->fd_nfiles,
|
KASSERT(fd >= 0 && fd < fdp->fd_nfiles,
|
||||||
("file descriptor %d out of range (0, %d)", fd, fdp->fd_nfiles));
|
("file descriptor %d out of range (0, %d)", fd, fdp->fd_nfiles));
|
||||||
|
|
||||||
return ((fdp->fd_map[NDSLOT(fd)] & NDBIT(fd)) != 0);
|
return ((fdp->fd_map[NDSLOT(fd)] & NDBIT(fd)) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -255,8 +257,8 @@ fdused(struct filedesc *fdp, int fd)
|
|||||||
{
|
{
|
||||||
|
|
||||||
FILEDESC_XLOCK_ASSERT(fdp);
|
FILEDESC_XLOCK_ASSERT(fdp);
|
||||||
KASSERT(!fdisused(fdp, fd),
|
|
||||||
("fd already used"));
|
KASSERT(!fdisused(fdp, fd), ("fd=%d is already used", fd));
|
||||||
|
|
||||||
fdp->fd_map[NDSLOT(fd)] |= NDBIT(fd);
|
fdp->fd_map[NDSLOT(fd)] |= NDBIT(fd);
|
||||||
if (fd > fdp->fd_lastfile)
|
if (fd > fdp->fd_lastfile)
|
||||||
@ -273,10 +275,9 @@ fdunused(struct filedesc *fdp, int fd)
|
|||||||
{
|
{
|
||||||
|
|
||||||
FILEDESC_XLOCK_ASSERT(fdp);
|
FILEDESC_XLOCK_ASSERT(fdp);
|
||||||
KASSERT(fdisused(fdp, fd),
|
|
||||||
("fd is already unused"));
|
KASSERT(fdisused(fdp, fd), ("fd=%d is already unused", fd));
|
||||||
KASSERT(fdp->fd_ofiles[fd] == NULL,
|
KASSERT(fdp->fd_ofiles[fd] == NULL, ("fd=%d is still in use", fd));
|
||||||
("fd is still in use"));
|
|
||||||
|
|
||||||
fdp->fd_map[NDSLOT(fd)] &= ~NDBIT(fd);
|
fdp->fd_map[NDSLOT(fd)] &= ~NDBIT(fd);
|
||||||
if (fd < fdp->fd_freefile)
|
if (fd < fdp->fd_freefile)
|
||||||
|
Loading…
Reference in New Issue
Block a user