diff --git a/.ci/build-n-run.sh b/.ci/build-n-run.sh index de065ab..250cfb1 100755 --- a/.ci/build-n-run.sh +++ b/.ci/build-n-run.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash function build_mod() -{ +{ make all || exit 1 } diff --git a/.ci/check-commentflow.sh b/.ci/check-commentflow.sh new file mode 100755 index 0000000..3f66b77 --- /dev/null +++ b/.ci/check-commentflow.sh @@ -0,0 +1,76 @@ +#!/usr/bin/env bash + +# Reflow comments to the column limit, or check that they already are. +# +# clang-format breaks a comment line that runs past ColumnLimit but never +# refills a short-wrapped one, so comment width is the one part of the house +# style no other gate settles. commentflow reads the same ColumnLimit from +# .clang-format, which keeps comment width and code width on one number. +# +# The selection below is shared by --write and the default check, so what gets +# rewritten is what gets checked. +# +# Exit codes: 0 clean, 1 files would change, 2 the check could not run. + +set -u -o pipefail + +cd "$(dirname "${BASH_SOURCE[0]}")/.." || exit 2 + +case "${1:-}" in + "" | --check) write=0 ;; + --write) write=1 ;; + *) + echo "usage: $0 [--check | --write]" >&2 + exit 2 + ;; +esac + +COMMENTFLOW="${COMMENTFLOW:-commentflow}" + +if ! command -v "$COMMENTFLOW" > /dev/null 2>&1; then + echo "Error: $COMMENTFLOW not found" >&2 + echo "Install it from https://github.com/sysprog21/commentflow" >&2 + exit 2 +fi + +# Untracked but non-ignored files are included, so a new file is covered before +# it is staged. A while-read loop because macOS ships bash 3.2 (no mapfile). +# Enumerated before the loop so a failing git is an error, not an empty list. +list=$(mktemp) +trap 'rm -f "$list"' EXIT +git ls-files -z --cached --others --exclude-standard \ + -- '*.c' '*.h' '*.sh' > "$list" || exit 2 +files=() +while IFS= read -r -d '' f; do + # A tracked file deleted from the worktree is not a reflow target. + [ -e "$f" ] && files+=("$f") +done < "$list" + +if [ "${#files[@]}" -eq 0 ]; then + echo "Error: no files selected; the pathspec no longer matches the tree" >&2 + exit 2 +fi + +printf ' CFLOW %d files\n' "${#files[@]}" + +if [ "$write" -eq 1 ]; then + exec "$COMMENTFLOW" "${files[@]}" +fi + +status=0 +"$COMMENTFLOW" --check "${files[@]}" || status=$? + +if [ "$status" -eq 0 ]; then + echo "Comment reflow clean." + exit 0 +fi + +# Exit 1 means "these files would change"; anything else is the tool failing to +# read them, which must not be reported as a style violation. +if [ "$status" -ne 1 ]; then + echo "Error: $COMMENTFLOW exited $status (I/O or parse error)" >&2 + exit "$status" +fi + +echo "Run '$0 --write' to reflow, or '$COMMENTFLOW --diff ' to see one." >&2 +exit 1 diff --git a/.ci/check-format.sh b/.ci/check-format.sh index d97a3a8..ddd6a3d 100755 --- a/.ci/check-format.sh +++ b/.ci/check-format.sh @@ -1,21 +1,62 @@ #!/usr/bin/env bash -SOURCES=$(find $(git rev-parse --show-toplevel) | egrep "\.(cpp|cc|c|h)\$") - -CLANG_FORMAT=$(which clang-format-12) -if [ $? -ne 0 ]; then - CLANG_FORMAT=$(which clang-format) - if [ $? -ne 0 ]; then - echo "[!] clang-format not installed. Unable to check source file format policy." >&2 - exit 1 +# Verify clang-format conformance for all tracked C/H files. The repository's +# .clang-format is calibrated against clang-format-20; other versions produce +# different output and are rejected to keep CI deterministic. +# +# Exit codes, matching .ci/check-commentflow.sh: 0 clean, 1 files differ from +# the style, 2 the check could not run. + +set -u -o pipefail + +cd "$(dirname "${BASH_SOURCE[0]}")/.." || exit 2 + +if [ -z "${CLANG_FORMAT:-}" ]; then + if command -v clang-format-20 > /dev/null 2>&1; then + CLANG_FORMAT="clang-format-20" + else + CLANG_FORMAT="clang-format" fi fi -set -x +# The pin is checked on whatever binary was resolved, an explicit CLANG_FORMAT +# included, so it cannot be bypassed by naming one. +if ! "$CLANG_FORMAT" --version 2> /dev/null | grep -qE 'version 20\.'; then + echo "Error: clang-format 20 is required (other versions differ in style)" >&2 + exit 2 +fi + +expected=$(mktemp) +trap 'rm -f "$expected"' EXIT + +# Enumerate first, NUL-delimited: a failing git inside a process substitution +# would be indistinguishable from "no files" and pass the gate. +list=$(mktemp) +trap 'rm -f "$expected" "$list"' EXIT +git ls-files -z -- '*.c' '*.h' > "$list" || exit 2 +if [ ! -s "$list" ]; then + echo "Error: no C sources tracked; the pathspec no longer matches" >&2 + exit 2 +fi + +# A tool failure (2) outranks a style difference (1). +rc=0 +while IFS= read -r -d '' file; do + # A tracked file deleted from the worktree is not a style defect. + [ -e "$file" ] || continue + if ! "$CLANG_FORMAT" "$file" > "$expected"; then + echo "Error: $CLANG_FORMAT failed on $file" >&2 + rc=2 + continue + fi + st=0 + diff -u -p --label="$file" --label="expected coding style" \ + "$file" "$expected" || st=$? + if [ "$st" -gt 1 ]; then + rc=2 + elif [ "$st" -eq 1 ] && [ "$rc" -eq 0 ]; then + rc=1 + fi +done < "$list" -for file in ${SOURCES}; -do - $CLANG_FORMAT ${file} > expected-format - diff -u -p --label="${file}" --label="expected coding style" ${file} expected-format -done -exit $($CLANG_FORMAT --output-replacements-xml ${SOURCES} | egrep -c "") +exit "$rc" diff --git a/.ci/check-newline.sh b/.ci/check-newline.sh index 2d32648..fcb1270 100755 --- a/.ci/check-newline.sh +++ b/.ci/check-newline.sh @@ -4,7 +4,9 @@ set -e -u -o pipefail ret=0 show=0 -# Reference: https://medium.com/@alexey.inkin/how-to-force-newline-at-end-of-files-and-why-you-should-do-it-fdf76d1d090e + +# Reference: +# https://medium.com/@alexey.inkin/how-to-force-newline-at-end-of-files-and-why-you-should-do-it-fdf76d1d090e while IFS= read -rd '' f; do if file --mime-encoding "$f" | grep -qv binary; then tail -c1 < "$f" | read -r _ || show=1 diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..ca79ca5 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: weekly diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 33687c8..857ae77 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -2,37 +2,64 @@ name: main on: [push, pull_request] +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + jobs: simplefs: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v4 - - name: install-dependencies - run: | - sudo apt-get install build-essential - - name: automated test - run: | - .ci/build-n-run.sh - shell: bash + - name: checkout code + uses: actions/checkout@v7 + - name: install dependencies + run: sudo apt-get update && sudo apt-get install -y build-essential + - name: automated test + run: .ci/build-n-run.sh + shell: bash coding_style: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - name: checkout code - uses: actions/checkout@v4 - - name: coding convention + uses: actions/checkout@v7 + - name: newline at end of file + run: .ci/check-newline.sh + # commentflow ships as a release binary, not an apt package. The bytes + # are checked against the sha256 GitHub records for the asset, read from + # the API in the same step, so no hash is kept in this file. + - name: install commentflow + env: + ASSET: commentflow-x86_64-unknown-linux-gnu.tar.gz + GH_TOKEN: ${{ github.token }} run: | - sudo apt-get install -q -y clang-format - .ci/check-newline.sh - .ci/check-format.sh - shell: bash + set -euo pipefail + meta=$(gh api repos/sysprog21/commentflow/releases/tags/latest) + read -r digest url < <(jq -r --arg n "$ASSET" \ + '.assets[] | select(.name == $n) | "\(.digest) \(.browser_download_url)"' <<< "$meta") + if [ -z "${digest:-}" ] || [ -z "${url:-}" ] || [ "$digest" = null ]; then + echo "no digest or download URL recorded for $ASSET" >&2 + exit 1 + fi + curl -fsSL -o /tmp/commentflow.tar.gz "$url" + echo "${digest#sha256:} /tmp/commentflow.tar.gz" | sha256sum -c - + sudo tar -xzf /tmp/commentflow.tar.gz -C /usr/local/bin commentflow + - name: comment reflow + run: .ci/check-commentflow.sh + # The major version must match the one .ci/check-format.sh requires. + - name: install clang-format 20 + run: pipx install 'clang-format==20.1.8' + - name: clang-format + run: .ci/check-format.sh mkfs_macos: runs-on: macos-latest steps: - name: checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: test mkfs.simplefs on macOS - run: | - .ci/test-mkfs-macos.sh + run: .ci/test-mkfs-macos.sh shell: bash diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a459251..7ad0f4b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -44,10 +44,15 @@ However, participation requires adherence to fundamental ground rules: This variant should be considered the standard for all documentation efforts. For instance, opt for "initialize" over "initialise" and "color" rather than "colour". -Software requirement: [clang-format](https://clang.llvm.org/docs/ClangFormat.html) version 18 or later. +Software requirements: +* [clang-format](https://clang.llvm.org/docs/ClangFormat.html) version 20. + `.ci/check-format.sh` rejects other versions, because their output differs. +* [commentflow](https://github.com/sysprog21/commentflow), which reflows comments to the column limit. + Do not hand-wrap comment text; run `.ci/check-commentflow.sh --write` and let it place the breaks. This repository consistently contains an up-to-date `.clang-format` file with rules that match the explained ones. -For maintaining a uniform coding style, execute the command `clang-format -i *.{c,h}`. +For maintaining a uniform coding style, run `.ci/check-commentflow.sh --write` first, then clang-format 20 (`-i *.{c,h}`). +The order matters: clang-format never refills a short-wrapped comment, and commentflow settles that before clang-format normalizes indentation. ## Coding Style for Modern C diff --git a/bitmap.h b/bitmap.h index 09606a7..b06b0f8 100644 --- a/bitmap.h +++ b/bitmap.h @@ -5,11 +5,12 @@ #include "simplefs.h" -/* Returns the first bit found and clears the following 'len' consecutive - * free bits (sets them to 1) in a given in-memory bitmap spanning multiple - * blocks. Returns 0 if an adequate number of free bits were not found. - * Assumes the first bit is never free (reserved for the superblock and the - * root inode), allowing the use of 0 as an error value. +/* Returns the first bit found and clears the following 'len' consecutive free + * bits (sets them to 1) in a given in-memory bitmap spanning multiple blocks. + * + * Returns 0 if an adequate number of free bits were not found. Assumes the + * first bit is never free (reserved for the superblock and the root inode), + * allowing the use of 0 as an error value. */ static inline uint32_t get_first_free_bits(unsigned long *freemap, unsigned long size, @@ -39,8 +40,8 @@ static inline uint32_t get_free_inode(struct simplefs_sb_info *sbi) return ret; } -/* Return 'len' unused block(s) number and mark it used. - * Clean the block content. +/* Return 'len' unused block(s) number and mark it used. Clean the block + * content. * Return 0 if no enough free block(s) were found. */ static inline uint32_t get_free_blocks(struct super_block *sb, uint32_t len) diff --git a/dir.c b/dir.c index 95fb7ba..f79ea19 100644 --- a/dir.c +++ b/dir.c @@ -7,8 +7,8 @@ #include "simplefs.h" -/* Iterate over the files contained in dir and commit them to @ctx. - * This function is called by the VFS as ctx->pos changes. +/* Iterate over the files contained in dir and commit them to @ctx. This + * function is called by the VFS as ctx->pos changes. * Returns 0 on success. */ static int simplefs_iterate(struct file *dir, struct dir_context *ctx) @@ -26,8 +26,8 @@ static int simplefs_iterate(struct file *dir, struct dir_context *ctx) if (!S_ISDIR(inode->i_mode)) return -ENOTDIR; - /* Check that ctx->pos is not bigger than what we can handle (including - * . and ..) + /* Check that ctx->pos is not bigger than what we can handle (including . + * and ..) */ if (ctx->pos > SIMPLEFS_MAX_SUBFILES + 2) return 0; diff --git a/extent.c b/extent.c index 8da6d5c..6fb14f9 100644 --- a/extent.c +++ b/extent.c @@ -3,8 +3,8 @@ #include "simplefs.h" -/* Search for the extent containing the target block. Binary search is used - * for efficiency. +/* Search for the extent containing the target block. Binary search is used for + * efficiency. * * Returns the first unused file index if not found. * Returns -1 if the target block is out of range. @@ -12,9 +12,9 @@ uint32_t simplefs_ext_search(struct simplefs_file_ei_block *index, uint32_t iblock) { - /* First, find the first unused file index with binary search. - * It will be our right boundary for actual binary search and the return - * value when the file index is not found. + /* First, find the first unused file index with binary search. It will be + * our right boundary for actual binary search and the return value when the + * file index is not found. */ uint32_t start = 0; uint32_t end = SIMPLEFS_MAX_EXTENTS - 1; diff --git a/file.c b/file.c index 1aa1956..1726bcd 100644 --- a/file.c +++ b/file.c @@ -112,8 +112,8 @@ static int simplefs_writepage(struct page *page, struct writeback_control *wbc) #endif /* Called by the VFS when a write() syscall is made on a file, before writing - * the data into the page cache. This function checks if the write operation - * can complete and allocates the necessary blocks through block_write_begin(). + * the data into the page cache. This function checks if the write operation can + * complete and allocates the necessary blocks through block_write_begin(). */ #if SIMPLEFS_AT_LEAST(6, 15, 0) static int simplefs_write_begin(const struct kiocb *iocb, @@ -299,11 +299,10 @@ static int simplefs_write_end(struct file *file, return ret; } -/* - * Called when a file is opened in the simplefs. - * It checks the flags associated with the file opening mode (O_WRONLY, O_RDWR, - * O_TRUNC) and performs truncation if the file is being opened for write or - * read/write and the O_TRUNC flag is set. +/* Called when a file is opened in the simplefs. It checks the flags associated + * with the file opening mode (O_WRONLY, O_RDWR, O_TRUNC) and performs + * truncation if the file is being opened for write or read/write and the + * O_TRUNC flag is set. * * Truncation is achieved by reading the file's index block from disk, iterating * over the data block pointers, releasing the associated data blocks, and diff --git a/inode.c b/inode.c index 6ecd46a..82ed25b 100644 --- a/inode.c +++ b/inode.c @@ -22,8 +22,9 @@ static const struct inode_operations symlink_inode_ops; brelse(bh); \ bh = NULL; \ } while (0) -/* Either return the inode that corresponds to a given inode number (ino), if - * it is already in the cache, or create a new inode object if it is not in the + +/* Either return the inode that corresponds to a given inode number (ino), if it + * is already in the cache, or create a new inode object if it is not in the * cache. * * Note that this function is very similar to simplefs_new_inode, except that @@ -54,9 +55,10 @@ struct inode *simplefs_iget(struct super_block *sb, unsigned long ino) /* If inode is in cache, return it */ #if SIMPLEFS_AT_LEAST(6, 19, 0) if (!(inode_state_read_once(inode) & I_NEW)) -/* inode->i_state is struct inode_state_flags in kernels v6.19 +, - * and inode_state_read_once returns __state from the state flag - * structure which is enum + +/* inode->i_state is struct inode_state_flags in kernels v6.19 +, and + * inode_state_read_once returns __state from the state flag structure which is + * enum */ #else if (!(inode->i_state & I_NEW)) @@ -202,9 +204,8 @@ static int __file_lookup(struct inode *dir, return ret; } -/* Search for a dentry in dir. - * Fills dentry with NULL if not found in dir, or with the corresponding inode - * if found. +/* Search for a dentry in dir. Fills dentry with NULL if not found in dir, or + * with the corresponding inode if found. * Returns NULL on success, indicating the dentry was successfully filled or * confirmed absent. */ @@ -219,7 +220,8 @@ static struct dentry *simplefs_lookup(struct inode *dir, int ei, bi, fi, chk; /* Check filename length less than SIMPLEFS_FILENAME_LEN - 1, the last - * character is for null terminator */ + * character is for null terminator + */ if (dentry->d_name.len >= SIMPLEFS_FILENAME_LEN) return ERR_PTR(-ENAMETOOLONG); @@ -421,13 +423,17 @@ static int simplefs_get_new_ext(struct super_block *sb, eblock->extents[ei].ee_start = bno; eblock->extents[ei].ee_len = SIMPLEFS_MAX_BLOCKS_PER_EXTENT; + /* ee_block is only used for file extent search, not for directory extents. - * Set to 0 as directory operations rely solely on ee_start and ee_len. */ + * Set to 0 as directory operations rely solely on ee_start and ee_len. + */ eblock->extents[ei].ee_block = 0; eblock->extents[ei].nr_files = 0; - /* clear the ext block*/ - /* TODO: fix from 8 to dynamic value */ + /* Clear the ext block. + * + * TODO: fix from 8 to dynamic value + */ for (bi = 0; bi < eblock->extents[ei].ee_len; bi++) { bh = sb_bread(sb, eblock->extents[ei].ee_start + bi); if (!bh) @@ -545,7 +551,8 @@ static int simplefs_create(struct inode *dir, int bi = 0, idx_bi; /* Check filename length less than SIMPLEFS_FILENAME_LEN - 1, the last - * character is for null terminator */ + * character is for null terminator + */ if (strlen(dentry->d_name.name) >= SIMPLEFS_FILENAME_LEN) return -ENAMETOOLONG; @@ -570,8 +577,8 @@ static int simplefs_create(struct inode *dir, goto end; } - /* Scrub ei_block for new file/directory to avoid previous data - * messing with new file/directory. + /* Scrub ei_block for new file/directory to avoid previous data messing with + * new file/directory. */ bh2 = sb_bread(sb, SIMPLEFS_INODE(inode)->ei_block); if (!bh2) { @@ -607,8 +614,10 @@ static int simplefs_create(struct inode *dir, alloc = true; } - /* TODO: fix from 8 to dynamic value */ - /* Find which simplefs_dir_block has free space */ + /* Find which simplefs_dir_block has free space. + * + * TODO: fix from 8 to dynamic value + */ bi = hash_code % eblock->extents[avail].ee_len; for (idx_bi = 0; idx_bi < eblock->extents[avail].ee_len; bi++, idx_bi++) { CHECK_AND_SET_RING_INDEX(bi, eblock->extents[avail].ee_len); @@ -742,8 +751,8 @@ static int simplefs_remove_from_dir(struct inode *dir, return ret; } -/* Remove a link for a file including the reference in the parent directory. - * If link count is 0, destroy file in this way: +/* Remove a link for a file including the reference in the parent directory. If + * link count is 0, destroy file in this way: * - remove the file from its parent directory. * - cleanup blocks containing data * - cleanup file index block @@ -808,9 +817,9 @@ static int simplefs_unlink(struct inode *dir, struct dentry *dentry) /* Cleans up pointed blocks when unlinking a file. If reading the index * block fails, the inode is cleaned up regardless, resulting in the - * permanent loss of this file's blocks. If scrubbing a data block fails, - * do not terminate the operation (as it is already too late); instead, - * release the block and proceed. + * permanent loss of this file's blocks. If scrubbing a data block fails, do + * not terminate the operation (as it is already too late); instead, release + * the block and proceed. */ bno = SIMPLEFS_INODE(inode)->ei_block; bh = sb_bread(sb, bno); @@ -996,8 +1005,9 @@ static int simplefs_rename(struct inode *src_dir, mark_buffer_dirty(dest_ei_bh); /* Track that we inserted the file for cleanup on error */ dest_inserted = 1; - /* Hold dest_bi_bh until the source is removed successfully or - * the operation is rolled back. + + /* Hold dest_bi_bh until the source is removed successfully or the + * operation is rolled back. */ break; } @@ -1206,8 +1216,10 @@ static int simplefs_link(struct dentry *src_dentry, alloc = true; } - /* TODO: fix from 8 to dynamic value */ - /* Find which simplefs_dir_block has free space */ + /* Find which simplefs_dir_block has free space. + * + * TODO: fix from 8 to dynamic value + */ bi = hash_code % eblock->extents[avail].ee_len; for (idx_bi = 0; idx_bi < eblock->extents[avail].ee_len; bi++, idx_bi++) { CHECK_AND_SET_RING_INDEX(bi, eblock->extents[avail].ee_len); @@ -1323,8 +1335,10 @@ static int simplefs_symlink(struct inode *dir, alloc = true; } - /* TODO: fix from 8 to dynamic value */ - /* Find which simplefs_dir_block has free space */ + /* Find which simplefs_dir_block has free space. + * + * TODO: fix from 8 to dynamic value + */ bi = hash_code % eblock->extents[avail].ee_len; for (idx_bi = 0; idx_bi < eblock->extents[avail].ee_len; bi++, idx_bi++) { CHECK_AND_SET_RING_INDEX(bi, eblock->extents[avail].ee_len); diff --git a/mkfs.c b/mkfs.c index 8ae753d..528289a 100644 --- a/mkfs.c +++ b/mkfs.c @@ -110,10 +110,9 @@ static int write_inode_store(int fd, struct superblock *sb) le32toh(sb->info.nr_ifree_blocks) + le32toh(sb->info.nr_istore_blocks); - /* Designate inode 1 as the root inode. - * When the system uses the glibc, the readdir function will skip over - * inode 0. Additionally, the VFS layer avoids using inode 0 to prevent - * potential issues. + /* Designate inode 1 as the root inode. When the system uses the glibc, the + * readdir function will skip over inode 0. Additionally, the VFS layer + * avoids using inode 0 to prevent potential issues. */ inode += 1; inode->i_mode = htole32(S_IFDIR | S_IRUSR | S_IRGRP | S_IROTH | S_IWUSR | diff --git a/script/test_large_file.sh b/script/test_large_file.sh index 9b26b70..4a76240 100755 --- a/script/test_large_file.sh +++ b/script/test_large_file.sh @@ -13,7 +13,8 @@ test_too_large_file() { } # Write the file size larger than BLOCK_SIZE -# test serial to write +# +# Test serial to write test_file_size_larger_than_block_size() { test_op 'yes 123456789 | head -n 1600 | tr -d "\n" > exceed_blk.txt' echo diff --git a/simplefs.h b/simplefs.h index c7aa3c5..10b13b0 100644 --- a/simplefs.h +++ b/simplefs.h @@ -68,8 +68,7 @@ struct simplefs_inode { #define SIMPLEFS_LESS_EQUAL(major, minor, rev) \ (LINUX_VERSION_CODE <= KERNEL_VERSION(major, minor, rev)) -/* A 'container' structure that keeps the VFS inode and additional on-disk - * data. +/* A 'container' structure that keeps the VFS inode and additional on-disk data. */ struct simplefs_inode_info { uint32_t ei_block; /* Block with list of extents for this file */ diff --git a/super.c b/super.c index f5cf93f..ffd8628 100644 --- a/super.c +++ b/super.c @@ -24,8 +24,8 @@ struct dentry *simplefs_mount(struct file_system_type *fs_type, void simplefs_kill_sb(struct super_block *sb); static struct kmem_cache *simplefs_inode_cache; -/* Needed to initiate the inode cache, to allow us to attach - * filesystem-specific inode information. +/* Needed to initiate the inode cache, to allow us to attach filesystem-specific + * inode information. */ int simplefs_init_inode_cache(void) { @@ -352,13 +352,13 @@ static journal_t *simplefs_get_dev_journal(struct super_block *sb, errno = -EINVAL; goto out_bdev; } - /* - * FIXME: Currently, the exact size of the external journal device is not + + /* FIXME: Currently, the exact size of the external journal device is not * available. Therefore, we use the device size divided by the block size to * set `len`. Hint: External device size available now is 8MB. * - * Future implementation might need to change to: - * len = CapacityOfJournalDevice / SIMPLEFS_BLOCK_SIZE + * Future implementation might need to compute len as + * CapacityOfJournalDevice divided by SIMPLEFS_BLOCK_SIZE. */ len = 2048;