1,6 → 1,3 |
/* This file contains the procedures that look up path names in the directory |
* system and determine the inode number that goes with a given path name. |
*/ |
/* |
* Copyright (c) 1987,1997, Prentice Hall |
* All rights reserved. |
35,17 → 32,18 |
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
|
/** @addtogroup FileSystemImpl |
* @{ |
*/ |
|
/** |
* @file path.c |
* @brief This file contains the procedures that look up path names in the directory |
* system and determine the inode number that goes with a given path name. |
*/ |
|
/* Methods: |
* eat_path: the 'main' routine of the path-to-inode conversion mechanism |
* last_dir: find the final directory on a given path |
* advance: parse one component of a path name |
* search_dir: search a directory for a string and return its inode number |
* search_dir_ex: used for extended versions |
*/ |
|
|
#include <string.h> |
#include "fs.h" |
#include "block.h" |
57,6 → 55,9 |
|
static char *get_name(char *old_name, char *string, int string_length); |
|
/** |
* The 'main' routine of the path-to-inode conversion mechanism |
*/ |
inode_t *eat_path(char *path) |
{ |
|
92,7 → 93,10 |
|
return rip; |
} |
|
|
/** |
* Find the final directory on a given path |
*/ |
inode_t *last_dir(char *path, char *string, int string_length) |
{ |
|
151,6 → 155,9 |
} |
} |
|
/** |
* Parse one component of a path name |
*/ |
char *get_name(char *old_name, char *string, int string_length) |
{ |
|
194,7 → 201,10 |
|
return rnp; |
} |
|
|
/** |
* |
*/ |
inode_t *advance(inode_t *dirp, char *string, int string_length) |
{ |
|
238,6 → 248,9 |
return rip; /* return pointer to inode's component */ |
} |
|
/** |
* Search a directory for a string and return its inode number |
*/ |
int search_dir(register inode_t *ldir_ptr, char string[NAME_MAX], ino_t *numb, int flag) |
{ |
|
305,6 → 318,9 |
return(flag == IS_EMPTY ? OK : FS_ENOENT); |
} |
|
/** |
* Used for extended versions |
*/ |
int search_dir_ex(register inode_t *ldir_ptr, char string[NAME_MAX_EX], ino_t *numb, int flag) |
{ |
|
369,3 → 385,8 |
return(flag == IS_EMPTY ? OK : FS_ENOENT); |
} |
|
|
/** |
* } |
*/ |
|