diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2013-09-28 14:47:49 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2013-09-28 14:47:49 -0600 |
commit | b2bb7e626fd9d3ca2a0a53a179712a30f6f2ab3a (patch) | |
tree | 40f60dd2d410a5f0d7b6af5d1e736f59187eabdf /nuttx/fs/fs_ioctl.c | |
parent | 7d1166b886638aab648cf27450454ea3b76bfd18 (diff) | |
download | nuttx-b2bb7e626fd9d3ca2a0a53a179712a30f6f2ab3a.tar.gz nuttx-b2bb7e626fd9d3ca2a0a53a179712a30f6f2ab3a.tar.bz2 nuttx-b2bb7e626fd9d3ca2a0a53a179712a30f6f2ab3a.zip |
Optimized sendfile() from Max Holtzberg
Diffstat (limited to 'nuttx/fs/fs_ioctl.c')
-rw-r--r-- | nuttx/fs/fs_ioctl.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/nuttx/fs/fs_ioctl.c b/nuttx/fs/fs_ioctl.c index 3440bc0d0..89b7b3f51 100644 --- a/nuttx/fs/fs_ioctl.c +++ b/nuttx/fs/fs_ioctl.c @@ -1,7 +1,7 @@ /**************************************************************************** * fs/fs_ioctl.c * - * Copyright (C) 2007-2010, 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2010, 2012-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -42,6 +42,7 @@ #include <sys/ioctl.h> #include <sched.h> #include <errno.h> +#include <assert.h> #include <net/if.h> @@ -89,7 +90,7 @@ int ioctl(int fd, int req, unsigned long arg) int err; #if CONFIG_NFILE_DESCRIPTORS > 0 FAR struct filelist *list; - FAR struct file *this_file; + FAR struct file *filep; FAR struct inode *inode; int ret = OK; @@ -117,22 +118,18 @@ int ioctl(int fd, int req, unsigned long arg) /* Get the thread-specific file list */ list = sched_getfiles(); - if (!list) - { - err = EMFILE; - goto errout; - } + DEBUGASSERT(list); /* Is a driver registered? Does it support the ioctl method? */ - this_file = &list->fl_files[fd]; - inode = this_file->f_inode; + filep = &list->fl_files[fd]; + inode = filep->f_inode; if (inode && inode->u.i_ops && inode->u.i_ops->ioctl) { /* Yes, then let it perform the ioctl */ - ret = (int)inode->u.i_ops->ioctl(this_file, req, arg); + ret = (int)inode->u.i_ops->ioctl(filep, req, arg); if (ret < 0) { err = -ret; |