xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: David Vrabel <david.vrabel@citrix.com>
To: David Vrabel <david.vrabel@citrix.com>,
	Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Juergen Gross <jgross@suse.com>,
	linux-fsdevel@vger.kernel.org,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org
Subject: Re: [PATCHv1 1/2] libfs: allow simple_fill_super() to add symlinks
Date: Fri, 10 Jun 2016 14:13:39 +0100	[thread overview]
Message-ID: <575ABD03.7010802__49613.0976280712$1465564492$gmane$org@citrix.com> (raw)
In-Reply-To: <1463480843-3860-2-git-send-email-david.vrabel@citrix.com>

On 17/05/16 11:27, David Vrabel wrote:
> simple_fill_super() will add symlinks if an entry has mode & S_IFLNK.
> The target is provided in the new "link" field.

Ping?

> Signed-off-by: David Vrabel <david.vrabel@citrix.com>
> ---
> v2:
> - simplified.
> ---
>  fs/libfs.c         | 15 +++++++++++++--
>  include/linux/fs.h |  2 +-
>  2 files changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/libfs.c b/fs/libfs.c
> index f3fa82c..5b3a391 100644
> --- a/fs/libfs.c
> +++ b/fs/libfs.c
> @@ -517,9 +517,20 @@ int simple_fill_super(struct super_block *s, unsigned long magic,
>  			dput(dentry);
>  			goto out;
>  		}
> -		inode->i_mode = S_IFREG | files->mode;
> +		if (files->mode & S_IFLNK) {
> +			inode->i_mode = files->mode;
> +			inode->i_op = &simple_symlink_inode_operations;
> +			inode->i_link = kstrdup(files->link, GFP_KERNEL);
> +			if (!inode->i_link) {
> +				iput(inode);
> +				dput(dentry);
> +				goto out;
> +			}
> +		} else {
> +			inode->i_mode = S_IFREG | files->mode;
> +			inode->i_fop = files->ops;
> +		}
>  		inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
> -		inode->i_fop = files->ops;
>  		inode->i_ino = i;
>  		d_add(dentry, inode);
>  	}
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 70e61b5..8a09998 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -2897,7 +2897,7 @@ extern const struct file_operations simple_dir_operations;
>  extern const struct inode_operations simple_dir_inode_operations;
>  extern void make_empty_dir_inode(struct inode *inode);
>  extern bool is_empty_dir_inode(struct inode *inode);
> -struct tree_descr { char *name; const struct file_operations *ops; int mode; };
> +struct tree_descr { char *name; const struct file_operations *ops; int mode; char *link; };
>  struct dentry *d_alloc_name(struct dentry *, const char *);
>  extern int simple_fill_super(struct super_block *, unsigned long, struct tree_descr *);
>  extern int simple_pin_fs(struct file_system_type *, struct vfsmount **mount, int *count);
> 


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  parent reply	other threads:[~2016-06-10 13:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1463480843-3860-1-git-send-email-david.vrabel@citrix.com>
2016-05-17 10:27 ` [PATCHv1 1/2] libfs: allow simple_fill_super() to add symlinks David Vrabel
2016-05-17 10:27 ` [PATCHv1 2/2] xenfs: replace xenbus and privcmd with symlinks David Vrabel
     [not found] ` <1463480843-3860-2-git-send-email-david.vrabel@citrix.com>
2016-06-10 13:13   ` David Vrabel [this message]
2016-05-16 17:44 [PATCHv1 0/2] xen/xenfs: fix /proc/xen/xenbus David Vrabel
2016-05-16 17:44 ` [PATCHv1 1/2] libfs: allow simple_fill_super() to add symlinks David Vrabel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='575ABD03.7010802__49613.0976280712$1465564492$gmane$org@citrix.com' \
    --to=david.vrabel@citrix.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=jgross@suse.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).