METHOD OF AND SYSTEM FOR REVERSE MAPPING VNODE POINTERS

Information

  • Patent Application
  • 20130246393
  • Publication Number
    20130246393
  • Date Filed
    April 20, 2009
    15 years ago
  • Date Published
    September 19, 2013
    11 years ago
Abstract
Embodiment of the invention provide a reverse name lookup function for providing an absolute path name or file name and absolute path name to the file name parent directory based on a vnode reference, NFS file handle reference, or file identifier reference associated with a computer virtual file system. A method in accordance with the invention comprises populating a table structure with vnodes, names, and absolute path information associated with the vnodes. The table structure and information are sufficient to generate an absolute path name and file name for each vnode. The table structure also includes entries for file identifiers, names, and associated absolute path information associated with the file identifiers. This information is sufficient to generate an absolute path name for each file identifier. The table is populated by hooking virtual file system function calls including the vnode name lookup function and the vnode inactive function. The table is populated with the file identifier entries by hooking the vnode inactive function.
Description
FIELD OF THE INVENTION

The invention relates to computer software. Specifically, the invention relates to methods of and systems for mapping a vnode pointer within a virtual file system to a file name and its absolute path name.


BACKGROUND OF THE INVENTION

Many computer file systems, are implemented using layers of abstraction including a virtual file system layer using vnodes. This is true for different variants of UNIX including HP-UX, AIX, and Solaris. FIG. 1 shows a file system 100 within a UNIX environment. These systems often lack a means to map or translate a vnode reference to the file name and its absolute path name.


At the top level, the file system provides a system interface for applications or network clients. This layer is shown in FIG. 1, which includes the system call (SYS_CALL) layer 110 and a Network File System (NFS) 160. The system call layer 110 provides a standardized interface for application programs (not shown). As a result, the underlying specifics of the file system can change or be replaced without requiring application modifications.


Below the system call layer 110 and the NFS 160 layer are one or more intermediate layers 105 below which lie the Virtual File System (VFS) layer 120. The VFS layer 120 references files by using vnode pointers. A vnode is a structure that represents a file in the file system 100. A vnode is created and used by the file system to reference a file. When a user attempts to open or create a file, if the VFS containing the file already has a vnode representing that file, a use count in the vnode is incremented and the existing vnode is used. Otherwise, a new vnode is allocated. Below the VFS layer 120 is the inode 130 layer. Inodes represent how files are organized on a disc drive 135.


Most operations within the file system 100 operate at the virtual file system layer and use vnodes or vnode pointers for file functions such as read, write, create, delete, and rename. Thus, extensions, modifications, or additions that hook into the file system 100, also need to operate on vnodes and or vnode pointers.


In this embodiment, the computer system 100 includes a Network File System (NFS) 160. The NFS 160 operates using NFS file handles or file identifiers (fids). Similar to the method by which file names are resolved into a vnode pointers, a file identifier or a NFS file handle for a file name is determined by determining the file identifier or NFS file handle for each directory and for the file name.



FIG. 2A is an example of prior art file system pseudo code 200 for resolving a file name “/user/foolbar” 201 into a vnode pointer for a file delete operation. The pseudo code 200 is for illustrative purposes. Different operating systems, such as AIX, Solaris, and HP-UX can use different function names and calling parameters from the example shown in FIG. 2A.


In the first step 202, the file system root vnode pointer “rootvp” is used in the VOP_LOOKUP( ) operation to determine the vnode pointer for the “usr” directory name. In a second operation 203, the returned vnode pointer for the “usr” directory name is used by the VOP_LOOKUP( ) operation to determine the vnode pointer for the “foo” directory name. In a third operation 204, the returned vnode pointer for the “foo” directory name is used by the VOP_LOOKUP( ) operation to determine the vnode pointer for the “bar” file name. The returned vnode pointer “vp” is used for the delete operation 205, VOP_DELETE(vp).


Functions such as VOP_DELETE( ) are useful to monitor for file system enhancements such as applications that monitor or control file system changes. However, functions of interest, such as VOP_DELETE, operate on a vnode pointer and accordingly changes in the file system are not directly or easily reported or monitored using an associated file name and an absolute path name. The absolute path name is a string of characters that represents a file system object such as a file, directory, or link. The absolute path name is also referred to as a full path or fully qualified directory path.


When an NFS client (not shown) requests a file operation, the NFS 160 of FIG. 1 performs a set operations similar to the ones used by the system call interface 110. One difference is that the NFS 160 uses file identifiers (fids) or NFS file handles to operate on a file.



