Several VFS related syscalls have been changed, added or removed.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8701 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -464,77 +464,6 @@ _user_rewind_dir(int fd)
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
_user_read_stat(int fd, struct stat *userStat, size_t statSize)
|
||||
{
|
||||
struct file_descriptor *descriptor;
|
||||
status_t status;
|
||||
|
||||
if (statSize > sizeof(struct stat))
|
||||
return B_BAD_VALUE;
|
||||
|
||||
/* This is a user_function, so abort if we have a kernel address */
|
||||
if (IS_KERNEL_ADDRESS(userStat))
|
||||
return B_BAD_ADDRESS;
|
||||
|
||||
descriptor = get_fd(get_current_io_context(false), fd);
|
||||
if (descriptor == NULL)
|
||||
return B_FILE_ERROR;
|
||||
|
||||
TRACE(("_user_read_stat(descriptor = %p)\n", descriptor));
|
||||
|
||||
if (descriptor->ops->fd_read_stat) {
|
||||
// we're using the stat buffer on the stack to not have to
|
||||
// lock the given stat buffer in memory
|
||||
struct stat stat;
|
||||
|
||||
status = descriptor->ops->fd_read_stat(descriptor, &stat);
|
||||
if (status >= 0)
|
||||
status = user_memcpy(userStat, &stat, statSize);
|
||||
} else
|
||||
status = EOPNOTSUPP;
|
||||
|
||||
put_fd(descriptor);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
_user_write_stat(int fd, const struct stat *userStat, size_t statSize, int statMask)
|
||||
{
|
||||
struct file_descriptor *descriptor;
|
||||
status_t status;
|
||||
|
||||
if (statSize > sizeof(struct stat))
|
||||
return B_BAD_VALUE;
|
||||
|
||||
if (IS_KERNEL_ADDRESS(userStat))
|
||||
return B_BAD_ADDRESS;
|
||||
|
||||
descriptor = get_fd(get_current_io_context(false), fd);
|
||||
if (descriptor == NULL)
|
||||
return B_FILE_ERROR;
|
||||
|
||||
TRACE(("_user_write_stat(descriptor = %p)\n", descriptor));
|
||||
|
||||
if (descriptor->ops->fd_write_stat) {
|
||||
// we're using the stat buffer on the stack to not have to
|
||||
// lock the given stat buffer in memory
|
||||
struct stat stat;
|
||||
if (sizeof(struct stat) != statSize)
|
||||
memset((uint8 *)&stat + statSize, 0, sizeof(struct stat) - statSize);
|
||||
|
||||
status = user_memcpy(&stat, userStat, statSize);
|
||||
if (status == B_OK)
|
||||
status = descriptor->ops->fd_write_stat(descriptor, &stat, statMask);
|
||||
} else
|
||||
status = EOPNOTSUPP;
|
||||
|
||||
put_fd(descriptor);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
_user_close(int fd)
|
||||
{
|
||||
@@ -721,75 +650,6 @@ _kern_rewind_dir(int fd)
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
_kern_read_stat(int fd, struct stat *stat, size_t statSize)
|
||||
{
|
||||
struct file_descriptor *descriptor;
|
||||
status_t status;
|
||||
|
||||
if (statSize > sizeof(struct stat))
|
||||
return B_BAD_VALUE;
|
||||
|
||||
descriptor = get_fd(get_current_io_context(true), fd);
|
||||
if (descriptor == NULL)
|
||||
return B_FILE_ERROR;
|
||||
|
||||
TRACE(("_kern_read_stat(descriptor = %p)\n", descriptor));
|
||||
|
||||
if (descriptor->ops->fd_read_stat) {
|
||||
// this supports different stat extensions
|
||||
struct stat completeStat;
|
||||
struct stat *originalStat = NULL;
|
||||
|
||||
if (statSize < sizeof(struct stat)) {
|
||||
originalStat = stat;
|
||||
stat = &completeStat;
|
||||
}
|
||||
status = descriptor->ops->fd_read_stat(descriptor, stat);
|
||||
|
||||
if (originalStat != NULL)
|
||||
memcpy(originalStat, stat, statSize);
|
||||
} else
|
||||
status = EOPNOTSUPP;
|
||||
|
||||
put_fd(descriptor);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
_kern_write_stat(int fd, const struct stat *stat, size_t statSize, int statMask)
|
||||
{
|
||||
struct file_descriptor *descriptor;
|
||||
status_t status;
|
||||
|
||||
if (statSize > sizeof(struct stat))
|
||||
return B_BAD_VALUE;
|
||||
|
||||
descriptor = get_fd(get_current_io_context(true), fd);
|
||||
if (descriptor == NULL)
|
||||
return B_FILE_ERROR;
|
||||
|
||||
TRACE(("_kern_write_stat(descriptor = %p)\n", descriptor));
|
||||
|
||||
if (descriptor->ops->fd_write_stat) {
|
||||
// this supports different stat extensions
|
||||
struct stat completeStat;
|
||||
|
||||
if (statSize < sizeof(struct stat)) {
|
||||
memset((uint8 *)&completeStat + statSize, 0, sizeof(struct stat) - statSize);
|
||||
memcpy(&completeStat, stat, statSize);
|
||||
stat = &completeStat;
|
||||
}
|
||||
status = descriptor->ops->fd_write_stat(descriptor, stat, statMask);
|
||||
} else
|
||||
status = EOPNOTSUPP;
|
||||
|
||||
put_fd(descriptor);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
_kern_close(int fd)
|
||||
{
|
||||
|
||||
+751
-211
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user