Print this page
10597 would like a way to set NMI behavior at boot
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Andy Fiddaman <andy@omniosce.org>
@@ -2913,28 +2913,38 @@
cbp->iscmp = 0;
cbp->blksize = MAXBSIZE;
return (0);
}
-#define BP_MAX_STRLEN 32
-
/*
- * Get value for given boot property
+ * Get an integer value for given boot property
*/
int
bootprop_getval(const char *prop_name, u_longlong_t *prop_value)
{
int boot_prop_len;
char str[BP_MAX_STRLEN];
u_longlong_t value;
boot_prop_len = BOP_GETPROPLEN(bootops, prop_name);
- if (boot_prop_len < 0 || boot_prop_len > sizeof (str) ||
+ if (boot_prop_len < 0 || boot_prop_len >= sizeof (str) ||
BOP_GETPROP(bootops, prop_name, str) < 0 ||
kobj_getvalue(str, &value) == -1)
return (-1);
if (prop_value)
*prop_value = value;
return (0);
+}
+
+int
+bootprop_getstr(const char *prop_name, char *buf, size_t buflen)
+{
+ int boot_prop_len = BOP_GETPROPLEN(bootops, prop_name);
+
+ if (boot_prop_len < 0 || boot_prop_len >= buflen ||
+ BOP_GETPROP(bootops, prop_name, buf) < 0)
+ return (-1);
+
+ return (0);
}