Function report |
Source Code:fs\namespace.c |
Create Date:2022-07-28 20:09:23 |
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:pivot_root Semantics:* Moves the root file system of the current process to the directory put_old,* makes new_root as the new root file system of the current process, and sets* root/cwd of all processes which had them on the current root to new_root
Proto:SYSCALL_DEFINE2(pivot_root, const char __user *, new_root, const char __user *, put_old)
Type:
Parameter:Nothing
| 3618 | If Not Is the caller allowed to modify his namespace? Then Return -EPERM |
| 3621 | error = user_path_at(Special value used to indicateopenat should use the currentworking directory. , new_root, llow links at the end | quire a directory , & new) |
| 3626 | error = user_path_at(Special value used to indicateopenat should use the currentworking directory. , put_old, llow links at the end | quire a directory , & old) |
| 3631 | error = security_sb_pivotroot( & old, & new) |
| 3635 | get_fs_root(fs, & root) |
| 3636 | old_mp = lock_mount( & old) |
| 3642 | new_mnt = real_mount(mnt) |
| 3643 | root_mnt = real_mount(mnt) |
| 3644 | old_mnt = real_mount(mnt) |
| 3645 | ex_parent = mnt_parent |
| 3646 | root_parent = mnt_parent |
| 3647 | If IS_MNT_SHARED(old_mnt) || IS_MNT_SHARED(ex_parent) || IS_MNT_SHARED(root_parent) Then Go to out4 |
| 3653 | If mnt_flags & MNT_LOCKED Then Go to out4 |
| 3656 | If d_unlinked(dentry) Then Go to out4 |
| 3664 | If Not mnt_has_parent(root_mnt) Then Go to out4 |
| 3668 | If Not mnt_has_parent(new_mnt) Then Go to out4 |
| 3671 | If Not Return true if path is reachable from root* namespace_sem or mount_lock is held Then Go to out4 |
| 3674 | If Not Return true if path is reachable from root* namespace_sem or mount_lock is held Then Go to out4 |
| 3676 | lock_mount_hash() |
| 3679 | If mnt_flags & MNT_LOCKED Then |
| 3680 | mnt_flags |= MNT_LOCKED |
| 3681 | mnt_flags &= ~MNT_LOCKED |
| 3692 | unlock_mount_hash() |
| 3693 | chroot_fs_refs( & root, & new) |
| 3694 | error = 0 |
| 3695 | out4 : |
| 3696 | unlock_mount(old_mp) |
| 3697 | If Not error Then mntput_no_expire(ex_parent) |
| 3699 | out3 : |
| 3701 | out2 : |
| 3703 | out1 : |
| 3705 | out0 : |
| 3706 | Return error |
| Source code conversion tool public plug-in interface | X |
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |