def get_dir_from_path(pathname): if under_plash: return get_caps()["fs_op"].fsop_get_dir(pathname) else: return plash_core.initial_dir(pathname)
test_utimes(lambda: cow_dir.dir_traverse("mydir")) subdir = cow_dir.dir_traverse("mydir") assert_equal(subdir.fsobj_type(), pm.OBJT_DIR) # This will realize mydir subdir.dir_mkdir(0777, "dir2") # This uses already-realized mydir subdir.dir_mkdir(0777, "dir3") check_dir_listing(subdir, ["dir1", "dir2", "dir3"]) subdir = cow_dir.dir_traverse("only-in-write") assert_equal(subdir.fsobj_type(), pm.OBJT_DIR) subdir.dir_mkdir(0777, "dir4") fd = os.open(".", os.O_RDONLY) dir = plash_core.initial_dir(".") test_empty_writable_dir(dir) print "ok" import plash.namespace as ns os.fchdir(fd) os.mkdir("write") os.mkdir("read") test_cow_dir(plash_core.initial_dir("write"), plash_core.initial_dir("read")) print "ok"
def get_root_dir(): if under_plash: return get_caps()['fs_op'].fsop_get_root_dir() else: return plash_core.initial_dir('/')