panel-plugin/devices.c File Reference

#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_infomount_info_new (float size, float used, float avail, unsigned int percent, char *type, char *mounted_on)
t_mount_infomount_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_diskdisk_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_diskdisks_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 Documentation

#define GB   1073741824

#define KB   1024

#define MB   1048576

#define MTAB   "/etc/mtab"


Function Documentation

t_deviceclass disk_classify ( char *  device,
char *  mountpoint 
)

Returns classification for given information

Parameters:
device Device to get class for
mountpoint Mountpoint used as additional information for classfication
Returns:
Device class

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().

Parameters:
include_NFSs whether to include network file systems
Returns:
GPtrArray *pdisks containing elements to be displayed

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.

Returns:
true on success, else false.

gboolean disks_remove_mountpoint ( GPtrArray *  pdisks,
char *  mountp 
)

Removes specfied mount point from array.

Returns:
true on success, else false.

t_disk* disks_search ( GPtrArray *  pdisks,
char *  mount_point 
)

Returns:
a pointer on FIRST struct t_disk containing char * device as device field; if not found return NULL.

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.

Parameters:
size,: Size in bytes
Returns:
Formatted output, e.g. "1.5 GB"

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  ) 


Generated on Sun Feb 18 18:07:09 2007 for Xfce4-Mount-Plugin by  doxygen 1.5.1