mkdir almost working.

Added changes to pathname lookup code so that the root
directory special case is handled properly.
This commit is contained in:
Bahadir Balban
2008-04-15 00:51:58 +01:00
parent 287b7705da
commit a9420d3dc9
11 changed files with 159 additions and 66 deletions

View File

@@ -10,7 +10,7 @@
#include <l4/macros.h>
#include <l4lib/types.h>
#include <stat.h>
#include <path.h>
typedef void (*vnode_op_t)(void);
typedef void (*file_op_t)(void);
@@ -46,7 +46,7 @@ struct file_ops {
/* Operations that work on vnode fields and associations between vnodes */
struct vnode_ops {
vnode_op_t create;
struct vnode *(*lookup)(struct vnode *root, char *path);
struct vnode *(*lookup)(struct vnode *root, struct pathdata *pdata);
int (*readdir)(struct vnode *v);
int (*filldir)(void *buf, struct vnode *v, int count);
vnode_op_t link;

26
tasks/fs0/include/path.h Normal file
View File

@@ -0,0 +1,26 @@
/*
* Copyright (C) 2008 Bahadir Balban
*
* Path lookup related information
*/
#ifndef __PATH_H__
#define __PATH_H__
/*
* FIXME:
* These ought to be strings and split/comparison functions should
* always use strings because formats like UTF-8 wouldn't work.
*/
#define VFS_CHAR_SEP '/'
#define VFS_STR_ROOTDIR "/"
#define VFS_STR_PARDIR ".."
#define VFS_STR_CURDIR "."
#define VFS_STR_XATDIR "...."
struct pathdata {
struct tcb *task;
int root;
char *path;
};
#endif /* __PATH_H__ */

View File

@@ -8,20 +8,11 @@
#include <l4/macros.h>
#include <stdio.h>
#include <task.h>
#include <path.h>
extern struct list_head vnode_cache;
extern struct list_head dentry_cache;
/*
* FIXME:
* These ought to be strings and split/comparison functions should
* always use strings because formats like UTF-8 wouldn't work.
*/
#define VFS_STR_SEP '/'
#define VFS_STR_PARDIR ".."
#define VFS_STR_CURDIR "."
#define VFS_STR_XATDIR "...."
/*
* This is a temporary replacement for page cache support provided by mm0.
* Normally mm0 tracks all vnode pages, but this is used to track pages in
@@ -91,8 +82,8 @@ struct vfs_mountpoint {
extern struct vfs_mountpoint vfs_root;
int vfs_mount_root(struct superblock *sb);
struct vnode *generic_vnode_lookup(struct vnode *thisnode, char *path);
struct vnode *vfs_lookup_bypath(struct tcb *task, char *path);
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_byvnum(struct superblock *sb, unsigned long vnum);
#endif /* __VFS_H__ */