The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Special Forums > Hardware > Filesystems, Disks and Memory
.
google unix.com



Filesystems, Disks and Memory Discuss NAS, SAN, RAID, Robotic Libraries, backup devices, RAM, DRAM, SCSI, IDE, EIDE topics here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
egrep understanding problem namishtiwari Shell Programming and Scripting 1 01-29-2008 07:03 AM
Basic multi module problem enuenu High Level Programming 9 05-28-2007 08:43 PM
Problem in registering new netfilter target module Rakesh Ranjan High Level Programming 0 11-09-2005 01:43 AM
A little help understanding FIFOs? deckard Linux 0 11-01-2005 01:46 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-20-2003
kangc kangc is offline
Registered User
  
 

Join Date: Oct 2003
Posts: 5
having problem in understanding namei module

can anyone give me some idea on unix filesystem namei's algorithsm
  #2 (permalink)  
Old 10-20-2003
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,122
Your question assumes that there is a module called namei() which is probably false. Back when there was a namei(), it took a pathname and returned a (in-core) inode or it returned an error. namei, by its very name, cannot handle a modern kernel's needs. Today a kernel would want a vnode, not an inode. And the change was made to support the concept of several types of filesystems. You can't return an inode for fat-32 or nfs.

I am guessing that your motivation for asking this question comes from looking at the output of sar which can tell you how often namei was called. Today that counter in incremented in a function called lookupname() (or something like that). And iget() is no longer around either. It is now VFS_LOOKUP() (a macro) (and again, the name may be a little different).

Even the old namei() was a rough algorithm. Look at the system call lstat().... that tells you that sometimes namei needs to not follow a symbolic link. And at some point a name cache appeared. Since I must go back in time, I'm going back far enough that there are no symlinks nor a name cache.

namei() is called by a system call and namei needs to access the uarea of the process that is making the system call. If a pathname starts with a /, namei must get the process root. That's how a chroot is enforced. Otherwise it must get the process CWD. Now it knows where to start. At each point it will also verify that the process has permission to access each component.

Now it needs to lookup the first name. So it reads the current directory and obtains a directory entry. Then it calls geti() to obtain an in-core inode. geti will notice if the inode is a mount point by checking the mount table.... if so, it will seek the inode in the mount table instead. It will also notice if the inode is in core, if not iget will read it.

This continues until the pathname is resolved or the procedure fails.

The only other problem is a path like /usr/local/../lib where /usr/local is a mounted filesystem. Here namei() must cross a mount point backwards and there is special code for that.

Nice first question of the day! I'm awake now!
  #3 (permalink)  
Old 10-22-2003
kangc kangc is offline
Registered User
  
 

Join Date: Oct 2003
Posts: 5
Smile thanks from my heart

first ,here i give my sincere thank to you.

I have go to the kernel of unix for about 2 months, i am a beginner.
I studied the kernel from a book structure analysis of unix, a relatively simple and basic one.So sometimes i really can't get it and can't get the whole of the unix,also some specific problem.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:41 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0