mirror of
https://github.com/drasko/codezero.git
synced 2026-04-03 02:29:06 +02:00
In FS0 filesystem image buffer was smaller than the memfs-defined maximum.
- Now fs size is in sync with memfs max size.
This commit is contained in:
@@ -84,6 +84,55 @@ out:
|
||||
return err;
|
||||
}
|
||||
|
||||
/*
|
||||
* Different from vfs_open(), which validates an already opened
|
||||
* file descriptor, this call opens a new vfs file by the pager
|
||||
* using the given path. The vnum handle and file length is returned
|
||||
* since the pager uses this information to access file pages.
|
||||
*/
|
||||
int vfs_open_bypath(const char *pathname, unsigned long *vnum, unsigned long *length)
|
||||
{
|
||||
int err = 0;
|
||||
struct tcb *vfs;
|
||||
|
||||
// printf("%s/%s\n", __TASKNAME__, __FUNCTION__);
|
||||
|
||||
if (!(vfs = find_task(VFS_TID)))
|
||||
return -ESRCH;
|
||||
|
||||
/*
|
||||
* Copy string to vfs shared page.
|
||||
*
|
||||
* FIXME: There's a chance we're overwriting other tasks'
|
||||
* ipc information that is on the vfs shared page.
|
||||
*/
|
||||
strcpy(vfs->shared_page + 0x200, pathname);
|
||||
|
||||
l4_save_ipcregs();
|
||||
|
||||
write_mr(L4SYS_ARG0, (unsigned long)vfs->shared_page + 0x200);
|
||||
|
||||
if ((err = l4_sendrecv(VFS_TID, VFS_TID,
|
||||
L4_IPC_TAG_PAGER_OPEN_BYPATH)) < 0) {
|
||||
printf("%s: L4 IPC Error: %d.\n", __FUNCTION__, err);
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Check if syscall was successful */
|
||||
if ((err = l4_get_retval()) < 0) {
|
||||
printf("%s: VFS open error: %d.\n",
|
||||
__FUNCTION__, err);
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Read file information */
|
||||
*vnum = read_mr(L4SYS_ARG0);
|
||||
*length = read_mr(L4SYS_ARG1);
|
||||
|
||||
out:
|
||||
l4_restore_ipcregs();
|
||||
return err;
|
||||
}
|
||||
|
||||
/*
|
||||
* When a task does a read/write/mmap request on a file, if
|
||||
@@ -95,8 +144,6 @@ int vfs_open(l4id_t opener, int fd, unsigned long *vnum, unsigned long *length)
|
||||
{
|
||||
int err = 0;
|
||||
|
||||
// printf("%s/%s\n", __TASKNAME__, __FUNCTION__);
|
||||
|
||||
l4_save_ipcregs();
|
||||
|
||||
write_mr(L4SYS_ARG0, opener);
|
||||
|
||||
Reference in New Issue
Block a user