Debian Codegraph @

src/lib/plugin_apis/s390.api

raw
1 #include <glib.h>
2 #include <blockdev/utils.h>
3
4 #ifndef BD_S390_API
5 #define BD_S390_API
6
7 GQuark bd_s390_error_quark (void) {
8 return g_quark_from_static_string ("g-bd-s390-error-quark");
9 }
10
11 #define BD_S390_ERROR bd_s390_error_quark ()
12 typedef enum {
13 BD_S390_ERROR_TECH_UNAVAIL,
14 BD_S390_ERROR_DEVICE,
15 BD_S390_ERROR_FORMAT_FAILED,
16 BD_S390_ERROR_DASDFMT,
17 BD_S390_ERROR_IO,
18 } BDS390Error;
19
20 typedef enum {
21 BD_S390_TECH_DASD = 0,
22 BD_S390_TECH_ZFCP,
23 } BDS390Tech;
24
25 typedef enum {
26 BD_S390_TECH_MODE_MODIFY = 1 << 0,
27 BD_S390_TECH_MODE_QUERY = 1 << 1,
28 } BDS390TechMode;
29
30 /**
31 * bd_s390_is_tech_avail:
32 * @tech: the queried tech
33 * @mode: a bit mask of queried modes of operation (#BDS390TechMode) for @tech
34 * @error: (out) (optional): place to store error (details about why the @tech-@mode combination is not available)
35 *
36 * Returns: whether the @tech-@mode combination is available -- supported by the
37 * plugin implementation and having all the runtime dependencies available
38 */
39 gboolean bd_s390_is_tech_avail (BDS390Tech tech, guint64 mode, GError **error);
40
41 /**
42 * bd_s390_dasd_format:
43 * @dasd: dasd to format
44 * @extra: (nullable) (array zero-terminated=1): extra options for the formatting (right now
45 * passed to the 'dasdfmt' utility)
46 * @error: (out) (optional): place to store error (if any)
47 *
48 * Returns: whether dasdfmt was successful or not
49 *
50 * Tech category: %BD_S390_TECH_DASD-%BD_S390_TECH_MODE_MODIFY
51 */
52 gboolean bd_s390_dasd_format (const gchar *dasd, const BDExtraArg **extra, GError **error);
53
54 /**
55 * bd_s390_dasd_needs_format:
56 * @dasd: dasd to check, given as device number
57 * @error: (out) (optional): place to store error (if any)
58 *
59 * Returns: whether a dasd needs dasdfmt run against it
60 *
61 * Tech category: %BD_S390_TECH_DASD-%BD_S390_TECH_MODE_QUERY
62 */
63 gboolean bd_s390_dasd_needs_format (const gchar *dasd, GError **error);
64
65 /**
66 * bd_s390_dasd_online:
67 * @dasd: dasd to switch online, given as device number
68 * @error: (out) (optional): place to store error (if any)
69 *
70 * Returns: whether a dasd was successfully switched online
71 *
72 * Tech category: %BD_S390_TECH_DASD-%BD_S390_TECH_MODE_MODIFY
73 */
74 gboolean bd_s390_dasd_online (const gchar *dasd, GError **error);
75
76 /**
77 * bd_s390_dasd_is_Ldl:
78 * @dasd: dasd to check, whether it is LDL formatted
79 * @error: (out) (optional): place to store error (if any)
80 *
81 * Returns: whether a dasd is LDL formatted
82 *
83 * Tech category: %BD_S390_TECH_DASD-%BD_S390_TECH_MODE_QUERY
84 */
85 gboolean bd_s390_dasd_is_ldl (const gchar *dasd, GError **error);
86
87 /**
88 * bd_s390_dasd_is_fba:
89 * @dasd: dasd to check, whether it is FBA
90 * @error: (out) (optional): place to store error (if any)
91 *
92 * Returns: whether a dasd is FBA
93 *
94 * Tech category: %BD_S390_TECH_DASD-%BD_S390_TECH_MODE_QUERY
95 */
96 gboolean bd_s390_dasd_is_fba (const gchar *dasd, GError **error);
97
98 /**
99 * bd_s390_sanitize_dev_input:
100 * @dev: a DASD or zFCP device number
101 * @error: (out) (optional): place to store error (if any)
102 *
103 * Returns: (transfer full): a synthesized dasd or zfcp device number
104 *
105 * Tech category: always available
106 */
107 gchar* bd_s390_sanitize_dev_input (const gchar *dev, GError **error);
108
109 /**
110 * bd_s390_zfcp_sanitize_wwpn_input:
111 * @wwpn: a zFCP WWPN identifier
112 * @error: (out) (optional): place to store error (if any)
113 *
114 * Returns: (transfer full): a synthesized zFCP WWPN
115 *
116 * Tech category: always available
117 */
118 gchar* bd_s390_zfcp_sanitize_wwpn_input (const gchar *wwpn, GError **error);
119
120 /**
121 * bd_s390_zfcp_sanitize_lun_input:
122 * @lun: a zFCP LUN identifier
123 * @error: (out) (optional): place to store error (if any)
124 *
125 * Returns: (transfer full): a synthesized zFCP LUN
126 *
127 * Tech category: always available
128 */
129 gchar* bd_s390_zfcp_sanitize_lun_input (const gchar *lun, GError **error);
130
131 /**
132 * bd_s390_zfcp_online:
133 * @devno: zfcp device number
134 * @wwpn: zfcp WWPN (World Wide Port Number)
135 * @lun: zfcp LUN (Logical Unit Number)
136 * @error: (out) (optional): place to store error (if any)
137 *
138 * Returns: whether a zFCP device was successfully switched online
139 *
140 * Tech category: %BD_S390_TECH_ZFCP-%BD_S390_TECH_MODE_MODIFY
141 */
142 gboolean bd_s390_zfcp_online (const gchar *devno, const gchar *wwpn, const gchar *lun, GError **error);
143
144 /**
145 * bd_s390_zfcp_scsi_offline:
146 * @devno: zfcp device number
147 * @wwpn: zfcp WWPN (World Wide Port Number)
148 * @lun: zfcp LUN (Logical Unit Number)
149 * @error: (out) (optional): place to store error (if any)
150 *
151 * Returns: whether a LUN was successfully removed from its associated WWPN
152 *
153 * This function looks through /proc/scsi/scsi and manually removes LUNs from
154 * associated WWPNs. zFCP devices are SCSI devices accessible over FCP protocol.
155 * In z/OS the IODF (I/O definition file) contains basic information about the
156 * I/O config, but WWPN and LUN configuration is done at the OS level, hence
157 * this function becomes necessary when switching the device offline. This
158 * particular sequence of actions is for some reason unnecessary when switching
159 * the device online. Chalk it up to s390x being s390x.
160 *
161 * Tech category: %BD_S390_TECH_ZFCP-%BD_S390_TECH_MODE_MODIFY
162 */
163 gboolean bd_s390_zfcp_scsi_offline(const gchar *devno, const gchar *wwpn, const gchar *lun, GError **error);
164
165 /**
166 * bd_s390_zfcp_offline:
167 * @devno: zfcp device number
168 * @wwpn: zfcp WWPN (World Wide Port Number)
169 * @lun: zfcp LUN (Logical Unit Number)
170 * @error: (out) (optional): place to store error (if any)
171 *
172 * Returns: whether a zfcp device was successfully switched offline
173 *
174 * Tech category: %BD_S390_TECH_ZFCP-%BD_S390_TECH_MODE_MODIFY
175 */
176 gboolean bd_s390_zfcp_offline (const gchar *devno, const gchar *wwpn, const gchar *lun, GError **error);
177
178 #endif /* BD_S390_API */