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:
Alexander Larsson 2009-02-25 16:37:35 +00:00 committed by Alexander Larsson
parent ddfe508c04
commit 8c6e7c103f
2 changed files with 72 additions and 0 deletions

View File

@ -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>
Bug 570069 wrong preprocessor directive in gio/glocalfileinfo.c

View File

@ -38,6 +38,9 @@
#ifdef HAVE_POLL_H
#include <poll.h>
#endif
#if HAVE_SYS_STATVFS_H
#include <sys/statvfs.h>
#endif
#include <stdio.h>
#include <unistd.h>
#include <sys/time.h>
@ -45,6 +48,7 @@
#include <string.h>
#include <signal.h>
#include <gstdio.h>
#include <dirent.h>
#include "gunixmounts.h"
#include "gfile.h"
@ -597,6 +601,61 @@ _g_get_unix_mounts (void)
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
#error No _g_get_unix_mounts() implementation for system
#endif
@ -975,6 +1034,12 @@ _g_get_unix_mount_points (void)
return g_list_reverse (return_list);
}
#elif defined(__INTERIX)
static GList *
_g_get_unix_mount_points (void)
{
return _g_get_unix_mounts ();
}
#else
#error No g_get_mount_table() implementation for system
#endif