source: network-demos/nfsClientTest/init.c @ c8d1675

4.11network-demos-4-10-branchnetwork-demos-4-8-branchnetwork-demos-4-9-branch
Last change on this file since c8d1675 was c8d1675, checked in by Joel Sherrill <joel.sherrill@…>, on Jul 16, 2007 at 3:32:18 PM

2007-07-16 Joel Sherrill <joel.sherrill@…>

Initial add of NFS Client test.

  • .cvsignore, Makefile, dirutils.c, init.c, rootfs/rtems_logo.jpg: New files.
  • Property mode set to 100644
File size: 3.6 KB
Line 
1/*  Init
2 *
3 *  This routine is the initialization task for this test program.
4 *
5 *  Don't forget to change the IP addresses
6 */
7
8#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
9#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
10#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
11#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS        20
12#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
13
14#define CONFIGURE_MEMORY_OVERHEAD       256
15#define CONFIGURE_MESSAGE_BUFFER_MEMORY 32 * 1024
16#define CONFIGURE_MAXIMUM_SEMAPHORES    40
17#define CONFIGURE_MAXIMUM_TASKS         20
18#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES        20
19
20#define CONFIGURE_MICROSECONDS_PER_TICK 1000
21
22#define CONFIGURE_INIT_TASK_STACK_SIZE  (64*1024)
23#define CONFIGURE_INIT_TASK_PRIORITY    120
24#define CONFIGURE_INIT_TASK_ATTRIBUTES    RTEMS_FLOATING_POINT
25#define CONFIGURE_INIT_TASK_INITIAL_MODES (RTEMS_PREEMPT | \
26                                           RTEMS_NO_TIMESLICE | \
27                                           RTEMS_NO_ASR | \
28                                           RTEMS_INTERRUPT_LEVEL(0))
29
30#define CONFIGURE_MAXIMUM_DRIVERS 10
31#define CONFIGURE_INIT
32
33#include <rtems.h>
34#include <librtemsNfs.h>
35
36/* functions */
37
38rtems_task Init(
39  rtems_task_argument argument
40);
41
42/* configuration information */
43
44#include <rtems/confdefs.h>
45#include <bsp.h>
46
47#include <errno.h>
48#include <time.h>
49
50#include <rtems/confdefs.h>
51#include <stdio.h>
52#include <rtems/rtems_bsdnet.h>
53#include <rtems/ftpd.h>
54#include <rtems/untar.h>
55
56     
57#include <rtems/error.h>
58#include <rpc/rpc.h>
59#include <netinet/in.h>
60#include <time.h>
61
62#include <arpa/inet.h>
63#include <sys/socket.h>
64#include "../networkconfig.h"
65
66#include <rtems_webserver.h>
67
68#define ARGUMENT 0
69
70/*
71 *  The tarfile is built automatically externally so we need to account
72 *  for the leading symbol on the names.
73 */
74#if defined(__sh__)
75  #define SYM(_x) _x
76#else
77  #define SYM(_x) _ ## _x
78#endif
79
80extern int SYM(binary_tarfile_start);
81extern int SYM(binary_tarfile_size);
82#define TARFILE_START SYM(binary_tarfile_start)
83#define TARFILE_SIZE SYM(binary_tarfile_size)
84
85rtems_task Init(
86  rtems_task_argument argument
87)
88{
89  rtems_status_code status;
90  int int_status;
91
92  printf("\n\n*** NFS Client TEST ***\n\r" );
93
94  printf( "Free space %d\n", malloc_free_space() );
95  /*
96   * Load filesystem image
97   */
98  printf("=============== Loading filesystem image ===============\n");
99  status = Untar_FromMemory((void *)(&TARFILE_START), (size_t)&TARFILE_SIZE);
100   
101  printf("============== Look at Local Filesystem ==============\n");
102  printf( "PWD: " );
103  pwd(); 
104 
105  printf( "\nls /\n" );
106  ls("/");
107
108  printf( "\nls /etc\n" );
109  ls("/etc");
110
111  printf("============== Initializing Network ==============\n");
112  rtems_bsdnet_initialize_network ();
113
114  printf("============== Initializing RPC ==============\n");
115  int_status = rpcUdpInit();
116  if ( int_status )
117    printf( "RPC UDP Initialization failed\n" );
118
119  printf("============== Initializing NFS Subsystem ==============\n");
120  nfsInit( 0, 0 );
121
122  printf("============== Mounting Remote Filesystem ==============\n");
123#if 0
124  int_status = nfsMount("192.168.1.210", "/home", "/home" );
125#else
126  int_status = mount(
127    NULL,                        /* mount_table_entry_pointer */
128    &nfs_fs_ops,                 /* filesystem_operations_table_pointer */
129    RTEMS_FILESYSTEM_READ_WRITE, /* options */
130    "192.168.1.210:/home",       /* device aka remote filesystem */
131    "/home"                      /* mount_point */
132  );
133
134#endif
135
136  if ( int_status )
137    printf( "NFS Mount failed -- %s\n", strerror(errno) );
138
139  printf("============== Look at Remote Filesystem ==============\n");
140  printf( "\nls /home\n" );
141  ls("/home");
142
143  exit(0);
144
145  status = rtems_task_delete( RTEMS_SELF );
146}
147
Note: See TracBrowser for help on using the repository browser.