FIG. 2B illustrates the steps for determining the file identifier for the file /usr/foo/bar. The process 250 begins in the step 260 by looking up the fid for the first directory “usr” in the path name. From the root directory, a “root_fid” or “share_fid” is used as a known base point identifier for a file system. In the step 270, the fid returned for the “usr” directory is used in an NFS_LOOKUP( ) call to determine the fid for the “foo” directory. In the step 280, the fid returned for the “foo” directory is used in an nfs_lookup( ) call to determine the fid for the “bar” file. In the step 290, the returned fid is used for the file function NFS_DELETE(fid). The NFS_LOOKUP( ) and NFS_DELETE( ) functions represent pseudo code for the functions provided. The function names depend on the version of the UNIX operating system used. Similar steps can be used to resolve a NFS file handle.



FIG. 3 lists the types of information of interest 300 to an exemplary file change monitoring application that interfaces with the virtual file system. The application monitors and reports “who” 310, “what” 320, “where” 330, and “how” 340 a change is made. The “who” 310 is the login user name that made the change. The “what” 320 is the file name that was changed. The “where” 330 is the computer that made the change, and the “how” 340 is the name of the program that made the change. For determining the “who” 310, “where” 330, and “how” 340, there are known solutions. As described above, it is difficult to determine from a vnode the file name and absolute path name that changed. Applications monitoring file system changes need to operate or report events to an operator based on file names and absolute path names. Reporting changes based on vnodes would be meaningless to a person monitoring system changes. Accordingly, there is a need for the ability to translate a vnode, vnode reference, an NFS file handle or file identifier into an absolute path name.


SUMMARY OF THE INVENTION

In accordance with the present invention a method of and system for providing a reverse name lookup for a file reference is disclosed. A file reference includes a vnode pointer (vp), a NFS file handle, or a file identifier (fid). The present invention is thus advantageous for applications that monitor file changes at a Virtual File System (VFS) level but need to report detected changes in terms of a file name and an absolute path name.


In a first aspect of the present invention, a computer system having a file system that includes a virtual file system abstraction comprising a memory table structure. The memory table structure comprises one or more names within the file system. The names are one of file system directory names and file names as seen and used by a user of the computer system. The names are preferably text, but in other embodiments include the unicode encoding of different languages. Further, the table structure includes one or more file references associated with the virtual file system and, respectively, with the one or more names. Preferably the file reference is a vnode pointer, an NFS file handle, or a file identifier. However, the file reference can include a vnode, an index into a table of vnodes or any other type of indirections to a vnode, NFS file handle, or file identifier. Additionally, the memory table structure holds path name information associated with each of the one or more file references. The path name information is sufficient to generate either an absolute path name or file name and absolute path name to the file name parent directory. In one embodiment, the file references are vnode references, NFS file handles, file identifier references, or a combination thereof. In another embodiment, the one or more names is one of a file name, relative path name and an absolute path name. In another embodiment, the associated path name information is the absolute path name for the file reference. A combination of relative path names and pointers to table names or entries are also contemplated for the path name information.


In a further embodiment, the system further comprises software module configured to intercept a virtual file system vnode, a NFS file handle, or a file identifier name lookup. The one or more names, vnode references, NFS file handle references, file identifier references, and path name information are determined from the intercepted vnode, file handle, or file identifier name lookup. The information from the file name lookup function is used as the source for populating the table structure with one of one or more names, vnode references, and path name information. In a further embodiment, the vnode reference is one of a vnode, a vnode pointer index and wherein the file identifier reference is a file identifier.


In a further embodiment, the system comprises a software module configured to generate either an absolute path name or file name and absolute path name to the file name parent directory in response to receiving an associated vnode reference or an associated file identifier reference.


In a second aspect of the invention, a method of providing in a computer system that includes a virtual file system, either an absolute path name or file name and absolute path name to the file name parent directory from a file reference. The method comprises populating a table structure with a file reference, an associated name, and associated path name information. The table structure holds one or more vnode references, associated names, and associated path name information. The table structure has sufficient information to generate either an absolute path name or file name and absolute path name to the file name parent directory. In one embodiment, the file references are vnode references, NFS file handle references, file identifier references, or a combination of these. In another embodiment, the vnode reference is a vnode, vnode pointer, or an vnode index and the file identifier reference is a file identifier.


In a further embodiment, method further comprises a trapping or intercepting virtual file system references, NFS file handle references, file identifier references, or their combination. The populating the table structure is determined from the vnode reference, NFS file handler, or file identifier name lookup.


In another embodiment, the method further comprises generating either an absolute path name or file name and absolute path name to the file name parent directory from a vnode reference or file identifier reference.


In one embodiment, the name associated with a vnode pointer is one of a file name and a directory name. Preferably the name is a text string that in some embodiments is ASCII but in other embodiments includes unicode characters. In other embodiments the vnode reference is a vnode or a vnode pointer.


