#include <fstab.h>
#include <glib.h>
#include <mntent.h>
#include <stdio.h>
#include <string.h>
#include <sys/vfs.h>
#include <libxfce4panel/xfce-panel-plugin.h>
#include <libxfce4util/libxfce4util.h>
#include <libxfcegui4/xfce-exec.h>
#include "devices.h"
#include "helpers.c"
Include dependency graph for devices.c:
Defines | |
#define | KB 1024 |
#define | MB 1048576 |
#define | GB 1073741824 |
#define | MTAB "/etc/mtab" |
Functions | |
char * | get_size_human_readable (float size) |
void | mount_info_print (t_mount_info *mount_info) |
t_mount_info * | mount_info_new (float size, float used, float avail, unsigned int percent, char *type, char *mounted_on) |
t_mount_info * | mount_info_new_from_stat (struct statfs *pstatfs, char *mnt_type, char *mnt_dir) |
void | mount_info_free (t_mount_info **mount_info) |
void | disk_print (t_disk *pdisk) |
t_disk * | disk_new (const char *dev, const char *mp) |
void | disk_free (t_disk **pdisk) |
void | disk_mount (t_disk *pdisk, char *on_mount_cmd, char *mount_command, gboolean eject) |
int | disk_umount (t_disk *pdisk, char *umount_command, gboolean synchronous, gboolean eject) |
GPtrArray * | disks_new (gboolean include_NFSs) |
void | disks_free (GPtrArray **pdisks) |
void | disks_print (GPtrArray *pdisks) |
gboolean | disks_remove_device (GPtrArray *pdisks, char *device) |
gboolean | disks_remove_mountpoint (GPtrArray *pdisks, char *mountp) |
t_disk * | disks_search (GPtrArray *pdisks, char *mount_point) |
void | disks_free_mount_info (GPtrArray *pdisks) |
void | disks_refresh (GPtrArray *pdisks) |
t_deviceclass | disk_classify (char *device, char *mountpoint) |
#define GB 1073741824 |
#define KB 1024 |
#define MB 1048576 |
#define MTAB "/etc/mtab" |
t_deviceclass disk_classify | ( | char * | device, | |
char * | mountpoint | |||
) |
Returns classification for given information
device | Device to get class for | |
mountpoint | Mountpoint used as additional information for classfication |
void disk_free | ( | t_disk ** | pdisk | ) |
void disk_mount | ( | t_disk * | pdisk, | |
char * | on_mount_cmd, | |||
char * | mount_command, | |||
gboolean | eject | |||
) |
Return exit status of the mount command
t_disk* disk_new | ( | const char * | dev, | |
const char * | mp | |||
) |
void disk_print | ( | t_disk * | pdisk | ) |
int disk_umount | ( | t_disk * | pdisk, | |
char * | umount_command, | |||
gboolean | synchronous, | |||
gboolean | eject | |||
) |
Return exit status of the umount command.
void disks_free | ( | GPtrArray ** | pdisks | ) |
Free a GPtrArray containing pointer on struct t_disk elements
void disks_free_mount_info | ( | GPtrArray * | pdisks | ) |
Remove struct t_mount_info from a GPtrArray containing struct t_disk * elements.
GPtrArray* disks_new | ( | gboolean | include_NFSs | ) |
Fill a GPtrArray with pointers on struct t_disk containing infos on devices and theoretical mount point. used setfsent() and getfsent(), now uses setmntent() and getmntent() and enmntent().
include_NFSs | whether to include network file systems |
void disks_print | ( | GPtrArray * | pdisks | ) |
Print a GPtrArray containing pointer on struct t_disk elements
void disks_refresh | ( | GPtrArray * | pdisks | ) |
Refreshes t_mount_info infos in a GPtrArray containing struct t_disk * elements.
gboolean disks_remove_device | ( | GPtrArray * | pdisks, | |
char * | device | |||
) |
Removes specfied device from array.
gboolean disks_remove_mountpoint | ( | GPtrArray * | pdisks, | |
char * | mountp | |||
) |
Removes specfied mount point from array.
t_disk* disks_search | ( | GPtrArray * | pdisks, | |
char * | mount_point | |||
) |
char* get_size_human_readable | ( | float | size | ) |
Return a string containing a size expressed in KB, MB or GB and the unit it is expressed in.
size,: | Size in bytes |
void mount_info_free | ( | t_mount_info ** | mount_info | ) |
t_mount_info* mount_info_new | ( | float | size, | |
float | used, | |||
float | avail, | |||
unsigned int | percent, | |||
char * | type, | |||
char * | mounted_on | |||
) |
t_mount_info* mount_info_new_from_stat | ( | struct statfs * | pstatfs, | |
char * | mnt_type, | |||
char * | mnt_dir | |||
) |
Creates a new struct t_mount_info from a struct statfs data.
void mount_info_print | ( | t_mount_info * | mount_info | ) |