Stylus cleanupus.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21224 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Hugo Santos 2007-05-23 21:48:31 +00:00
parent 77bf99deb0
commit 6580fd3848
2 changed files with 30 additions and 38 deletions

View File

@ -371,14 +371,14 @@ net_stack_control(void *_cookie, uint32 op, void *data, size_t length)
if (status < B_OK)
return status;
net_stack_cookie *accept_cookie;
net_stack_cookie *acceptCookie;
status = resolve_cookie(kernel, args.accept_socket,
&accept_cookie);
&acceptCookie);
if (status < B_OK)
return status;
status = sSocket->accept(cookie->socket, args.address,
&args.address_length, &accept_cookie->socket);
&args.address_length, &acceptCookie->socket);
if (status < B_OK)
return status;

View File

@ -346,6 +346,26 @@ dup2_fd(int oldfd, int newfd, bool kernel)
}
static status_t
fd_ioctl(bool kernelFD, int fd, ulong op, void *buffer, size_t length)
{
struct file_descriptor *descriptor;
int status;
descriptor = get_fd(get_current_io_context(kernelFD), fd);
if (descriptor == NULL)
return B_FILE_ERROR;
if (descriptor->ops->fd_ioctl)
status = descriptor->ops->fd_ioctl(descriptor, op, buffer, length);
else
status = EOPNOTSUPP;
put_fd(descriptor);
return status;
}
status_t
select_fd(int fd, uint8 event, uint32 ref, struct select_sync *sync, bool kernel)
{
@ -690,17 +710,7 @@ _user_ioctl(int fd, ulong op, void *buffer, size_t length)
TRACE(("user_ioctl: fd %d\n", fd));
descriptor = get_fd(get_current_io_context(false), fd);
if (!descriptor)
return B_FILE_ERROR;
if (descriptor->ops->fd_ioctl)
status = descriptor->ops->fd_ioctl(descriptor, op, buffer, length);
else
status = EOPNOTSUPP;
put_fd(descriptor);
return status;
return fd_ioctl(false, fd, op, buffer, length);
}
@ -956,39 +966,21 @@ _kern_seek(int fd, off_t pos, int seekType)
}
static status_t
_fd_ioctl(bool kernel_fd, int fd, ulong op, void *buffer, size_t length)
{
struct file_descriptor *descriptor;
int status;
TRACE(("sys_ioctl: fd %d\n", fd));
descriptor = get_fd(get_current_io_context(kernel_fd), fd);
if (descriptor == NULL)
return B_FILE_ERROR;
if (descriptor->ops->fd_ioctl)
status = descriptor->ops->fd_ioctl(descriptor, op, buffer, length);
else
status = EOPNOTSUPP;
put_fd(descriptor);
return status;
}
status_t
_kern_ioctl(int fd, ulong op, void *buffer, size_t length)
{
return _fd_ioctl(true, fd, op, buffer, length);
TRACE(("kern_ioctl: fd %d\n", fd));
return fd_ioctl(true, fd, op, buffer, length);
}
status_t
user_fd_kernel_ioctl(int fd, ulong op, void *buffer, size_t length)
{
return _fd_ioctl(false, fd, op, buffer, length);
TRACE(("user_fd_kernel_ioctl: fd %d\n", fd));
return fd_ioctl(false, fd, op, buffer, length);
}