All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Américo Wang" <xiyou.wangcong@gmail.com>
To: linux-btrfs@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>
Cc: Chris Mason <chris.mason@oracle.com>, Andrew Morton <akpm@osdl.org>
Subject: [Patch] Btrfs: use BTRFS_VOL_NAME_MAX for struct btrfs_ioctl_vol_args
Date: Mon, 19 Jan 2009 20:57:32 +0800	[thread overview]
Message-ID: <20090119125732.GA7424@hack.private> (raw)


I found userspace tool, btrfsctl, uses BTRFS_VOL_NAME_MAX, and
it also looks that this one is more proper.

Kill BTRFS_PATH_NAME_MAX since no one will use it.

Signed-off-by: WANG Cong <wangcong@zeuux.org>
Cc: Chris Mason <chris.mason@oracle.com>

---
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index c2aa33e..f229950 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -472,7 +472,7 @@ static int btrfs_ioctl_resize(struct btrfs_root *root, void __user *arg)
 		goto out;
 	}
 
-	vol_args->name[BTRFS_PATH_NAME_MAX] = '\0';
+	vol_args->name[BTRFS_VOL_NAME_MAX] = '\0';
 	namelen = strlen(vol_args->name);
 
 	mutex_lock(&root->fs_info->volume_mutex);
@@ -576,7 +576,7 @@ static noinline int btrfs_ioctl_snap_create(struct file *file,
 		goto out;
 	}
 
-	vol_args->name[BTRFS_PATH_NAME_MAX] = '\0';
+	vol_args->name[BTRFS_VOL_NAME_MAX] = '\0';
 	namelen = strlen(vol_args->name);
 	if (strchr(vol_args->name, '/')) {
 		ret = -EINVAL;
@@ -685,7 +685,7 @@ static long btrfs_ioctl_add_dev(struct btrfs_root *root, void __user *arg)
 		ret = -EFAULT;
 		goto out;
 	}
-	vol_args->name[BTRFS_PATH_NAME_MAX] = '\0';
+	vol_args->name[BTRFS_VOL_NAME_MAX] = '\0';
 	ret = btrfs_init_new_device(root, vol_args->name);
 
 out:
@@ -713,7 +713,7 @@ static long btrfs_ioctl_rm_dev(struct btrfs_root *root, void __user *arg)
 		ret = -EFAULT;
 		goto out;
 	}
-	vol_args->name[BTRFS_PATH_NAME_MAX] = '\0';
+	vol_args->name[BTRFS_VOL_NAME_MAX] = '\0';
 	ret = btrfs_rm_device(root, vol_args->name);
 
 out:
diff --git a/fs/btrfs/ioctl.h b/fs/btrfs/ioctl.h
index b320b10..f5d182a 100644
--- a/fs/btrfs/ioctl.h
+++ b/fs/btrfs/ioctl.h
@@ -22,12 +22,10 @@
 
 #define BTRFS_IOCTL_MAGIC 0x94
 #define BTRFS_VOL_NAME_MAX 255
-#define BTRFS_PATH_NAME_MAX 4087
 
-/* this should be 4k */
 struct btrfs_ioctl_vol_args {
 	__s64 fd;
-	char name[BTRFS_PATH_NAME_MAX + 1];
+	char name[BTRFS_VOL_NAME_MAX + 1];
 };
 
 struct btrfs_ioctl_clone_range_args {
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index db9fb3b..5facdbf 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -593,7 +593,7 @@ static long btrfs_control_ioctl(struct file *file, unsigned int cmd,
 		ret = -EFAULT;
 		goto out;
 	}
-	len = strnlen(vol->name, BTRFS_PATH_NAME_MAX);
+	len = strnlen(vol->name, BTRFS_VOL_NAME_MAX);
 
 	switch (cmd) {
 	case BTRFS_IOC_SCAN_DEV:


             reply	other threads:[~2009-01-19 12:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-19 12:57 Américo Wang [this message]
2009-01-19 13:03 ` [Patch] Btrfs: use BTRFS_VOL_NAME_MAX for struct btrfs_ioctl_vol_args Josef Bacik
2009-01-19 13:03   ` Josef Bacik
2009-01-19 13:12   ` Américo Wang
2009-01-19 13:12     ` Américo Wang
2009-01-21 15:04     ` Chris Mason
2009-01-21 15:04       ` Chris Mason
2009-01-22 16:11       ` Américo Wang
2009-01-22 16:11         ` Américo Wang

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=20090119125732.GA7424@hack.private \
    --to=xiyou.wangcong@gmail.com \
    --cc=akpm@osdl.org \
    --cc=chris.mason@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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 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.