| 1 |
#include <glib.h> |
| 2 |
#include <blockdev/utils.h> |
| 3 |
|
| 4 |
#ifndef BD_MPATH_API |
| 5 |
#define BD_MPATH_API |
| 6 |
|
| 7 |
GQuark bd_mpath_error_quark (void) { |
| 8 |
return g_quark_from_static_string ("g-bd-mpath-error-quark"); |
| 9 |
} |
| 10 |
|
| 11 |
#define BD_MPATH_ERROR bd_mpath_error_quark () |
| 12 |
typedef enum { |
| 13 |
BD_MPATH_ERROR_TECH_UNAVAIL, |
| 14 |
BD_MPATH_ERROR_INVAL, |
| 15 |
BD_MPATH_ERROR_FLUSH, |
| 16 |
BD_MPATH_ERROR_NOT_ROOT, |
| 17 |
BD_MPATH_ERROR_DM_ERROR, |
| 18 |
} BDMpathError; |
| 19 |
|
| 20 |
typedef enum { |
| 21 |
BD_MPATH_TECH_BASE = 0, |
| 22 |
BD_MPATH_TECH_FRIENDLY_NAMES, |
| 23 |
} BDMpathTech; |
| 24 |
|
| 25 |
typedef enum { |
| 26 |
BD_MPATH_TECH_MODE_QUERY = 1 << 0, |
| 27 |
BD_MPATH_TECH_MODE_MODIFY = 1 << 1, |
| 28 |
} BDMpathTechMode; |
| 29 |
|
| 30 |
/** |
| 31 |
* bd_mpath_is_tech_avail: |
| 32 |
* @tech: the queried tech |
| 33 |
* @mode: a bit mask of queried modes of operation 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_mpath_is_tech_avail (BDMpathTech tech, guint64 mode, GError **error); |
| 40 |
|
| 41 |
/** |
| 42 |
* bd_mpath_flush_mpaths: |
| 43 |
* @error: (out) (optional): place to store error (if any) |
| 44 |
* |
| 45 |
* Returns: whether multipath device maps were successfully flushed or not |
| 46 |
* |
| 47 |
* Flushes all unused multipath device maps. |
| 48 |
* |
| 49 |
* Tech category: %BD_MPATH_TECH_BASE-%BD_MPATH_TECH_MODE_MODIFY |
| 50 |
*/ |
| 51 |
gboolean bd_mpath_flush_mpaths (GError **error); |
| 52 |
|
| 53 |
/** |
| 54 |
* bd_mpath_is_mpath_member: |
| 55 |
* @device: device to test |
| 56 |
* @error: (out) (optional): place to store error (if any) |
| 57 |
* |
| 58 |
* Returns: %TRUE if the device is a multipath member, %FALSE if not or an error |
| 59 |
* appeared when queried (@error is set in those cases) |
| 60 |
* |
| 61 |
* Tech category: %BD_MPATH_TECH_BASE-%BD_MPATH_TECH_MODE_QUERY |
| 62 |
*/ |
| 63 |
gboolean bd_mpath_is_mpath_member (const gchar *device, GError **error); |
| 64 |
|
| 65 |
/** |
| 66 |
* bd_mpath_get_mpath_members: |
| 67 |
* @error: (out) (optional): place to store error (if any) |
| 68 |
* |
| 69 |
* Returns: (transfer full) (array zero-terminated=1): list of names of all devices that are |
| 70 |
* members of the mpath mappings (or %NULL |
| 71 |
* in case of error) |
| 72 |
* |
| 73 |
* Tech category: %BD_MPATH_TECH_BASE-%BD_MPATH_TECH_MODE_QUERY |
| 74 |
*/ |
| 75 |
gchar** bd_mpath_get_mpath_members (GError **error); |
| 76 |
|
| 77 |
/** |
| 78 |
* bd_mpath_set_friendly_names: |
| 79 |
* @enabled: whether friendly names should be enabled or not |
| 80 |
* @error: (out) (optional): place to store error (if any) |
| 81 |
* |
| 82 |
* Returns: if successfully set or not |
| 83 |
* |
| 84 |
* Tech category: %BD_MPATH_TECH_FRIENDLY_NAMES-%BD_MPATH_TECH_MODE_MODIFY |
| 85 |
*/ |
| 86 |
gboolean bd_mpath_set_friendly_names (gboolean enabled, GError **error); |
| 87 |
|
| 88 |
#endif /* BD_MPATH_API */ |