Skip to content

Seq file bad #18

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 3 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
14 changes: 7 additions & 7 deletions .github/workflows/busybox.config
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ CONFIG_GZIP_FAST=0
# Coreutils
#
# CONFIG_BASENAME is not set
# CONFIG_CAT is not set
CONFIG_CAT=y
# CONFIG_FEATURE_CATN is not set
# CONFIG_FEATURE_CATV is not set
# CONFIG_CHGRP is not set
Expand All @@ -209,7 +209,7 @@ CONFIG_GZIP_FAST=0
# CONFIG_CP is not set
# CONFIG_FEATURE_CP_LONG_OPTIONS is not set
# CONFIG_FEATURE_CP_REFLINK is not set
# CONFIG_CUT is not set
CONFIG_CUT=y
# CONFIG_DATE is not set
# CONFIG_FEATURE_DATE_ISOFMT is not set
# CONFIG_FEATURE_DATE_NANO is not set
Expand Down Expand Up @@ -263,9 +263,9 @@ CONFIG_GZIP_FAST=0
# CONFIG_SHA512SUM is not set
# CONFIG_SHA3SUM is not set
# CONFIG_FEATURE_MD5_SHA1_SUM_CHECK is not set
# CONFIG_MKDIR is not set
CONFIG_MKDIR=y
# CONFIG_MKFIFO is not set
# CONFIG_MKNOD is not set
CONFIG_MKNOD=y
# CONFIG_MKTEMP is not set
# CONFIG_MV is not set
# CONFIG_NICE is not set
Expand All @@ -280,7 +280,7 @@ CONFIG_GZIP_FAST=0
# CONFIG_READLINK is not set
# CONFIG_FEATURE_READLINK_FOLLOW is not set
# CONFIG_REALPATH is not set
# CONFIG_RM is not set
CONFIG_RM=y
# CONFIG_RMDIR is not set
# CONFIG_SEQ is not set
# CONFIG_SHRED is not set
Expand Down Expand Up @@ -449,7 +449,7 @@ CONFIG_FEATURE_VI_UNDO_QUEUE_MAX=0
# CONFIG_FEATURE_FIND_REGEX is not set
# CONFIG_FEATURE_FIND_CONTEXT is not set
# CONFIG_FEATURE_FIND_LINKS is not set
# CONFIG_GREP is not set
CONFIG_GREP=y
# CONFIG_EGREP is not set
# CONFIG_FGREP is not set
# CONFIG_FEATURE_GREP_CONTEXT is not set
Expand Down Expand Up @@ -635,7 +635,7 @@ CONFIG_DEFAULT_DEPMOD_FILE="modules.dep"
# CONFIG_MKSWAP is not set
# CONFIG_FEATURE_MKSWAP_UUID is not set
# CONFIG_MORE is not set
# CONFIG_MOUNT is not set
CONFIG_MOUNT=y
# CONFIG_FEATURE_MOUNT_FAKE is not set
# CONFIG_FEATURE_MOUNT_VERBOSE is not set
# CONFIG_FEATURE_MOUNT_HELPERS is not set
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,15 @@ jobs:
grep '] rust_semaphore_c: Rust semaphore sample (in C, for comparison) (init)$' qemu-stdout.log
grep '] rust_semaphore_c: Rust semaphore sample (in C, for comparison) (exit)$' qemu-stdout.log

- run: |
grep '] rust_seq_file: Rust seq_file sample (init)$' qemu-stdout.log
grep '] rust_seq_file: Rust seq_file sample (exit)$' qemu-stdout.log
if [ $(grep -c 'rust_seq_file: device opened this many times: 2' qemu-stdout.log) -ne 3 ]; then
exit 1;
else
exit 0;
fi

# Report
- run: |
ls -l \
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/kernel-arm-debug.config
Original file line number Diff line number Diff line change
Expand Up @@ -1665,6 +1665,7 @@ CONFIG_SAMPLE_RUST_MISCDEV=m
CONFIG_SAMPLE_RUST_STACK_PROBING=m
CONFIG_SAMPLE_RUST_SEMAPHORE=m
CONFIG_SAMPLE_RUST_SEMAPHORE_C=m
CONFIG_SAMPLE_RUST_SEQ_FILE=m
# CONFIG_STRICT_DEVMEM is not set

#
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/kernel-arm-release.config
Original file line number Diff line number Diff line change
Expand Up @@ -1589,6 +1589,7 @@ CONFIG_SAMPLE_RUST_MISCDEV=m
CONFIG_SAMPLE_RUST_STACK_PROBING=m
CONFIG_SAMPLE_RUST_SEMAPHORE=m
CONFIG_SAMPLE_RUST_SEMAPHORE_C=m
CONFIG_SAMPLE_RUST_SEQ_FILE=m
# CONFIG_STRICT_DEVMEM is not set

#
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/kernel-arm64-debug.config
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,7 @@ CONFIG_DCACHE_WORD_ACCESS=y
#
# Pseudo filesystems
#
# CONFIG_PROC_FS is not set
CONFIG_PROC_FS=y
# CONFIG_PROC_CHILDREN is not set
# CONFIG_SYSFS is not set
# CONFIG_HUGETLBFS is not set
Expand Down Expand Up @@ -1431,6 +1431,7 @@ CONFIG_SAMPLE_RUST_MISCDEV=m
CONFIG_SAMPLE_RUST_STACK_PROBING=m
CONFIG_SAMPLE_RUST_SEMAPHORE=m
CONFIG_SAMPLE_RUST_SEMAPHORE_C=m
CONFIG_SAMPLE_RUST_SEQ_FILE=m

