Typedefs

typedef struct _Eeze_Disk Eeze_Disk
 
typedef struct
_Eeze_Event_Disk_Error 
Eeze_Event_Disk_Error
 

Enumerations

enum  Eeze_Disk_Type {
  EEZE_DISK_TYPE_UNKNOWN = 0,
  EEZE_DISK_TYPE_INTERNAL = (1 << 0),
  EEZE_DISK_TYPE_CDROM = (1 << 1),
  EEZE_DISK_TYPE_USB = (1 << 2),
  EEZE_DISK_TYPE_FLASH = (1 << 3)
}
 
enum  Eeze_Mount_Opts { ,
  EEZE_DISK_MOUNTOPT_UID = (1 << 6),
  EEZE_DISK_MOUNTOPT_NODEV = (1 << 7)
}
 

Functions

EAPI void eeze_disk_function (void)
 Use this function to determine whether your eeze is disk-capable. More...
 
EAPI Eina_Bool eeze_disk_can_mount (void)
 Return whether mount support is available in eeze. More...
 
EAPI Eina_Bool eeze_disk_can_unmount (void)
 Return whether unmount support is available in eeze. More...
 
EAPI Eina_Bool eeze_disk_can_eject (void)
 Return whether eject support is available in eeze. More...
 
EAPI Eeze_Diskeeze_disk_new (const char *path)
 Create a new disk object from a /sys/ path or /dev/ path. More...
 
EAPI Eeze_Diskeeze_disk_new_from_mount (const char *mount_point)
 Create a new disk object from a mount point. More...
 
EAPI void eeze_disk_free (Eeze_Disk *disk)
 Frees a disk object. More...
 
EAPI void eeze_disk_scan (Eeze_Disk *disk)
 Retrieve all disk information. More...
 
EAPI void eeze_disk_data_set (Eeze_Disk *disk, void *data)
 Associate data with a disk. More...
 
EAPI void * eeze_disk_data_get (Eeze_Disk *disk)
 Retrieve data previously associated with a disk. More...
 
EAPI const char * eeze_disk_syspath_get (Eeze_Disk *disk)
 Return the /sys/ path of a disk. More...
 
EAPI const char * eeze_disk_devpath_get (Eeze_Disk *disk)
 Return the /dev/ path of a disk. More...
 
EAPI const char * eeze_disk_fstype_get (Eeze_Disk *disk)
 Return the filesystem of the disk (if known) More...
 
EAPI const char * eeze_disk_vendor_get (Eeze_Disk *disk)
 Return the manufacturing vendor of the disk. More...
 
EAPI const char * eeze_disk_model_get (Eeze_Disk *disk)
 Return the model of the disk. More...
 
EAPI const char * eeze_disk_serial_get (Eeze_Disk *disk)
 Return the serial number of the disk. More...
 
EAPI const char * eeze_disk_uuid_get (Eeze_Disk *disk)
 Return the UUID of the disk. More...
 
EAPI const char * eeze_disk_label_get (Eeze_Disk *disk)
 Return the label of the disk. More...
 
EAPI Eeze_Disk_Type eeze_disk_type_get (Eeze_Disk *disk)
 Return the Eeze_Disk_Type of the disk. More...
 
EAPI Eina_Bool eeze_disk_removable_get (Eeze_Disk *disk)
 Return whether the disk is removable. More...
 
EAPI Eina_Bool eeze_disk_mounted_get (Eeze_Disk *disk)
 Return the mount state of a disk. More...
 
EAPI const char * eeze_disk_mount_wrapper_get (Eeze_Disk *disk)
 Get the previously set mount wrapper for a disk. More...
 
EAPI Eina_Bool eeze_disk_mount_wrapper_set (Eeze_Disk *disk, const char *wrapper)
 Set a wrapper to run mount commands with. More...
 
EAPI Eina_Bool eeze_disk_mount (Eeze_Disk *disk)
 Begin a mount operation on the disk. More...
 
EAPI Eina_Bool eeze_disk_unmount (Eeze_Disk *disk)
 Begin an unmount operation on the disk. More...
 
EAPI Eina_Bool eeze_disk_eject (Eeze_Disk *disk)
 Begin an eject operation on the disk. More...
 
EAPI void eeze_disk_cancel (Eeze_Disk *disk)
 Cancel a pending operation on the disk. More...
 
EAPI const char * eeze_disk_mount_point_get (Eeze_Disk *disk)
 Return the mount point of a disk. More...
 
