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)
{
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)
bp = bread(dev, pblk, 0);
if (bp == NULL)
break;
- uputblk(bp, BLKOFF(udata.u_offset), amount);
+ uputblk(bp, uoff(), amount);
brelse(bp);
}
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;
if (bp == NULL)
break;
- ugetblk(bp, BLKOFF(udata.u_offset), amount);
+ ugetblk(bp, uoff(), amount);
/* O_SYNC */
if (bfree(bp, flag))