In yet another embodiment, the method includes generating either an absolute path name or file name and absolute path name to the file name parent directory from a vnode reference or file identifier reference.


In a further embodiment, the method further comprises converting the vnode reference to a file identifier upon trapping a virtual file system vnode release or inactivate VOP_INACTIVE function call. The table structure is further populated with the file identifier, file name associated with the released or inactivated vnode, the associated path name information, and any other information required to determine an absolute path name. The table structure also holds one or more file identifier structures, associated names, and associated absolute or relative path name information. The table structure associated with the file identifier has sufficient information to generate an absolute path name or file name and absolute path name to the file name parent directory.


In another aspect of the invention, a computer device comprises a computer-readable storage medium bearing computer executable code thereon for generating in a computer system that includes a virtual file system, either an absolute path name or file name and absolute path name to the file name parent directory from a file reference. The computer device comprises a program module configured to populate a table structure with a file reference, an associated name, and associated path name information. The table holds one or more file references, names, and path name information, associated with the file references. The table structure has sufficient information to generate either an absolute path name or file name and absolute path name to the file name parent for each file reference in the table.


In one embodiment of the present invention, the computer device further comprises a program module programed to intercept virtual file system file reference name lookup, wherein the populating the table structure with the file reference, the associated name, and the associated path name information is determined from the file reference name lookup.


In a further embodiment, the file reference is a vnode reference, a file identifier reference, or a combination thereof. In another embodiment, each of the associated names is one of a file name, relative path name, and an absolute path name.


In another embodiment, the computer device includes a software module configured to generate either an absolute path name or file name and absolute path name to the file name parent directory a name and an associated absolute path name in response to receiving a vnode reference or a file identifier reference. In a further embodiment, the computer device vnode reference is one of a vnode, a vnode pointer, a vnode index and wherein the file identifier reference is a file identifier.





BRIEF DESCRIPTION OF THE DRAWINGS

Embodiments of the invention are better understood by reading the following detailed description in conjunction with the accompanying drawings.



FIG. 1 illustrates a prior art configuration of a file system.



FIG. 2A illustrates prior art pseudo code for resolving a file and path name to a vnode pointer.



FIG. 2B illustrates prior art pseudo code for resolving a file and path name to a fid.



FIG. 3 illustrates the types of information of interest for change tracking and logging in accordance with embodiments of the present invention.



FIG. 4 illustrates a file system supporting both a system call interface and a Network File System with a Reverse Name Lookup Cache (RNLC) or table in accordance with one embodiment of the present invention.



FIG. 5 illustrates a block diagram of an exemplary computing device suitable to implement a method for populating a reverse name lookup table in accordance with one embodiment of the present invention.



FIG. 6A illustrates the steps to populate reverse name lookup table in accordance with one embodiment of the present invention.



FIG. 6B illustrates the steps to determine the file name an absolute path name in accordance with one embodiment of the present invention.



FIGS. 7A and 7B illustrate an RNLC table in accordance with embodiments of the present invention.





DETAILED DESCRIPTION OF THE INVENTION

The following descriptions are provided as an enabling teaching of embodiments of the invention. Those skilled in the relevant art will recognize that many changes can be made to the embodiments described, while still obtaining the beneficial results of the present invention. It will also be apparent that some of the desired benefits of the present invention can be obtained by selecting some of the features of the present invention without utilizing other features. Accordingly, those who work in the art will recognize that many modifications and adaptations to the present invention are possible and can even be desirable in certain circumstances, and are a part of the present invention.


The present invention provides for applications or functions that monitor or otherwise operate on vnodes, the capability to report or perform logical operations using the file name and absolute path name associated with a vnode. Without this capability, the reporting of changes would occur using vnodes which provide no useful information on their own. Accordingly, the present invention provides applications the capability to map a vnode, a potentially changing and operator meaningless value, to a file and absolute path name which is useful to operators or applications that deal with files on an absolute or relative path name basis.


In accordance with one embodiment of the invention, a file system includes a Reverse Name Lookup Cache (RNLC) for translating vnode pointers and file identifiers into a file name and an absolute path name. Data for the RNLC is found by intercepting specific system function calls to the virtual file system. The functions intercepted include the virtual file system functions such as VOP_DELETE, VOP_CREATE, VOP_RENAME, VOP_LOOKUP, and VOP_INACTIVE. Each of these functions operates on a vnode pointer (vp). In order to report file changes on a basis that a human operator can understand, i.e. in terms of a file name and absolute path name, an RNLC function is provided for translating a vnode pointer to a file name and an absolute name.



