From: "Morey Roof" <moreyroof@gmail.com>
To: linux-btrfs@vger.kernel.org
Subject: Second Try
Date: Thu, 7 Aug 2008 09:59:20 -0600 [thread overview]
Message-ID: <91a37e890808070859r68a059f2pfc236ee3385ee6d4@mail.gmail.com> (raw)
Chris,
Here is the patch again but without the whitespace problem.
Thanks,
Morey
diff -r b68faa369602 ioctl.c
--- a/ioctl.c Wed Aug 06 14:41:23 2008 -0600
+++ b/ioctl.c Thu Aug 07 09:57:27 2008 -0600
@@ -749,6 +749,53 @@
return ret;
}
+long btrfs_ioctl_set_label(struct btrfs_root *root, void __user *arg)
+{
+ struct btrfs_trans_handle *trans;
+ struct btrfs_ioctl_label_args *label_args;
+ int ret = 0;
+
+ label_args = kmalloc(sizeof(*label_args), GFP_NOFS);
+
+ if (!label_args)
+ return -ENOMEM;
+
+ if (copy_from_user(label_args, arg, sizeof(*label_args)))
+ {
+ ret = -EFAULT;
+ } else
+ {
+ /* Everything looks good, so lets do a label change */
+ label_args->name[BTRFS_LABEL_SIZE] = 0x00;
+ trans = btrfs_start_transaction(root, 1);
+ strncpy(root->fs_info->super_copy.label, label_args->name, BTRFS_LABEL_SIZE);
+ btrfs_commit_transaction(trans, root);
+ }
+
+ kfree(label_args);
+ return ret;
+}
+
+long btrfs_ioctl_get_label(struct btrfs_root *root, void __user *arg)
+{
+ struct btrfs_ioctl_label_args *label_args;
+ int ret = 0;
+
+ label_args = kmalloc(sizeof(*label_args), GFP_NOFS);
+
+ if (!label_args)
+ return -ENOMEM;
+
+ strncpy(label_args->name, root->fs_info->super_copy.label, BTRFS_LABEL_SIZE);
+ if (copy_to_user(arg, label_args, sizeof(*label_args)))
+ {
+ ret = -EFAULT;
+ }
+
+ kfree(label_args);
+ return ret;
+}
+
long btrfs_ioctl(struct file *file, unsigned int
cmd, unsigned long arg)
{
@@ -773,6 +820,10 @@
return btrfs_ioctl_trans_start(file);
case BTRFS_IOC_TRANS_END:
return btrfs_ioctl_trans_end(file);
+ case BTRFS_IOC_SET_LABEL:
+ return btrfs_ioctl_set_label(root, (void __user *)arg);
+ case BTRFS_IOC_GET_LABEL:
+ return btrfs_ioctl_get_label(root, (void __user *)arg);
case BTRFS_IOC_SYNC:
btrfs_start_delalloc_inodes(root);
btrfs_sync_fs(file->f_dentry->d_sb, 1);
diff -r b68faa369602 ioctl.h
--- a/ioctl.h Wed Aug 06 14:41:23 2008 -0600
+++ b/ioctl.h Thu Aug 07 09:57:27 2008 -0600
@@ -28,6 +28,10 @@
char name[BTRFS_PATH_NAME_MAX + 1];
};
+struct btrfs_ioctl_label_args {
+ char name[BTRFS_LABEL_SIZE + 1];
+};
+
#define BTRFS_IOC_SNAP_CREATE _IOW(BTRFS_IOCTL_MAGIC, 1, \
struct btrfs_ioctl_vol_args)
#define BTRFS_IOC_DEFRAG _IOW(BTRFS_IOCTL_MAGIC, 2, \
@@ -52,4 +56,10 @@
#define BTRFS_IOC_BALANCE _IOW(BTRFS_IOCTL_MAGIC, 12, \
struct btrfs_ioctl_vol_args)
+/* Used to set and get the current volume label */
+#define BTRFS_IOC_SET_LABEL _IOW(BTRFS_IOCTL_MAGIC, 13, \
+ struct btrfs_ioctl_label_args)
+#define BTRFS_IOC_GET_LABEL _IOW(BTRFS_IOCTL_MAGIC, 14, \
+ struct btrfs_ioctl_label_args)
+
#endif
reply other threads:[~2008-08-07 15:59 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=91a37e890808070859r68a059f2pfc236ee3385ee6d4@mail.gmail.com \
--to=moreyroof@gmail.com \
--cc=linux-btrfs@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox