diff options
author | Nathan Benavides-Luu <nate1299@me.com> | 2024-04-01 12:57:03 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-01 12:57:03 -0400 |
commit | 6ddcbbd59f0a04eee2b163930fc86d74dd2434ec (patch) | |
tree | ac055d6005ac81bde8100cec8842faf125db5b03 /kernel/fs/s5fs/s5fs_subr.c | |
parent | 7a684c5fb743d1e03d59db49fe283cfd4b0439a6 (diff) |
S5 Fixes (#6)
* S5 Fixes
* Remove #ifdef OLD
* Fix comments for s5_get_disk_block
* Add info for newp return parameter
* Add stencil comment to s5_file_block_to_disk_block
* Remove ifdefno
---------
Co-authored-by: Ayma-n <aymanbt14@gmail.com>
Diffstat (limited to 'kernel/fs/s5fs/s5fs_subr.c')
-rw-r--r-- | kernel/fs/s5fs/s5fs_subr.c | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/kernel/fs/s5fs/s5fs_subr.c b/kernel/fs/s5fs/s5fs_subr.c index 0187e74..33b03c9 100644 --- a/kernel/fs/s5fs/s5fs_subr.c +++ b/kernel/fs/s5fs/s5fs_subr.c @@ -91,7 +91,6 @@ static inline void s5_release_file_block(pframe_t **pfp) pframe_release(pfp); } -#ifdef OLD /* Given a file and a file block number, return the disk block number of the * desired file block. * @@ -100,6 +99,8 @@ static inline void s5_release_file_block(pframe_t **pfp) * the file * alloc - If set, allocate the block / indirect block as necessary * If clear, don't allocate sparse blocks + * newp - Return parameter that should be set to 1 if the returned + * block number is new (block has just been allocated) * * Return a disk block number on success, or: * - 0: The block is sparse, and alloc is clear, OR @@ -121,20 +122,13 @@ static inline void s5_release_file_block(pframe_t **pfp) * 1) file_blocknum < S_NDIRECT_BLOCKS * 2) Indirect block is not allocated but alloc is set. Be careful not to * leak a block in an error case! + 2a) Make sure you allocate the indirect block on disk and create a + corresponding pframe_t on the mobj (Hint: see s5_cache_and_clear_block). * 3) Indirect block is allocated. The desired block may be sparse, and you * may have to allocate it. * 4) The indirect block has not been allocated and alloc is clear. */ long s5_file_block_to_disk_block(s5_node_t *sn, size_t file_blocknum, - int alloc) -{ - NOT_YET_IMPLEMENTED("S5FS: s5_file_block_to_disk_block"); - return -1; -} -#endif - - -long s5_file_block_to_disk_block(s5_node_t *sn, size_t file_blocknum, int alloc, int *newp) { NOT_YET_IMPLEMENTED("S5FS: s5_file_block_to_disk_block"); @@ -211,7 +205,6 @@ ssize_t s5_write_file(s5_node_t *sn, size_t pos, const char *buf, size_t len) return -1; } -#ifdef OLD /* Allocate one block from the filesystem. * * Return the block number of the newly allocated block, or: @@ -243,13 +236,6 @@ static long s5_alloc_block(s5fs_t *s5fs) NOT_YET_IMPLEMENTED("S5FS: s5_alloc_block"); return -1; } -#endif - -static long s5_alloc_block(s5fs_t *s5fs) -{ - NOT_YET_IMPLEMENTED("S5FS: s5_alloc_block"); - return -1; -} /* * The exact opposite of s5_alloc_block: add blockno to the free list of the |