FIG. 4 is a block diagram of components of the computer operating system 400 including the virtual file system 420 and 440 in accordance with one embodiment of the present invention. The computer system 400 comprises a SYSTEM_CALL module 410 with its associated interface functions, an NFS Dispatch Table module 460 that includes the interface functions with the network protocol stack, other layers of abstraction 405, a Virtual File System layer 420 (VFS), hook or intercept module 422, I-nodes 440, disk drives 445, and an RNLC module 450. The computer file system 400 has hooks 422 are in the execution path between (a) the SYSTEM_CALL 410 and the NFS Dispatch Table module 460 and (b) the VFS layer 420.


The computer system 400 is configured to provide additional file system features such as file change monitoring as part of the hook or intercept modules 422. The additional features that are provided by the VFS hooks 422 include intercepting and processing a subset of the calls into the VFS layer 420. In one embodiment, these functions include the pseudo functions VOP_DELETE, VOP_CREATE, VOP_RENAME, VOP_LOOKUP, and VOP_INACTIVE. While FIG. 4 shows only a subset of the functions being hooked, other embodiments can hook more or fewer VFS layer 420 functions calls.


The RNLC 450 comprises a module 456 that performs the function of populating the table structure 455 with vnode references, fid structures, file names, and absolute or relative path information. Further, the RNLC 450 includes a translation module 458 that performs the function of generating a file name with absolute path information based on a provided vnode pointer or fid.


The table structure 455 is organized into a vp (vnode pointer) table 452 and a fid table 454. Each vp entry in the vp table 452 comprises a vnode reference, a name, and absolute path information associated with the vnode. Each fid entry in the fid table 454 comprises a fid structure, a name, and absolute path information associated with the fid. An example of the table structure 455 is further described below in the discussions of FIGS. 7A and 7B. The vnode reference in some embodiments is a vnode pointer which is a direct reference to a vnode. In other embodiments, the table structure can include NFS file handles and associated reference information to vnodes and path information. In further embodiments it is an indirect reference or any other means to reference a vnode. Examples of other indirect references to a vnode include using uniquely identifying vnode metadata, hashes of uniquely identifying vnode data, using a hash of the vnode pointers, using a hash of file identifiers, or using an index into a list of pre-allocated vnodes. Each name entry in the vp table 452 or fid table 454 represents a directory or a file name for the vnode. The name information is used to generate a fully qualified path of the parent directory. In one embodiment, the name information is the absolute path name. In other embodiments, the path information is linkage information for determining one level of the absolute path name. This includes linkages or references to one or more table entries that contain all or part of the absolute path name. Examples of these tables are discussed below and shown in FIGS. 7A and 7B. The fid table entries are similarly organized.


The NFS Dispatch table module 460 operates differently from the system_call module 410 since in using the NFS module 460, files might not be explicitly opened to perform file I/O. To perform an NFS operation on a file, the NFS server first receives a command over the network and the file identifier or NFS file handle to operate on. The file identifier or NFS file handle is then used to obtain a vnode via the VNODE_FROM_FID( ) pseudo-API. The actual file system operation is performed by passing the vnode to the appropriate VOP routine. Finally, the vnode is released which may cause VOP_INACTIVE( ) to be called. Depending on the operation, more arguments may be sent with the command which are in turn passed to the VOP routine, but the workflow is the same.


The nfs_lookup( ) operation also differs significantly. When an nfs_lookup( ) call is made, the NFS server first receives the lookup command, a file identifier or file handle representing the directory in which the lookup is to be performed and a file name. The file identifier or file handle is used to obtain a directory vnode via the VNODE_FROM_FID( ) pseudo-API. Then the directory vnode is passed to VOP_LOOKUP( ) along with the file name to obtain a vnode to the desired file. The VNODE_TO_FID( ) pseudo-API is then called to obtain a file identifier from the desired file's vnode. Both the directory vnode and the desired file's vnode are then released which may cause VOP_INACTIVE( ) to be called for either vnode or both. Finally, the desired file's file identifier or NFS file handle is sent back to the NFS client.


This presents an issue for any application that needs to look up the absolute path name using the RNLC 450: the NFS dispatch table module 460 releases the vnode pointer after performing an NFS_lookup function. To keep the RNLC tables from growing indefinitely, the RNLC 450 also removes the vnode pointer from the table structure 455. Accordingly, a vnode pointer will not be found that can resolve the NFS fid to a file and absolute path name. Thus, if a file of interest is being monitored, it is not possible to report the change in terms of a name and absolute path name.


When attempting a delete operation, the NFS dispatch table module 460 performs a VNOD_FROM_FID( ) operation to obtain a vnode. It is the new vnode that is used to perform a delete operation. Because this operation is performed without performing a VOP_LOOKUP operation, the new vnode pointer is not found in the vp table 452.


