/* Some limits. */
#define MAX_INODE_NR ((ino_t) 037777777777) /* largest inode number */
#define MAX_FILE_POS ((off_t) 0x7FFFFFFF) /* largest legal file offset */
-#define UMAX_FILE_POS ((unsigned) 0x7FFFFFF) /* largest legal file offset */
+#define UMAX_FILE_POS ((unsigned) 0x7FFFFFFF) /* largest legal file offset */
#define MAX_SYM_LOOPS 8 /* how many symbolic links are recursed */
if (rip->i_nlinks == NO_LINK) {
/* i_nlinks == NO_LINK means free the inode. */
/* return all the disk blocks */
- if (truncate_inode(rip, (off_t) 0) != OK) return;
+ if (truncate_inode(rip, (off_t) 0) != OK) {
+ printf("MFS: truncate of inode %u on dev %d failed\n",
+ rip->i_num, rip->i_dev);
+ }
rip->i_mode = I_NOT_ALLOC; /* clear I_TYPE field */
rip->i_dirt = DIRTY;
free_inode(rip->i_dev, rip->i_num);
/* Locate the appropriate super_block. */
sp = get_super(dev);
- if (inumb > sp->s_ninodes) return;
+ if (inumb == NO_ENTRY || inumb > sp->s_ninodes) return;
b = (bit_t) inumb;
free_bit(sp, IMAP, b);
if (b < sp->s_isearch) sp->s_isearch = b;
int r;
/* search_dir checks that rip is a directory too. */
- if ((r = search_dir(rip, "", (ino_t *) 0, IS_EMPTY, IGN_PERM)) != OK)
+ if ((r = search_dir(rip, "", NULL, IS_EMPTY, IGN_PERM)) != OK)
return(r);
if (strcmp(dir_name, ".") == 0 || strcmp(dir_name, "..") == 0)return(EINVAL);
dup_inode(rip); /* inode will be returned with put_inode */
}
- r = search_dir(dirp, file_name, (ino_t *) 0, DELETE, IGN_PERM);
+ r = search_dir(dirp, file_name, NULL, DELETE, IGN_PERM);
if (r == OK) {
rip->i_nlinks--; /* entry deleted from parent's dir */
} else {
/* It was not possible to enter . or .. probably disk was full -
* links counts haven't been touched. */
- if(search_dir(ldirp, lastc, (ino_t *) 0, DELETE, IGN_PERM) != OK)
+ if(search_dir(ldirp, lastc, NULL, DELETE, IGN_PERM) != OK)
panic("Dir disappeared: %ul", rip->i_num);
rip->i_nlinks--; /* undo the increment done in new_node() */
}