diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2012-10-25 20:58:05 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2012-10-25 20:58:05 +0000 |
commit | 935ff48eb6fee0b1b8f8a54a74be69d5ec9144e3 (patch) | |
tree | bcfef546a7fe02381287ed3c3918fee18d865c79 /usr.sbin/ldomctl | |
parent | cf232de1046b1495d1684f7e3cb59a51160a58d8 (diff) |
Some more machine description manipulation stuff.
Diffstat (limited to 'usr.sbin/ldomctl')
-rw-r--r-- | usr.sbin/ldomctl/mdesc.c | 16 | ||||
-rw-r--r-- | usr.sbin/ldomctl/mdesc.h | 10 |
2 files changed, 24 insertions, 2 deletions
diff --git a/usr.sbin/ldomctl/mdesc.c b/usr.sbin/ldomctl/mdesc.c index 07dfd60ba25..11c9a8c14df 100644 --- a/usr.sbin/ldomctl/mdesc.c +++ b/usr.sbin/ldomctl/mdesc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mdesc.c,v 1.2 2012/10/21 12:56:45 kettenis Exp $ */ +/* $OpenBSD: mdesc.c,v 1.3 2012/10/25 20:58:04 kettenis Exp $ */ /* * Copyright (c) 2012 Mark Kettenis @@ -246,6 +246,20 @@ md_get_prop_val(struct md *md, struct md_node *node, const char *name, } bool +md_set_prop_val(struct md *md, struct md_node *node, const char *name, + uint64_t val) +{ + struct md_prop *prop; + + prop = md_find_prop(md, node, name); + if (prop == NULL || prop->tag != MD_PROP_VAL) + return false; + + prop->d.val = val; + return true; +} + +bool md_get_prop_str(struct md *md, struct md_node *node, const char *name, const char **str) { diff --git a/usr.sbin/ldomctl/mdesc.h b/usr.sbin/ldomctl/mdesc.h index 586d37c87b4..61676e8d6a0 100644 --- a/usr.sbin/ldomctl/mdesc.h +++ b/usr.sbin/ldomctl/mdesc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mdesc.h,v 1.2 2012/10/21 12:56:45 kettenis Exp $ */ +/* $OpenBSD: mdesc.h,v 1.3 2012/10/25 20:58:04 kettenis Exp $ */ /* * Copyright (c) 2012 Mark Kettenis @@ -109,12 +109,20 @@ struct md_prop *md_add_prop_data(struct md *, struct md_node *, const char *, const uint8_t *, size_t); struct md_prop *md_add_prop_arc(struct md *, struct md_node *, const char *,struct md_node *); +void md_delete_prop(struct md *, struct md_node *, struct md_prop *); struct md_node *md_find_node(struct md *, const char *); +struct md_node *md_add_node(struct md *, const char *); +void md_link_node(struct md *, struct md_node *, struct md_node *); struct md_prop *md_find_prop(struct md *, struct md_node *, const char *); bool md_get_prop_val(struct md *, struct md_node *, const char *, uint64_t *); +bool md_set_prop_val(struct md *, struct md_node *, const char *, uint64_t); bool md_get_prop_str(struct md *, struct md_node *, const char *, const char **); struct md *md_ingest(void *, size_t); +size_t md_exhume(struct md *md, void **); + +struct md *md_read(const char *); +void md_write(struct md *, const char *); |