This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

fileio mutex init attrib and trivial namespace bits


As per ecos-devel, the nstab_lock mutex in src/socket.cxx should have an init priority. While there, I noticed the mutex should be static really, and then noticed nstab itself is in the global namespace. I then got a bit carried away!

Simple renames anyway, and build checked for viper.

Jifl
--
eCosCentric    http://www.eCosCentric.com/    The eCos and RedBoot experts
--[ "You can complain because roses have thorns, or you ]--
--[  can rejoice because thorns have roses." -Lincoln   ]-- Opinions==mine
Index: ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/fileio/current/ChangeLog,v
retrieving revision 1.30
diff -u -5 -p -r1.30 ChangeLog
--- ChangeLog	20 Mar 2003 19:00:43 -0000	1.30
+++ ChangeLog	11 Apr 2003 02:03:02 -0000
@@ -1,5 +1,16 @@
+2003-04-11  Jonathan Larmour  <jifl at eCosCentric dot com>
+
+	* src/socket.cxx: Give nstab_lock mutex a priority. Also it's
+	local, so make static.
+	Change nstab and nstab_end to cyg_nstab and cyg_nstab_end for
+	cleaner namespace.
+	* include/sockio.h: nstab -> cyg_nstab.
+	* src/misc.cxx, src/dir.cxx, src/fio.h, src/file.cxx: Change
+	fstab, fstab_end, mtab, mtab_end, cdir_dir, cdir_mtab_entry to
+	have cyg_ prefix for cleaner namespace.
+
 2003-03-20  Gary Thomas  <gary at mlbassoc dot com>
 
 	* src/devfs.cxx: Remove unnecessary checks for -EAGAIN (should
 	no longer happen in lower layers).
 
Index: src/dir.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/fileio/current/src/dir.cxx,v
retrieving revision 1.4
diff -u -5 -p -r1.4 dir.cxx
--- src/dir.cxx	23 May 2002 23:06:08 -0000	1.4
+++ src/dir.cxx	11 Apr 2003 02:03:05 -0000
@@ -96,12 +96,12 @@ extern DIR *opendir( const char *dirname
     CYG_CANCELLATION_POINT;
 
     int ret = 0;
     int fd;
     cyg_file *file;
-    cyg_mtab_entry *mte = cdir_mtab_entry;
-    cyg_dir dir = cdir_dir;
+    cyg_mtab_entry *mte = cyg_cdir_mtab_entry;
+    cyg_dir dir = cyg_cdir_dir;
     const char *name = dirname;
 
     fd = cyg_fd_alloc(1); // Never return fd 0
 
     if( fd < 0 )
Index: src/file.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/fileio/current/src/file.cxx,v
retrieving revision 1.7
diff -u -5 -p -r1.7 file.cxx
--- src/file.cxx	23 May 2002 23:06:09 -0000	1.7
+++ src/file.cxx	11 Apr 2003 02:03:05 -0000
@@ -112,11 +112,11 @@ static size_t cwd_size = 0;
 
 static void update_cwd( cyg_mtab_entry *mte, cyg_dir dir, const char *path )
 {
     char *p = cwd;
 
-    if( mte != cdir_mtab_entry || dir != cdir_dir )
+    if( mte != cyg_cdir_mtab_entry || dir != cyg_cdir_dir )
     {
         // Here, the path is relative to the root of the filesystem,
         // or in a totally new filesystem, initialize the cwd with the
         // mount point name of the filesystem.
 
@@ -191,12 +191,12 @@ __externC int open( const char *path, in
     CYG_CANCELLATION_POINT;
 
     int ret = 0;
     int fd;
     cyg_file *file;
-    cyg_mtab_entry *mte = cdir_mtab_entry;
-    cyg_dir dir = cdir_dir;
+    cyg_mtab_entry *mte = cyg_cdir_mtab_entry;
+    cyg_dir dir = cyg_cdir_dir;
     const char *name = path;
 
     // At least one of O_RDONLY, O_WRONLY, O_RDWR must be provided
     if( (oflag & O_RDWR) == 0 )
         FILEIO_RETURN(EINVAL);
@@ -259,12 +259,12 @@ __externC int creat( const char *path, m
 __externC int unlink( const char *path )
 {
     FILEIO_ENTRY();
     
     int ret = 0;
-    cyg_mtab_entry *mte = cdir_mtab_entry;
-    cyg_dir dir = cdir_dir;
+    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 )
@@ -285,12 +285,12 @@ __externC int unlink( const char *path )
 __externC int mkdir( const char *path, mode_t mode )
 {
     FILEIO_ENTRY();
     
     int ret = 0;
-    cyg_mtab_entry *mte = cdir_mtab_entry;
-    cyg_dir dir = cdir_dir;
+    cyg_mtab_entry *mte = cyg_cdir_mtab_entry;
+    cyg_dir dir = cyg_cdir_dir;
     const char *name = path;
 
     mode=mode;
     
     ret = cyg_mtab_lookup( &dir, &name, &mte );
@@ -313,12 +313,12 @@ __externC int mkdir( const char *path, m
 __externC int rmdir( const char *path )
 {
     FILEIO_ENTRY();
     
     int ret = 0;
-    cyg_mtab_entry *mte = cdir_mtab_entry;
-    cyg_dir dir = cdir_dir;
+    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 )
@@ -339,14 +339,14 @@ __externC int rmdir( const char *path )
 __externC int rename( const char *path1, const char *path2 )
 {
     FILEIO_ENTRY();
     
     int ret = 0;
-    cyg_mtab_entry *mte1 = cdir_mtab_entry;
-    cyg_mtab_entry *mte2 = cdir_mtab_entry;
-    cyg_dir dir1 = cdir_dir;
-    cyg_dir dir2 = cdir_dir;
+    cyg_mtab_entry *mte1 = cyg_cdir_mtab_entry;
+    cyg_mtab_entry *mte2 = cyg_cdir_mtab_entry;
+    cyg_dir dir1 = cyg_cdir_dir;
+    cyg_dir dir2 = cyg_cdir_dir;
     const char *name1 = path1;
     const char *name2 = path2;
 
     ret = cyg_mtab_lookup( &dir1, &name1, &mte1 );
     
@@ -377,14 +377,14 @@ __externC int rename( const char *path1,
 __externC int link( const char *path1, const char *path2 )
 {
     FILEIO_ENTRY();
     
     int ret = 0;
-    cyg_mtab_entry *mte1 = cdir_mtab_entry;
-    cyg_mtab_entry *mte2 = cdir_mtab_entry;
-    cyg_dir dir1 = cdir_dir;
-    cyg_dir dir2 = cdir_dir;
+    cyg_mtab_entry *mte1 = cyg_cdir_mtab_entry;
+    cyg_mtab_entry *mte2 = cyg_cdir_mtab_entry;
+    cyg_dir dir1 = cyg_cdir_dir;
+    cyg_dir dir2 = cyg_cdir_dir;
     const char *name1 = path1;
     const char *name2 = path2;
 
     ret = cyg_mtab_lookup( &dir1, &name1, &mte1 );
     
@@ -415,12 +415,12 @@ __externC int link( const char *path1, c
 __externC int chdir( const char *path )
 {
     FILEIO_ENTRY();
     
     int ret = 0;
-    cyg_mtab_entry *mte = cdir_mtab_entry;
-    cyg_dir dir = cdir_dir;
+    cyg_mtab_entry *mte = cyg_cdir_mtab_entry;
+    cyg_dir dir = cyg_cdir_dir;
     cyg_dir newdir;
     const char *name = path;
 
     ret = cyg_mtab_lookup( &dir, &name, &mte );
     
@@ -438,28 +438,28 @@ __externC int chdir( const char *path )
 
 #ifdef CYGPKG_IO_FILEIO_TRACK_CWD
     update_cwd( mte, dir, name );
 #endif
     
-    if( cdir_mtab_entry != NULL && cdir_dir != CYG_DIR_NULL )
+    if( cyg_cdir_mtab_entry != NULL && cyg_cdir_dir != CYG_DIR_NULL )
     {
-        // Now detach from current cdir. We call the current directory's
+        // Now detach from current cyg_cdir. We call the current directory's
         // chdir routine with a NULL dir_out pointer.
 
-        LOCK_FS(cdir_mtab_entry);
+        LOCK_FS(cyg_cdir_mtab_entry);
 
-        ret = cdir_mtab_entry->fs->chdir( cdir_mtab_entry, cdir_dir, NULL, NULL );
+        ret = cyg_cdir_mtab_entry->fs->chdir( cyg_cdir_mtab_entry, cyg_cdir_dir, NULL, NULL );
     
-        UNLOCK_FS(cdir_mtab_entry);
+        UNLOCK_FS(cyg_cdir_mtab_entry);
 
         // We really shouldn't get an error here.
         if( 0 != ret )
             FILEIO_RETURN(ret);
     }
     
-    cdir_mtab_entry = mte;
-    cdir_dir = newdir;
+    cyg_cdir_mtab_entry = mte;
+    cyg_cdir_dir = newdir;
     
     FILEIO_RETURN(ENOERR);
 }
 
 //==========================================================================
@@ -468,12 +468,12 @@ __externC int chdir( const char *path )
 __externC int stat( const char *path, struct stat *buf )
 {
     FILEIO_ENTRY();
     
     int ret = 0;
-    cyg_mtab_entry *mte = cdir_mtab_entry;
-    cyg_dir dir = cdir_dir;
+    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 )
@@ -494,12 +494,12 @@ __externC int stat( const char *path, st
 __externC long pathconf( const char *path, int vname )
 {
     FILEIO_ENTRY();
     
     int ret = 0;
-    cyg_mtab_entry *mte = cdir_mtab_entry;
-    cyg_dir dir = cdir_dir;
+    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 )
@@ -557,12 +557,12 @@ extern int 	access(const char *path, int
 __externC char *getcwd( char *buf, size_t size )
 {
     FILEIO_ENTRY();
 
     int err = ENOERR;
-    cyg_mtab_entry *mte = cdir_mtab_entry;
-    cyg_dir dir = cdir_dir;
+    cyg_mtab_entry *mte = cyg_cdir_mtab_entry;
+    cyg_dir dir = cyg_cdir_dir;
     cyg_getcwd_info info;
 
     if( size == 0 )
     {
         errno = EINVAL;
Index: src/fio.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/fileio/current/src/fio.h,v
retrieving revision 1.7
diff -u -5 -p -r1.7 fio.h
--- src/fio.h	11 Nov 2002 23:58:53 -0000	1.7
+++ src/fio.h	11 Apr 2003 02:03:05 -0000
@@ -182,12 +182,12 @@ CYG_MACRO_END
 
 //-----------------------------------------------------------------------------
 // Exports from misc.cxx
 
 // Current directory info
-__externC cyg_mtab_entry *cdir_mtab_entry;
-__externC cyg_dir cdir_dir;
+__externC cyg_mtab_entry *cyg_cdir_mtab_entry;
+__externC cyg_dir cyg_cdir_dir;
 
 __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 );
 
Index: src/misc.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/fileio/current/src/misc.cxx,v
retrieving revision 1.7
diff -u -5 -p -r1.7 misc.cxx
--- src/misc.cxx	23 Jan 2003 17:07:27 -0000	1.7
+++ src/misc.cxx	11 Apr 2003 02:03:05 -0000
@@ -91,46 +91,46 @@ __externC int chdir( const char *path );
 // -------------------------------------------------------------------------
 // Filesystem table.
 
 // This array contains entries for all filesystem that are installed in
 // the system.
-__externC cyg_fstab_entry fstab[];
-CYG_HAL_TABLE_BEGIN( fstab, fstab );
+__externC cyg_fstab_entry cyg_fstab[];
+CYG_HAL_TABLE_BEGIN( cyg_fstab, fstab );
 
 // end of filesystem table, set in linker script.
-__externC cyg_fstab_entry fstab_end;
-CYG_HAL_TABLE_END( fstab_end, fstab );
+__externC cyg_fstab_entry cyg_fstab_end;
+CYG_HAL_TABLE_END( cyg_fstab_end, fstab );
 
 #ifdef CYGPKG_KERNEL
 // Array of mutexes for locking the fstab entries
-Cyg_Mutex fstab_lock[CYGNUM_FILEIO_FSTAB_MAX] CYGBLD_ATTRIB_INIT_PRI(CYG_INIT_IO_FS);
+static Cyg_Mutex fstab_lock[CYGNUM_FILEIO_FSTAB_MAX] CYGBLD_ATTRIB_INIT_PRI(CYG_INIT_IO_FS);
 #endif
 
 // -------------------------------------------------------------------------
 // Mount table.
 
 // This array contains entries for all valid running filesystems.
-__externC cyg_mtab_entry mtab[];
-CYG_HAL_TABLE_BEGIN( mtab, mtab );
+__externC cyg_mtab_entry cyg_mtab[];
+CYG_HAL_TABLE_BEGIN( cyg_mtab, mtab );
 
 // Extra entries at end of mtab for dynamic mount points.
-cyg_mtab_entry mtab_extra[CYGNUM_FILEIO_MTAB_EXTRA] CYG_HAL_TABLE_EXTRA(mtab) = { { NULL } };
+cyg_mtab_entry cyg_mtab_extra[CYGNUM_FILEIO_MTAB_EXTRA] CYG_HAL_TABLE_EXTRA(mtab) = { { NULL } };
 
 // End of mount table, set in the linker script.
-__externC cyg_mtab_entry mtab_end;
-CYG_HAL_TABLE_END( mtab_end, mtab );
+__externC cyg_mtab_entry cyg_mtab_end;
+CYG_HAL_TABLE_END( cyg_mtab_end, mtab );
 
 #ifdef CYGPKG_KERNEL
 // Array of mutexes for locking the mtab entries
-Cyg_Mutex mtab_lock[CYGNUM_FILEIO_MTAB_MAX] CYGBLD_ATTRIB_INIT_PRI(CYG_INIT_IO_FS);
+static Cyg_Mutex mtab_lock[CYGNUM_FILEIO_MTAB_MAX] CYGBLD_ATTRIB_INIT_PRI(CYG_INIT_IO_FS);
 #endif
 
 //==========================================================================
 // Current directory
 
-cyg_mtab_entry *cdir_mtab_entry = NULL;
-cyg_dir cdir_dir = CYG_DIR_NULL;
+cyg_mtab_entry *cyg_cdir_mtab_entry = NULL;
+cyg_dir cyg_cdir_dir = CYG_DIR_NULL;
 
 //==========================================================================
 // Initialization object
 
 class Cyg_Fileio_Init_Class
@@ -155,27 +155,27 @@ Cyg_Fileio_Init_Class::Cyg_Fileio_Init_C
 
 static void cyg_mtab_init()
 {
     cyg_mtab_entry *m;
     
-    for( m = &mtab[0]; m != &mtab_end; m++ )
+    for( m = &cyg_mtab[0]; m != &cyg_mtab_end; m++ )
     {
         const char *fsname = m->fsname;
         cyg_fstab_entry *f;
 
         // Ignore empty entries
         if( m->name == NULL )
             continue;
         
         // stop if there are more than the configured maximum
-        if( m-&mtab[0] >= CYGNUM_FILEIO_MTAB_MAX )
+        if( m-&cyg_mtab[0] >= CYGNUM_FILEIO_MTAB_MAX )
             break;
         
-        for( f = &fstab[0]; f != &fstab_end; f++ )
+        for( f = &cyg_fstab[0]; f != &cyg_fstab_end; f++ )
         {
             // stop if there are more than the configured maximum
-            if( f-&fstab[0] >= CYGNUM_FILEIO_FSTAB_MAX )
+            if( f-&cyg_fstab[0] >= CYGNUM_FILEIO_FSTAB_MAX )
                 break;
             
             if( strcmp( fsname, f->name) == 0 )
             {
                 // We have a match.
@@ -239,11 +239,11 @@ __externC int cyg_mtab_lookup( cyg_dir *
         // Current directory is well known
         return 0;
     }
 
     // Otherwise search the mount table.
-    for( m = &mtab[0]; m != &mtab_end; m++ )
+    for( m = &cyg_mtab[0]; m != &cyg_mtab_end; m++ )
     {
         if( m->name != NULL && m->valid )
         {
             int len = matchlen(*name,m->name);
             if( len > best_len )
@@ -276,37 +276,37 @@ __externC int mount( const char *devname
     cyg_mtab_entry *m;
     cyg_fstab_entry *f;
     int result = ENOERR;
 
     // Search the mount table for an empty entry
-    for( m = &mtab[0]; m != &mtab_end; m++ )
+    for( m = &cyg_mtab[0]; m != &cyg_mtab_end; m++ )
     {
         // stop if there are more than the configured maximum
-        if( m-&mtab[0] >= CYGNUM_FILEIO_MTAB_MAX )
+        if( m-&cyg_mtab[0] >= CYGNUM_FILEIO_MTAB_MAX )
         {
-            m = &mtab_end;
+            m = &cyg_mtab_end;
             break;
         }
 
          if( m->name == NULL ) break;
     }
 
-    if( m == &mtab_end )
+    if( m == &cyg_mtab_end )
         FILEIO_RETURN(ENOMEM);
 
     // Now search the fstab for the filesystem implementation
-    for( f = &fstab[0]; f != &fstab_end; f++ )
+    for( f = &cyg_fstab[0]; f != &cyg_fstab_end; f++ )
     {
         // stop if there are more than the configured maximum
-        if( f-&fstab[0] >= CYGNUM_FILEIO_FSTAB_MAX )
+        if( f-&cyg_fstab[0] >= CYGNUM_FILEIO_FSTAB_MAX )
             break;
             
         if( strcmp( fsname, f->name) == 0 )
             break;
     }
 
-    if( f == &fstab_end )
+    if( f == &cyg_fstab_end )
         FILEIO_RETURN(ENODEV);
             
     // We have a match.
 
     m->name = dir;
@@ -325,12 +325,12 @@ __externC int mount( const char *devname
         m->name = NULL;
     }
 
     // Make sure that there is something to search (for open)
 
-    if (cdir_mtab_entry == (cyg_mtab_entry *)NULL) {
-        cdir_mtab_entry = m;
+    if (cyg_cdir_mtab_entry == (cyg_mtab_entry *)NULL) {
+        cyg_cdir_mtab_entry = m;
     }
 
     FILEIO_RETURN(result);
 }
 
@@ -344,16 +344,16 @@ __externC int umount( const char *name)
     FILEIO_ENTRY();
     
     cyg_mtab_entry *m;
 
     // Search the mount table for a matching entry
-    for( m = &mtab[0]; m != &mtab_end; m++ )
+    for( m = &cyg_mtab[0]; m != &cyg_mtab_end; m++ )
     {
         // stop if there are more than the configured maximum
-        if( m-&mtab[0] >= CYGNUM_FILEIO_MTAB_MAX )
+        if( m-&cyg_mtab[0] >= CYGNUM_FILEIO_MTAB_MAX )
         {
-            m = &mtab_end;
+            m = &cyg_mtab_end;
             break;
         }
 
         // Ignore empty or invalid entries
          if( m->name == NULL || !m->valid ) continue;
@@ -362,11 +362,11 @@ __externC int umount( const char *name)
          if( strcmp(name,m->name) == 0 ) break;
 
          // Match device name too?
     }
 
-    if( m == &mtab_end )
+    if( m == &cyg_mtab_end )
         FILEIO_RETURN(EINVAL);
 
     // We have a match, call the umount function
 
     err = m->fs->umount( m );
@@ -386,32 +386,32 @@ __externC int umount( const char *name)
 void cyg_fs_lock( cyg_mtab_entry *mte, cyg_uint32 syncmode )
 {
     CYG_ASSERT(mte != NULL, "Bad mount table entry");
 
     if( syncmode & CYG_SYNCMODE_FILE_FILESYSTEM ) {
-        CYG_ASSERT(mte->fs-&fstab[0] < CYGNUM_FILEIO_FSTAB_MAX, "Bad file system");
-        FILEIO_MUTEX_LOCK( fstab_lock[mte->fs-&fstab[0]] );
+        CYG_ASSERT(mte->fs-&cyg_fstab[0] < CYGNUM_FILEIO_FSTAB_MAX, "Bad file system");
+        FILEIO_MUTEX_LOCK( fstab_lock[mte->fs-&cyg_fstab[0]] );
     }
 
     if( syncmode & CYG_SYNCMODE_FILE_MOUNTPOINT ) {
-        CYG_ASSERT(mte-&mtab[0] < CYGNUM_FILEIO_MTAB_MAX, "Bad mount point");
-        FILEIO_MUTEX_LOCK( mtab_lock[mte-&mtab[0]] );
+        CYG_ASSERT(mte-&cyg_mtab[0] < CYGNUM_FILEIO_MTAB_MAX, "Bad mount point");
+        FILEIO_MUTEX_LOCK( mtab_lock[mte-&cyg_mtab[0]] );
     }
 }
 
 void cyg_fs_unlock( cyg_mtab_entry *mte, cyg_uint32 syncmode )
 {
     CYG_ASSERT(mte != NULL, "Bad mount table entry");
 
     if( syncmode & CYG_SYNCMODE_FILE_FILESYSTEM ) {
-        CYG_ASSERT(mte->fs-&fstab[0] < CYGNUM_FILEIO_FSTAB_MAX, "Bad file system");
-        FILEIO_MUTEX_UNLOCK( fstab_lock[mte->fs-&fstab[0]] );
+        CYG_ASSERT(mte->fs-&cyg_fstab[0] < CYGNUM_FILEIO_FSTAB_MAX, "Bad file system");
+        FILEIO_MUTEX_UNLOCK( fstab_lock[mte->fs-&cyg_fstab[0]] );
     }
 
     if( syncmode & CYG_SYNCMODE_FILE_MOUNTPOINT ) {
-        CYG_ASSERT(mte-&mtab[0] < CYGNUM_FILEIO_MTAB_MAX, "Bad mount point");
-        FILEIO_MUTEX_UNLOCK( mtab_lock[mte-&mtab[0]] );
+        CYG_ASSERT(mte-&cyg_mtab[0] < CYGNUM_FILEIO_MTAB_MAX, "Bad mount point");
+        FILEIO_MUTEX_UNLOCK( mtab_lock[mte-&cyg_mtab[0]] );
     }
 }
 
 //==========================================================================
 // Timestamp support
Index: src/socket.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/fileio/current/src/socket.cxx,v
retrieving revision 1.5
diff -u -5 -p -r1.5 socket.cxx
--- src/socket.cxx	23 May 2002 23:06:10 -0000	1.5
+++ src/socket.cxx	11 Apr 2003 02:03:05 -0000
@@ -108,30 +108,30 @@ static void cyg_sock_unlock( cyg_file *f
 
 //==========================================================================
 // Tables and local variables
 
 // Array of network stacks installed
-__externC cyg_nstab_entry nstab[];
-CYG_HAL_TABLE_BEGIN( nstab, nstab );
+__externC cyg_nstab_entry cyg_nstab[];
+CYG_HAL_TABLE_BEGIN( cyg_nstab, nstab );
 
 // End of array marker
-__externC cyg_nstab_entry nstab_end;
-CYG_HAL_TABLE_END( nstab_end, nstab );
+__externC cyg_nstab_entry cyg_nstab_end;
+CYG_HAL_TABLE_END( cyg_nstab_end, nstab );
 
-Cyg_Mutex nstab_lock[CYGNUM_FILEIO_NSTAB_MAX];
+static Cyg_Mutex nstab_lock[CYGNUM_FILEIO_NSTAB_MAX] CYGBLD_ATTRIB_INIT_PRI(CYG_INIT_IO_FS);
 
 //==========================================================================
 // Initialization
 
 __externC void cyg_nstab_init()
 {
     cyg_nstab_entry *n;
 
-    for( n = &nstab[0]; n != &nstab_end; n++ )
+    for( n = &cyg_nstab[0]; n != &cyg_nstab_end; n++ )
     {
         // stop if there are more than the configured maximum
-        if( n-&nstab[0] >= CYGNUM_FILEIO_NSTAB_MAX )
+        if( n-&cyg_nstab[0] >= CYGNUM_FILEIO_NSTAB_MAX )
             break;
 
         if( n->init( n ) == 0 )
         {
             n->valid = true;
@@ -165,11 +165,11 @@ __externC int	socket (int domain, int ty
         SOCKET_RETURN(ENFILE);
     }
 
     cyg_nstab_entry *n;
 
-    for( n = &nstab[0]; n != &nstab_end; n++ )
+    for( n = &cyg_nstab[0]; n != &cyg_nstab_end; n++ )
     {
         LOCK_NS( n );
         
         err = n->socket( n, domain, type, protocol, file );
 
@@ -695,38 +695,38 @@ __externC int	shutdown (int s, int how)
 
 static void cyg_ns_lock( cyg_nstab_entry *ns )
 {
     if( ns->syncmode & CYG_SYNCMODE_SOCK_NETSTACK )
     {
-        nstab_lock[ns-&nstab[0]].lock();
+        nstab_lock[ns-&cyg_nstab[0]].lock();
     }
 }
 
 static void cyg_ns_unlock( cyg_nstab_entry *ns )
 {
     if( ns->syncmode & CYG_SYNCMODE_SOCK_NETSTACK )
     {
-        nstab_lock[ns-&nstab[0]].unlock();
+        nstab_lock[ns-&cyg_nstab[0]].unlock();
     }
 }
 
 static void cyg_sock_lock( cyg_file *fp )
 {
     cyg_nstab_entry *ns = (cyg_nstab_entry *)fp->f_mte;
 
     if( fp->f_syncmode & CYG_SYNCMODE_SOCK_NETSTACK )
-        nstab_lock[ns-&nstab[0]].lock();
+        nstab_lock[ns-&cyg_nstab[0]].lock();
 
     cyg_file_lock( fp, fp->f_syncmode>>CYG_SYNCMODE_SOCK_SHIFT);
 }
 
 static void cyg_sock_unlock( cyg_file *fp )
 {
     cyg_nstab_entry *ns = (cyg_nstab_entry *)fp->f_mte;
 
     if( fp->f_syncmode & CYG_SYNCMODE_SOCK_NETSTACK )
-        nstab_lock[ns-&nstab[0]].unlock();
+        nstab_lock[ns-&cyg_nstab[0]].unlock();
 
     cyg_file_unlock( fp, fp->f_syncmode>>CYG_SYNCMODE_SOCK_SHIFT);
 }
 
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]