Re: [PATCH 19/35] Unionfs: Directory file operations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




>+++ b/fs/unionfs/dirfops.c

>+/* This is not meant to be a generic repositioning function.  If you do
>+ * things that aren't supported, then we return EINVAL.
>+ *
>+ * What is allowed:
>+ *  (1) seeking to the same position that you are currently at
>+ *	This really has no effect, but returns where you are.
>+ *  (2) seeking to the end of the file, if you've read everything
>+ *	This really has no effect, but returns where you are.
>+ *  (3) seeking to the beginning of the file
>+ *	This throws out all state, and lets you begin again.
>+ */
>+static loff_t unionfs_dir_llseek(struct file *file, loff_t offset, int origin)
>+{
[...]
>+	/* We let users seek to their current position, but not anywhere else. */
>+	if (!offset) {
[...]
>+		case SEEK_END:
>+			/* Unsupported, because we would break everything.  */
>+			err = -EINVAL;
>+			break;
[...]

This SEEK_END implementation clashes with (2).

>+	} else {
[...]
>+	}
>+
>+out:
>+	return err;
>+}
>+
>+/* Trimmed directory options, we shouldn't pass everything down since
>+ * we don't want to operate on partial directories.
>+ */
>+struct file_operations unionfs_dir_fops = {
>+	.llseek =		unionfs_dir_llseek,
>+	.read =			generic_read_dir,
>+	.readdir =		unionfs_readdir,
>+	.unlocked_ioctl =	unionfs_ioctl,
>+	.open =			unionfs_open,
>+	.release =		unionfs_file_release,
>+	.flush =		unionfs_flush,
>+};

Prefers

+struct file_operations unionfs_dir_fops = {
+	.llseek         = unionfs_dir_llseek,
+	.read           = generic_read_dir,
+	.readdir        = unionfs_readdir,
+	.unlocked_ioctl = unionfs_ioctl,
+	.open           = unionfs_open,
+	.release        = unionfs_file_release,
+	.flush          = unionfs_flush,
+};

BTW, you could line up other structs too! :)



	-`J'
-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux