data_type large_stringclasses 3
values | source large_stringclasses 29
values | code large_stringlengths 98 49.4M | filepath large_stringlengths 5 161 ⌀ | message large_stringclasses 234
values | commit large_stringclasses 234
values | subject large_stringclasses 418
values | critique large_stringlengths 101 1.26M ⌀ | metadata dict |
|---|---|---|---|---|---|---|---|---|
source | asterinas | // SPDX-License-Identifier: MPL-2.0
//! This module offers `/proc/uptime` file support, which provides
//! information about the system uptime and idle time.
//!
//! Reference: <https://man7.org/linux/man-pages/man5/proc_uptime.5.html>
use aster_util::printer::VmPrinter;
use crate::{
fs::{
procfs::templa... | kernel/src/fs/procfs/uptime.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
//! This module offers `/proc/version` file support, which provides
//! information about the kernel version.
//!
//! Reference: <https://man7.org/linux/man-pages/man5/proc_version.5.html>
use aster_util::printer::VmPrinter;
use crate::{
fs::{
procfs::template::{FileOp... | kernel/src/fs/procfs/version.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use aster_util::slot_vec::SlotVec;
use ostd::sync::RwMutexUpgradeableGuard;
use super::template::{
DirOps, ProcDir, ProcDirBuilder, lookup_child_from_table, populate_children_from_table,
};
use crate::{
fs::{
procfs::pid::task::{TaskDirOps, TidDirOps},
utils... | kernel/src/fs/procfs/pid/mod.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use aster_systree::SysObj;
use aster_util::printer::VmPrinter;
use crate::{
fs::{
procfs::{
pid::TidDirOps,
template::{FileOps, ProcFileBuilder},
},
utils::{Inode, mkmod},
},
prelude::*,
};
/// Represents the inode at `/p... | kernel/src/fs/procfs/pid/task/cgroup.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::TidDirOps;
use crate::{
fs::{
procfs::template::{FileOps, ProcFileBuilder},
utils::{Inode, mkmod},
},
prelude::*,
process::Process,
};
/// Represents the inode at `/proc/[pid]/task/[tid]/cmdline` (and also `/proc/[pid]/cmdline`).
pub struc... | kernel/src/fs/procfs/pid/task/cmdline.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::TidDirOps;
use crate::{
fs::{
procfs::template::{FileOps, ProcFileBuilder},
utils::{Inode, mkmod},
},
prelude::*,
process::Process,
};
/// Represents the inode at `/proc/[pid]/task/[tid]/comm` (and also `/proc/[pid]/comm`).
pub struct Comm... | kernel/src/fs/procfs/pid/task/comm.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::TidDirOps;
use crate::{
fs::{
procfs::template::{FileOps, ProcFileBuilder},
utils::{Inode, mkmod},
},
prelude::*,
process::Process,
};
/// Represents the inode at `/proc/[pid]/task/[tid]/environ` (and also `/proc/[pid]/environ`).
pub struc... | kernel/src/fs/procfs/pid/task/environ.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::TidDirOps;
use crate::{
fs::{
procfs::{ProcSymBuilder, SymOps},
utils::{Inode, SymbolicLink, mkmod},
},
prelude::*,
process::Process,
};
/// Represents the inode at `/proc/[pid]/task/[tid]/exe` (and also `/proc/[pid]/exe`).
pub struct ExeS... | kernel/src/fs/procfs/pid/task/exe.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use core::marker::PhantomData;
use aster_util::{printer::VmPrinter, slot_vec::SlotVec};
use ostd::sync::RwMutexUpgradeableGuard;
use super::TidDirOps;
use crate::{
fs::{
file_handle::FileLike,
file_table::FileDesc,
procfs::{
DirOps, ProcDir,... | kernel/src/fs/procfs/pid/task/fd.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use aster_util::printer::VmPrinter;
use super::TidDirOps;
use crate::{
fs::{
procfs::template::{FileOps, ProcFileBuilder},
utils::{Inode, mkmod},
},
prelude::*,
process::{Gid, Process},
};
/// Represents the inode at `/proc/[pid]/task/[tid]/gid_map`... | kernel/src/fs/procfs/pid/task/gid_map.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use aster_util::printer::VmPrinter;
use super::TidDirOps;
use crate::{
fs::{
procfs::template::{FileOps, ProcFileBuilder},
utils::{Inode, mkmod},
},
prelude::*,
process::{Process, posix_thread::AsPosixThread},
vm::vmar::{VMAR_CAP_ADDR, VMAR_LOWES... | kernel/src/fs/procfs/pid/task/maps.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::TidDirOps;
use crate::{
fs::{
procfs::template::{FileOps, ProcFileBuilder},
utils::{Inode, mkmod},
},
prelude::*,
process::Process,
};
/// Represents the inode at `/proc/[pid]/task/[tid]/mem` (and also `/proc/[pid]/mem`).
pub struct MemFil... | kernel/src/fs/procfs/pid/task/mem.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use aster_util::slot_vec::SlotVec;
use ostd::sync::RwMutexUpgradeableGuard;
use super::PidDirOps;
use crate::{
events::Observer,
fs::{
procfs::{
pid::task::{
cgroup::CgroupFileOps, cmdline::CmdlineFileOps, comm::CommFileOps,
... | kernel/src/fs/procfs/pid/task/mod.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use aster_util::printer::VmPrinter;
use super::TidDirOps;
use crate::{
fs::{
path::{Mount, Path, PathResolver, PerMountFlags},
procfs::template::{FileOps, ProcFileBuilder},
utils::{FsFlags, Inode, mkmod},
},
prelude::*,
process::posix_thread:... | kernel/src/fs/procfs/pid/task/mountinfo.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use aster_util::printer::VmPrinter;
use super::TidDirOps;
use crate::{
fs::{
path::{PathResolver, PerMountFlags},
procfs::{
pid::task::mountinfo::make_mount_point_path,
template::{FileOps, ProcFileBuilder},
},
utils::{Inod... | kernel/src/fs/procfs/pid/task/mounts.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use core::sync::atomic::Ordering;
use aster_util::printer::VmPrinter;
use super::TidDirOps;
use crate::{
fs::{
procfs::template::{FileOps, ProcFileBuilder},
utils::{Inode, mkmod},
},
prelude::*,
process::Process,
};
/// Represents the inode at `/pr... | kernel/src/fs/procfs/pid/task/oom_score_adj.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use core::sync::atomic::Ordering;
use aster_util::printer::VmPrinter;
use super::TidDirOps;
use crate::{
fs::{
procfs::template::{FileOps, ProcFileBuilder},
utils::{Inode, mkmod},
},
prelude::*,
process::posix_thread::{AsPosixThread, SleepingState},... | kernel/src/fs/procfs/pid/task/stat.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use aster_util::printer::VmPrinter;
use super::TidDirOps;
use crate::{
fs::{
procfs::template::{FileOps, ProcFileBuilder},
utils::{Inode, mkmod},
},
prelude::*,
process::{
credentials::{AMBIENT_CAPSET, BOUNDING_CAPSET},
posix_thread::... | kernel/src/fs/procfs/pid/task/status.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use aster_util::printer::VmPrinter;
use super::TidDirOps;
use crate::{
fs::{
procfs::template::{FileOps, ProcFileBuilder},
utils::{Inode, mkmod},
},
prelude::*,
process::{Process, Uid},
};
/// Represents the inode at `/proc/[pid]/task/[tid]/uid_map`... | kernel/src/fs/procfs/pid/task/uid_map.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use aster_util::slot_vec::SlotVec;
use ostd::sync::RwMutexUpgradeableGuard;
use self::kernel::KernelDirOps;
use super::template::populate_children_from_table;
use crate::{
fs::{
procfs::template::{DirOps, ProcDir, ProcDirBuilder, lookup_child_from_table},
utils:... | kernel/src/fs/procfs/sys/mod.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use aster_util::printer::VmPrinter;
use crate::{
fs::{
procfs::template::{FileOps, ProcFileBuilder},
utils::{Inode, mkmod},
},
prelude::*,
process::credentials::capabilities::CapSet,
};
/// Represents the inode at `/proc/sys/kernel/cap_last_cap`.
pu... | kernel/src/fs/procfs/sys/kernel/cap_last_cap.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use aster_util::slot_vec::SlotVec;
use ostd::sync::RwMutexUpgradeableGuard;
use crate::{
fs::{
procfs::{
ProcDir,
sys::kernel::{cap_last_cap::CapLastCapFileOps, pid_max::PidMaxFileOps},
template::{
DirOps, ProcDirBuild... | kernel/src/fs/procfs/sys/kernel/mod.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use aster_util::printer::VmPrinter;
use crate::{
fs::{
procfs::template::{FileOps, ProcFileBuilder},
utils::{Inode, mkmod},
},
prelude::*,
process::posix_thread::PID_MAX,
};
/// Represents the inode at `/proc/sys/kernel/pid_max`.
pub struct PidMaxFi... | kernel/src/fs/procfs/sys/kernel/pid_max.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::{
dir::{DirOps, ProcDir},
file::{FileOps, ProcFile},
sym::{ProcSym, SymOps},
};
use crate::{
fs::utils::{FileSystem, Inode, InodeMode},
prelude::*,
};
pub struct ProcDirBuilder<O: DirOps> {
// Mandatory field
dir: O,
mode: InodeMode,
/... | kernel/src/fs/procfs/template/builder.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use core::time::Duration;
use aster_util::slot_vec::SlotVec;
use inherit_methods_macro::inherit_methods;
use ostd::sync::RwMutexUpgradeableGuard;
use super::{Common, ProcFs};
use crate::{
fs::{
path::{is_dot, is_dotdot},
utils::{
DirEntryVecExt, Dir... | kernel/src/fs/procfs/template/dir.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use core::time::Duration;
use inherit_methods_macro::inherit_methods;
use super::{Common, ProcFs};
use crate::{
fs::utils::{
Extension, FileSystem, Inode, InodeIo, InodeMode, InodeType, Metadata, StatusFlags,
SymbolicLink,
},
prelude::*,
process::{G... | kernel/src/fs/procfs/template/file.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use core::time::Duration;
pub(super) use self::{
builder::{ProcDirBuilder, ProcFileBuilder, ProcSymBuilder},
dir::{DirOps, ProcDir, lookup_child_from_table, populate_children_from_table},
file::{FileOps, ProcFile},
sym::{ProcSym, SymOps},
};
use super::{BLOCK_SIZE, ... | kernel/src/fs/procfs/template/mod.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use core::time::Duration;
use inherit_methods_macro::inherit_methods;
use super::{Common, ProcFs};
use crate::{
fs::utils::{
Extension, FileSystem, Inode, InodeIo, InodeMode, InodeType, Metadata, StatusFlags,
SymbolicLink,
},
prelude::*,
process::{G... | kernel/src/fs/procfs/template/sym.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use core::{
sync::atomic::{AtomicU64, Ordering},
time::Duration,
};
use align_ext::AlignExt;
use aster_block::bio::BioWaiter;
use aster_util::slot_vec::SlotVec;
use device_id::DeviceId;
use hashbrown::HashMap;
use ostd::{
mm::{HasSize, io_util::HasVmReaderWriter},
s... | kernel/src/fs/ramfs/fs.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
//! Memfd Implementation.
use alloc::format;
use core::time::Duration;
use align_ext::AlignExt;
use aster_block::bio::BioWaiter;
use aster_rights::Rights;
use inherit_methods_macro::inherit_methods;
use spin::Once;
use super::fs::RamInode;
use crate::{
fs::{
inode_han... | kernel/src/fs/ramfs/memfd.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
//! Ramfs based on PageCache
pub use fs::RamFs;
use fs::RamFsType;
mod fs;
pub mod memfd;
mod xattr;
const RAMFS_MAGIC: u64 = 0x8584_58f6;
const BLOCK_SIZE: usize = 4096;
const ROOT_INO: u64 = 1;
const NAME_MAX: usize = 255;
pub(super) fn init() {
super::registry::register(&... | kernel/src/fs/ramfs/mod.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use hashbrown::{Equivalent, HashMap, hash_map::Entry};
use spin::Once;
use crate::{
fs::utils::{InodeType, XattrName, XattrNamespace, XattrSetFlags},
prelude::*,
};
/// An in-memory xattr object of a `RamInode`.
/// An xattr is used to manage special 'name-value' pairs of ... | kernel/src/fs/ramfs/xattr.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use spin::Once;
use crate::{
fs::{
Result,
registry::{FsProperties, FsType},
sysfs::{self, inode::SysFsInode},
utils::{
FileSystem, FsEventSubscriberStats, FsFlags, Inode, SuperBlock,
systree_inode::SysTreeInodeTy,
... | kernel/src/fs/sysfs/fs.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use alloc::sync::{Arc, Weak};
use ostd::sync::RwLock;
use super::fs::SysFs;
use crate::{
fs::utils::{
Extension, FileSystem, Inode, InodeMode, InodeType, Metadata,
systree_inode::{SysTreeInodeTy, SysTreeNodeKind},
},
prelude::*,
};
/// An inode abstrac... | kernel/src/fs/sysfs/inode.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use alloc::sync::Arc;
use aster_systree::{
BranchNodeFields, Error, Result, SysAttrSetBuilder, SysBranchNode, SysNode, SysPerms, SysStr,
inherit_sys_branch_node,
};
use inherit_methods_macro::inherit_methods;
use ostd::mm::{VmReader, VmWriter};
use spin::Once;
/// Register... | kernel/src/fs/sysfs/kernel.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
mod fs;
mod inode;
mod kernel;
#[cfg(ktest)]
mod test;
use aster_systree::SysNode;
pub use aster_systree::primary_tree as systree_singleton;
use fs::SysFsType;
use crate::prelude::*;
// This method should be called during kernel file system initialization,
// _after_ `aster_systr... | kernel/src/fs/sysfs/mod.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use alloc::{
borrow::Cow,
collections::BTreeMap,
format,
string::{String, ToString},
sync::Arc,
vec,
vec::Vec,
};
use core::fmt::Debug;
use aster_systree::{
BranchNodeFields, Error as SysTreeError, NormalNodeFields, Result as SysTreeResult,
Symli... | kernel/src/fs/sysfs/test.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use crate::{
fs::{
ramfs::RamFs,
registry::{FsProperties, FsType},
utils::{FileSystem, FsEventSubscriberStats, FsFlags, Inode, SuperBlock},
},
prelude::*,
};
/// The temporary file system (tmpfs) structure.
//
// TODO: Currently, tmpfs is impleme... | kernel/src/fs/tmpfs/fs.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
//! Temporary file system (tmpfs) based on RamFs.
pub(super) use fs::TmpFs;
use fs::TmpFsType;
mod fs;
#[expect(dead_code)]
const TMPFS_MAGIC: u64 = 0x0102_1994;
pub(super) fn init() {
super::registry::register(&TmpFsType).unwrap();
} | kernel/src/fs/tmpfs/mod.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use aster_rights::Rights;
use crate::prelude::*;
#[expect(non_camel_case_types)]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum AccessMode {
/// Read only
O_RDONLY = 0,
/// Write only
O_WRONLY = 1,
/// Read write
O_RDWR = 2,
}
impl Acces... | kernel/src/fs/utils/access_mode.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use bitflags::bitflags;
bitflags! {
// TODO: Add O_TMPFILE
pub struct CreationFlags: u32 {
/// create file if it does not exist
const O_CREAT = 1 << 6;
/// error if CREATE and the file exists
const O_EXCL = 1 << 7;
/// not become the ... | kernel/src/fs/utils/creation_flags.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#![expect(unused_variables)]
use super::InodeType;
use crate::{fs::path::is_dot_or_dotdot, prelude::*};
/// A visitor for dir entries.
pub trait DirentVisitor {
/// Visit a dir entry.
///
/// If the visitor succeeds in visiting the given inode, an `Ok(())` is returned;... | kernel/src/fs/utils/dirent_visitor.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use aster_util::slot_vec::SlotVec;
use super::Inode;
use crate::prelude::*;
pub trait DirEntryVecExt {
/// Finds the entry by the `name`.
fn find_entry_by_name(&self, name: &str) -> Option<&Arc<dyn Inode>>;
/// Puts the entry given by `f` into the vector if it is not ... | kernel/src/fs/utils/direntry_vec.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use alloc::sync::Arc;
use core::sync::atomic::{AtomicBool, Ordering};
use crate::{
events::IoEvents,
prelude::*,
process::signal::{PollHandle, Pollee},
};
/// One of two connected endpoints.
///
/// There is a `T` on the local endpoint and another `T` on the remote end... | kernel/src/fs/utils/endpoint.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use crate::prelude::*;
/// Represents the various operation modes for fallocate.
///
/// Each mode determines whether the target disk space within a file
/// will be allocated, deallocated, or zeroed, among other operations.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Fal... | kernel/src/fs/utils/falloc_mode.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use core::sync::atomic::AtomicU16;
use atomic_integer_wrapper::define_atomic_version_of_integer_like_type;
use crate::prelude::*;
/// A mask for the file mode of a newly-created file or directory.
///
/// This mask is always a subset of `0o777`.
pub struct FileCreationMask(u16);
... | kernel/src/fs/utils/file_creation_mask.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use alloc::fmt;
use core::ptr;
use ostd::sync::{WaitQueue, Waiter, Waker};
use crate::{
fs::{file_handle::FileLike, inode_handle::InodeHandle},
prelude::*,
};
/// Represents a file lock (FLOCK) with an owner and type.
#[derive(Debug, Clone)]
struct Flock {
/// Owner of... | kernel/src/fs/utils/flock.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use core::sync::atomic::{AtomicI64, AtomicU32, Ordering};
use atomic_integer_wrapper::define_atomic_version_of_integer_like_type;
use super::Inode;
use crate::prelude::*;
#[derive(Debug, Clone)]
pub struct SuperBlock {
pub magic: u64,
pub bsize: usize,
pub blocks: usi... | kernel/src/fs/utils/fs.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use core::ops::Range;
use aster_block::BLOCK_SIZE;
use bitvec::{
order::Lsb0,
slice::BitSlice,
view::{AsBits, AsMutBits},
};
use crate::prelude::*;
/// A disk I/O-friendly bitmap for ID management (e.g., block or inode IDs).
///
/// An ID bitmap has the same size as a... | kernel/src/fs/utils/id_bitmap.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#![expect(unused_variables)]
use alloc::boxed::ThinBox;
use core::time::Duration;
use core2::io::{Error as IoError, ErrorKind as IoErrorKind, Result as IoResult, Write};
use ostd::task::Task;
use spin::Once;
use super::{
AccessMode, DirentVisitor, FallocMode, FileSystem, Inod... | kernel/src/fs/utils/inode.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use alloc::boxed::ThinBox;
use super::{FlockList, Inode, RangeLockList};
use crate::fs::notify::FsEventPublisher;
/// Context for FS locks.
pub struct FsLockContext {
range_lock_list: RangeLockList,
flock_list: FlockList,
}
impl FsLockContext {
pub(self) fn new() -> S... | kernel/src/fs/utils/inode_ext.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use aster_systree::SysPerms;
use crate::prelude::*;
bitflags! {
pub struct InodeMode: u16 {
/// set-user-ID
const S_ISUID = 0o4000;
/// set-group-ID
const S_ISGID = 0o2000;
/// sticky bit
const S_ISVTX = 0o1000;
/// read ... | kernel/src/fs/utils/inode_mode.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use crate::util::ioctl::{OutData, ioc};
// Reference: <https://elixir.bootlin.com/linux/v6.18/source/include/uapi/asm-generic/ioctls.h>
pub type GetNumBytesToRead = ioc!(FIONREAD, 0x541B, OutData<i32>); | kernel/src/fs/utils/ioctl_defs.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
//! VFS components
pub use access_mode::AccessMode;
pub use creation_flags::CreationFlags;
pub use dirent_visitor::{DirentCounter, DirentVisitor};
pub use direntry_vec::DirEntryVecExt;
pub use endpoint::{Endpoint, EndpointState};
pub use falloc_mode::FallocMode;
pub use file_creati... | kernel/src/fs/utils/mod.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use crate::{
fs::utils::{AccessMode, CreationFlags, InodeMode, StatusFlags},
prelude::*,
};
/// Arguments for an open request.
#[derive(Debug)]
pub struct OpenArgs {
pub creation_flags: CreationFlags,
pub status_flags: StatusFlags,
pub access_mode: AccessMode,
... | kernel/src/fs/utils/open_args.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#![expect(dead_code)]
use core::{
ops::Range,
sync::atomic::{AtomicU8, Ordering},
};
use align_ext::AlignExt;
use aster_block::bio::{BioStatus, BioWaiter};
use lru::LruCache;
use ostd::{
impl_untyped_frame_meta_for,
mm::{Frame, FrameAllocOptions, UFrame, VmIoFill},... | kernel/src/fs/utils/page_cache.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
#![expect(unused_variables)]
use alloc::sync::Arc;
use hashbrown::HashMap;
use rand::{Rng, RngCore};
use super::{Inode, InodeMode, InodeType};
use crate::prelude::*;
pub struct FileInMemory {
pub name: String,
pub inode: Arc<dyn Inode>,
pub valid_len: usize,
pub ... | kernel/src/fs/utils/random_test.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use core::sync::atomic::AtomicU32;
use atomic_integer_wrapper::define_atomic_version_of_integer_like_type;
use bitflags::bitflags;
bitflags! {
pub struct StatusFlags: u32 {
/// append on each write
const O_APPEND = 1 << 10;
/// non block
const O... | kernel/src/fs/utils/status_flags.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use alloc::{
borrow::Cow,
boxed::Box,
string::ToString,
sync::{Arc, Weak},
vec::Vec,
};
use core::time::Duration;
use aster_systree::{
SysAttr, SysBranchNode, SysNode, SysNodeId, SysNodeType, SysObj, SysStr, SysSymlink,
};
use super::Extension;
use crate::{... | kernel/src/fs/utils/systree_inode.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use crate::prelude::*;
pub const XATTR_NAME_MAX_LEN: usize = 255;
pub const XATTR_VALUE_MAX_LEN: usize = 65536;
pub const XATTR_LIST_MAX_LEN: usize = 65536;
/// Represents different namespaces with different capabilities
/// for extended attributes (xattrs).
#[derive(Debug, Partia... | kernel/src/fs/utils/xattr.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use core::fmt;
use ostd::sync::{RwMutexWriteGuard, WaitQueue, Waiter, Waker};
pub use range::{FileRange, OFFSET_MAX};
use range::{FileRangeChange, OverlapWith};
use crate::{prelude::*, process::Pid};
mod range;
/// The metadata of a POSIX advisory file range lock.
#[derive(Debug... | kernel/src/fs/utils/range_lock/mod.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use crate::prelude::*;
/// The maximum offset in a file.
pub const OFFSET_MAX: usize = i64::MAX as usize;
/// A range in a file.
///
/// The range is [start, end).
/// The range is valid if start < end.
/// The range is empty if start == end.
/// The range is [0, OFFSET_MAX] if it... | kernel/src/fs/utils/range_lock/range.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use crate::{
prelude::*,
process::{Gid, Uid},
};
pub mod semaphore;
#[expect(non_camel_case_types)]
pub type key_t = i32;
bitflags! {
pub struct IpcFlags: u32{
/// Create key if key does not exist
const IPC_CREAT = 1 << 9;
/// Fail if key exis... | kernel/src/ipc/mod.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
//! Semaphore for the system, including System V semaphore and
//! POSIX semaphore.
pub mod posix;
pub mod system_v;
pub(super) fn init_in_first_kthread() {
system_v::init_in_first_kthread();
} | kernel/src/ipc/semaphore/mod.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
//! System V semaphore.
use bitflags::bitflags;
pub mod sem;
pub mod sem_set;
bitflags! {
pub struct PermissionMode: u16{
const ALTER = 0o002;
const WRITE = 0o002;
const READ = 0o004;
}
}
pub(super) fn init_in_first_kthread() {
sem_set::in... | kernel/src/ipc/semaphore/system_v/mod.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use core::{
slice::Iter,
sync::atomic::{AtomicU16, Ordering},
time::Duration,
};
use atomic_integer_wrapper::define_atomic_version_of_integer_like_type;
use ostd::sync::{PreemptDisabled, Waiter, Waker};
use super::sem_set::{SEMVMX, SemSetInner};
use crate::{
ipc::{... | kernel/src/ipc/semaphore/system_v/sem.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use alloc::{collections::btree_map::BTreeMap, vec::Vec};
use core::sync::atomic::{AtomicU64, Ordering};
use aster_rights::ReadOp;
use id_alloc::IdAlloc;
use ostd::sync::{PreemptDisabled, RwLockReadGuard, RwLockWriteGuard};
use spin::Once;
use super::{
PermissionMode,
sem::... | kernel/src/ipc/semaphore/system_v/sem_set.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
pub mod iface;
pub mod socket;
pub mod uts_ns;
pub fn init() {
iface::init();
socket::netlink::init();
socket::vsock::init();
}
/// Lazy init should be called after spawning init thread.
pub fn init_in_first_kthread() {
iface::init_in_first_kthread();
} | kernel/src/net/mod.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use ostd::{const_assert, sync::RwMutexReadGuard};
use spin::Once;
use crate::{
prelude::*,
process::{UserNamespace, credentials::capabilities::CapSet, posix_thread::PosixThread},
util::padded,
};
/// The UTS namespace.
pub struct UtsNamespace {
uts_name: RwMutex<Ut... | kernel/src/net/uts_ns.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use core::net::Ipv4Addr;
use aster_bigtcp::wire::{IpAddress, IpEndpoint};
use spin::Once;
use crate::{net::iface::iter_all_ifaces, prelude::*};
/// All known broadcast addresses.
// FIXME: This information should be maintained in the routing table,
// since a broadcast address mi... | kernel/src/net/iface/broadcast.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::sched::PollScheduler;
use crate::net::socket::ip::{DatagramObserver, StreamObserver};
pub struct BigtcpExt;
impl aster_bigtcp::ext::Ext for BigtcpExt {
type ScheduleNextPoll = PollScheduler;
type TcpEventObserver = StreamObserver;
type UdpEventObserver = Da... | kernel/src/net/iface/ext.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use alloc::borrow::ToOwned;
use core::slice::Iter;
use aster_bigtcp::{
device::WithDevice,
iface::{InterfaceFlags, InterfaceType},
};
use aster_softirq::BottomHalfDisabled;
use spin::Once;
use super::{Iface, poll::poll_ifaces};
use crate::{
net::iface::{broadcast, sche... | kernel/src/net/iface/init.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
mod broadcast;
mod ext;
mod init;
mod poll;
mod sched;
pub use broadcast::is_broadcast_endpoint;
pub use init::{init, iter_all_ifaces, loopback_iface, virtio_iface};
pub(super) use poll::init_in_first_kthread;
pub type Iface = dyn aster_bigtcp::iface::Iface<ext::BigtcpExt>;
pub ty... | kernel/src/net/iface/mod.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use alloc::sync::Arc;
use core::time::Duration;
use log::trace;
use ostd::timer::Jiffies;
use super::{Iface, iter_all_ifaces};
use crate::{
sched::{Nice, SchedPolicy},
thread::kernel_thread::ThreadOptions,
time::wait::WaitTimeout,
};
pub fn init_in_first_kthread() {
... | kernel/src/net/iface/poll.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use core::sync::atomic::{AtomicU64, Ordering};
use aster_bigtcp::iface::ScheduleNextPoll;
use ostd::sync::WaitQueue;
pub struct PollScheduler {
/// The time when we should do the next poll.
/// We store the total number of milliseconds since the system booted.
next_pol... | kernel/src/net/iface/sched.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use core::fmt::Display;
use options::SocketOption;
use util::{MessageHeader, SendRecvFlags, SockShutdownCmd, SocketAddr};
use crate::{
fs::{
file_handle::FileLike,
file_table::FdFlags,
path::Path,
pseudofs::SockFs,
utils::{CreationFlags,... | kernel/src/net/socket/mod.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use aster_bigtcp::wire::{IpAddress, IpEndpoint, Ipv4Address};
use crate::{net::socket::util::SocketAddr, prelude::*, return_errno_with_message};
impl TryFrom<SocketAddr> for IpEndpoint {
type Error = Error;
fn try_from(value: SocketAddr) -> Result<Self> {
match va... | kernel/src/net/socket/ip/addr.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use aster_bigtcp::{
errors::BindError,
iface::BindPortConfig,
wire::{IpAddress, IpEndpoint},
};
use crate::{
net::iface::{BoundPort, Iface, iter_all_ifaces, loopback_iface, virtio_iface},
prelude::*,
};
pub(super) fn get_iface_to_bind(ip_addr: &IpAddress) -> Op... | kernel/src/net/socket/ip/common.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
mod addr;
mod common;
mod datagram;
pub mod options;
mod stream;
pub use datagram::DatagramSocket;
pub(in crate::net) use datagram::observer::DatagramObserver;
pub(in crate::net) use stream::observer::StreamObserver;
pub use stream::{StreamSocket, options as stream_options}; | kernel/src/net/socket/ip/mod.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use core::num::NonZeroU8;
use aster_bigtcp::socket::NeedIfacePoll;
use crate::{
net::socket::options::{
SocketOption,
macros::{impl_socket_options, sock_option_mut, sock_option_ref},
},
prelude::*,
};
/// IP-level socket options.
#[derive(Debug, Clone,... | kernel/src/net/socket/ip/options.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use aster_bigtcp::{
errors::udp::{RecvError, SendError},
wire::IpEndpoint,
};
use crate::{
events::IoEvents,
net::{
iface::{BoundPort, Iface, UdpSocket},
socket::util::{SendRecvFlags, datagram_common},
},
prelude::*,
util::{MultiRead, Mul... | kernel/src/net/socket/ip/datagram/bound.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use core::sync::atomic::{AtomicBool, Ordering};
use aster_bigtcp::wire::IpEndpoint;
use bound::BoundDatagram;
use unbound::{BindOptions, UnboundDatagram};
use super::addr::UNSPECIFIED_LOCAL_ENDPOINT;
use crate::{
events::IoEvents,
fs::{path::Path, pseudofs::SockFs},
ne... | kernel/src/net/socket/ip/datagram/mod.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use aster_bigtcp::socket::{SocketEventObserver, SocketEvents};
use crate::{events::IoEvents, process::signal::Pollee};
pub struct DatagramObserver(Pollee);
impl DatagramObserver {
pub(super) fn new(pollee: Pollee) -> Self {
Self(pollee)
}
}
impl SocketEventObserv... | kernel/src/net/socket/ip/datagram/observer.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use aster_bigtcp::{socket::UdpSocket, wire::IpEndpoint};
use super::{bound::BoundDatagram, observer::DatagramObserver};
use crate::{
events::IoEvents,
net::socket::{
ip::common::{bind_port, get_ephemeral_endpoint},
util::datagram_common,
},
prelude::... | kernel/src/net/socket/ip/datagram/unbound.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use aster_bigtcp::{
errors::tcp::{RecvError, SendError},
socket::{NeedIfacePoll, RawTcpSetOption},
wire::IpEndpoint,
};
use super::observer::StreamObserver;
use crate::{
events::IoEvents,
net::{
iface::{BoundPort, Iface, RawTcpSocketExt, TcpConnection},
... | kernel/src/net/socket/ip/stream/connected.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use aster_bigtcp::{
errors::tcp::ConnectError,
socket::{ConnectState, RawTcpOption, RawTcpSetOption},
wire::IpEndpoint,
};
use super::{connected::ConnectedStream, init::InitStream, observer::StreamObserver};
use crate::{
events::IoEvents,
net::iface::{BoundPort,... | kernel/src/net/socket/ip/stream/connecting.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use core::{
net::Ipv4Addr,
sync::atomic::{AtomicBool, Ordering},
};
use aster_bigtcp::{socket::RawTcpOption, wire::IpEndpoint};
use super::{connecting::ConnectingStream, listen::ListenStream, observer::StreamObserver};
use crate::{
events::IoEvents,
net::{
... | kernel/src/net/socket/ip/stream/init.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use aster_bigtcp::{
errors::tcp::ListenError,
socket::{RawTcpOption, RawTcpSetOption},
wire::IpEndpoint,
};
use super::{connected::ConnectedStream, observer::StreamObserver};
use crate::{
events::IoEvents,
net::iface::{BoundPort, Iface, TcpListener},
prelude... | kernel/src/net/socket/ip/stream/listen.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use core::sync::atomic::{AtomicBool, Ordering};
use aster_bigtcp::{
socket::{NeedIfacePoll, RawTcpOption, RawTcpSetOption},
wire::IpEndpoint,
};
use connected::{ConnectedStream, close_and_linger};
use connecting::{ConnResult, ConnectingStream};
use init::InitStream;
use lis... | kernel/src/net/socket/ip/stream/mod.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use aster_bigtcp::socket::{SocketEventObserver, SocketEvents};
use crate::{events::IoEvents, process::signal::Pollee};
#[derive(Clone)]
pub struct StreamObserver(Pollee);
impl StreamObserver {
pub(super) fn new(pollee: Pollee) -> Self {
Self(pollee)
}
}
impl Sock... | kernel/src/net/socket/ip/stream/observer.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use crate::{net::socket::options::macros::impl_socket_options, prelude::*};
impl_socket_options!(
pub struct NoDelay(bool);
pub struct MaxSegment(u32);
pub struct KeepIdle(u32);
pub struct SynCnt(u8);
pub struct DeferAccept(u32);
pub struct WindowClamp(u32);... | kernel/src/net/socket/ip/stream/options.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use aster_bigtcp::time::Duration;
use super::options::CongestionControl;
use crate::prelude::*;
#[derive(Debug, Clone, Copy, CopyGetters, Setters)]
#[get_copy = "pub"]
#[set = "pub"]
pub(super) struct TcpOptionSet {
no_delay: bool,
maxseg: u32,
keep_idle: u32,
syn_... | kernel/src/net/socket/ip/stream/util.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
//! This module defines netlink sockets.
//!
//! Netlink provides a standardized, socket-based interface,
//! typically used for communication between user space and kernel space.
//! It can also be used for interaction between two user processes.
//!
//! Each netlink socket corresp... | kernel/src/net/socket/netlink/mod.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use crate::net::socket::options::macros::impl_socket_options;
impl_socket_options!(
pub struct AddMembership(u32);
pub struct DropMembership(u32);
); | kernel/src/net/socket/netlink/options.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use crate::{events::IoEvents, prelude::*, process::signal::Pollee};
pub struct MessageReceiver<Message> {
message_queue: Arc<Mutex<MessageQueue<Message>>>,
pollee: Pollee,
}
pub(super) struct MessageQueue<Message> {
messages: VecDeque<Message>,
total_length: usize,... | kernel/src/net/socket/netlink/receiver.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
mod multicast;
pub use multicast::{GroupIdSet, MAX_GROUPS};
use crate::{net::socket::util::SocketAddr, prelude::*};
/// The socket address of a netlink socket.
///
/// The address contains the port number for unicast
/// and the group IDs for multicast.
#[derive(Debug, Clone, Cop... | kernel/src/net/socket/netlink/addr/mod.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use crate::prelude::*;
/// A set of group IDs.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct GroupIdSet(u32);
impl GroupIdSet {
/// Creates a new empty `GroupIdSet`.
pub const fn new_empty() -> Self {
Self(0)
}
/// Creates a new `GroupIdSet` with... | kernel/src/net/socket/netlink/addr/multicast.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use crate::{
events::IoEvents,
net::socket::netlink::{
GroupIdSet, NetlinkSocketAddr, receiver::MessageQueue, table::BoundHandle,
},
prelude::*,
};
pub struct BoundNetlink<Message: 'static> {
pub(in crate::net::socket::netlink) handle: BoundHandle<Messag... | kernel/src/net/socket/netlink/common/bound.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use core::sync::atomic::{AtomicBool, Ordering};
pub(super) use bound::BoundNetlink;
use unbound::UnboundNetlink;
use super::{GroupIdSet, NetlinkSocketAddr};
use crate::{
events::IoEvents,
fs::{path::Path, pseudofs::SockFs},
net::socket::{
Socket,
netlin... | kernel/src/net/socket/netlink/common/mod.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use core::marker::PhantomData;
use crate::{
events::IoEvents,
net::socket::{
netlink::{
GroupIdSet, NetlinkSocketAddr, common::bound::BoundNetlink, receiver::MessageQueue,
table::SupportedNetlinkProtocol,
},
util::datagram_com... | kernel/src/net/socket/netlink/common/unbound.rs | null | null | null | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.