Fixed bugs in fsutil.
This commit is contained in:
@@ -158,7 +158,7 @@ dumpregs (frame)
|
||||
printf( "*******STACK DUMP START*************\n");
|
||||
printf( "frame = %8x\n", frame );
|
||||
printf( "stack data\n" );
|
||||
while( p <= stacktop )
|
||||
while( p <= stacktop )
|
||||
{
|
||||
printf( " %8x", *p++ );
|
||||
if( p <= stacktop ) printf( " %8x", *p++ );
|
||||
@@ -343,14 +343,14 @@ exception (frame)
|
||||
mips_write_c0_register (C0_COMPARE, 0, c);
|
||||
} while ((int) (c - (unsigned)mips_read_c0_register (C0_COUNT, 0)) < 0);
|
||||
hardclock ((caddr_t) frame [FRAME_PC], status);
|
||||
|
||||
|
||||
#ifdef POWER_ENABLED
|
||||
power_switch_check();
|
||||
#endif
|
||||
|
||||
#ifdef UARTUSB_ENABLED
|
||||
/* Poll USB on every timer tick. */
|
||||
usbintr(0);
|
||||
usbintr(0);
|
||||
#endif
|
||||
break;
|
||||
#ifdef UART1_ENABLED
|
||||
@@ -389,7 +389,7 @@ exception (frame)
|
||||
#ifdef UARTUSB_ENABLED
|
||||
case PIC32_VECT_USB: /* USB */
|
||||
IFSCLR(1) = 1 << (PIC32_IRQ_USB - 32);
|
||||
usbintr(0);
|
||||
usbintr(0);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -418,7 +418,7 @@ exception (frame)
|
||||
if (sp < u.u_procp->p_daddr + u.u_dsize) {
|
||||
/* Process has trashed its stack; give it an illegal
|
||||
* instruction violation to halt it in its tracks. */
|
||||
panic ("unexpected exception 2");
|
||||
panic ("unexpected exception 2");
|
||||
psig = SIGSEGV;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
#include <getopt.h>
|
||||
@@ -354,6 +355,7 @@ void add_device (fs_t *fs, char *name, char *spec)
|
||||
return;
|
||||
}
|
||||
dev.addr[1] = majr << 8 | minr;
|
||||
time (&dev.mtime);
|
||||
fs_inode_save (&dev, 1);
|
||||
}
|
||||
|
||||
@@ -408,6 +410,7 @@ void add_file (fs_t *fs, char *name)
|
||||
}
|
||||
}
|
||||
file.inode.mtime = st.st_mtime;
|
||||
file.inode.dirty = 1;
|
||||
fs_file_close (&file);
|
||||
fclose (fd);
|
||||
}
|
||||
|
||||
@@ -161,7 +161,6 @@ int fs_inode_save (fs_inode_t *inode, int force)
|
||||
BSDFS_BSIZE / BSDFS_INODES_PER_BLOCK;
|
||||
|
||||
time (&inode->atime);
|
||||
//time (&inode->mtime);
|
||||
|
||||
if (! fs_seek (inode->fs, offset))
|
||||
return 0;
|
||||
|
||||
@@ -56,6 +56,11 @@ static void printlog(const char *format, ...)
|
||||
}
|
||||
}
|
||||
|
||||
static dev_t make_rdev(unsigned raw)
|
||||
{
|
||||
return makedev (raw >> 8, raw & 0xff);
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy data to struct stat.
|
||||
*/
|
||||
@@ -66,7 +71,7 @@ static int getstat (fs_inode_t *inode, struct stat *statbuf)
|
||||
statbuf->st_nlink = inode->nlink; /* number of hard links */
|
||||
statbuf->st_uid = inode->uid; /* user ID of owner */
|
||||
statbuf->st_gid = inode->gid; /* group ID of owner */
|
||||
statbuf->st_rdev = 0; /* device ID (if special file) */
|
||||
statbuf->st_rdev = 0; /* device ID (if special file) */
|
||||
statbuf->st_size = inode->size; /* total size, in bytes */
|
||||
statbuf->st_blocks = inode->size >> 9; /* number of blocks allocated */
|
||||
statbuf->st_atime = inode->atime; /* time of last access */
|
||||
@@ -82,11 +87,11 @@ static int getstat (fs_inode_t *inode, struct stat *statbuf)
|
||||
break;
|
||||
case INODE_MODE_FCHR: /* character special */
|
||||
statbuf->st_mode |= S_IFCHR;
|
||||
statbuf->st_rdev = inode->addr[1];
|
||||
statbuf->st_rdev = make_rdev (inode->addr[1]);
|
||||
break;
|
||||
case INODE_MODE_FBLK: /* block special */
|
||||
statbuf->st_mode |= S_IFBLK;
|
||||
statbuf->st_rdev = inode->addr[1];
|
||||
statbuf->st_rdev = make_rdev (inode->addr[1]);
|
||||
break;
|
||||
case INODE_MODE_FLNK: /* symbolic link */
|
||||
statbuf->st_mode |= S_IFLNK;
|
||||
@@ -527,7 +532,7 @@ int op_mknod(const char *path, mode_t mode, dev_t dev)
|
||||
return -EIO;
|
||||
}
|
||||
if (S_ISCHR(mode) || S_ISBLK(mode)) {
|
||||
inode.addr[1] = dev;
|
||||
inode.addr[1] = major(dev) << 8 | minor(dev);
|
||||
}
|
||||
inode.mtime = time(0);
|
||||
inode.dirty = 1;
|
||||
|
||||
Reference in New Issue
Block a user