Ignore:
Timestamp:
Mar 13, 2017, 2:20:20 PM (3 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
ccd4a7f
Parents:
1becaa9
git-author:
Sebastian Huber <sebastian.huber@…> (03/13/17 14:20:20)
git-committer:
Sebastian Huber <sebastian.huber@…> (03/16/17 14:33:57)
Message:

dosfs: Fix fat_file_write()

Remove forced overwrite which leads to file data corruption. The logic
to determine a forced overwrite was fundamentally broken. For simplity,
disable this feature.

Update #2622.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • testsuites/fstests/fsdosfswrite01/init.c

    r1becaa9 re69ee36  
    126126  const char *file_name )
    127127{
    128   static const rtems_blkdev_stats complete_block_stats = {
     128  static const rtems_blkdev_stats complete_existing_block_stats = {
    129129    .read_hits            = 0,
    130130    .read_misses          = 0,
     
    136136    .write_errors         = 0
    137137  };
    138   static const rtems_blkdev_stats new_block_stats = {
    139     .read_hits            = 8,
     138  static const rtems_blkdev_stats complete_new_block_stats = {
     139    .read_hits            = 3,
    140140    .read_misses          = 2,
    141141    .read_ahead_transfers = 0,
     
    143143    .read_errors          = 0,
    144144    .write_transfers      = 1,
    145     .write_blocks         = 4,
     145    .write_blocks         = 3,
     146    .write_errors         = 0
     147  };
     148  static const rtems_blkdev_stats partial_new_block_stats = {
     149    .read_hits            = 3,
     150    .read_misses          = 3,
     151    .read_ahead_transfers = 0,
     152    .read_blocks          = 3,
     153    .read_errors          = 0,
     154    .write_transfers      = 1,
     155    .write_blocks         = 3,
    146156    .write_errors         = 0
    147157  };
     
    175185  rtems_test_assert( (ssize_t) cluster_size == num_bytes );
    176186
    177   check_block_stats( dev_name, mount_dir, &complete_block_stats );
     187  check_block_stats( dev_name, mount_dir, &complete_existing_block_stats );
    178188  reset_block_stats( dev_name, mount_dir );
    179189
     190  /* Write a complete cluster into a new file space */
    180191  num_bytes = write( fd, cluster_buf, cluster_size );
    181192  rtems_test_assert( (ssize_t) cluster_size == num_bytes );
     193
     194  check_block_stats( dev_name, mount_dir, &complete_new_block_stats );
     195  reset_block_stats( dev_name, mount_dir );
    182196
    183197  /* Write a new partial cluster into a new file space */
     
    185199  rtems_test_assert( num_bytes == 1 );
    186200
    187   check_block_stats( dev_name, mount_dir, &new_block_stats );
     201  check_block_stats( dev_name, mount_dir, &partial_new_block_stats );
    188202
    189203  rv = close( fd );
Note: See TracChangeset for help on using the changeset viewer.