This reverts commit 97be116a39.
This commit broke nxffs. This leaves the first block as empty which
then exposes another bug where when the pack is called because we
have reached the end of flash and need to look for deleted inodes
we search the first block find no inode and assume that there
are no more inodes. This then results in corrupting the filesystem
by writing over existing inodes.
This can be seen by runing the sim:nxffs configuration.
Prior to this commit the first pass of writing files would look like
this:
NXFFS Dump:
BLOCK:OFFS TYPE STATE LENGTH
0:5 INODE OK 2680
0:78 DATA OK 424
1:5 DATA OK 497
2:5 DATA OK 497
3:5 DATA OK 497
4:5 DATA OK 497
5:5 DATA OK 268
5:283 INODE OK 7410
5:425 DATA OK 77
6:5 DATA OK 497
With this commit:
NXFFS Dump:
BLOCK:OFFS TYPE STATE LENGTH
0:0 BLOCK ERASED 512
1:5 INODE OK 6394
1:39 DATA OK 463
2:5 DATA OK 497
3:5 DATA OK 497
Signed-off-by: Brennan Ashton <bashton@brennanashton.com>
fs/nxffs: Giving up on truncate() support in NXFFS for now. There is too much that has to be done to make that work.
configs/sim: Add support for testing NXFFS.
fs/nxffs: Add partial implementation of the truncate method: It extend files, but cannot yet shrink them.
fs/smartfs: Add partial implementation of the truncate method: It extend files, but cannot yet shrink them.
fs/fat: Add partial implementation of the truncate method: It extend files, but no yet shrink them.
fs/nfs: Add support for the truncate method to the NFS file system.
fs: Add truncate() support for userfs
fs/unionfs: Add truncate() support to the unionfs
fs/tmpfs: Add ftruncate() support to tmpfs
syscall/: Add system call support for ftruncate()
net/route: Adding ftruncate() support eliminates an issue in file-based routing table management.
fs: Add basic framework to support truncate() and ftruncate(). The infrastructure is complete. Now, however, the actual implementation of ftruncate() will have to be done for each file system.
libc/semaphore: Add nxsem_getvalue() which is identical to sem_getvalue() except that it never modifies the errno variable. Changed all references to sem_getvalue in the OS to nxsem_getvalue().
sched/semaphore: Rename all internal private functions from sem_xyz to nxsem_xyz. The sem_ prefix is (will be) reserved only for the application semaphore interfaces.
libc/semaphore: Add nxsem_init() which is identical to sem_init() except that it never modifies the errno variable. Changed all references to sem_init in the OS to nxsem_init().
sched/semaphore: Rename sem_tickwait() to nxsem_tickwait() so that it is clear this is an internal OS function.
sched/semaphoate: Rename sem_reset() to nxsem_reset() so that it is clear this is an internal OS function.