summaryrefslogtreecommitdiff
path: root/bootadm/debian/patches/bootadm-avoid-smf.patch
blob: dd85cd9549283405e4dbde5d057646051077c71a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
Index: bootadm/usr/src/cmd/boot/bootadm/Makefile
===================================================================
--- bootadm.orig/usr/src/cmd/boot/bootadm/Makefile	2012-12-29 21:54:13.808947514 +0400
+++ bootadm/usr/src/cmd/boot/bootadm/Makefile	2012-12-29 22:14:02.412091491 +0400
@@ -36,7 +36,7 @@
 .KEEP_STATE:
 
 LDLIBS_i386= -lfdisk
-LDLIBS +=	-lnvpair -lgen -lefi -lscf -lz $(LDLIBS_$(MACH))
+LDLIBS +=	-lnvpair -lgen -lefi -lz $(LDLIBS_$(MACH))
 
 # Writing into string literals is incorrect.  We need to match gcc's
 # behavior, which causes us to take SIGSEGV on such a write.
Index: bootadm/usr/src/cmd/boot/bootadm/bootadm.c
===================================================================
--- bootadm.orig/usr/src/cmd/boot/bootadm/bootadm.c	2012-12-29 21:55:04.332345403 +0400
+++ bootadm/usr/src/cmd/boot/bootadm/bootadm.c	2012-12-29 22:13:48.635223338 +0400
@@ -59,7 +59,6 @@
 #include <libgen.h>
 #include <sys/sysmacros.h>
 #include <sys/elf.h>
-#include <libscf.h>
 #include <zlib.h>
 #include <sys/lockfs.h>
 #include <sys/filio.h>
@@ -7370,92 +7369,6 @@
 	return (0);
 }
 
-/*
- * Certain services needed to run metastat successfully may not
- * be enabled. Enable them now.
- */
-/*
- * Checks if the specified service is online
- * Returns: 	1 if the service is online
- *		0 if the service is not online
- *		-1 on error
- */
-static int
-is_svc_online(char *svc)
-{
-	char			*state;
-	const char		*fcn = "is_svc_online()";
-
-	BAM_DPRINTF((D_FUNC_ENTRY1, fcn, svc));
-
-	state = smf_get_state(svc);
-	INJECT_ERROR2("GET_SVC_STATE", free(state), state = NULL);
-	if (state == NULL) {
-		bam_error(GET_SVC_STATE_ERR, svc);
-		return (-1);
-	}
-	BAM_DPRINTF((D_GOT_SVC_STATUS, fcn, svc));
-
-	if (strcmp(state, SCF_STATE_STRING_ONLINE) == 0) {
-		BAM_DPRINTF((D_SVC_ONLINE, fcn, svc));
-		free(state);
-		return (1);
-	}
-
-	BAM_DPRINTF((D_SVC_NOT_ONLINE, fcn, state, svc));
-
-	free(state);
-
-	return (0);
-}
-
-static int
-enable_svc(char *svc)
-{
-	int			ret;
-	int			sleeptime;
-	const char		*fcn = "enable_svc()";
-
-	ret = is_svc_online(svc);
-	if (ret == -1) {
-		bam_error(SVC_IS_ONLINE_FAILED, svc);
-		return (-1);
-	} else if (ret == 1) {
-		BAM_DPRINTF((D_SVC_ALREADY_ONLINE, fcn, svc));
-		return (0);
-	}
-
-	/* Service is not enabled. Enable it now. */
-	ret = smf_enable_instance(svc, 0);
-	INJECT_ERROR1("ENABLE_SVC_FAILED", ret = -1);
-	if (ret != 0) {
-		bam_error(ENABLE_SVC_FAILED, svc);
-		return (-1);
-	}
-
-	BAM_DPRINTF((D_SVC_ONLINE_INITIATED, fcn, svc));
-
-	sleeptime = 0;
-	do {
-		ret = is_svc_online(svc);
-		INJECT_ERROR1("SVC_ONLINE_SUCCESS", ret = 1);
-		INJECT_ERROR1("SVC_ONLINE_FAILURE", ret = -1);
-		INJECT_ERROR1("SVC_ONLINE_NOTYET", ret = 0);
-		if (ret == -1) {
-			bam_error(ERR_SVC_GET_ONLINE, svc);
-			return (-1);
-		} else if (ret == 1) {
-			BAM_DPRINTF((D_SVC_NOW_ONLINE, fcn, svc));
-			return (1);
-		}
-		(void) sleep(1);
-	} while (++sleeptime < 60);
-
-	bam_error(TIMEOUT_ENABLE_SVC, svc);
-
-	return (-1);
-}
-
 static int
 ufs_get_physical(char *special, char ***physarray, int *n)
 {
@@ -7495,11 +7408,6 @@
 
 	BAM_DPRINTF((D_UFS_SVM_SHORT, fcn, special, shortname));
 
-	svc = "network/rpc/meta:default";
-	if (enable_svc(svc) == -1) {
-		bam_error(UFS_SVM_METASTAT_SVC_ERR, svc);
-	}
-
 	(void) snprintf(cmd, sizeof (cmd), "/sbin/metastat -p %s", shortname);
 
 	ret = exec_cmd(cmd, &flist);