Thought Bubbles - Why do we need symbolic links?

In "The Linux Programming Interface: A Linux and UNIX Programming Handbook", Symbolic links is described as follow:

"Like a normal link, a symbolic link provides an alternative name for a file. But whereas a normal link is a filename-plus-pointer entry in a directory list, a symbolic link is a specially marked file containing the name of another file. (In other words, a symbolic link has a filename-plus-pointer entry in a directory, and the file referred to by the pointer contains a string that names another file.) This latter file is often called the target of the symbolic link, and it is common to say that the symbolic link "points" or "refers" to the target file."

So why we need symbolic links? Can a symbolic link be replaced by a normal link? 

Suppose we have a normal link "LinkA", as described above, the LinkA can be structured as: ( FileNameA, PointerToAddrOfFileA ). And we have a symbolic link "SymbLinkA", and the it can be structured as: (FileNameA1, PointerToAddrOfFileA1), and The file referred by "PointerToAddrOfFileA1" contains the string "FileNameA" that is a file name of the file that referred by "PointerToAddrOfFileA". Can we just represent the "SymbLinkA" as such: (FileNameA1, PointerToAddrOfFileA) to remove the concept of symbolic link, so that there would be no difference between normal link and symbolic link and we still succeed in that a file can have multiple file names? The answer is No. Let's think about the situation where a link refers to a directory that is the prefix of the directory where this link lays in, this would cause a circle when we try to enumerate the directory the this link lays in, and since we can not figure out we are cycling, we would trap in endless running.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值