Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2010-08-09 12:18:30 +0400
committerCorinna Vinschen <corinna@vinschen.de>2010-08-09 12:18:30 +0400
commita52993d42652f6f34763f33cfac9c961c96e595b (patch)
tree25a48b31baaf328d9dc90dffe2c253acfc5be56d /winsup/cygwin
parent99006a85e255eb93d174b1de97df6821bc321933 (diff)
* fhandler_proc.cc: Add /proc/filesystems virtual file.
(format_proc_filesystems): New function. * mount.cc (fs_names): Move to global scope. Redefine as array of { "name", block_device? } structs. (fillout_mntent): Use name member of fs_names. * mount.h (fs_names): New prototype.
Diffstat (limited to 'winsup/cygwin')
-rw-r--r--winsup/cygwin/ChangeLog9
-rw-r--r--winsup/cygwin/fhandler_proc.cc23
-rw-r--r--winsup/cygwin/mount.cc38
-rw-r--r--winsup/cygwin/mount.h5
4 files changed, 55 insertions, 20 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index b36dc8067..3a574186b 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,14 @@
2010-08-09 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
+ * fhandler_proc.cc: Add /proc/filesystems virtual file.
+ (format_proc_filesystems): New function.
+ * mount.cc (fs_names): Move to global scope. Redefine as array
+ of { "name", block_device? } structs.
+ (fillout_mntent): Use name member of fs_names.
+ * mount.h (fs_names): New prototype.
+
+2010-08-09 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
+
* include/dlfcn.h (RTLD_LOCAL): Define.
2010-08-06 Corinna Vinschen <corinna@vinschen.de>
diff --git a/winsup/cygwin/fhandler_proc.cc b/winsup/cygwin/fhandler_proc.cc
index de55797d6..a7eba3abf 100644
--- a/winsup/cygwin/fhandler_proc.cc
+++ b/winsup/cygwin/fhandler_proc.cc
@@ -1,6 +1,6 @@
/* fhandler_proc.cc: fhandler for /proc virtual filesystem
- Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2009 Red Hat, Inc.
+ Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010 Red Hat, Inc.
This file is part of Cygwin.
@@ -28,6 +28,7 @@ details. */
#include <winioctl.h>
#include <wchar.h>
#include "cpuid.h"
+#include "mount.h"
#define _COMPILING_NEWLIB
#include <dirent.h>
@@ -41,6 +42,7 @@ static _off64_t format_proc_cpuinfo (void *, char *&);
static _off64_t format_proc_partitions (void *, char *&);
static _off64_t format_proc_self (void *, char *&);
static _off64_t format_proc_mounts (void *, char *&);
+static _off64_t format_proc_filesystems (void *, char *&);
/* names of objects in /proc */
static const virt_tab_t proc_tab[] = {
@@ -59,6 +61,7 @@ static const virt_tab_t proc_tab[] = {
{ "registry32", FH_REGISTRY, virt_directory, NULL },
{ "registry64", FH_REGISTRY, virt_directory, NULL },
{ "net", FH_PROCNET, virt_directory, NULL },
+ { "filesystems", FH_PROC, virt_file, format_proc_filesystems },
{ NULL, 0, virt_none, NULL }
};
@@ -1220,4 +1223,22 @@ format_proc_mounts (void *, char *&destbuf)
return __small_sprintf (destbuf, "self/mounts");
}
+static _off64_t
+format_proc_filesystems (void *, char *&destbuf)
+{
+ tmp_pathbuf tp;
+ char *buf = tp.c_get ();
+ char *bufptr = buf;
+
+ /* start at 1 to skip type "none" */
+ for (int i = 1; fs_names[i].name; i++)
+ bufptr += __small_sprintf(bufptr, "%s\t%s\n",
+ fs_names[i].block_device ? "" : "nodev",
+ fs_names[i].name);
+
+ destbuf = (char *) crealloc_abort (destbuf, bufptr - buf);
+ memcpy (destbuf, buf, bufptr - buf);
+ return bufptr - buf;
+}
+
#undef print
diff --git a/winsup/cygwin/mount.cc b/winsup/cygwin/mount.cc
index 561146a57..315125967 100644
--- a/winsup/cygwin/mount.cc
+++ b/winsup/cygwin/mount.cc
@@ -1472,6 +1472,24 @@ mount_info::del_item (const char *path, unsigned flags)
/************************* mount_item class ****************************/
+/* Order must be identical to mount.h, enum fs_info_type. */
+fs_names_t fs_names[] = {
+ { "none", false },
+ { "vfat", true },
+ { "ntfs", true },
+ { "smbfs", false },
+ { "nfs", false },
+ { "netapp", false },
+ { "iso9660", true },
+ { "udf", true },
+ { "csc-cache", false },
+ { "sunwnfs", false },
+ { "unixfs", false },
+ { "mvfs", false },
+ { "cifs", false },
+ { "nwfs", false }
+};
+
static mntent *
fillout_mntent (const char *native_path, const char *posix_path, unsigned flags)
{
@@ -1509,26 +1527,8 @@ fillout_mntent (const char *native_path, const char *posix_path, unsigned flags)
RtlAppendUnicodeToString (&unat, L"\\");
mntinfo.update (&unat, NULL);
- /* Order must be identical to mount.h, enum fs_info_type. */
- const char *fs_names[] = {
- "none",
- "vfat",
- "ntfs",
- "smbfs",
- "nfs",
- "netapp",
- "iso9660",
- "udf",
- "csc-cache",
- "sunwnfs",
- "unixfs",
- "mvfs",
- "cifs",
- "nwfs"
- };
-
if (mntinfo.what_fs () > 0 && mntinfo.what_fs () < max_fs_type)
- strcpy (_my_tls.locals.mnt_type, fs_names[mntinfo.what_fs ()]);
+ strcpy (_my_tls.locals.mnt_type, fs_names[mntinfo.what_fs ()].name);
else
strcpy (_my_tls.locals.mnt_type, mntinfo.fsname ());
diff --git a/winsup/cygwin/mount.h b/winsup/cygwin/mount.h
index 7133cc412..7c229bb2e 100644
--- a/winsup/cygwin/mount.h
+++ b/winsup/cygwin/mount.h
@@ -32,6 +32,11 @@ enum fs_info_type
max_fs_type
};
+extern struct fs_names_t {
+ const char *name;
+ bool block_device;
+} fs_names[];
+
#define IMPLEMENT_FS_FLAG(func, flag) \
bool func (bool val) { if (val) status.fs_type = flag; return val; } \
bool func () const { return status.fs_type == flag; }