add functions for runtime checking of disk capabilities for embedded devices

SVN revision: 65358
This commit is contained in:
Mike Blumenkrantz 2011-11-18 03:13:31 +00:00
parent 8c34d7abf0
commit ec9e6085ad
4 changed files with 67 additions and 6 deletions

View File

@ -53,3 +53,7 @@
2011-08-01 Mike Blumenkrantz (discomfitor/zmike)
* added fix for battery/ac detection with very recent versions of udev
2011-11-17 Mike Blumenkrantz (discomfitor/zmike)
* added eeze_disk_can_{mount,unmount,eject} to determine at runtime whether eeze
is capable of performing disk operations

View File

@ -116,20 +116,32 @@ if test "x$eeze_mount" = "xyes";then
PKG_CHECK_MODULES([ECORE_CON], [ecore-con >= 1.1.0])
if test "x$with_mount" = "xdetect";then
AC_PATH_PROG([with_mount], [mount], [no])
test "x$with_mount" = "xno" && AC_MSG_ERROR([mount binary could not be detected])
AC_PATH_PROG([with_mount], [mount], [])
fi
if test -z "$with_mount" ; then
AC_DEFINE_UNQUOTED([MOUNTABLE], [0], [whether mount is available])
else
AC_DEFINE_UNQUOTED([MOUNTABLE], [1], [whether mount is available])
fi
AC_DEFINE_UNQUOTED([EEZE_MOUNT_BIN], ["$with_mount"], [mount bin to use])
if test "x$with_umount" = "xdetect";then
AC_PATH_PROG([with_umount], [umount], [no])
test "x$with_umount" = "xno" && AC_MSG_ERROR([umount binary could not be detected])
AC_PATH_PROG([with_umount], [umount], [])
fi
if test -z "$with_umount" ; then
AC_DEFINE_UNQUOTED([UNMOUNTABLE], [0], [whether umount is available])
else
AC_DEFINE_UNQUOTED([UNMOUNTABLE], [1], [whether umount is available])
fi
AC_DEFINE_UNQUOTED([EEZE_UNMOUNT_BIN], ["$with_umount"], [umount bin to use])
if test "x$with_eject" = "xdetect";then
AC_PATH_PROG([with_eject], [eject], [no])
test "x$with_eject" = "xno" && AC_MSG_ERROR([eject binary could not be detected])
AC_PATH_PROG([with_eject], [eject], [])
fi
if test -z "$with_eject" ; then
AC_DEFINE_UNQUOTED([EJECTABLE], [0], [whether eject is available])
else
AC_DEFINE_UNQUOTED([EJECTABLE], [1], [whether eject is available])
fi
AC_DEFINE_UNQUOTED([EEZE_EJECT_BIN], ["$with_eject"], [eject bin to use])
fi

View File

@ -87,6 +87,33 @@ struct _Eeze_Event_Disk_Error
*/
EAPI void eeze_disk_function(void);
/**
* @brief 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_mount(void);
/**
* @brief 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 Eina_Bool eeze_disk_can_unmount(void);
/**
* @brief 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_eject(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

View File

@ -456,3 +456,21 @@ eeze_disk_removable_get(Eeze_Disk *disk)
}
return disk->cache.removable;
}
EAPI Eina_Bool
eeze_disk_can_mount(void)
{
return MOUNTABLE;
}
EAPI Eina_Bool
eeze_disk_can_unmount(void)
{
return UNMOUNTABLE;
}
EAPI Eina_Bool
eeze_disk_can_eject(void)
{
return EJECTABLE;
}