From 6580fd384823ed56a2970911ac42cb6ebdfc7976 Mon Sep 17 00:00:00 2001 From: Hugo Santos Date: Wed, 23 May 2007 21:48:31 +0000 Subject: [PATCH] Stylus cleanupus. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21224 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../drivers/network/stack/kernel_stack.cpp | 6 +- src/system/kernel/fs/fd.c | 62 ++++++++----------- 2 files changed, 30 insertions(+), 38 deletions(-) diff --git a/src/add-ons/kernel/drivers/network/stack/kernel_stack.cpp b/src/add-ons/kernel/drivers/network/stack/kernel_stack.cpp index b4f9ad390d..83d1f3c56a 100644 --- a/src/add-ons/kernel/drivers/network/stack/kernel_stack.cpp +++ b/src/add-ons/kernel/drivers/network/stack/kernel_stack.cpp @@ -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; diff --git a/src/system/kernel/fs/fd.c b/src/system/kernel/fs/fd.c index e3933d61e4..458e3f005b 100644 --- a/src/system/kernel/fs/fd.c +++ b/src/system/kernel/fs/fd.c @@ -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); }