Main Page | Modules | Data Structures | File List | Data Fields | Related Pages

MNT library

A convenience library used to communicate with the MNT daemon using D-BUS. More...

Data Structures

struct  LIBMNTFUNCS_
 Struct to group callbacks for signals. More...

Defines

#define DBUS_SERVICE_MNT   "biz.bambach.Mnt"
 DBUS mntd service name.
#define DBUS_PATH_MNT_MANAGER   "/biz/bambach/Mnt/Manager"
 DBUS mntd manager path.
#define DBUS_PATH_MNT_BLOCK   "/biz/bambach/Mnt/Block"
 DBUS mntd block path.
#define DBUS_PATH_MNT_DISC   "/biz/bambach/Mnt/Disc"
 DBUS mntd disc path.
#define DBUS_PATH_MNT_TTY   "/biz/bambach/Mnt/Tty"
 DBUS mntd tty path.
#define DBUS_INTERFACE_MNT_MANAGER   "biz.bambach.Mnt.Manager"
 DBUS mntd manager interface.
#define DBUS_INTERFACE_MNT_BLOCK   "biz.bambach.Mnt.Block"
 DBUS mntd block interface.
#define DBUS_INTERFACE_MNT_DISC   "biz.bambach.Mnt.Disc"
 DBUS mntd disc interface.
#define DBUS_INTERFACE_MNT_TTY   "biz.bambach.Mnt.Tty"
 DBUS mntd tty interface.
#define DBUS_ERROR_NO_SUCH_DEVICE   "biz.bambach.Mnt.NoSuchDevice"
 DBUS mntd NoSuchDevice error.
#define DBUS_ERROR_SYNTAX   "biz.bambach.Mnt.SyntaxError"
 DBUS mntd SyntaxError error.
#define DBUS_ERROR_NO_MNTPNT   "biz.bambach.Mnt.NoMntPnt"
 DBUS mntd NoMntPnt error.

Typedefs

typedef void(* LibMntMainLoop )(DBusConnection *dbus_connection, void *user_data)
 Type for function to integrate a DBusConnection into it's own mainloop.
typedef void(* LibMntVolumeMounted )(const char *udi, const char *mntpnt, void *user_data)
 Type for callback when a volume is mounted.
typedef void(* LibMntVolumeUnmounted )(const char *udi, const char *mntpnt, void *user_data)
 Type for callback when a volume is unmounted.
typedef void(* LibMntDbusDisconnect )(void *user_data)
 Type for callback when a disconnected from dbus.
typedef LIBMNTFUNCS_ LIBMNTFUNCS
 Struct to group callbacks for signals.
typedef LIBMNTFUNCS_PLIBMNTFUNCS
 Struct to group callbacks for signals.

Functions

int mnt_init (PLIBMNTFUNCS functions, void *user_data)
 Initialize the MNT library.
void mnt_quit (void)
 Shutdown the MNT library.
char ** mnt_get_all_volumes (int *num_volumes)
 Get all volumes from mntd (with dbus method call).
char * mnt_get_mntpnt (char *udi)
 Get mount point for a specific volume.
int mnt_remount_rd (char *udi)
 Remount mntd volume read only.
int mnt_remount_rw (char *udi)
 Remount mntd volume rdwr.
DBusConnection * _mnt_get_connection (void)
 Get internal dbus connection.

Detailed Description

A convenience library used to communicate with the MNT daemon using D-BUS.


Typedef Documentation

typedef void(* LibMntDbusDisconnect)(void *user_data)
 

Type for callback when a disconnected from dbus.

Parameters:
user_data given user_data pointer

Definition at line 113 of file libmnt.h.

typedef struct LIBMNTFUNCS_ LIBMNTFUNCS
 

Struct to group callbacks for signals.

Set unneeded function pointers to NULL to disable them.

typedef void(* LibMntMainLoop)(DBusConnection *dbus_connection, void *user_data)
 

Type for function to integrate a DBusConnection into it's own mainloop.

Parameters:
dbus_connection dbus connection pointer
user_data given user_data pointer

Definition at line 88 of file libmnt.h.

typedef void(* LibMntVolumeMounted)(const char *udi, const char *mntpnt, void *user_data)
 

Type for callback when a volume is mounted.

Parameters:
udi Unique Device Id
mntpnt pointer to mount point string representation
user_data given user_data pointer

Definition at line 97 of file libmnt.h.

typedef void(* LibMntVolumeUnmounted)(const char *udi, const char *mntpnt, void *user_data)
 

Type for callback when a volume is unmounted.

Parameters:
udi Unique Device Id
mntpnt pointer to mount point string representation
user_data given user_data pointer

Definition at line 106 of file libmnt.h.

typedef struct LIBMNTFUNCS_ * PLIBMNTFUNCS
 

Struct to group callbacks for signals.

Set unneeded function pointers to NULL to disable them.

Referenced by mnt_init().


Function Documentation

DBusConnection* _mnt_get_connection void   ) 
 

Get internal dbus connection.

This is for internal testing only, and will be removed some times. So don't use it !

Definition at line 467 of file libmnt.c.

char** mnt_get_all_volumes int *  num_volumes  ) 
 

Get all volumes from mntd (with dbus method call).

You have to free each element and the data array by yourself.

Parameters:
num_volumes Integer pointer will hold number of found volumes, if successful
Returns:
data pointer if successful, NULL otherwise

Definition at line 270 of file libmnt.c.

References DBUS_INTERFACE_MNT_MANAGER, DBUS_PATH_MNT_MANAGER, and DBUS_SERVICE_MNT.

char* mnt_get_mntpnt char *  udi  ) 
 

Get mount point for a specific volume.

You have to free to returned mount point string yourself.

Parameters:
udi udi of volume
Returns:
mount point if successful, NULL otherwise

Definition at line 339 of file libmnt.c.

References DBUS_INTERFACE_MNT_MANAGER, DBUS_PATH_MNT_MANAGER, and DBUS_SERVICE_MNT.

int mnt_init PLIBMNTFUNCS  functions,
void *  user_data
 

Initialize the MNT library.

Parameters:
functions Callback functions. If this is set to NULL then the library will not listen for notifications.
user_data User data pointer will be passed to callbacks
Returns:
0 if successful, -1 otherwise

Definition at line 165 of file libmnt.c.

References DBUS_INTERFACE_MNT_MANAGER, DBUS_PATH_MNT_MANAGER, DBUS_SERVICE_MNT, LIBMNTFUNCS_::main_loop, and PLIBMNTFUNCS.

int mnt_remount_rd char *  udi  ) 
 

Remount mntd volume read only.

Parameters:
udi udi of volume
Returns:
0 if successful, -1 otherwise

Definition at line 455 of file libmnt.c.

int mnt_remount_rw char *  udi  ) 
 

Remount mntd volume rdwr.

Parameters:
udi udi of volume
Returns:
0 if successful, -1 otherwise

Definition at line 461 of file libmnt.c.


Generated on Wed Mar 30 13:43:27 2005 for Mntd by  doxygen 1.3.9.1