Added forgotten os/time.o, stdio/fseek.o, and stdio/rewind.o to the build.
Implemented index syscall functions in VFS. Added fs_index.c to the build. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1566 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
64b00573d2
commit
28c9a687e6
@ -324,11 +324,13 @@ KernelLd libroot.so :
|
|||||||
<$(SOURCE_GRIST)!libroot!os>area.o
|
<$(SOURCE_GRIST)!libroot!os>area.o
|
||||||
<$(SOURCE_GRIST)!libroot!os>debug.o
|
<$(SOURCE_GRIST)!libroot!os>debug.o
|
||||||
<$(SOURCE_GRIST)!libroot!os>fs_attr.o
|
<$(SOURCE_GRIST)!libroot!os>fs_attr.o
|
||||||
|
<$(SOURCE_GRIST)!libroot!os>fs_index.o
|
||||||
<$(SOURCE_GRIST)!libroot!os>port.o
|
<$(SOURCE_GRIST)!libroot!os>port.o
|
||||||
<$(SOURCE_GRIST)!libroot!os>sem.o
|
<$(SOURCE_GRIST)!libroot!os>sem.o
|
||||||
<$(SOURCE_GRIST)!libroot!os>systeminfo.o
|
<$(SOURCE_GRIST)!libroot!os>systeminfo.o
|
||||||
<$(SOURCE_GRIST)!libroot!os>thread.o
|
<$(SOURCE_GRIST)!libroot!os>thread.o
|
||||||
<$(SOURCE_GRIST)!libroot!os>team.o
|
<$(SOURCE_GRIST)!libroot!os>team.o
|
||||||
|
<$(SOURCE_GRIST)!libroot!os>time.o
|
||||||
<$(SOURCE_GRIST)!libroot!os>syscalls.o
|
<$(SOURCE_GRIST)!libroot!os>syscalls.o
|
||||||
<$(SOURCE_GRIST)!libroot!os!arch!$(OBOS_ARCH)>atomic.o
|
<$(SOURCE_GRIST)!libroot!os!arch!$(OBOS_ARCH)>atomic.o
|
||||||
|
|
||||||
@ -362,6 +364,7 @@ KernelLd libroot.so :
|
|||||||
<$(SOURCE_GRIST)!libroot!posix!stdio>fputc.o
|
<$(SOURCE_GRIST)!libroot!posix!stdio>fputc.o
|
||||||
<$(SOURCE_GRIST)!libroot!posix!stdio>fputs.o
|
<$(SOURCE_GRIST)!libroot!posix!stdio>fputs.o
|
||||||
<$(SOURCE_GRIST)!libroot!posix!stdio>fread.o
|
<$(SOURCE_GRIST)!libroot!posix!stdio>fread.o
|
||||||
|
<$(SOURCE_GRIST)!libroot!posix!stdio>fseek.o
|
||||||
<$(SOURCE_GRIST)!libroot!posix!stdio>fwrite.o
|
<$(SOURCE_GRIST)!libroot!posix!stdio>fwrite.o
|
||||||
<$(SOURCE_GRIST)!libroot!posix!stdio>fvwrite.o
|
<$(SOURCE_GRIST)!libroot!posix!stdio>fvwrite.o
|
||||||
<$(SOURCE_GRIST)!libroot!posix!stdio>fwalk.o
|
<$(SOURCE_GRIST)!libroot!posix!stdio>fwalk.o
|
||||||
@ -376,6 +379,7 @@ KernelLd libroot.so :
|
|||||||
<$(SOURCE_GRIST)!libroot!posix!stdio>puts.o
|
<$(SOURCE_GRIST)!libroot!posix!stdio>puts.o
|
||||||
<$(SOURCE_GRIST)!libroot!posix!stdio>putw.o
|
<$(SOURCE_GRIST)!libroot!posix!stdio>putw.o
|
||||||
<$(SOURCE_GRIST)!libroot!posix!stdio>refill.o
|
<$(SOURCE_GRIST)!libroot!posix!stdio>refill.o
|
||||||
|
<$(SOURCE_GRIST)!libroot!posix!stdio>rewind.o
|
||||||
<$(SOURCE_GRIST)!libroot!posix!stdio>rget.o
|
<$(SOURCE_GRIST)!libroot!posix!stdio>rget.o
|
||||||
<$(SOURCE_GRIST)!libroot!posix!stdio>sscanf.o
|
<$(SOURCE_GRIST)!libroot!posix!stdio>sscanf.o
|
||||||
<$(SOURCE_GRIST)!libroot!posix!stdio>sprintf.o
|
<$(SOURCE_GRIST)!libroot!posix!stdio>sprintf.o
|
||||||
|
@ -2905,7 +2905,7 @@ err1:
|
|||||||
|
|
||||||
err:
|
err:
|
||||||
mutex_unlock(&gMountMutex);
|
mutex_unlock(&gMountMutex);
|
||||||
return B_ENTRY_NOT_FOUND;
|
return B_BAD_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2960,6 +2960,108 @@ index_dir_rewind(struct file_descriptor *descriptor)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static status_t
|
||||||
|
index_create(mount_id mountID, const char *name, uint32 type, uint32 flags, bool kernel)
|
||||||
|
{
|
||||||
|
struct fs_mount *mount;
|
||||||
|
fs_cookie cookie;
|
||||||
|
int status;
|
||||||
|
|
||||||
|
FUNCTION(("index_create(mountID = %ld, name = %s, kernel = %d)\n", mountID, name, kernel));
|
||||||
|
|
||||||
|
mutex_lock(&gMountMutex);
|
||||||
|
|
||||||
|
mount = find_mount(mountID);
|
||||||
|
if (mount == NULL)
|
||||||
|
goto err;
|
||||||
|
|
||||||
|
// ToDo: lock the mount in some way - i.e. increment the root node's ref counter
|
||||||
|
mutex_unlock(&gMountMutex);
|
||||||
|
|
||||||
|
if (FS_MOUNT_CALL(mount, create_index) == NULL)
|
||||||
|
return EROFS;
|
||||||
|
|
||||||
|
return FS_MOUNT_CALL(mount, create_index)(mount->cookie, name, type, flags);
|
||||||
|
|
||||||
|
err:
|
||||||
|
mutex_unlock(&gMountMutex);
|
||||||
|
return B_BAD_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static status_t
|
||||||
|
index_read_stat(struct file_descriptor *descriptor, struct stat *stat)
|
||||||
|
{
|
||||||
|
struct vnode *vnode = descriptor->u.vnode;
|
||||||
|
|
||||||
|
// ToDo: currently unused!
|
||||||
|
FUNCTION(("index_read_stat: stat 0x%p\n", stat));
|
||||||
|
if (!FS_CALL(vnode, read_index_stat))
|
||||||
|
return EOPNOTSUPP;
|
||||||
|
|
||||||
|
return EOPNOTSUPP;
|
||||||
|
//return FS_CALL(vnode, read_index_stat)(vnode->mount->cookie, vnode->private_node, descriptor->cookie, stat);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static status_t
|
||||||
|
index_name_read_stat(mount_id mountID, const char *name, struct stat *stat, bool kernel)
|
||||||
|
{
|
||||||
|
struct fs_mount *mount;
|
||||||
|
fs_cookie cookie;
|
||||||
|
int status;
|
||||||
|
|
||||||
|
FUNCTION(("index_remove(mountID = %ld, name = %s, kernel = %d)\n", mountID, name, kernel));
|
||||||
|
|
||||||
|
mutex_lock(&gMountMutex);
|
||||||
|
|
||||||
|
mount = find_mount(mountID);
|
||||||
|
if (mount == NULL)
|
||||||
|
goto err;
|
||||||
|
|
||||||
|
// ToDo: lock the mount in some way - i.e. increment the root node's ref counter
|
||||||
|
mutex_unlock(&gMountMutex);
|
||||||
|
|
||||||
|
if (FS_MOUNT_CALL(mount, read_index_stat) == NULL)
|
||||||
|
return EOPNOTSUPP;
|
||||||
|
|
||||||
|
return FS_MOUNT_CALL(mount, read_index_stat)(mount->cookie, name, stat);
|
||||||
|
|
||||||
|
err:
|
||||||
|
mutex_unlock(&gMountMutex);
|
||||||
|
return B_BAD_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static status_t
|
||||||
|
index_remove(mount_id mountID, const char *name, bool kernel)
|
||||||
|
{
|
||||||
|
struct fs_mount *mount;
|
||||||
|
fs_cookie cookie;
|
||||||
|
int status;
|
||||||
|
|
||||||
|
FUNCTION(("index_remove(mountID = %ld, name = %s, kernel = %d)\n", mountID, name, kernel));
|
||||||
|
|
||||||
|
mutex_lock(&gMountMutex);
|
||||||
|
|
||||||
|
mount = find_mount(mountID);
|
||||||
|
if (mount == NULL)
|
||||||
|
goto err;
|
||||||
|
|
||||||
|
// ToDo: lock the mount in some way - i.e. increment the root node's ref counter
|
||||||
|
mutex_unlock(&gMountMutex);
|
||||||
|
|
||||||
|
if (FS_MOUNT_CALL(mount, remove_index) == NULL)
|
||||||
|
return EROFS;
|
||||||
|
|
||||||
|
return FS_MOUNT_CALL(mount, remove_index)(mount->cookie, name);
|
||||||
|
|
||||||
|
err:
|
||||||
|
mutex_unlock(&gMountMutex);
|
||||||
|
return B_BAD_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
// General File System functions
|
// General File System functions
|
||||||
|
|
||||||
@ -3602,6 +3704,34 @@ sys_rename_attr(int fromFile, const char *fromName, int toFile, const char *toNa
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
sys_open_index_dir(dev_t device)
|
||||||
|
{
|
||||||
|
return index_dir_open(device, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
sys_create_index(dev_t device, const char *name, uint32 type, uint32 flags)
|
||||||
|
{
|
||||||
|
return index_create(device, name, type, flags, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
sys_read_index_stat(dev_t device, const char *name, struct stat *stat)
|
||||||
|
{
|
||||||
|
return index_name_read_stat(device, name, stat, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
sys_remove_index(dev_t device, const char *name)
|
||||||
|
{
|
||||||
|
return index_remove(device, name, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
sys_getcwd(char *buffer, size_t size)
|
sys_getcwd(char *buffer, size_t size)
|
||||||
{
|
{
|
||||||
@ -4131,6 +4261,61 @@ user_rename_attr(int fromFile, const char *userFromName, int toFile, const char
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
user_open_index_dir(dev_t device)
|
||||||
|
{
|
||||||
|
return index_dir_open(device, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
user_create_index(dev_t device, const char *userName, uint32 type, uint32 flags)
|
||||||
|
{
|
||||||
|
char name[B_FILE_NAME_LENGTH];
|
||||||
|
|
||||||
|
if (!CHECK_USER_ADDRESS(userName)
|
||||||
|
|| user_strlcpy(name, userName, B_FILE_NAME_LENGTH) < B_OK)
|
||||||
|
return B_BAD_ADDRESS;
|
||||||
|
|
||||||
|
return index_create(device, name, type, flags, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
user_read_index_stat(dev_t device, const char *userName, struct stat *userStat)
|
||||||
|
{
|
||||||
|
char name[B_FILE_NAME_LENGTH];
|
||||||
|
struct stat stat;
|
||||||
|
status_t status;
|
||||||
|
|
||||||
|
if (!CHECK_USER_ADDRESS(userName)
|
||||||
|
|| !CHECK_USER_ADDRESS(userStat)
|
||||||
|
|| user_strlcpy(name, userName, B_FILE_NAME_LENGTH) < B_OK)
|
||||||
|
return B_BAD_ADDRESS;
|
||||||
|
|
||||||
|
status = index_name_read_stat(device, name, &stat, false);
|
||||||
|
if (status == B_OK) {
|
||||||
|
if (user_memcpy(userStat, &stat, sizeof(stat)) < B_OK)
|
||||||
|
return B_BAD_ADDRESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
user_remove_index(dev_t device, const char *userName)
|
||||||
|
{
|
||||||
|
char name[B_FILE_NAME_LENGTH];
|
||||||
|
|
||||||
|
if (!CHECK_USER_ADDRESS(userName)
|
||||||
|
|| user_strlcpy(name, userName, B_FILE_NAME_LENGTH) < B_OK)
|
||||||
|
return B_BAD_ADDRESS;
|
||||||
|
|
||||||
|
return index_remove(device, name, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
user_getcwd(char *userBuffer, size_t size)
|
user_getcwd(char *userBuffer, size_t size)
|
||||||
{
|
{
|
||||||
|
@ -159,6 +159,18 @@ int syscall_dispatcher(unsigned long call_num, void *arg_buffer, uint64 *call_re
|
|||||||
case SYSCALL_RENAME_ATTR:
|
case SYSCALL_RENAME_ATTR:
|
||||||
*call_ret = user_rename_attr((int)arg0, (const char *)arg1, (int)arg2, (const char *)arg3);
|
*call_ret = user_rename_attr((int)arg0, (const char *)arg1, (int)arg2, (const char *)arg3);
|
||||||
break;
|
break;
|
||||||
|
case SYSCALL_OPEN_INDEX_DIR:
|
||||||
|
*call_ret = user_open_index_dir((dev_t)arg0);
|
||||||
|
break;
|
||||||
|
case SYSCALL_CREATE_INDEX:
|
||||||
|
*call_ret = user_create_index((dev_t)arg0, (const char *)arg1, (uint32)arg2, (uint32)arg3);
|
||||||
|
break;
|
||||||
|
case SYSCALL_READ_INDEX_STAT:
|
||||||
|
*call_ret = user_read_index_stat((dev_t)arg0, (const char *)arg1, (struct stat *)arg2);
|
||||||
|
break;
|
||||||
|
case SYSCALL_REMOVE_INDEX:
|
||||||
|
*call_ret = user_remove_index((dev_t)arg0, (const char *)arg1);
|
||||||
|
break;
|
||||||
case SYSCALL_SYSTEM_TIME:
|
case SYSCALL_SYSTEM_TIME:
|
||||||
*call_ret = system_time();
|
*call_ret = system_time();
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user