1 | /* |
---|
2 | * COPYRIGHT (c) 1989-2010. |
---|
3 | * On-Line Applications Research Corporation (OAR). |
---|
4 | * |
---|
5 | * The license and distribution terms for this file may be |
---|
6 | * found in the file LICENSE in this distribution or at |
---|
7 | * http://www.rtems.com/license/LICENSE. |
---|
8 | */ |
---|
9 | |
---|
10 | #ifdef HAVE_CONFIG_H |
---|
11 | #include "config.h" |
---|
12 | #endif |
---|
13 | |
---|
14 | #include <bsp.h> /* for device driver prototypes */ |
---|
15 | #include "tmacros.h" |
---|
16 | #include <rtems/imfs.h> |
---|
17 | #include <rtems/error.h> |
---|
18 | |
---|
19 | #include <stdio.h> |
---|
20 | #include <stdlib.h> |
---|
21 | #include <sys/types.h> |
---|
22 | #include <sys/stat.h> |
---|
23 | #include <fcntl.h> |
---|
24 | #include <unistd.h> |
---|
25 | |
---|
26 | #include "initial_filesystem_tar.h" |
---|
27 | |
---|
28 | #define TARFILE_START initial_filesystem_tar |
---|
29 | #define TARFILE_SIZE initial_filesystem_tar_size |
---|
30 | |
---|
31 | void test_cat( |
---|
32 | char *file, |
---|
33 | int offset_arg, |
---|
34 | int length |
---|
35 | ); |
---|
36 | |
---|
37 | void test_tarfs_load(void) |
---|
38 | { |
---|
39 | rtems_status_code sc; |
---|
40 | |
---|
41 | printf("Loading tarfs image ... "); |
---|
42 | sc = rtems_tarfs_load("/",(void *)TARFILE_START, TARFILE_SIZE); |
---|
43 | if (sc != RTEMS_SUCCESSFUL) { |
---|
44 | printf ("error: untar failed: %s\n", rtems_status_text (sc)); |
---|
45 | exit(1); |
---|
46 | } |
---|
47 | printf ("successful\n"); |
---|
48 | |
---|
49 | /******************/ |
---|
50 | printf( "========= /home/test_file =========\n" ); |
---|
51 | test_cat( "/home/test_file", 0, 0 ); |
---|
52 | |
---|
53 | /******************/ |
---|
54 | puts("*** Skipping symlink -- NOT CURRENTLY SUPPORTED ***" ); |
---|
55 | #if 0 |
---|
56 | printf( "========= /symlink =========\n" ); |
---|
57 | test_cat( "/symlink", 0, 0 ); |
---|
58 | #endif |
---|
59 | } |
---|
60 | |
---|
61 | rtems_task Init( |
---|
62 | rtems_task_argument ignored |
---|
63 | ) |
---|
64 | { |
---|
65 | printf( "\n\n*** TAR02 TEST ***\n" ); |
---|
66 | |
---|
67 | test_tarfs_load(); |
---|
68 | IMFS_dump(); |
---|
69 | |
---|
70 | printf( "*** END OF TAR02 TEST ***\n" ); |
---|
71 | exit( 0 ); |
---|
72 | } |
---|
73 | |
---|
74 | |
---|
75 | /* NOTICE: the clock driver is explicitly disabled */ |
---|
76 | #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER |
---|
77 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
---|
78 | |
---|
79 | #define CONFIGURE_MAXIMUM_TASKS 1 |
---|
80 | #define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM |
---|
81 | #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 5 |
---|
82 | |
---|
83 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
---|
84 | |
---|
85 | #define CONFIGURE_INIT |
---|
86 | #include <rtems/confdefs.h> |
---|