mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 09:36:22 +02:00
block: add a macro to initialize the status table
Prepare for adding a new value to the error table by adding a macro to fill it. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Keith Busch <kbusch@kernel.org> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: Hannes Reinecke <hare@kernel.org> Reviewed-by: Md Haris Iqbal <haris.iqbal@linux.dev> Link: https://patch.msgid.link/20260611140703.2401204-2-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
64e3357902
commit
8c8ebed165
|
|
@ -132,39 +132,44 @@ inline const char *blk_op_str(enum req_op op)
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(blk_op_str);
|
||||
|
||||
#define ENT(_tag, _errno, _desc) \
|
||||
[BLK_STS_##_tag] = { \
|
||||
.errno = _errno, \
|
||||
.name = _desc, \
|
||||
}
|
||||
static const struct {
|
||||
int errno;
|
||||
const char *name;
|
||||
} blk_errors[] = {
|
||||
[BLK_STS_OK] = { 0, "" },
|
||||
[BLK_STS_NOTSUPP] = { -EOPNOTSUPP, "operation not supported" },
|
||||
[BLK_STS_TIMEOUT] = { -ETIMEDOUT, "timeout" },
|
||||
[BLK_STS_NOSPC] = { -ENOSPC, "critical space allocation" },
|
||||
[BLK_STS_TRANSPORT] = { -ENOLINK, "recoverable transport" },
|
||||
[BLK_STS_TARGET] = { -EREMOTEIO, "critical target" },
|
||||
[BLK_STS_RESV_CONFLICT] = { -EBADE, "reservation conflict" },
|
||||
[BLK_STS_MEDIUM] = { -ENODATA, "critical medium" },
|
||||
[BLK_STS_PROTECTION] = { -EILSEQ, "protection" },
|
||||
[BLK_STS_RESOURCE] = { -ENOMEM, "kernel resource" },
|
||||
[BLK_STS_DEV_RESOURCE] = { -EBUSY, "device resource" },
|
||||
[BLK_STS_AGAIN] = { -EAGAIN, "nonblocking retry" },
|
||||
[BLK_STS_OFFLINE] = { -ENODEV, "device offline" },
|
||||
ENT(OK, 0, ""),
|
||||
ENT(NOTSUPP, -EOPNOTSUPP, "operation not supported"),
|
||||
ENT(TIMEOUT, -ETIMEDOUT, "timeout"),
|
||||
ENT(NOSPC, -ENOSPC, "critical space allocation"),
|
||||
ENT(TRANSPORT, -ENOLINK, "recoverable transport"),
|
||||
ENT(TARGET, -EREMOTEIO, "critical target"),
|
||||
ENT(RESV_CONFLICT, -EBADE, "reservation conflict"),
|
||||
ENT(MEDIUM, -ENODATA, "critical medium"),
|
||||
ENT(PROTECTION, -EILSEQ, "protection"),
|
||||
ENT(RESOURCE, -ENOMEM, "kernel resource"),
|
||||
ENT(DEV_RESOURCE, -EBUSY, "device resource"),
|
||||
ENT(AGAIN, -EAGAIN, "nonblocking retry"),
|
||||
ENT(OFFLINE, -ENODEV, "device offline"),
|
||||
|
||||
/* device mapper special case, should not leak out: */
|
||||
[BLK_STS_DM_REQUEUE] = { -EREMCHG, "dm internal retry" },
|
||||
ENT(DM_REQUEUE, -EREMCHG, "dm internal retry"),
|
||||
|
||||
/* zone device specific errors */
|
||||
[BLK_STS_ZONE_OPEN_RESOURCE] = { -ETOOMANYREFS, "open zones exceeded" },
|
||||
[BLK_STS_ZONE_ACTIVE_RESOURCE] = { -EOVERFLOW, "active zones exceeded" },
|
||||
ENT(ZONE_OPEN_RESOURCE, -ETOOMANYREFS, "open zones exceeded"),
|
||||
ENT(ZONE_ACTIVE_RESOURCE, -EOVERFLOW, "active zones exceeded"),
|
||||
|
||||
/* Command duration limit device-side timeout */
|
||||
[BLK_STS_DURATION_LIMIT] = { -ETIME, "duration limit exceeded" },
|
||||
|
||||
[BLK_STS_INVAL] = { -EINVAL, "invalid" },
|
||||
ENT(DURATION_LIMIT, -ETIME, "duration limit exceeded"),
|
||||
ENT(INVAL, -EINVAL, "invalid"),
|
||||
|
||||
/* everything else not covered above: */
|
||||
[BLK_STS_IOERR] = { -EIO, "I/O" },
|
||||
ENT(IOERR, -EIO, "I/O"),
|
||||
};
|
||||
#undef ENT
|
||||
|
||||
blk_status_t errno_to_blk_status(int errno)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user