-/**
-@file eeze.dox
-@brief Eeze Device Library
-*/
-
-/**
-@mainpage Eeze
-@image html eeze.png
-@version @PACKAGE_VERSION@
-@author Mike Blumenkrantz (zmike/discomfitor) <mike@@zentific.com>
-@date 2010-2011
-
-@section intro What is Eeze?
-
-Eeze is a library for manipulating devices through udev with a simple and fast
-api. It interfaces directly with libudev, avoiding such middleman daemons as
-udisks/upower or hal, to immediately gather device information the instant it
-becomes known to the system. This can be used to determine such things as:
-@li If a cdrom has a disk inserted
-@li The temperature of a cpu core
-@li The remaining power left in a battery
-@li The current power consumption of various parts
-@li Monitor in realtime the status of peripheral devices
-
-Each of the above examples can be performed by using only a single eeze
-function, as one of the primary focuses of the library is to reduce the
-complexity of managing devices.
-
-@li @link Eeze.h Eeze functions @endlink
-@li @ref udev UDEV functions
- @li @ref watch Functions that watch for events
- @li @ref syspath Functions that accept a device /sys/ path
- @li @ref find Functions which find types of devices
-
-@verbatim
-Pants
-@endverbatim
-*/
+/**
+ @brief Eeze Device Library
+ *
+ @mainpage Eeze
+ @image html eeze.png
+ @version 1.0.0
+ @author Mike Blumenkrantz (zmike/discomfitor) <mike@@zentific.com>
+ @date 2010-2011
+
+ @section intro What is Eeze?
+
+ Eeze is a library for manipulating devices through udev with a simple and fast
+ api. It interfaces directly with libudev, avoiding such middleman daemons as
+ udisks/upower or hal, to immediately gather device information the instant it
+ becomes known to the system. This can be used to determine such things as:
+ @li If a cdrom has a disk inserted
+ @li The temperature of a cpu core
+ @li The remaining power left in a battery
+ @li The current power consumption of various parts
+ @li Monitor in realtime the status of peripheral devices
+
+ Each of the above examples can be performed by using only a single eeze
+ function, as one of the primary focuses of the library is to reduce the
+ complexity of managing devices.
+
+ @li @link Eeze.h Eeze functions @endlink
+ @li @ref udev UDEV functions
+ @li @ref watch Functions that watch for events
+ @li @ref syspath Functions that accept a device /sys/ path
+ @li @ref find Functions which find types of devices
+
+ @verbatim
+ Pants
+ @endverbatim
+ */
#ifndef EEZE_UDEV_H
#define EEZE_UDEV_H
*
* For udev functions, see @ref udev.
*/
+
+/**
+ * @defgroup main main
+ *
+ * These are general eeze functions which include init and shutdown.
+ */
+
+/**
+ * @defgroup udev udev
+ *
+ * These are functions which interact directly with udev.
+ */
+
/**
* @addtogroup udev
*
*/
typedef void(*Eeze_Udev_Watch_Cb)(const char *, Eeze_Udev_Event, void *, Eeze_Udev_Watch *);
- EAPI int eeze_init(void);
- EAPI int eeze_shutdown(void);
-
- EAPI Eina_List *eeze_udev_find_similar_from_syspath(const char *syspath);
- EAPI Eina_List *eeze_udev_find_unlisted_similar(Eina_List *list);
- EAPI Eina_List *eeze_udev_find_by_sysattr(const char *sysattr, const char *value);
- EAPI Eina_List *eeze_udev_find_by_type(Eeze_Udev_Type type, const char *name);
- EAPI Eina_List *eeze_udev_find_by_filter(const char *subsystem, const char *type, const char *name);
-
- EAPI const char *eeze_udev_devpath_get_syspath(const char *devpath);
- EAPI const char *eeze_udev_syspath_get_parent(const char *syspath);
- EAPI Eina_List *eeze_udev_syspath_get_parents(const char *syspath);
- EAPI const char *eeze_udev_syspath_get_devpath(const char *syspath);
- EAPI const char *eeze_udev_syspath_get_devname(const char *syspath);
- EAPI const char *eeze_udev_syspath_get_subsystem(const char *syspath);
- EAPI const char *eeze_udev_syspath_get_property(const char *syspath, const char *property);
- EAPI const char *eeze_udev_syspath_get_sysattr(const char *syspath, const char *sysattr);
-
- EAPI Eina_Bool eeze_udev_syspath_is_mouse(const char *syspath);
- EAPI Eina_Bool eeze_udev_syspath_is_kbd(const char *syspath);
- EAPI Eina_Bool eeze_udev_syspath_is_touchpad(const char *syspath);
-
- EAPI Eina_Bool eeze_udev_walk_check_sysattr(const char *syspath, const char *sysattr, const char *value);
- EAPI const char *eeze_udev_walk_get_sysattr(const char *syspath, const char *sysattr);
-
- EAPI Eeze_Udev_Watch *eeze_udev_watch_add(Eeze_Udev_Type type, int event, Eeze_Udev_Watch_Cb cb, void *user_data);
- EAPI void *eeze_udev_watch_del(Eeze_Udev_Watch *watch);
+
+/**
+ * Initialize the eeze library.
+ * @return The number of times the function has been called, or -1 on failure.
+ *
+ * This function should be called prior to using any eeze functions, and MUST
+ * be called prior to using any udev functions to avoid a segv.
+ *
+ * @ingroup main
+ */
+EAPI int eeze_init(void);
+
+/**
+ * Shut down the eeze library.
+ * @return The number of times the eeze_init has been called, or -1 when
+ * all occurrences of eeze have been shut down.
+ *
+ * This function should be called when no further eeze functions will be called.
+ *
+ * @ingroup main
+ */
+EAPI int eeze_shutdown(void);
+
+ /**
+ * @addtogroup find Find
+ *
+ * These are functions which find/supplement lists of devices.
+ *
+ * @ingroup udev
+ *
+ * @{
+ */
+
+/**
+ * Returns a stringshared list of all syspaths that are (or should be) the same
+ * device as the device pointed at by @p syspath.
+ *
+ * @param syspath The syspath of the device to find matches for
+ * @return All devices which are the same as the one passed
+ */
+EAPI Eina_List *eeze_udev_find_similar_from_syspath(const char *syspath);
+
+/**
+ * Updates a list of all syspaths that are (or should be) the same
+ * device.
+ *
+ * @param list The list of devices to update
+ * @return The updated list
+ *
+ * This function will update @p list to include all devices matching
+ * devices with syspaths currently stored in @p list. All strings are
+ * stringshared.
+ */
+EAPI Eina_List *eeze_udev_find_unlisted_similar(Eina_List *list);
+
+/**
+ * Find a list of devices by a sysattr (and, optionally, a value of that sysattr).
+ *
+ * @param sysattr The attribute to find
+ * @param value Optional: the value that the attribute should have
+ *
+ * @return A stringshared list of the devices found with the attribute
+ *
+ * @ingroup find
+ */
+EAPI Eina_List *eeze_udev_find_by_sysattr(const char *sysattr, const char *value);
+
+/**
+ * Find devices using an #Eeze_Udev_Type and/or a name.
+ *
+ * @param etype An #Eeze_Udev_Type or 0
+ * @param name A filter for the device name or #NULL
+ * @return A stringshared Eina_List of matched devices or #NULL on failure
+ *
+ * Return a list of syspaths (/sys/$syspath) for matching udev devices.
+ */
+EAPI Eina_List *eeze_udev_find_by_type(Eeze_Udev_Type type, const char *name);
+
+/**
+ * A more advanced find, allows finds using udev properties.
+ *
+ * @param subsystem The udev subsystem to filter by, or NULL
+ * @param type "ID_INPUT_KEY", "ID_INPUT_MOUSE", "ID_INPUT_TOUCHPAD", NULL, etc
+ * @param name A filter for the device name, or NULL
+ * @return A stringshared Eina_List* of matched devices or NULL on failure
+ *
+ * Return a list of syspaths (/sys/$syspath) for matching udev devices.
+ * Requires at least one filter.
+ */
+EAPI Eina_List *eeze_udev_find_by_filter(const char *subsystem, const char *type, const char *name);
+ /**
+ * @}
+ */
+
+ /**
+ * @addtogroup syspath Syspath
+ *
+ * These are functions which interact with the syspath (/sys/$PATH) of
+ * a device.
+ *
+ * @ingroup udev
+ *
+ * @{
+ */
+
+/**
+ * Get the syspath of a device from the /dev/ path.
+ *
+ * @param devpath The /dev/ path of the device
+ * @return A stringshared char* which corresponds to the /sys/ path of the device or NULL on failure
+ *
+ * Takes "/dev/path" and returns the corresponding /sys/ path (without the "/sys/")
+ */
+EAPI const char *eeze_udev_devpath_get_syspath(const char *devpath);
+
+/**
+ * Find the root device of a device from its syspath.
+ *
+ * @param syspath The syspath of a device, with or without "/sys/"
+ * @return The syspath of the parent device
+ *
+ * Return a stringshared syspath (/sys/$syspath) for the parent device.
+ */
+EAPI const char *eeze_udev_syspath_get_parent(const char *syspath);
+
+/**
+ * Returns a list of all parent device syspaths for @p syspath.
+ *
+ * @param syspath The device to find parents of
+ * @return A stringshared list of the parent devices of @p syspath
+ */
+EAPI Eina_List *eeze_udev_syspath_get_parents(const char *syspath);
+
+/**
+ * Get the /dev/ path from the /sys/ path.
+ *
+ * @param syspath The /sys/ path with or without the /sys/
+ * @return A stringshared char* with the /dev/ path or NULL on failure
+ *
+ * Takes /sys/$PATH and turns it into the corresponding "/dev/x/y".
+ */
+EAPI const char *eeze_udev_syspath_get_devpath(const char *syspath);
+
+/**
+ * Get the /dev/ name from the /sys/ path.
+ *
+ * @param syspath The /sys/ path with or without the /sys/
+ * @return A stringshared char* of the device name without the /dev/ path, or NULL on failure
+ *
+ * Takes /sys/$PATH and turns it into the corresponding /dev/x/"y".
+ */
+EAPI const char *eeze_udev_syspath_get_devname(const char *syspath);
+
+/**
+ * Get the subsystem of a device from the /sys/ path.
+ *
+ * @param syspath The /sys/ path with or without the /sys/
+ * @return A stringshared char* with the subsystem of the device or NULL on failure
+ *
+ * Takes /sys/$PATH and returns the corresponding device subsystem,
+ * such as "input" for keyboards/mice.
+ */
+EAPI const char *eeze_udev_syspath_get_subsystem(const char *syspath);
+
+/**
+ * Get the property value of a device from the /sys/ path.
+ *
+ * @param syspath The /sys/ path with or without the /sys/
+ * @param property The property to get; full list of these is a FIXME
+ * @return A stringshared char* with the property or NULL on failure
+ */
+EAPI const char *eeze_udev_syspath_get_property(const char *syspath, const char *property);
+
+/**
+ * Get the sysattr value of a device from the /sys/ path.
+ *
+ * @param syspath The /sys/ path with or without the /sys/
+ * @param sysattr The sysattr to get; full list of these is a FIXME
+ * @return A stringshared char* with the sysattr or NULL on failure
+ */
+EAPI const char *eeze_udev_syspath_get_sysattr(const char *syspath, const char *sysattr);
+
+/**
+ * Checks whether the device is a mouse.
+ *
+ * @param syspath The /sys/ path with or without the /sys/
+ * @return If true, the device is a mouse
+ */
+EAPI Eina_Bool eeze_udev_syspath_is_mouse(const char *syspath);
+
+/**
+ * Checks whether the device is a keyboard.
+ *
+ * @param syspath The /sys/ path with or without the /sys/
+ * @return If true, the device is a keyboard
+ */
+EAPI Eina_Bool eeze_udev_syspath_is_kbd(const char *syspath);
+
+/**
+ * Checks whether the device is a touchpad.
+ *
+ * @param syspath The /sys/ path with or without the /sys/
+ * @return If true, the device is a touchpad
+ */
+EAPI Eina_Bool eeze_udev_syspath_is_touchpad(const char *syspath);
+ /**
+ * @}
+ */
+
+ /**
+ * @addtogroup walks Walks
+ *
+ * These are functions which walk up the device chain.
+ *
+ * @ingroup udev
+ *
+ * @{
+ */
+
+/**
+ * Walks up the device chain starting at @p syspath,
+ * checking each device for @p sysattr with (optional) @p value.
+ *
+ * @param syspath The /sys/ path of the device to start at, with or without the /sys/
+ * @param sysattr The attribute to find
+ * @param value OPTIONAL: The value that @p sysattr should have, or NULL
+ *
+ * @return If the sysattr (with value) is found, returns TRUE. Else, false.
+ */
+EAPI Eina_Bool eeze_udev_walk_check_sysattr(const char *syspath, const char *sysattr, const char *value);
+
+/**
+ * Walks up the device chain starting at @p syspath,
+ * checking each device for @p sysattr, and returns the value if found.
+ *
+ * @param syspath The /sys/ path of the device to start at, with or without the /sys/
+ * @param sysattr The attribute to find
+ *
+ * @return The stringshared value of @p sysattr if found, or NULL
+ */
+EAPI const char *eeze_udev_walk_get_sysattr(const char *syspath, const char *sysattr);
+ /**
+ * @}
+ */
+
+ /**
+ * @addtogroup watch Watch
+ *
+ * @brief These are functions which monitor udev for events.
+ *
+ * Eeze watches are simple: you specify a type of device to watch (or all devices), some events (or all) to watch for, a callback,
+ * and some data, and then udev watches those device types for events of the type you specified. Your callback is called with a
+ * syspath of the triggering device and the event that happened to the device, along with the data you associated with the watch and
+ * the watch object itself in case you want to stop the watch easily in a callback.
+ *
+ * @ingroup udev
+ *
+ * @{
+ */
+
+/**
+ * Add a watch for a device type
+ *
+ * @param type The #Eeze_Udev_Type to watch
+ * @param event The events to watch; an OR list of #Eeze_Udev_Event (ie (#EEZE_UDEV_EVENT_ADD | #EEZE_UDEV_EVENT_REMOVE)), or 0 for all events
+ * @param cb The function to call when the watch receives data of type #Eeze_Udev_Watch_Cb
+ * @param user_data Data to pass to the callback function
+ *
+ * @return A watch struct for the watch type specified, or NULL on failure
+ *
+ * Eeze watches will monitor udev for changes of type(s) @p event to devices of type @p type. When these changes occur, the stringshared
+ * syspath of the device will be sent to function @p func, along with the bitmask of the event type which can be detected through
+ * binary &.
+ */
+EAPI Eeze_Udev_Watch *eeze_udev_watch_add(Eeze_Udev_Type type, int event, Eeze_Udev_Watch_Cb cb, void *user_data);
+
+/**
+ * Deletes a watch.
+ *
+ * @param watch An Eeze_Udev_Watch object
+ * @return The data originally associated with the watch, or NULL
+ *
+ * Deletes a watch, closing file descriptors and freeing related udev memory.
+ */
+EAPI void *eeze_udev_watch_del(Eeze_Udev_Watch *watch);
+ /**
+ * @}
+ */
#ifdef __cplusplus
}
EEZE_DISK_MOUNTOPT_REMOUNT = (1 << 5)
} Eeze_Mount_Opts;
+
+/**
+ * @brief Use this function to determine whether your eeze is disk-capable
+ *
+ * Since applications will die if they run against a function that doesn't exist,
+ * if your application successfully runs this function then you have eeze_disk.
+ */
EAPI extern int EEZE_EVENT_DISK_MOUNT;
EAPI extern int EEZE_EVENT_DISK_UNMOUNT;
EAPI extern int EEZE_EVENT_DISK_ERROR;
};
EAPI void eeze_disk_function(void);
+
+/**
+ * @brief Create a new disk object from a /sys/ path or /dev/ path
+ * @param path The /sys/ or /dev path of the disk; CANNOT be #NULL
+ * @return The new disk object
+ *
+ * This function creates a new #Eeze_Disk from @p 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.
+ */
EAPI Eeze_Disk *eeze_disk_new(const char *path);
+
+/**
+ * @brief Create a new disk object from a mount point
+ * @param mount_point The mount point of the disk; CANNOT be #NULL
+ * @return The new disk object
+ *
+ * This function creates a new #Eeze_Disk from @p 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.
+ */
EAPI Eeze_Disk *eeze_disk_new_from_mount(const char *mount_point);
+
+/**
+ * @brief Frees a disk object
+ * @param disk The disk object to free
+ *
+ * This call frees an #Eeze_Disk. Once freed, the disk can no longer be used.
+ */
EAPI void eeze_disk_free(Eeze_Disk *disk);
+
+/**
+ * @brief Retrieve all disk information
+ * @param disk
+ *
+ * Use 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.
+ */
EAPI void eeze_disk_scan(Eeze_Disk *disk);
+
+/**
+ * @brief Associate data with a disk
+ * @param disk The disk
+ * @param data The data
+ *
+ * Data can be associated with @p disk with this function.
+ * @see eeze_disk_data_get
+ */
EAPI void eeze_disk_data_set(Eeze_Disk *disk, void *data);
+
+/**
+ * @brief Retrieve data previously associated with a disk
+ * @param disk The disk
+ * @return The data
+ *
+ * Data that has been previously associated with @p disk
+ * is returned with this function.
+ * @see eeze_disk_data_set
+ */
EAPI void *eeze_disk_data_get(Eeze_Disk *disk);
+
+/**
+ * @brief Return the /sys/ path of a disk
+ * @param disk The disk
+ * @return The /sys/ path
+ *
+ * This retrieves the /sys/ path that udev associates with @p disk.
+ */
EAPI const char *eeze_disk_syspath_get(Eeze_Disk *disk);
+
+/**
+ * @brief Return the /dev/ path of a disk
+ * @param disk The disk
+ * @return The /dev/ path
+ *
+ * This retrieves the /dev/ path that udev has created a device node at for @p disk.
+ */
EAPI const char *eeze_disk_devpath_get(Eeze_Disk *disk);
+
+/**
+ * @brief Return the filesystem of the disk (if known)
+ * @param disk The disk
+ * @return The filesystem type
+ *
+ * This retrieves the filesystem that the disk is using, or #NULL if unknown.
+ */
EAPI const char *eeze_disk_fstype_get(Eeze_Disk *disk);
+
+/**
+ * @brief Return the manufacturing vendor of the disk
+ * @param disk The disk
+ * @return The vendor
+ *
+ * This retrieves the vendor which manufactured the disk, or #NULL if unknown.
+ */
EAPI const char *eeze_disk_vendor_get(Eeze_Disk *disk);
+
+/**
+ * @brief Return the model of the disk
+ * @param disk The disk
+ * @return The model
+ *
+ * This retrieves the model of the disk, or #NULL if unknown.
+ */
EAPI const char *eeze_disk_model_get(Eeze_Disk *disk);
+
+/**
+ * @brief Return the serial number of the disk
+ * @param disk The disk
+ * @return The serial number
+ *
+ * This retrieves the serial number the disk, or #NULL if unknown.
+ */
EAPI const char *eeze_disk_serial_get(Eeze_Disk *disk);
+
+/**
+ * @brief Return the UUID of the disk
+ * @param disk The disk
+ * @return 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.
+ */
EAPI const char *eeze_disk_uuid_get(Eeze_Disk *disk);
+
+/**
+ * @brief Return the label of the disk
+ * @param disk The disk
+ * @return The label
+ *
+ * This retrieves the label (name) of the disk, or #NULL if unknown.
+ */
EAPI const char *eeze_disk_label_get(Eeze_Disk *disk);
+
+/**
+ * @brief Return the #Eeze_Disk_Type of the disk
+ * @param disk The disk
+ * @return 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.
+ */
EAPI Eeze_Disk_Type eeze_disk_type_get(Eeze_Disk *disk);
EAPI Eina_Bool eeze_disk_removable_get(Eeze_Disk *disk);
+
+/**
+ * @brief Return the mount state of a disk
+ * @param disk The disk
+ * @return The mount state
+ *
+ * This returns the mounted state of the disk. #EINA_TRUE if mounted, else #EINA_FALSE.
+ */
EAPI Eina_Bool eeze_disk_mounted_get(Eeze_Disk *disk);
+
+/**
+ * @brief Begin a mount operation on the disk
+ * @param disk The disk
+ * @return #EINA_TRUE if the operation was started, else #EINA_FALSE
+ *
+ * This call is used to begin a mount operation on @p 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.
+ */
EAPI Eina_Bool eeze_disk_mount(Eeze_Disk *disk);
+
+/**
+ * @brief Begin an unmount operation on the disk
+ * @param disk The disk
+ * @return #EINA_TRUE if the operation was started, else #EINA_FALSE
+ *
+ * This call is used to begin an unmount operation on @p 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.
+ */
EAPI Eina_Bool eeze_disk_unmount(Eeze_Disk *disk);
+
+/**
+ * @brief Return the mount point of a disk
+ * @param disk The disk
+ * @return The mount point
+ *
+ * This function returns the mount point associated with @p disk.
+ * Note that to determine whether the disk is actually mounted, eeze_disk_mounted_get should be used.
+ */
EAPI const char *eeze_disk_mount_point_get(Eeze_Disk *disk);
+
+/**
+ * @brief Set the mount point of a disk
+ * @param disk The disk
+ * @param mount_point The mount point
+ * @return EINA_TRUE on success, else EINA_FALSE
+ *
+ * This function sets the mount point associated with @p 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.
+ */
EAPI Eina_Bool eeze_disk_mount_point_set(Eeze_Disk *disk, const char *mount_point);
+
+/**
+ * @brief Set the mount options using flags
+ * @param disk The disk
+ * @param opts An ORed set of #Eeze_Mount_Opts
+ * @return EINA_TRUE on success, else EINA_FALSE
+ *
+ * This function replaces the current mount opts of a disk with the ones in @p opts.
+ */
EAPI Eina_Bool eeze_disk_mountopts_set(Eeze_Disk *disk, unsigned long opts);
+
+/**
+ * @brief Get the flags of a disk's current mount options
+ * @param disk The disk
+ * @return An ORed set of #Eeze_Mount_Opts, 0 on failure
+ *
+ * This function returns the current mount opts of a disk.
+ */
EAPI unsigned long eeze_disk_mountopts_get(Eeze_Disk *disk);
+
+/**
+ * @brief Begin watching mtab and fstab
+ * @return #EINA_TRUE if watching was started, else #EINA_FALSE
+ *
+ * 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 eeze_mount_mtab_scan, eeze_mount_fstab_scan
+ */
EAPI Eina_Bool eeze_mount_tabs_watch(void);
+
+/**
+ * @brief Stop watching /etc/fstab and /etc/mtab
+ *
+ * This function stops watching fstab and mtab. Data obtained previously will be saved.
+ */
EAPI void eeze_mount_tabs_unwatch(void);
+
+/**
+ * @brief Scan /etc/mtab a single time
+ * @return #EINA_TRUE if mtab could be scanned, else #EINA_FALSE
+ *
+ * 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 eeze_mount_tabs_watch, eeze_mount_fstab_scan
+ */
EAPI Eina_Bool eeze_mount_mtab_scan(void);
+
+/**
+ * @brief Scan /etc/fstab a single time
+ * @return #EINA_TRUE if mtab could be scanned, else #EINA_FALSE
+ *
+ * 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 eeze_mount_tabs_watch, eeze_mount_mtab_scan
+ */
EAPI Eina_Bool eeze_mount_fstab_scan(void);
#ifdef __cplusplus
}
#endif
-/** @} */
-
+/**
+ * @}
+ */
#endif
#include "eeze_udev_private.h"
#include "eeze_disk_private.h"
-/**
- * @addtogroup disk Disk
- * @{
- */
-
static Eeze_Disk_Type
_eeze_disk_type_find(Eeze_Disk *disk)
{
}
-/**
- * @brief Use this function to determine whether your eeze is disk-capable
- *
- * Since applications will die if they run against a function that doesn't exist,
- * if your application successfully runs this function then you have eeze_disk.
- */
EAPI void
eeze_disk_function(void)
{
}
-/**
- * @brief Create a new disk object from a /sys/ path or /dev/ path
- * @param path The /sys/ or /dev path of the disk; CANNOT be #NULL
- * @return The new disk object
- *
- * This function creates a new #Eeze_Disk from @p 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.
- */
EAPI Eeze_Disk *
eeze_disk_new(const char *path)
{
return disk;
}
-/**
- * @brief Create a new disk object from a mount point
- * @param mount_point The mount point of the disk; CANNOT be #NULL
- * @return The new disk object
- *
- * This function creates a new #Eeze_Disk from @p 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.
- */
EAPI Eeze_Disk *
eeze_disk_new_from_mount(const char *mount_point)
{
return NULL;
}
-/**
- * @brief Frees a disk object
- * @param disk The disk object to free
- *
- * This call frees an #Eeze_Disk. Once freed, the disk can no longer be used.
- */
EAPI void
eeze_disk_free(Eeze_Disk *disk)
{
free(disk);
}
-/**
- * @brief Retrieve all disk information
- * @param disk
- *
- * Use 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.
- */
EAPI void
eeze_disk_scan(Eeze_Disk *disk)
{
disk->cache.filled = EINA_TRUE;
}
-/**
- * @brief Associate data with a disk
- * @param disk The disk
- * @param data The data
- *
- * Data can be associated with @p disk with this function.
- * @see eeze_disk_data_get
- */
EAPI void
eeze_disk_data_set(Eeze_Disk *disk, void *data)
{
disk->data = data;
}
-/**
- * @brief Retrieve data previously associated with a disk
- * @param disk The disk
- * @return The data
- *
- * Data that has been previously associated with @p disk
- * is returned with this function.
- * @see eeze_disk_data_set
- */
EAPI void *
eeze_disk_data_get(Eeze_Disk *disk)
{
return disk->data;
}
-/**
- * @brief Return the /sys/ path of a disk
- * @param disk The disk
- * @return The /sys/ path
- *
- * This retrieves the /sys/ path that udev associates with @p disk.
- */
EAPI const char *
eeze_disk_syspath_get(Eeze_Disk *disk)
{
return disk->syspath;
}
-/**
- * @brief Return the /dev/ path of a disk
- * @param disk The disk
- * @return The /dev/ path
- *
- * This retrieves the /dev/ path that udev has created a device node at for @p disk.
- */
EAPI const char *
eeze_disk_devpath_get(Eeze_Disk *disk)
{
return disk->devpath;
}
-/**
- * @brief Return the filesystem of the disk (if known)
- * @param disk The disk
- * @return The filesystem type
- *
- * This retrieves the filesystem that the disk is using, or #NULL if unknown.
- */
EAPI const char *
eeze_disk_fstype_get(Eeze_Disk *disk)
{
return disk->fstype;
}
-/**
- * @brief Return the manufacturing vendor of the disk
- * @param disk The disk
- * @return The vendor
- *
- * This retrieves the vendor which manufactured the disk, or #NULL if unknown.
- */
EAPI const char *
eeze_disk_vendor_get(Eeze_Disk *disk)
{
return disk->cache.vendor;
}
-/**
- * @brief Return the model of the disk
- * @param disk The disk
- * @return The model
- *
- * This retrieves the model of the disk, or #NULL if unknown.
- */
EAPI const char *
eeze_disk_model_get(Eeze_Disk *disk)
{
return disk->cache.model;
}
-/**
- * @brief Return the serial number of the disk
- * @param disk The disk
- * @return The serial number
- *
- * This retrieves the serial number the disk, or #NULL if unknown.
- */
EAPI const char *
eeze_disk_serial_get(Eeze_Disk *disk)
{
return disk->cache.serial;
}
-/**
- * @brief Return the UUID of the disk
- * @param disk The disk
- * @return 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.
- */
EAPI const char *
eeze_disk_uuid_get(Eeze_Disk *disk)
{
return disk->cache.uuid;
}
-/**
- * @brief Return the label of the disk
- * @param disk The disk
- * @return The label
- *
- * This retrieves the label (name) of the disk, or #NULL if unknown.
- */
EAPI const char *
eeze_disk_label_get(Eeze_Disk *disk)
{
return disk->cache.label;
}
-/**
- * @brief Return the #Eeze_Disk_Type of the disk
- * @param disk The disk
- * @return 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.
- */
EAPI Eeze_Disk_Type
eeze_disk_type_get(Eeze_Disk *disk)
{
disk->cache.removable = !!strtol(udev_device_get_sysattr_value(disk->device, "removable"), NULL, 10);
return disk->cache.removable;
}
-
-/** @} */
#include "eeze_udev_private.h"
#include "eeze_disk_private.h"
-/**
- * @addtogroup disk Disk
- * @{
- */
-
/*
*
* PRIVATE
*
*/
-/**
- * @brief Begin watching mtab and fstab
- * @return #EINA_TRUE if watching was started, else #EINA_FALSE
- *
- * 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 eeze_mount_mtab_scan, eeze_mount_fstab_scan
- */
EAPI Eina_Bool
eeze_mount_tabs_watch(void)
{
return EINA_FALSE;
}
-/**
- * @brief Stop watching /etc/fstab and /etc/mtab
- *
- * This function stops watching fstab and mtab. Data obtained previously will be saved.
- */
EAPI void
eeze_mount_tabs_unwatch(void)
{
ecore_file_monitor_del(_fstab_mon);
}
-/**
- * @brief Scan /etc/mtab a single time
- * @return #EINA_TRUE if mtab could be scanned, else #EINA_FALSE
- *
- * 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 eeze_mount_tabs_watch, eeze_mount_fstab_scan
- */
EAPI Eina_Bool
eeze_mount_mtab_scan(void)
{
return EINA_FALSE;
}
-/**
- * @brief Scan /etc/fstab a single time
- * @return #EINA_TRUE if mtab could be scanned, else #EINA_FALSE
- *
- * 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 eeze_mount_tabs_watch, eeze_mount_mtab_scan
- */
EAPI Eina_Bool
eeze_mount_fstab_scan(void)
{
error:
return EINA_FALSE;
}
-
-/** @} */
#include "eeze_udev_private.h"
#include "eeze_disk_private.h"
-
-/**
- * @addtogroup disk Disk
- * @{
- */
-
/*
*
* PRIVATE
error:
return EINA_FALSE;
}
-
-/** @} */
#define EEZE_MOUNT_DEFAULT_OPTS "noexec,nosuid,utf8"
-/**
- * @addtogroup disk Disk
- * @{
- */
-
EAPI int EEZE_EVENT_DISK_MOUNT = 0;
EAPI int EEZE_EVENT_DISK_UNMOUNT = 0;
EAPI int EEZE_EVENT_DISK_ERROR = 0;
*
*/
-/**
- * @brief Return the mount state of a disk
- * @param disk The disk
- * @return The mount state
- *
- * This returns the mounted state of the disk. #EINA_TRUE if mounted, else #EINA_FALSE.
- */
EAPI Eina_Bool
eeze_disk_mounted_get(Eeze_Disk *disk)
{
return eeze_disk_libmount_mounted_get(disk);
}
-/**
- * @brief Set the mount options using flags
- * @param disk The disk
- * @param opts An ORed set of #Eeze_Mount_Opts
- * @return EINA_TRUE on success, else EINA_FALSE
- *
- * This function replaces the current mount opts of a disk with the ones in @p opts.
- */
EAPI Eina_Bool
eeze_disk_mountopts_set(Eeze_Disk *disk, unsigned long opts)
{
return EINA_TRUE;
}
-/**
- * @brief Get the flags of a disk's current mount options
- * @param disk The disk
- * @return An ORed set of #Eeze_Mount_Opts, 0 on failure
- *
- * This function returns the current mount opts of a disk.
- */
EAPI unsigned long
eeze_disk_mountopts_get(Eeze_Disk *disk)
{
return disk->mount_opts;
}
-/**
- * @brief Begin a mount operation on the disk
- * @param disk The disk
- * @return #EINA_TRUE if the operation was started, else #EINA_FALSE
- *
- * This call is used to begin a mount operation on @p 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.
- */
EAPI Eina_Bool
eeze_disk_mount(Eeze_Disk *disk)
{
return EINA_TRUE;
}
-/**
- * @brief Begin an unmount operation on the disk
- * @param disk The disk
- * @return #EINA_TRUE if the operation was started, else #EINA_FALSE
- *
- * This call is used to begin an unmount operation on @p 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.
- */
EAPI Eina_Bool
eeze_disk_unmount(Eeze_Disk *disk)
{
return EINA_TRUE;
}
-/**
- * @brief Return the mount point of a disk
- * @param disk The disk
- * @return The mount point
- *
- * This function returns the mount point associated with @p disk.
- * Note that to determine whether the disk is actually mounted, eeze_disk_mounted_get should be used.
- */
EAPI const char *
eeze_disk_mount_point_get(Eeze_Disk *disk)
{
return NULL;
}
-/**
- * @brief Set the mount point of a disk
- * @param disk The disk
- * @param mount_point The mount point
- * @return EINA_TRUE on success, else EINA_FALSE
- *
- * This function sets the mount point associated with @p 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.
- */
EAPI Eina_Bool
eeze_disk_mount_point_set(Eeze_Disk *disk, const char *mount_point)
{
disk->unmount_cmd_changed = EINA_TRUE;
return EINA_TRUE;
}
-
-/** @} */
#include "eeze_udev_private.h"
#include "eeze_disk_private.h"
-/**
- * @defgroup udev udev
- *
- * These are functions which interact directly with udev.
- */
-
_udev *udev;
int _eeze_udev_log_dom = -1;
#endif
int _eeze_init_count = 0;
-/**
- * @defgroup main main
- *
- * These are general eeze functions which include init and shutdown.
- */
-
static Eeze_Version _version = { VMAJ, VMIN, VMIC, VREV };
EAPI Eeze_Version *eeze_version = &_version;
-/**
- * Initialize the eeze library.
- * @return The number of times the function has been called, or -1 on failure.
- *
- * This function should be called prior to using any eeze functions, and MUST
- * be called prior to using any udev functions to avoid a segv.
- *
- * @ingroup main
- */
EAPI int
eeze_init(void)
{
return 0;
}
-/**
- * Shut down the eeze library.
- * @return The number of times the eeze_init has been called, or -1 when
- * all occurrences of eeze have been shut down.
- *
- * This function should be called when no further eeze functions will be called.
- *
- * @ingroup main
- */
EAPI int
eeze_shutdown(void)
{
#include <Eeze.h>
#include "eeze_udev_private.h"
-/**
- * @addtogroup find Find
- *
- * These are functions which find/supplement lists of devices.
- *
- * @ingroup udev
- *
- * @{
- */
-
-/**
- * Returns a stringshared list of all syspaths that are (or should be) the same
- * device as the device pointed at by @p syspath.
- *
- * @param syspath The syspath of the device to find matches for
- * @return All devices which are the same as the one passed
- */
EAPI Eina_List *
eeze_udev_find_similar_from_syspath(const char *syspath)
{
return ret;
}
-/**
- * Updates a list of all syspaths that are (or should be) the same
- * device.
- *
- * @param list The list of devices to update
- * @return The updated list
- *
- * This function will update @p list to include all devices matching
- * devices with syspaths currently stored in @p list. All strings are
- * stringshared.
- */
EAPI Eina_List *
eeze_udev_find_unlisted_similar(Eina_List *list)
{
return list;
}
-/**
- * Find devices using an #Eeze_Udev_Type and/or a name.
- *
- * @param etype An #Eeze_Udev_Type or 0
- * @param name A filter for the device name or #NULL
- * @return A stringshared Eina_List of matched devices or #NULL on failure
- *
- * Return a list of syspaths (/sys/$syspath) for matching udev devices.
- */
EAPI Eina_List *
eeze_udev_find_by_type(Eeze_Udev_Type etype,
const char *name)
return ret;
}
-/**
- * A more advanced find, allows finds using udev properties.
- *
- * @param subsystem The udev subsystem to filter by, or NULL
- * @param type "ID_INPUT_KEY", "ID_INPUT_MOUSE", "ID_INPUT_TOUCHPAD", NULL, etc
- * @param name A filter for the device name, or NULL
- * @return A stringshared Eina_List* of matched devices or NULL on failure
- *
- * Return a list of syspaths (/sys/$syspath) for matching udev devices.
- * Requires at least one filter.
- */
EAPI Eina_List *
eeze_udev_find_by_filter(const char *subsystem,
const char *type,
return ret;
}
-/**
- * Find a list of devices by a sysattr (and, optionally, a value of that sysattr).
- *
- * @param sysattr The attribute to find
- * @param value Optional: the value that the attribute should have
- *
- * @return A stringshared list of the devices found with the attribute
- *
- * @ingroup find
- */
EAPI Eina_List *
eeze_udev_find_by_sysattr(const char *sysattr,
const char *value)
udev_enumerate_unref(en);
return ret;
}
-
-/** @} */
#include <Eeze.h>
#include "eeze_udev_private.h"
-/**
- * @addtogroup syspath Syspath
- *
- * These are functions which interact with the syspath (/sys/$PATH) of
- * a device.
- *
- * @ingroup udev
- *
- * @{
- */
-
-/**
- * Find the root device of a device from its syspath.
- *
- * @param syspath The syspath of a device, with or without "/sys/"
- * @return The syspath of the parent device
- *
- * Return a stringshared syspath (/sys/$syspath) for the parent device.
- */
EAPI const char *
eeze_udev_syspath_get_parent(const char *syspath)
{
return ret;
}
-/**
- * Returns a list of all parent device syspaths for @p syspath.
- *
- * @param syspath The device to find parents of
- * @return A stringshared list of the parent devices of @p syspath
- */
EAPI Eina_List *
eeze_udev_syspath_get_parents(const char *syspath)
{
return devlist;
}
-/**
- * Get the /dev/ path from the /sys/ path.
- *
- * @param syspath The /sys/ path with or without the /sys/
- * @return A stringshared char* with the /dev/ path or NULL on failure
- *
- * Takes /sys/$PATH and turns it into the corresponding "/dev/x/y".
- */
EAPI const char *
eeze_udev_syspath_get_devpath(const char *syspath)
{
return name;
}
-/**
- * Get the /dev/ name from the /sys/ path.
- *
- * @param syspath The /sys/ path with or without the /sys/
- * @return A stringshared char* of the device name without the /dev/ path, or NULL on failure
- *
- * Takes /sys/$PATH and turns it into the corresponding /dev/x/"y".
- */
EAPI const char *
eeze_udev_syspath_get_devname(const char *syspath)
{
return name;
}
-/**
- * Get the subsystem of a device from the /sys/ path.
- *
- * @param syspath The /sys/ path with or without the /sys/
- * @return A stringshared char* with the subsystem of the device or NULL on failure
- *
- * Takes /sys/$PATH and returns the corresponding device subsystem,
- * such as "input" for keyboards/mice.
- */
EAPI const char *
eeze_udev_syspath_get_subsystem(const char *syspath)
{
return subsystem;
}
-/**
- * Get the property value of a device from the /sys/ path.
- *
- * @param syspath The /sys/ path with or without the /sys/
- * @param property The property to get; full list of these is a FIXME
- * @return A stringshared char* with the property or NULL on failure
- */
EAPI const char *
eeze_udev_syspath_get_property(const char *syspath,
const char *property)
return value;
}
-/**
- * Get the sysattr value of a device from the /sys/ path.
- *
- * @param syspath The /sys/ path with or without the /sys/
- * @param sysattr The sysattr to get; full list of these is a FIXME
- * @return A stringshared char* with the sysattr or NULL on failure
- */
EAPI const char *
eeze_udev_syspath_get_sysattr(const char *syspath,
const char *sysattr)
return value;
}
-/**
- * Checks whether the device is a mouse.
- *
- * @param syspath The /sys/ path with or without the /sys/
- * @return If true, the device is a mouse
- */
EAPI Eina_Bool
eeze_udev_syspath_is_mouse(const char *syspath)
{
return mouse;
}
-/**
- * Checks whether the device is a keyboard.
- *
- * @param syspath The /sys/ path with or without the /sys/
- * @return If true, the device is a keyboard
- */
EAPI Eina_Bool
eeze_udev_syspath_is_kbd(const char *syspath)
{
return kbd;
}
-/**
- * Checks whether the device is a touchpad.
- *
- * @param syspath The /sys/ path with or without the /sys/
- * @return If true, the device is a touchpad
- */
EAPI Eina_Bool
eeze_udev_syspath_is_touchpad(const char *syspath)
{
return touchpad;
}
-/**
- * Get the syspath of a device from the /dev/ path.
- *
- * @param devpath The /dev/ path of the device
- * @return A stringshared char* which corresponds to the /sys/ path of the device or NULL on failure
- *
- * Takes "/dev/path" and returns the corresponding /sys/ path (without the "/sys/")
- */
EAPI const char *
eeze_udev_devpath_get_syspath(const char *devpath)
{
udev_enumerate_unref(en);
return ret;
}
-
-/** @} */
#include <Eeze.h>
#include "eeze_udev_private.h"
-/**
- * @addtogroup walks Walks
- *
- * These are functions which walk up the device chain.
- *
- * @ingroup udev
- *
- * @{
- */
-
-/**
- * Walks up the device chain starting at @p syspath,
- * checking each device for @p sysattr with (optional) @p value.
- *
- * @param syspath The /sys/ path of the device to start at, with or without the /sys/
- * @param sysattr The attribute to find
- * @param value OPTIONAL: The value that @p sysattr should have, or NULL
- *
- * @return If the sysattr (with value) is found, returns TRUE. Else, false.
- */
EAPI Eina_Bool
eeze_udev_walk_check_sysattr(const char *syspath,
const char *sysattr,
return ret;
}
-/**
- * Walks up the device chain starting at @p syspath,
- * checking each device for @p sysattr, and returns the value if found.
- *
- * @param syspath The /sys/ path of the device to start at, with or without the /sys/
- * @param sysattr The attribute to find
- *
- * @return The stringshared value of @p sysattr if found, or NULL
- */
EAPI const char *
eeze_udev_walk_get_sysattr(const char *syspath,
const char *sysattr)
udev_device_unref(device);
return NULL;
}
-
-/** @} */
Eeze_Udev_Watch *watch;
};
-/**
- * @addtogroup watch Watch
- *
- * @brief These are functions which monitor udev for events.
- *
- * Eeze watches are simple: you specify a type of device to watch (or all devices), some events (or all) to watch for, a callback,
- * and some data, and then udev watches those device types for events of the type you specified. Your callback is called with a
- * syspath of the triggering device and the event that happened to the device, along with the data you associated with the watch and
- * the watch object itself in case you want to stop the watch easily in a callback.
- *
- * @ingroup udev
- *
- * @{
- */
-
/* private function to further filter watch results based on Eeze_Udev_Type
* specified; helpful for new udev versions, but absolutely required for
* old udev, which does not implement filtering in device monitors.
return EINA_TRUE;
}
-/**
- * Add a watch for a device type
- *
- * @param type The #Eeze_Udev_Type to watch
- * @param event The events to watch; an OR list of #Eeze_Udev_Event (ie (#EEZE_UDEV_EVENT_ADD | #EEZE_UDEV_EVENT_REMOVE)), or 0 for all events
- * @param cb The function to call when the watch receives data of type #Eeze_Udev_Watch_Cb
- * @param user_data Data to pass to the callback function
- *
- * @return A watch struct for the watch type specified, or NULL on failure
- *
- * Eeze watches will monitor udev for changes of type(s) @p event to devices of type @p type. When these changes occur, the stringshared
- * syspath of the device will be sent to function @p func, along with the bitmask of the event type which can be detected through
- * binary &.
- */
EAPI Eeze_Udev_Watch *
eeze_udev_watch_add(Eeze_Udev_Type type,
int event,
return NULL;
}
-/**
- * Deletes a watch.
- *
- * @param watch An Eeze_Udev_Watch object
- * @return The data originally associated with the watch, or NULL
- *
- * Deletes a watch, closing file descriptors and freeing related udev memory.
- */
EAPI void *
eeze_udev_watch_del(Eeze_Udev_Watch *watch)
{
free(watch);
return ret;
}
-
-/** @} */