Line 0
Link Here
|
|
|
1 |
diff -u -ruN ../ipmitool-1.8.9/configure.in ./configure.in |
2 |
--- ../ipmitool-1.8.9/configure.in Wed Mar 7 04:15:35 2007 |
3 |
+++ ./configure.in Sat Dec 15 19:22:10 2007 |
4 |
@@ -239,7 +239,7 @@ |
5 |
fi |
6 |
if test "x$enable_intf_free" = "xyes"; then |
7 |
dnl Determine if you got the right FreeIPMI version |
8 |
- AC_MSG_CHECKING([for good libfreeipmi version]) |
9 |
+ AC_MSG_CHECKING([for libfreeipmi version 0.3.0]) |
10 |
AC_TRY_COMPILE([ |
11 |
#include <sys/types.h> /* For size_t */ |
12 |
#include <stdio.h> /* For NULL */ |
13 |
@@ -253,13 +253,65 @@ |
14 |
0, |
15 |
NULL, |
16 |
0); |
17 |
- ], ac_free_version_good=yes,ac_free_version_good=no) |
18 |
- AC_MSG_RESULT($ac_free_version_good) |
19 |
- if test "x$ac_free_version_good" = "xyes"; then |
20 |
+ ], ac_free_version_0_3_0=yes,ac_free_version_0_3_0=no) |
21 |
+ AC_MSG_RESULT($ac_free_version_0_3_0) |
22 |
+ AC_MSG_CHECKING([for libfreeipmi version 0.4.0]) |
23 |
+ AC_TRY_COMPILE([ |
24 |
+#include <sys/types.h> /* For size_t */ |
25 |
+#include <stdio.h> /* For NULL */ |
26 |
+#include <freeipmi/freeipmi.h> |
27 |
+#include <freeipmi/udm/ipmi-udm.h> |
28 |
+ ], [ |
29 |
+ ipmi_device_t dev = NULL; |
30 |
+ int rv; |
31 |
+ dev = ipmi_device_create(); |
32 |
+ rv = ipmi_open_inband(dev, |
33 |
+ IPMI_DEVICE_KCS, |
34 |
+ 0, |
35 |
+ 0, |
36 |
+ 0, |
37 |
+ NULL, |
38 |
+ 0); |
39 |
+ ], ac_free_version_0_4_0=yes,ac_free_version_0_4_0=no) |
40 |
+ AC_MSG_RESULT($ac_free_version_0_4_0) |
41 |
+ |
42 |
+ AC_MSG_CHECKING([for libfreeipmi version 0.5.0]) |
43 |
+ AC_TRY_COMPILE([ |
44 |
+#include <sys/types.h> /* For size_t */ |
45 |
+#include <stdio.h> /* For NULL */ |
46 |
+#include <freeipmi/freeipmi.h> |
47 |
+#include <freeipmi/udm/ipmi-udm.h> |
48 |
+ ], [ |
49 |
+ ipmi_device_t dev = NULL; |
50 |
+ int rv; |
51 |
+ dev = ipmi_device_create(); |
52 |
+ rv = ipmi_open_inband(dev, |
53 |
+ IPMI_DEVICE_KCS, |
54 |
+ 0, |
55 |
+ 0, |
56 |
+ 0, |
57 |
+ NULL, |
58 |
+ 0, |
59 |
+ 0); |
60 |
+ ], ac_free_version_0_5_0=yes,ac_free_version_0_5_0=no) |
61 |
+ AC_MSG_RESULT($ac_free_version_0_5_0) |
62 |
+ |
63 |
+ if test "x$ac_free_version_0_3_0" = "xyes" \ |
64 |
+ || test "x$ac_free_version_0_4_0" = "xyes" \ |
65 |
+ || test "x$ac_free_version_0_5_0" = "xyes"; then |
66 |
AC_DEFINE(IPMI_INTF_FREE, [1], [Define to 1 to enable FreeIPMI interface.]) |
67 |
AC_SUBST(INTF_FREE, [free]) |
68 |
AC_SUBST(INTF_FREE_LIB, [libintf_free.la]) |
69 |
IPMITOOL_INTF_LIB="$IPMITOOL_INTF_LIB free/libintf_free.la" |
70 |
+ if test "x$ac_free_version_0_3_0" = "xyes"; then |
71 |
+ AC_DEFINE(IPMI_INTF_FREE_VERSION_0_3_0, [1], [Define to 1 for FreeIPMI 0.3.0.]) |
72 |
+ fi |
73 |
+ if test "x$ac_free_version_0_4_0" = "xyes"; then |
74 |
+ AC_DEFINE(IPMI_INTF_FREE_VERSION_0_4_0, [1], [Define to 1 for FreeIPMI 0.4.0.]) |
75 |
+ fi |
76 |
+ if test "x$ac_free_version_0_5_0" = "xyes"; then |
77 |
+ AC_DEFINE(IPMI_INTF_FREE_VERSION_0_5_0, [1], [Define to 1 for FreeIPMI 0.5.0.]) |
78 |
+ fi |
79 |
else |
80 |
enable_intf_free=no |
81 |
fi |
82 |
diff -u -ruN ../ipmitool-1.8.9/src/plugins/free/free.c ./src/plugins/free/free.c |
83 |
--- ../ipmitool-1.8.9/src/plugins/free/free.c Fri Feb 23 00:17:46 2007 |
84 |
+++ ./src/plugins/free/free.c Sat Dec 15 19:22:10 2007 |
85 |
@@ -58,6 +58,7 @@ |
86 |
return -1; |
87 |
} |
88 |
|
89 |
+#if IPMI_INTF_FREE_VERSION_0_3_0 |
90 |
if (!(dev = ipmi_open_inband (IPMI_DEVICE_KCS, |
91 |
0, |
92 |
0, |
93 |
@@ -74,19 +75,80 @@ |
94 |
goto cleanup; |
95 |
} |
96 |
} |
97 |
+#elif IPMI_INTF_FREE_VERSION_0_4_0 |
98 |
+ if (!(dev = ipmi_device_create())) { |
99 |
+ perror("ipmi_open_inband()"); |
100 |
+ goto cleanup; |
101 |
+ } |
102 |
+ if (ipmi_open_inband (dev, |
103 |
+ IPMI_DEVICE_KCS, |
104 |
+ 0, |
105 |
+ 0, |
106 |
+ 0, |
107 |
+ NULL, |
108 |
+ IPMI_FLAGS_DEFAULT) < 0) { |
109 |
+ if (ipmi_open_inband (dev, |
110 |
+ IPMI_DEVICE_SSIF, |
111 |
+ 0, |
112 |
+ 0, |
113 |
+ 0, |
114 |
+ NULL, |
115 |
+ IPMI_FLAGS_DEFAULT) < 0) { |
116 |
+ fprintf(stderr, |
117 |
+ "ipmi_open_inband(): %s\n", |
118 |
+ ipmi_device_strerror(ipmi_device_errnum(dev))); |
119 |
+ goto cleanup; |
120 |
+ } |
121 |
+ } |
122 |
+#elif IPMI_INTF_FREE_VERSION_0_5_0 |
123 |
+ if (!(dev = ipmi_device_create())) { |
124 |
+ perror("ipmi_open_inband()"); |
125 |
+ goto cleanup; |
126 |
+ } |
127 |
+ if (ipmi_open_inband (dev, |
128 |
+ IPMI_DEVICE_KCS, |
129 |
+ 0, |
130 |
+ 0, |
131 |
+ 0, |
132 |
+ NULL, |
133 |
+ 0, |
134 |
+ IPMI_FLAGS_DEFAULT) < 0) { |
135 |
+ if (ipmi_open_inband (dev, |
136 |
+ IPMI_DEVICE_SSIF, |
137 |
+ 0, |
138 |
+ 0, |
139 |
+ 0, |
140 |
+ NULL, |
141 |
+ 0, |
142 |
+ IPMI_FLAGS_DEFAULT) < 0) { |
143 |
+ fprintf(stderr, |
144 |
+ "ipmi_open_inband(): %s\n", |
145 |
+ ipmi_device_strerror(ipmi_device_errnum(dev))); |
146 |
+ goto cleanup; |
147 |
+ } |
148 |
+ } |
149 |
+#endif |
150 |
|
151 |
intf->opened = 1; |
152 |
return 0; |
153 |
cleanup: |
154 |
- if (dev) |
155 |
+ if (dev) { |
156 |
ipmi_close_device(dev); |
157 |
+#if IPMI_INTF_FREE_VERSION_0_4_0 |
158 |
+ ipmi_device_destroy(dev); |
159 |
+#endif |
160 |
+ } |
161 |
return -1; |
162 |
} |
163 |
|
164 |
static void ipmi_free_close(struct ipmi_intf * intf) |
165 |
{ |
166 |
- if (dev) |
167 |
+ if (dev) { |
168 |
ipmi_close_device(dev); |
169 |
+#if IPMI_INTF_FREE_VERSION_0_4_0 |
170 |
+ ipmi_device_destroy(dev); |
171 |
+#endif |
172 |
+ } |
173 |
intf->opened = 0; |
174 |
} |
175 |
|
176 |
@@ -132,7 +194,13 @@ |
177 |
req->msg.data_len + 1, |
178 |
rs_buf, |
179 |
rs_buf_len)) < 0) { |
180 |
+#if IPMI_INTF_FREE_VERSION_0_3_0 |
181 |
perror("ipmi_cmd_raw"); |
182 |
+#elif IPMI_INTF_FREE_VERSION_0_4_0 |
183 |
+ fprintf(stderr, |
184 |
+ "ipmi_cmd_raw: %s\n", |
185 |
+ ipmi_device_strerror(ipmi_device_errnum(dev))); |
186 |
+#endif |
187 |
return NULL; |
188 |
} |
189 |
|