To handle the above described problem of vnodes not being found in the vp table 452, a fid table 454 is included as part of the table structure 455. When a vnode is to be removed from the VFS layer 420, the function VOP_INACTIVE( ) is called to release the vnode. The VOP_INACTIVE( ) function is intercepted (hooked) to intercept function calls to release vnodes. When VOP_INACTIVE( ) is called, the fid for the vnode pointer is determined and stored with the associated information for the name and absolute path name in the fid table entries 454 of the table structure 455.



FIG. 5 shows a computer system 500 in accordance with one embodiment of the invention. The computer system 500 is configured to execute the Reverse Name Lookup Cache (RNLC) method 600 of FIG. 6A. The computer system 500 includes one or more processors or processing units 520, a system memory 510, and a bus 525 that couples various system components, including the system memory 510, to the processor 520.


The bus 525 represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, and a processor or local bus using any of a variety of bus architectures. The system memory 510 includes read only memory (ROM) 511 and random access memory (RAM) 513. A basic input/output system (BIOS) 512, containing the basic routines that help to transfer information between elements within the computer system 500, such as during start-up, is stored in ROM 511. The computer system 500 further includes a storage device 532 for reading from and writing to a hard disk (not shown) connected to the bus 525 via a hard disk drive interface 530 (e.g., a SCSI, ATA, or other type of interface). Additionally, removable recording media are contemplated, including a magnetic disk drive (not show) for reading from and writing to a removable magnetic disk (not shown), connected to bus 525 via a magnetic disk drive interface (not shown); and an optical disk drive (not shown) for reading from and/or writing to a removable optical disk such as a CD ROM, DVD, or other optical media, connected to the bus 525 via an optical drive interface (not shown). The drives and their associated computer-readable media provide nonvolatile storage of computer readable instructions, data structures, program modules and other data for the computer system 500. Although the exemplary environment described herein employs a hard disk, it will be appreciated by those skilled in the art that other types of computer-readable media which can store data that is accessible by a computer, such as magnetic cassettes, flash memory cards, random access memories (RAMs), read only memories (ROM), and the like, may also be used in the exemplary operating environment.


A number of program modules are stored on the storage 532, magnetic disk, optical disk (not shown), ROM 511, or RAM 513, including an operating system 514 having a file system with a virtual machine abstraction, one or more application programs 515 that can include a File Change Monitoring application, other program modules 516, and program data modules 518. A user may enter commands and information into the computer system 500 through input devices such as a keyboard 562 and a pointing device 563. Other input devices (not shown) may include a microphone, joystick, game pad, satellite dish, scanner, or the like. These and other input devices are connected to the processing unit 520 through an interface 560 that is coupled to the system bus 525 (e.g., a serial port interface, a parallel port interface, a universal serial bus (USB) interface, etc.). A terminal 545 or other type of display device is also connected to the system bus 525 via an interface, such as a video interface 540. In addition to the terminal 545, personal computers typically include other peripheral output devices (not shown) such as speakers and printers.



FIG. 6A illustrates the steps of a method of populating a table structure 600 used for the reverse name lookup of a vnode reference in accordance with one embodiment of the invention. A vnode reference can be a vnode structure, an indirect reference to a vnode, or preferably a pointer to a vnode.


The method begins at a start step 601. The step 601 can include initialization of variables, software states, and hardware. In the step 601 a hook is inserted into the execution path of calls to the virtual file system to capture some or all of the functional calls.


In a step 610, a call to the virtual file system is intercepted by code in the execution path of the virtual file system. Two particular functions of interest are represented by the pseudo code names VOP_LOOKUP 622 and VOP_INACTIVE 624.


In the step 620, the method determines the type of VFS function call that is made. This determination can be made by different components or combination of components. If the implementation of the functional calls to the VFS are in a single module, the code for performing the step 620 is placed in this module. If the implementation of the interface is through multiple modules, the code for performing the step 620 can be placed in each of the multiple modules.


If in the step 620 it is determined that the VFS function is a VOP_LOOKUP(vp, “name”) function call, then the returned vnode pointer, the name, and the absolute path information associated with the vp are stored in the table structure 455 of FIG. 4 in the step 630. In one embodiment, the absolute path information is the vp that was used to get the vnode information. In another embodiment, this information is a pointer to the table structure entry that contains information about the directory in which the name is found. This relationship can be used to form a link from file to directory, and to the next directory, and on up to the root directory, thereby providing sufficient information for generating the absolute path name. FIG. 7B shows such a table in accordance with one embodiment of the invention. In another embodiment, for each vnode reference in the table, the absolute path name is determined and stored with the vnode reference in the table structure as shown in FIG. 7A.


