cdev_setup()

Complete the setup for a character device's state structure

Synopsis:

#include <qvm/cdev.h>
int cdev_setup(struct cdev_state *cds,
               struct vdev_s *vdev,
               unsigned size)

Arguments:

cds
A pointer to a structure with the character device state (see cdev_state).
vdev
A pointer to the vdev using this state (see vdev_s).
size
The size, in bytes, of the input and output buffers.

Description:

This function allocates both the internal input and output buffers, and makes them both the size given in size. If you specify a non-zero size, you must use cdev_input_*() and cdev_output_*() to read and write device data. If you don't want to use the internal buffers and use only your own input and output buffers, set size to 0 (zero). In this case, you must use cdev_read() and cdev_write() instead.

Returns:

EOK on success; otherwise, an errno value.