xianlubird / mydocker

<<自己动手写docker>> 源码

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

potientially redudant code in code-4.3 container_process.go

s3341458 opened this issue · comments

//Delete the AUFS filesystem while container exit
func DeleteWorkSpace(rootURL string, mntURL string, volume string){
/f(volume != ""){
volumeURLs := volumeUrlExtract(volume)
length := len(volumeURLs)
if(length == 2 && volumeURLs[0] != "" && volumeURLs[1] !=""){
DeleteMountPointWithVolume(rootURL, mntURL, volumeURLs)
}else{
DeleteMountPoint(rootURL, mntURL)
}
}else {
DeleteMountPoint(rootURL, mntURL)
}
DeleteWriteLayer(rootURL)
}

seems can be done by
if (volume) {
.. umount volume
}
.. umount container mnt
delete write layer

basically the if else clause have room be simplified

欢迎提交 PR 指正

please leave this issue here for a while, I will make a pr soon, pretty busy (with walking through chapter 5) recently.