RamDisk-Handler for VxWorks

Version 16-Dec-2002/jn

This program can install up to 10 ramdisks in MSDOS-Format in the VxWorks-processor's memory. The size is limited at the moment to ~ 1 Mbyte per ramdisk. The ramdisk will be newly installed or can be reinstalled after a warm reboot of the processor, if the former memory address is known. This important address will be written into a specific file on the host computer, when the ramdisk is created. After a warm reboot one can reinstall that ramdisk. The program searches for that file and tries to reconstruct the former ramdisk from the address in that file. If this is not succesfull, it installs a new ramdisk.

With the installation of a ramdisk (with name RAM<nr>:) there are automatically created two files each for logging and error messages. Their maximally reachable dimensions are in that way that all these files together use the whole ramdisk space. If one of these files reaches its maximum size, it is switched to the next one while deleting the last before. In that way an active and a last file exist for both, the log- and the error-messages.

One can especially write to the logfile by a writing function. The errorfile can be written by setting the stderr output to the active ramdisk accessable with a special function.

The following functions give access to the ramdisks:

  • ramDisk_install(ramdisk-nr=0,debug=0,forced=0)

    This routine installs a ramdisk and must be the first one called before using other ramdisk accesses.

    <ramdisk-nr> is the number for the ramdisk. The internal name is „RAM<nr>:“ (for example RAM0:)

    <debug> =0 produces no additive debug information if running the program.

    <forced> != 0 produces in any case a new instant of the ramdisk-handler.

  • ramDisk_write( char *text, ramdisk-nr)

    With this function one can write text to the active log-file on the ramdisk.

    <text> is the text to write into the file.

    <ramdisk-nr> is the number for the ramdisk. The internal name is „RAM<nr>:“ (for example RAM0:)

  • ramDisk_copy( ramdisk-nr=0, last=0, name)

    Copy the active or last error- and log-files to the host. The <name> will be prefixed with LOG and ERR.

    <ramdisk-nr> is the number for the ramdisk. The internal name is „RAM<nr>:“ (for example RAM0:)

    <last> =0 means to copy the active files, otherwise the last non active files.

    <name> is the name for the files. They will be prefixed with LOG and ERR.

  • ramDisk_set_debug() and ramDisk_reset_debug()

    will set or reset the output of debugging information.

  • ramDisk_set_stderr(ramdisk-nr=0) and ramDisk_reset_stderr(ramdisk-nr=0)

    Set the stderr-output to the active error message file on the ramdisk or reset to the normal stderr.

    <ramdisk-nr> is the number for the ramdisk. The internal name is „RAM<nr>:“ (for example RAM0:)

  • ll(„RAM<nr>:“)

    gives a directory output of the choosen ramdisk.

  • copy(„RAM<nr>:<filename>“,0)

    makes a printout in the shell to stdout.

    Before printing the active error-file one must close it by ramDisk_reset_stderr otherwise there may lack some text.

The handler is a C++ class object named RAMdisk with the following public member functions:

  • RAMdisk(int debug=0)

    debug != 0 means printout of debug information

  • ramDisk_start(int nr=0)

    First search for a existent ramdisk, otherwise install it.

  • ramDisk_set(int nr=0)

    Set the number of the active ramdisk.

  • ramDisk_test()

    look for existent ramdisks.

jneidhoefer_at_mpifr-bonn.mpg.de