DCMD_FSYS_ERRNOTIFY
Register for error notifications from a filesystem
Synopsis:
#include <sys/dcmd_blk.h>
#define DCMD_FSYS_ERRNOTIFY __DIOT(_DCMD_FSYS, 32, struct blk_errnotify)
Arguments to devctl():
Argument | Value |
---|---|
filedes | A file descriptor that you obtained by opening the device. |
dcmd | DCMD_FSYS_ERRNOTIFY |
dev_data_ptr | A pointer to a struct blk_errnotify (see below) |
n_bytes | sizeof(struct blk_errnotify) |
dev_info_ptr | NULL |
Description:
This command registers a process for error notifications from a block filesystem. The command must come from the local process running with superuser privileges, and be directed at one of the driver's block devices.
If you successfully register for error notifications, the io-blk.so module does the following:
- It immediately sends your process an acknowledgement pulse, including the ack_data you provide (see below).
- If any errors have occurred in the past, io-blk.so sends a notification pulse to your process, with BLK_ERRNOTIFY_STALE as the pulse data.
- If another client is already registered for error notifications, io-blk.so disconnects from it. The client receives a pulse with a code of _PULSE_CODE_DISCONNECT.
If a filesystem error occurs, io-blk.so sends your process a pulse with the code and priority that you provided (pulse_code and pulse_prio, respectively). The pulse's value describes the error; it consists of the following 32 bits:
Bits | Mask | Description |
---|---|---|
31 | 0x80000000 (BLK_ERRNOTIFY_STALE) | One or more errors occured before the client registered to receive error notifications |
30–9 | 0x7FFFFE00 | Currently undefined |
8–0 | 0x000001FF | An error code from <error.h> |
You can use this macro to extract the error code:
#define BLK_ERRNOTIFY_GETERROR(v) ((v) & 0x000001ff)
Input:
A pointer to a blk_errnotify structure:
typedef struct blk_errnotify {
uint32_t signature;
int chid;
int pulse_prio;
uint32_t ack_data;
uint8_t pulse_code;
uint8_t spare[15]; /* reserved; set to zero */
} blk_errnotify_t;
The members include:
- signature
- This must be BLK_ERRNOTIFY_SIGNATURE.
- chid
- The channel ID that you want io-blk to send the pulse to.
- pulse_prio
- The priority to send the pulse at. This must not be higher than the caller's priority.
- ack_data
- Data to send back with the acknowledgement pulse.
- pulse_code
- The notification pulse's code. This must be within the range allowed for user processes (see the entry for _pulse in the C Library Reference).
Output:
None.
See also:
devctl(), _pulse in the QNX OS C Library Reference
io-blk.so in the Utilities Reference