summaryrefslogtreecommitdiffstats
path: root/cpukit/libfs/src/imfs
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2010-03-04 06:36:51 +0000
committerChris Johns <chrisj@rtems.org>2010-03-04 06:36:51 +0000
commit8ec7abb551a23bdf47509189145885a364810006 (patch)
tree7b5fa486b93583479b97f05a51c7370dd0c2d69f /cpukit/libfs/src/imfs
parentThis commit was generated by cvs2svn to compensate for changes in r22694, (diff)
downloadrtems-8ec7abb551a23bdf47509189145885a364810006.tar.bz2
010-03-04 Chris Johns <chrisj@rtems.org>
* libcsupport/include/rtems/libio.h, libcsupport/src/_rename_r.c: Add a rename file op and have rename use it. * libfs/Makefile.am, libfs/src/dosfs/msdos_rename.c, libfs/src/imfs/imfs_rename.c: New files to support the rename file op. * libfs/src/imfs/imfs.h: Add rename interface. * libfs/src/imfs/imfs_init.c: Add rename handler. * libfs/src/imfs/miniimfs_init.c: Fix up ops struct. * libfs/src/dosfs/msdos.h: Add msdos_rename and remove msdos_file_link. * libfs/src/dosfs/msdos_create.c: Remove the link call. * libfs/src/dosfs/msdos_eval.c: Fix a path parsing bug. * libfs/src/dosfs/msdos_init.c: Add rename handler and clean up the struct naming. * libfs/src/rfs/rtems-rfs-link.c, libfs/src/rfs/rtems-rfs-link.h: Change the link call to allow linking of directories if told to and change the unlink to handle unlink directories that are not empty so rename can be supported. * libfs/src/rfs/rtems-rfs-rtems-dir.c: Fix the link/unlink calls. * libfs/src/rfs/rtems-rfs-rtems.c: Add a rename handler. Fix the link/unlink calls. * libfs/src/dosfs/msdos_dir.c, libfs/src/dosfs/msdos_format.c, libfs/src/dosfs/msdos_misc.c, httpd/asp.c, libfs/src/nfsclient/src/nfs.c: Work around a newlib warning when using the is*() family of calls.
Diffstat (limited to 'cpukit/libfs/src/imfs')
-rw-r--r--cpukit/libfs/src/imfs/imfs.h7
-rw-r--r--cpukit/libfs/src/imfs/imfs_init.c1
-rw-r--r--cpukit/libfs/src/imfs/imfs_rename.c54
-rw-r--r--cpukit/libfs/src/imfs/miniimfs_init.c4
4 files changed, 65 insertions, 1 deletions
diff --git a/cpukit/libfs/src/imfs/imfs.h b/cpukit/libfs/src/imfs/imfs.h
index d198c5d884..ae682c06fd 100644
--- a/cpukit/libfs/src/imfs/imfs.h
+++ b/cpukit/libfs/src/imfs/imfs.h
@@ -529,6 +529,13 @@ extern int IMFS_readlink(
size_t bufsize
);
+extern int IMFS_rename(
+ rtems_filesystem_location_info_t *old_loc, /* IN */
+ rtems_filesystem_location_info_t *old_parent_loc, /* IN */
+ rtems_filesystem_location_info_t *new_parent_loc, /* IN */
+ const char *new_name /* IN */
+);
+
extern int IMFS_fdatasync(
rtems_libio_t *iop
);
diff --git a/cpukit/libfs/src/imfs/imfs_init.c b/cpukit/libfs/src/imfs/imfs_init.c
index d1b2d44fcf..9dae7cc690 100644
--- a/cpukit/libfs/src/imfs/imfs_init.c
+++ b/cpukit/libfs/src/imfs/imfs_init.c
@@ -50,6 +50,7 @@ const rtems_filesystem_operations_table IMFS_ops = {
IMFS_evaluate_link,
IMFS_symlink,
IMFS_readlink,
+ IMFS_rename,
NULL
};
diff --git a/cpukit/libfs/src/imfs/imfs_rename.c b/cpukit/libfs/src/imfs/imfs_rename.c
new file mode 100644
index 0000000000..f45aa5b694
--- /dev/null
+++ b/cpukit/libfs/src/imfs/imfs_rename.c
@@ -0,0 +1,54 @@
+/*
+ * IMFS_rename
+ *
+ * The following rouine creates a new link node under parent with the
+ * name given in name and removes the old.
+ *
+ * COPYRIGHT (c) 1989-2010.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <errno.h>
+#include "imfs.h"
+#include <rtems/libio_.h>
+#include <rtems/seterr.h>
+
+int IMFS_rename(
+ rtems_filesystem_location_info_t *old_parent_loc, /* IN */
+ rtems_filesystem_location_info_t *old_loc, /* IN */
+ rtems_filesystem_location_info_t *new_parent_loc, /* IN */
+ const char *new_name /* IN */
+)
+{
+ IMFS_jnode_t *the_jnode;
+ IMFS_jnode_t *new_parent;
+
+ the_jnode = old_loc->node_access;
+
+ strncpy( the_jnode->name, new_name, IMFS_NAME_MAX );
+
+ if ( the_jnode->Parent != NULL )
+ rtems_chain_extract( (rtems_chain_node *) the_jnode );
+
+ new_parent = new_parent_loc->node_access;
+ the_jnode->Parent = new_parent;
+
+ rtems_chain_append( &new_parent->info.directory.Entries, &the_jnode->Node );
+
+ /*
+ * Update the time.
+ */
+ IMFS_update_ctime( the_jnode );
+
+ return 0;
+}
diff --git a/cpukit/libfs/src/imfs/miniimfs_init.c b/cpukit/libfs/src/imfs/miniimfs_init.c
index 15ca663429..2244dfde7d 100644
--- a/cpukit/libfs/src/imfs/miniimfs_init.c
+++ b/cpukit/libfs/src/imfs/miniimfs_init.c
@@ -49,7 +49,9 @@ const rtems_filesystem_operations_table miniIMFS_ops = {
NULL, /* XXX IMFS_utime, */
NULL, /* XXX IMFS_evaluate_link, */
NULL, /* XXX IMFS_symlink, */
- NULL /* XXX IMFS_readlink */
+ NULL, /* XXX IMFS_readlink */
+ NULL, /* XXX IMFS_rename */
+ NULL /* XXX IMFS_statvfs */
};
/*