Tornado Reference : Tornado Utilities
memdrvbuild - filesystem builder for memDrv
The memdrvbuild utility is designed to be used in conjunction with the memDrv( ) memory file driver. It packs files and directories into a compilable C file which can be built into VxWorks, and then mounted as a filesystem using memDrv( ).
memdrvbuild converts a directory hierarchy, and all of the files contained within it, into a single C source file. The individual files are converted into C data arrays containing the contents of the files (which may be in any format), along with administrative data describing the names and sizes of the files. This constructed C file can then be built into VxWorks in the normal way.
The generated C file also contains two function which can be called to register or unregister all of the packed files and directories; they are mounted as a filesystem using memDevCreateDir( ), and unmounted using memDevDelete( ). An include file is also generated, containing a declaration of this function.
This utility is invoked as:
memdrvbuild [ -o filebase ] [ -m mount ] directorywhere:
- -o filebase
- The base name for the generated .c and .h files. Defaults to the name of the source directory.
- -m mount
- The name ("mount point") under which directory will be mounted on the target. Defaults to the name of the source directory.
- directory
- The source directory containing the files to be packed into a memDrv filesystem.
The output C file contains two function, called memDrvAddFilesmount() and memDrvDeleteFilesmount(), where mount is the argument to the "-d" option, with non-alpha characters converted to _. This first function mounts the packed files using memDevCreate( ). The second function unmounts the packed files using memDevDelete( ). The H file contains a declaration of those functions.
Each file will be mounted with the name "mount/file", where file is the pathname of the file below the indicated source directory.
Given a directory "docs", containing a number of files:
memdrvbuild -m /mem -o memFiles docswill produce 2 files, memFiles.c and memFiles.h. memFiles.c will contain the data for the packed files, plus two functions:STATUS memDrvAddFiles_mem (void); STATUS memDrvDeleteFiles_mem (void);When called, the first function will mount all of the contained files in the filesystem under "/mem". For example, the file "docs/fred.html" would be mounted as "/mem/fred.html". The second function will unmount all of the contained files in the filesystem under "/mem".