| 1 |
#include <glib.h> |
| 2 |
#include <blockdev/utils.h> |
| 3 |
|
| 4 |
#ifndef BD_SWAP |
| 5 |
#define BD_SWAP |
| 6 |
|
| 7 |
GQuark bd_swap_error_quark (void); |
| 8 |
#define BD_SWAP_ERROR bd_swap_error_quark () |
| 9 |
typedef enum { |
| 10 |
BD_SWAP_ERROR_TECH_UNAVAIL, |
| 11 |
BD_SWAP_ERROR_UNKNOWN_STATE, |
| 12 |
BD_SWAP_ERROR_ACTIVATE, |
| 13 |
BD_SWAP_ERROR_ACTIVATE_OLD, |
| 14 |
BD_SWAP_ERROR_ACTIVATE_SUSPEND, |
| 15 |
BD_SWAP_ERROR_ACTIVATE_UNKNOWN, |
| 16 |
BD_SWAP_ERROR_ACTIVATE_PAGESIZE, |
| 17 |
BD_SWAP_ERROR_LABEL_INVALID, |
| 18 |
BD_SWAP_ERROR_UUID_INVALID, |
| 19 |
} BDSwapError; |
| 20 |
|
| 21 |
typedef enum { |
| 22 |
BD_SWAP_TECH_SWAP = 0, |
| 23 |
} BDSwapTech; |
| 24 |
|
| 25 |
typedef enum { |
| 26 |
BD_SWAP_TECH_MODE_CREATE = 1 << 0, |
| 27 |
BD_SWAP_TECH_MODE_ACTIVATE_DEACTIVATE = 1 << 1, |
| 28 |
BD_SWAP_TECH_MODE_QUERY = 1 << 2, |
| 29 |
BD_SWAP_TECH_MODE_SET_LABEL = 1 << 3, |
| 30 |
BD_SWAP_TECH_MODE_SET_UUID = 1 << 4, |
| 31 |
} BDSwapTechMode; |
| 32 |
|
| 33 |
/* |
| 34 |
* If using the plugin as a standalone library, the following functions should |
| 35 |
* be called to: |
| 36 |
* |
| 37 |
* init() - initialize the plugin, returning TRUE on success |
| 38 |
* close() - clean after the plugin at the end or if no longer used |
| 39 |
* |
| 40 |
*/ |
| 41 |
gboolean bd_swap_init (void); |
| 42 |
void bd_swap_close (void); |
| 43 |
|
| 44 |
gboolean bd_swap_is_tech_avail (BDSwapTech tech, guint64 mode, GError **error); |
| 45 |
|
| 46 |
gboolean bd_swap_mkswap (const gchar *device, const gchar *label, const gchar *uuid, const BDExtraArg **extra, GError **error); |
| 47 |
gboolean bd_swap_swapon (const gchar *device, gint priority, GError **error); |
| 48 |
gboolean bd_swap_swapoff (const gchar *device, GError **error); |
| 49 |
gboolean bd_swap_swapstatus (const gchar *device, GError **error); |
| 50 |
gboolean bd_swap_set_label (const gchar *device, const gchar *label, GError **error); |
| 51 |
gboolean bd_swap_check_label (const gchar *label, GError **error); |
| 52 |
gboolean bd_swap_set_uuid (const gchar *device, const gchar *uuid, GError **error); |
| 53 |
gboolean bd_swap_check_uuid (const gchar *uuid, GError **error); |
| 54 |
|
| 55 |
#endif /* BD_SWAP */ |