summaryrefslogtreecommitdiffstats
path: root/drivers/block/swim.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2017-06-03 03:38:04 -0400
committerJens Axboe <axboe@fb.com>2017-06-09 11:27:32 -0400
commit2a842acab109f40f0d7d10b38e9ca88390628996 (patch)
treebdfc7a47fe655c2ea7a5f74127015d7a502042f0 /drivers/block/swim.c
parent1be5690984588953e759af0a4c6ddac182a1806c (diff)
block: introduce new block status code type
Currently we use nornal Linux errno values in the block layer, and while we accept any error a few have overloaded magic meanings. This patch instead introduces a new blk_status_t value that holds block layer specific status codes and explicitly explains their meaning. Helpers to convert from and to the previous special meanings are provided for now, but I suspect we want to get rid of them in the long run - those drivers that have a errno input (e.g. networking) usually get errnos that don't know about the special block layer overloads, and similarly returning them to userspace will usually return somethings that strictly speaking isn't correct for file system operations, but that's left as an exercise for later. For now the set of errors is a very limited set that closely corresponds to the previous overloaded errno values, but there is some low hanging fruite to improve it. blk_status_t (ab)uses the sparse __bitwise annotations to allow for sparse typechecking, so that we can easily catch places passing the wrong values. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/block/swim.c')
-rw-r--r--drivers/block/swim.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/block/swim.c b/drivers/block/swim.c
index 3064be6cf375..1633aaf24060 100644
--- a/drivers/block/swim.c
+++ b/drivers/block/swim.c
@@ -493,7 +493,7 @@ static inline int swim_read_sector(struct floppy_state *fs,
493 return ret; 493 return ret;
494} 494}
495 495
496static int floppy_read_sectors(struct floppy_state *fs, 496static blk_status_t floppy_read_sectors(struct floppy_state *fs,
497 int req_sector, int sectors_nb, 497 int req_sector, int sectors_nb,
498 unsigned char *buffer) 498 unsigned char *buffer)
499{ 499{
@@ -516,7 +516,7 @@ static int floppy_read_sectors(struct floppy_state *fs,
516 ret = swim_read_sector(fs, side, track, sector, 516 ret = swim_read_sector(fs, side, track, sector,
517 buffer); 517 buffer);
518 if (try-- == 0) 518 if (try-- == 0)
519 return -EIO; 519 return BLK_STS_IOERR;
520 } while (ret != 512); 520 } while (ret != 512);
521 521
522 buffer += ret; 522 buffer += ret;
@@ -553,7 +553,7 @@ static void do_fd_request(struct request_queue *q)
553 553
554 req = swim_next_request(swd); 554 req = swim_next_request(swd);
555 while (req) { 555 while (req) {
556 int err = -EIO; 556 blk_status_t err = BLK_STS_IOERR;
557 557
558 fs = req->rq_disk->private_data; 558 fs = req->rq_disk->private_data;
559 if (blk_rq_pos(req) >= fs->total_secs) 559 if (blk_rq_pos(req) >= fs->total_secs)