<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>change log for rtems (2011-03-15)</title>
</head>
<body text='#000000' bgcolor='#ffffff'>
<a name='cs1'></a>
<table border='0' cellspacing='0' cellpadding='5' width='100%' bgcolor='#eeeeee'>
<tr><td colspan='3' bgcolor='#dddddd'>
<font color='#bb2222'><strong>ccj</strong></font>
</td></tr>
<tr><td colspan='3' bgcolor='#dddddd'><pre>2011-03-15 Chris Johns <chrisj@rtems.org>
* libfs/src/rfs/rtems-rfs-rtems-file.c,
libfs/src/rfs/rtems-rfs-rtems.c, libfs/src/rfs/rtems-rfs-rtems.h:
The fix to the removal of file_info from iop was broken. The
node_access field must be the inode number in the RFS because the
file system ops provides no way to tell is a stat call is the
result of stat, fstat, or lstat. The solution is to move the file
handle to node_access_2 which is also shared with doff but these
do not overlap.
</pre></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/ChangeLog.diff?r1=text&tr1=1.2775&r2=text&tr2=1.2776&diff_format=h">M</a></td><td width='1%'>1.2776</td><td width='100%'>cpukit/ChangeLog</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/libfs/src/rfs/rtems-rfs-rtems-file.c.diff?r1=text&tr1=1.10&r2=text&tr2=1.11&diff_format=h">M</a></td><td width='1%'>1.11</td><td width='100%'>cpukit/libfs/src/rfs/rtems-rfs-rtems-file.c</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/libfs/src/rfs/rtems-rfs-rtems.h.diff?r1=text&tr1=1.5&r2=text&tr2=1.6&diff_format=h">M</a></td><td width='1%'>1.6</td><td width='100%'>cpukit/libfs/src/rfs/rtems-rfs-rtems.h</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/libfs/src/rfs/rtems-rfs-rtems.c.diff?r1=text&tr1=1.16&r2=text&tr2=1.17&diff_format=h">M</a></td><td width='1%'>1.17</td><td width='100%'>cpukit/libfs/src/rfs/rtems-rfs-rtems.c</td></tr>
</table>
<pre>
<font color='#006600'>diff -u rtems/cpukit/ChangeLog:1.2775 rtems/cpukit/ChangeLog:1.2776
--- rtems/cpukit/ChangeLog:1.2775 Tue Mar 15 00:14:38 2011
+++ rtems/cpukit/ChangeLog Tue Mar 15 02:32:39 2011
</font><font color='#997700'>@@ -1,5 +1,16 @@
</font> 2011-03-15 Chris Johns <chrisj@rtems.org>
<font color='#000088'>+ * libfs/src/rfs/rtems-rfs-rtems-file.c,
+ libfs/src/rfs/rtems-rfs-rtems.c, libfs/src/rfs/rtems-rfs-rtems.h:
+ The fix to the removal of file_info from iop was broken. The
+ node_access field must be the inode number in the RFS because the
+ file system ops provides no way to tell is a stat call is the
+ result of stat, fstat, or lstat. The solution is to move the file
+ handle to node_access_2 which is also shared with doff but these
+ do not overlap.
+<span style="background-color: #FF0000"> </span>
+2011-03-15 Chris Johns <chrisj@rtems.org>
+
</font> PR 1757/filesystem
* libfs/src/rfs/rtems-rfs-block-pos.h: Fix the bug in equal
compare.
<font color='#006600'>diff -u rtems/cpukit/libfs/src/rfs/rtems-rfs-rtems-file.c:1.10 rtems/cpukit/libfs/src/rfs/rtems-rfs-rtems-file.c:1.11
--- rtems/cpukit/libfs/src/rfs/rtems-rfs-rtems-file.c:1.10 Tue Mar 15 00:02:34 2011
+++ rtems/cpukit/libfs/src/rfs/rtems-rfs-rtems-file.c Tue Mar 15 02:32:39 2011
</font><font color='#997700'>@@ -71,7 +71,7 @@
</font> printf("rtems-rfs: file-open: handle:%p\n", file);
iop->size = rtems_rfs_file_size (file);
<font color='#880000'>- iop->pathinfo.node_access = file;
</font><font color='#000088'>+ rtems_rfs_rtems_set_iop_file_handle (iop, file);
</font>
rtems_rfs_rtems_unlock (fs);
return 0;
<font color='#997700'>@@ -87,7 +87,7 @@
</font> static int
rtems_rfs_rtems_file_close (rtems_libio_t* iop)
{
<font color='#880000'>- rtems_rfs_file_handle* file = iop->pathinfo.node_access;
</font><font color='#000088'>+ rtems_rfs_file_handle* file = rtems_rfs_rtems_get_iop_file_handle (iop);
</font> rtems_rfs_file_system* fs = rtems_rfs_file_fs (file);
int rc;
<font color='#997700'>@@ -117,7 +117,7 @@
</font> void* buffer,
size_t count)
{
<font color='#880000'>- rtems_rfs_file_handle* file = iop->pathinfo.node_access;
</font><font color='#000088'>+ rtems_rfs_file_handle* file = rtems_rfs_rtems_get_iop_file_handle (iop);
</font> rtems_rfs_pos pos;
uint8_t* data = buffer;
ssize_t read = 0;
<font color='#997700'>@@ -182,7 +182,7 @@
</font> const void* buffer,
size_t count)
{
<font color='#880000'>- rtems_rfs_file_handle* file = iop->pathinfo.node_access;
</font><font color='#000088'>+ rtems_rfs_file_handle* file = rtems_rfs_rtems_get_iop_file_handle (iop);
</font> rtems_rfs_pos pos;
const uint8_t* data = buffer;
ssize_t write = 0;
<font color='#997700'>@@ -279,7 +279,7 @@
</font> rtems_off64_t offset,
int whence)
{
<font color='#880000'>- rtems_rfs_file_handle* file = iop->pathinfo.node_access;
</font><font color='#000088'>+ rtems_rfs_file_handle* file = rtems_rfs_rtems_get_iop_file_handle (iop);
</font> rtems_rfs_pos pos;
int rc;
<font color='#997700'>@@ -303,62 +303,6 @@
</font> }
/**
<font color='#880000'>- * 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;
-}
-
-/**
</font> * This routine processes the ftruncate() system call.
*
* @param iop
<font color='#997700'>@@ -369,7 +313,7 @@
</font> rtems_rfs_rtems_file_ftruncate (rtems_libio_t* iop,
rtems_off64_t length)
{
<font color='#880000'>- rtems_rfs_file_handle* file = iop->pathinfo.node_access;
</font><font color='#000088'>+ rtems_rfs_file_handle* file = rtems_rfs_rtems_get_iop_file_handle (iop);
</font> int rc;
if (rtems_rfs_rtems_trace (RTEMS_RFS_RTEMS_DEBUG_FILE_FTRUNC))
<font color='#997700'>@@ -399,8 +343,8 @@
</font> .write_h = rtems_rfs_rtems_file_write,
.ioctl_h = rtems_rfs_rtems_file_ioctl,
.lseek_h = rtems_rfs_rtems_file_lseek,
<font color='#880000'>- .fstat_h = rtems_rfs_rtems_file_fstat,
- .fchmod_h = rtems_rfs_rtems_file_fchmod,
</font><font color='#000088'>+ .fstat_h = rtems_rfs_rtems_fstat,
+ .fchmod_h = rtems_rfs_rtems_fchmod,
</font> .ftruncate_h = rtems_rfs_rtems_file_ftruncate,
.fpathconf_h = rtems_filesystem_default_fpathconf,
.fsync_h = rtems_rfs_rtems_fdatasync,
<font color='#006600'>diff -u rtems/cpukit/libfs/src/rfs/rtems-rfs-rtems.h:1.5 rtems/cpukit/libfs/src/rfs/rtems-rfs-rtems.h:1.6
--- rtems/cpukit/libfs/src/rfs/rtems-rfs-rtems.h:1.5 Tue Mar 15 00:02:34 2011
+++ rtems/cpukit/libfs/src/rfs/rtems-rfs-rtems.h Tue Mar 15 02:32:39 2011
</font><font color='#997700'>@@ -191,12 +191,30 @@
</font> * Get the ino from the I/O pointer.
*
* @param _iop The I/O pointer.
<font color='#880000'>- * @return
</font><font color='#000088'>+ * @return ino
</font> */
#define rtems_rfs_rtems_get_iop_ino(_iop) \
((intptr_t)(_iop)->pathinfo.node_access)
/**
<font color='#000088'>+ * Get the file handle from the I/O pointer.
+ *
+ * @param _iop The I/O pointer.
+ * @return filehandle The file handle
+ */
+#define rtems_rfs_rtems_get_iop_file_handle(_iop) \
+ ((rtems_rfs_file_handle*)(_iop)->pathinfo.node_access_2)
+
+/**
+ * Set the file handle in the I/O pointer.
+ *
+ * @param _iop The I/O pointer.
+ * @param _fh The file handle.
+ */
+#define rtems_rfs_rtems_set_iop_file_handle(_iop, _fh) \
+ (_iop)->pathinfo.node_access_2 = (_fh)
+
+/**
</font> * Create the name of the handler's table given the type of handlers.
*
* @param _h The name of the handlers.
<font color='#997700'>@@ -274,18 +292,6 @@
</font> /**
* The following routine does a stat on a node.
*
<font color='#880000'>- * @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.
- *
</font> * @param iop
* @param buf
* @return int
<font color='#997700'>@@ -294,18 +300,6 @@
</font> struct stat* buf);
/**
<font color='#880000'>- * 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);
-
-/**
</font> * File change mode routine.
*
* @param iop
<font color='#006600'>diff -u rtems/cpukit/libfs/src/rfs/rtems-rfs-rtems.c:1.16 rtems/cpukit/libfs/src/rfs/rtems-rfs-rtems.c:1.17
--- rtems/cpukit/libfs/src/rfs/rtems-rfs-rtems.c:1.16 Tue Mar 15 00:02:34 2011
+++ rtems/cpukit/libfs/src/rfs/rtems-rfs-rtems.c Tue Mar 15 02:32:39 2011
</font><font color='#997700'>@@ -793,46 +793,16 @@
</font> }
int
<font color='#880000'>-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);
-<span style="background-color: #FF0000"> </span>
- imode = rtems_rfs_inode_get_mode (inode);
-<span style="background-color: #FF0000"> </span>
- /*
- * 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);
-<span style="background-color: #FF0000"> </span>
- return 0;
-}
-
-int
</font> rtems_rfs_rtems_fchmod (rtems_filesystem_location_info_t* pathloc,
mode_t mode)
{
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;
<font color='#000088'>+ uint16_t imode;
+#if defined (RTEMS_POSIX_API)
+ uid_t uid;
+#endif
</font> int rc;
if (rtems_rfs_rtems_trace (RTEMS_RFS_RTEMS_DEBUG_FCHMOD))
<font color='#997700'>@@ -848,13 +818,26 @@
</font> return rtems_rfs_rtems_error ("fchmod: opening inode", rc);
}
<font color='#880000'>- rc = rtems_rfs_rtems_fchmod_inode (fs, &inode, mode);
- if (rc > 0)
</font><font color='#000088'>+ imode = rtems_rfs_inode_get_mode (&inode);
+<span style="background-color: #FF0000"> </span>
+ /*
+ * 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))
</font> {
rtems_rfs_inode_close (fs, &inode);
rtems_rfs_rtems_unlock (fs);
<font color='#880000'>- return rtems_rfs_rtems_error ("fchmod: fchmod inode", EPERM);
</font><font color='#000088'>+ return rtems_rfs_rtems_error ("fchmod: checking uid", EPERM);
</font> }
<font color='#000088'>+#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);
</font>
rc = rtems_rfs_inode_close (fs, &inode);
if (rc > 0)
<font color='#997700'>@@ -869,38 +852,49 @@
</font> }
int
<font color='#880000'>-rtems_rfs_rtems_stat_inode (rtems_rfs_file_system* fs,
- rtems_rfs_inode_handle* inode,
- struct stat* buf)
</font><font color='#000088'>+rtems_rfs_rtems_fstat (rtems_filesystem_location_info_t* pathloc,
+ struct stat* buf)
</font> {
<font color='#000088'>+ 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;
</font> rtems_rfs_file_shared* shared;
uint16_t mode;
<font color='#000088'>+ int rc;
</font>
if (rtems_rfs_rtems_trace (RTEMS_RFS_RTEMS_DEBUG_STAT))
<font color='#880000'>- printf ("rtems-rfs-rtems: stat-inode: in: ino:%" PRId32 "\n",
- rtems_rfs_inode_ino (inode));
</font><font color='#000088'>+ printf ("rtems-rfs-rtems: stat: in: ino:%" PRId32 "\n", ino);
</font>
<font color='#880000'>- mode = rtems_rfs_inode_get_mode (inode);
</font><font color='#000088'>+ rtems_rfs_rtems_lock (fs);
+<span style="background-color: #FF0000"> </span>
+ 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);
+ }
+
+ mode = rtems_rfs_inode_get_mode (&inode);
</font>
if (RTEMS_RFS_S_ISCHR (mode) || RTEMS_RFS_S_ISBLK (mode))
{
buf->st_rdev =<span style="background-color: #FF0000"> </span>
<font color='#880000'>- rtems_filesystem_make_dev_t (rtems_rfs_inode_get_block (inode, 0),
- rtems_rfs_inode_get_block (inode, 1));
</font><font color='#000088'>+ rtems_filesystem_make_dev_t (rtems_rfs_inode_get_block (&inode, 0),
+ rtems_rfs_inode_get_block (&inode, 1));
</font> }
buf->st_dev = rtems_rfs_fs_device (fs);
<font color='#880000'>- buf->st_ino = rtems_rfs_inode_ino (inode);
</font><font color='#000088'>+ buf->st_ino = rtems_rfs_inode_ino (&inode);
</font> buf->st_mode = rtems_rfs_rtems_mode (mode);
<font color='#880000'>- 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);
</font><font color='#000088'>+ 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);
</font>
/*
* Need to check is the ino is an open file. If so we take the values from
* the open file rather than the inode.
*/
<font color='#880000'>- shared = rtems_rfs_file_get_shared (fs, rtems_rfs_inode_ino (inode));
</font><font color='#000088'>+ shared = rtems_rfs_file_get_shared (fs, rtems_rfs_inode_ino (&inode));
</font>
if (shared)
{
<font color='#997700'>@@ -916,50 +910,19 @@
</font> }
else
{
<font color='#880000'>- 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);
</font><font color='#000088'>+ 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);
</font>
if (S_ISLNK (buf->st_mode))
<font color='#880000'>- buf->st_size = rtems_rfs_inode_get_block_offset (inode);
</font><font color='#000088'>+ buf->st_size = rtems_rfs_inode_get_block_offset (&inode);
</font> else
<font color='#880000'>- buf->st_size = rtems_rfs_inode_get_size (fs, inode);
</font><font color='#000088'>+ buf->st_size = rtems_rfs_inode_get_size (fs, &inode);
</font> }
buf->st_blksize = rtems_rfs_fs_block_size (fs);
<font color='#880000'>- 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);
-<span style="background-color: #FF0000"> </span>
- 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);
- }
-
</font> rc = rtems_rfs_inode_close (fs, &inode);
if (rc > 0)
{
</pre>
<p> </p>
<p>--<br />
<small>Generated by <a href="http://www.codewiz.org/projects/index.html#loginfo">Deluxe Loginfo</a> 2.122 by Bernardo Innocenti <bernie@develer.com></small></p>
</body>
</html>