changeset 1329:c687f86ab7a4

* src/io.cxx: Added cyg_fs_fsetinfo and cyg_fs_fgetinfo functions. * src/file.cxx: Added cyg_fs_setinfo and cyg_fs_getinfo functions. * include/fileio.h: Added cyg_fs_fsetinfo, cyg_fs_fgetinfo, cyg_fs_setinfo and cyg_fs_getinfo function prototypes.
author nickg
date Thu, 23 Oct 2003 17:15:19 +0000
parents afd4dd211d3a
children 322a6fa415e0
files packages/io/fileio/current/ChangeLog packages/io/fileio/current/include/fileio.h packages/io/fileio/current/src/file.cxx packages/io/fileio/current/src/io.cxx
diffstat 4 files changed, 121 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/packages/io/fileio/current/ChangeLog
+++ b/packages/io/fileio/current/ChangeLog
@@ -1,3 +1,12 @@
+2003-10-23  Savin Zlobec  <savin@elatec.si>
+
+	* src/io.cxx: Added cyg_fs_fsetinfo and cyg_fs_fgetinfo functions.
+	
+	* src/file.cxx: Added cyg_fs_setinfo and cyg_fs_getinfo functions.
+	
+	* include/fileio.h: Added cyg_fs_fsetinfo, cyg_fs_fgetinfo,
+	cyg_fs_setinfo and cyg_fs_getinfo function prototypes.
+
 2003-10-16  Andrew Lunn  <andrew.lunn@ascom.ch>
 
 	* src/socket.cxx (bind): Pass a copy of the socket address so the
--- a/packages/io/fileio/current/include/fileio.h
+++ b/packages/io/fileio/current/include/fileio.h
@@ -380,6 +380,14 @@ struct cyg_pathconf_info
 __externC int umount( const char *name);
 
 //=============================================================================
+// Get/Set info functions
+
+__externC int cyg_fs_getinfo( const char *path, int key, void *buf, int len );
+__externC int cyg_fs_setinfo( const char *path, int key, void *buf, int len );
+__externC int cyg_fs_fgetinfo( int fd, int key, void *buf, int len );
+__externC int cyg_fs_fsetinfo( int fd, int key, void *buf, int len );
+
+//=============================================================================
 // Select support
 
 //-----------------------------------------------------------------------------
--- a/packages/io/fileio/current/src/file.cxx
+++ b/packages/io/fileio/current/src/file.cxx
@@ -756,5 +756,57 @@ extern int 	access(const char *path, int
     FILEIO_RETURN_VALUE(buf);
 }
 
+//==========================================================================
+// FS get info.
+
+__externC int cyg_fs_getinfo( const char *path, int key, void *buf, int len )
+{
+    FILEIO_ENTRY();
+    
+    int ret = 0;
+    cyg_mtab_entry *mte = cyg_cdir_mtab_entry;
+    cyg_dir dir = cyg_cdir_dir;
+    const char *name = path;
+    
+    ret = cyg_mtab_lookup( &dir, &name, &mte );
+    
+    if( 0 != ret )
+        FILEIO_RETURN(ENOENT);
+
+    LOCK_FS( mte );
+    
+    ret = mte->fs->getinfo( mte, dir, name, key, buf, len );
+    
+    UNLOCK_FS( mte );
+    
+    FILEIO_RETURN(ret);
+}
+
+//==========================================================================
+// FS set info.
+
+__externC int cyg_fs_setinfo( const char *path, int key, void *buf, int len )
+{
+    FILEIO_ENTRY();
+    
+    int ret = 0;
+    cyg_mtab_entry *mte = cyg_cdir_mtab_entry;
+    cyg_dir dir = cyg_cdir_dir;
+    const char *name = path;
+    
+    ret = cyg_mtab_lookup( &dir, &name, &mte );
+    
+    if( 0 != ret )
+        FILEIO_RETURN(ENOENT);
+
+    LOCK_FS( mte );
+    
+    ret = mte->fs->setinfo( mte, dir, name, key, buf, len );
+    
+    UNLOCK_FS( mte );
+    
+    FILEIO_RETURN(ret);
+}
+
 // -------------------------------------------------------------------------
 // EOF file.cxx
--- a/packages/io/fileio/current/src/io.cxx
+++ b/packages/io/fileio/current/src/io.cxx
@@ -480,5 +480,57 @@ readwritev( int fd, const cyg_iovec *_io
     FILEIO_RETURN_VALUE(ret);
 }
 
+//==========================================================================
+// File get info.
+
+__externC int cyg_fs_fgetinfo( int fd, int key, void *buf, int len )
+{
+    FILEIO_ENTRY();
+
+    int ret;
+    cyg_file *fp;
+
+    fp = cyg_fp_get( fd );
+
+    if( fp == NULL )
+        FILEIO_RETURN(EBADF);
+       
+    LOCK_FILE( fp );
+
+    ret = fp->f_ops->fo_getinfo( fp, key, buf, len );
+    
+    UNLOCK_FILE( fp );
+
+    cyg_fp_free( fp );    
+    
+    FILEIO_RETURN(ret);
+}
+
+//==========================================================================
+// File set info.
+
+__externC int cyg_fs_fsetinfo( int fd, int key, void *buf, int len )
+{
+    FILEIO_ENTRY();
+
+    int ret;
+    cyg_file *fp;
+
+    fp = cyg_fp_get( fd );
+
+    if( fp == NULL )
+        FILEIO_RETURN(EBADF);
+       
+    LOCK_FILE( fp );
+
+    ret = fp->f_ops->fo_setinfo( fp, key, buf, len );
+    
+    UNLOCK_FILE( fp );
+
+    cyg_fp_free( fp );    
+    
+    FILEIO_RETURN(ret);
+}
+
 // -------------------------------------------------------------------------
 // EOF io.cxx