Debian Codegraph @

modules/lsm/lsm_data.h

raw
1 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
2 *
3 * Copyright (C) 2015 Red Hat, Inc.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 *
19 * Author: Gris Ge <[email protected]>
20 *
21 */
22
23 /*
24 * This file contains:
25 * 1. LSM data to udisks interface data converting.
26 * 2. Provide simple abstracted interface of LSM to udisks codes.
27 */
28
29 #ifndef __LSM_DATA_H__
30 #define __LSM_DATA_H__
31
32 #include <libstoragemgmt/libstoragemgmt.h>
33 #include <stdio.h>
34 #include <string.h>
35 #include <stdlib.h>
36 #include <stdint.h>
37 #include <glib.h>
38
39 G_BEGIN_DECLS
40
41 #define _MAX_RAID_TYPE_LEN 10
42 #define _MAX_STATUS_INFO_LEN 255
43
44 typedef struct _UDisksDaemon UDisksDaemon;
45
46 struct StdLsmVolData
47 {
48 char raid_type[_MAX_RAID_TYPE_LEN];
49 char status_info[_MAX_STATUS_INFO_LEN];
50 gboolean is_raid_degraded;
51 gboolean is_raid_reconstructing;
52 gboolean is_raid_verifying;
53 gboolean is_raid_error;
54 gboolean is_ok;
55 uint32_t min_io_size;
56 uint32_t opt_io_size;
57 uint32_t raid_disk_count;
58 };
59
60 gboolean std_lsm_data_init (UDisksDaemon *daemon, GError **error);
61
62 /*
63 * The cached lsm volume/vpd83 list will not refresh automatically. This is
64 * might cause new volume get incorrectly marked as not managed by
65 * std_lsm_vol_data_get ().
66 * This method is used to manually refresh that cache.
67 */
68 void std_lsm_vpd83_list_refresh (void);
69
70 void std_lsm_data_teardown (void);
71
72 struct StdLsmVolData *std_lsm_vol_data_get (const char *vpd83);
73
74 void std_lsm_vol_data_free (struct StdLsmVolData *std_lsm_vol_data);
75
76 uint32_t std_lsm_refresh_time_get (void);
77
78 gboolean std_lsm_vpd83_is_managed (const char *vpd83);
79
80 G_END_DECLS
81
82 #endif /* __LSM_DATA_H__ */