[rtems commit] dosfs: Fix device identifier

Sebastian Huber sebh at rtems.org
Tue Nov 27 11:46:33 UTC 2018


Module:    rtems
Branch:    master
Commit:    06331e4dcb2495d323964cde4a5835110a6ed023
Changeset: http://git.rtems.org/rtems/commit/?id=06331e4dcb2495d323964cde4a5835110a6ed023

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Nov 27 11:56:01 2018 +0100

dosfs: Fix device identifier

Update #3358.

---

 cpukit/libfs/src/dosfs/fat.c            |  2 +-
 testsuites/fstests/fsdosfsname01/init.c | 41 +++++++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+), 1 deletion(-)

diff --git a/cpukit/libfs/src/dosfs/fat.c b/cpukit/libfs/src/dosfs/fat.c
index cb45f91..8979065 100644
--- a/cpukit/libfs/src/dosfs/fat.c
+++ b/cpukit/libfs/src/dosfs/fat.c
@@ -505,7 +505,7 @@ fat_init_volume_info(fat_fs_info_t *fs_info, const char *device)
         rtems_set_errno_and_return_minus_one(ENXIO);
     }
 
-    vol->dev = stat_buf.st_dev;
+    vol->dev = stat_buf.st_rdev;
 
     /* Read boot record */
     /* FIXME: Asserts FAT_MAX_BPB_SIZE < bdbuf block size */
diff --git a/testsuites/fstests/fsdosfsname01/init.c b/testsuites/fstests/fsdosfsname01/init.c
index 90db282..1785b65 100644
--- a/testsuites/fstests/fsdosfsname01/init.c
+++ b/testsuites/fstests/fsdosfsname01/init.c
@@ -29,6 +29,7 @@
 #include <rtems/dosfs.h>
 #include <rtems/ramdisk.h>
 #include <rtems/libcsupport.h>
+#include <rtems/userenv.h>
 #include "image.h"
 #include "image_bin_le_singlebyte.h"
 #include "image_bin_le_multibyte.h"
@@ -1143,6 +1144,44 @@ static void test_file_with_same_name_as_volume_label( void )
   rtems_test_assert( rc == 0 );
 }
 
+static void test_getcwd( void )
+{
+  const char *dir_path = MOUNT_DIR "/somedir";
+  char cwd_buf[128];
+  char *cwd;
+  int rc;
+  rtems_status_code sc;
+
+  sc = rtems_libio_set_private_env();
+  rtems_test_assert( sc == RTEMS_SUCCESSFUL );
+
+  cwd = getcwd( cwd_buf, sizeof( cwd_buf ) );
+  rtems_test_assert( cwd != NULL );
+  rtems_test_assert( strcmp( cwd, "/" ) == 0 );
+
+  rc = mkdir( dir_path, S_IRWXU | S_IRWXG | S_IRWXO );
+  rtems_test_assert( rc == 0 );
+
+  rc = chdir( dir_path );
+  rtems_test_assert( rc == 0 );
+
+  cwd = getcwd( cwd_buf, sizeof( cwd_buf ) );
+  rtems_test_assert( cwd != NULL );
+  rtems_test_assert( strcmp( cwd, dir_path ) == 0 );
+
+  rc = chdir( "/" );
+  rtems_test_assert( rc == 0 );
+
+  rc = unlink( dir_path );
+  rtems_test_assert( rc == 0 );
+
+  cwd = getcwd( cwd_buf, sizeof( cwd_buf ) );
+  rtems_test_assert( cwd != NULL );
+  rtems_test_assert( strcmp( cwd, "/" ) == 0 );
+
+  rtems_libio_use_global_env();
+}
+
 static void test_special_cases( void )
 {
   test_end_of_string_matches();
@@ -1150,6 +1189,7 @@ static void test_special_cases( void )
   test_full_8_3_name();
   test_file_with_same_name_as_volume_label();
   test_dir_with_same_name_as_volume_label();
+  test_getcwd();
 }
 
 /*
@@ -1397,6 +1437,7 @@ size_t rtems_ramdisk_configuration_size = RTEMS_ARRAY_SIZE(rtems_ramdisk_configu
 #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
 #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
 #define CONFIGURE_MAXIMUM_SEMAPHORES (2 * RTEMS_DOSFS_SEMAPHORES_PER_INSTANCE)
+#define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS 2
 #define CONFIGURE_APPLICATION_EXTRA_DRIVERS RAMDISK_DRIVER_TABLE_ENTRY
 
 #define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK




More information about the vc mailing list