[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/2] Add functions to iterate the IO space list.
From: |
John Darrington |
Subject: |
[PATCH 1/2] Add functions to iterate the IO space list. |
Date: |
Sat, 22 Feb 2020 10:38:18 +0100 |
---
ChangeLog | 9 +++++++++
src/ios.c | 18 ++++++++++++++++++
src/ios.h | 14 ++++++++++++++
3 files changed, 41 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 903d80c5..2b07ae34 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2020-02-22 John Darrington <address@hidden>
+
+ * src/ios.c (ios_begin): New function.
+ * src/ios.c (ios_end): New function.
+ * src/ios.c (ios_next): New function.
+ * src/ios.h (ios_begin): New declaration.
+ * src/ios.h (ios_end): New declaration.
+ * src/ios.h (ios_next): New declaration.
+
2020-02-21 Jose E. Marchesi <address@hidden>
* testsuite/poke.pkl/sizeof-1.pk: New test.
diff --git a/src/ios.c b/src/ios.c
index d6b6735d..75eacdaf 100644
--- a/src/ios.c
+++ b/src/ios.c
@@ -317,6 +317,24 @@ ios_set_bias (ios io, ios_off bias)
io->bias = bias;
}
+ios
+ios_begin (void)
+{
+ return io_list;
+}
+
+bool
+ios_end (const ios io)
+{
+ return (io == NULL);
+}
+
+ios
+ios_next (const ios io)
+{
+ return io->next;
+}
+
void
ios_map (ios_map_fn cb, void *data)
{
diff --git a/src/ios.h b/src/ios.h
index 377510ef..cbe613f9 100644
--- a/src/ios.h
+++ b/src/ios.h
@@ -21,6 +21,7 @@
#include <config.h>
#include <stdint.h>
+#include <stdbool.h>
/* The following two functions intialize and shutdown the IO poke
subsystem. */
@@ -190,6 +191,19 @@ ios ios_search_by_id (int id);
int ios_get_id (ios io);
+/* Return the first IO space. */
+
+ios ios_begin (void);
+
+/* Return the space following IO. */
+
+ios ios_next (const ios io);
+
+/* Return true iff IO is past the last one. */
+
+bool ios_end (const ios io);
+
+
/* Map over all the open IO spaces executing a handler. */
typedef void (*ios_map_fn) (ios io, void *data);
--
2.20.1
- [PATCH 1/2] Add functions to iterate the IO space list.,
John Darrington <=