-
-
Notifications
You must be signed in to change notification settings - Fork 143
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
feat(namespace) feat some namespace bugs #1033
Open
codeironman
wants to merge
19
commits into
DragonOS-Community:master
Choose a base branch
from
codeironman:ospp
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
ac0e419
[feat](namespace) add pid_namespace
codeironman fa78e87
[feat](namespace) add pid_namespace (#880)
codeironman 0b7830e
[feat](namespace) add mnt_namespace && begin to cgroup
codeironman 67cce32
[feat](namespace) fix pid_namespace && mnt_namespace
codeironman 00122f6
feat(namespace): add mnt_namespace (#888)
codeironman d2f07f1
[feature](union filesystem) add overlayfs filesystem
codeironman 1e08a46
(feature)[namespace] add namespace syscall && bugfix
codeironman 80e2074
Merge remote-tracking branch 'upstream/feat-containerization-dev' int…
codeironman b3311bd
Merge remote-tracking branch 'upstream/master' into mr
codeironman 8f90bb6
feat(docs) add namespace && overlayfs docs
codeironman 6a1b404
(feat)(overlayfs)
codeironman 9f03e49
feat(overlayfs) fix some bugs
codeironman eb855e1
feat(overlayfs) delete debug info
codeironman 2345338
(feat)(overlayfs) fix overlayfs test bugs
codeironman b702398
Merge remote-tracking branch 'upstream/master' into ospp
codeironman 6cbade5
(feat)(namespace) fix fmt
codeironman 2709fac
feat(namespace) feat namespace bugs
codeironman 95a6274
Merge remote-tracking branch 'upstream/master' into ospp
codeironman 5da999f
[feat](namespace) change Dynamic Distribution to Static distribution
codeironman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
#![allow(dead_code, unused_variables, unused_imports)] | ||
use alloc::string::String; | ||
use core::fmt::Debug; | ||
|
||
use crate::filesystem::procfs::ProcFSInode; | ||
|
@@ -12,30 +13,17 @@ use system_error::SystemError; | |
|
||
// 目前无credit功能,采用全局静态的user_namespace | ||
lazy_static! { | ||
pub static ref USER_NS: Arc<UserNamespace> = Arc::new(UserNamespace::new()); | ||
pub static ref USER_NS: Arc<UserNamespace> = Arc::new(UserNamespace::default()); | ||
} | ||
use super::{create_new_namespaces, NsProxy, NsSet}; | ||
pub trait NsOperations: Send + Sync + Debug { | ||
fn get(&self, pid: Pid) -> Option<Arc<NsCommon>>; | ||
fn put(&self, ns_common: Arc<NsCommon>); | ||
fn install(&self, nsset: &mut NsSet, ns_common: Arc<NsCommon>) -> Result<(), SystemError>; | ||
fn owner(&self, ns_common: Arc<NsCommon>) -> Arc<UserNamespace>; | ||
fn get_parent(&self, ns_common: Arc<NsCommon>) -> Result<Arc<NsCommon>, SystemError>; | ||
} | ||
#[derive(Debug)] | ||
pub struct NsCommon { | ||
ops: Box<dyn NsOperations>, | ||
stashed: Arc<dyn IndexNode>, | ||
} | ||
|
||
impl NsCommon { | ||
pub fn new(ops: Box<dyn NsOperations>) -> Self { | ||
let inode = ROOT_INODE().find("proc").unwrap_or_else(|_| ROOT_INODE()); | ||
Self { | ||
ops, | ||
stashed: inode, | ||
} | ||
} | ||
pub trait Namespace: Send + Sync + Debug { | ||
fn name(&self) -> String; | ||
fn clone_flags(&self) -> CloneFlags; | ||
fn get(&self, pid: Pid) -> Option<Arc<Self>>; | ||
fn put(&self); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 不需要put方法吧 |
||
fn install(nsset: &mut NsSet, ns: Arc<Self>) -> Result<(), SystemError>; | ||
fn owner(&self) -> Arc<UserNamespace>; | ||
fn get_parent(&self) -> Result<Arc<Self>, SystemError>; | ||
} | ||
|
||
pub enum NsType { | ||
|
@@ -49,10 +37,6 @@ pub enum NsType { | |
Time, | ||
} | ||
|
||
pub trait Namespace { | ||
fn ns_common_to_ns(ns_common: Arc<NsCommon>) -> Arc<Self>; | ||
} | ||
|
||
pub fn check_unshare_flags(unshare_flags: u64) -> Result<usize, SystemError> { | ||
let valid_flags = CloneFlags::CLONE_THREAD | ||
| CloneFlags::CLONE_FS | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
删掉全局的这种lint