All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Jeff Liu <jeff.liu@oracle.com>
Cc: linux-btrfs@vger.kernel.org, anand.jain@oracle.com,
	miaox@cn.fujitsu.com, Goffredo Baroncelli <kreijack@gmail.com>,
	dsterba@suse.cz
Subject: Re: [RFC PATCH v8 1/2] Btrfs: Add a new ioctl to get the label of a mounted file system
Date: Fri, 28 Dec 2012 12:51:32 +0100	[thread overview]
Message-ID: <20121228115132.GU14116@twin.jikos.cz> (raw)
In-Reply-To: <50DD152C.4050701@oracle.com>

On Fri, Dec 28, 2012 at 11:42:36AM +0800, Jeff Liu wrote:
> +static int btrfs_ioctl_get_fslabel(struct file *file, void __user *arg)
> +{
> +	struct btrfs_root *root = BTRFS_I(fdentry(file)->d_inode)->root;
> +	const char *label = root->fs_info->super_copy->label;
> +	size_t len = strnlen(label, BTRFS_LABEL_SIZE);
> +	int ret;
> +
> +	if (len == BTRFS_LABEL_SIZE) {
> +		len--;
> +		WARN(1, "btrfs: device label is not zero terminated, "
> +			"it will be truncated to %zu bytes.\n", len);

This will print a stacktrace, it's not needed in this context, the
warning is enough.

		printk(KERN_WARNING "...");

> +	}
> +
> +	mutex_lock(&root->fs_info->volume_mutex);
> +	ret = copy_to_user(arg, label, len);
> +	mutex_unlock(&root->fs_info->volume_mutex);
> +
> +	return ret ? -EFAULT : 0;
> +}

  reply	other threads:[~2012-12-28 11:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-28  3:42 [RFC PATCH v8 0/2] Btrfs: get/set label of a mounted file system Jeff Liu
2012-12-28  3:42 ` [RFC PATCH v8 1/2] Btrfs: Add a new ioctl to get the " Jeff Liu
2012-12-28 11:51   ` David Sterba [this message]
2012-12-28  3:42 ` [RFC PATCH v8 2/2] Btrfs: Add a new ioctl to set/change " Jeff Liu
2012-12-28 12:03   ` David Sterba
2012-12-31 10:23     ` Jeff Liu

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=20121228115132.GU14116@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=anand.jain@oracle.com \
    --cc=jeff.liu@oracle.com \
    --cc=kreijack@gmail.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=miaox@cn.fujitsu.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.