summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2010-06-10 09:07:28 +0000
committerSebastian Huber <sebastian.huber@embedded-brains.de>2010-06-10 09:07:28 +0000
commitb813d632b09171f2fd8e05042d90061c5a42a7bd (patch)
tree101e2e7132982622af91d66c80119327073a8e29 /cpukit
parentRegenerate. (diff)
downloadrtems-b813d632b09171f2fd8e05042d90061c5a42a7bd.tar.bz2
2010-06-10 Sebastian Huber <sebastian.huber@embedded-brains.de>
* libcsupport/src/mount-mktgt.c: New file. * libcsupport/Makefile.am: Reflect change above. * libcsupport/include/rtems/libio.h: Declare mount_and_make_target_path().
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/ChangeLog7
-rw-r--r--cpukit/libcsupport/Makefile.am2
-rw-r--r--cpukit/libcsupport/include/rtems/libio.h21
-rw-r--r--cpukit/libcsupport/src/mount-mktgt.c56
4 files changed, 84 insertions, 2 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog
index 0e2f59c644..9ce8f6621a 100644
--- a/cpukit/ChangeLog
+++ b/cpukit/ChangeLog
@@ -1,3 +1,10 @@
+2010-06-10 Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+ * libcsupport/src/mount-mktgt.c: New file.
+ * libcsupport/Makefile.am: Reflect change above.
+ * libcsupport/include/rtems/libio.h: Declare
+ mount_and_make_target_path().
+
2010-06-09 Sebastian Huber <sebastian.huber@embedded-brains.de>
* libnetworking/rtems/ftpfs.h, libnetworking/lib/ftpfs.c: Added
diff --git a/cpukit/libcsupport/Makefile.am b/cpukit/libcsupport/Makefile.am
index 3e80056408..368833b60b 100644
--- a/cpukit/libcsupport/Makefile.am
+++ b/cpukit/libcsupport/Makefile.am
@@ -44,7 +44,7 @@ ASSOCIATION_C_FILES = src/assoclocalbyname.c \
src/assocremotebylocal.c src/assocremotebyname.c
BASE_FS_C_FILES = src/base_fs.c src/mount.c src/unmount.c src/libio.c \
- src/mount-mgr.c src/libio_init.c \
+ src/mount-mgr.c src/mount-mktgt.c src/libio_init.c \
src/libio_sockets.c src/eval.c src/fs_null_handlers.c src/privateenv.c \
src/open_dev_console.c src/__usrenv.c src/rtems_mkdir.c
diff --git a/cpukit/libcsupport/include/rtems/libio.h b/cpukit/libcsupport/include/rtems/libio.h
index cc28c7b42d..d705228c4b 100644
--- a/cpukit/libcsupport/include/rtems/libio.h
+++ b/cpukit/libcsupport/include/rtems/libio.h
@@ -704,6 +704,25 @@ int mount(
const void *data
);
+/**
+ * @brief Mounts a file system and makes the @a target path.
+ *
+ * The @a target path will be created with rtems_mkdir() and must not be
+ * @c NULL.
+ *
+ * @see mount().
+ *
+ * @retval 0 Successful operation.
+ * @retval -1 An error occured. The @c errno indicates the error.
+ */
+int mount_and_make_target_path(
+ const char *source,
+ const char *target,
+ const char *filesystemtype,
+ rtems_filesystem_options_t options,
+ const void *data
+);
+
/*
* Boot Time Mount Table Structure
*/
@@ -736,7 +755,7 @@ extern rtems_fs_init_functions_t rtems_fs_init_helper;
* The @a mode value selects the access permissions of the directory.
*
* @retval 0 Successful operation.
- * @retval -1 An error occured. @c errno indicates the error.
+ * @retval -1 An error occured. The @c errno indicates the error.
*/
extern int rtems_mkdir(const char *path, mode_t mode);
diff --git a/cpukit/libcsupport/src/mount-mktgt.c b/cpukit/libcsupport/src/mount-mktgt.c
new file mode 100644
index 0000000000..3b4d50aded
--- /dev/null
+++ b/cpukit/libcsupport/src/mount-mktgt.c
@@ -0,0 +1,56 @@
+/**
+ * @file
+ *
+ * @ingroup LibIO
+ *
+ * @brief mount_and_make_target_path() implementation.
+ */
+
+/*
+ * Copyright (c) 2010
+ * embedded brains GmbH
+ * Obere Lagerstr. 30
+ * D-82178 Puchheim
+ * Germany
+ * <rtems@embedded-brains.de>
+ *
+ * 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.
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <errno.h>
+
+#include <rtems/libio.h>
+
+int mount_and_make_target_path(
+ const char *source,
+ const char *target,
+ const char *filesystemtype,
+ rtems_filesystem_options_t options,
+ const void *data
+)
+{
+ int rv = -1;
+
+ if (target != NULL) {
+ rv = rtems_mkdir(target, S_IRWXU | S_IRWXG | S_IRWXO);
+ if (rv == 0) {
+ rv = mount(
+ source,
+ target,
+ filesystemtype,
+ options,
+ data
+ );
+ }
+ } else {
+ errno = EINVAL;
+ }
+
+ return rv;
+}