superblock.s_tfree = swizzle16(swizzle16(superblock.s_tfree)+1);
s = swizzle16(superblock.s_nfree);
superblock.s_free[s++] = swizzle16(j);
- superblock.s_nfree = s;
+ superblock.s_nfree = swizzle16(s);
}
}
/* The inodes are already zeroed out */
/* create the root dir */
- inode[ROOTINODE].i_mode = F_DIR | (0777 & MODE_MASK);
+ inode[ROOTINODE].i_mode = swizzle16(F_DIR | (0777 & MODE_MASK));
inode[ROOTINODE].i_nlink = swizzle16(3);
inode[ROOTINODE].i_size = swizzle32(64);
inode[ROOTINODE].i_addr[0] = swizzle16(isize);
/* Update file length to next block */
if (swizzle32(wd->c_node.i_size) & 511)
- wd->c_node.i_size =
+ wd->c_node.i_size = swizzle32(
swizzle32(wd->c_node.i_size) + 512 -
- (swizzle16(wd->c_node.i_size) & 511);
+ (swizzle32(wd->c_node.i_size) & 511));
return (1);
}
_sync(); /* Make on-disk inodes consistent */
k = 0;
- for (blk = 2; blk < dev->s_isize; blk++) {
+ for (blk = 2; blk < swizzle16(dev->s_isize); blk++) {
buf = (struct dinode *) bread(devno, blk, 0);
for (j = 0; j < 8; j++) {
ifnot(buf[j].i_mode || buf[j].i_nlink)
* fetch the address from the inode
* Create the first indirect block if needed.
*/
- ifnot(nb = ip->c_node.i_addr[20 - j]) {
+ ifnot(nb = swizzle16(ip->c_node.i_addr[20 - j])) {
if (rwflg || !(nb = blk_alloc(dev)))
return (NULLBLK);
ip->c_node.i_addr[20 - j] = swizzle16(nb);