-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite with circular doubly-linked list
In original CMU assignment, a singly-linked list was used. However, toward to Linux kernel development, we would like to stick to its linked list implementation. That is, we take the circular doubly-linked list to re-implement the queue oriented operations. In addition, we introduce some LeetCode exercises based on Linux-like lists. Now, queue is replaced with linux kernel linked list. Also, implementation of l_new, l_free, l_insert_head, l_insert_tail, l_remove_head and l_size are added. Implementation of l_sort and l_reverse are added. Add command "mid" which would return the middle element in list. Relative test also be added in this commit Add command "swap" which would swap every two adjacent nodes in list. Relative test also be added in this commit. Reference: https://leetcode.com/problems/swap-nodes-in-pairs/ Replace "get_mid" with "remove_mid", which is LeetCode problem. Relative test bench also be updated in this commit. Reference: https://leetcode.com/problems/delete-the-middle-node-of-a-linked-list/ Add command remove_tail. Suppress the null pointer errors Newer versions of cppcheck find the potential NULL pointer bug in list_entry. The function is difficult to refactor without extensive work, so suppress the potential NULL pointer error which cannot occur for now. remove_tail and remove_head was re-desinged. We extract "free" from remove_.* because "free" is not stable (lead not constant time). Relative testbench also update in this commit. Add function "is_circular" which check if the queue is doubly circular. Suppress simulation of list removal on Arm64 We suffered from some unknown issues that simulation of list removal can not pass on Arm64 based platforms such as ThunderX2/Linux and Apple M1 (macOS). At the moment, we just skip the simulations for Arm64. We support new command: dedup. Relative test bench also be updated. Co-authored-by: eecheng87 <[email protected]>
- Loading branch information
Showing
34 changed files
with
1,228 additions
and
406 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/env bash | ||
|
||
SOURCES=$(find $(git rev-parse --show-toplevel) | egrep "\.(cpp|h)\$") | ||
|
||
set -x | ||
|
||
for file in ${SOURCES}; | ||
do | ||
clang-format-12 ${file} > expected-format | ||
diff -u -p --label="${file}" --label="expected coding style" ${file} expected-format | ||
done | ||
exit $(clang-format-12 --output-replacements-xml ${SOURCES} | egrep -c "</replacement>") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/env bash | ||
|
||
SHA1SUM=$(which sha1sum) | ||
if [ $? -ne 0 ]; then | ||
SHA1SUM=shasum | ||
fi | ||
|
||
$SHA1SUM -c scripts/checksums | ||
if [ $? -ne 0 ]; then | ||
echo "[!] You are not allowed to change the header file queue.h or list.h" >&2 | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: CI | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
lab0-c: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/[email protected] | ||
- name: install-dependencies | ||
run: | | ||
.ci/check-sanity.sh | ||
sudo apt-get update | ||
sudo apt-get -q -y install build-essential cppcheck | ||
- name: make | ||
run: make | ||
- name: make check | ||
run: make check | ||
- name: make test | ||
run: make test | ||
|
||
coding-style: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/[email protected] | ||
- name: coding convention | ||
run: | | ||
sudo apt-get install -q -y clang-format-12 | ||
sh .ci/check-format.sh | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.