Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sparc64 sun4v: Add two new functions to the mdesc a...
details: https://anonhg.NetBSD.org/src/rev/87654c06509a
branches: trunk
changeset: 335664:87654c06509a
user: palle <palle%NetBSD.org@localhost>
date: Mon Jan 19 19:46:08 2015 +0000
description:
sun4v: Add two new functions to the mdesc api: mdesc_find_node_by_idx() and mdesc_next_node()
diffstat:
sys/arch/sparc64/include/mdesc.h | 4 +++-
sys/arch/sparc64/sparc64/mdesc.c | 24 ++++++++++++++++++++----
2 files changed, 23 insertions(+), 5 deletions(-)
diffs (68 lines):
diff -r e082a1b3072f -r 87654c06509a sys/arch/sparc64/include/mdesc.h
--- a/sys/arch/sparc64/include/mdesc.h Mon Jan 19 19:02:35 2015 +0000
+++ b/sys/arch/sparc64/include/mdesc.h Mon Jan 19 19:46:08 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mdesc.h,v 1.1 2015/01/10 22:19:26 palle Exp $ */
+/* $NetBSD: mdesc.h,v 1.2 2015/01/19 19:46:08 palle Exp $ */
/* $OpenBSD: mdesc.h,v 1.3 2014/11/30 22:26:14 kettenis Exp $ */
/*
* Copyright (c) 2009 Mark Kettenis
@@ -48,4 +48,6 @@
int mdesc_find(const char *, uint64_t);
int mdesc_find_child(int, const char *, uint64_t);
int mdesc_find_node(const char *);
+int mdesc_find_node_by_idx(int, const char *);
+int mdesc_next_node(int);
#endif
diff -r e082a1b3072f -r 87654c06509a sys/arch/sparc64/sparc64/mdesc.c
--- a/sys/arch/sparc64/sparc64/mdesc.c Mon Jan 19 19:02:35 2015 +0000
+++ b/sys/arch/sparc64/sparc64/mdesc.c Mon Jan 19 19:46:08 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mdesc.c,v 1.2 2015/01/11 13:40:22 palle Exp $ */
+/* $NetBSD: mdesc.c,v 1.3 2015/01/19 19:46:08 palle Exp $ */
/* $OpenBSD: mdesc.c,v 1.7 2014/11/30 22:26:15 kettenis Exp $ */
/*
* Copyright (c) 2009 Mark Kettenis
@@ -217,19 +217,18 @@
}
int
-mdesc_find_node(const char *name)
+mdesc_find_node_by_idx(int idx, const char *name)
{
struct md_header *hdr;
struct md_element *elem;
const char *name_blk;
const char *str;
- int idx;
hdr = (struct md_header *)mdesc;
elem = (struct md_element *)(mdesc + sizeof(struct md_header));
name_blk = (char *)mdesc + sizeof(struct md_header) + hdr->node_blk_sz;
- for (idx = 0; elem[idx].tag == 'N'; idx = elem[idx].d.val) {
+ for ( ; elem[idx].tag == 'N'; idx = elem[idx].d.val) {
str = name_blk + elem[idx].name_offset;
if (str && strcmp(str, name) == 0)
return (idx);
@@ -237,3 +236,20 @@
return (-1);
}
+
+int
+mdesc_find_node(const char *name)
+{
+ return mdesc_find_node_by_idx(0, name);
+}
+
+int
+mdesc_next_node(int idx)
+{
+ struct md_element *elem;
+
+ elem = (struct md_element *)(mdesc + sizeof(struct md_header));
+
+ return elem[idx].d.val;
+}
+
Home |
Main Index |
Thread Index |
Old Index