You copied the Doc URL to your clipboard.

4.4.69 VFS2 component

This section describes the VFS2 component.

VFS2 - about

This component implements the Virtual File System (VFS).

The VFS is a virtual device that provides access to parts of the underlying host filesystem through a target OS-specific driver and a memory-mapped device called the MessageBox. The VFS component is virtual, so you might have to write your own driver. Fast Models contains example drivers. These drivers are for bare metal, written in C++, and for Linux, written in C. You can use much of the driver code for porting to other operating systems.

This component contains:

VFS LISA component
Coordinates device activity.
MessageBox component
Handles bus activity and interrupts.
MBoxTypes.h
Defines types shared between target and OS.
VFS.cpp/h
Implements the VFS class/function interface.
VFSFileSystem.cpp/h
Provides a host filesystem abstraction layer.
MessageCodec.h
Provides utility classes for packing and unpacking messages.
VFSOps.h
Defines the VFS operations.
VFSTypes.h
Defines types shared between target and OS.

To use this component in a platform, add the vfs.sgrepo repository file to your project. You must also add the path to the C++ header files in the VFS implementation parts list to your project.

This is a LISA+ component.

Related reference

VFS2 - operations

This section describes the operations.

Access to the host filesystem through the VFS is analogous to access to a shared network drive, and you can expect it to behave in the same way.

These are the VFS operations:

getattr
Retrieve metadata for the file, directory, or symbolic link.
mkdir
Create a new directory.
remove
Remove a file, directory, or symbolic link.
rename
Rename a file, directory, or symbolic link.
rmdir
Remove an empty directory.
setattr

Set metadata for the file, directory, or symbolic link.

Note

The VFS does not implement setattr.

The VFS does not support symbolic links. The model cannot create hard links, but hard links that the host operating system created function correctly.

These are the VFS mount points:

closemounts

Free the iterator handle returned from openmounts.

openmounts
Retrieve an iterator handle for the list of available mounts.
readmounts
Read one entry from the mount iterator ID.

These are the VFS directory iterators:

closedir
Free a directory iterator handle retrieved by opendir.
opendir
Retrieve an iterator handle for the directory specified.
readdir
Read the next entry from the directory iterator.

These are the VFS file operations:

closefile
Free a handle opened with openfile.
filesync
Force the host OS to flush all file data to persistent storage.
getfilesize
Return the size of a file, in bytes.
openfile
Return a handle to the file specified.
readfile
Read a block of data from a file.
setfilesize
Set the size of a file in bytes, either by truncating, or extending the file with zeroes.
writefile
Write a block of data to a file.

Note

Datestamps are in milliseconds since the VFS epoch of January 01 1970 00:00 UTC and are host datestamps. The host datestamp might be in the future relative to the OS datestamp.

VFS2 - ports

This section describes the ports.

Table 4-173 VFS2 ports

Name Protocol Type Description
pvbus_s PVBus Slave Provides memory-mapped access to the VFS device.
intr Signal Master Optional interrupt line used to indicate availability of incoming VFS data. If the intr port is not used, MessageBox registers can be used to poll for incoming VFS data.
Related reference

VFS2 - parameters

This section describes the parameters.

Table 4-174 VFS2 parameters

Name Type Allowed values Default value Description
mount string - '' Path to host folder to make accessible inside the model.

VFS2 - verification and testing

This component passes tests through use with Linux operating systems.

VFS2 - performance

ARM® expects this component to have little effect on the performance of PV systems. The component depends on the performance of the host filesystem.

Was this page helpful? Yes No