static const char no_more_free[] = { "Sorry... No more free blocks." };
static const char block_multi[]= { "Block %u in inode %u value %u multiply allocated. Fix? " };
static const char missing_ind_blk[] = { "Missing indirect block" };
+static const char no_memory[] = { "Not enough memory.\n" };
+static const char fstab[] = { "/etc/fstab" };
+static const char rstr[] = { "r" };
static int dev = 0;
static struct filesys superblock;
static int dev_fd;
return ret;
}
-static void bitset(uint16_t b) __z88dk_fastcall
+static void bitset(uint16_t b)
{
bitmap[b >> 3] |= (1 << (b & 7));
}
-static void bitclear(uint16_t b) __z88dk_fastcall
+static void bitclear(uint16_t b)
{
bitmap[b >> 3] &= ~(1 << (b & 7));
}
-static int bittest(uint16_t b) __z88dk_fastcall
+static int bittest(uint16_t b)
{
return (bitmap[b >> 3] & (1 << (b & 7))) ? 1 : 0;
}
FILE *fp;
struct mntent *mnt;
- fp = setmntent("/etc/fstab", "r");
+ fp = setmntent(fstab, rstr);
if (fp) {
while (mnt = getmntent(fp)) {
if (strcmp(mnt->mnt_dir, mount) == 0) {
linkmap = (int16_t *) calloc(8 * superblock.s_isize, sizeof(int16_t));
if (!bitmap || !linkmap) {
- fputs("Not enough memory.\n", stderr);
+ fputs(no_memory, stderr);
return(error |= 8);
}
}
if (argc == 1 && aflag) {
- FILE *fp = setmntent("/etc/fstab", "r");
+ FILE *fp = setmntent(fstab, rstr);
if (fp == NULL) {
- perror("/etc/fstab");
+ perror(fstab);
exit(1);
}
while((mnt = getmntent(fp)) != NULL) {
}
if (dentry.d_ino != pnum &&
dentry.d_ino != inum && depth < MAXDEPTH) {
+ /* This is a bad approach. We ought to have some kind of
+ growing buffer, but our realloc will end up chopping up
+ the pool and stuff I think. sbrk() doesn't help as we've
+ got lots of memory in the pool from freeing bitmap that
+ won't go back FIXME */
ename = malloc(strlen(name) + strlen(dentry.d_name) + 2);
if (ename == NULL) {
fprintf(stderr, "Not enough memory.\n");