Loop

Loop — plugin for operations with loop devices

Synopsis

#include <loop.h>

GQuark              bd_loop_error_quark                 (void);
#define             BD_LOOP_ERROR
enum                BDLoopError;
gchar *             bd_loop_get_backing_file            (gchar *dev_name,
                                                         GError **error);
gchar *             bd_loop_get_loop_name               (gchar *file,
                                                         GError **error);
gboolean            bd_loop_setup                       (gchar *file,
                                                         gchar **loop_name,
                                                         GError **error);
gboolean            bd_loop_teardown                    (gchar *loop,
                                                         GError **error);

Description

A plugin for operations with loop devices. All sizes passed in/out to/from the functions are in bytes.

Details

bd_loop_error_quark ()

GQuark              bd_loop_error_quark                 (void);

BD_LOOP_ERROR

#define             BD_LOOP_ERROR

enum BDLoopError

typedef enum {
    BD_LOOP_ERROR_DEVICE,
} BDLoopError;

BD_LOOP_ERROR_DEVICE


bd_loop_get_backing_file ()

gchar *             bd_loop_get_backing_file            (gchar *dev_name,
                                                         GError **error);

dev_name :

name of the loop device to get backing file for (e.g. "loop0")

error :

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

Returns :

path of the device's backing file or NULL if none is found. [transfer full]

bd_loop_get_loop_name ()

gchar *             bd_loop_get_loop_name               (gchar *file,
                                                         GError **error);

file :

path of the backing file to get loop name for

error :

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

Returns :

name of the loop device associated with the given file. [transfer full]

bd_loop_setup ()

gboolean            bd_loop_setup                       (gchar *file,
                                                         gchar **loop_name,
                                                         GError **error);

file :

file to setup as a loop device

loop_name :

if not NULL, it is used to store the name of the loop device. [out]

error :

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

Returns :

whether the file was successfully setup as a loop device or not

bd_loop_teardown ()

gboolean            bd_loop_teardown                    (gchar *loop,
                                                         GError **error);

loop :

path or name of the loop device to tear down

error :

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

Returns :

whether the loop device was successfully torn down or not