mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-30 04:13:06 +02:00
Bug 570073 – Add support for reading filesystems on Interix
2009-02-25 Alexander Larsson <alexl@redhat.com> Bug 570073 – Add support for reading filesystems on Interix * gunixmounts.c (_g_get_unix_mounts): Support Interix. Patch from Fabian Groffen svn path=/trunk/; revision=7911
This commit is contained in:
parent
ddfe508c04
commit
8c6e7c103f
@ -1,3 +1,10 @@
|
|||||||
|
2009-02-25 Alexander Larsson <alexl@redhat.com>
|
||||||
|
|
||||||
|
Bug 570073 – Add support for reading filesystems on Interix
|
||||||
|
|
||||||
|
* gunixmounts.c (_g_get_unix_mounts):
|
||||||
|
Support Interix. Patch from Fabian Groffen
|
||||||
|
|
||||||
2009-02-25 Paolo Borelli <pborelli@katamail.com>
|
2009-02-25 Paolo Borelli <pborelli@katamail.com>
|
||||||
|
|
||||||
Bug 570069 – wrong preprocessor directive in gio/glocalfileinfo.c
|
Bug 570069 – wrong preprocessor directive in gio/glocalfileinfo.c
|
||||||
|
@ -38,6 +38,9 @@
|
|||||||
#ifdef HAVE_POLL_H
|
#ifdef HAVE_POLL_H
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if HAVE_SYS_STATVFS_H
|
||||||
|
#include <sys/statvfs.h>
|
||||||
|
#endif
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
@ -45,6 +48,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <gstdio.h>
|
#include <gstdio.h>
|
||||||
|
#include <dirent.h>
|
||||||
|
|
||||||
#include "gunixmounts.h"
|
#include "gunixmounts.h"
|
||||||
#include "gfile.h"
|
#include "gfile.h"
|
||||||
@ -597,6 +601,61 @@ _g_get_unix_mounts (void)
|
|||||||
|
|
||||||
return g_list_reverse (return_list);
|
return g_list_reverse (return_list);
|
||||||
}
|
}
|
||||||
|
#elif defined(__INTERIX)
|
||||||
|
|
||||||
|
static char *
|
||||||
|
get_mtab_monitor_file (void)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static GList *
|
||||||
|
_g_get_unix_mounts (void)
|
||||||
|
{
|
||||||
|
DIR *dirp;
|
||||||
|
GList* return_list = NULL;
|
||||||
|
char filename[9 + NAME_MAX];
|
||||||
|
|
||||||
|
dirp = opendir ("/dev/fs");
|
||||||
|
if (!dirp)
|
||||||
|
{
|
||||||
|
g_warning ("unable to read /dev/fs!");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
struct statvfs statbuf;
|
||||||
|
struct dirent entry;
|
||||||
|
struct dirent* result;
|
||||||
|
|
||||||
|
if (readdir_r (dirp, &entry, &result) || result == NULL)
|
||||||
|
break;
|
||||||
|
|
||||||
|
strcpy (filename, "/dev/fs/");
|
||||||
|
strcat (filename, entry.d_name);
|
||||||
|
|
||||||
|
if (statvfs (filename, &statbuf) == 0)
|
||||||
|
{
|
||||||
|
GUnixMountEntry* mount_entry = g_new0(GUnixMountEntry, 1);
|
||||||
|
|
||||||
|
mount_entry->mount_path = g_strdup (statbuf.f_mntonname);
|
||||||
|
mount_entry->device_path = g_strdup (statbuf.f_mntfromname);
|
||||||
|
mount_entry->filesystem_type = g_strdup (statbuf.f_fstypename);
|
||||||
|
|
||||||
|
if (statbuf.f_flag & ST_RDONLY)
|
||||||
|
mount_entry->is_read_only = TRUE;
|
||||||
|
|
||||||
|
return_list = g_list_prepend(return_list, mount_entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return_list = g_list_reverse (return_list);
|
||||||
|
|
||||||
|
closedir (dirp);
|
||||||
|
|
||||||
|
return return_list;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
#error No _g_get_unix_mounts() implementation for system
|
#error No _g_get_unix_mounts() implementation for system
|
||||||
#endif
|
#endif
|
||||||
@ -975,6 +1034,12 @@ _g_get_unix_mount_points (void)
|
|||||||
|
|
||||||
return g_list_reverse (return_list);
|
return g_list_reverse (return_list);
|
||||||
}
|
}
|
||||||
|
#elif defined(__INTERIX)
|
||||||
|
static GList *
|
||||||
|
_g_get_unix_mount_points (void)
|
||||||
|
{
|
||||||
|
return _g_get_unix_mounts ();
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
#error No g_get_mount_table() implementation for system
|
#error No g_get_mount_table() implementation for system
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user