git: fc7e121d88d6 - main - file: Move FILEDESC_FOREACH macros to kern_descrip.c
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 17 Mar 2022 19:40:13 UTC
The branch main has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=fc7e121d88d65aabbb8ce87d8e1d13e3c3cf18eb
commit fc7e121d88d65aabbb8ce87d8e1d13e3c3cf18eb
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2022-03-17 16:58:56 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2022-03-17 19:39:00 +0000
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
---
sys/kern/kern_descrip.c | 12 ++++++++++++
sys/sys/filedesc.h | 11 -----------
2 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index da1eb24cf9c8..b13fc719c2b0 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -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.
diff --git a/sys/sys/filedesc.h b/sys/sys/filedesc.h
index b64a4c4849d9..8ecf7d8cb45e 100644
--- a/sys/sys/filedesc.h
+++ b/sys/sys/filedesc.h
@@ -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