1 /* This FileX test concentrates on the unicode operations.  */
2 
3 #ifndef FX_STANDALONE_ENABLE
4 #include   "tx_api.h"
5 #endif
6 #include   "fx_api.h"
7 #include   "fx_utility.h"
8 #include   <stdio.h>
9 #include   "fx_ram_driver_test.h"
10 
11 #define     DEMO_STACK_SIZE         8192
12 #define     CACHE_SIZE              16*128
13 
14 /* Define the ThreadX and FileX object control blocks...  */
15 
16 #ifndef FX_STANDALONE_ENABLE
17 static TX_THREAD                ftest_0;
18 #endif
19 static FX_MEDIA                 ram_disk;
20 
21 
22 static UCHAR                    short_unicode_name[] =  {1, 0, 0, 0};
23 static UCHAR                    directory_name[] =      {3, 0, 4, 0, 5, 0, 6, 0, 0, 0};
24 static UCHAR                    long_unicode_name[] =   {2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 8, 0, 9, 0, 10, 0, 11, 0, 12, 0, 13, 0, 14, 0, 15, 0, 0, 0};
25 static UCHAR                    destination_name[100];
26 static UCHAR                    does_not_exist[] =      {1, 1, 1, 1};
27 
28 static UCHAR                    unicode_temp_long_file_name[FX_MAX_LONG_NAME_LEN];
29 
30 /* Define the counters used in the test application...  */
31 
32 #ifndef FX_STANDALONE_ENABLE
33 static UCHAR                    *ram_disk_memory;
34 static UCHAR                    *cache_buffer;
35 #else
36 static UCHAR                     cache_buffer[CACHE_SIZE];
37 #endif
38 
39 /* Define thread prototypes.  */
40 
41 void    filex_unicode_application_define(void *first_unused_memory);
42 static void    ftest_0_entry(ULONG thread_input);
43 
44 VOID  _fx_ram_driver(FX_MEDIA *media_ptr);
45 void  test_control_return(UINT status);
46 
47 #ifndef FX_ENABLE_FAULT_TOLERANT
48 /* Calculate the times driver was called to raise error at a particular time. */
49 static INT                      driver_called_counter = 0;
50 
51 /* Create a terrible driver. */
_fx_terrible_driver(FX_MEDIA * media_ptr)52 static void _fx_terrible_driver(FX_MEDIA *media_ptr)
53 {
54     driver_called_counter++;
55 
56     /* Make IO error to cover the branch at Line 247 in fx_unicode_file_create.c */
57     if ( driver_called_counter != 61)
58         (* _fx_ram_driver)(media_ptr);
59     else
60         media_ptr -> fx_media_driver_status = FX_IO_ERROR;
61 
62     return;
63 }
64 #endif /* FX_ENABLE_FAULT_TOLERANT */
65 
66 /* Define what the initial system looks like.  */
67 
68 #ifdef CTEST
test_application_define(void * first_unused_memory)69 void test_application_define(void *first_unused_memory)
70 #else
71 void    filex_unicode_application_define(void *first_unused_memory)
72 #endif
73 {
74 #ifndef FX_STANDALONE_ENABLE
75 UCHAR    *pointer;
76 
77     /* Setup the working pointer.  */
78     pointer =  (UCHAR *) first_unused_memory;
79 
80     /* Create the main thread.  */
81 
82     tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0,
83             pointer, DEMO_STACK_SIZE,
84             4, 4, TX_NO_TIME_SLICE, TX_AUTO_START);
85 
86     pointer =  pointer + DEMO_STACK_SIZE;
87 
88     /* Setup memory for the RAM disk and the sector cache.  */
89     cache_buffer =  pointer;
90     pointer =  pointer + CACHE_SIZE;
91     ram_disk_memory =  pointer;
92 #endif
93 
94     /* Initialize the FileX system.  */
95     fx_system_initialize();
96 #ifdef FX_STANDALONE_ENABLE
97     ftest_0_entry(0);
98 #endif
99 }
100 
101 
102 
103 /* Define the test threads.  */
104 
ftest_0_entry(ULONG thread_input)105 static void    ftest_0_entry(ULONG thread_input)
106 {
107 
108 UINT        status;
109 ULONG       length;
110 ULONG       ul_temp;
111 UCHAR       buffer[512];
112 UINT        i;
113 
114     FX_PARAMETER_NOT_USED(thread_input);
115 
116     /* Print out some test information banners.  */
117     printf("FileX Test:   Unicode test...........................................");
118 
119     /* Format the media.  This needs to be done before opening it!  */
120     status =  fx_media_format(&ram_disk,
121                             _fx_ram_driver,         // Driver entry
122                             ram_disk_memory,        // RAM disk memory pointer
123                             cache_buffer,           // Media buffer pointer
124                             CACHE_SIZE,             // Media buffer size
125                             "MY_RAM_DISK",          // Volume Name
126                             1,                      // Number of FATs
127                             100,                    // Directory Entries
128                             0,                      // Hidden sectors
129                             512,                    // Total sectors
130                             128,                    // Sector size
131                             1,                      // Sectors per cluster
132                             1,                      // Heads
133                             1);                     // Sectors per track
134 
135     /* Determine if the format had an error.  */
136     if (status)
137     {
138 
139         printf("ERROR!\n");
140         test_control_return(1);
141     }
142 
143     /* try to do all the unicode commands before the media is opened to generate an error */
144     length = 1;
145 
146     /* short name get */
147     status = fx_unicode_short_name_get(&ram_disk, directory_name, length, (CHAR *) destination_name);
148     if (status != FX_MEDIA_NOT_OPEN)
149     {
150         printf("ERROR!\n");
151         test_control_return(2);
152     }
153 
154     /* Call extended version of short name get.  */
155     status = fx_unicode_short_name_get_extended(&ram_disk, directory_name, length, (CHAR*)destination_name, sizeof(destination_name));
156     if (status != FX_MEDIA_NOT_OPEN)
157     {
158         printf("ERROR!\n");
159         test_control_return(2);
160     }
161 
162     /* name get */
163     status = fx_unicode_name_get(&ram_disk, (CHAR *) destination_name, destination_name, &length);
164     if (status != FX_MEDIA_NOT_OPEN)
165     {
166         printf("ERROR!\n");
167         test_control_return(3);
168     }
169 
170     /* Call extended version of name get.  */
171     status = fx_unicode_name_get_extended(&ram_disk, (CHAR*)destination_name, destination_name, &length, sizeof(destination_name));
172     if (status != FX_MEDIA_NOT_OPEN)
173     {
174         printf("ERROR!\n");
175         test_control_return(3);
176     }
177 
178     /* create */
179     status = fx_unicode_directory_create(&ram_disk,  directory_name, length, (CHAR *) destination_name);
180     if (status != FX_MEDIA_NOT_OPEN)
181     {
182         printf("ERROR!\n");
183         test_control_return(4);
184     }
185 
186     /* file create */
187     status =  fx_unicode_file_create(&ram_disk, short_unicode_name, length, (CHAR *) destination_name);
188     if (status != FX_MEDIA_NOT_OPEN)
189     {
190         printf("ERROR!\n");
191         test_control_return(5);
192     }
193 
194     /* Open the ram_disk.  */
195     status =  fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE);
196 
197     /* Check the status.  */
198     if (status != FX_SUCCESS)
199     {
200 
201         /* Error, return error code.  */
202         printf("ERROR!\n");
203         test_control_return(6);
204     }
205 
206     /* try to create a directory while the media is write protected */
207     ram_disk.fx_media_driver_write_protect = FX_TRUE;
208     status = fx_unicode_directory_create(&ram_disk,  directory_name, length, (CHAR *) destination_name);
209     if (status != FX_WRITE_PROTECT)
210     {
211         printf("ERROR!\n");
212         test_control_return(7);
213     }
214 
215     /* try to create a file while the media is write protected */
216     status =  fx_unicode_file_create(&ram_disk, short_unicode_name, length, (CHAR *) destination_name);
217     if (status != FX_WRITE_PROTECT)
218     {
219         printf("ERROR!\n");
220         test_control_return(8);
221     }
222     ram_disk.fx_media_driver_write_protect = FX_FALSE;
223 
224     /* only test this if error checking is enabled */
225 #ifndef FX_DISABLE_ERROR_CHECKING
226     /* send a null pointer to generate an error */
227     /* short name get */
228     status = fx_unicode_short_name_get(FX_NULL, directory_name, length, (CHAR *) destination_name);
229     if (status != FX_PTR_ERROR)
230     {
231         printf("ERROR!\n");
232         test_control_return(9);
233     }
234 
235     /* name get */
236     status = fx_unicode_name_get(FX_NULL, (CHAR *) destination_name, destination_name, &length);
237     if (status != FX_PTR_ERROR)
238     {
239         printf("ERROR!\n");
240         test_control_return(10);
241     }
242 
243     /* file create */
244     status = fx_unicode_file_create(FX_NULL, short_unicode_name, length, (CHAR *) destination_name);
245     if (status != FX_PTR_ERROR)
246     {
247         printf("ERROR!\n");
248         test_control_return(11);
249     }
250 #endif /* FX_DISABLE_ERROR_CHECKING */
251 
252     /* Create the a short and long unicode file name.  */
253     length =  fx_unicode_length_get(short_unicode_name);
254     status =  fx_unicode_file_create(&ram_disk, short_unicode_name, length, (CHAR *) destination_name);
255     length =  fx_unicode_length_get(long_unicode_name);
256     status += fx_unicode_file_create(&ram_disk, long_unicode_name, length, (CHAR *) destination_name);
257     status += fx_file_create(&ram_disk, "abcdefghijklmnop");
258     status += fx_directory_short_name_get(&ram_disk, "abcdefghijklmnop", (CHAR *) destination_name);
259     status += fx_media_flush(&ram_disk);
260 
261     /* Check for erros.  */
262     if (status != FX_SUCCESS)
263     {
264 
265         /* Error creating unicode file names.  Return to caller.  */
266         printf("ERROR!\n");
267         test_control_return(13);
268     }
269 
270     /* Try to create the same name again - this should result in an error!  */
271     length =  fx_unicode_length_get(long_unicode_name);
272     status += fx_unicode_file_create(&ram_disk, long_unicode_name, length, (CHAR *) destination_name);
273 
274     /* Check for expected error.  */
275     if (status != FX_ALREADY_CREATED)
276     {
277 
278         /* Error creating unicode file names.  Return to caller.  */
279         printf("ERROR!\n");
280         test_control_return(14);
281     }
282 
283     /* Try creating a unicode name twice... this should result in an error as well.  */
284     length =  fx_unicode_length_get(short_unicode_name);
285     status =  fx_unicode_file_create(&ram_disk, short_unicode_name, length, (CHAR *) destination_name);
286 
287     /* Check for expected error.  */
288     if (status != FX_ALREADY_CREATED)
289     {
290 
291         /* Error creating unicode file names.  Return to caller.  */
292         printf("ERROR!\n");
293         test_control_return(15);
294     }
295 
296     /* Only run this if error checking is enabled */
297 #ifndef FX_DISABLE_ERROR_CHECKING
298     /* send null pointer to generate an error */
299     status = fx_unicode_directory_create(FX_NULL,  directory_name, length, (CHAR *) destination_name);
300     if (status != FX_PTR_ERROR)
301     {
302         printf("ERROR!\n");
303         test_control_return(16);
304     }
305 #endif /* FX_DISABLE_ERROR_CHECKING */
306 
307     /* Create the unicode directory name to create the same unicode file names in the sub directory.  */
308     length =  fx_unicode_length_get(directory_name);
309     status =  fx_unicode_directory_create(&ram_disk,  directory_name, length, (CHAR *) destination_name);
310     status += fx_file_create(&ram_disk, "qrstuvwxyz");
311 
312     /* Check for erros.  */
313     if (status != FX_SUCCESS)
314     {
315 
316         /* Error creating unicode directory.  Return to caller.  */
317         printf("ERROR!\n");
318         test_control_return(17);
319     }
320 
321     /* Attempt to create the unicode sub-directory again.  */
322     status =  fx_unicode_directory_create(&ram_disk,  directory_name, length, (CHAR *) destination_name);
323 
324     /* Check for expected error.  */
325     if (status != FX_ALREADY_CREATED)
326     {
327 
328         /* Error creating unicode directory name.  Return to caller.  */
329         printf("ERROR!\n");
330         test_control_return(18);
331     }
332 
333     /* Ask for the name of something that does not exist to generate an error. */
334     ul_temp = length;
335     status = fx_unicode_short_name_get(&ram_disk, does_not_exist, length, (CHAR *) destination_name);
336     if (status == FX_SUCCESS)
337     {
338         printf("ERROR!\n");
339         test_control_return(19);
340     }
341     status = fx_unicode_name_get(&ram_disk, (CHAR *) does_not_exist, destination_name, &length);
342     if (status == FX_SUCCESS)
343     {
344         printf("ERROR!\n");
345         test_control_return(20);
346     }
347     length = ul_temp;
348 
349     /* Now, pickup the short name for the unicode directory so we can set the default path there and
350        do the same thing from a sub-directory.  */
351     status =  fx_unicode_short_name_get(&ram_disk, directory_name, length, (CHAR *) destination_name);
352     status += fx_directory_default_set(&ram_disk, (CHAR *) destination_name);
353     length =  fx_unicode_length_get(short_unicode_name);
354     status =  fx_unicode_file_create(&ram_disk, short_unicode_name, length, (CHAR *) destination_name);
355     length =  fx_unicode_length_get(long_unicode_name);
356     status += fx_unicode_file_create(&ram_disk, long_unicode_name, length, (CHAR *) destination_name);
357     status += fx_file_create(&ram_disk, "abcdefghijklmnop");
358     length =  fx_unicode_length_get(directory_name);
359     status += fx_unicode_directory_create(&ram_disk,  directory_name, length, (CHAR *) destination_name);
360     status += fx_file_create(&ram_disk, "qrstuvwxyz");
361     status += fx_media_flush(&ram_disk);
362 
363     /* Check for erros.  */
364     if (status != FX_SUCCESS)
365     {
366 
367         /* Error creating unicode file and directory names in a sub-directory.  Return to caller.  */
368         printf("ERROR!\n");
369         test_control_return(21);
370     }
371 
372 
373     /* Test the short/long name get routines with the short unicode name.  */
374     length =  fx_unicode_length_get(short_unicode_name);
375     status += fx_unicode_short_name_get(&ram_disk, short_unicode_name, length, (CHAR *) destination_name);
376     status += fx_unicode_name_get(&ram_disk, (CHAR *) destination_name, destination_name, &length);
377 
378     /* Check for errors.  */
379     if ((status) || (length != fx_unicode_length_get(short_unicode_name)))
380     {
381 
382         /* Error getting unicode file and short names in a sub-directory.  Return to caller.  */
383         printf("ERROR!\n");
384         test_control_return(22);
385     }
386 
387     /* Test the short/long name get routines with the long unicode name.  */
388     length =  fx_unicode_length_get(long_unicode_name);
389     status += fx_unicode_short_name_get(&ram_disk, long_unicode_name, length, (CHAR *) destination_name);
390     status += fx_unicode_name_get(&ram_disk, (CHAR *) destination_name, destination_name, &length);
391 
392     /* Check for errors.  */
393     if ((status) || (length != fx_unicode_length_get(long_unicode_name)))
394     {
395 
396         /* Error getting unicode file and short names in a sub-directory.  Return to caller.  */
397         printf("ERROR!\n");
398         test_control_return(23);
399     }
400 
401     /* Test the short/long name get routines with the directory unicode name.  */
402     length =  fx_unicode_length_get(directory_name);
403     status += fx_unicode_short_name_get(&ram_disk, directory_name, length, (CHAR *) destination_name);
404     status += fx_unicode_name_get(&ram_disk, (CHAR *) destination_name, destination_name, &length);
405 
406     /* Check for errors.  */
407     if ((status) || (length != fx_unicode_length_get(directory_name)))
408     {
409 
410         /* Error getting unicode file and short names in a sub-directory.  Return to caller.  */
411         printf("ERROR!\n");
412         test_control_return(24);
413     }
414 
415     /* Now delete everything in the sub-directory.  */
416     status += fx_unicode_short_name_get(&ram_disk, directory_name, length, (CHAR *) destination_name);
417     status += fx_directory_delete(&ram_disk, (CHAR *) destination_name);
418     status += fx_file_delete(&ram_disk, "qrstuvwxyz");
419     status += fx_file_delete(&ram_disk, "abcdefghijklmnop");
420     length =  fx_unicode_length_get(long_unicode_name);
421     status += fx_unicode_short_name_get(&ram_disk, long_unicode_name, length, (CHAR *) destination_name);
422     status += fx_file_delete(&ram_disk, (CHAR *) destination_name);
423     length =  fx_unicode_length_get(short_unicode_name);
424     status += fx_unicode_short_name_get(&ram_disk, short_unicode_name, length, (CHAR *) destination_name);
425     status += fx_file_delete(&ram_disk, (CHAR *) destination_name);
426 
427     /* Check for erros.  */
428     if (status != FX_SUCCESS)
429     {
430 
431         /* Error deleting unicode file and directory names in a sub-directory.  Return to caller.  */
432         printf("ERROR!\n");
433         test_control_return(25);
434     }
435 
436 
437    /* Move the directory default back to the root.  */
438     status += fx_directory_default_set(&ram_disk, "/");
439 
440     /* Test the short/long name get routines with the short unicode name.  */
441     length =  fx_unicode_length_get(short_unicode_name);
442     status += fx_unicode_short_name_get(&ram_disk, short_unicode_name, length, (CHAR *) destination_name);
443     status += fx_unicode_name_get(&ram_disk, (CHAR *) destination_name, destination_name, &length);
444 
445     /* Check for errors.  */
446     if ((status) || (length != fx_unicode_length_get(short_unicode_name)))
447     {
448 
449         /* Error getting unicode file and short names in the root directory.  Return to caller.  */
450         printf("ERROR!\n");
451         test_control_return(26);
452     }
453 
454     /* Test the short/long name get routines with the long unicode name.  */
455     length =  fx_unicode_length_get(long_unicode_name);
456     status += fx_unicode_short_name_get(&ram_disk, long_unicode_name, length, (CHAR *) destination_name);
457     status += fx_unicode_name_get(&ram_disk, (CHAR *) destination_name, destination_name, &length);
458 
459     /* Check for errors.  */
460     if ((status) || (length != fx_unicode_length_get(long_unicode_name)))
461     {
462 
463         /* Error getting unicode file and short names in the root directory.  Return to caller.  */
464         printf("ERROR!\n");
465         test_control_return(27);
466     }
467 
468     /* Test the short/long name get routines with the directory unicode name.  */
469     length =  fx_unicode_length_get(directory_name);
470     status += fx_unicode_short_name_get(&ram_disk, directory_name, length, (CHAR *) destination_name);
471     status += fx_unicode_name_get(&ram_disk, (CHAR *) destination_name, destination_name, &length);
472 
473     /* Check for errors.  */
474     if ((status) || (length != fx_unicode_length_get(directory_name)))
475     {
476 
477         /* Error getting unicode file and short names in the root directory.  Return to caller.  */
478         printf("ERROR!\n");
479         test_control_return(28);
480     }
481 
482     /* Delete the root directory contents.  */
483     status += fx_unicode_short_name_get(&ram_disk, directory_name, length, (CHAR *) destination_name);
484     status += fx_directory_delete(&ram_disk, (CHAR *) destination_name);
485     status += fx_file_delete(&ram_disk, "qrstuvwxyz");
486     status += fx_file_delete(&ram_disk, "abcdefghijklmnop");
487     length =  fx_unicode_length_get(long_unicode_name);
488     status += fx_unicode_short_name_get(&ram_disk, long_unicode_name, length, (CHAR *) destination_name);
489     status += fx_file_delete(&ram_disk, (CHAR *) destination_name);
490     length =  fx_unicode_length_get(short_unicode_name);
491     status += fx_unicode_short_name_get(&ram_disk, short_unicode_name, length, (CHAR *) destination_name);
492     status += fx_file_delete(&ram_disk, (CHAR *) destination_name);
493 
494     /* Check for errors.  */
495     if (status != FX_SUCCESS)
496     {
497 
498         /* Error getting unicode file and short names in the root directory.  Return to caller.  */
499         printf("ERROR!\n");
500         test_control_return(29);
501     }
502 
503     length = fx_unicode_length_get(short_unicode_name);
504     status = fx_unicode_file_create(&ram_disk, short_unicode_name, length, (CHAR*)destination_name);
505     length = fx_unicode_length_get(long_unicode_name);
506     status += fx_unicode_file_create(&ram_disk, long_unicode_name, length, (CHAR*)destination_name);
507 
508     length = fx_unicode_length_get((UCHAR*)"Z\01\02\03\0\0");
509     status += fx_file_create(&ram_disk, (CHAR*)"test");
510 
511     /* Check for errors.  */
512     if (status != FX_SUCCESS)
513     {
514 
515         /* Error creating unicode files.  Return to caller.  */
516         printf("ERROR!\n");
517         test_control_return(29);
518     }
519 
520     length = fx_unicode_length_get(long_unicode_name);
521     status = fx_unicode_short_name_get_extended(&ram_disk, long_unicode_name, length, (CHAR*)destination_name, 14);
522 
523     /* Check for error.  */
524     if (status != FX_SUCCESS)
525     {
526 
527         /* Error getting short name.  Return to caller.  */
528         printf("ERROR!\n");
529         test_control_return(29);
530     }
531 
532     /* Set unicode_temp_long_file_name and length to known state.  */
533     memcpy(unicode_temp_long_file_name, "ORIGINALSTRING", 15);
534     length = 0;
535     status = fx_unicode_name_get_extended(&ram_disk, (CHAR*)destination_name, (UCHAR*)unicode_temp_long_file_name, &length, 4);
536 
537     /* Check for error.  */
538     if ((status != FX_SUCCESS) || (length != 14) || (memcmp(unicode_temp_long_file_name, "\2\0\0\0INALSTRING\0", 15)))
539     {
540 
541         /* Error getting short name.  Return to caller.  */
542         printf("ERROR!\n");
543         test_control_return(29);
544     }
545 
546     status = fx_unicode_short_name_get_extended(&ram_disk, (UCHAR*)"t\0e\0s\0t\0\0", 4, (CHAR*)destination_name, 14);
547 
548     /* Check for error.  */
549     if (status != FX_SUCCESS)
550     {
551 
552         /* Error getting short name.  Return to caller.  */
553         printf("ERROR!\n");
554         test_control_return(29);
555     }
556 
557     /*  At the circumstance of the same lenth of unicode name,there are no more than 26 unicode names
558         with the first character ranging from 'a'to 'z'.If you create one more unicode name, an error will
559         occur.Now test this case */
560     length = fx_unicode_length_get(long_unicode_name);
561     unicode_temp_long_file_name[0] = 'z';
562 
563     for (i = 1; i < length; i++)
564     {
565 
566         /* Build temporary long file name.  */
567         unicode_temp_long_file_name[i] = (UCHAR)('0' + (i % 9));
568     }
569     unicode_temp_long_file_name[i] = FX_NULL;
570     for (i = 1; i < 27; i++)
571     {
572 
573         /* creat the same lenth  files but Them differ in the first character of file name.  */
574         status = fx_file_create(&ram_disk, (CHAR *)unicode_temp_long_file_name);
575         if (status)
576             break;
577         unicode_temp_long_file_name[0] = (UCHAR)('z' - i);
578     }
579     status = fx_unicode_file_create(&ram_disk, long_unicode_name, length, (CHAR *)destination_name);
580     if (status != FX_ALREADY_CREATED)
581     {
582         /* No spare name for unicode file names.  Return to caller.  */
583         printf("ERROR!\n");
584         test_control_return(30);
585     }
586 
587     /* Test the unicode length get that exceeds the maximum value.  */
588     for (i = 0; i < 512; i++)
589     {
590         buffer[i] = 'A';
591     }
592     length =  fx_unicode_length_get(buffer);
593     if (length != 128)
594     {
595 
596         printf("ERROR!\n");
597         test_control_return(31);
598     }
599 
600     /* Now test the NULL bytes being in different locations.  */
601     buffer[0] =  0;
602     buffer[3] =  0;
603     buffer[8] =  0;
604     buffer[9] =  0;
605 
606     length =  fx_unicode_length_get(buffer);
607     if (length != 4)
608     {
609 
610         printf("ERROR!\n");
611         test_control_return(32);
612     }
613 
614     /* Close the media.  */
615     status =  fx_media_close(&ram_disk);
616     return_value_if_fail( status == FX_SUCCESS, 33);
617 
618     /* Open the ram_disk.  */
619     status =  fx_media_open(&ram_disk, "RAM DISK", _fx_ram_driver, ram_disk_memory, cache_buffer, CACHE_SIZE);
620     return_value_if_fail( status == FX_SUCCESS, 34);
621 
622 #ifndef FX_ENABLE_FAULT_TOLERANT
623     /* Register our terrible driver. */
624     ram_disk.fx_media_driver_entry = _fx_terrible_driver;
625     short_unicode_name[0]++;
626     length = fx_unicode_length_get(short_unicode_name);
627     status = fx_unicode_file_create(&ram_disk, long_unicode_name, length, (CHAR *)destination_name);
628     ram_disk.fx_media_driver_entry = _fx_ram_driver;
629     return_value_if_fail( status == FX_IO_ERROR, 35);
630 #endif /* FX_ENABLE_FAULT_TOLERANT */
631 
632     /* Close the media.  */
633     status =  fx_media_close(&ram_disk);
634 
635     /* Determine if the test was successful.  */
636     return_value_if_fail( status == FX_SUCCESS, 36);
637 
638     printf("SUCCESS!\n");
639     test_control_return(0);
640 }
641