Swap

Swap — plugin for operations with swap space

Functions

Types and Values

Includes

#include <swap.h>

Description

A plugin for operations with swap space.

Functions

bd_swap_check_deps ()

gboolean
bd_swap_check_deps (void);

Returns

whether the plugin's runtime dependencies are satisfied or not

Function checking plugin's runtime dependencies.


bd_swap_init ()

gboolean
bd_swap_init (void);

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


bd_swap_close ()

void
bd_swap_close (void);

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);

[skip]


bd_swap_mkswap ()

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

Parameters

device

a device to create swap space on

 

label

a label for the swap space device.

[nullable]

extra

extra options for the creation (right now passed to the 'mkswap' utility).

[nullable][array zero-terminated=1]

error

place to store error (if any).

[out][optional]

Returns

whether the swap space was successfully created or not

Tech category: BD_SWAP_TECH_SWAP-BD_SWAP_TECH_MODE_CREATE


bd_swap_swapon ()

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

Parameters

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][optional]

Returns

whether the swap device was successfully activated or not

Tech category: BD_SWAP_TECH_SWAP-BD_SWAP_TECH_MODE_ACTIVATE_DEACTIVATE


bd_swap_swapoff ()

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

Parameters

device

swap device to deactivate

 

error

place to store error (if any).

[out][optional]

Returns

whether the swap device was successfully deactivated or not

Tech category: BD_SWAP_TECH_SWAP-BD_SWAP_TECH_MODE_ACTIVATE_DEACTIVATE


bd_swap_swapstatus ()

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

Parameters

device

swap device to get status of

 

error

place to store error (if any).

[out][optional]

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)

Tech category: BD_SWAP_TECH_SWAP-BD_SWAP_TECH_MODE_QUERY


bd_swap_set_label ()

gboolean
bd_swap_set_label (const gchar *device,
                   const gchar *label,
                   GError **error);

Parameters

device

a device to set label on

 

label

label that will be set

 

error

place to store error (if any).

[out][optional]

Returns

whether the label was successfully set or not

Tech category: BD_SWAP_TECH_SWAP-BD_SWAP_TECH_MODE_SET_LABEL


bd_swap_is_tech_avail ()

gboolean
bd_swap_is_tech_avail (BDSwapTech tech,
                       guint64 mode,
                       GError **error);

Parameters

tech

the queried tech

 

mode

a bit mask of queried modes of operation (BDSwapTechMode) for tech

 

error

place to store error (details about why the tech -mode combination is not available).

[out][optional]

Returns

whether the tech -mode combination is available -- supported by the plugin implementation and having all the runtime dependencies available

Types and Values

BD_SWAP_ERROR

#define             BD_SWAP_ERROR

enum BDSwapError

Members

BD_SWAP_ERROR_UNKNOWN_STATE

   

BD_SWAP_ERROR_ACTIVATE

   

BD_SWAP_ERROR_TECH_UNAVAIL

   

BD_SWAP_ERROR_ACTIVATE_OLD

   

BD_SWAP_ERROR_ACTIVATE_SUSPEND

   

BD_SWAP_ERROR_ACTIVATE_UNKNOWN

   

BD_SWAP_ERROR_ACTIVATE_PAGESIZE

   

enum BDSwapTech

Members

BD_SWAP_TECH_SWAP

   

enum BDSwapTechMode

Members

BD_SWAP_TECH_MODE_CREATE

   

BD_SWAP_TECH_MODE_ACTIVATE_DEACTIVATE

   

BD_SWAP_TECH_MODE_QUERY

   

BD_SWAP_TECH_MODE_SET_LABEL