If in the step 620, it is determined that the VFS function 620 is a VOP_INACTIVE(vp) function call, the method continues to the step 640. The VOP_INACTIVE function call may indicate Network File System (NFS) activity. The reason for this is that the NFS_LOOKUP function uses a directory fid in a VOP_LOOKUP( ) function to determine a vnode pointer. The vnode pointer is used to resolve the fid for the file name. Then the determined vnode pointer is made inactive. Subsequent NFS operations use the fid in subsequent operations. The VP_INACTIVE( ) function is intercepted so that the determined fid for the vnode and the associated information are stored in the fid table 454 of FIG. 4. Thus, the table structure can provide an absolute path name and file name for a referenced file identifier (fid).


From both steps 630 and 640, the process proceeds to the step 690, in which it ends. In the step 690, any required memory management cleanup or reconfiguration is performed. Alternatively or additionally, the step 690 performs caching functions such as removing the least recently used vnode references if the cache size exceeds a threshold. Also, the fids in the table structure 455 of FIG. 4 can be managed as a cache and the least recently used fid and associated information removed if the number of entries exceeds a threshold.


The method described above is simplified. In other embodiments, there can be additional virtual file system functions that are intercepted and other information extracted and stored in the table structure that is important to the determination of the file name and absolute path name for a vnode.



FIG. 6B illustrates the steps of a process of determining the file name and absolute path name for a vnode pointer in accordance with one embodiment of the invention.


The process begins at a start step 650. The step 650 can include initialization of variables, software states, and any required hardware initialization. The method is given a vnode pointer for which the corresponding file name and absolute path name is to be determined. The process also contemplates determining a partial path name. Referring to FIG. 4, the step searching the vp table 652 searches for the matching vp within the vp table 452. Any standard search algorithm that appropriate for the table organization can be used. A decision is made 654 based on finding or not finding the vnode pointer. If the vnode pointer is found in the vp table the process proceeds to the step 659. If the vnode pointer is not found, then the process proceeds to step 657.


In the step 657 the vp is converted to a fid. The fid is provided to the next step 658 which searches the fid table for a matching fid. The search can be any method that is appropriate for the organization of the fid table 454. The process proceeds to a step 659 where the table reference for for the matching fid is used to determine the file name and absolute path name.


In a step 659, the vp or fid table reference to either the matching vnode pointer or matching fid is used to determine the file name, or absolute path name. The process proceeds to an ending step 660. This step can include any required memory clean up and returning the determined file name and absolute path name.



FIGS. 7A and 7B are two example implementations of a memory resident the table structure 700 and 750 of the table structure of 455 of FIG. 4, in accordance with embodiments of the invention. The table structure 700 has 6 rows 700A-F, each with 3 elements: vp or fd in the first column 710, a name element 720, and path information 730. Using (row, column) pairs to refer to the elements in table 700, the vp1 element (700A, 710) corresponds to the “usr” (700A, 720) in the “name” column 720. The elements in the “name” column 720 are one of a directory name, and a file name. The elements (700A-C, 730) in the path information column 730 comprises a text string with the complete absolute path name. In the first row 700A, the “path info” (700A, 730) for the “usr” (700A, 720) directory is “/”. For vp2 (700B, 710), the associated absolute path name (700B, 730) for “foo” (700B, 720) is “usr/”. For the file “bar” the full absolute path name (700C, 730) is “/usr/foo/”. The same relationship between the file identifier elements (700D-F, 710) and the name element (700D-F, 720) and the “path info” elements (700D-F, 730) holds true.


Referring to FIG. 7B, the first two columns 760 and 770 have the same elements 710 and 720 as in FIG. 7A. The path information column 780 is implemented with a different structure. In the first row 750A, the “path info” (750A, 780) is a null value indicating a root directory. In the second row 750B, the “path info” (750B, 780) is “vp1”, the vnode pointer for the first row. Thus, to generate the absolute path name for the second row vnode (750B, 760) “vp2”, the vp1 vnode pointer (750A, 760) is located, and the name element (750A, 770) “usr” is pre-appended to the path information (750B, 770) “foo” with the required directory slashes, which forms the absolute path name “/usr/foo”. For the third row 750C, the absolute path is generated by using the path information (750C, 780) to locate the vp2. The “name” element of vp2 (750B,770) forms the directories in the absolute path name. The path info (750B, 780) for the vp2 is used in the same manner to determine the rest of the absolute path name. The two configurations of the table structures 700 and 750 are for illustrative purposes. The two table configurations are illustrative of sufficient information for generating a file name and absolute path name for a vnode pointer. Other embodiments of a table structure are contemplated. The path info (750A-F) can comprise pointer, indexes, or other information sufficient to build an absolute path name for the vnode pointer, NFS file handle, or file identifier.


