change log for rtems (2011-03-15)

rtems-vc at rtems.org rtems-vc at rtems.org
Tue Mar 15 05:10:26 UTC 2011


 *ccj*:
2011-03-15      Chris Johns <chrisj at rtems.org>

        PR 1763/shell
        * libmisc/shell/hexdump-conv.c: Remove debug hacks.

        PR 1757/filesystem
        * libfs/src/rfs/rtems-rfs-block-pos.h,
        libfs/src/rfs/rtems-rfs-block.h, libfs/src/rfs/rtems-rfs-file.c,
        libfs/src/rfs/rtems-rfs-rtems-file.c: Set the file size in
        iop-size when a file is open. Fix lseek to end of file then write
        for sizes less than half the file system block size.
        * libfs/src/rfs/rtems-rfs-rtems-dev.c,
        libfs/src/rfs/rtems-rfs-rtems-dir.c,
        libfs/src/rfs/rtems-rfs-rtems.c, libfs/src/rfs/rtems-rfs-rtems.h:
        Fix the fstat and fchmod calls due to the change in the iop struct
        where pathinfo went away. The node_access field in pathinfo was
        overloaded.

M 1.2774  cpukit/ChangeLog
M    1.5  cpukit/libfs/src/rfs/rtems-rfs-block-pos.h
M    1.4  cpukit/libfs/src/rfs/rtems-rfs-block.h
M    1.7  cpukit/libfs/src/rfs/rtems-rfs-file.c
M    1.5  cpukit/libfs/src/rfs/rtems-rfs-rtems-dev.c
M    1.8  cpukit/libfs/src/rfs/rtems-rfs-rtems-dir.c
M   1.10  cpukit/libfs/src/rfs/rtems-rfs-rtems-file.c
M    1.5  cpukit/libfs/src/rfs/rtems-rfs-rtems.h
M   1.16  cpukit/libfs/src/rfs/rtems-rfs-rtems.c
M    1.5  cpukit/libmisc/shell/hexdump-conv.c

diff -u rtems/cpukit/ChangeLog:1.2773 rtems/cpukit/ChangeLog:1.2774
--- rtems/cpukit/ChangeLog:1.2773	Mon Mar 14 13:17:27 2011
+++ rtems/cpukit/ChangeLog	Tue Mar 15 00:02:34 2011
@@ -1,3 +1,21 @@
+2011-03-15	Chris Johns <chrisj at rtems.org>
+
+	PR 1763/shell
+	* libmisc/shell/hexdump-conv.c: Remove debug hacks.
+
+	PR 1757/filesystem
+	* libfs/src/rfs/rtems-rfs-block-pos.h,
+	libfs/src/rfs/rtems-rfs-block.h, libfs/src/rfs/rtems-rfs-file.c,
+	libfs/src/rfs/rtems-rfs-rtems-file.c: Set the file size in
+	iop-size when a file is open. Fix lseek to end of file then write
+	for sizes less than half the file system block size.
+	* libfs/src/rfs/rtems-rfs-rtems-dev.c,
+	libfs/src/rfs/rtems-rfs-rtems-dir.c,
+	libfs/src/rfs/rtems-rfs-rtems.c, libfs/src/rfs/rtems-rfs-rtems.h:
+	Fix the fstat and fchmod calls due to the change in the iop struct
+	where pathinfo went away. The node_access field in pathinfo was
+	overloaded.
+
 2011-03-14	Joel Sherrill <joel.sherrill at oarcorp.com>
 
 	* libmisc/mouse/mouse_parser.c, libmisc/mouse/serial_mouse.c: Remove

