Skip to content

Fix workflows lib #68

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
uses: actions/checkout@v4
- name: coding convention
run: |
sudo apt-get install -q -y clang-format-12
sudo apt-get install -q -y clang-format
.ci/check-newline.sh
.ci/check-format.sh
shell: bash
4 changes: 2 additions & 2 deletions file.c
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,8 @@ static ssize_t simplefs_write(struct file *file,
size_t bytes_to_write =
min_t(size_t, len, SIMPLEFS_BLOCK_SIZE - pos % SIMPLEFS_BLOCK_SIZE);

if (copy_from_user(bh_data->b_data + pos % SIMPLEFS_BLOCK_SIZE, buf,
bytes_to_write)) {
if (copy_from_user(bh_data->b_data + pos % SIMPLEFS_BLOCK_SIZE,
buf + bytes_write, bytes_to_write)) {
brelse(bh_data);
bytes_write = -EFAULT;
break;
Expand Down
2 changes: 1 addition & 1 deletion mkfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ _Static_assert(sizeof(struct superblock) == SIMPLEFS_BLOCK_SIZE);
*
* Return the result of n / d, rounded up to the nearest integer.
*/
#define DIV_ROUND_UP(n, d) (((n) + (d) -1) / (d))
#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))

static struct superblock *write_superblock(int fd, struct stat *fstats)
{
Expand Down
12 changes: 12 additions & 0 deletions script/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,18 @@ test_op 'dd if=/dev/zero of=file bs=1M count=12 status=none'
filesize=$(sudo ls -lR | grep -e "$F_MOD 2".*file | awk '{print $5}')
test $filesize -le $MAXFILESIZE || echo "Failed, file size over the limit"

# Write the file size larger than BLOCK_SIZE
# test serial to write
test_op 'bash -c "printf \"%.0s123456789\" {1..1600} > file.txt"'
count=$(awk '{count += gsub(/123456789/, "")} END {print count}' "file.txt")
echo "test $count"
test "$count" -eq 1600 || echo "Failed, file size not matching"
# test block to write
test_op 'cat file.txt > checkfile.txt'
count=$(awk '{count += gsub(/123456789/, "")} END {print count}' "checkfile.txt")
echo "test $count"
test "$count" -eq 1600 || echo "Failed, file size not matching"

# test remove symbolic link
test_op 'ln -s file symlink_fake'
test_op 'rm -f symlink_fake'
Expand Down