Referring again to FIG. 4, in operation the RNLC 450 is used in support of file system applications or modifications to the file system that need to translate vnode pointers, fids, or both to file names and absolute path names. In one example, an application (not shown) makes a call to the virtual file system 420 to open the file. The application communicates with the virtual file system 420 through the SYSTEM_CALL module 410. A call to open the file “/usr/foolbar” results in a series for VOP_LOOKUP calls 411 to the VFS layer 420 to resolve the vnode for each directory in the absolute path name and file name.


The file system 400 is configured with a hook 422 in the functional path between the SYSTEM_CALL module 410 and the VFS layer 420. The hook 422 intercepts some or all of the function calls to the VFS layer 420. In some embodiments, the hook 422 is part of or coupled to an application that monitors changes to files within the computer system (not shown). The information used in the VOP_LOOKUP 411 function call is captured and used to populate the vp table 452 of the table structure 455. Populating the vp table 452 is controlled by a function 456 which is part of the RNLC 450. The vnode pointer is used to populate the vp table 452 with the associated name and associated path information. The VOP_LOOKUP 411 is passed on to the VFS layer 420 which returns a vnode pointer for use by the file system 400.


The system monitoring application, which in the shown embodiment is part of the VFS hook module 422, utilizes the RNLC 450 to translate a vnode or vnode pointer to a file name and an absolute path name. The translation is performed by a function call 421 to the RNLC 450. The call invokes the translation function 456.


The translation module 456 of the RNLC 450 searches the vp table 452 to find the requested vnode pointer. The organization of the vp's within the table can follow any common know organizational scheme for fast lookup. Once the vp is found, the associated name and absolute path name information are generated and returned 451.


If the hook 422 intercepts a VOP_INACTIVE function call to the VFS 420, then the associated vp is converted to a fid using a virtual file system function, referred to here as VOP_2_FID(vp), and transferred to the fid table 454 along with the associated name and absolute path information.


If an NFS operation occurs, such as an NFS_DELETE 462, an NFS operation using a fid is generated. The fid is turned into a vp. However, the vp generation step does not utilize the VOP_LOOKUP call and accordingly the vp will not be loaded into the vp table 452. When a request for a translation of a vp occurs, and if the vp is not found, the translation module 458 searches the fid table 454 to find the fid corresponding to the requested vp. The fid table 454 is used to generate an associated name and absolute path name for the fid. The RNLC 450 includes a module 458 for converting a vp or fid into an absolute path name.


In some embodiments, all functions discussed are stored in computer-readable media containing computer-executable instructions and a processor for executing the functions.


Reference has been made in detail to the preferred and alternative embodiments of the invention, examples of which are illustrated in the accompanying drawings. It will be readily apparent to one skilled in the art that other modifications may be made to the embodiment without departing from the spirt and scope of the invention as defined by the appended claims. The invention is intended to cover alternatives, modifications and equivalents, which can be included within the spirit and scope of the invention. Furthermore, in the detailed description of the present invention, numerous specific details have been set forth in order to provide a thorough understanding of the present invention. However, it should be noted that the present invention can be practiced without these specific details. In other instances, well known methods, procedures and components have not been described in detail so as not to unnecessarily obscure aspects of the present invention.