diff -u rtems/cpukit/libfs/src/rfs/rtems-rfs-block-pos.h:1.4 rtems/cpukit/libfs/src/rfs/rtems-rfs-block-pos.h:1.5
--- rtems/cpukit/libfs/src/rfs/rtems-rfs-block-pos.h:1.4	Wed Jun 16 22:09:00 2010
+++ rtems/cpukit/libfs/src/rfs/rtems-rfs-block-pos.h	Tue Mar 15 00:02:34 2011
@@ -193,6 +193,12 @@
        if ((_b)->boff) --(_b)->bno; } while (0)
 
 /**
+ * Do the sizes match ?
+ */
+#define rtems_rfs_block_size_equal(_lhs, _rhs) \
+  (((_lhs)->count == (_rhs)->count) && ((_lhs)->offset == (_rhs)->count))
+
+/**
  * Zero a block size.
  *
  * @param size A pointer to the block size.

diff -u rtems/cpukit/libfs/src/rfs/rtems-rfs-block.h:1.3 rtems/cpukit/libfs/src/rfs/rtems-rfs-block.h:1.4
--- rtems/cpukit/libfs/src/rfs/rtems-rfs-block.h:1.3	Wed Jun 16 22:09:00 2010
+++ rtems/cpukit/libfs/src/rfs/rtems-rfs-block.h	Tue Mar 15 00:02:34 2011
@@ -163,11 +163,6 @@
 #define rtems_rfs_block_map_size_offset(_m) ((_m)->size.offset)
 
 /**
- * Set the size offset for the map.
- */
-#define rtems_rfs_block_map_set_size_offset(_m, _o) ((_m)->size.offset = (_o))
-
-/**
  * Are we at the last block in the map ?
  */
 #define rtems_rfs_block_map_last(_m) \
@@ -196,6 +191,33 @@
 #define rtems_rfs_block_map_block_offset(_m) ((_m)->bpos.boff)
 
 /**
+ * Set the size offset for the map. The map is tagged as dirty.
+ *
+ * @param map Pointer to the open map to set the offset in.
+ * @param offset The offset to set in the map's size.
+ */
+static inline void 
+rtems_rfs_block_map_set_size_offset (rtems_rfs_block_map* map,
+                                     rtems_rfs_block_off  offset)
+{
+  map->size.offset = offset;
+  map->dirty = true;
+}
+
+/**
+ * Set the map's size. The map is tagged as dirty.
+ *
+ * @param map Pointer to the open map to set the offset in.
+ * @param size The size to set in the map's size.
+ */
+static inline void 
+rtems_rfs_block_map_set_size (rtems_rfs_block_map*  map,
+                              rtems_rfs_block_size* size)
+{
+  rtems_rfs_block_copy_size (&map->size, size);
+  map->dirty = true;
+}
+/**
  * Open a block map. The block map data in the inode is copied into the
  * map. The buffer handles are opened. The block position is set to the start
  * so a seek of offset 0 will return the first block.

diff -u rtems/cpukit/libfs/src/rfs/rtems-rfs-file.c:1.6 rtems/cpukit/libfs/src/rfs/rtems-rfs-file.c:1.7
--- rtems/cpukit/libfs/src/rfs/rtems-rfs-file.c:1.6	Thu Aug 26 01:31:15 2010
+++ rtems/cpukit/libfs/src/rfs/rtems-rfs-file.c	Tue Mar 15 00:02:34 2011
@@ -172,8 +172,10 @@
                                  handle->shared->mtime);
       rtems_rfs_inode_set_ctime (&handle->shared->inode,
                                  handle->shared->ctime);
-      handle->shared->map.size.count = handle->shared->size.count;
-      handle->shared->map.size.offset = handle->shared->size.offset;
+      if (!rtems_rfs_block_size_equal (&handle->shared->size,
+                                       &handle->shared->map.size))
+        rtems_rfs_block_map_set_size (&handle->shared->map,
+                                      &handle->shared->size);
     }
     
     rc = rtems_rfs_block_map_close (fs, &handle->shared->map);
@@ -420,8 +422,8 @@
    * This means the file needs to set the file size to the pos only when a
    * write occurs.
    */
-  if (pos <= rtems_rfs_file_shared_get_size (rtems_rfs_file_fs (handle),
-                                             handle->shared))
+  if (pos < rtems_rfs_file_shared_get_size (rtems_rfs_file_fs (handle),
+                                            handle->shared))
     rtems_rfs_file_set_bpos (handle, pos);
   
   *new_pos = pos;

