From e8f47cf068c3a4b5de7770ebb9eef37e28e09ef7 Mon Sep 17 00:00:00 2001 From: Goffredo Baroncelli Date: Sun, 5 Dec 2010 17:46:44 +0000 Subject: Add the "btrfs filesystem label" command Hi all, this patch adds the command "btrfs filesystem label" to change (or show) the label of a filesystem. This patch is a subset of the one written previously by Morey Roof. I included the user space part only. So it is possible only to change/show a label of a *single device* and *unounted* filesystem. The reason of excluding the kernel space part, is to simplify the patch in order to speed the check and then the merging of the patch itself. In fact I have to point out that in the past there was almost three attempts to propose this patch, without success neither complaints. Chris, let me know how you want to proceed. I know that you are very busy, and you prefer to work to stabilize btrfs instead adding new feature. But I think that changing a label is a *essential* feature for a filesystem managing tool. Think about a mount by LABEL. To show a label $ btrfs filesystem label To set a label $ btrfs filesystem label Please guys, give a look to the source. Comments are welcome. You can pull the source from the branch "label" of the repository http://cassiopea.homelinux.net/git/btrfs-progs-unstable.git Regards G.Baroncelli Signed-off-by: Chris Mason --- Makefile | 2 +- btrfs.c | 5 --- btrfs_cmds.c | 16 ++++++++ btrfs_cmds.h | 1 + btrfslabel.c | 121 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ btrfslabel.h | 5 +++ man/btrfs.8.in | 19 +++++++++ utils.c | 57 +++++++++++++++++++++++++++ utils.h | 2 + 9 files changed, 222 insertions(+), 6 deletions(-) create mode 100644 btrfslabel.c create mode 100644 btrfslabel.h diff --git a/Makefile b/Makefile index d65f6a22..4b95d2f0 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ CFLAGS = -g -Werror -Os objects = ctree.o disk-io.o radix-tree.o extent-tree.o print-tree.o \ root-tree.o dir-item.o file-item.o inode-item.o \ inode-map.o crc32c.o rbtree.o extent-cache.o extent_io.o \ - volumes.o utils.o btrfs-list.o + volumes.o utils.o btrfs-list.o btrfslabel.o # CHECKFLAGS=-D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ -Wbitwise \ diff --git a/btrfs.c b/btrfs.c index 62140efb..4cd42102 100644 --- a/btrfs.c +++ b/btrfs.c @@ -108,11 +108,6 @@ static struct Command commands[] = { "device delete", " [...] \n" "Remove a device from a filesystem." }, - /* coming soon - { 2, "filesystem label", "