Claims
  • 1. Logic encoded in a non-transitory computer-readable media and when executed by a processor is operable to perform operations comprising: intercepting a first function call into a virtual file system layer, wherein the first function call includes a first name of a file and first path name information associated with a first file reference of the file, and wherein the first intercepted function call is processed in the virtual file system layer to return the first file reference; andpopulating a first entry of a table structure with the first file reference, the first name, and the first path name information, wherein the table holds one or more file references, names, and path name information,wherein the first path name information is linkage information for determining one level of an absolute path name, andwherein one or more entries in the table structure have sufficient information to determine an absolute path name to the file.
  • 2. The logic of claim 1, wherein the file references are vnode references, NFS file handles, file identifier references, or a combination thereof.
  • 3. (canceled)
  • 4. (canceled)
  • 5. The logic of claim 2, wherein each of the vnode references is one of a vnode, a vnode pointer, and a vnode pointer index and wherein each of the file identifier references is a file identifier.
  • 6. The logic of claim 2, further comprising: determining the absolute path name to the file from at least one vnode reference or at least one file identifier reference in the table structure.
  • 7. A method comprising: intercepting a first function call into a virtual file system layer, wherein the first function call includes a first name of a file and first path name information associated with a first file reference of the file, and wherein the first intercepted function call is processed in the virtual file system layer to return the first file reference; andpopulating a first entry of a table structure with the first file reference, the first name, and the first path name information, wherein the table holds one or more file references, names, and path name information,wherein the first path name information is linkage information for determining one level of an absolute path name, andwherein one or more entries in the table structure have sufficient information to determine an absolute path name to the file.
  • 8. The method of claim 7, wherein the file references are vnode references, NFS file handles, file identifier references, or a combination thereof.
  • 9. (canceled)
  • 10. (canceled)
  • 11. The method of claim 8, wherein each of the vnode references is one of a vnode, a vnode pointer, and a vnode index and wherein each of the file identifier references is a file identifier.
  • 12. The method of claim 7, further comprising: determining the absolute path name to the file from at least one vnode reference or at least one file identifier reference in the table structure.
  • 13. A computer device comprising: a table structure configured to store one or more entries, each entry including a file reference, an name, and path information;a program module for populating the table structure; andone or more processors operable to execute operations associated with the table structure and the program module, comprising: intercepting a first function call into a virtual file system layer, wherein the first function call includes a first name of a file and first path name information associated with a first file reference of the file, and wherein the first intercepted function call is processed in the virtual file system layer to return the first file reference; andpopulating a first entry of a table structure with the first file reference, the first name, and the first path name information,wherein the table structure holds one or more file references, names, and path name information,wherein the first path name information is linkage information for determining one level of an absolute path name, andwherein one or more entries in the table structure have sufficient information to determine an absolute path name to the file.
  • 14. (canceled)
  • 15. The computer device of claim 13, wherein the first file reference is a vnode reference, a NFS file handle, or a file identifier reference.
  • 16. (canceled)
  • 17. The computer device of claim 15, wherein the one or more processors are operable to perform further operations comprising: determining an absolute path name to the file in response to receiving a vnode reference or a file identifier reference.
  • 18. The computer device of claim 15, wherein the vnode reference is one of a vnode, a vnode pointer, a vnode index and wherein the file identifier reference is a file identifier.
  • 19. The computer device of claim 13, wherein the one or more processors are operable to perform further operations comprising: intercepting a second function call into the virtual file system layer, wherein the second function call is intercepted before the first function call, wherein the second function call includes a second name of a directory of the file and second path name information associated with a second file reference of the directory, and wherein the second intercepted function call is processed in the virtual file system layer to return the second file reference; andpopulating a second entry of the table structure with the second file reference, the second name, and the second path name information.
  • 20. The computer device of claim 19, wherein the absolute path name to the file is determined from the first name and an absolute path name to the directory.
  • 21. The logic of claim 1, wherein the processor is operable to perform further operations comprising: intercepting a second function call into the virtual file system layer, wherein the second function call is intercepted before the first function call, wherein the second function call includes a second name of a directory of the file and second path name information associated with a second file reference of the directory, and wherein the second intercepted function call is processed in the virtual file system layer to return the second file reference; andpopulating a second entry of the table structure with the second file reference, the second name, and the second path name information.
  • 22. The method of claim 7, further comprising: intercepting a second function call into the virtual file system layer, wherein the second function call is intercepted before the first function call, wherein the second function call includes a second name of a directory of the file and second path name information associated with a second file reference of the directory, and wherein the second intercepted function call is processed in the virtual file system layer to return the second file reference; andpopulating a second entry of the table structure with the second file reference, the second name, and the second path name information.
  • 23. The method of claim 22, wherein the absolute path name to the file is determined from the first name and an absolute path name to the directory.
  • 24. The method of claim 7, wherein the first path name information includes one of the absolute path name to the file or a linkage to one or more other entries in the table structure containing at least part of the absolute path name to the file.
  • 25. The method of claim 7, wherein the first function call is a vnode lookup operation with a first name parameter representing the file, wherein the vnode lookup operation returns a returned vnode pointer for the file, and wherein the first file reference stored in the first entry is a vnode reference representing the returned vnode pointer.
  • 26. The method of claim 7, wherein the first function call is a vnode release operation with a first vnode parameter,wherein a file identifier corresponding to the first vnode parameter is determined, andwherein the first file reference stored in the first entry of the table structure is a file identifier reference representing the file identifier.
RELATED APPLICATIONS

This application claims priority under 35 U.S.C. §119(e) of the co-pending, co-owned U.S. Provisional Patent Application, Ser. No. 61/124,731 filed Apr. 18, 2008, and entitled “MULTI-LEVEL NAME RESOLUTION,” which is hereby incorporated by reference in its entirety.

Provisional Applications (1)
Number Date Country
61124731 Apr 2008 US