changeset 1870:f610eb62ce8a

* src/misc.cxx (cyg_fs_root_lookup): New function to find the mount point of a give filesystems root directory. * src/fio.h: * include/fileio.h: Made cyg_fs_{un}lock accessible outside of the fileio package
author asl
date Sat, 22 Jan 2005 14:03:37 +0000
parents 17d9a15eab14
children 31350a76c03d
files packages/io/fileio/current/ChangeLog packages/io/fileio/current/include/fileio.h packages/io/fileio/current/src/fio.h packages/io/fileio/current/src/misc.cxx
diffstat 4 files changed, 41 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/packages/io/fileio/current/ChangeLog
+++ b/packages/io/fileio/current/ChangeLog
@@ -1,3 +1,14 @@
+2005-01-22  Andrew Lunn  <andrew.lunn@ascom.ch>
+
+	* src/misc.cxx (cyg_fs_root_lookup): New function to find the mount
+	point of a give filesystems root directory.
+	* src/fio.h:
+	* include/fileio.h: Made cyg_fs_{un}lock accessible outside of the 
+	fileio package.
+
+2004-01-22  Andrew Lunn  <andrew.lunn@ascom.ch>
+
+	* 
 2004-12-15  Andrew Lunn  <andrew.lunn@ascom.ch>
 
 	* src/select.cxx (cyg_pselect): We need the oldmask under all
--- a/packages/io/fileio/current/include/fileio.h
+++ b/packages/io/fileio/current/include/fileio.h
@@ -440,6 +440,19 @@ struct CYG_SELINFO_TAG
 __externC int cyg_fs_get_attrib( const char *fname, 
                                  cyg_fs_attrib_t * const file_attrib );
 
+// Functions to lock and unlock a filesystem. These are normally used
+// internally by the fileio layer, but the file system might need to
+// use them when it needs to lock itself, eg when performing garbage
+// collect.
+__externC void cyg_fs_lock( cyg_mtab_entry *mte, cyg_uint32 syncmode );
+
+__externC void cyg_fs_unlock( cyg_mtab_entry *mte, cyg_uint32 syncmode );
+
+// To be able to lock the filesystem you need the mte. This function
+// allows the table of mounted filesystems to be searched to find an
+// mte which uses the give filesystem root.
+
+__externC cyg_mtab_entry * cyg_fs_root_lookup( cyg_dir *root );
 
 //=============================================================================
 // Default functions.
--- a/packages/io/fileio/current/src/fio.h
+++ b/packages/io/fileio/current/src/fio.h
@@ -199,10 +199,6 @@ CYG_MACRO_END
 
 __externC int cyg_mtab_lookup( cyg_dir *dir, const char **name, cyg_mtab_entry **mte);
 
-__externC void cyg_fs_lock( cyg_mtab_entry *mte, cyg_uint32 syncmode );
-
-__externC void cyg_fs_unlock( cyg_mtab_entry *mte, cyg_uint32 syncmode );
-
 //-----------------------------------------------------------------------------
 // Exports from fd.cxx
 
--- a/packages/io/fileio/current/src/misc.cxx
+++ b/packages/io/fileio/current/src/misc.cxx
@@ -414,6 +414,23 @@ void cyg_fs_unlock( cyg_mtab_entry *mte,
 }
 
 //==========================================================================
+// Search mount table for a filesystems root. 
+
+__externC cyg_mtab_entry * cyg_fs_root_lookup( cyg_dir *root ) 
+{
+     cyg_mtab_entry *m;
+
+     for( m = &cyg_mtab[0]; m != &cyg_mtab_end; m++ ) 
+     {
+          if( (cyg_dir *)m->root == root )
+          {
+               return m;
+          }
+     }
+     return NULL;
+}
+
+//==========================================================================
 // Timestamp support
 // This provides access to the current time/date, expressed as a
 // time_t.  It uses a number of mechanisms to do this, selecting