1#ifndef E_FM_SHARED_TYPES
2#define E_FM_SHARED_TYPES
3
4#include <Eina.h>
5#include <Ecore.h>
6
7#if @EEZE_MOUNT_CONFIG@
8# include <Eeze.h>
9# include <Eeze_Disk.h>
10#endif
11#if @DBUS_MOUNT_CONFIG@
12# include <Eldbus.h>
13#endif
14
15# define E_DEVICE_TYPE_STORAGE 1
16# define E_DEVICE_TYPE_VOLUME  2
17typedef struct _E_Storage E_Storage;
18typedef struct _E_Volume  E_Volume;
19typedef struct _E_Fm2_Mount  E_Fm2_Mount;
20
21typedef enum
22{
23   EFM_MODE_USING_RASTER_MOUNT,
24   EFM_MODE_USING_HAL_MOUNT,
25   EFM_MODE_USING_UDISKS_MOUNT,
26   EFM_MODE_USING_UDISKS2_MOUNT,
27   EFM_MODE_USING_EEZE_MOUNT
28} Efm_Mode;
29
30typedef enum
31{
32  E_VOLUME_OP_TYPE_NONE,
33  E_VOLUME_OP_TYPE_MOUNT,
34  E_VOLUME_OP_TYPE_UNMOUNT,
35  E_VOLUME_OP_TYPE_EJECT
36} E_Volume_Op_Type;
37
38typedef struct E_Fm2_Device_Mount_Op
39{
40   EINA_INLIST;
41   unsigned int action;
42   char *args;
43   void *ic;
44   E_Fm2_Mount *mnt;
45   size_t size, length;
46} E_Fm2_Device_Mount_Op;
47
48struct _E_Storage
49{
50   int type;
51   const char *udi; /* with eeze, this is actually the syspath */
52   const char *drive_type;
53
54   const char *model, *vendor, *serial;
55
56   Eina_Bool removable;
57   Eina_Bool media_available;
58   Eina_Bool system_internal;
59   unsigned long long media_size;
60
61   Eina_Bool requires_eject;
62   Eina_Bool hotpluggable;
63   Eina_Bool media_check_enabled;
64
65   struct
66     {
67        const char *drive, *volume;
68     } icon;
69
70   Eina_List *volumes;
71
72   Eina_Bool validated : 1;
73   Eina_Bool trackable : 1;
74#if @DBUS_MOUNT_CONFIG@
75   Eldbus_Proxy *proxy;
76   const char *dbus_path;
77#endif
78#if @EEZE_MOUNT_CONFIG@
79   Eeze_Disk *disk;
80#endif
81   const char *bus;
82};
83
84struct _E_Volume
85{
86   int type;
87   const char *udi, *uuid;
88   const char *label, *icon, *fstype;
89   unsigned long long size;
90
91   Eina_Bool partition;
92   int partition_number;
93   const char *partition_label;
94   Eina_Bool mounted;
95   const char *mount_point;
96
97   const char *parent;
98   E_Storage *storage;
99   Eina_List *mounts;
100
101   Eina_Bool validated : 1;
102
103   Eina_Bool auto_unmount : 1;                  // unmount, when last associated fm window closed
104   Eina_Bool first_time;                    // volume discovery in init sequence
105   Ecore_Timer *guard;                 // operation guard timer
106   E_Volume_Op_Type optype;
107   Efm_Mode efm_mode;
108
109   Eina_Inlist *mount_ops;  // E_Fm2_Device_Mount_Op
110
111   Eina_Bool encrypted;
112   Eina_Bool unlocked;
113
114#if @DBUS_MOUNT_CONFIG@
115   Eldbus_Pending *op;
116   Eldbus_Proxy *proxy;
117   const char *dbus_path;
118#endif
119#if @EEZE_MOUNT_CONFIG@
120   Eeze_Disk *disk;
121#endif
122};
123
124struct _E_Fm2_Mount
125{
126   const char *udi;
127   const char *mount_point;
128
129   Ecore_Cb mount_ok;
130   Ecore_Cb mount_fail;
131   Ecore_Cb unmount_ok;
132   Ecore_Cb unmount_fail;
133   void *data;
134
135   E_Volume *volume;
136
137   Eina_Bool mounted : 1;
138   Eina_Bool deleted : 1;
139};
140
141#endif
142