File: ipmi_close.c

package info (click to toggle)
openhpi 3.6.1-2.2
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 25,544 kB
  • ctags: 25,275
  • sloc: ansic: 202,885; cpp: 63,639; java: 16,472; cs: 15,161; python: 11,884; makefile: 4,872; perl: 1,529; sh: 371; xml: 36; asm: 13
file content (57 lines) | stat: -rw-r--r-- 1,428 bytes parent folder | download | duplicates (8)
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
/*      -*- linux-c -*-
 *
 * Copyright (c) 2003 by Intel Corp.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  This
 * file and program are licensed under a BSD style license.  See
 * the Copying file included with the OpenHPI distribution for
 * full licensing terms.
 *
 * Authors:
 *     Tariq Shureih <tariq.shureih@intel.com>
 */

#include "ipmi.h"

static void close_done(void *cb_data)
{
	struct ohoi_handler *ipmi_handler = cb_data;
	trace_ipmi("close_done");
	ipmi_handler->fully_up = 0;
}

static void close_connection(ipmi_domain_t *domain, void *user_data)
{
	int rv, *flag = user_data;

	trace_ipmi("close flag:%d", *flag);

	
	rv = ipmi_domain_close(domain, close_done, user_data);
	if (rv) {
		err("ipmi_close_connection failed!");
		*flag = 1;
	}
}

void ohoi_close_connection(ipmi_domain_id_t domain_id, void *user_data)
{
	struct oh_handler_state *handler = (struct oh_handler_state *)user_data;
	struct ohoi_handler *ipmi_handler = (struct ohoi_handler *)handler->data;
	int rv;

	trace_ipmi("ohoi_close_connection");

	rv = ipmi_domain_pointer_cb(domain_id, close_connection, ipmi_handler);
	
	if (rv) {
		err("ipmi_domain_pointer_cb failed!");
		return;
	}

	while (ipmi_handler->fully_up != 0) {
		sel_select(ipmi_handler->ohoi_sel, NULL, 0, NULL, NULL);
	}
}