2011-05-15 Mike Blumenkrantz (discomfitor/zmike)
++eeze_disk_mount_wrapper_set
++eeze_disk_mount_wrapper_get
+Allow use of wrapper exes for mount commands (such as sudo)
+---------------------------------------
+eeze_disk_udev_get_property
+eeze_disk_udev_get_sysattr
+eeze_disk_udev_walk_check_sysattr
*/
EAPI Eina_Bool eeze_disk_mounted_get(Eeze_Disk *disk);
+/**
+ * @brief Get the previously set mount wrapper for a disk
+ * @param disk The disk
+ * @return The wrapper, or NULL on failure
+ *
+ * This returns the wrapper previously set with eeze_disk_mount_wrapper_set
+ */
+EAPI const char *eeze_disk_mount_wrapper_get(Eeze_Disk *disk);
+
+/**
+ * @brief Set a wrapper to run mount commands with
+ * @param disk The disk to wrap mount commands for
+ * @param wrapper The wrapper executable
+ * @return EINA_TRUE on success, else EINA_FALSE
+ *
+ * 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 @p wrapper if not NULL to test for existence.
+ */
+EAPI Eina_Bool eeze_disk_mount_wrapper_set(Eeze_Disk *disk, const char *wrapper);
+
/**
* @brief Begin a mount operation on the disk
* @param disk The disk
return disk->mount_opts;
}
+EAPI Eina_Bool
+eeze_disk_mount_wrapper_set(Eeze_Disk *disk, const char *wrapper)
+{
+ struct stat s;
+ EINA_SAFETY_ON_NULL_RETURN_VAL(disk, EINA_FALSE);
+ if (wrapper) EINA_SAFETY_ON_TRUE_RETURN_VAL(!*wrapper, EINA_FALSE);
+ else
+ {
+ eina_stringshare_del(disk->mount_wrapper);
+ return EINA_TRUE;
+ }
+ if ((!stat(wrapper, &s)) && S_ISREG(s.st_mode))
+ {
+ eina_stringshare_replace(&disk->mount_wrapper, wrapper);
+ return EINA_TRUE;
+ }
+ ERR("%s does not exist!", wrapper);
+ return EINA_FALSE;
+}
+
+EAPI const char *
+eeze_disk_mount_wrapper_get(Eeze_Disk *disk)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(disk, NULL);
+ return disk->mount_wrapper;
+}
+
EAPI Eina_Bool
eeze_disk_mount(Eeze_Disk *disk)
{
}
if ((!disk->mount_point) || (!disk->mount_point[0])) return EINA_FALSE;
+ if (disk->mount_wrapper)
+ eina_strbuf_append_printf(disk->mount_cmd, "%s ", disk->mount_wrapper);
if (disk->mount_opts == EEZE_DISK_MOUNTOPT_DEFAULTS)
eina_strbuf_append_printf(disk->mount_cmd, EEZE_MOUNT_BIN" -o "EEZE_MOUNT_DEFAULT_OPTS" UUID=%s %s", disk->cache.uuid, disk->mount_point);
else if (!disk->mount_opts)
const char *devpath;
const char *fstype;
const char *mount_point;
+ const char *mount_wrapper;
unsigned long mount_opts;
struct