summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToomas Soome <tsoome@me.com>2015-06-14 00:00:08 +0300
committerRobert Mustacchi <rm@joyent.com>2016-09-22 11:43:40 -0700
commita6424c753d6e2f0f04fb65b11e9f9c04445ccbae (patch)
treee01a8e8dcbc1afb671dc777fdcaee57f9ca309e8
parentc262cbbc8301f7c884fd4800056ee51ba75d931c (diff)
downloadillumos-joyent-a6424c753d6e2f0f04fb65b11e9f9c04445ccbae.tar.gz
6704 svc.startd: replace grub_get_boot_args with be_get_boot_args (loader project)
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com> Reviewed by: Richard Lowe <richlowe@richlowe.net> Approved by: Robert Mustacchi <rm@joyent.com>
-rw-r--r--usr/src/cmd/svc/startd/Makefile3
-rw-r--r--usr/src/cmd/svc/startd/graph.c45
2 files changed, 22 insertions, 26 deletions
diff --git a/usr/src/cmd/svc/startd/Makefile b/usr/src/cmd/svc/startd/Makefile
index 1a29300a68..0479bc97b8 100644
--- a/usr/src/cmd/svc/startd/Makefile
+++ b/usr/src/cmd/svc/startd/Makefile
@@ -21,6 +21,7 @@
#
# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright 2012 Milan Jurik. All rights reserved.
+# Copyright 2016 Toomas Soome <tsoome@me.com>
#
PROG = svc.startd
@@ -93,7 +94,7 @@ LDLIBS += \
-lumem \
-luutil
-LDLIBS_i386 += -lgrubmgmt
+LDLIBS_i386 += -lbe
LDLIBS += $(LDLIBS_$(MACH)) -L $(ROOT)/lib/fm -lfmevent
LDFLAGS += -R /lib/fm
diff --git a/usr/src/cmd/svc/startd/graph.c b/usr/src/cmd/svc/startd/graph.c
index c831c99301..772253fa03 100644
--- a/usr/src/cmd/svc/startd/graph.c
+++ b/usr/src/cmd/svc/startd/graph.c
@@ -22,6 +22,7 @@
/*
* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, Syneto S.R.L. All rights reserved.
+ * Copyright 2016 Toomas Soome <tsoome@me.com>
*/
/*
@@ -159,9 +160,9 @@
#include <sys/statvfs.h>
#include <sys/uadmin.h>
#include <zone.h>
-#if defined(__i386)
-#include <libgrubmgmt.h>
-#endif /* __i386 */
+#if defined(__x86)
+#include <libbe.h>
+#endif /* __x86 */
#include "startd.h"
#include "protocol.h"
@@ -530,8 +531,8 @@ graph_walk_dependents(graph_vertex_t *v, void (*func)(graph_vertex_t *, void *),
}
static void
-graph_walk_dependencies(graph_vertex_t *v, void (*func)(graph_vertex_t *,
- void *), void *arg)
+graph_walk_dependencies(graph_vertex_t *v,
+ void (*func)(graph_vertex_t *, void *), void *arg)
{
graph_edge_t *e;
@@ -3585,9 +3586,9 @@ do_uadmin(void)
struct tm nowtm;
char down_buf[256], time_buf[256];
uintptr_t mdep;
-#if defined(__i386)
- grub_boot_args_t fbarg;
-#endif /* __i386 */
+#if defined(__x86)
+ char *fbarg = NULL;
+#endif /* __x86 */
mdep = NULL;
fd = creat(resetting, 0777);
@@ -3638,27 +3639,22 @@ do_uadmin(void)
* print warning and fall back to regular reboot.
*/
if (halting == AD_FASTREBOOT) {
-#if defined(__i386)
- int rc;
-
- if ((rc = grub_get_boot_args(&fbarg, NULL,
- GRUB_ENTRY_DEFAULT)) == 0) {
- mdep = (uintptr_t)&fbarg.gba_bootargs;
+#if defined(__x86)
+ if (be_get_boot_args(&fbarg, BE_ENTRY_DEFAULT) == 0) {
+ mdep = (uintptr_t)fbarg;
} else {
/*
- * Failed to read GRUB menu, fall back to normal reboot
+ * Failed to read BE info, fall back to normal reboot
*/
halting = AD_BOOT;
- uu_warn("Failed to process GRUB menu entry "
- "for fast reboot.\n\t%s\n"
- "Falling back to regular reboot.\n",
- grub_strerror(rc));
+ uu_warn("Failed to get fast reboot arguments.\n"
+ "Falling back to regular reboot.\n");
}
-#else /* __i386 */
+#else /* __x86 */
halting = AD_BOOT;
uu_warn("Fast reboot configured, but not supported by "
"this ISA\n");
-#endif /* __i386 */
+#endif /* __x86 */
}
fork_with_timeout("/sbin/umountall -l", 0, 5);
@@ -3714,11 +3710,10 @@ do_uadmin(void)
(void) uadmin(A_SHUTDOWN, halting, mdep);
uu_warn("uadmin() failed");
-#if defined(__i386)
- /* uadmin fail, cleanup grub_boot_args */
+#if defined(__x86)
if (halting == AD_FASTREBOOT)
- grub_cleanup_boot_args(&fbarg);
-#endif /* __i386 */
+ free(fbarg);
+#endif /* __x86 */
if (remove(resetting) != 0 && errno != ENOENT)
uu_warn("Could not remove \"%s\"", resetting);