Changeset a45dfa14 in rtems


Ignore:
Timestamp:
Feb 20, 2015, 8:42:15 AM (4 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
dc9aaf7
Parents:
5eb27ce
Message:

IMFS: Fix copy on write for linfiles

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libfs/src/imfs/imfs_linfile.c

    r5eb27ce ra45dfa14  
    6464    file->Memfile.doubly_indirect = 0;
    6565    file->Memfile.triply_indirect = 0;
     66
     67    IMFS_Set_handlers( &iop->pathinfo );
     68
    6669    if ((count != 0)
    6770     && (IMFS_memfile_write(&file->Memfile, 0, buffer, count) == -1))
  • testsuites/libtests/tar02/init.c

    r5eb27ce ra45dfa14  
    2323#include <fcntl.h>
    2424#include <unistd.h>
     25#include <string.h>
    2526
    2627#include "initial_filesystem_tar.h"
     
    3536#define TARFILE_SIZE  initial_filesystem_tar_size
    3637
     38static const char file[] = "/home/test_file";
     39
     40static const char content_0[] =
     41  "This is a test of loading an RTEMS filesystem from an\n"
     42  "initial tar image.\n";
     43
     44static const char content_1[] =
     45  "This is a test of loading an RTEMS filesystem from an\n"
     46  "initial tar image.\n"
     47  "And some other stuff.\n";
     48
     49static char buf[sizeof(content_1) - 1];
     50
     51static void check_file(
     52  const char *file,
     53  const char *expected_content,
     54  char *buf,
     55  size_t size
     56)
     57{
     58  int fd;
     59  ssize_t n;
     60  int rv;
     61
     62  fd = open(file, O_RDONLY);
     63  rtems_test_assert(fd >= 0);
     64
     65  n = read(fd, buf, size);
     66  rtems_test_assert(n == (ssize_t) size);
     67
     68  rtems_test_assert(memcmp(expected_content, buf, size) == 0);
     69
     70  rv = close(fd);
     71  rtems_test_assert(rv == 0);
     72}
     73
     74static void write_file(
     75  const char *file,
     76  const char *content,
     77  size_t size
     78)
     79{
     80  int fd;
     81  ssize_t n;
     82  int rv;
     83
     84  fd = open(file, O_WRONLY);
     85  rtems_test_assert(fd >= 0);
     86
     87  n = write(fd, content, size);
     88  rtems_test_assert(n == (ssize_t) size);
     89
     90  rv = close(fd);
     91  rtems_test_assert(rv == 0);
     92}
     93
     94/* FIXME */
    3795void test_cat(
    38   char *file,
    39   int   offset_arg,
    40   int   length
     96  const char *file,
     97  int         offset_arg,
     98  int         length
    4199);
    42100
     
    55113  /******************/
    56114  printf( "========= /home/test_file =========\n" );
    57   test_cat( "/home/test_file", 0, 0 );
    58  
     115  test_cat(&file[0], 0, 0);
     116  check_file(&file[0], &content_0[0], &buf[0], sizeof(content_0) - 1);
     117  write_file(&file[0], &content_1[0], sizeof(content_1) - 1);
     118  check_file(&file[0], &content_1[0], &buf[0], sizeof(content_1) - 1);
     119
    59120  /******************/
    60121  printf( "========= /symlink =========\n" );
  • testsuites/libtests/tar02/tar02.scn

    r5eb27ce ra45dfa14  
    88(0)This is a test of loading an RTEMS filesystem from an
    99initial tar image.
     10And some other stuff.
    1011
    1112*** END OF TEST TAR 2 ***
Note: See TracChangeset for help on using the changeset viewer.