File: array_plugin.h

package info (click to toggle)
array-info 0.16-12
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 324 kB
  • sloc: ansic: 2,056; makefile: 121; xml: 19
file content (103 lines) | stat: -rw-r--r-- 3,421 bytes parent folder | download | duplicates (7)
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
/*
 * array-info - Array Controllers Informations
 * Copyright (C) 2002  Benoit Gaussen (ben@trez42.net)
 * Copyright (c) 2009  Google, Inc (ragnark@google.com)
 *
 * $Log: array_plugin.h,v $
 * Revision 1.8  2009/09/18 17:40:22  ragnark
 * Add information about spare disks for cciss plugin
 * Make array-info exit with exit code 1 if it detects problems with any of the logical volumes.
 *
 * Revision 1.7  2007/02/07 17:17:43  pere
 * Changed the 'status is ok' message for the md plugin to match the one
 * in the cciss and ida plugin, and make the string common across all
 * plugins.
 *
 * Revision 1.6  2007/02/01 14:43:26  pere
 * Rewrite plugin API to pass driver data between the functions.
 *
 * Revision 1.5  2007/01/31 13:32:29  pere
 * Remove the need to link libarray-info into plugins by providing the functions needed in a list of callbacks.
 *
 * Revision 1.4  2007/01/25 23:02:41  pere
 * Correct the prototypes.
 *
 * Revision 1.3  2007/01/25 15:14:06  pere
 * Make sure the install target installs the plugins.
 *
 * Revision 1.2  2002/07/30 14:12:46  trez42
 * Functions add and show infos
 *
 * Revision 1.1  2002/07/29 16:50:19  trez42
 * Add plugin support
 * Change directory structure
 *
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * 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.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

#ifndef _ARRAY_PLUGIN_H_
#define _ARRAY_PLUGIN_H_

#include "array_info.h"

typedef struct array_plugin_callbacks_s {
	void (*array_add_infos) (array_infos_t ** info, char level,
				 char *string, ...);
} array_plugin_callbacks_t;

typedef void *driver_data_ptr_t;

typedef struct {
	device_major_t *device_majors;

	u_int32_t plugin_version;
	u_int32_t array_info_version;

	driver_data_ptr_t driver_data;

	char *(*plugin_description) (void);
	 driver_data_ptr_t(*ctrl_open) (array_data_t *);
	int (*ctrl_close) (driver_data_ptr_t);
	int (*ctrl_req) (driver_data_ptr_t);
	array_infos_t *(*ctrl_infos) (driver_data_ptr_t,
				      array_plugin_callbacks_t * callbacks,
				      int *errors);
	void (*ctrl_free) (driver_data_ptr_t);
} array_plugin_t;

typedef struct array_plugin_list_s {
	array_plugin_t *plugin;
	void *plugin_handle;
	char *plugin_path;
	struct array_plugin_list_s *next;
} array_plugin_list_t;

// Prototypes

array_plugin_list_t *array_load_plugins(char *so_path);
void array_close_plugins(array_plugin_list_t * plugin_list);
void array_show_plugins(array_plugin_list_t * plugin_list);
int array_dispatch(array_plugin_list_t * plugin_list,
		   array_data_t * array_data);

// Plugin API
void array_show_infos(array_infos_t * info, char level);
void array_add_infos(array_infos_t ** info, char level, char *string, ...);

/* Make sure all plugins report an OK volume the same way */
#define LOGICAL_VOLUME_OK "Logical drive is ok"

#endif				// _ARRAY_PLUGIN_H_