Thread (6 messages) flat view 6 messages, 2 authors, 2008-12-18

Re: [PATCH v4 2/3] Add preadv and pwritev system calls.

From: Gerd Hoffmann <hidden>
Date: 2008-12-18 13:38:21
Also in: linux-arch, lkml

  Hi,
Please remember to add the function prototypes to
include/linux/syscalls.h.
Done.
quoted
+asmlinkage ssize_t
+compat_sys_preadv(unsigned long fd, const struct compat_iovec __user *vec,
+                  unsigned long vlen, u32 pos_high, u32 pos_low)
+{.
+        loff_t pos = ((loff_t)pos_high << 32) | pos_low;
This is whitespace damaged, as are the other four functions in the
same place.
Fixed.
quoted
+	struct file *file;
+	ssize_t ret = -EBADF;
+
+	if (pos < 0)
+		return -EINVAL;
+
+	file = fget(fd);
+	if (!file)
+		return -EBADF;
Any reason for using fget() here, but fget_light() in sys_preadv?
Due to the new syscalls being derived from the readv()/preadv()
versions, which have the same inconsistency.  Dunno why.  I'd suspect
the reason is that the compat syscalls tend to be overlooked when the
code is updated.  Proof: patch #1 in this series ...

I'll switch them all over in a separate followup patch.
quoted
+	if (!(file->f_mode & FMODE_READ))
+		goto out;
+
+	ret = -EINVAL;
+	if (!file->f_op || (!file->f_op->aio_read && !file->f_op->read))
+		goto out;
Maybe this logic could get moved into a compat_readv() function,
similar to vfs_readv().
Yes, makes sense.

cheers,
  Gerd


--
To unsubscribe from this list: send the line "unsubscribe linux-api" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help