Loop

Loop — plugin for operations with loop devices

Functions

Types and Values

#define BD_LOOP_ERROR
enum BDLoopError

Includes

#include <loop.h>

Description

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

Functions

bd_loop_error_quark ()

GQuark
bd_loop_error_quark (void);

bd_loop_get_backing_file ()

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

Parameters

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

Parameters

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 or NULL if failed to determine.

[transfer full]


bd_loop_setup ()

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

Parameters

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

Parameters

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

Types and Values

BD_LOOP_ERROR

#define BD_LOOP_ERROR bd_loop_error_quark ()

enum BDLoopError

Members

BD_LOOP_ERROR_DEVICE