devb-ram

Driver for RAM disk interface (QNX Neutrino)

Note: You must be root or have the right abilities to start this driver.

Syntax:

devb-ram [cam option[,option]...]
         [disk option[,option]...] 
         [ram option[,option]...]
         [blk option[,option]...] &

Runs on:

QNX Neutrino

Options:

Note: Use commas (,) to separate the options. You can put the cam, disk, ram, and blk groups of options in any order.
cam options
The cam options control the common access methods:
async
Perform CPU cache invalidation after an I/O operation in a thread that's separate from the one that's notifying the upper layer. In some cases, and on some boards, this can provide a performance boost.
bounce=size
Specify the size of the driver's “bounce” buffer. The size argument can include a case-insensitve suffix that indicates the units: B (bytes; the default), K (kilobytes), M (megabytes), or P (pages). The bounce buffer is used if a specific piece of hardware can't directly access io-blk block cache buffers. The most common example is chips that don't support scatter-gather. The default is 32 KB.
cache[=on|off]
Specify to perform cache invalidation or cache flushes on the buffers. Map the bounce buffer as PROT_NOCACHE (cache=off) or not (cache or cache=on).
nopriv
Don't call ThreadCtl(_NTO_TCTL_IO_PRIV).
quiet
Be quiet: don't display any information on startup.
retries
Specify the number of times to retry an operation before indicating to the filesystem that an I/O error occurred. The default is 10.
user=UID:GID
Operate as the specified user and group IDs. The driver retains the necessary process-manager abilities.
verbose
Be verbose.
disk options
The disk options control the driver's interface to cam-disk.so. If specified, they must follow the disk keyword. For more information, see cam-disk.so.
ram options
The ram options control the driver's interface to RAM:
address=addr
The physical address to overlay. The default is not to overlay.
blksize=size
Set the sector size. The default is 512 bytes.
capacity=blocks
Specify the capacity of the RAM drive in the blocks of the size specified by the blksize option. The default is 4096 blocks (2 MB).
blk options
The blk options control io-blk.so. These options must follow the blk keyword and must be specified after any general or disk options. For more information, see io-blk.so.

Description:

The devb-ram driver creates a RAM disk interface, a storage area that exists only in memory but looks like a hard disk. When the capacity option isn't specified, devb-ram creates a 2 MB RAM disk. You can later manually format the RAM disk, optionally partition it with fdisk (or you can make the whole thing a filesystem), and then mount it.

Note: By default, io-blk.so allocates 2 MB plus 15% of system RAM for cache. The devb-ram system looks like a disk drive to io-blk.so, so it doesn't know that the cache is unnecessary. You should use the blk cache=512k option to reduce the cache size to the minimum.

Because devb-ram is a block device which reads from and writes to RAM, its operations go through a lot of layers before they actually get to RAM. For a RAM disk with better performance, use the blk ramdisk=... option to io-blk.so. This creates an internal RAM disk that io-blk.so does know is RAM and doesn't need to be copied via cache. It uses a 4 KB sector size. If you already have any other devb-* driver running, then you can simply piggyback the RAM disk on it (by adding, for example, blk ramdisk=10m to the invocation of that devb- driver).

If you really want a separate devb-ram, then it can be the container for an internal RAM disk too, with an invocation like this:

devb-ram ram capacity=1 blk ramdisk=10m,cache=512k,vnode=256

Use the /dev/ram0 device, which is the io-blk.so internal RAM disk. You need to manually format it and mount it first. For example:

mkqnx6fs /dev/ram0
mount -tqnx6 /dev/ram0

This approach has superior performance because it eliminates the memory-to-memory copies of devb-ram, it bypasses cache lookups, and the 4 KB sectors have smaller overheads.

Examples:

Create a 4 MB RAM drive:

devb-ram ram capacity=8192 &

Files:

The devb-ram driver causes io-blk.so to adopt various block special devices under /dev. These devices are normally named hdn, where n is the physical unit number of the device.

This driver could also require the following shared objects:

Binary Required
cam-disk.so For RAM disk access.
libcam.so Always

Exit status:

The devb-ram driver terminates only if an error occurs during startup, or if it has successfully forked itself upon startup because it hadn't been initially started in the background.

0
The devb-ram driver wasn't started in the background and therefore forked itself. The original process terminated with a zero exit status, the forked process continued.
> 0
An error occurred during startup.

Caveats:

While there's no limit to the size of a disk or partition, the limit on I/O (i.e., the lseek(), read() and write() functions) depends on the type of filesystem mounted and on whether you use the 32- or 64-bit versions of these functions. This I/O limit has no effect on the partition size for mounted filesystems. The maximum number of blocks is 232.

Known supported functions include:

chmod(), chown(), close(), closedir(), creat(), devctl(), dup(), dup2(), fcntl(), fpathconf(), fstat(), lseek(), mkdir(), mkfifo(), mknod(), open(), opendir(), pathconf(), read(), readdir(), readlink(), rewinddir(), rmdir(), stat(), symlink(), unlink() (not supported for directories), utime(), write()

Note that certain calls (such as pipe(), as well as read() and write() on FIFOs) may require the pipe manager.