diff -u rtems/cpukit/libfs/src/rfs/rtems-rfs-rtems-dev.c:1.4 rtems/cpukit/libfs/src/rfs/rtems-rfs-rtems-dev.c:1.5
--- rtems/cpukit/libfs/src/rfs/rtems-rfs-rtems-dev.c:1.4	Thu Jul  1 15:18:41 2010
+++ rtems/cpukit/libfs/src/rfs/rtems-rfs-rtems-dev.c	Tue Mar 15 00:02:34 2011
@@ -260,7 +260,7 @@
   .write_h     = rtems_rfs_rtems_device_write,
   .ioctl_h     = rtems_rfs_rtems_device_ioctl,
   .lseek_h     = rtems_rfs_rtems_device_lseek,
-  .fstat_h     = rtems_rfs_rtems_stat,
+  .fstat_h     = rtems_rfs_rtems_fstat,
   .fchmod_h    = rtems_rfs_rtems_fchmod,
   .ftruncate_h = rtems_rfs_rtems_device_ftruncate,
   .fpathconf_h = rtems_filesystem_default_fpathconf,

diff -u rtems/cpukit/libfs/src/rfs/rtems-rfs-rtems-dir.c:1.7 rtems/cpukit/libfs/src/rfs/rtems-rfs-rtems-dir.c:1.8
--- rtems/cpukit/libfs/src/rfs/rtems-rfs-rtems-dir.c:1.7	Sun Oct 10 23:34:48 2010
+++ rtems/cpukit/libfs/src/rfs/rtems-rfs-rtems-dir.c	Tue Mar 15 00:02:34 2011
@@ -234,7 +234,7 @@
   .write_h     = rtems_filesystem_default_write,
   .ioctl_h     = rtems_filesystem_default_ioctl,
   .lseek_h     = rtems_rfs_rtems_dir_lseek,
-  .fstat_h     = rtems_rfs_rtems_stat,
+  .fstat_h     = rtems_rfs_rtems_fstat,
   .fchmod_h    = rtems_rfs_rtems_fchmod,
   .ftruncate_h = rtems_filesystem_default_ftruncate,
   .fpathconf_h = rtems_filesystem_default_fpathconf,

diff -u rtems/cpukit/libfs/src/rfs/rtems-rfs-rtems-file.c:1.9 rtems/cpukit/libfs/src/rfs/rtems-rfs-rtems-file.c:1.10
--- rtems/cpukit/libfs/src/rfs/rtems-rfs-rtems-file.c:1.9	Mon Oct 18 17:39:35 2010
+++ rtems/cpukit/libfs/src/rfs/rtems-rfs-rtems-file.c	Tue Mar 15 00:02:34 2011
@@ -70,6 +70,7 @@
   if (rtems_rfs_rtems_trace (RTEMS_RFS_RTEMS_DEBUG_FILE_OPEN))
     printf("rtems-rfs: file-open: handle:%p\n", file);
   
+  iop->size = rtems_rfs_file_size (file);
   iop->pathinfo.node_access = file;
   
   rtems_rfs_rtems_unlock (fs);
@@ -111,7 +112,7 @@
  * @param count
  * @return int
  */
-ssize_t
+static ssize_t
 rtems_rfs_rtems_file_read (rtems_libio_t* iop,
                            void*          buffer,
                            size_t         count)
@@ -176,7 +177,7 @@
  * @param count
  * @return ssize_t
  */
-ssize_t
+static ssize_t
 rtems_rfs_rtems_file_write (rtems_libio_t* iop,
                             const void*    buffer,
                             size_t         count)
@@ -195,21 +196,25 @@
   pos = iop->offset;
   
   /*
-   * If the iop position is past the physical end of the file we need to set the
-   * file size to the new length before writing.
+   * If the iop position is past the physical end of the file we need to set
+   * the file size to the new length before writing. If the position equals the
+   * size of file we are still past the end of the file as positions number
+   * from 0. For a specific position we need a file that has a length of one
+   * more.
    */
   
