lkml.org 
[lkml]   [1997]   [Jul]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[patch-again] romfs for 2.1.46
    On Wed, Jul 23, 1997 at 10:35:37AM -0700, Linus Torvalds wrote:
    > > Patch contents: first the patch to fs/namei.c to avoid trying follow_link
    > > for strange directories, this may or may not be required in later
    > > pre-patches.
    >
    > This won't be applied. There are real reason why we may want to do
    > follow-link even on files that don't "appear" to be links.

    Ahh, thought so... :) I guess it would be better saying 'this
    "solution" may or may not be best for later (pre-)patches', here's
    the way that keeps the ugliness out the core of the fs code.

    --
    Janos - Don't worry, my address works. I'm just bored of spam.

    --- linux-2.1.46-current/fs/romfs/inode.c Tue Jul 22 15:59:16 1997
    +++ linux/fs/romfs/inode.c Thu Jul 24 00:36:12 1997
    @@ -21,6 +21,7 @@
    * Jun 1997 2.1.43+ changes
    * Jul 1997 proper page locking in readpage
    * Changed to work with 2.1.45+ fs
    + * Fixed follow_link
    */

    /* todo:
    @@ -442,32 +443,35 @@ out:
    return mylen;
    }

    -static struct dentry * romfs_follow_link(struct inode * inode, struct dentry *base)
    +static struct dentry *romfs_follow_link(struct inode *inode, struct dentry *base)
    {
    char *link;
    - int len;
    - long err;
    -
    - /* note: 2.1.46 calls this for directories... not handled */
    + int len, cnt;
    + struct dentry *dentry;

    - err = -EBADF; /* correct? */
    - if (!S_ISLNK(inode->i_mode))
    + /* Note: 2.1.46+ calls this for our strange directories...
    + * What I do is not really right, but I like it better for now,
    + * than a separate i_op table. Anyway, our directories won't
    + * have multiple "real" links to them, so it maybe loses nothing. */
    + if (!S_ISLNK(inode->i_mode)) {
    + dentry = dget(i_dentry(inode));
    goto outnobuf;
    + }

    len = inode->i_size;

    - err = -EAGAIN; /* correct? */
    + dentry = ERR_PTR(-EAGAIN); /* correct? */
    if (!(link = kmalloc(len+1, GFP_KERNEL)))
    - goto out;
    + goto outnobuf;

    - err = romfs_copyfrom(inode, link, inode->u.romfs_i.i_dataoffset, len);
    - if (err != len) {
    - err = -EIO;
    + cnt = romfs_copyfrom(inode, link, inode->u.romfs_i.i_dataoffset, len);
    + if (len != cnt) {
    + dentry = ERR_PTR(-EIO);
    goto out;
    } else
    link[len] = 0;

    - base = lookup_dentry(link, base, 1);
    + dentry = lookup_dentry(link, base, 1);
    kfree(link);

    if (0) {
    @@ -475,9 +479,8 @@ out:
    kfree(link);
    outnobuf:
    dput(base);
    - base = ERR_PTR(err);
    }
    - return base;
    + return dentry;
    }

    /* Mapping from our types to the kernel */
    \
     
     \ /
      Last update: 2005-03-22 13:39    [W:0.021 / U:61.848 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site