Skip to content

Commit

Permalink
[style] format the code style
Browse files Browse the repository at this point in the history
  • Loading branch information
Azure-stars committed Nov 21, 2024
1 parent ed2162b commit 531a50c
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 10 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ axerrno = "0.1"
memory_addr = "0.3"
xmas-elf = "0.9"
bitflags = "2.6"

kernel-elf-parser = "0.1.0"
num_enum = { version = "0.7", default-features = false }
syscalls = { version = "0.6", default-features = false }
Expand Down
3 changes: 2 additions & 1 deletion apps/libc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ build_rust:
for app in $(shell find rust -name Cargo.toml); do \
echo "Building $$(dirname $${app})"; \
app_name=$$(basename $$(dirname $${app})); \
RUSTFLAGS=$(RUSTFLAGS) cargo build --release --target $(RUST_TARGET) --manifest-path $${app} ; \
export RUSTFLAGS=$(RUSTFLAGS); \
cargo build --release --target $(RUST_TARGET) --manifest-path $${app} ; \
cp $$(dirname $${app})/target/$(RUST_TARGET)/release/$${app_name} build/$(ARCH)/$${app_name}_rust ; \
done \
fi
Expand Down
16 changes: 14 additions & 2 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,22 @@ fn gen_kernel_config(arch: &str) -> Result<()> {
let key_name = key.to_uppercase().replace('-', "_");
match value {
toml_edit::Value::Integer(i) => {
writeln!(f, "pub(crate) const {}: usize = {};", key_name, i)?;
writeln!(
f,
"
#[allow(dead_code)]\n
pub const {}: usize = {};",
key_name, i
)?;
}
toml_edit::Value::String(s) => {
writeln!(f, "pub(crate) const {}: &str = \"{}\";", key_name, s)?;
writeln!(
f,
"
#[allow(dead_code)]\n
pub const {}: &str = \"{}\";",
key_name, s
)?;
}
_ => {
panic!("Unsupported value type");
Expand Down
4 changes: 2 additions & 2 deletions src/syscall_imp/mm/mmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ use memory_addr::{VirtAddr, VirtAddrRange};
use crate::syscall_body;

bitflags::bitflags! {
#[derive(Debug)]
/// permissions for sys_mmap
///
/// See <https://github.com/bminor/glibc/blob/master/bits/mman.h>
#[derive(Debug)]
struct MmapProt: i32 {
/// Page can be read.
const PROT_READ = 1 << 0;
Expand Down Expand Up @@ -37,10 +37,10 @@ impl From<MmapProt> for MappingFlags {
}

bitflags::bitflags! {
#[derive(Debug)]
/// flags for sys_mmap
///
/// See <https://github.com/bminor/glibc/blob/master/bits/mman.h>
#[derive(Debug)]
struct MmapFlags: i32 {
/// Share changes
const MAP_SHARED = 1 << 0;
Expand Down
10 changes: 6 additions & 4 deletions src/syscall_imp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@ mod fs;
mod mm;
mod task;
mod time;

use axerrno::LinuxError;
use axhal::{
arch::TrapFrame,
trap::{register_trap_handler, SYSCALL},
};
use fs::*;
use mm::*;
use syscalls::Sysno;
use task::*;
use time::*;

use self::fs::*;
use self::mm::*;
use self::task::*;
use self::time::*;

/// Macro to generate syscall body
///
Expand Down

0 comments on commit 531a50c

Please sign in to comment.