2012-01-24 12:59:11 -08:00
|
|
|
|
2020-04-19 01:06:07 -07:00
|
|
|
#include "places_config.h"
|
2012-01-24 12:59:11 -08:00
|
|
|
|
2019-06-02 10:01:41 -07:00
|
|
|
#ifdef PLACES_HAVE_EEZE
|
2012-01-24 12:59:11 -08:00
|
|
|
|
|
|
|
#include <e.h>
|
|
|
|
#include "e_mod_places.h"
|
|
|
|
#include <Eeze.h>
|
2013-04-18 14:26:06 -07:00
|
|
|
#include <Eeze_Disk.h>
|
2012-01-24 12:59:11 -08:00
|
|
|
|
|
|
|
/* Local Function Prototypes */
|
|
|
|
|
|
|
|
|
|
|
|
/* Local Variables */
|
|
|
|
|
2013-04-18 14:26:06 -07:00
|
|
|
// Eina_Bool eeze_mount_mtab_scan (void)
|
|
|
|
// Eina_Bool eeze_mount_fstab_scan (void)
|
2012-01-24 12:59:11 -08:00
|
|
|
|
2013-04-18 14:26:06 -07:00
|
|
|
// Eina_Bool eeze_mount_tabs_watch (void)
|
|
|
|
// void eeze_mount_tabs_unwatch (void)
|
|
|
|
|
|
|
|
// Eina_Bool eeze_disk_mount (Eeze_Disk *disk)
|
|
|
|
// Eina_Bool eeze_disk_unmount (Eeze_Disk *disk)
|
|
|
|
// Eina_Bool eeze_disk_eject (Eeze_Disk *disk)
|
2012-01-24 12:59:11 -08:00
|
|
|
|
|
|
|
/* Implementation */
|
2013-04-18 14:26:06 -07:00
|
|
|
|
|
|
|
void _places_eeze_disk_print(Eeze_Disk *disk)
|
|
|
|
{
|
|
|
|
eeze_disk_scan(disk); // NEEDED ??
|
|
|
|
|
|
|
|
printf("PLACES: SysPath: %s\n", eeze_disk_syspath_get(disk));
|
|
|
|
printf("PLACES: devpath: %s\n", eeze_disk_devpath_get(disk));
|
|
|
|
printf("PLACES: mount_point: %s\n", eeze_disk_mount_point_get(disk));
|
|
|
|
printf("PLACES: mountopts: %ld\n", eeze_disk_mountopts_get(disk));
|
|
|
|
printf("PLACES: label: %s\n", eeze_disk_label_get(disk));
|
|
|
|
printf("PLACES: type: %d\n", eeze_disk_type_get(disk));
|
|
|
|
printf("PLACES: fstype: %s\n", eeze_disk_fstype_get(disk));
|
2014-02-01 05:16:40 -08:00
|
|
|
if (eeze_disk_devpath_get(disk)) // prevent eeze segfault :/
|
|
|
|
printf("PLACES: mounted: %d\n", eeze_disk_mounted_get(disk));
|
2013-04-18 14:26:06 -07:00
|
|
|
printf("PLACES: removable: %d\n", eeze_disk_removable_get(disk));
|
|
|
|
printf("PLACES: mount_wrapper: %s\n", eeze_disk_mount_wrapper_get(disk));
|
2014-02-01 05:16:40 -08:00
|
|
|
|
2013-04-18 14:26:06 -07:00
|
|
|
printf("PLACES: vendor: %s\n", eeze_disk_vendor_get(disk));
|
|
|
|
printf("PLACES: model: %s\n", eeze_disk_model_get(disk));
|
|
|
|
printf("PLACES: serial: %s\n", eeze_disk_serial_get(disk));
|
|
|
|
printf("PLACES: uuid: %s\n", eeze_disk_uuid_get(disk));
|
|
|
|
|
2014-02-01 05:16:40 -08:00
|
|
|
printf("PLACES: -----------------------------------------------\n");
|
2013-04-18 14:26:06 -07:00
|
|
|
}
|
|
|
|
|
2012-01-24 12:59:11 -08:00
|
|
|
Eina_Bool
|
|
|
|
places_eeze_init(void)
|
|
|
|
{
|
2014-02-01 05:16:40 -08:00
|
|
|
printf("PLACES: *****************************************\n");
|
2012-01-24 12:59:11 -08:00
|
|
|
printf("PLACES: eeze: init()\n");
|
|
|
|
|
2013-04-18 14:26:06 -07:00
|
|
|
// init eeze
|
|
|
|
if (!eeze_init())
|
|
|
|
{
|
2014-02-01 05:16:40 -08:00
|
|
|
printf("PLACES: Impossible to setup eeze.\n");
|
2013-04-18 14:26:06 -07:00
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2014-02-01 05:16:40 -08:00
|
|
|
// This will fail on compilation/runtime if Disk functions not available
|
|
|
|
eeze_disk_function();
|
|
|
|
|
2013-04-18 14:26:06 -07:00
|
|
|
// check eeze mount/umont/eject support
|
|
|
|
if (!eeze_disk_can_mount() ||
|
|
|
|
!eeze_disk_can_unmount() ||
|
|
|
|
!eeze_disk_can_eject())
|
|
|
|
{
|
2014-02-01 05:16:40 -08:00
|
|
|
printf("PLACES: Eeze don't have mount/umount/eject support.\n");
|
2013-04-18 14:26:06 -07:00
|
|
|
eeze_shutdown();
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2014-02-01 05:16:40 -08:00
|
|
|
if (!eeze_mount_tabs_watch())
|
|
|
|
{
|
|
|
|
printf("PLACES: Cannot setup watcher for fstab/mtab.\n");
|
|
|
|
eeze_shutdown();
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2013-04-18 14:26:06 -07:00
|
|
|
|
|
|
|
eeze_mount_fstab_scan();
|
|
|
|
eeze_mount_mtab_scan();
|
|
|
|
|
2012-01-24 12:59:11 -08:00
|
|
|
|
|
|
|
Eina_List *disks;
|
|
|
|
const char *syspath;
|
2013-04-18 14:26:06 -07:00
|
|
|
Eeze_Disk *disk;
|
|
|
|
|
|
|
|
disks = eeze_udev_find_by_type(EEZE_UDEV_TYPE_DRIVE_INTERNAL, NULL);
|
2014-02-01 05:16:40 -08:00
|
|
|
printf("PLACES: Found the following internal drive:\n");
|
2013-04-18 14:26:06 -07:00
|
|
|
EINA_LIST_FREE(disks, syspath)
|
|
|
|
{
|
|
|
|
disk = eeze_disk_new(syspath);
|
|
|
|
_places_eeze_disk_print(disk);
|
|
|
|
eina_stringshare_del(syspath);
|
|
|
|
eeze_disk_free(disk);
|
|
|
|
}
|
|
|
|
|
2012-01-24 12:59:11 -08:00
|
|
|
disks = eeze_udev_find_by_type(EEZE_UDEV_TYPE_DRIVE_MOUNTABLE, NULL);
|
2014-02-01 05:16:40 -08:00
|
|
|
printf("PLACES: Found the following mountable drive:\n");
|
2012-01-24 12:59:11 -08:00
|
|
|
EINA_LIST_FREE(disks, syspath)
|
|
|
|
{
|
2013-04-18 14:26:06 -07:00
|
|
|
disk = eeze_disk_new(syspath);
|
|
|
|
_places_eeze_disk_print(disk);
|
|
|
|
eeze_disk_free(disk);
|
|
|
|
eina_stringshare_del(syspath);
|
|
|
|
}
|
2012-01-24 12:59:11 -08:00
|
|
|
|
2013-04-18 14:26:06 -07:00
|
|
|
disks = eeze_udev_find_by_type(EEZE_UDEV_TYPE_DRIVE_CDROM, NULL);
|
2014-02-01 05:16:40 -08:00
|
|
|
printf("PLACES: Found the following cdrom drive:\n");
|
2013-04-18 14:26:06 -07:00
|
|
|
EINA_LIST_FREE(disks, syspath)
|
|
|
|
{
|
2012-01-24 12:59:11 -08:00
|
|
|
disk = eeze_disk_new(syspath);
|
2013-04-18 14:26:06 -07:00
|
|
|
_places_eeze_disk_print(disk);
|
2012-01-24 12:59:11 -08:00
|
|
|
eeze_disk_free(disk);
|
|
|
|
eina_stringshare_del(syspath);
|
|
|
|
}
|
2013-04-18 14:26:06 -07:00
|
|
|
|
2014-02-01 05:16:40 -08:00
|
|
|
disks = eeze_udev_find_by_type(EEZE_UDEV_TYPE_DRIVE_REMOVABLE, NULL);
|
|
|
|
printf("PLACES: Found the following removable drive:\n");
|
|
|
|
EINA_LIST_FREE(disks, syspath)
|
|
|
|
{
|
|
|
|
disk = eeze_disk_new(syspath);
|
|
|
|
_places_eeze_disk_print(disk);
|
|
|
|
eeze_disk_free(disk);
|
|
|
|
eina_stringshare_del(syspath);
|
|
|
|
}
|
2013-04-18 14:26:06 -07:00
|
|
|
|
|
|
|
printf("PLACES: Searching for your root:\n");
|
|
|
|
disk = eeze_disk_new_from_mount("/");
|
|
|
|
if (disk)
|
|
|
|
{
|
|
|
|
_places_eeze_disk_print(disk);
|
|
|
|
eeze_disk_free(disk);
|
|
|
|
}
|
2012-01-24 12:59:11 -08:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
places_eeze_shutdown(void)
|
|
|
|
{
|
2013-04-18 14:26:06 -07:00
|
|
|
eeze_mount_tabs_unwatch();
|
2012-01-24 12:59:11 -08:00
|
|
|
eeze_shutdown();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Internals */
|
|
|
|
|
|
|
|
#endif
|