5 def full_path(root, partial):
6 if partial.startswith(
"/"):
8 return os.path.join(root, partial)
11 def _mkdir(root, path, mode):
12 f_path = full_path(root, path)
13 result = os.mkdir(f_path)
14 file_names = [
'alpha',
'beta',
'gamma',
'kappa',
'omega',
'theta']
15 [os.open(f_path +
"/" + file_name, os.O_WRONLY | os.O_CREAT, mode)
for
16 file_name
in file_names]
20 def _getattr(root, path, fh=None):
21 st = os.lstat(full_path(root, path))
22 return_dictionary = dict()
23 return_dictionary[
'st_atime'] = st.st_atime
24 return_dictionary[
'st_ctime'] = st.st_ctime
25 return_dictionary[
'st_gid'] = st.st_gid
26 return_dictionary[
'st_mode'] = st.st_mode
27 return_dictionary[
'st_mtime'] = st.st_mtime
28 return_dictionary[
'st_nlink'] = st.st_nlink
29 return_dictionary[
'st_size'] = st.st_size
30 return_dictionary[
'st_uid'] = st.st_uid
31 return return_dictionary
34 def _read(root, path, length, offset, fh):
35 os.lseek(fh, offset, os.SEEK_SET)
36 return os.read(fh, length)
39 def _write(root, path, buf, offset, fh):
40 os.lseek(fh, offset, os.SEEK_SET)
41 return os.write(fh, buf)