filesystems: fix naming

edi-0.5
Alastair Poole 4 years ago
parent 461c34fc0d
commit ce200bf65f
  1. 26
      src/bin/system/filesystems.c
  2. 16
      src/bin/system/filesystems.h
  3. 2
      src/bin/ui/ui.c
  4. 10
      src/bin/ui/ui_disk.c

@ -108,7 +108,7 @@ static _magic _magique[] = {
};
unsigned int
filesystem_id_by_name(const char *name)
file_system_id_by_name(const char *name)
{
size_t n = sizeof(_magique) / sizeof(_magic);
for (int i = 0; i < n; i++)
@ -120,7 +120,7 @@ filesystem_id_by_name(const char *name)
}
const char *
filesystem_name_by_id(unsigned int id)
file_system_name_by_id(unsigned int id)
{
size_t n = sizeof(_magique) / sizeof(_magic);
for (int i = 0; i < n; i++)
@ -133,7 +133,7 @@ filesystem_name_by_id(unsigned int id)
#if defined(__linux__)
static char *
filesystem_type_name(const char *mountpoint)
file_system_type_name(const char *mountpoint)
{
FILE *f;
char *mount, *res, *type, *end;
@ -166,10 +166,10 @@ filesystem_type_name(const char *mountpoint)
#endif
Filesystem_Info *
filesystem_info_get(const char *path)
File_System *
file_system_info_get(const char *path)
{
Filesystem_Info *fs;
File_System *fs;
const char *mountpoint;
struct statfs stats;
@ -179,7 +179,7 @@ filesystem_info_get(const char *path)
if (statfs(mountpoint, &stats) < 0)
return NULL;
fs = calloc(1, sizeof(Filesystem_Info));
fs = calloc(1, sizeof(File_System));
fs->mount = strdup(mountpoint);
fs->path = strdup(path);
@ -189,7 +189,7 @@ filesystem_info_get(const char *path)
#endif
#if defined(__linux__)
fs->type_name = filesystem_type_name(fs->mount);
fs->type_name = file_system_type_name(fs->mount);
#else
fs->type_name = strdup(stats.f_fstypename);
#endif
@ -201,7 +201,7 @@ filesystem_info_get(const char *path)
}
void
filesystem_info_free(Filesystem_Info *fs)
file_system_info_free(File_System *fs)
{
free(fs->mount);
free(fs->path);
@ -211,7 +211,7 @@ filesystem_info_free(Filesystem_Info *fs)
}
Eina_Bool
filesystem_in_use(const char *name)
file_system_in_use(const char *name)
{
Eina_List *disks;
char *path;
@ -221,13 +221,13 @@ filesystem_in_use(const char *name)
disks = disks_get();
EINA_LIST_FREE(disks, path)
{
Filesystem_Info *fs = filesystem_info_get(path);
File_System *fs = file_system_info_get(path);
if (fs)
{
if (fs->type == filesystem_id_by_name(name))
if (fs->type == file_system_id_by_name(name))
fs_mounted = EINA_TRUE;
filesystem_info_free(fs);
file_system_info_free(fs);
}
free(path);
}

@ -8,27 +8,27 @@ typedef struct {
unsigned long long used;
} _Usage;
typedef struct _Filesystem_Info {
typedef struct _File_System {
char *path;
char *mount;
char *type_name;
unsigned int type;
_Usage usage;
} Filesystem_Info;
} File_System;
const char *
filesystem_name_by_id(unsigned int id);
file_system_name_by_id(unsigned int id);
unsigned int
filesystem_id_by_name(const char *name);
file_system_id_by_name(const char *name);
Filesystem_Info *
filesystem_info_get(const char *path);
File_System *
file_system_info_get(const char *path);
void
filesystem_info_free(Filesystem_Info *fs);
file_system_info_free(File_System *fs);
Eina_Bool
filesystem_in_use(const char *name);
file_system_in_use(const char *name);
#endif

@ -1646,7 +1646,7 @@ _ui_init(Evas_Object *parent)
ui->cpu_list = NULL;
// Only take account of the ZFS ARC if there is an active mount.
ui->zfs_mounted = filesystem_in_use("ZFS");
ui->zfs_mounted = file_system_in_use("ZFS");
_ui = NULL;
_evisum_config = NULL;

@ -38,7 +38,7 @@ ui_tab_disk_add(Ui *ui)
}
static void
_ui_disk_add(Ui *ui, Filesystem_Info *inf)
_ui_disk_add(Ui *ui, File_System *inf)
{
Evas_Object *box, *frame, *pb, *label;
const char *type;
@ -46,7 +46,7 @@ _ui_disk_add(Ui *ui, Filesystem_Info *inf)
type = inf->type_name;
if (!type)
type = filesystem_name_by_id(inf->type);
type = file_system_name_by_id(inf->type);
if (!type) type = "unknown";
box = elm_box_add(ui->disk_activity);
@ -107,17 +107,17 @@ ui_tab_disk_update(Ui *ui)
disks = disks_get();
EINA_LIST_FREE(disks, path)
{
Filesystem_Info *fs = filesystem_info_get(path);
File_System *fs = file_system_info_get(path);
if (fs)
{
// ZFS usage may have changed during application's lifetime.
// Keep track of ZFS mounts else we may report bogus use
// of memory.
if (fs->type == filesystem_id_by_name("ZFS"))
if (fs->type == file_system_id_by_name("ZFS"))
zfs_mounted = EINA_TRUE;
_ui_disk_add(ui, fs);
filesystem_info_free(fs);
file_system_info_free(fs);
}
free(path);
}

Loading…
Cancel
Save