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

Mount helper for mounting/unmounting devices
[MNT daemon]

Some helper functions for mounting and unmounting device on a directory. More...

Functions

int mntd_mount_mount (const char *device, const char *mntpnt)
 Mount device to mntpnt with options (with system() call at the moment).
int mntd_mount_umount (const char *mntpnt)
 Unmount device with options (with system() call at the moment).
int _mntd_mount_remount (const char *user_opts, const char *mntpnt)
 Remount mntpnt with given options.
int mntd_mount_remount_rd (const char *mntpnt)
 Remount mntpnt read only.
int mntd_mount_remount_rw (const char *mntpnt)
 Remount mntpnt read/write.
int mntd_mount_remount_from_configfile (const char *mntpnt)
 Remount mntpnt with options from configfile (if options are different).
FILE * mntd_mount_open_mtab (void)
 Try to open mtab file.
int mntd_mount_is_mounted (const char *path)
 Check if path is mounted.
mntent * mntd_mount_getmntent (const char *path)
 Check if path is mounted and return the mntent structure.
char * mntd_mount_getfsname (const char *path)
 Get the filesystem name for mounted path.
gchar * mntd_mount_getoptions (const char *path)
 Get the filesystem options for mounted path.
gchar * mntd_mount_normalize_options (const char *options)
 Normalize options string to be passed to mount.

Detailed Description

Some helper functions for mounting and unmounting device on a directory.


Function Documentation

char* mntd_mount_getfsname const char *  path  ) 
 

Get the filesystem name for mounted path.

Parameters:
path Path to device or mount point
Returns:
fsname string, NULL otherwise

Definition at line 420 of file mntd_mount.c.

References mntd_mount_open_mtab().

Referenced by mntd_mount_remount_from_configfile().

struct mntent* mntd_mount_getmntent const char *  path  ) 
 

Check if path is mounted and return the mntent structure.

Parameters:
path Path to device or mount point
Returns:
mntent pointer, NULL otherwise

Definition at line 380 of file mntd_mount.c.

References mntd_mount_open_mtab().

gchar* mntd_mount_getoptions const char *  path  ) 
 

Get the filesystem options for mounted path.

Parameters:
path Path to device or mount point
Returns:
options string, NULL otherwise

Definition at line 452 of file mntd_mount.c.

References mntd_mount_normalize_options(), and mntd_mount_open_mtab().

Referenced by mntd_mount_remount_from_configfile().

int mntd_mount_is_mounted const char *  path  ) 
 

Check if path is mounted.

Parameters:
path Path to device or mount point
Returns:
1 if mounted, 0 otherwise

Definition at line 348 of file mntd_mount.c.

References mntd_mount_open_mtab().

Referenced by _mntd_mount_remount(), mntd_mount_mount(), mntd_mount_remount_from_configfile(), mntd_mount_remount_rd(), mntd_mount_remount_rw(), and mntd_mount_umount().

int mntd_mount_mount const char *  device,
const char *  mntpnt
 

Mount device to mntpnt with options (with system() call at the moment).

Parameters:
device Device
mntpnt Mount point
Returns:
0 if successful, -1 otherwise

Definition at line 59 of file mntd_mount.c.

References mntd_mount_is_mounted(), mntd_mount_remount_from_configfile(), MSG_DEBUG, and MSG_ERR.

Referenced by mntd_volume_mount().

gchar* mntd_mount_normalize_options const char *  options  ) 
 

Normalize options string to be passed to mount.

Parameters:
options Options string for mount
Returns:
normalized options string, NULL otherwise

Definition at line 484 of file mntd_mount.c.

Referenced by mntd_mount_getoptions(), and mntd_mount_remount_from_configfile().

FILE* mntd_mount_open_mtab void   ) 
 

Try to open mtab file.

Returns:
FILE pointer, NULL otherwise

Definition at line 325 of file mntd_mount.c.

Referenced by mntd_mount_getfsname(), mntd_mount_getmntent(), mntd_mount_getoptions(), and mntd_mount_is_mounted().

int mntd_mount_remount_from_configfile const char *  mntpnt  ) 
 

Remount mntpnt with options from configfile (if options are different).

Parameters:
mntpnt Mount point
Returns:
0 if successful, -1 otherwise

Definition at line 267 of file mntd_mount.c.

References _mntd_mount_remount(), MNTDDATA_::configdata, ConfigData::filesystems, mntd_mount_getfsname(), mntd_mount_getoptions(), mntd_mount_is_mounted(), mntd_mount_normalize_options(), MSG_DEBUG, MSG_ERR, and MSG_WARNING.

Referenced by mntd_mount_mount().

int mntd_mount_remount_rd const char *  mntpnt  ) 
 

Remount mntpnt read only.

Parameters:
mntpnt Mount point
Returns:
0 if successful, -1 otherwise

Definition at line 227 of file mntd_mount.c.

References _mntd_mount_remount(), and mntd_mount_is_mounted().

Referenced by mntd_volume_remount().

int mntd_mount_remount_rw const char *  mntpnt  ) 
 

Remount mntpnt read/write.

Parameters:
mntpnt Mount point
Returns:
0 if successful, -1 otherwise

Definition at line 247 of file mntd_mount.c.

References _mntd_mount_remount(), and mntd_mount_is_mounted().

Referenced by mntd_volume_remount().

int mntd_mount_umount const char *  mntpnt  ) 
 

Unmount device with options (with system() call at the moment).

Parameters:
mntpnt Path to umount (dir | device)
Returns:
0 if successful, -1 otherwise

Definition at line 115 of file mntd_mount.c.

References mntd_mount_is_mounted(), MSG_DEBUG, and MSG_ERR.

Referenced by mntd_volume_umount().


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