Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 2699 → Rev 2700

/trunk/uspace/srv/vfs/vfs_ops.c
71,7 → 71,8
.dev_handle = dev_handle,
};
 
return vfs_lookup_internal("/", strlen("/"), result, &altroot);
return vfs_lookup_internal("/", strlen("/"), L_DIRECTORY, result,
&altroot);
}
 
void vfs_mount(ipc_callid_t rid, ipc_call_t *request)
195,7 → 196,8
* We already have the root FS.
*/
rwlock_write_lock(&namespace_rwlock);
rc = vfs_lookup_internal(buf, size, &mp_res, NULL);
rc = vfs_lookup_internal(buf, size, L_DIRECTORY, &mp_res,
NULL);
if (rc != EOK) {
/*
* The lookup failed for some reason.
297,12 → 299,16
}
 
/*
* The POSIX interface is open(path, flags, mode).
* We can receive flags and mode along with the VFS_OPEN call; the path
* The POSIX interface is open(path, oflag, mode).
* We can receive oflags and mode along with the VFS_OPEN call; the path
* will need to arrive in another call.
*
* We also receive one private, non-POSIX set of flags called lflag
* used to pass information to vfs_lookup_internal().
*/
int flags = IPC_GET_ARG1(*request);
int mode = IPC_GET_ARG2(*request);
int lflag = IPC_GET_ARG1(*request);
int oflag = IPC_GET_ARG2(*request);
int mode = IPC_GET_ARG3(*request);
size_t len;
 
ipc_callid_t callid;
345,7 → 351,7
* The path is now populated and we can call vfs_lookup_internal().
*/
vfs_lookup_res_t lr;
rc = vfs_lookup_internal(path, len, &lr, NULL);
rc = vfs_lookup_internal(path, len, lflag, &lr, NULL);
if (rc) {
rwlock_read_unlock(&namespace_rwlock);
ipc_answer_0(rid, rc);
/trunk/uspace/srv/vfs/vfs.h
138,6 → 138,9
VFS_TRIPLET;
} vfs_triplet_t;
 
#define L_FILE 1
#define L_DIRECTORY 2
 
typedef struct {
vfs_triplet_t triplet;
size_t size;
203,7 → 206,7
 
extern int fs_name_to_handle(char *, bool);
 
extern int vfs_lookup_internal(char *, size_t, vfs_lookup_res_t *,
extern int vfs_lookup_internal(char *, size_t, int, vfs_lookup_res_t *,
vfs_pair_t *);
 
extern bool vfs_nodes_init(void);
/trunk/uspace/srv/vfs/vfs_lookup.c
55,6 → 55,7
*
* @param path Path to be resolved; it needn't be an ASCIIZ string.
* @param len Number of path characters pointed by path.
* @param lflag Flags to be used during lookup.
* @param result Empty structure where the lookup result will be stored.
* @param altroot If non-empty, will be used instead of rootfs as the root
* of the whole VFS tree.
61,8 → 62,8
*
* @return EOK on success or an error code from errno.h.
*/
int vfs_lookup_internal(char *path, size_t len, vfs_lookup_res_t *result,
vfs_pair_t *altroot)
int vfs_lookup_internal(char *path, size_t len, int lflag,
vfs_lookup_res_t *result, vfs_pair_t *altroot)
{
vfs_pair_t *root;
 
144,9 → 145,9
 
ipc_call_t answer;
int phone = vfs_grab_phone(root->fs_handle);
aid_t req = async_send_3(phone, VFS_LOOKUP, (ipcarg_t) first,
aid_t req = async_send_4(phone, VFS_LOOKUP, (ipcarg_t) first,
(ipcarg_t) (first + len - 1) % PLB_SIZE,
(ipcarg_t) root->dev_handle, &answer);
(ipcarg_t) root->dev_handle, (ipcarg_t) lflag, &answer);
vfs_release_phone(phone);
 
ipcarg_t rc;