EAPI Eina_Bool eeze_disk_mount_point_set (Eeze_Disk *disk, const char *mount_point)
 Set the mount point of a disk. More...
 
EAPI Eina_Bool eeze_disk_mountopts_set (Eeze_Disk *disk, unsigned long opts)
 Set the mount options using flags. More...
 
EAPI unsigned long eeze_disk_mountopts_get (Eeze_Disk *disk)
 Get the flags of a disk's current mount options. More...
 
EAPI Eina_Bool eeze_mount_tabs_watch (void)
 Begin watching mtab and fstab. More...
 
EAPI void eeze_mount_tabs_unwatch (void)
 Stop watching /etc/fstab and /etc/mtab. More...
 
EAPI Eina_Bool eeze_mount_mtab_scan (void)
 Scan /etc/mtab a single time. More...
 
EAPI Eina_Bool eeze_mount_fstab_scan (void)
 Scan /etc/fstab a single time. More...
 
EAPI const char * eeze_disk_udev_get_property (Eeze_Disk *disk, const char *property)
 Get the property value of a disk. More...
 
EAPI const char * eeze_disk_udev_get_sysattr (Eeze_Disk *disk, const char *sysattr)
 Get the sysattr value of a disk. More...
 
EAPI const char * eeze_disk_udev_get_parent (Eeze_Disk *disk)
 Find the root device of a disk. More...
 
EAPI Eina_Bool eeze_disk_udev_walk_check_sysattr (Eeze_Disk *disk, const char *sysattr, const char *value)
 Walks up the device chain using the device from disk, checking each device for sysattr with (optional) value. More...
 
EAPI const char * eeze_disk_udev_walk_get_sysattr (Eeze_Disk *disk, const char *sysattr)
 Walks up the device chain of disk checking each device for sysattr and returns the value if found. More...
 

Detailed Description

Typedef Documentation

Since
1.1

Handle for an Eeze Disk.

Since
1.1

Contains the human readable error message.

Enumeration Type Documentation

Since
1.1

All disk types known to Eeze.

Enumerator
EEZE_DISK_TYPE_UNKNOWN 

type could not be determined

EEZE_DISK_TYPE_INTERNAL 

internal drive

EEZE_DISK_TYPE_CDROM 

cdrom drive

EEZE_DISK_TYPE_USB 

usb drive

EEZE_DISK_TYPE_FLASH 

flash disk

Since
1.1

All mount options known to Eeze.

Enumerator
EEZE_DISK_MOUNTOPT_UID 

use current user's uid

EEZE_DISK_MOUNTOPT_NODEV 
Since
1.7

Function Documentation

EAPI Eina_Bool eeze_disk_can_eject ( void  )

Return whether eject support is available in eeze.

Use this function to determine whether your Eeze library was compiled with an eject binary available.

Since
1.1
EAPI Eina_Bool eeze_disk_can_mount ( void  )

Return whether mount support is available in eeze.

Use this function to determine whether your Eeze library was compiled with a mount binary available.

Since
1.1
EAPI Eina_Bool eeze_disk_can_unmount ( void  )

Return whether unmount support is available in eeze.

Use this function to determine whether your Eeze library was compiled with an unmount binary available.

Since
1.1
EAPI void eeze_disk_cancel ( Eeze_Disk disk)

Cancel a pending operation on the disk.

Parameters
diskThe disk

This function cancels the current pending operation on disk which was previously started with eeze_disk_mount or eeze_disk_unmount.

Since
1.1
EAPI void* eeze_disk_data_get ( Eeze_Disk disk)

Retrieve data previously associated with a disk.

Parameters
diskThe disk
Returns
The data

Data that has been previously associated with disk is returned with this function.

See also
eeze_disk_data_set
Since
1.1
EAPI void eeze_disk_data_set ( Eeze_Disk disk,
void *  data 
)

Associate data with a disk.

Parameters
diskThe disk
dataThe data

Data can be associated with disk with this function.

See also
eeze_disk_data_get
Since
1.1
EAPI const char* eeze_disk_devpath_get ( Eeze_Disk disk)

Return the /dev/ path of a disk.

Parameters
diskThe disk
Returns
The /dev/ path

This retrieves the /dev/ path that udev has created a device node at for disk.

Since
1.1

Referenced by eeze_disk_eject(), eeze_disk_mount(), eeze_disk_mount_point_get(), and eeze_disk_unmount().

EAPI Eina_Bool eeze_disk_eject ( Eeze_Disk disk)

