diff -rbupN ecos-fisfs-util/packages/fs/fisfs/current/cdl/fisfs.cdl ecos-fisfs-complete/packages/fs/fisfs/current/cdl/fisfs.cdl
--- ecos-fisfs-util/packages/fs/fisfs/current/cdl/fisfs.cdl	2007-01-03 16:39:01.000000000 +0100
+++ ecos-fisfs-complete/packages/fs/fisfs/current/cdl/fisfs.cdl	2007-01-02 15:56:51.000000000 +0100
@@ -63,6 +63,17 @@ cdl_package CYGPKG_FS_FIS {
        default_value 1
     }
 
+    cdl_option CYGFUN_FS_FIS_FILESYSTEM {
+       display "Build FIS filesystem support"
+       requires        CYGPKG_IO_FILEIO
+       implements      CYGINT_IO_FILEIO_FS
+       compile         -library=libextras.a fisfs.c
+       default_value 1
+       description "An eCos filesystem which allows reading the
+       contents of the Redboot FIS."
+
+    }
+
     cdl_option CYGFUN_FS_FIS_UPDATE {
        requires        CYGPKG_CRC
        display "Build FIS update support"
diff -rbupN ecos-fisfs-util/packages/fs/fisfs/current/src/fisfs.c ecos-fisfs-complete/packages/fs/fisfs/current/src/fisfs.c
--- ecos-fisfs-util/packages/fs/fisfs/current/src/fisfs.c	1970-01-01 01:00:00.000000000 +0100
+++ ecos-fisfs-complete/packages/fs/fisfs/current/src/fisfs.c	2007-01-03 10:35:35.000000000 +0100
@@ -0,0 +1,769 @@
+//==========================================================================
+//
+//      fisfs.c
+//
+//      FIS file system
+//
+//==========================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later version.
+//
+// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+// at http://sources.redhat.com/ecos/ecos-license/
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):           nickg, alexander.neundorf@jenoptik.com
+// Date:                2007-01-02
+// Purpose:             FIS file system
+// Description:         This is a read-only filesystem providing access to the
+//                      the Redboot Flash Image System for eCos applications. It attempts to
+//                      provide full POSIX-compatible filesystem behaviour for accessing
+//                      the images in read-only mode.
+//
+//####DESCRIPTIONEND####
+//
+
+#include <pkgconf/system.h>
+#include <pkgconf/hal.h>
+#include <pkgconf/kernel.h>
+#include <pkgconf/fs_fis.h>
+#include <pkgconf/io_fileio.h>
+
+#include <cyg/kernel/ktypes.h>         // base kernel types
+#include <cyg/kernel/kapi.h>
+#include <cyg/infra/cyg_trac.h>        // tracing macros
+#include <cyg/infra/cyg_ass.h>         // assertion macros
+#include <cyg/hal/hal_if.h>
+#include <cyg/infra/diag.h>
+#include <cyg/fileio/fileio.h>
+#include <cyg/io/flash.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <dirent.h>
+#include <unistd.h>
+#include <stdarg.h>
+#include <string.h>
+
+
+#define FIS_MAX_OPEN_FILES (16)
+/* If a file is opened, an entry of this array is used to
+ hold the information about the file, thus marking it as opened. */
+struct fis_table_entry fis_open_files[FIS_MAX_OPEN_FILES];
+int fis_is_mounted=0;
+
+/* both coming from fisupdate.c */
+extern int fis_max_entries;
+extern int fis_init(void);
+extern int fis_find_entry(const char* name, struct fis_table_entry* entry);
+
+//enable debug from CYG_TRACE
+#ifdef CYGDBG_FS_FIS_DEBUG_OUTPUT
+#define DEBUG_FIS 1
+#else
+#define DEBUG_FIS 0
+#endif
+
+//Return 1 if any files are opened right now, otherwise 0
+int fis_any_files_open(void)
+{
+   int i=0;
+   if (!fis_is_mounted)
+   {
+      return 0;
+   }
+
+   for (i=0; i<FIS_MAX_OPEN_FILES; i++)
+   {
+      if (fis_open_files[i].name[0]!='\0')
+      {
+         return 1;
+      }
+   }
+   return 0;
+}
+
+// Filesystem operations
+static int fisfs_mount    ( cyg_fstab_entry *fste, cyg_mtab_entry *mte );
+static int fisfs_umount   ( cyg_mtab_entry *mte );
+static int fisfs_open     ( cyg_mtab_entry *mte, cyg_dir dir, const char *name,
+                             int mode,  cyg_file *fte );
+static int fisfs_opendir  ( cyg_mtab_entry *mte, cyg_dir dir, const char *name,
+                             cyg_file *fte );
+static int fisfs_chdir    ( cyg_mtab_entry *mte, cyg_dir dir, const char *name,
+                             cyg_dir *dir_out );
+static int fisfs_stat     ( cyg_mtab_entry *mte, cyg_dir dir, const char *name,
+                             struct stat *buf);
+static int fisfs_getinfo  ( cyg_mtab_entry *mte, cyg_dir dir, const char *name,
+                             int key, void *buf, int len );
+static int fisfs_setinfo  ( cyg_mtab_entry *mte, cyg_dir dir, const char *name,
+                             int key, void *buf, int len );
+
+// File operations
+static int fisfs_fo_read      (struct CYG_FILE_TAG *fp, struct CYG_UIO_TAG *uio);
+static int fisfs_fo_lseek     (struct CYG_FILE_TAG *fp, off_t *pos, int whence );
+static int fisfs_fo_ioctl     (struct CYG_FILE_TAG *fp, CYG_ADDRWORD com,
+                                CYG_ADDRWORD data);
+static int fisfs_fo_fsync     (struct CYG_FILE_TAG *fp, int mode );
+static int fisfs_fo_close     (struct CYG_FILE_TAG *fp);
+static int fisfs_fo_fstat     (struct CYG_FILE_TAG *fp, struct stat *buf );
+static int fisfs_fo_getinfo   (struct CYG_FILE_TAG *fp, int key, void *buf, int len );
+static int fisfs_fo_setinfo   (struct CYG_FILE_TAG *fp, int key, void *buf, int len );
+
+// Directory operations
+static int fisfs_fo_dirread      (struct CYG_FILE_TAG *fp, struct CYG_UIO_TAG *uio);
+static int fisfs_fo_dirlseek     (struct CYG_FILE_TAG *fp, off_t *pos, int whence );
+
+
+//==========================================================================
+// Filesystem table entries
+
+// -------------------------------------------------------------------------
+// Fstab entry.
+// This defines the entry in the filesystem table.
+// For simplicity we use _FILESYSTEM synchronization for all accesses since
+// we should never block in any filesystem operations.
+
+FSTAB_ENTRY( fisfs_fste, "fisfs", 0,
+             CYG_SYNCMODE_FILE_FILESYSTEM|CYG_SYNCMODE_IO_FILESYSTEM,
+             fisfs_mount,
+             fisfs_umount,
+             fisfs_open,
+             (cyg_fsop_unlink *)cyg_fileio_erofs,
+             (cyg_fsop_mkdir *)cyg_fileio_erofs,
+             (cyg_fsop_rmdir *)cyg_fileio_erofs,
+             (cyg_fsop_rename *)cyg_fileio_erofs,
+             (cyg_fsop_link *)cyg_fileio_erofs,
+             fisfs_opendir,
+             fisfs_chdir,
+             fisfs_stat,
+             fisfs_getinfo,
+             fisfs_setinfo);
+
+// -------------------------------------------------------------------------
+// mtab entry.
+// This defines a single FISFS loaded into FIS at the configured address
+//
+// MTAB_ENTRY(	fis_mte,	// structure name
+// 		"/fis",		// mount point
+// 		"fisfs",	// FIlesystem type
+// 		"",		// hardware device
+//  (CYG_ADDRWORD) CYGNUM_FS_ROM_BASE_ADDRESS	// Address in ROM
+//           );
+
+
+// -------------------------------------------------------------------------
+// File operations.
+// This set of file operations are used for normal open files.
+
+static cyg_fileops fisfs_fileops =
+{
+    fisfs_fo_read,
+    (cyg_fileop_write *)cyg_fileio_erofs,
+    fisfs_fo_lseek,
+    fisfs_fo_ioctl,
+    cyg_fileio_seltrue,
+    fisfs_fo_fsync,
+    fisfs_fo_close,
+    fisfs_fo_fstat,
+    fisfs_fo_getinfo,
+    fisfs_fo_setinfo
+};
+
+// -------------------------------------------------------------------------
+// Directory file operations.
+// This set of operations are used for open directories. Most entries
+// point to error-returning stub functions. Only the read, lseek and
+// close entries are functional.
+
+static cyg_fileops fisfs_dirops =
+{
+    fisfs_fo_dirread,
+    (cyg_fileop_write *)cyg_fileio_enosys,
+    fisfs_fo_dirlseek,
+    (cyg_fileop_ioctl *)cyg_fileio_enosys,
+    cyg_fileio_seltrue,
+    (cyg_fileop_fsync *)cyg_fileio_enosys,
+    fisfs_fo_close,
+    (cyg_fileop_fstat *)cyg_fileio_enosys,
+    (cyg_fileop_getinfo *)cyg_fileio_enosys,
+    (cyg_fileop_setinfo *)cyg_fileio_enosys
+};
+
+//==========================================================================
+// Pathconf support
+// This function provides support for pathconf() and fpathconf().
+// Directly taken from romfs
+static int fisfs_pathconf(struct cyg_pathconf_info *info )
+{
+    int err = ENOERR;
+   CYG_TRACE0(DEBUG_FIS,"pathconf");
+
+    switch( info->name )
+    {
+    case _PC_LINK_MAX:
+        info->value = LINK_MAX;
+        break;
+
+    case _PC_MAX_CANON:
+        info->value = -1;       // not supported
+        err = EINVAL;
+        break;
+
+    case _PC_MAX_INPUT:
+        info->value = -1;       // not supported
+        err = EINVAL;
+        break;
+
+    case _PC_NAME_MAX:
+        info->value = NAME_MAX;
+        break;
+
+    case _PC_PATH_MAX:
+        info->value = PATH_MAX;
+        break;
+
+    case _PC_PIPE_BUF:
+        info->value = -1;       // not supported
+        err = EINVAL;
+        break;
+
+    case _PC_ASYNC_IO:
+        info->value = -1;       // not supported
+        err = EINVAL;
+        break;
+
+    case _PC_CHOWN_RESTRICTED:
+        info->value = -1;       // not supported
+        err = EINVAL;
+        break;
+
+    case _PC_NO_TRUNC:
+        info->value = 0;
+        break;
+
+    case _PC_PRIO_IO:
+        info->value = 0;
+        break;
+
+    case _PC_SYNC_IO:
+        info->value = 0;
+        break;
+
+    case _PC_VDISABLE:
+        info->value = -1;       // not supported
+        err = EINVAL;
+        break;
+
+    default:
+        err = EINVAL;
+        break;
+    }
+
+    return err;
+}
+
+//==========================================================================
+// Filesystem operations
+
+// -------------------------------------------------------------------------
+// fisfs_mount()
+// Process a mount request. This mainly finds root for the
+// filesystem.
+
+static int fisfs_mount    ( cyg_fstab_entry *fste, cyg_mtab_entry *mte )
+{
+   int res=ENOERR;
+
+   if (fis_is_mounted)
+      return ENOERR;
+
+   res=fis_init();
+   memset(fis_open_files, 0, sizeof(fis_open_files));
+
+   if ((res==ENOERR) || (res==EXDEV))
+      fis_is_mounted=1;
+
+   return res;
+}
+
+// -------------------------------------------------------------------------
+// fisfs_umount()
+// Unmount the filesystem. This will currently always succeed.
+static int fisfs_umount   ( cyg_mtab_entry *mte )
+{
+   CYG_TRACE0(DEBUG_FIS,"umount");
+   fis_is_mounted=0;
+   return ENOERR;
+}
+
+// -------------------------------------------------------------------------
+// fisfs_open()
+// Open a file for reading
+static int fisfs_open     ( cyg_mtab_entry *mte, cyg_dir dir, const char *name,
+                             int mode,  cyg_file *file )
+{
+   int fd=-1;
+   int i=0;
+   struct fis_table_entry entry;
+
+   CYG_TRACE1(DEBUG_FIS, "open name: -%s-", name);
+
+   // Find an empty entry for this file
+   for (i=0; i<FIS_MAX_OPEN_FILES; i++)
+   {
+      if (fis_open_files[i].name[0]=='\0')
+      {
+         fd=i;
+         break;
+      }
+   }
+
+   if (fd==-1)  //no empty descriptor
+      return EMFILE;
+
+   if (fis_find_entry(name, &entry)<0) //file does not exist
+      return ENOENT;
+
+   // The node exists. If the O_CREAT and O_EXCL bits are set, we
+   // must fail the open.
+   if( (mode & (O_CREAT|O_EXCL)) == (O_CREAT|O_EXCL) )
+      return EEXIST;
+
+   // If the O_TRUNC bit is set we must fail the open
+   if (mode & O_TRUNC )
+      return EPERM;
+
+   memcpy(&fis_open_files[fd], &entry, sizeof(struct fis_table_entry));
+
+   // Initialize the file object
+   file->f_flag        |= mode & CYG_FILE_MODE_MASK;
+   file->f_type        = CYG_FILE_TYPE_FILE;
+   file->f_ops         = &fisfs_fileops;
+   file->f_offset      = 0;
+   file->f_data        = fd;
+   file->f_xops        = 0;
+
+   return ENOERR;
+}
+
+// -------------------------------------------------------------------------
+// fisfs_opendir()
+// Open a directory for reading.
+static int fisfs_opendir  ( cyg_mtab_entry *mte, cyg_dir dir, const char *name,
+                             cyg_file *file )
+{
+   CYG_TRACE1(DEBUG_FIS, "name: -%s-", name);
+
+   //the current directory, there is no other directory in FIS
+   if ((name==NULL) || (name[0]=='\0') || (strcmp(name, ".")==0))
+   {
+      file->f_type        = CYG_FILE_TYPE_FILE;
+      file->f_ops         = &fisfs_dirops;
+      file->f_offset      = 0;
+      file->f_data        = 0;
+      file->f_xops        = 0;
+      return ENOERR;
+   }
+
+   if (fis_find_entry(name, NULL)>=0) //file exists, so it's a file and no directory
+      return ENOTDIR;
+   return ENOENT;
+}
+
+// -------------------------------------------------------------------------
+// fisfs_chdir()
+// Change directory support.
+
+static int fisfs_chdir    ( cyg_mtab_entry *mte, cyg_dir dir, const char *name,
+                             cyg_dir *dir_out )
+{
+   CYG_TRACE1(DEBUG_FIS,"chdir: -%s-", name);
+    if( dir_out != NULL )
+    {
+       if ((name==NULL) || (name[0]=='\0') || (strcmp(name, ".")==0))
+          *dir_out = mte->root;
+       else
+          return ENOENT;
+        // Pass it out
+    }
+    // If no output dir is required, this means that the mte and
+    // dir arguments are the current cdir setting and we should
+    // forget this fact. Do nothing in ROMFS.
+
+    return ENOERR;
+}
+
+// -------------------------------------------------------------------------
+// fisfs_stat()
+// Get struct stat info for named object.
+
+static int fisfs_stat     ( cyg_mtab_entry *mte, cyg_dir dir, const char *name,
+                             struct stat *buf)
+{
+   //the current directory ?
+   if ((name==NULL) || (name[0]=='\0') || (strcmp(name, ".")==0) || (strcmp(name, "..")==0))
+   {
+      buf->st_size        = 512;
+      buf->st_ino         = 0;
+   }
+   else
+   {
+      struct fis_table_entry entry;
+      if (fis_find_entry(name, &entry)>=0)
+      {
+         buf->st_size        = entry.data_length;
+         buf->st_ino         = (ino_t)(entry.flash_base);
+      }
+      else
+         return ENOENT;  //file doesn't exist
+   }
+
+   // Fill in the status
+   buf->st_mode        = O_RDONLY;
+   buf->st_dev         = (dev_t)1;
+   buf->st_nlink       = 1;
+   buf->st_uid         = 0;
+   buf->st_gid         = 0;
+   buf->st_atime       = 0;
+   buf->st_mtime       = 0;
+   buf->st_ctime       = 0;
+
+   return ENOERR;
+}
+
+// -------------------------------------------------------------------------
+// fisfs_getinfo()
+// Getinfo. Currently only support pathconf().
+// Taken directly from romfs
+static int fisfs_getinfo  ( cyg_mtab_entry *mte, cyg_dir dir, const char *name,
+                             int key, void *buf, int len )
+{
+    int err;
+    switch( key )
+    {
+    case FS_INFO_CONF:
+        err = fisfs_pathconf( (struct cyg_pathconf_info *)buf );
+        break;
+
+    default:
+        err = EINVAL;
+    }
+    return err;
+}
+
+// -------------------------------------------------------------------------
+// fisfs_setinfo()
+// Setinfo. Nothing to support here at present.
+// Taken directly from romfs
+static int fisfs_setinfo  ( cyg_mtab_entry *mte, cyg_dir dir, const char *name,
+                             int key, void *buf, int len )
+{
+   CYG_TRACE0(DEBUG_FIS, "setinfo");
+    // No setinfo keys supported at present
+
+    return EINVAL;
+}
+
+
+//==========================================================================
+// File operations
+
+// -------------------------------------------------------------------------
+// fisfs_fo_read()
+// Read data from the file.
+
+static int fisfs_fo_read      (struct CYG_FILE_TAG *fp, struct CYG_UIO_TAG *uio)
+{
+    struct fis_table_entry* entry = &fis_open_files[fp->f_data];
+    int i;
+    off_t pos = fp->f_offset;
+    ssize_t resid = uio->uio_resid;
+
+    CYG_TRACE0(DEBUG_FIS,"read");
+
+   // Loop over the io vectors until there are none left
+    for( i = 0; i < uio->uio_iovcnt; i++ )
+    {
+        cyg_iovec *iov = &uio->uio_iov[i];
+        char *buf = (char *)iov->iov_base;
+        off_t len = iov->iov_len;
+
+        // Loop over each vector filling it with data from the file.
+        while( len > 0 && pos < entry->data_length )
+        {
+           void* err_addr=NULL;
+            off_t l = len;
+
+            // adjust size to end of file if necessary
+            if( l > entry->data_length - pos )
+                l = entry->data_length - pos;
+
+            // copy data out
+            flash_read((void *)(entry->flash_base+pos), buf, l, (void **)&err_addr);
+
+            // Update working vars
+            len -= l;
+            buf += l;
+            pos += l;
+            resid -= l;
+        }
+    }
+
+    // We successfully read some data
+    // Update the file offset and transfer residue.
+
+    uio->uio_resid = resid;
+    fp->f_offset = pos;
+
+    return ENOERR;
+}
+
+// -------------------------------------------------------------------------
+// fisfs_fo_lseek()
+// Seek to a new file position.
+
+static int fisfs_fo_lseek     (struct CYG_FILE_TAG *fp, off_t *apos, int whence )
+{
+   struct fis_table_entry* entry = &fis_open_files[fp->f_data];
+   off_t pos = *apos;
+   CYG_TRACE0(DEBUG_FIS,"lseek");
+
+    switch( whence )
+    {
+    case SEEK_SET:
+        // Pos is already where we want to be.
+        break;
+
+    case SEEK_CUR:
+        // Add pos to current offset.
+        pos += fp->f_offset;
+        break;
+
+    case SEEK_END:
+        // Add pos to file size.
+        pos += entry->data_length;
+        break;
+
+    default:
+        return EINVAL;
+    }
+
+    // Check that pos is still within current file size, or at the
+    // very end.
+    if( pos < 0 || pos > entry->data_length)
+        return EINVAL;
+
+    // All OK, set fp offset and return new position.
+    *apos = fp->f_offset = pos;
+
+    return ENOERR;
+}
+
+// -------------------------------------------------------------------------
+// fisfs_fo_ioctl()
+// Handle ioctls. Currently none are defined.
+
+static int fisfs_fo_ioctl     (struct CYG_FILE_TAG *fp, CYG_ADDRWORD com,
+                                CYG_ADDRWORD data)
+{
+   CYG_TRACE0(DEBUG_FIS,"ioctl");
+    // No Ioctls currenly defined.
+
+    return EINVAL;
+}
+
+// -------------------------------------------------------------------------
+// fisfs_fo_fsync().
+// Force the file out to data storage.
+
+static int fisfs_fo_fsync     (struct CYG_FILE_TAG *fp, int mode )
+{
+   CYG_TRACE0(DEBUG_FIS,"fsync");
+   // Data is always permanently where it belongs, nothing to do here.
+   return ENOERR;
+}
+
+// -------------------------------------------------------------------------
+// fisfs_fo_close()
+// Close a file. Clear the data pointer and mark the entry again as empty.
+static int fisfs_fo_close     (struct CYG_FILE_TAG *fp)
+{
+   CYG_TRACE0(DEBUG_FIS,"close");
+   memset(&fis_open_files[fp->f_data], 0, sizeof(struct fis_table_entry));
+   fp->f_data = 0;     // zero data pointer
+   return ENOERR;
+}
+
+// -------------------------------------------------------------------------
+//fisfs_fo_fstat()
+// Get file status.
+static int fisfs_fo_fstat     (struct CYG_FILE_TAG *fp, struct stat *buf )
+{
+   struct fis_table_entry* entry = &fis_open_files[fp->f_data];
+   CYG_TRACE0(DEBUG_FIS,"stat");
+
+   // Fill in the status
+   buf->st_mode        = O_RDONLY;
+   buf->st_ino         = (ino_t)(entry->flash_base);
+   buf->st_dev         = 1;
+   buf->st_nlink       = 1;
+   buf->st_uid         = 0;
+   buf->st_gid         = 0;
+   buf->st_size        = entry->data_length;
+   buf->st_atime       = 0;
+   buf->st_mtime       = 0;
+   buf->st_ctime       = 0;
+
+   return ENOERR;
+}
+
+// -------------------------------------------------------------------------
+// fisfs_fo_getinfo()
+// Get info. Currently only supports fpathconf().
+// Taken directly from romfs.
+static int fisfs_fo_getinfo   (struct CYG_FILE_TAG *fp, int key, void *buf, int len )
+{
+    int err;
+   CYG_TRACE0(DEBUG_FIS,"getInfo");
+
+    switch( key )
+    {
+    case FS_INFO_CONF:
+        err = fisfs_pathconf((struct cyg_pathconf_info *)buf );
+        break;
+
+    default:
+        err = EINVAL;
+    }
+    return err;
+}
+
+// -------------------------------------------------------------------------
+// fisfs_fo_setinfo()
+// Set info. Nothing supported here.
+// Taken directly from romfs.
+static int fisfs_fo_setinfo   (struct CYG_FILE_TAG *fp, int key, void *buf, int len )
+{
+   CYG_TRACE0(DEBUG_FIS,"setinfo");
+    // No setinfo key supported at present
+
+    return ENOERR;
+}
+
+
+//==========================================================================
+// Directory operations
+
+// -------------------------------------------------------------------------
+// fisfs_fo_dirread()
+// Read a single directory entry from a file.
+static int fisfs_fo_dirread      (struct CYG_FILE_TAG *fp, struct CYG_UIO_TAG *uio)
+{
+   CYG_TRACE1(DEBUG_FIS,"dirread, offset: %d", fp->f_offset);
+
+   off_t pos = fp->f_offset;
+
+   struct dirent *ent = (struct dirent *)uio->uio_iov[0].iov_base;
+   char *nbuf = ent->d_name;
+   char *name=NULL;
+   int nlen = sizeof(ent->d_name)-1;
+   off_t len = uio->uio_iov[0].iov_len;
+   int i=0;
+
+   if ( len < sizeof(struct dirent) )
+      return EINVAL;
+
+   if (pos==0) // the first entry "."
+   {
+      name=".";
+      pos++;
+   }
+   else if (pos==1) // the second entry ".."
+   {
+      name="..";
+      pos++;
+   }
+   else
+   {
+      struct fis_table_entry entry;
+      for (i=pos-2; i<fis_max_entries; i++)
+      {
+         pos++;
+         CYGACC_CALL_IF_FLASH_FIS_OP2(CYGNUM_CALL_IF_FLASH_FIS_GET_ENTRY, i, &entry);
+
+         if (entry.name[0]!=0xff)
+         {
+            name=entry.name;
+            break;
+         }
+      }
+   }
+
+   if (name==NULL)
+      return ENOERR;
+
+   for ( i = 0 ; i < nlen && name[i] ; i++)
+      nbuf[i] = name[i];
+
+    nbuf[i] = '\0';
+
+    CYG_TRACE2(DEBUG_FIS, "name: -%s- ent: -%s-", name, ent->d_name);
+    // A successful read. Terminate the entry name with a NUL, set the
+    // residue and set the file offset to restart at the next
+    // directory entry.
+
+   uio->uio_resid -= sizeof(struct dirent);
+   fp->f_offset=pos;
+
+    return ENOERR;
+}
+
+// -------------------------------------------------------------------------
+// fisfs_fo_dirlseek()
+// Seek directory to start.
+
+static int fisfs_fo_dirlseek     (struct CYG_FILE_TAG *fp, off_t *pos, int whence )
+{
+    // Only allow SEEK_SET to zero
+
+    if( whence != SEEK_SET || *pos != 0)
+        return EINVAL;
+
+    *pos = fp->f_offset = 0;
+
+    return ENOERR;
+}
+
+// -------------------------------------------------------------------------
+// EOF fisfs.c
diff -rbupN ecos-fisfs-util/packages/fs/fisfs/current/src/fisupdate.c ecos-fisfs-complete/packages/fs/fisfs/current/src/fisupdate.c
--- ecos-fisfs-util/packages/fs/fisfs/current/src/fisupdate.c	2007-01-03 16:40:04.000000000 +0100
+++ ecos-fisfs-complete/packages/fs/fisfs/current/src/fisupdate.c	2007-01-03 14:35:23.000000000 +0100
@@ -234,6 +234,10 @@ static int fis_program_data(const void* 
    return 0;
 }
 
+#ifdef  CYGFUN_FS_FIS_FILESYSTEM
+extern int fis_any_files_open(void);
+#endif
+
 #ifdef CYGPKG_CRC
 #include <cyg/crc/crc.h>
 #endif
@@ -256,6 +260,14 @@ int fis_remove_image(const char* name)
       }
    }
 
+#ifdef  CYGFUN_FS_FIS_FILESYSTEM
+   // this function should only succeed when no files are open
+   if (fis_any_files_open())
+   {
+      return EBUSY;
+   }
+#endif
+
    index=fis_find_entry(name, &oldEntry);
    if (index<0)
    {
@@ -343,6 +355,14 @@ int fis_create_image(const char* name, c
       }
    }
 
+#ifdef  CYGFUN_FS_FIS_FILESYSTEM
+   // this function should only work when no files are open
+   if (fis_any_files_open())
+   {
+      return EBUSY;
+   }
+#endif
+
    // check parameters
    if (size==0)
    {
