Added new path parsing functions that work cleaner, better.

Input paths are now parsed at the beginning and components
put into an ordered linked list headed by struct pathdata.
Lookup functions use these components to look up vnodes.
This commit is contained in:
Bahadir Balban
2008-04-15 19:36:07 +01:00
parent fb249b0c5b
commit 9ba6638d01
6 changed files with 176 additions and 85 deletions

View File

@@ -6,6 +6,8 @@
#ifndef __PATH_H__
#define __PATH_H__
#include <l4/lib/list.h>
/*
* FIXME:
* These ought to be strings and split/comparison functions should
@@ -18,9 +20,22 @@
#define VFS_STR_XATDIR "...."
struct pathdata {
struct list_head list;
struct tcb *task;
int root;
char *path;
};
struct pathcomp {
struct list_head list;
char *str;
};
struct pathdata *pathdata_parse(const char *pathname, char *pathbuf,
struct tcb *task);
void pathdata_destroy(struct pathdata *p);
/* Destructive, i.e. unlinks those components from list */
char *pathdata_next_component(struct pathdata *pdata);
char *pathdata_last_component(struct pathdata *pdata);
#endif /* __PATH_H__ */

View File

@@ -83,7 +83,7 @@ extern struct vfs_mountpoint vfs_root;
int vfs_mount_root(struct superblock *sb);
struct vnode *generic_vnode_lookup(struct vnode *thisnode, struct pathdata *p);
struct vnode *vfs_lookup_bypath(struct tcb *task, struct pathdata *p);
struct vnode *vfs_lookup_bypath(struct pathdata *p);
struct vnode *vfs_lookup_byvnum(struct superblock *sb, unsigned long vnum);
#endif /* __VFS_H__ */