summaryrefslogtreecommitdiff
path: root/src/bin/eeze/eeze_disk_ls.c
blob: 1c1e6a2b04643043d37ed1e8b1c59a11d0ebec35 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif

#include <stdio.h>

#include <Ecore.h>
#include <Eeze.h>
#include <Eeze_Disk.h>

/* simple app to print disks and their mount points */

int
main(void)
{
   Eina_List *disks;
   const char *syspath;

   eeze_init();
   eeze_disk_function();

   disks = eeze_udev_find_by_type(EEZE_UDEV_TYPE_DRIVE_MOUNTABLE, NULL);
   printf("Found the following mountable disks:\n");
   EINA_LIST_FREE(disks, syspath)
     {
        Eeze_Disk *disk;

        disk = eeze_disk_new(syspath);
        printf("\t%s - %s:%s\n", syspath, eeze_disk_devpath_get(disk), eeze_disk_mount_point_get(disk));
        eeze_disk_free(disk);
        eina_stringshare_del(syspath);
     }

   disks = eeze_udev_find_by_type(EEZE_UDEV_TYPE_DRIVE_REMOVABLE, NULL);
   printf("Found the following removable drives:\n");
   EINA_LIST_FREE(disks, syspath)
     {
        Eeze_Disk *disk;

        disk = eeze_disk_new(syspath);
        printf("\t%s - %s:%s\n", syspath, eeze_disk_devpath_get(disk), eeze_disk_mount_point_get(disk));
        eeze_disk_free(disk);
        eina_stringshare_del(syspath);
     }

   disks = eeze_udev_find_by_type(EEZE_UDEV_TYPE_DRIVE_INTERNAL, NULL);
   printf("Found the following internal drives:\n");
   EINA_LIST_FREE(disks, syspath)
     {
        Eeze_Disk *disk;

        disk = eeze_disk_new(syspath);
        printf("\t%s - %s\n", syspath, eeze_disk_devpath_get(disk));
        eeze_disk_free(disk);
        eina_stringshare_del(syspath);
     }
   return 0;
}