From: Alan Cox Date: Thu, 14 Dec 2017 21:55:30 +0000 (+0000) Subject: inode: another SDCC size-ism fixup X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=3d957307995d2817ea3bd4f5a6568f909e794f6f;p=FUZIX.git inode: another SDCC size-ism fixup --- diff --git a/Kernel/inode.c b/Kernel/inode.c index 365fa067..920fb817 100644 --- a/Kernel/inode.c +++ b/Kernel/inode.c @@ -26,6 +26,12 @@ static uint8_t pipewait(inoptr ino, uint8_t flag) return 1; } +/* We need this because SDCC otherwise makes a right hash of it */ +static uint16_t uoff(void) +{ + return BLKOFF((uint16_t)udata.u_offset); +} + /* Writei (and readi) need more i/o error handling */ void readi(regptr inoptr ino, uint8_t flag) { @@ -69,7 +75,7 @@ void readi(regptr inoptr ino, uint8_t flag) loop: toread = udata.u_count; while (toread) { - amount = min(toread, BLKSIZE - BLKOFF(udata.u_offset)); + amount = min(toread, BLKSIZE - uoff()); pblk = bmap(ino, udata.u_offset >> BLKSHIFT, 1); #if defined(read_direct) @@ -98,7 +104,7 @@ void readi(regptr inoptr ino, uint8_t flag) bp = bread(dev, pblk, 0); if (bp == NULL) break; - uputblk(bp, BLKOFF(udata.u_offset), amount); + uputblk(bp, uoff(), amount); brelse(bp); } @@ -184,7 +190,7 @@ void writei(regptr inoptr ino, uint8_t flag) flag = flag & O_SYNC ? 2 : 1; while (towrite) { - amount = min(towrite, BLKSIZE - BLKOFF(udata.u_offset)); + amount = min(towrite, BLKSIZE - uoff()); if (udata.u_offset >> BLKOVERSIZE) { udata.u_error = EFBIG; @@ -204,7 +210,7 @@ void writei(regptr inoptr ino, uint8_t flag) if (bp == NULL) break; - ugetblk(bp, BLKOFF(udata.u_offset), amount); + ugetblk(bp, uoff(), amount); /* O_SYNC */ if (bfree(bp, flag))