forked from enlightenment/efl
implement actual handling of mountopts, add utf8 to default mountopts, allow iso automounting in eeze_mount
+EEZE_DISK_MOUNTOPT_UTF8 = (1 << 2) +EEZE_DISK_MOUNTOPT_NOEXEC = (1 << 3) +EEZE_DISK_MOUNTOPT_NOSUID = (1 << 4) +EEZE_DISK_MOUNTOPT_REMOUNT = (1 << 5) +EAPI Eina_Bool eeze_disk_mountopts_set(Eeze_Disk *disk, int opts); +EAPI int eeze_disk_mountopts_get(Eeze_Disk *disk); SVN revision: 56879
This commit is contained in:
parent
6067dad09e
commit
178cda4124
|
@ -1,3 +1,12 @@
|
||||||
|
2011-02-09 Mike Blumenkrantz (discomfitor/zmike)
|
||||||
|
implement actual handling of mountopts, add utf8 to default mountopts, allow iso automounting in eeze_mount
|
||||||
|
+EEZE_DISK_MOUNTOPT_UTF8 = (1 << 2)
|
||||||
|
+EEZE_DISK_MOUNTOPT_NOEXEC = (1 << 3)
|
||||||
|
+EEZE_DISK_MOUNTOPT_NOSUID = (1 << 4)
|
||||||
|
+EEZE_DISK_MOUNTOPT_REMOUNT = (1 << 5)
|
||||||
|
+EAPI Eina_Bool eeze_disk_mountopts_set(Eeze_Disk *disk, int opts);
|
||||||
|
+EAPI int eeze_disk_mountopts_get(Eeze_Disk *disk);
|
||||||
|
|
||||||
2011-01-29 Mike Blumenkrantz (discomfitor/zmike)
|
2011-01-29 Mike Blumenkrantz (discomfitor/zmike)
|
||||||
+Eeze_Disk_Type enum
|
+Eeze_Disk_Type enum
|
||||||
+Eeze_Mount_Opts enum
|
+Eeze_Mount_Opts enum
|
||||||
|
|
|
@ -101,7 +101,11 @@ main(int argc, char *argv[])
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (argc > 2)
|
if (argc > 2)
|
||||||
eeze_disk_mount_point_set(disk, mount_point);
|
{
|
||||||
|
eeze_disk_mount_point_set(disk, mount_point);
|
||||||
|
if (eina_str_has_extension(dev, "iso"))
|
||||||
|
eeze_disk_mountopts_set(disk, EEZE_DISK_MOUNTOPT_LOOP | EEZE_DISK_MOUNTOPT_NOEXEC | EEZE_DISK_MOUNTOPT_NOSUID);
|
||||||
|
}
|
||||||
ecore_event_handler_add(EEZE_EVENT_DISK_MOUNT, (Ecore_Event_Handler_Cb)_mount_cb, NULL);
|
ecore_event_handler_add(EEZE_EVENT_DISK_MOUNT, (Ecore_Event_Handler_Cb)_mount_cb, NULL);
|
||||||
ecore_event_handler_add(EEZE_EVENT_DISK_ERROR, (Ecore_Event_Handler_Cb)_error_cb, NULL);
|
ecore_event_handler_add(EEZE_EVENT_DISK_ERROR, (Ecore_Event_Handler_Cb)_error_cb, NULL);
|
||||||
if (!eeze_disk_mount(disk))
|
if (!eeze_disk_mount(disk))
|
||||||
|
|
|
@ -44,7 +44,11 @@ typedef enum
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
EEZE_DISK_MOUNTOPT_DEFAULTS = 0xf0,
|
EEZE_DISK_MOUNTOPT_DEFAULTS = 0xf0,
|
||||||
EEZE_DISK_MOUNTOPT_LOOP = (1 << 1)
|
EEZE_DISK_MOUNTOPT_LOOP = (1 << 1),
|
||||||
|
EEZE_DISK_MOUNTOPT_UTF8 = (1 << 2),
|
||||||
|
EEZE_DISK_MOUNTOPT_NOEXEC = (1 << 3),
|
||||||
|
EEZE_DISK_MOUNTOPT_NOSUID = (1 << 4),
|
||||||
|
EEZE_DISK_MOUNTOPT_REMOUNT = (1 << 5)
|
||||||
} Eeze_Mount_Opts;
|
} Eeze_Mount_Opts;
|
||||||
|
|
||||||
EAPI extern int EEZE_EVENT_DISK_MOUNT;
|
EAPI extern int EEZE_EVENT_DISK_MOUNT;
|
||||||
|
@ -102,6 +106,8 @@ EAPI Eina_Bool eeze_disk_mount(Eeze_Disk *disk);
|
||||||
EAPI Eina_Bool eeze_disk_unmount(Eeze_Disk *disk);
|
EAPI Eina_Bool eeze_disk_unmount(Eeze_Disk *disk);
|
||||||
EAPI const char *eeze_disk_mount_point_get(Eeze_Disk *disk);
|
EAPI const char *eeze_disk_mount_point_get(Eeze_Disk *disk);
|
||||||
EAPI Eina_Bool eeze_disk_mount_point_set(Eeze_Disk *disk, const char *mount_point);
|
EAPI Eina_Bool eeze_disk_mount_point_set(Eeze_Disk *disk, const char *mount_point);
|
||||||
|
EAPI Eina_Bool eeze_disk_mountopts_set(Eeze_Disk *disk, int opts);
|
||||||
|
EAPI int eeze_disk_mountopts_get(Eeze_Disk *disk);
|
||||||
|
|
||||||
EAPI Eina_Bool eeze_mount_tabs_watch(void);
|
EAPI Eina_Bool eeze_mount_tabs_watch(void);
|
||||||
EAPI void eeze_mount_tabs_unwatch(void);
|
EAPI void eeze_mount_tabs_unwatch(void);
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include "eeze_udev_private.h"
|
#include "eeze_udev_private.h"
|
||||||
#include "eeze_disk_private.h"
|
#include "eeze_disk_private.h"
|
||||||
|
|
||||||
#define EEZE_MOUNT_DEFAULT_OPTS "noexec,nosuid"
|
#define EEZE_MOUNT_DEFAULT_OPTS "noexec,nosuid,utf8"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @addtogroup disk Disk
|
* @addtogroup disk Disk
|
||||||
|
@ -167,6 +167,38 @@ eeze_disk_mounted_get(Eeze_Disk *disk)
|
||||||
return eeze_disk_libmount_mounted_get(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, int opts)
|
||||||
|
{
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(disk, EINA_FALSE);
|
||||||
|
if (opts != disk->mount_opts)
|
||||||
|
disk->mount_cmd_changed = EINA_TRUE;
|
||||||
|
disk->mount_opts = 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, -1 on failure
|
||||||
|
*
|
||||||
|
* This function returns the current mount opts of a disk.
|
||||||
|
*/
|
||||||
|
EAPI int
|
||||||
|
eeze_disk_mountopts_get(Eeze_Disk *disk)
|
||||||
|
{
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(disk, -1);
|
||||||
|
return disk->mount_opts;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Begin a mount operation on the disk
|
* @brief Begin a mount operation on the disk
|
||||||
* @param disk The disk
|
* @param disk The disk
|
||||||
|
@ -230,7 +262,24 @@ eeze_disk_mount(Eeze_Disk *disk)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((!disk->mount_point) || (!disk->mount_point[0])) return EINA_FALSE;
|
if ((!disk->mount_point) || (!disk->mount_point[0])) return EINA_FALSE;
|
||||||
eina_strbuf_append_printf(disk->mount_cmd, "%s -o %s UUID=%s %s", EEZE_MOUNT_BIN, EEZE_MOUNT_DEFAULT_OPTS, disk->cache.uuid, disk->mount_point);
|
if ((!disk->mount_opts) || (disk->mount_opts = 0xf0))
|
||||||
|
eina_strbuf_append_printf(disk->mount_cmd, "%s -o %s UUID=%s %s", EEZE_MOUNT_BIN, EEZE_MOUNT_DEFAULT_OPTS, disk->cache.uuid, disk->mount_point);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
eina_strbuf_append_printf(disk->mount_cmd, "%s -o ", EEZE_MOUNT_BIN);
|
||||||
|
/* trailing commas are okay */
|
||||||
|
if (disk->mount_opts & EEZE_DISK_MOUNTOPT_LOOP)
|
||||||
|
eina_strbuf_append(disk->mount_cmd, "loop,");
|
||||||
|
if (disk->mount_opts & EEZE_DISK_MOUNTOPT_UTF8)
|
||||||
|
eina_strbuf_append(disk->mount_cmd, "utf8,");
|
||||||
|
if (disk->mount_opts & EEZE_DISK_MOUNTOPT_NOEXEC)
|
||||||
|
eina_strbuf_append(disk->mount_cmd, "noexec,");
|
||||||
|
if (disk->mount_opts & EEZE_DISK_MOUNTOPT_NOSUID)
|
||||||
|
eina_strbuf_append(disk->mount_cmd, "nosuid,");
|
||||||
|
if (disk->mount_opts & EEZE_DISK_MOUNTOPT_REMOUNT)
|
||||||
|
eina_strbuf_append(disk->mount_cmd, "remount,");
|
||||||
|
eina_strbuf_append_printf(disk->mount_cmd, " UUID=%s %s", disk->cache.uuid, disk->mount_point);
|
||||||
|
}
|
||||||
disk->mount_cmd_changed = EINA_FALSE;
|
disk->mount_cmd_changed = EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,7 @@ struct _Eeze_Disk
|
||||||
const char *devpath;
|
const char *devpath;
|
||||||
const char *fstype;
|
const char *fstype;
|
||||||
const char *mount_point;
|
const char *mount_point;
|
||||||
|
int mount_opts;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue