From 7bdd64c0b8e20f3eff3c66aaf5087a760ffc3f37 Mon Sep 17 00:00:00 2001 From: chyyuu Date: Wed, 13 May 2015 14:01:33 +0800 Subject: [PATCH 1/5] Update sfs-homework.md --- related_info/lab8/sfs-homework.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/related_info/lab8/sfs-homework.md b/related_info/lab8/sfs-homework.md index 18162c3..41d011a 100644 --- a/related_info/lab8/sfs-homework.md +++ b/related_info/lab8/sfs-homework.md @@ -103,7 +103,7 @@ fs.data: [(.,0) (..,0) (y,1) (z,2) (x,3)] [u] [(.,3) (..,0)] [] ... ## 问题1: -根据[sfs文件系统的状态变化信息](https://github.com/chyyuu/ucore_lab/blob/master/related_info/lab8/sfs-states.txt),给出具体的文件相关操作内容. +根据[sfs文件系统的状态变化信息](./sfs_states.txt),给出具体的文件相关操作内容. ## 问题2: 在[sfs-homework.py 参考代码的基础上](https://github.com/chyyuu/ucore_lab/blob/master/related_info/lab8/sfs-homework.py),实现 `writeFile, createFile, createLink, deleteFile`,使得你的实现能够达到与问题1的正确结果一致 From e18a31359c51de9d4ac66c8216d3b00b2c3984e8 Mon Sep 17 00:00:00 2001 From: chyyuu Date: Wed, 13 May 2015 14:19:56 +0800 Subject: [PATCH 2/5] Update sfs-homework.md --- related_info/lab8/sfs-homework.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/related_info/lab8/sfs-homework.md b/related_info/lab8/sfs-homework.md index 41d011a..a8d4326 100644 --- a/related_info/lab8/sfs-homework.md +++ b/related_info/lab8/sfs-homework.md @@ -38,7 +38,7 @@ ### 完整文件系统的例子 ``` fs.ibitmap: inode bitmap 11110000 -fs.inodes: [d a:0 r:6] [f a:1 r:1] [f a:-1 r:1] [d a:2 r:2] [] ... +fs.inodes: [d a:0 r:5] [f a:1 r:1] [f a:-1 r:1] [d a:2 r:2] [] ... fs.dbitmap: data bitmap 11100000 fs.data: [(.,0) (..,0) (y,1) (z,2) (x,3)] [u] [(.,3) (..,0)] [] ... ``` From c8bebc1a268c2a02f78a2b2269874dc9b2dc26b0 Mon Sep 17 00:00:00 2001 From: chyyuu Date: Wed, 13 May 2015 14:45:56 +0800 Subject: [PATCH 3/5] Update sfs-homework.md --- related_info/lab8/sfs-homework.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/related_info/lab8/sfs-homework.md b/related_info/lab8/sfs-homework.md index a8d4326..66af3b9 100644 --- a/related_info/lab8/sfs-homework.md +++ b/related_info/lab8/sfs-homework.md @@ -32,7 +32,11 @@ #### 数据块内容结构 - 一般文件的内容的表示:只是包含单个字符的list,比如`['a']`, `['b']` ..... - - 目录内容的表示: 多个两元组`(name, inode_number)`形成的list,比如, 根目录 `[(.,0) (..,0)]`, 或者包含了一个`'f'`文件的根目录[(.,0) (..,0) (f,1)] + - 目录内容的表示: 多个两元组`(name, inode_number)`形成的list,比如, 根目录 `[(.,0) (..,0)]`, 或者包含了一个`'f'`文件的根目录[(.,0) (..,0) (f,1)] 。 + +> 注意:一个目录的目录项的个数是有限的。 `block.maxUsed = 32` +> 注意:data block的个数是有限的,为 fs.numData +> 注意:inode的个数是有限的,为 fs.numInodes ### 完整文件系统的例子 From adc8b010c3070a666e0ea8adcc8bac6c438c5a01 Mon Sep 17 00:00:00 2001 From: chyyuu Date: Wed, 13 May 2015 14:48:49 +0800 Subject: [PATCH 4/5] Update sfs-homework.md --- related_info/lab8/sfs-homework.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/related_info/lab8/sfs-homework.md b/related_info/lab8/sfs-homework.md index 66af3b9..4d68957 100644 --- a/related_info/lab8/sfs-homework.md +++ b/related_info/lab8/sfs-homework.md @@ -31,11 +31,13 @@ #### 数据块内容结构 - - 一般文件的内容的表示:只是包含单个字符的list,比如`['a']`, `['b']` ..... + - 一般文件的内容的表示:只是包含单个字符的list,即占一个data block,比如`['a']`, `['b']` ..... - 目录内容的表示: 多个两元组`(name, inode_number)`形成的list,比如, 根目录 `[(.,0) (..,0)]`, 或者包含了一个`'f'`文件的根目录[(.,0) (..,0) (f,1)] 。 > 注意:一个目录的目录项的个数是有限的。 `block.maxUsed = 32` + > 注意:data block的个数是有限的,为 fs.numData + > 注意:inode的个数是有限的,为 fs.numInodes From 00d7df75800cb3aff3918aa678ca385d8f36bcd9 Mon Sep 17 00:00:00 2001 From: chyyuu Date: Wed, 13 May 2015 14:54:58 +0800 Subject: [PATCH 5/5] Update sfs-homework.md --- related_info/lab8/sfs-homework.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/related_info/lab8/sfs-homework.md b/related_info/lab8/sfs-homework.md index 4d68957..5e26a13 100644 --- a/related_info/lab8/sfs-homework.md +++ b/related_info/lab8/sfs-homework.md @@ -3,7 +3,7 @@ ## 面向文件系统的用户操作 - mkdir() - 创建一个新目录 - creat() - 创建一个空文件 -- open(), write(), close() - 对文件写一个数据buffer +- open(), write(), close() - 对文件写一个数据buffer,注意常规文件的最大size是一个data block,所以第二次写(写文件的语义是在上次写的位置后再写一个data block)会报错(文件大小满了)。或者如果data block也满了,也会报错。 - link() - 对文件创建一个硬链接(hard link) - unlink() - 对文件取消一个硬链接 (如果文件的链接数为0,则删除文件