Fix comments about when to pivot_root

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
This commit is contained in:
Qiang Huang 2017-05-06 07:59:03 +08:00
parent b6b70e5345
commit 96e0df7633
1 changed files with 4 additions and 5 deletions

View File

@ -37,9 +37,8 @@ func needsSetupDev(config *configs.Config) bool {
} }
// prepareRootfs sets up the devices, mount points, and filesystems for use // prepareRootfs sets up the devices, mount points, and filesystems for use
// inside a new mount namespace. It doesn't set anything as ro or pivot_root, // inside a new mount namespace. It doesn't set anything as ro. You must call
// because console setup happens inside the caller. You must call // finalizeRootfs after this function to finish setting up the rootfs.
// finalizeRootfs in order to finish the rootfs setup.
func prepareRootfs(pipe io.ReadWriter, config *configs.Config) (err error) { func prepareRootfs(pipe io.ReadWriter, config *configs.Config) (err error) {
if err := prepareRoot(config); err != nil { if err := prepareRoot(config); err != nil {
return newSystemErrorWithCause(err, "preparing rootfs") return newSystemErrorWithCause(err, "preparing rootfs")
@ -114,8 +113,8 @@ func prepareRootfs(pipe io.ReadWriter, config *configs.Config) (err error) {
return nil return nil
} }
// finalizeRootfs actually switches the root of the process and sets anything // finalizeRootfs sets anything to ro if necessary. You must call
// to ro if necessary. You must call prepareRootfs first. // prepareRootfs first.
func finalizeRootfs(config *configs.Config) (err error) { func finalizeRootfs(config *configs.Config) (err error) {
// remount dev as ro if specified // remount dev as ro if specified
for _, m := range config.Mounts { for _, m := range config.Mounts {