Begin an eject operation on the disk.

Parameters
diskThe disk
Returns
EINA_TRUE if the operation was started, EINA_FALSE otherwise.

This call is used to begin an eject operation on disk. The operation will run asynchronously in a pipe, emitting an EEZE_EVENT_DISK_EJECT event with the disk object as its event on completion. If any errors are encountered, they will automatically logged to the eeze_disk domain and an EEZE_EVENT_DISK_ERROR event will be generated with an Eeze_Event_Disk_Error struct as its event.

NOTE: The return value of this function does not in any way reflect the mount state of a disk.

Since
1.1

References eeze_disk_devpath_get(), and eeze_disk_unmount().

EAPI void eeze_disk_free ( Eeze_Disk disk)

Frees a disk object.

Parameters
diskThe disk object to free

This call frees an Eeze_Disk. Once freed, the disk can no longer be used.

Since
1.1
EAPI const char* eeze_disk_fstype_get ( Eeze_Disk disk)

Return the filesystem of the disk (if known)

Parameters
diskThe disk
Returns
The filesystem type

This retrieves the filesystem that the disk is using, or NULL if unknown.

Since
1.1

Referenced by eeze_disk_mount().

EAPI void eeze_disk_function ( void  )

Use this function to determine whether your eeze is disk-capable.

Since applications will die if they run/compile against a function that doesn't exist, if your application successfully runs/compiles with this function then you have eeze_disk.

Since
1.1
EAPI const char* eeze_disk_label_get ( Eeze_Disk disk)

Return the label of the disk.

Parameters
diskThe disk
Returns
The label

This retrieves the label (name) of the disk, or NULL if unknown.

Since
1.1

Referenced by eeze_disk_mount_point_get().

EAPI const char* eeze_disk_model_get ( Eeze_Disk disk)

Return the model of the disk.

Parameters
diskThe disk
Returns
The model

This retrieves the model of the disk, or NULL if unknown.

Since
1.1
EAPI Eina_Bool eeze_disk_mount ( Eeze_Disk disk)

Begin a mount operation on the disk.

Parameters
diskThe disk
Returns
EINA_TRUE if the operation was started, EINA_FALSE otherwise.

This call is used to begin a mount operation on disk. The operation will run asynchronously in a pipe, emitting an EEZE_EVENT_DISK_MOUNT event with the disk object as its event on completion. If any errors are encountered, they will automatically logged to the eeze_disk domain and an EEZE_EVENT_DISK_ERROR event will be generated with an Eeze_Event_Disk_Error struct as its event.

NOTE: The return value of this function does not in any way reflect the mount state of a disk.

Since
1.1

References eeze_disk_devpath_get(), eeze_disk_fstype_get(), eeze_disk_mount_point_set(), EEZE_DISK_MOUNTOPT_NODEV, EEZE_DISK_MOUNTOPT_UID, and eeze_disk_uuid_get().

EAPI const char* eeze_disk_mount_point_get ( Eeze_Disk disk)

Return the mount point of a disk.

Parameters
diskThe disk
Returns
The mount point

This function returns the mount point associated with disk. Note that to determine whether the disk is actually mounted, eeze_disk_mounted_get should be used.

Since
1.1

References eeze_disk_devpath_get(), eeze_disk_label_get(), and eeze_disk_uuid_get().

EAPI Eina_Bool eeze_disk_mount_point_set ( Eeze_Disk disk,
const char *  mount_point 
)

Set the mount point of a disk.

Parameters
diskThe disk
mount_pointThe mount point
Returns
EINA_TRUE on success, EINA_FALSE otherwise.

This function sets the mount point associated with disk. Note that to determine whether the disk is actually mounted, eeze_disk_mounted_get should be used. Also note that this function cannot be used while the disk is mounted to avoid losing the current mount point.

Since
1.1

Referenced by eeze_disk_mount().

EAPI const char* eeze_disk_mount_wrapper_get ( Eeze_Disk disk)

Get the previously set mount wrapper for a disk.

Parameters
diskThe disk
Returns
The wrapper, or NULL on failure.

This returns the wrapper previously set with eeze_disk_mount_wrapper_set

Since
1.1
EAPI Eina_Bool eeze_disk_mount_wrapper_set ( Eeze_Disk disk,
const char *  wrapper 
)

Set a wrapper to run mount commands with.

Parameters
diskThe disk to wrap mount commands for
wrapperThe wrapper executable
Returns
EINA_TRUE on success, EINA_FALSE otherwise.

