[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH v3 26/30] monitor: Extract fdset fd flags comparison into a f
From: |
Fabiano Rosas |
Subject: |
[RFC PATCH v3 26/30] monitor: Extract fdset fd flags comparison into a function |
Date: |
Mon, 27 Nov 2023 17:26:08 -0300 |
We're about to add one more condition to the flags comparison that
requires an ifdef. Move the code into a separate function now to make
it cleaner after the next patch.
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
monitor/fds.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/monitor/fds.c b/monitor/fds.c
index 4ec3b7eea9..9a28e4b72b 100644
--- a/monitor/fds.c
+++ b/monitor/fds.c
@@ -406,6 +406,19 @@ AddfdInfo *monitor_fdset_add_fd(int fd, bool has_fdset_id,
int64_t fdset_id,
return fdinfo;
}
+#ifndef _WIN32
+static bool monitor_fdset_flags_match(int flags, int fd_flags)
+{
+ bool match = false;
+
+ if ((flags & O_ACCMODE) == (fd_flags & O_ACCMODE)) {
+ match = true;
+ }
+
+ return match;
+}
+#endif
+
int monitor_fdset_dup_fd_add(int64_t fdset_id, int flags)
{
#ifdef _WIN32
@@ -431,7 +444,7 @@ int monitor_fdset_dup_fd_add(int64_t fdset_id, int flags)
return -1;
}
- if ((flags & O_ACCMODE) == (mon_fd_flags & O_ACCMODE)) {
+ if (monitor_fdset_flags_match(flags, mon_fd_flags)) {
fd = mon_fdset_fd->fd;
break;
}
--
2.35.3
- [RFC PATCH v3 16/30] multifd: Rename MultiFDSendParams::data to compress_data, (continued)
- [RFC PATCH v3 16/30] multifd: Rename MultiFDSendParams::data to compress_data, Fabiano Rosas, 2023/11/27
- [RFC PATCH v3 17/30] migration/multifd: Decouple recv method from pages, Fabiano Rosas, 2023/11/27
- [RFC PATCH v3 18/30] migration/multifd: Allow receiving pages without packets, Fabiano Rosas, 2023/11/27
- [RFC PATCH v3 19/30] migration/ram: Ignore multifd flush when doing fixed-ram migration, Fabiano Rosas, 2023/11/27
- [RFC PATCH v3 20/30] migration/multifd: Support outgoing fixed-ram stream format, Fabiano Rosas, 2023/11/27
- [RFC PATCH v3 21/30] migration/multifd: Support incoming fixed-ram stream format, Fabiano Rosas, 2023/11/27
- [RFC PATCH v3 22/30] tests/qtest: Add a multifd + fixed-ram migration test, Fabiano Rosas, 2023/11/27
- [RFC PATCH v3 23/30] migration: Add direct-io parameter, Fabiano Rosas, 2023/11/27
- [RFC PATCH v3 24/30] tests/qtest: Add a test for migration with direct-io and multifd, Fabiano Rosas, 2023/11/27
- [RFC PATCH v3 25/30] monitor: Honor QMP request for fd removal immediately, Fabiano Rosas, 2023/11/27
- [RFC PATCH v3 26/30] monitor: Extract fdset fd flags comparison into a function,
Fabiano Rosas <=
- [RFC PATCH v3 27/30] monitor: fdset: Match against O_DIRECT, Fabiano Rosas, 2023/11/27
- [RFC PATCH v3 28/30] docs/devel/migration.rst: Document the file transport, Fabiano Rosas, 2023/11/27
- [RFC PATCH v3 30/30] tests/qtest: Add a test for fixed-ram with passing of fds, Fabiano Rosas, 2023/11/27
- [RFC PATCH v3 29/30] migration: Add support for fdset with multifd + file, Fabiano Rosas, 2023/11/27