Next: Device Close, Previous: Device Reply Server, Up: Device Interface
The function
device_openopens the device name and returns a port to it in device. The open count for the device is incremented by one. If the open count was 0, the open handler for the device is invoked.master_port must hold the master device port. name specifies the device to open, and is a string up to 128 characters long. mode is the open mode. It is a bitwise-or of the following constants:
D_READ- Request read access for the device.
D_WRITE- Request write access for the device.
D_NODELAY- Do not delay an open.
The function returns
D_SUCCESSif the device was successfully opened,D_INVALID_OPERATIONif master_port is not the master device port,D_WOULD_BLOCKis the device is busy andD_NOWAITwas specified in mode,D_ALREADY_OPENif the device is already open in an incompatible mode andD_NO_SUCH_DEVICEif name does not denote a know device.
This is the asynchronous form of the
device_openfunction.device_open_requestperforms the open request. The meaning for the parameters is as indevice_open. Additionally, the caller has to supply a reply port to which theds_device_open_replymessage is sent by the kernel when the open has been performed. The return value of the open operation is stored in return_code.As neither function receives a reply message, only message transmission errors apply. If no error occurs,
KERN_SUCCESSis returned.