-  if (pos > rtems_rfs_file_size (file))
+  if (pos >= rtems_rfs_file_size (file))
   {
-    rc = rtems_rfs_file_set_size (file, pos);
+    rc = rtems_rfs_file_set_size (file, pos + 1);
     if (rc)
     {
       rtems_rfs_rtems_unlock (rtems_rfs_file_fs (file));
       return rtems_rfs_rtems_error ("file-write: write extend", rc);
     }
-    rtems_rfs_file_set_bpos (file, pos);
   }
   
+  rtems_rfs_file_set_bpos (file, pos);
+  
   while (count)
   {
     size_t size = count;
@@ -255,7 +260,7 @@
  * @param buffer
  */
 
-int
+static int
 rtems_rfs_rtems_file_ioctl (rtems_libio_t* iop, uint32_t command, void* buffer)
 {
   return 0;
@@ -269,7 +274,7 @@
  * @param whence
  * @return rtems_off64_t
  */
-rtems_off64_t
+static rtems_off64_t
 rtems_rfs_rtems_file_lseek (rtems_libio_t* iop,
                             rtems_off64_t  offset,
                             int            whence)
@@ -298,13 +303,69 @@
 }
 
 /**
+ * Stat the file.
+ *
+ * @param iop
+ * @param buf
+ * @return int
+ */
+static int
+rtems_rfs_rtems_file_fstat (rtems_filesystem_location_info_t* pathloc,
+                            struct stat*                      buf)
+{
+  rtems_rfs_file_handle* file = pathloc->node_access;
+  int                    rc;
+
+  if (rtems_rfs_rtems_trace (RTEMS_RFS_RTEMS_DEBUG_STAT))
+    printf ("rtems-rfs: file-fstat: handle:%p\n", file);
+
+  rtems_rfs_rtems_lock (rtems_rfs_file_fs (file));
+
+  rc = rtems_rfs_rtems_stat_inode (rtems_rfs_file_fs (file),
+                                   rtems_rfs_file_inode (file),
+                                   buf);
+
+  rtems_rfs_rtems_unlock (rtems_rfs_file_fs (file));
+
+  return rc;
+}
+
+/**
+ * File change mode routine.
+ *
+ * @param iop
+ * @param mode
+ * @return int
+ */
+static int
+rtems_rfs_rtems_file_fchmod (rtems_filesystem_location_info_t* pathloc,
+                             mode_t                            mode)
+{
+  rtems_rfs_file_handle* file = pathloc->node_access;
+  int                    rc;
+
+  if (rtems_rfs_rtems_trace (RTEMS_RFS_RTEMS_DEBUG_FCHMOD))
+    printf ("rtems-rfs: file-fchmod: handle:%p\n", file);
+
+  rtems_rfs_rtems_lock (rtems_rfs_file_fs (file));
+
+  rc = rtems_rfs_rtems_fchmod_inode (rtems_rfs_file_fs (file),
+                                     rtems_rfs_file_inode (file),
+                                     mode);
+
+  rtems_rfs_rtems_unlock (rtems_rfs_file_fs (file));
+
+  return rc;
+}
+
+/**
  * This routine processes the ftruncate() system call.
  *
  * @param iop
  * @param length
  * @return int
  */
-int
+static int
 rtems_rfs_rtems_file_ftruncate (rtems_libio_t* iop,
                                 rtems_off64_t  length)
 {
@@ -338,8 +399,8 @@
   .write_h     = rtems_rfs_rtems_file_write,
   .ioctl_h     = rtems_rfs_rtems_file_ioctl,
   .lseek_h     = rtems_rfs_rtems_file_lseek,
-  .fstat_h     = rtems_rfs_rtems_stat,
-  .fchmod_h    = rtems_rfs_rtems_fchmod,
+  .fstat_h     = rtems_rfs_rtems_file_fstat,
+  .fchmod_h    = rtems_rfs_rtems_file_fchmod,
   .ftruncate_h = rtems_rfs_rtems_file_ftruncate,
   .fpathconf_h = rtems_filesystem_default_fpathconf,
   .fsync_h     = rtems_rfs_rtems_fdatasync,

diff -u rtems/cpukit/libfs/src/rfs/rtems-rfs-rtems.h:1.4 rtems/cpukit/libfs/src/rfs/rtems-rfs-rtems.h:1.5
--- rtems/cpukit/libfs/src/rfs/rtems-rfs-rtems.h:1.4	Wed Aug 25 04:37:49 2010
+++ rtems/cpukit/libfs/src/rfs/rtems-rfs-rtems.h	Tue Mar 15 00:02:34 2011
@@ -274,20 +274,46 @@
 /**
  * The following routine does a stat on a node.
  *
- * @param pathloc
+ * @param fs The file system data.
+ * @param inode The inode to stat held in memory.
+ * @param buf The stat buffer to fill.
+ * @return int The result code.
+ */
+int rtems_rfs_rtems_stat_inode (rtems_rfs_file_system*  fs,
+                                rtems_rfs_inode_handle* inode,
+                                struct stat*            buf);
+
+/**
+ * The following routine does a stat on a node.
+ *
+ * @param iop
  * @param buf
  * @return int
  */
-int rtems_rfs_rtems_stat (rtems_filesystem_location_info_t* loc, struct stat* buf);
+int rtems_rfs_rtems_fstat (rtems_filesystem_location_info_t* pathloc,
+                           struct stat*                      buf);
+
+/**
+ * File change mode routine changes an inode.
+ *
+ * @param fs The file system data.
+ * @param inode The inode to change held in memory.
+ * @param buf The new mode.
+ * @return int The result code.
+ */
+int rtems_rfs_rtems_fchmod_inode (rtems_rfs_file_system*  fs,
+                                  rtems_rfs_inode_handle* inode,
+                                  mode_t                  mode);
 
 /**
  * File change mode routine.
  *
- * @param pathloc
+ * @param iop
  * @param mode
  * @return int
  */
-int rtems_rfs_rtems_fchmod (rtems_filesystem_location_info_t* loc, mode_t mode);
+int rtems_rfs_rtems_fchmod (rtems_filesystem_location_info_t* pathloc,
+                            mode_t                            mode);
 
 /**
  * Routine to remove a node from the RFS file system.

diff -u rtems/cpukit/libfs/src/rfs/rtems-rfs-rtems.c:1.15 rtems/cpukit/libfs/src/rfs/rtems-rfs-rtems.c:1.16
--- rtems/cpukit/libfs/src/rfs/rtems-rfs-rtems.c:1.15	Mon Feb  7 16:41:37 2011
+++ rtems/cpukit/libfs/src/rfs/rtems-rfs-rtems.c	Tue Mar 15 00:02:34 2011
@@ -65,7 +65,7 @@
  * @param flags
  * @param pathloc
  */
-int
+static int
 rtems_rfs_rtems_eval_path (const char*                       path,
                            size_t                            pathlen,
                            int                               flags,
@@ -246,7 +246,7 @@
  * @param name
  * @return int
  */
-int
+static int
 rtems_rfs_rtems_eval_for_make (const char*                       path,
                                rtems_filesystem_location_info_t* pathloc,
                                const char**                      name)
@@ -481,7 +481,7 @@
  * @param name
  * @return int
  */
-int
+static int
 rtems_rfs_rtems_link (rtems_filesystem_location_info_t* to_loc,
                       rtems_filesystem_location_info_t* parent_loc,
                       const char*                       name)
@@ -517,7 +517,7 @@
  * @return int
  */
 
-int
+static int
 rtems_rfs_rtems_unlink (rtems_filesystem_location_info_t* parent_loc,
                         rtems_filesystem_location_info_t* loc)
 {
@@ -553,7 +553,7 @@
  * @return rtems_filesystem_node_types_t
  */
 
-rtems_filesystem_node_types_t
+static rtems_filesystem_node_types_t
 rtems_rfs_rtems_node_type (rtems_filesystem_location_info_t* pathloc)
 {
   rtems_rfs_file_system*        fs = rtems_rfs_rtems_pathloc_dev (pathloc);
@@ -677,7 +677,7 @@
  * return int
  */
 
-int
+static int
 rtems_rfs_rtems_utime(rtems_filesystem_location_info_t* pathloc,
                       time_t                            atime,
                       time_t                            mtime)
@@ -721,7 +721,7 @@
  * return int
  */
 
-int
+static int
 rtems_rfs_rtems_symlink (rtems_filesystem_location_info_t* parent_loc,
                          const char*                       link_name,
                          const char*                       node_name)
@@ -765,7 +765,7 @@
  * @return int
  */
 
-ssize_t
+static ssize_t
 rtems_rfs_rtems_readlink (rtems_filesystem_location_info_t* pathloc,
                           char*                             buf,
                           size_t                            bufsize)
@@ -792,13 +792,40 @@
   return (int) length;
 }
 
-/**
- * File change mode routine.
- *
- * @param pathloc
- * @param mode
- * @return int
- */
+int
+rtems_rfs_rtems_fchmod_inode (rtems_rfs_file_system*  fs,
+                              rtems_rfs_inode_handle* inode,
+                              mode_t                  mode)
+{
+  uint16_t imode;
+#if defined (RTEMS_POSIX_API)
+  uid_t     uid;
+#endif
+
+  if (rtems_rfs_rtems_trace (RTEMS_RFS_RTEMS_DEBUG_FCHMOD))
+    printf ("rtems-rfs-rtems: fchmod indo: in: ino:%" PRId32 " mode:%06" PRIomode_t "\n",
+            rtems_rfs_inode_ino (inode), mode);
+  
+  imode = rtems_rfs_inode_get_mode (inode);
+  
+  /*
+   *  Verify I am the owner of the node or the super user.
+   */
+#if defined (RTEMS_POSIX_API)
+  uid = geteuid();
+
+  if ((uid != rtems_rfs_inode_get_uid (inode)) && (uid != 0))
+    return EPERM;
+#endif
+
+  imode &= ~(S_IRWXU | S_IRWXG | S_IRWXO | S_ISUID | S_ISGID | S_ISVTX);
+  imode |= mode & (S_IRWXU | S_IRWXG | S_IRWXO | S_ISUID | S_ISGID | S_ISVTX);
+
+  rtems_rfs_inode_set_mode (inode, imode);
+  
+  return 0;
+}
+
 int
 rtems_rfs_rtems_fchmod (rtems_filesystem_location_info_t* pathloc,
                         mode_t                            mode)
@@ -806,10 +833,6 @@
   rtems_rfs_file_system*  fs = rtems_rfs_rtems_pathloc_dev (pathloc);
   rtems_rfs_ino           ino = rtems_rfs_rtems_get_pathloc_ino (pathloc);
   rtems_rfs_inode_handle  inode;
-  uint16_t                imode;
-#if defined (RTEMS_POSIX_API)
-  uid_t                   uid;
-#endif
   int                     rc;
 
   if (rtems_rfs_rtems_trace (RTEMS_RFS_RTEMS_DEBUG_FCHMOD))
@@ -825,26 +848,13 @@
     return rtems_rfs_rtems_error ("fchmod: opening inode", rc);
   }
 
-  imode = rtems_rfs_inode_get_mode (&inode);
-  
-  /*
-   *  Verify I am the owner of the node or the super user.
-   */
-#if defined (RTEMS_POSIX_API)
-  uid = geteuid();
-
-  if ((uid != rtems_rfs_inode_get_uid (&inode)) && (uid != 0))
+  rc = rtems_rfs_rtems_fchmod_inode (fs, &inode, mode);
+  if (rc > 0)
   {
     rtems_rfs_inode_close (fs, &inode);
     rtems_rfs_rtems_unlock (fs);
-    return rtems_rfs_rtems_error ("fchmod: not owner", EPERM);
+    return rtems_rfs_rtems_error ("fchmod: fchmod inode", EPERM);
   }
-#endif
-
-  imode &= ~(S_IRWXU | S_IRWXG | S_IRWXO | S_ISUID | S_ISGID | S_ISVTX);
-  imode |= mode & (S_IRWXU | S_IRWXG | S_IRWXO | S_ISUID | S_ISGID | S_ISVTX);
-
-  rtems_rfs_inode_set_mode (&inode, imode);
   
   rc = rtems_rfs_inode_close (fs, &inode);
   if (rc > 0)
@@ -858,58 +868,39 @@
   return 0;
 }
 
-/**
- * The following routine does a stat on a node.
- *
- * @param pathloc
- * @param buf
- * @return int
- */
-
 int
-rtems_rfs_rtems_stat (rtems_filesystem_location_info_t* pathloc,
-                      struct stat*                      buf)
+rtems_rfs_rtems_stat_inode (rtems_rfs_file_system*  fs,
+                            rtems_rfs_inode_handle* inode,
+                            struct stat*            buf)
 {
-  rtems_rfs_file_system*  fs = rtems_rfs_rtems_pathloc_dev (pathloc);
-  rtems_rfs_ino           ino = rtems_rfs_rtems_get_pathloc_ino (pathloc);
-  rtems_rfs_inode_handle  inode;
-  rtems_rfs_file_shared*  shared;
-  uint16_t                mode;
-  int                     rc;
+  rtems_rfs_file_shared* shared;
+  uint16_t               mode;
 
   if (rtems_rfs_rtems_trace (RTEMS_RFS_RTEMS_DEBUG_STAT))
-    printf ("rtems-rfs-rtems: stat: in: ino:%" PRId32 "\n", ino);
-
-  rtems_rfs_rtems_lock (fs);
-  
-  rc = rtems_rfs_inode_open (fs, ino, &inode, true);
-  if (rc)
-  {
-    rtems_rfs_rtems_unlock (fs);
-    return rtems_rfs_rtems_error ("stat: opening inode", rc);
-  }
+    printf ("rtems-rfs-rtems: stat-inode: in: ino:%" PRId32 "\n",
+            rtems_rfs_inode_ino (inode));
 
-  mode = rtems_rfs_inode_get_mode (&inode);
+  mode = rtems_rfs_inode_get_mode (inode);
   
   if (RTEMS_RFS_S_ISCHR (mode) || RTEMS_RFS_S_ISBLK (mode))
   {
     buf->st_rdev = 
-      rtems_filesystem_make_dev_t (rtems_rfs_inode_get_block (&inode, 0),
-                                   rtems_rfs_inode_get_block (&inode, 1));
+      rtems_filesystem_make_dev_t (rtems_rfs_inode_get_block (inode, 0),
+                                   rtems_rfs_inode_get_block (inode, 1));
   }
   
   buf->st_dev     = rtems_rfs_fs_device (fs);
-  buf->st_ino     = ino;
+  buf->st_ino     = rtems_rfs_inode_ino (inode);
   buf->st_mode    = rtems_rfs_rtems_mode (mode);
-  buf->st_nlink   = rtems_rfs_inode_get_links (&inode);
-  buf->st_uid     = rtems_rfs_inode_get_uid (&inode);
-  buf->st_gid     = rtems_rfs_inode_get_gid (&inode);
+  buf->st_nlink   = rtems_rfs_inode_get_links (inode);
+  buf->st_uid     = rtems_rfs_inode_get_uid (inode);
+  buf->st_gid     = rtems_rfs_inode_get_gid (inode);
 
   /*
    * Need to check is the ino is an open file. If so we take the values from
    * the open file rather than the inode.
    */
-  shared = rtems_rfs_file_get_shared (fs, ino);
+  shared = rtems_rfs_file_get_shared (fs, rtems_rfs_inode_ino (inode));
 
   if (shared)
   {
@@ -925,19 +916,50 @@
   }
   else
   {
-    buf->st_atime   = rtems_rfs_inode_get_atime (&inode);
-    buf->st_mtime   = rtems_rfs_inode_get_mtime (&inode);
-    buf->st_ctime   = rtems_rfs_inode_get_ctime (&inode);
-    buf->st_blocks  = rtems_rfs_inode_get_block_count (&inode);
+    buf->st_atime   = rtems_rfs_inode_get_atime (inode);
+    buf->st_mtime   = rtems_rfs_inode_get_mtime (inode);
+    buf->st_ctime   = rtems_rfs_inode_get_ctime (inode);
+    buf->st_blocks  = rtems_rfs_inode_get_block_count (inode);
 
     if (S_ISLNK (buf->st_mode))
-      buf->st_size = rtems_rfs_inode_get_block_offset (&inode);
+      buf->st_size = rtems_rfs_inode_get_block_offset (inode);
     else
-      buf->st_size = rtems_rfs_inode_get_size (fs, &inode);
+      buf->st_size = rtems_rfs_inode_get_size (fs, inode);
   }
   
   buf->st_blksize = rtems_rfs_fs_block_size (fs);
   
+  return 0;
+}
+
+int
+rtems_rfs_rtems_fstat (rtems_filesystem_location_info_t* pathloc,
+                       struct stat*                      buf)
+{
+  rtems_rfs_file_system* fs = rtems_rfs_rtems_pathloc_dev (pathloc);
+  rtems_rfs_ino          ino = rtems_rfs_rtems_get_pathloc_ino (pathloc);
+  rtems_rfs_inode_handle inode;
+  int                    rc;
+
+  if (rtems_rfs_rtems_trace (RTEMS_RFS_RTEMS_DEBUG_STAT))
+    printf ("rtems-rfs-rtems: stat: in: ino:%" PRId32 "\n", ino);
+
+  rtems_rfs_rtems_lock (fs);
+  
+  rc = rtems_rfs_inode_open (fs, ino, &inode, true);
+  if (rc)
+  {
+    rtems_rfs_rtems_unlock (fs);
+    return rtems_rfs_rtems_error ("stat: opening inode", rc);
+  }
+
+  rc = rtems_rfs_rtems_stat_inode (fs, &inode, buf);
+  if (rc > 0)
+  {
+    rtems_rfs_rtems_unlock (fs);
+    return rtems_rfs_rtems_error ("stat: stat'ing the inode", rc);
+  }
+
   rc = rtems_rfs_inode_close (fs, &inode);
   if (rc > 0)
   {
@@ -959,7 +981,7 @@
  * @return int
  */
 
-int
+static int
 rtems_rfs_rtems_mknod (const char                       *name,
                        mode_t                            mode,
                        dev_t                             dev,
@@ -1090,7 +1112,7 @@
  * @param new_name The new name.
  * @return int 
  */
-int
+static int
 rtems_rfs_rtems_rename(rtems_filesystem_location_info_t* old_parent_loc,
                        rtems_filesystem_location_info_t* old_loc,
                        rtems_filesystem_location_info_t* new_parent_loc,
@@ -1150,7 +1172,7 @@
  * @param sb
  * @return int
  */
-int
+static int
 rtems_rfs_rtems_statvfs (rtems_filesystem_location_info_t* pathloc,
                          struct statvfs*                   sb)
 {
@@ -1186,7 +1208,7 @@
   .write_h     = rtems_filesystem_default_write,
   .ioctl_h     = rtems_filesystem_default_ioctl,
   .lseek_h     = rtems_filesystem_default_lseek,
-  .fstat_h     = rtems_rfs_rtems_stat,
+  .fstat_h     = rtems_rfs_rtems_fstat,
   .fchmod_h    = rtems_filesystem_default_fchmod,
   .ftruncate_h = rtems_filesystem_default_ftruncate,
   .fpathconf_h = rtems_filesystem_default_fpathconf,

diff -u rtems/cpukit/libmisc/shell/hexdump-conv.c:1.4 rtems/cpukit/libmisc/shell/hexdump-conv.c:1.5
--- rtems/cpukit/libmisc/shell/hexdump-conv.c:1.4	Fri Mar 26 12:18:43 2010
+++ rtems/cpukit/libmisc/shell/hexdump-conv.c	Tue Mar 15 00:02:34 2011
@@ -63,8 +63,6 @@
 	int converr, pad, width;
 	char peekbuf[MB_LEN_MAX];
 
-  printf("MB_LEN_MAX=%i\n", MB_LEN_MAX);
-  return;
 	if (pr->mbleft > 0) {
 		str = "**";
 		pr->mbleft--;



--

Generated by Deluxe Loginfo [http://www.codewiz.org/projects/index.html#loginfo] 2.122 by Bernardo Innocenti <bernie at develer.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/vc/attachments/20110315/cc6d44b5/attachment.html>


More information about the vc mailing list