Re: purpose of "." entry in a diretory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Apr 8, 2005 4:43 PM, Jason Zheng <xin.zheng@xxxxxxxxxxxx> wrote:
> Manu Jose wrote:
> 
> >Hi Jason,
> >               "." represents the current working directory and ".."
> >represents the parent directory of the current working directory . It
> >is useful in various contexts. For example if u r currently in the
> >directory /mnt/foo and want to copy the content of /mnt/foo1 to
> >/mnt/foo just isuue the command " cp -R /mnt/foo1/* . "  .So it is
> >always good to represent the working directory with a short symbol and
> >it is not at all a waste....
> >
> >Manu
> >
> >--
> >Kernelnewbies: Help each other learn about the Linux kernel.
> >Archive:       http://mail.nl.linux.org/kernelnewbies/
> >FAQ:           http://kernelnewbies.org/faq/
> >
> >
> >
> >
> Let me rephrase my question a little bit: BESIDES the obvious usage of
> "." entry, in terms of the filesystem, what is the purpose of "." entry?
> 
> The obvious answer is that you can refer to the current directory using
> "./", however, in order to look up the "." entry, the kernel must have a
> knowledge of the current directory in the first place, doesn't it? The
> kernel needs the directory table for the current directory to look up
> which inode the "." entry refers to. Doesn't that seem a little
> redundant, since the kernel already knows what the current directory is?
> If the kernel is already caching the current directory table, it might
> as well just cache the current directory's inode.
> 
> Coming back to my original question, does the kernel really need that
> "." entry? or is it purely for the user convenience?
> 
> cheers,
> 
> jz
> 
Jason,

I thought about your question when you first asked it, and again now. 
In a generic sense I can't think of a reason that the '.' entry is
mandatory.  As you say there seem to be ways to track the same info
without have that specific directory entry.

OTOH, I would assume the VFS (virtual file system) component of the
Linux Kernel assumes that it is there.

Greg
--
Greg Freemyer

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux