file: Move FILEDESC_FOREACH macros to kern_descrip.c

They are only used in kern_descrip.c, so make them private.  No
functional change intended.

Discussed with:	mjg
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Mark Johnston 2022-03-17 12:58:56 -04:00
parent c702242292
commit fc7e121d88
2 changed files with 12 additions and 11 deletions

View File

@ -155,6 +155,18 @@ static struct pwd *pwd_alloc(void);
#define NDBIT(x) ((NDSLOTTYPE)1 << ((x) % NDENTRIES))
#define NDSLOTS(x) (((x) + NDENTRIES - 1) / NDENTRIES)
#define FILEDESC_FOREACH_FDE(fdp, _iterator, _fde) \
struct filedesc *_fdp = (fdp); \
int _lastfile = fdlastfile_single(_fdp); \
for (_iterator = 0; _iterator <= _lastfile; _iterator++) \
if ((_fde = &_fdp->fd_ofiles[_iterator])->fde_file != NULL)
#define FILEDESC_FOREACH_FP(fdp, _iterator, _fp) \
struct filedesc *_fdp = (fdp); \
int _lastfile = fdlastfile_single(_fdp); \
for (_iterator = 0; _iterator <= _lastfile; _iterator++) \
if ((_fp = _fdp->fd_ofiles[_iterator].fde_file) != NULL)
/*
* SLIST entry used to keep track of ofiles which must be reclaimed when
* the process exits.

View File

@ -193,17 +193,6 @@ struct filedesc_to_leader {
MPASS(curproc->p_fd == _fdp); \
(curproc->p_numthreads == 1 && refcount_load(&_fdp->fd_refcnt) == 1); \
})
#define FILEDESC_FOREACH_FDE(fdp, _iterator, _fde) \
struct filedesc *_fdp = (fdp); \
int _lastfile = fdlastfile_single(_fdp); \
for (_iterator = 0; _iterator <= _lastfile; _iterator++) \
if ((_fde = &_fdp->fd_ofiles[_iterator])->fde_file != NULL)
#define FILEDESC_FOREACH_FP(fdp, _iterator, _fp) \
struct filedesc *_fdp = (fdp); \
int _lastfile = fdlastfile_single(_fdp); \
for (_iterator = 0; _iterator <= _lastfile; _iterator++) \
if ((_fp = _fdp->fd_ofiles[_iterator].fde_file) != NULL)
#else