From 11f39e79fea8303b3bf5d12fc2dedf2da759a731 Mon Sep 17 00:00:00 2001 From: Toomas Soome Date: Sun, 14 Jun 2015 00:00:08 +0300 Subject: [PATCH] svc.startd: replace grub_get_boot_args with be_get_boot_args illumos issue #6704 --- usr/src/cmd/svc/startd/Makefile | 3 ++- usr/src/cmd/svc/startd/graph.c | 27 ++++++++++----------------- 2 files changed, 12 insertions(+), 18 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 # 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..0b5f2c6b50 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 */ /* @@ -159,9 +160,7 @@ #include #include #include -#if defined(__i386) -#include -#endif /* __i386 */ +#include #include "startd.h" #include "protocol.h" @@ -531,7 +530,7 @@ 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) + void *), void *arg) { graph_edge_t *e; @@ -3586,7 +3585,7 @@ do_uadmin(void) char down_buf[256], time_buf[256]; uintptr_t mdep; #if defined(__i386) - grub_boot_args_t fbarg; + char *fbarg = NULL; #endif /* __i386 */ mdep = NULL; @@ -3639,20 +3638,15 @@ do_uadmin(void) */ 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 (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 */ halting = AD_BOOT; @@ -3715,9 +3709,8 @@ do_uadmin(void) uu_warn("uadmin() failed"); #if defined(__i386) - /* uadmin fail, cleanup grub_boot_args */ if (halting == AD_FASTREBOOT) - grub_cleanup_boot_args(&fbarg); + free(fbarg); #endif /* __i386 */ if (remove(resetting) != 0 && errno != ENOENT) -- 2.11.4.GIT