MFS

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
810 Views
netra
Contributor IV

I have Installed a device ram , under which I have installed a MFS named "s:"

Then I am uninstalling "s:".

I want to search all the files present in he device . so, I am opening ram using fopen & searching first file using ioctl , which is throwing error .

I am writing  a code to search a file from root directory.

mfs_ramdisk: is device driver , the directory is a:(only root directory is present no other directory is present)

error_code = ioctl(mfs_fd_ptr, IO_IOCTL_FIND_FIRST_FILE,(uint_32_ptr) &search);// I am getting error in this statement , it is failing and not displying any files searched 





mfs_fd_ptr = fopen("ramdisk:", NULL);

    if (mfs_fd_ptr == NULL)

    {

printf("Error opening the MFS device driver!");
return;

    }

   error_code = ioctl(mfs_fd_ptr, IO_IOCTL_FIND_FIRST_FILE,(uint_32_ptr) &search);

    while (error_code == MFS_NO_ERROR)

    {

error_code = ioctl(mfs_fd_ptr, IO_IOCTL_FIND_NEXT_FILE,(uint_32_ptr) &search_data);

    }

    fclose(mfs_fd_ptr);




Thanks in advance

Labels (1)
Tags (3)
0 Kudos
1 Solution
323 Views
DavidS
NXP Employee
NXP Employee

Hi netra,

Why are you closing "s:"?

Have you reviewed and run the following example?

C:\Freescale\Freescale_MQX_4_0\mfs\examples\ramdisk\cw10

From the shell prompt, after you have formatted the drive, you can create a test file and the issue a "dir" shell command that will issue the IOCTL command to find the first file in current directory.

Here is my terminal output (note I used TWR-MEM card with MRAM):

shell> Demo start

Initialized Ram Disk to a:\

NOT A DOS DISK! You must format to continue.

Shell (build: Feb 15 2013)

Copyright (c) 2008 Freescale Semiconductor;

shell>

shell> format a:

Formating...

Done. Volume name is

Free disk space: 518144 bytes

shell>

shell> dir

shell>

shell> write test.txt 123

shell>

shell> dir

TEST.TXT         123 01-01-1980 00:04:26      A TEST.TXT

shell>

Similar topic that might also be of value:

Re: USB device with MFS ramdisk

Hope this helps.

Regards,

David

View solution in original post

0 Kudos
2 Replies
323 Views
Monica
Senior Contributor III

Netra, is this helpful?

How is the project going?

Keep us posted please! :smileywink:

Regards!

0 Kudos
324 Views
DavidS
NXP Employee
NXP Employee

Hi netra,

Why are you closing "s:"?

Have you reviewed and run the following example?

C:\Freescale\Freescale_MQX_4_0\mfs\examples\ramdisk\cw10

From the shell prompt, after you have formatted the drive, you can create a test file and the issue a "dir" shell command that will issue the IOCTL command to find the first file in current directory.

Here is my terminal output (note I used TWR-MEM card with MRAM):

shell> Demo start

Initialized Ram Disk to a:\

NOT A DOS DISK! You must format to continue.

Shell (build: Feb 15 2013)

Copyright (c) 2008 Freescale Semiconductor;

shell>

shell> format a:

Formating...

Done. Volume name is

Free disk space: 518144 bytes

shell>

shell> dir

shell>

shell> write test.txt 123

shell>

shell> dir

TEST.TXT         123 01-01-1980 00:04:26      A TEST.TXT

shell>

Similar topic that might also be of value:

Re: USB device with MFS ramdisk

Hope this helps.

Regards,

David

0 Kudos