summaryrefslogtreecommitdiffstats
path: root/cpukit/libmisc/fsmount
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2010-06-08 12:59:51 +0000
committerSebastian Huber <sebastian.huber@embedded-brains.de>2010-06-08 12:59:51 +0000
commiteaee27b0b9b9dd243512e10ff8988ec66751474a (patch)
tree3265b365c2285f4060b8ad97c6428da020de72d8 /cpukit/libmisc/fsmount
parent2010-06-08 Sebastian Huber <sebastian.huber@embedded-brains.de> (diff)
downloadrtems-eaee27b0b9b9dd243512e10ff8988ec66751474a.tar.bz2
2010-06-08 Sebastian Huber <sebastian.huber@embedded-brains.de>
PR 1524/filesystem * libcsupport/src/rtems_mkdir.c: New file. * libcsupport/src/Makefile.am: Reflect change above. * libcsupport/include/rtems/libio.h: Added rtems_mkdir(). * libmisc/fsmount/fsmount.h, libmisc/fsmount/fsmount.c, libblock/src/bdpart-mount.c, libnetworking/rtems/mkrootfs.h, libnetworking/rtems/mkrootfs.c, libfs/src/pipe/pipe.c: Use rtems_mkdir(). Removed rtems_fsmount_create_mount_point() and rtems_rootfs_mkdir().
Diffstat (limited to 'cpukit/libmisc/fsmount')
-rw-r--r--cpukit/libmisc/fsmount/fsmount.c76
-rw-r--r--cpukit/libmisc/fsmount/fsmount.h14
2 files changed, 4 insertions, 86 deletions
diff --git a/cpukit/libmisc/fsmount/fsmount.c b/cpukit/libmisc/fsmount/fsmount.c
index 5fa52e99f2..1d82b94391 100644
--- a/cpukit/libmisc/fsmount/fsmount.c
+++ b/cpukit/libmisc/fsmount/fsmount.c
@@ -34,83 +34,11 @@
#include <rtems.h>
#include <rtems/fsmount.h>
+#include <rtems/libio.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
-#include <rtems/imfs.h>
-#include <sys/stat.h>
-
-/*=========================================================================*\
-| Function: |
-\*-------------------------------------------------------------------------*/
-int rtems_fsmount_create_mount_point
-(
-/*-------------------------------------------------------------------------*\
-| Purpose: |
-| This function will create the mount point given |
-+---------------------------------------------------------------------------+
-| Input Parameters: |
-\*-------------------------------------------------------------------------*/
- const char *mount_point
- )
-/*-------------------------------------------------------------------------*\
-| Return Value: |
-| 0, if success, -1 and errno if failed |
-\*=========================================================================*/
-{
- int rc = 0;
- char *tok_buffer = NULL;
- char *token = NULL;
- int token_len;
- size_t total_len;
- IMFS_token_types token_type;
- struct stat file_info;
- /*
- * allocate temp memory to rebuild path name
- */
- tok_buffer = calloc(strlen(mount_point)+1,sizeof(char));
- if ( !tok_buffer )
- return -1;
- token = tok_buffer;
- total_len = 0;
- do {
- /*
- * scan through given string, one segment at a time
- */
- token_type = IMFS_get_token(
- mount_point+total_len,
- strlen(mount_point+total_len),
- token,
- &token_len
- );
- total_len += token_len;
- strncpy(tok_buffer,mount_point,total_len);
- tok_buffer[total_len] = '\0';
-
- if ((token_type != IMFS_NO_MORE_PATH) &&
- (token_type != IMFS_CURRENT_DIR) &&
- (token_type != IMFS_INVALID_TOKEN)) {
- /*
- * check, whether segment exists
- */
- if (0 != stat(tok_buffer,&file_info)) {
- /*
- * if not, create directory
- */
- rc = mknod(tok_buffer,S_IRWXU | S_IRWXG | S_IRWXO | S_IFDIR,0);
- }
- }
- } while ((rc == 0) &&
- (token_type != IMFS_NO_MORE_PATH) &&
- (token_type != IMFS_INVALID_TOKEN));
-
- /*
- * return token buffer to heap. Verified to be non-NULL when calloc'ed.
- */
- free(tok_buffer);
- return rc;
-}
/*=========================================================================*\
| Function: |
@@ -148,7 +76,7 @@ int rtems_fsmount
* create mount point
*/
if (tmp_rc == 0) {
- tmp_rc = rtems_fsmount_create_mount_point(fstab_ptr->target);
+ tmp_rc = rtems_mkdir(fstab_ptr->target, S_IRWXU | S_IRWXG | S_IRWXO);
if (tmp_rc != 0) {
if (0 != (fstab_ptr->report_reasons & FSMOUNT_MNTPNT_CRTERR)) {
fprintf(stdout,"fsmount: creation of mount point \"%s\" failed: %s\n",
diff --git a/cpukit/libmisc/fsmount/fsmount.h b/cpukit/libmisc/fsmount/fsmount.h
index 15597c31ff..94c8508358 100644
--- a/cpukit/libmisc/fsmount/fsmount.h
+++ b/cpukit/libmisc/fsmount/fsmount.h
@@ -121,24 +121,14 @@ typedef struct {
} rtems_fstab_entry;
/**
- * Creates the mount point with path @a mount_point.
- *
- * On success, zero is returned. On error, -1 is returned, and @c errno is set
- * appropriately.
- *
- * @see rtems_fsmount().
- */
-int rtems_fsmount_create_mount_point(const char *mount_point);
-
-/**
* Mounts the file systems listed in the file system mount table @a fstab of
* size @a size.
*
* Each file system will be mounted according to its table entry parameters.
* In case of an abort condition the corresponding table index will be reported
* in @a abort_index. The pointer @a abort_index may be @c NULL. The mount
- * point paths will be created with rtems_fsmount_create_mount_point() and need
- * not exist beforehand.
+ * point paths will be created with rtems_mkdir() and need not exist
+ * beforehand.
*
* On success, zero is returned. On error, -1 is returned, and @c errno is set
* appropriately.