lkml.org 
[lkml]   [2006]   [Dec]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 19/35] Unionfs: Directory file operations


    >+++ 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 majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2006-12-05 22:27    [W:0.027 / U:0.088 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site