Use this function to set up a wrapper for running mount/umount commands. The wrapper must NOT use any of the standard mount/umount error code return values, and it must return 0 on success. Note that this function will call stat() on wrapper if not NULL to test for existence.

Since
1.1
EAPI Eina_Bool eeze_disk_mounted_get ( Eeze_Disk disk)

Return the mount state of a disk.

Parameters
diskThe disk
Returns
The mount state

This returns the mounted state of the disk. EINA_TRUE if mounted, EINA_FALSE otherwise.

Since
1.1
EAPI unsigned long eeze_disk_mountopts_get ( Eeze_Disk disk)

Get the flags of a disk's current mount options.

Parameters
diskThe disk
Returns
An ORed set of Eeze_Mount_Opts, 0 on failure

This function returns the current mount opts of a disk.

Since
1.1
EAPI Eina_Bool eeze_disk_mountopts_set ( Eeze_Disk disk,
unsigned long  opts 
)

Set the mount options using flags.

Parameters
diskThe disk
optsAn ORed set of Eeze_Mount_Opts
Returns
EINA_TRUE on success, EINA_FALSE otherwise.

This function replaces the current mount opts of a disk with the ones in opts.

Since
1.1

References EEZE_DISK_MOUNTOPT_UID.

EAPI Eeze_Disk* eeze_disk_new ( const char *  path)

Create a new disk object from a /sys/ path or /dev/ path.

Parameters
pathThe /sys/ or /dev path of the disk; CANNOT be NULL.
Returns
The new disk object

This function creates a new Eeze_Disk from path. Note that this function does the minimal amount of work in order to save memory, and udev info about the disk is not retrieved in this call.

Since
1.1

References eeze_udev_devpath_get_syspath().

EAPI Eeze_Disk* eeze_disk_new_from_mount ( const char *  mount_point)

Create a new disk object from a mount point.

Parameters
mount_pointThe mount point of the disk; CANNOT be NULL
Returns
The new disk object

This function creates a new Eeze_Disk from mount_point. Note that this function does the minimal amount of work in order to save memory, and udev info about the disk is not retrieved in this call. If the disk is not currently mounted, it must have an entry in /etc/fstab.

Since
1.1

References eeze_udev_devpath_get_syspath().

EAPI Eina_Bool eeze_disk_removable_get ( Eeze_Disk disk)

Return whether the disk is removable.

Parameters
diskThe disk
Returns
EINA_TRUE if removable, EINA_FALSE otherwise.
Since
1.1
EAPI void eeze_disk_scan ( Eeze_Disk disk)

Retrieve all disk information.

Parameters
diskUse this function to retrieve all of a disk's information at once, then use a "get" function to retrieve the value. Data retrieved in this call is cached, meaning that subsequent calls will return immediately without performing any work.
Since
1.1
EAPI const char* eeze_disk_serial_get ( Eeze_Disk disk)

Return the serial number of the disk.

Parameters
diskThe disk
Returns
The serial number

This retrieves the serial number the disk, or NULL if unknown.

Since
1.1
EAPI const char* eeze_disk_syspath_get ( Eeze_Disk disk)

Return the /sys/ path of a disk.

Parameters
diskThe disk
Returns
The /sys/ path

This retrieves the /sys/ path that udev associates with disk.

Since
1.1
EAPI Eeze_Disk_Type eeze_disk_type_get ( Eeze_Disk disk)

Return the Eeze_Disk_Type of the disk.

Parameters
diskThe disk
Returns
The type

This retrieves the Eeze_Disk_Type of the disk. This call is useful for determining the bus that the disk is connected through.

Since
1.1

References EEZE_DISK_TYPE_UNKNOWN.

EAPI const char* eeze_disk_udev_get_parent ( Eeze_Disk disk)

Find the root device of a disk.

Parameters
diskThe disk
Returns
The syspath of the parent device

Return a stringshared syspath (/sys/$syspath) for the parent device.

Since
1.1
EAPI const char* eeze_disk_udev_get_property ( Eeze_Disk disk,
const char *  property 
)

Get the property value of a disk.

Parameters
diskThe disk
propertyThe property to get; full list of these is a FIXME
Returns
A stringshared char* with the property or NULL on failure.
Since
1.1
EAPI const char* eeze_disk_udev_get_sysattr ( Eeze_Disk disk,
const char *  sysattr 
)

Get the sysattr value of a disk.

