summaryrefslogtreecommitdiffstats
path: root/cpukit/libcsupport/src/mount-mktgt.c
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/libcsupport/src/mount-mktgt.c
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/libcsupport/src/mount-mktgt.c')
-rw-r--r--cpukit/libcsupport/src/mount-mktgt.c56
1 files changed, 56 insertions, 0 deletions
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;
+}