Filesystem operations with RTEMS
mkhoory at eiast.ae
Wed Jul 10 06:05:33 UTC 2013
>> I have set up a RAMDisk on RTEMS 4.10.2 and formatted it with dosfs,
>> then mounted it in a specific address. I'm now trying to do two
>> operations on this active filesystem:
>> 1. I have an open file in this filesystem, represented in C code as a
>> file descriptor int, and I'm trying to get the pathname of this file
>You would need an RTEMS specific method to be able to do this and I do not
>think one exists and I am not sure if it is possible. In POSIX an fd
>to an inode (see the stat st_ino field) and there could be more than one
>linked file name to that inode. This means an fd for a file could be
>by more than one file name.
I understand that there might be several hard links for a file, but I just
need the path used to open the fd. I guess the path that was used to
initially open the fd isn't stored somewhere in a struct then...
>> 2. I would like to get the amount of free space on this filesystem.
>I know 4.11 has support for statvf but I am not sure if this has the file
>space available. It has been a while since I looked at this and I cannot
>remember if there is a standard method of obtaining this.
>Maybe the BSD 'df' source may provide some pointers.
I've been looking through the supercore docs, and I thought maybe I could
somehow calculate the free space using the data located in struct statvfs
which I can get for a particular filesystem using its structvfs handler
function. However, it seems that the dosfs filesystem doesn't have one
implemented (at least, not in 4.10.2), which probably means I can't do this.
I will keep looking.
More information about the users