Parameters
diskThe disk
sysattrThe sysattr to get; full list of these is a FIXME
Returns
A stringshared char* with the sysattr or NULL on failure.
Since
1.1
EAPI Eina_Bool eeze_disk_udev_walk_check_sysattr ( Eeze_Disk disk,
const char *  sysattr,
const char *  value 
)

Walks up the device chain using the device from disk, checking each device for sysattr with (optional) value.

Parameters
diskThe disk to walk
sysattrThe attribute to find
valueOPTIONAL: The value that sysattr should have, or NULL.
Returns
If the sysattr (with value) is found, returns EINA_TRUE, EINA_FALSE otherwise.
Since
1.1
EAPI const char* eeze_disk_udev_walk_get_sysattr ( Eeze_Disk disk,
const char *  sysattr 
)

Walks up the device chain of disk checking each device for sysattr and returns the value if found.

Parameters
diskThe disk
sysattrThe attribute to find
Returns
The stringshared value of sysattr if found, or NULL.
Since
1.1
EAPI Eina_Bool eeze_disk_unmount ( Eeze_Disk disk)

Begin an unmount operation on the disk.

Parameters
diskThe disk
Returns
EINA_TRUE if the operation was started, EINA_FALSE otherwise.

This call is used to begin an unmount operation on disk. The operation will run asynchronously in a pipe, emitting an EEZE_EVENT_DISK_UNMOUNT event with the disk object as its event on completion. If any errors are encountered, they will automatically logged to the eeze_disk domain and an EEZE_EVENT_DISK_ERROR event will be generated with an Eeze_Event_Disk_Error struct as its event.

NOTE: The return value of this function does not in any way reflect the mount state of a disk.

Since
1.1

References eeze_disk_devpath_get().

Referenced by eeze_disk_eject().

EAPI const char* eeze_disk_uuid_get ( Eeze_Disk disk)

Return the UUID of the disk.

Parameters
diskThe disk
Returns
The UUID

This retrieves the UUID of the disk, or NULL if unknown. A UUID is a 36 character (hopefully) unique identifier which can be used to store persistent information about a disk.

Since
1.1

Referenced by eeze_disk_mount(), and eeze_disk_mount_point_get().

EAPI const char* eeze_disk_vendor_get ( Eeze_Disk disk)

Return the manufacturing vendor of the disk.

Parameters
diskThe disk
Returns
The vendor

This retrieves the vendor which manufactured the disk, or NULL if unknown.

Since
1.1
EAPI Eina_Bool eeze_mount_fstab_scan ( void  )

Scan /etc/fstab a single time.

Returns
EINA_TRUE if mtab could be scanned, EINA_FALSE otherwise.

This function is used to perform a single scan on /etc/fstab. It is used to gather information about mounted filesystems which can then be used with your Eeze_Disk objects where appropriate. These files will automatically be scanned any time a mount point or mount state is requested unless eeze_mount_tabs_watch has been called previously, in which case data is stored for use. If this function is called after eeze_mount_tabs_watch, EINA_TRUE will be returned.

See also
eeze_mount_tabs_watch, eeze_mount_mtab_scan
Since
1.1
EAPI Eina_Bool eeze_mount_mtab_scan ( void  )

Scan /etc/mtab a single time.

Returns
EINA_TRUE if mtab could be scanned, EINA_FALSE otherwise.

This function is used to perform a single scan on /etc/mtab. It is used to gather information about mounted filesystems which can then be used with your Eeze_Disk objects where appropriate. These files will automatically be scanned any time a mount point or mount state is requested unless eeze_mount_tabs_watch has been called previously, in which case data is stored for use. If this function is called after eeze_mount_tabs_watch, EINA_TRUE will be returned.

See also
eeze_mount_tabs_watch, eeze_mount_fstab_scan
Since
1.1
EAPI void eeze_mount_tabs_unwatch ( void  )

Stop watching /etc/fstab and /etc/mtab.

This function stops watching fstab and mtab. Data obtained previously will be saved.

Since
1.1
EAPI Eina_Bool eeze_mount_tabs_watch ( void  )

Begin watching mtab and fstab.

Returns
EINA_TRUE if watching was started, EINA_FALSE otherwise.

This function creates inotify watches on /etc/mtab and /etc/fstab and watches them for changes. This function should be used when expecting a lot of disk mounting/unmounting while you need disk data since it will automatically update certain necessary data instead of waiting.

See also
eeze_mount_mtab_scan, eeze_mount_fstab_scan
Since
1.1