@@ -40,6 +40,8 @@ extern void SLOF_set_chosen_int(const char *s, long val);
extern void SLOF_set_chosen_bytes(const char *s, const char *addr, size_t size);
extern void SLOF_encode_bootp_response(void *addr, size_t size);
extern void SLOF_encode_dhcp_response(void *addr, size_t size);
+extern int SLOF_get_property(const char *node, const char *propname,
+ char **addr, int *len);
#define offset_of(type, member) ((long) &((type *)0)->member)
#define container_of(ptr, type, member) ({ \
@@ -209,3 +209,18 @@ void SLOF_encode_dhcp_response(void *addr, size_t size)
{
SLOF_set_chosen_bytes("dhcp-response", addr, size);
}
+
+int SLOF_get_property(const char *node, const char *propname,
+ char **addr, int *len)
+{
+ forth_push((unsigned long)propname);
+ forth_push(strlen(propname));
+ forth_push((unsigned long)node);
+ forth_push(strlen(node));
+ forth_eval("find-node get-property");
+ if (forth_pop())
+ return -1;
+ *len = forth_pop();
+ *addr = (char *)forth_pop();
+ return 0;
+}
We will need to retrieve the UUID of the VM in the libnet code, so we need a function to get the contents from a device tree property. Signed-off-by: Thomas Huth <thuth@redhat.com> --- include/helpers.h | 2 ++ slof/helpers.c | 15 +++++++++++++++ 2 files changed, 17 insertions(+)