예제 #1
0
def general_path_to_inode_number(path):
	path.strip("/")
	if (path[0] == "/"):
		return path_name_layer.path_to_inode_number(path, 0)
	else:
		return path_name_layer.path_to_inode_number(path, path_name_layer._wd)
예제 #2
0
파일: root.py 프로젝트: kitsully/PFS
import fileLayer
import blockLayer
from fileLayer import INode, FileType
import inode_number
import file_name_layer
import path_name_layer

inode_number._inode_table[0].add_block()


file_name_layer.mkdir("dir", 0)
d_inode = path_name_layer.path_to_inode_number("dir", 0)
print "dir", d_inode
file_name_layer.create_file("wooo", d_inode)
file_name_layer.create_file("FUCKYES", d_inode)
file_name_layer.mkdir("dir2", d_inode)
d_inode2 = path_name_layer.path_to_inode_number("dir2", d_inode)
print "dir2", d_inode2

path_name_layer.chdir("/")
print path_name_layer._wd

path_name_layer.chdir("/dir")
print path_name_layer._wd




path_name_layer.chdir("/dir/dir2")
#print path_name_layer._wd
예제 #3
0
# absolute path name layer 

import fileLayer
import blockLayer
from fileLayer import INode, FileType
import inode_number
import file_name_layer
import path_name_layer
from path_name_layer import _wd

#Creates the directories
inode_number._inode_table[0].add_block()

# Creates home directory and adds a few files
file_name_layer.mkdir("Home", 0)
d_inode = path_name_layer.path_to_inode_number("Home", 0)
file_name_layer.create_file("test_1", d_inode)
file_name_layer.create_file("test_2", d_inode)
file_name_layer.create_file("test_3", d_inode)
file_name_layer.create_file("test_4", d_inode)

# Creates Kris directory
file_name_layer.mkdir("Kris", d_inode)
d_inode2 = path_name_layer.path_to_inode_number("Kris", d_inode)

# Creates Docs directory
file_name_layer.mkdir("Docs", d_inode2)
d_inode_docs = path_name_layer.path_to_inode_number("Docs", d_inode2)
file_name_layer.create_file("Doc_1", d_inode_docs) # I want to write to this file
inum = path_name_layer.path_to_inode_number("Doc_1", d_inode_docs)
i = inode_number.inode_number_to_inode(inum)