#
# arm64 Debugging
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/kernel-arm64-release.config
Original file line number Diff line number Diff line change
Expand Up @@ -1064,7 +1064,7 @@ CONFIG_DCACHE_WORD_ACCESS=y
#
# Pseudo filesystems
#
# CONFIG_PROC_FS is not set
CONFIG_PROC_FS=y
# CONFIG_PROC_CHILDREN is not set
# CONFIG_SYSFS is not set
# CONFIG_HUGETLBFS is not set
Expand Down Expand Up @@ -1349,6 +1349,7 @@ CONFIG_SAMPLE_RUST_MISCDEV=m
CONFIG_SAMPLE_RUST_STACK_PROBING=m
CONFIG_SAMPLE_RUST_SEMAPHORE=m
CONFIG_SAMPLE_RUST_SEMAPHORE_C=m
CONFIG_SAMPLE_RUST_SEQ_FILE=m

#
# arm64 Debugging
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/kernel-ppc64le-debug.config
Original file line number Diff line number Diff line change
Expand Up @@ -1491,6 +1491,7 @@ CONFIG_SAMPLE_RUST_MISCDEV=m
CONFIG_SAMPLE_RUST_STACK_PROBING=m
CONFIG_SAMPLE_RUST_SEMAPHORE=m
CONFIG_SAMPLE_RUST_SEMAPHORE_C=m
CONFIG_SAMPLE_RUST_SEQ_FILE=m
CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y
# CONFIG_STRICT_DEVMEM is not set

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/kernel-ppc64le-release.config
Original file line number Diff line number Diff line change
Expand Up @@ -1453,6 +1453,7 @@ CONFIG_SAMPLE_RUST_MISCDEV=m
CONFIG_SAMPLE_RUST_STACK_PROBING=m
CONFIG_SAMPLE_RUST_SEMAPHORE=m
CONFIG_SAMPLE_RUST_SEMAPHORE_C=m
CONFIG_SAMPLE_RUST_SEQ_FILE=m
CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y
# CONFIG_STRICT_DEVMEM is not set

Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/kernel-x86_64-debug.config
Original file line number Diff line number Diff line change
Expand Up @@ -1059,7 +1059,7 @@ CONFIG_DCACHE_WORD_ACCESS=y
#
# Pseudo filesystems
#
# CONFIG_PROC_FS is not set
CONFIG_PROC_FS=y
# CONFIG_PROC_CHILDREN is not set
CONFIG_KERNFS=y
CONFIG_SYSFS=y
Expand Down Expand Up @@ -1443,6 +1443,7 @@ CONFIG_SAMPLE_RUST_MISCDEV=m
CONFIG_SAMPLE_RUST_STACK_PROBING=m
CONFIG_SAMPLE_RUST_SEMAPHORE=m
CONFIG_SAMPLE_RUST_SEMAPHORE_C=m
CONFIG_SAMPLE_RUST_SEQ_FILE=m
CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y
# CONFIG_STRICT_DEVMEM is not set

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/kernel-x86_64-release.config
Original file line number Diff line number Diff line change
Expand Up @@ -1391,6 +1391,7 @@ CONFIG_SAMPLE_RUST_MISCDEV=m
CONFIG_SAMPLE_RUST_STACK_PROBING=m
CONFIG_SAMPLE_RUST_SEMAPHORE=m
CONFIG_SAMPLE_RUST_SEMAPHORE_C=m
CONFIG_SAMPLE_RUST_SEQ_FILE=m
CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y
# CONFIG_STRICT_DEVMEM is not set

Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/qemu-init.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
#!/bin/sh

busybox insmod rust_seq_file.ko
busybox mkdir proc
busybox mount -t proc proc /proc
export RUST_SEQ_MINOR=$(busybox cat /proc/misc | busybox grep rust_seq_file | busybox cut -d ' ' -f 1)
busybox mknod /dev/rust_seq_file0 c 10 $RUST_SEQ_MINOR
busybox cat /dev/rust_seq_file0
busybox cat /dev/rust_seq_file0
busybox cat /proc/rust_seq_file
busybox rm /dev/rust_seq_file0
busybox rmmod rust_seq_file.ko

busybox insmod rust_minimal.ko
busybox rmmod rust_minimal.ko

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/qemu-initramfs.desc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ file /rust_miscdev.ko samples/rust/rust_miscdev.ko 0755
file /rust_stack_probing.ko samples/rust/rust_stack_probing.ko 0755 0 0
file /rust_semaphore.ko samples/rust/rust_semaphore.ko 0755 0 0
file /rust_semaphore_c.ko samples/rust/rust_semaphore_c.ko 0755 0 0
file /rust_seq_file.ko samples/rust/rust_seq_file.ko 0755 0 0

file /rust_module_parameters_loadable_default.ko samples/rust/rust_module_parameters_loadable_default.ko 0755 0 0
file /rust_module_parameters_loadable_custom.ko samples/rust/rust_module_parameters_loadable_custom.ko 0755 0 0
2 changes: 2 additions & 0 deletions rust/kernel/bindings_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
#include <linux/cdev.h>
#include <linux/fs.h>
#include <linux/module.h>
#include <linux/proc_fs.h>
#include <linux/random.h>
#include <linux/seq_file.h>
#include <linux/slab.h>
#include <linux/sysctl.h>
#include <linux/uaccess.h>
Expand Down
1 change: 1 addition & 0 deletions rust/kernel/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ pub mod module_param;
pub mod prelude;
pub mod print;
pub mod random;
pub mod seq_file;
mod static_assert;
pub mod sync;

Expand Down
Loading