Swap

Swap — plugin for operations with swap space

Synopsis

#include <swap.h>

gboolean            bd_swap_check_deps                  ();
gboolean            bd_swap_init                        ();
void                bd_swap_close                       ();
GQuark              bd_swap_error_quark                 (void);
#define             BD_SWAP_ERROR
enum                BDSwapError;
gboolean            bd_swap_mkswap                      (const gchar *device,
                                                         const gchar *label,
                                                         const BDExtraArg **extra,
                                                         GError **error);
gboolean            bd_swap_swapon                      (const gchar *device,
                                                         gint priority,
                                                         GError **error);
gboolean            bd_swap_swapoff                     (const gchar *device,
                                                         GError **error);
gboolean            bd_swap_swapstatus                  (const gchar *device,
                                                         GError **error);

Description

A plugin for operations with swap space.

Details

bd_swap_check_deps ()

gboolean            bd_swap_check_deps                  ();

Returns :

whether the plugin's runtime dependencies are satisfied or not Function checking plugin's runtime dependencies.

bd_swap_init ()

gboolean            bd_swap_init                        ();

Initializes the plugin. **This function is called automatically by the library's initialization functions.**


bd_swap_close ()

void                bd_swap_close                       ();

Cleans up after the plugin. **This function is called automatically by the library's functions that unload it.**


bd_swap_error_quark ()

GQuark              bd_swap_error_quark                 (void);

BD_SWAP_ERROR

#define             BD_SWAP_ERROR

enum BDSwapError

typedef enum {
    BD_SWAP_ERROR_UNKNOWN_STATE,
    BD_SWAP_ERROR_ACTIVATE,
} BDSwapError;

BD_SWAP_ERROR_UNKNOWN_STATE

BD_SWAP_ERROR_ACTIVATE


bd_swap_mkswap ()

gboolean            bd_swap_mkswap                      (const gchar *device,
                                                         const gchar *label,
                                                         const BDExtraArg **extra,
                                                         GError **error);

device :

a device to create swap space on

label :

a label for the swap space device. [allow-none]

extra :

extra options for the creation (right now passed to the 'mkswap' utility). [allow-none][array zero-terminated=1]

error :

place to store error (if any). [out]

Returns :

whether the swap space was successfully created or not

bd_swap_swapon ()

gboolean            bd_swap_swapon                      (const gchar *device,
                                                         gint priority,
                                                         GError **error);

device :

swap device to activate

priority :

priority of the activated device or -1 to use the default

error :

place to store error (if any). [out]

Returns :

whether the swap device was successfully activated or not

bd_swap_swapoff ()

gboolean            bd_swap_swapoff                     (const gchar *device,
                                                         GError **error);

device :

swap device to deactivate

error :

place to store error (if any). [out]

Returns :

whether the swap device was successfully deactivated or not

bd_swap_swapstatus ()

gboolean            bd_swap_swapstatus                  (const gchar *device,
                                                         GError **error);

device :

swap device to get status of

error :

place to store error (if any). [out]

Returns :

TRUE if the swap device is active, FALSE if not active or failed to determine (error) is set not a non-NULL value in such case)