Chinaunix

标题: 文件和目录的链接数都由什么决定 [打印本页]

作者: 海崎洋光    时间: 2007-10-20 14:09
标题: 文件和目录的链接数都由什么决定
请问一下:文件和目录的链接数都由什么决定?
作者: jamesr    时间: 2007-10-20 14:48
提示: 作者被禁止或删除 内容自动屏蔽
作者: 海崎洋光    时间: 2007-10-20 15:04
标题: 回复 #2 jamesr 的帖子
我不知道从何入手!!!怎样才能懂得原理!!!能告诉我应该从何下手吗?我在这块太迷茫了!!!
作者: 海崎洋光    时间: 2007-10-20 15:15
标题: 回复 #2 jamesr 的帖子
我也在网上找找了很久可是没找到!!!我不是总等别人来回答。
请您相信我
作者: crasy    时间: 2007-10-21 01:28
标题: 回复 #4 海崎洋光 的帖子
2楼的意思是,根本就没有固定的答案,数量的多少取决于用的什么文件系统.再说啦,貌似这种东西,没必要太死抠.....个人认为.
作者: 芬达7402    时间: 2007-10-21 11:03
楼主可以先去看一下 sector, inode等概念
作者: 海崎洋光    时间: 2007-10-21 18:31
标题: 回复 #6 芬达7402 的帖子
谢谢了各位!!!我会去看的
作者: 海崎洋光    时间: 2007-10-21 18:36
标题: 回复 #6 芬达7402 的帖子
谢谢了各位!!!我会去看的
作者: 海崎洋光    时间: 2007-10-21 18:39
标题: 回复 #5 crasy 的帖子
我也想呀!!可谓是君子所见略同.可是我在写作业!我总得把空填上吧!!!
作者: ShadowStar    时间: 2007-10-21 21:33
文件和目录的连接数由指向这个文件或目录的硬连接数决定。

和文件系统本身的性质有什么关系?

文件的连接数就是指向此文件的硬连接数+1(此文件本身)
目录的连接数是:1(此目录本身)+1(目录下的“.”连接)+此目录下的子目录数(子目录下的“..”连接)
作者: cixzer    时间: 2007-10-21 22:11
you can type "info link" in the shell.
  1. $info link
  2. A "hard link" is another name for an existing file; the link and the
  3. original are indistinguishable.  Technically speaking, they share the
  4. same inode, and the inode contains all the information about a
  5. file--indeed, it is not incorrect to say that the inode _is_ the file.
  6. On all existing implementations, you cannot make a hard link to a
  7. directory, and hard links cannot cross file system boundaries.  (These
  8. restrictions are not mandated by POSIX, however.)

  9. "Symbolic links" ("symlinks" for short), on the other hand, are a
  10. special file type (which not all kernels support: System V release 3
  11. (and older) systems lack symlinks) in which the link file actually
  12. refers to a different file, by name.  When most operations (opening,
  13. reading, writing, and so on) are passed the symbolic link file, the
  14. kernel automatically "dereferences" the link and operates on the target
  15. of the link.  But some operations (e.g., removing) work on the link
  16. file itself, rather than on its target.  *Note Symbolic Links:
  17. (libc)Symbolic Links.
复制代码

作者: 海崎洋光    时间: 2007-10-22 10:52
标题: 回复 #10 ShadowStar 的帖子
呵呵,老师今天也是这么说的!!!谢谢您的更正!!!
作者: jefferic    时间: 2007-10-22 12:42
看遍《UNIX教程》就不会对这种问题存有疑问了




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2