Building a VFS executable file

When building a VFS executable file, you can include whatever specific functionality is required in this file, such as:

For example, you will need to build a "file version" and a "network version" of VFS to separate data streams related to file systems and the network stack. In some cases, you need to include a network stack and file systems in the VFS.

Building a "file version" of the VFS program

In this example, the VFS program contains only an lwext4 file system implementation (see the figure below). The vfs.c implementation file is compiled, and the vfs_server, vfs_fs and lwext4 libraries are linked:

CMakeLists.txt

project (vfsfs)

include (platform/nk)

# Set compile flags

project_header_default ("STANDARD_GNU_17:YES" "STRICT_WARNINGS:NO")

add_executable (VfsFs "src/vfs.c")

# Linking with VFS libraries

target_link_libraries (VfsFs

${vfs_SERVER_LIB}

${LWEXT4_LIB}

${vfs_FS_LIB})

# Prepare VFS to connect to the ramdisk driver process

set_target_properties (VfsFs PROPERTIES ${blkdev_ENTITY}_REPLACEMENT ${ramdisk_ENTITY})

A block device driver cannot be linked to VFS and therefore must be run in the context of a separate process.

Interaction between three processes: client, "file version" of VFS, and block device driver.

Building a "network version" of the VFS program containing a network driver

In this example, the VFS program contains implementations of the network stack and network driver (see the figure below). The vfs.c implementation file is compiled and the vfs_server, vfs_implementation and dnet_implementation libraries are linked:

CMakeLists.txt

project (vfsnet)

include (platform/nk)

# Set compile flags

project_header_default ("STANDARD_GNU_17:YES" "STRICT_WARNINGS:NO")

add_executable (VfsNet "src/vfs.c")

# Linking with VFS libraries

target_link_libraries (VfsNet

${vfs_SERVER_LIB}

${vfs_IMPLEMENTATION_LIB}

${dnet_IMPLEMENTATION_LIB})

# Disconnect the block device driver

set_target_properties (VfsNet PROPERTIES ${blkdev_ENTITY}_REPLACEMENT "")

Interaction between the Client process and the process of the "network version" of VFS

Building the "network version" of the VFS program without a network driver

In this example, the "network version" of the VFS program does not contain a network driver implementation (see the figure below). (The network driver will run in the context of a separate process. Interaction with the driver will occur via IPC using the dnet_client library.) The vfs.c implementation file is compiled and the vfs_server, vfs_implementation and dnet_client libraries are linked:

CMakeLists.txt

project (vfsnet)

include (platform/nk)

# Set compile flags

project_header_default ("STANDARD_GNU_17:YES" "STRICT_WARNINGS:NO")

add_executable (VfsNet "src/vfs.c")

# Linking with VFS libraries

target_link_libraries (VfsNet

${vfs_SERVER_LIB}

${vfs_IMPLEMENTATION_LIB}

${dnet_CLIENT_LIB})

# Disconnect the block device driver

set_target_properties (VfsNet PROPERTIES ${blkdev_ENTITY}_REPLACEMENT "")

Interaction between three processes: client, "network version" of VFS, and network driver.

Building a "full version" of the VFS program

If you need to include implementations of a network stack and file systems in the VFS program, you must compile the vfs.c implementation file and link the vfs_server, vfs_implementation, and dnet_implementation libraries (or the dnet_client library if the network driver will run in the context of a separate process), and link the libraries for implementing file systems.

Page top