<!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 (2010-06-08)</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>sh</strong></font>
</td></tr>
<tr><td colspan='3' bgcolor='#dddddd'><pre>2010-06-08 Sebastian Huber <sebastian.huber@embedded-brains.de>
* libfs/src/devfs/devclose.c, libfs/src/devfs/devopen.c,
libfs/src/imfs/deviceerrno.c, libfs/src/imfs/deviceio.c,
libfs/src/rfs/rtems-rfs-rtems-dev.c: Changed rtems_deviceio_errno() to
cope with a status code of RTEMS_SUCCESSFUL. Removed dependency on
association framework.
</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.2351&r2=text&tr2=1.2352&diff_format=h">M</a></td><td width='1%'>1.2352</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/devfs/devclose.c.diff?r1=text&tr1=1.3&r2=text&tr2=1.4&diff_format=h">M</a></td><td width='1%'>1.4</td><td width='100%'>cpukit/libfs/src/devfs/devclose.c</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/libfs/src/devfs/devopen.c.diff?r1=text&tr1=1.3&r2=text&tr2=1.4&diff_format=h">M</a></td><td width='1%'>1.4</td><td width='100%'>cpukit/libfs/src/devfs/devopen.c</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/libfs/src/imfs/deviceerrno.c.diff?r1=text&tr1=1.1&r2=text&tr2=1.2&diff_format=h">M</a></td><td width='1%'>1.2</td><td width='100%'>cpukit/libfs/src/imfs/deviceerrno.c</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/libfs/src/imfs/deviceio.c.diff?r1=text&tr1=1.21&r2=text&tr2=1.22&diff_format=h">M</a></td><td width='1%'>1.22</td><td width='100%'>cpukit/libfs/src/imfs/deviceio.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-dev.c.diff?r1=text&tr1=1.2&r2=text&tr2=1.3&diff_format=h">M</a></td><td width='1%'>1.3</td><td width='100%'>cpukit/libfs/src/rfs/rtems-rfs-rtems-dev.c</td></tr>
</table>
<pre>
<font color='#006600'>diff -u rtems/cpukit/ChangeLog:1.2351 rtems/cpukit/ChangeLog:1.2352
--- rtems/cpukit/ChangeLog:1.2351 Mon Jun 7 14:33:37 2010
+++ rtems/cpukit/ChangeLog Tue Jun 8 03:30:03 2010
</font><font color='#997700'>@@ -1,3 +1,11 @@
</font><font color='#000088'>+2010-06-08 Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+ * libfs/src/devfs/devclose.c, libfs/src/devfs/devopen.c,
+ libfs/src/imfs/deviceerrno.c, libfs/src/imfs/deviceio.c,
+ libfs/src/rfs/rtems-rfs-rtems-dev.c: Changed rtems_deviceio_errno() to
+ cope with a status code of RTEMS_SUCCESSFUL. Removed dependency on
+ association framework.
+
</font> 2010-06-07 Ralf Corsépius <ralf.corsepius@rtems.org>
* aclocal/version.m4: Bump RTEMS_API to 4.11.
<font color='#006600'>diff -u rtems/cpukit/libfs/src/devfs/devclose.c:1.3 rtems/cpukit/libfs/src/devfs/devclose.c:1.4
--- rtems/cpukit/libfs/src/devfs/devclose.c:1.3 Thu Sep 18 08:21:49 2008
+++ rtems/cpukit/libfs/src/devfs/devclose.c Tue Jun 8 03:30:04 2010
</font><font color='#997700'>@@ -34,10 +34,8 @@
</font> np->minor,
(void *) &args
);
<font color='#880000'>- if ( status ) {
- return rtems_deviceio_errno(status);
- }
- return 0;
</font><font color='#000088'>+
+ return rtems_deviceio_errno(status);
</font> }
<font color='#006600'>diff -u rtems/cpukit/libfs/src/devfs/devopen.c:1.3 rtems/cpukit/libfs/src/devfs/devopen.c:1.4
--- rtems/cpukit/libfs/src/devfs/devopen.c:1.3 Thu Sep 18 08:21:49 2008
+++ rtems/cpukit/libfs/src/devfs/devopen.c Tue Jun 8 03:30:04 2010
</font><font color='#997700'>@@ -37,8 +37,6 @@
</font> np->minor,
(void *) &args
);
<font color='#880000'>- if ( status )
- return rtems_deviceio_errno(status);
</font>
<font color='#880000'>- return 0;
</font><font color='#000088'>+ return rtems_deviceio_errno(status);
</font> }
<font color='#006600'>diff -u rtems/cpukit/libfs/src/imfs/deviceerrno.c:1.1 rtems/cpukit/libfs/src/imfs/deviceerrno.c:1.2
--- rtems/cpukit/libfs/src/imfs/deviceerrno.c:1.1 Wed Sep 17 11:12:04 2008
+++ rtems/cpukit/libfs/src/imfs/deviceerrno.c Tue Jun 8 03:30:04 2010
</font><font color='#997700'>@@ -18,40 +18,53 @@
</font> #include "config.h"
#endif
<font color='#000088'>+#include <errno.h>
+
</font> #include <rtems.h>
#include <rtems/libio.h>
<font color='#880000'>-#include <rtems/assoc.h> /* assoc.h not included by rtems.h */
-#include <errno.h>
</font>
<font color='#880000'>-/*
- * Convert RTEMS status to a UNIX errno
- */
-
-const rtems_assoc_t errno_assoc[] = {
- { "OK", RTEMS_SUCCESSFUL, 0 },
- { "BUSY", RTEMS_RESOURCE_IN_USE, EBUSY },
- { "INVALID NAME", RTEMS_INVALID_NAME, EINVAL },
- { "NOT IMPLEMENTED", RTEMS_NOT_IMPLEMENTED, ENOSYS },
- { "TIMEOUT", RTEMS_TIMEOUT, ETIMEDOUT },
- { "NO MEMORY", RTEMS_NO_MEMORY, ENOMEM },
- { "NO DEVICE", RTEMS_UNSATISFIED, ENODEV },
- { "INVALID NUMBER", RTEMS_INVALID_NUMBER, EBADF},
- { "NOT RESOURCE OWNER", RTEMS_NOT_OWNER_OF_RESOURCE, EPERM},
- { "IO ERROR", RTEMS_IO_ERROR, EIO},
- { 0, 0, 0 },
</font><font color='#000088'>+static const int status_code_to_errno [RTEMS_STATUS_CODES_LAST + 1] = {
+ [RTEMS_SUCCESSFUL] = 0,
+ [RTEMS_TASK_EXITTED] = EIO,
+ [RTEMS_MP_NOT_CONFIGURED] = EIO,
+ [RTEMS_INVALID_NAME] = EINVAL,
+ [RTEMS_INVALID_ID] = EIO,
+ [RTEMS_TOO_MANY] = EIO,
+ [RTEMS_TIMEOUT] = ETIMEDOUT,
+ [RTEMS_OBJECT_WAS_DELETED] = EIO,
+ [RTEMS_INVALID_SIZE] = EIO,
+ [RTEMS_INVALID_ADDRESS] = EIO,
+ [RTEMS_INVALID_NUMBER] = EBADF,
+ [RTEMS_NOT_DEFINED] = EIO,
+ [RTEMS_RESOURCE_IN_USE] = EBUSY,
+ [RTEMS_UNSATISFIED] = ENODEV,
+ [RTEMS_INCORRECT_STATE] = EIO,
+ [RTEMS_ALREADY_SUSPENDED] = EIO,
+ [RTEMS_ILLEGAL_ON_SELF] = EIO,
+ [RTEMS_ILLEGAL_ON_REMOTE_OBJECT] = EIO,
+ [RTEMS_CALLED_FROM_ISR] = EIO,
+ [RTEMS_INVALID_PRIORITY] = EIO,
+ [RTEMS_NOT_OWNER_OF_RESOURCE] = EPERM,
+ [RTEMS_NOT_IMPLEMENTED] = ENOSYS,
+ [RTEMS_INTERNAL_ERROR] = EIO,
+ [RTEMS_NO_MEMORY] = ENOMEM,
+ [RTEMS_IO_ERROR] = EIO,
+ [RTEMS_PROXY_BLOCKING] = EIO
</font> };
<font color='#880000'>-int
-rtems_deviceio_errno(rtems_status_code code)
</font><font color='#000088'>+int rtems_deviceio_errno(rtems_status_code sc)
</font> {
<font color='#880000'>- int rc;
</font><font color='#000088'>+ if (sc == RTEMS_SUCCESSFUL) {
+ return 0;
+ } else {
+ int eno = EINVAL;
</font>
<font color='#880000'>- if ((rc = rtems_assoc_remote_by_local(errno_assoc, (uint32_t ) code)))
- {
- errno = rc;
- return -1;
</font><font color='#000088'>+ if ((unsigned) sc <= RTEMS_STATUS_CODES_LAST) {
+ eno = status_code_to_errno [sc];
</font> }
<font color='#880000'>- return -1;
-}
</font>
<font color='#000088'>+ errno = eno;
</font>
<font color='#000088'>+ return -1;
+ }
+}
</font>
<font color='#006600'>diff -u rtems/cpukit/libfs/src/imfs/deviceio.c:1.21 rtems/cpukit/libfs/src/imfs/deviceio.c:1.22
--- rtems/cpukit/libfs/src/imfs/deviceio.c:1.21 Wed Apr 29 03:31:27 2009
+++ rtems/cpukit/libfs/src/imfs/deviceio.c Tue Jun 8 03:30:04 2010
</font><font color='#997700'>@@ -20,17 +20,11 @@
</font>
#include <rtems.h>
#include <rtems/libio.h>
<font color='#880000'>-#include <rtems/assoc.h> /* assoc.h not included by rtems.h */
-#include <errno.h>
</font><font color='#000088'>+#include <rtems/devfs.h>
</font>
#include "imfs.h"
/*
<font color='#880000'>- * Convert RTEMS status to a UNIX errno
- */
-extern int rtems_deviceio_errno(rtems_status_code code);
-
-/*
</font> * device_open
*
* This handler maps an open() operation onto rtems_io_open().
<font color='#997700'>@@ -58,10 +52,8 @@
</font> the_jnode->info.device.minor,
(void *) &args
);
<font color='#880000'>- if ( status )
- return rtems_deviceio_errno(status);
</font>
<font color='#880000'>- return 0;
</font><font color='#000088'>+ return rtems_deviceio_errno( status );
</font> }
/*
<font color='#997700'>@@ -89,10 +81,8 @@
</font> the_jnode->info.device.minor,
(void *) &args
);
<font color='#880000'>- if ( status ) {
- return rtems_deviceio_errno(status);
- }
- return 0;
</font><font color='#000088'>+
+ return rtems_deviceio_errno( status );
</font> }
/*
<font color='#006600'>diff -u rtems/cpukit/libfs/src/rfs/rtems-rfs-rtems-dev.c:1.2 rtems/cpukit/libfs/src/rfs/rtems-rfs-rtems-dev.c:1.3
--- rtems/cpukit/libfs/src/rfs/rtems-rfs-rtems-dev.c:1.2 Fri Mar 26 23:04:40 2010
+++ rtems/cpukit/libfs/src/rfs/rtems-rfs-rtems-dev.c Tue Jun 8 03:30:04 2010
</font><font color='#997700'>@@ -83,10 +83,8 @@
</font> args.mode = mode;
status = rtems_io_open (major, minor, (void *) &args);
<font color='#880000'>- if (status)
- return rtems_deviceio_errno(status);
</font>
<font color='#880000'>- return 0;
</font><font color='#000088'>+ return rtems_deviceio_errno (status);
</font> }
/**
<font color='#997700'>@@ -112,10 +110,8 @@
</font> args.mode = 0;
status = rtems_io_close (major, minor, (void *) &args);
<font color='#880000'>- if (status)
- return rtems_deviceio_errno (status);
</font>
<font color='#880000'>- return 0;
</font><font color='#000088'>+ return rtems_deviceio_errno (status);
</font> }
/**
</pre>
<p> </p>
<a name='cs2'></a>
<table border='0' cellspacing='0' cellpadding='5' width='100%' bgcolor='#eeeeee'>
<tr><td colspan='3' bgcolor='#dddddd'>
<font color='#bb2222'><strong>sh</strong></font>
</td></tr>
<tr><td colspan='3' bgcolor='#dddddd'><pre>2010-06-08 Sebastian Huber <sebastian.huber@embedded-brains.de>
* libfs/src/imfs/imfs.h, libfs/src/imfs/imfs_rmnod.c: Added and use
IMFS_create_orphan() and IMFS_check_node_remove().
* libfs/src/imfs/deviceio.c, libfs/src/imfs/imfs_directory.c,
libfs/src/imfs/imfs_fifo.c: Use IMFS_create_orphan() and
IMFS_check_node_remove().
* libfs/src/imfs/imfs_handlers_memfile.c, libfs/src/imfs/memfile.c:
Use IMFS_rmnod() and IMFS_check_node_remove() instead of
memfile_rmnod() and memfile_check_rmnod().
</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.2352&r2=text&tr2=1.2353&diff_format=h">M</a></td><td width='1%'>1.2353</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/imfs/deviceio.c.diff?r1=text&tr1=1.22&r2=text&tr2=1.23&diff_format=h">M</a></td><td width='1%'>1.23</td><td width='100%'>cpukit/libfs/src/imfs/deviceio.c</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/libfs/src/imfs/imfs.h.diff?r1=text&tr1=1.41&r2=text&tr2=1.42&diff_format=h">M</a></td><td width='1%'>1.42</td><td width='100%'>cpukit/libfs/src/imfs/imfs.h</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/libfs/src/imfs/imfs_directory.c.diff?r1=text&tr1=1.24&r2=text&tr2=1.25&diff_format=h">M</a></td><td width='1%'>1.25</td><td width='100%'>cpukit/libfs/src/imfs/imfs_directory.c</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/libfs/src/imfs/imfs_fifo.c.diff?r1=text&tr1=1.3&r2=text&tr2=1.4&diff_format=h">M</a></td><td width='1%'>1.4</td><td width='100%'>cpukit/libfs/src/imfs/imfs_fifo.c</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/libfs/src/imfs/imfs_handlers_memfile.c.diff?r1=text&tr1=1.11&r2=text&tr2=1.12&diff_format=h">M</a></td><td width='1%'>1.12</td><td width='100%'>cpukit/libfs/src/imfs/imfs_handlers_memfile.c</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/libfs/src/imfs/imfs_rmnod.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/imfs/imfs_rmnod.c</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/libfs/src/imfs/memfile.c.diff?r1=text&tr1=1.32&r2=text&tr2=1.33&diff_format=h">M</a></td><td width='1%'>1.33</td><td width='100%'>cpukit/libfs/src/imfs/memfile.c</td></tr>
</table>
<pre>
<font color='#006600'>diff -u rtems/cpukit/ChangeLog:1.2352 rtems/cpukit/ChangeLog:1.2353
--- rtems/cpukit/ChangeLog:1.2352 Tue Jun 8 03:30:03 2010
+++ rtems/cpukit/ChangeLog Tue Jun 8 03:50:57 2010
</font><font color='#997700'>@@ -1,5 +1,16 @@
</font> 2010-06-08 Sebastian Huber <sebastian.huber@embedded-brains.de>
<font color='#000088'>+ * libfs/src/imfs/imfs.h, libfs/src/imfs/imfs_rmnod.c: Added and use
+ IMFS_create_orphan() and IMFS_check_node_remove().
+ * libfs/src/imfs/deviceio.c, libfs/src/imfs/imfs_directory.c,
+ libfs/src/imfs/imfs_fifo.c: Use IMFS_create_orphan() and
+ IMFS_check_node_remove().
+ * libfs/src/imfs/imfs_handlers_memfile.c, libfs/src/imfs/memfile.c:
+ Use IMFS_rmnod() and IMFS_check_node_remove() instead of
+ memfile_rmnod() and memfile_check_rmnod().
+
+2010-06-08 Sebastian Huber <sebastian.huber@embedded-brains.de>
+
</font> * libfs/src/devfs/devclose.c, libfs/src/devfs/devopen.c,
libfs/src/imfs/deviceerrno.c, libfs/src/imfs/deviceio.c,
libfs/src/rfs/rtems-rfs-rtems-dev.c: Changed rtems_deviceio_errno() to
<font color='#006600'>diff -u rtems/cpukit/libfs/src/imfs/deviceio.c:1.22 rtems/cpukit/libfs/src/imfs/deviceio.c:1.23
--- rtems/cpukit/libfs/src/imfs/deviceio.c:1.22 Tue Jun 8 03:30:04 2010
+++ rtems/cpukit/libfs/src/imfs/deviceio.c Tue Jun 8 03:50:56 2010
</font><font color='#997700'>@@ -82,6 +82,8 @@
</font> (void *) &args
);
<font color='#000088'>+ IMFS_check_node_remove( the_jnode );
+
</font> return rtems_deviceio_errno( status );
}
<font color='#006600'>diff -u rtems/cpukit/libfs/src/imfs/imfs.h:1.41 rtems/cpukit/libfs/src/imfs/imfs.h:1.42
--- rtems/cpukit/libfs/src/imfs/imfs.h:1.41 Mon May 31 08:56:36 2010
+++ rtems/cpukit/libfs/src/imfs/imfs.h Tue Jun 8 03:50:54 2010
</font><font color='#997700'>@@ -470,11 +470,6 @@
</font> int whence /* IN */
);
<font color='#880000'>-extern int memfile_rmnod(
- rtems_filesystem_location_info_t *parent_pathloc, /* IN */
- rtems_filesystem_location_info_t *pathloc /* IN */
-);
-
</font> extern int device_open(
rtems_libio_t *iop, /* IN */
const char *pathname, /* IN */
<font color='#997700'>@@ -554,6 +549,14 @@
</font> rtems_libio_t *iop
);
<font color='#000088'>+extern void IMFS_create_orphan(
+ IMFS_jnode_t *jnode
+);
+
+extern void IMFS_check_node_remove(
+ IMFS_jnode_t *jnode
+);
+
</font> extern int IMFS_rmnod(
rtems_filesystem_location_info_t *parent_pathloc, /* IN */
rtems_filesystem_location_info_t *pathloc /* IN */
<font color='#006600'>diff -u rtems/cpukit/libfs/src/imfs/imfs_directory.c:1.24 rtems/cpukit/libfs/src/imfs/imfs_directory.c:1.25
--- rtems/cpukit/libfs/src/imfs/imfs_directory.c:1.24 Thu Jun 11 20:53:33 2009
+++ rtems/cpukit/libfs/src/imfs/imfs_directory.c Tue Jun 8 03:50:56 2010
</font><font color='#997700'>@@ -311,42 +311,8 @@
</font> if ( the_jnode->info.directory.mt_fs != NULL )
rtems_set_errno_and_return_minus_one( EBUSY );
<font color='#880000'>- /*
- * Take the node out of the parent's chain that contains this node
- */
-
- if ( the_jnode->Parent != NULL ) {
- rtems_chain_extract( (rtems_chain_node *) the_jnode );
- the_jnode->Parent = NULL;
- }
-
- /*
- * Decrement the link counter and see if we can free the space.
- */
-
- the_jnode->st_nlink--;
- IMFS_update_ctime( the_jnode );
-
- /*
- * The file cannot be open and the link must be less than 1 to free.
- */
-
- if ( !rtems_libio_is_file_open( the_jnode ) && (the_jnode->st_nlink < 1) ) {
-
- /*
- * Is the rtems_filesystem_current is this node?
- */
-
- if ( rtems_filesystem_current.node_access == pathloc->node_access )
- rtems_filesystem_current.node_access = NULL;
-
- /*
- * Free memory associated with a memory file.
- */
-
- free( the_jnode );
- }
</font><font color='#000088'>+ IMFS_create_orphan( the_jnode );
+ IMFS_check_node_remove( the_jnode );
</font>
return 0;
<font color='#880000'>-
</font> }
<font color='#006600'>diff -u rtems/cpukit/libfs/src/imfs/imfs_fifo.c:1.3 rtems/cpukit/libfs/src/imfs/imfs_fifo.c:1.4
--- rtems/cpukit/libfs/src/imfs/imfs_fifo.c:1.3 Wed Apr 29 03:31:27 2009
+++ rtems/cpukit/libfs/src/imfs/imfs_fifo.c Tue Jun 8 03:50:56 2010
</font><font color='#997700'>@@ -53,11 +53,9 @@
</font>
int err = pipe_release(&JNODE2PIPE(jnode), iop);
<font color='#880000'>- if (! err) {
</font><font color='#000088'>+ if (err == 0) {
</font> iop->flags &= ~LIBIO_FLAGS_OPEN;
<font color='#880000'>- /* Free jnode if file is already unlinked and no one opens it */
- if (! rtems_libio_is_file_open(jnode) && jnode->st_nlink < 1)
- free(jnode);
</font><font color='#000088'>+ IMFS_check_node_remove(jnode);
</font> }
IMFS_FIFO_RETURN(err);
<font color='#006600'>diff -u rtems/cpukit/libfs/src/imfs/imfs_handlers_memfile.c:1.11 rtems/cpukit/libfs/src/imfs/imfs_handlers_memfile.c:1.12
--- rtems/cpukit/libfs/src/imfs/imfs_handlers_memfile.c:1.11 Tue May 27 05:34:14 2008
+++ rtems/cpukit/libfs/src/imfs/imfs_handlers_memfile.c Tue Jun 8 03:50:56 2010
</font><font color='#997700'>@@ -37,5 +37,5 @@
</font> IMFS_fdatasync, /* fsync */
IMFS_fdatasync,
IMFS_fcntl,
<font color='#880000'>- memfile_rmnod
</font><font color='#000088'>+ IMFS_rmnod
</font> };
<font color='#006600'>diff -u rtems/cpukit/libfs/src/imfs/imfs_rmnod.c:1.16 rtems/cpukit/libfs/src/imfs/imfs_rmnod.c:1.17
--- rtems/cpukit/libfs/src/imfs/imfs_rmnod.c:1.16 Thu Jun 11 20:53:33 2009
+++ rtems/cpukit/libfs/src/imfs/imfs_rmnod.c Tue Jun 8 03:50:56 2010
</font><font color='#997700'>@@ -26,6 +26,39 @@
</font>
#include "imfs.h"
<font color='#000088'>+void IMFS_create_orphan( IMFS_jnode_t *jnode )
+{
+ if ( jnode->Parent != NULL ) {
+ rtems_chain_extract( &jnode->Node );
+ jnode->Parent = NULL;
+ }
+
+ --jnode->st_nlink;
+
+ IMFS_update_ctime( jnode );
+}
+
+void IMFS_check_node_remove( IMFS_jnode_t *jnode )
+{
+ if ( !rtems_libio_is_file_open( jnode ) && jnode->st_nlink < 1 ) {
+ if ( rtems_filesystem_current.node_access == jnode )
+ rtems_filesystem_current.node_access = NULL;
+
+ switch ( jnode->type ) {
+ case IMFS_MEMORY_FILE:
+ IMFS_memfile_remove( jnode );
+ break;
+ case IMFS_SYM_LINK:
+ free( jnode->info.sym_link.name );
+ break;
+ default:
+ break;
+ }
+
+ free( jnode );
+ }
+}
+
</font> /*
* IMFS_rmnod
*/
<font color='#997700'>@@ -35,50 +68,10 @@
</font> rtems_filesystem_location_info_t *pathloc /* IN */
)
{
<font color='#880000'>- IMFS_jnode_t *the_jnode;
</font><font color='#000088'>+ IMFS_jnode_t *jnode = (IMFS_jnode_t *) pathloc->node_access;
</font>
<font color='#880000'>- the_jnode = (IMFS_jnode_t *) pathloc->node_access;
-
- /*
- * Take the node out of the parent's chain that contains this node
- */
-
- if ( the_jnode->Parent != NULL ) {
- rtems_chain_extract( (rtems_chain_node *) the_jnode );
- the_jnode->Parent = NULL;
- }
-
- /*
- * Decrement the link counter and see if we can free the space.
- */
-
- the_jnode->st_nlink--;
- IMFS_update_ctime( the_jnode );
-
- /*
- * The file cannot be open and the link must be less than 1 to free.
- */
-
- if ( !rtems_libio_is_file_open( the_jnode ) && (the_jnode->st_nlink < 1) ) {
-
- /*
- * Is rtems_filesystem_current this node?
- */
-
- if ( rtems_filesystem_current.node_access == pathloc->node_access )
- rtems_filesystem_current.node_access = NULL;
-
- /*
- * Free memory associated with a memory file.
- */
-
- if ( the_jnode->type == IMFS_SYM_LINK ) {
- if ( the_jnode->info.sym_link.name )
- free( (void*) the_jnode->info.sym_link.name );
- }
- free( the_jnode );
- }
</font><font color='#000088'>+ IMFS_create_orphan( jnode );
+ IMFS_check_node_remove( jnode );
</font>
return 0;
<font color='#880000'>-
</font> }
<font color='#006600'>diff -u rtems/cpukit/libfs/src/imfs/memfile.c:1.32 rtems/cpukit/libfs/src/imfs/memfile.c:1.33
--- rtems/cpukit/libfs/src/imfs/memfile.c:1.32 Mon Jan 18 19:55:28 2010
+++ rtems/cpukit/libfs/src/imfs/memfile.c Tue Jun 8 03:50:56 2010
</font><font color='#997700'>@@ -73,8 +73,6 @@
</font> unsigned int length
);
<font color='#880000'>-int memfile_check_rmnod( IMFS_jnode_t *the_jnode );
-
</font> void *memfile_alloc_block(void);
void memfile_free_block(
<font color='#997700'>@@ -141,7 +139,8 @@
</font> if (iop->flags & LIBIO_FLAGS_APPEND)
iop->offset = the_jnode->info.file.size;
<font color='#880000'>- memfile_check_rmnod( the_jnode );
</font><font color='#000088'>+ IMFS_check_node_remove( the_jnode );
+
</font> return 0;
}
<font color='#997700'>@@ -1097,67 +1096,3 @@
</font> free(memory);
memfile_blocks_allocated--;
}
<font color='#880000'>-
-
-/*
- * memfile_rmnod
- *
- * This routine is available from the optable to remove a node
- * from the IMFS file system.
- */
-
-int memfile_rmnod(
- rtems_filesystem_location_info_t *parent_pathloc, /* IN */
- rtems_filesystem_location_info_t *pathloc /* IN */
-)
-{
- IMFS_jnode_t *the_jnode;
-
- the_jnode = (IMFS_jnode_t *) pathloc->node_access;
-
- /*
- * Take the node out of the parent's chain that contains this node
- */
-
- if ( the_jnode->Parent != NULL ) {
- rtems_chain_extract( (rtems_chain_node *) the_jnode );
- the_jnode->Parent = NULL;
- }
-
- /*
- * Decrement the link counter and see if we can free the space.
- */
-
- the_jnode->st_nlink--;
- IMFS_update_ctime( the_jnode );
-
- return memfile_check_rmnod( the_jnode );
-}
-
-
-int memfile_check_rmnod( IMFS_jnode_t *the_jnode ){
-
- /*
- * The file cannot be open and the link must be less than 1 to free.
- */
-
- if ( !rtems_libio_is_file_open( the_jnode ) && (the_jnode->st_nlink < 1) ) {
-
- /*
- * Is the rtems_filesystem_current is this node?
- */
-
- if ( rtems_filesystem_current.node_access == the_jnode )
- rtems_filesystem_current.node_access = NULL;
-
- /*
- * Free memory associated with a memory file.
- */
- if (the_jnode->type != IMFS_LINEAR_FILE)
- IMFS_memfile_remove( the_jnode );
-
- free( the_jnode );
- }
-
- return 0;
-}
</font></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>