disks: Fix this horrible broken API.

Some horrid left over from a tool i wrote to write disk images and
parsing for physicaly disks. Well, it doesn't map well. Keep linux
as is for now.

FreeBSD win and OpenBSD win.
Alastair Poole 3 years ago
parent 194ab50626
commit 63953978d9
  1. 30
      src/bin/system/filesystems.c
  2. 3
      src/bin/system/filesystems.h
  3. 9
      src/bin/ui/ui_disk.c

@ -166,6 +166,36 @@ file_system_type_name(const char *mountpoint)
#endif
Eina_List *
file_system_info_all_get(void)
{
# if defined(__linux__)
return NULL;
# else
struct statfs *mounts;
int i, count;
Eina_List *list = NULL;
count = getmntinfo(&mounts, MNT_WAIT);
for (i = 0; i < count; i++)
{
File_System *fs = calloc(1, sizeof(File_System));
fs->mount = strdup(mounts[i].f_mntonname);
fs->path = strdup(mounts[i].f_mntfromname);
#if defined(__OpenBSD__)
#else
fs->type = mounts[i].f_type;
#endif
fs->type_name = strdup(mounts[i].f_fstypename);
fs->usage.total = mounts[i].f_bsize * mounts[i].f_blocks;
fs->usage.used = fs->usage.total - (mounts[i].f_bsize * mounts[i].f_bfree);
list = eina_list_append(list, fs);
}
# endif
return list;
}
File_System *
file_system_info_get(const char *path)
{

@ -22,6 +22,9 @@ file_system_name_by_id(unsigned int id);
unsigned int
file_system_id_by_name(const char *name);
Eina_List *
file_system_info_all_get(void);
File_System *
file_system_info_get(const char *path);

@ -221,15 +221,15 @@ _item_disk_clicked_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info
static Eina_Bool
_disks_poll_timer_cb(void *data)
{
Eina_List *disks;
char *path;
Elm_Object_Item *it;
File_System *fs;
Eina_List *mounted = NULL;
eina_lock_take(&_lock);
disks = disks_get();
#if defined(__linux__)
char *path;
Eina_List *disks = disks_get();
EINA_LIST_FREE(disks, path)
{
fs = file_system_info_get(path);
@ -238,6 +238,9 @@ _disks_poll_timer_cb(void *data)
free(path);
}
#else
mounted = file_system_info_all_get();
#endif
if (_private_data->sort_cb)
mounted = eina_list_sort(mounted, eina_list_count(mounted), _private_data->sort_cb);

Loading…
Cancel
Save