summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile5
-rw-r--r--btrfs-show.c3
-rw-r--r--btrfsck.c3
-rw-r--r--btrfsctl.c14
-rw-r--r--debug-tree.c3
-rw-r--r--mkfs.c3
6 files changed, 28 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 287ce5ab..e50d7b7c 100644
--- a/Makefile
+++ b/Makefile
@@ -29,7 +29,10 @@ endif
$(CC) $(DEPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c $<
-all: $(progs)
+all: version $(progs)
+
+version:
+ bash version.sh
btrfsctl: $(objects) btrfsctl.o
gcc $(CFLAGS) -o btrfsctl btrfsctl.o $(objects) $(LDFLAGS) $(LIBS)
diff --git a/btrfs-show.c b/btrfs-show.c
index 5c370f1e..c49626ce 100644
--- a/btrfs-show.c
+++ b/btrfs-show.c
@@ -36,6 +36,7 @@
#include "transaction.h"
#include "utils.h"
#include "volumes.h"
+#include "version.h"
static int uuid_search(struct btrfs_fs_devices *fs_devices, char *search)
{
@@ -98,6 +99,7 @@ static void print_one_uuid(struct btrfs_fs_devices *fs_devices)
static void print_usage(void)
{
fprintf(stderr, "usage: btrfs-show [search label or device]\n");
+ fprintf(stderr, "%s\n", BTRFS_BUILD_VERSION);
exit(1);
}
@@ -143,6 +145,7 @@ int main(int ac, char **av)
continue;
print_one_uuid(fs_devices);
}
+ printf("%s\n", BTRFS_BUILD_VERSION);
return 0;
}
diff --git a/btrfsck.c b/btrfsck.c
index e367840b..ee7c7f73 100644
--- a/btrfsck.c
+++ b/btrfsck.c
@@ -27,6 +27,7 @@
#include "print-tree.h"
#include "transaction.h"
#include "list.h"
+#include "version.h"
static u64 bytes_used = 0;
static u64 total_csum_bytes = 0;
@@ -719,6 +720,7 @@ int check_extent_refs(struct btrfs_root *root,
void print_usage(void) {
fprintf(stderr, "usage: btrfsck dev\n");
+ fprintf(stderr, "%s\n", BTRFS_BUILD_VERSION);
exit(1);
}
@@ -821,5 +823,6 @@ int main(int ac, char **av) {
printf("file data blocks allocated: %llu\n referenced %llu\n",
(unsigned long long)data_bytes_allocated,
(unsigned long long)data_bytes_referenced);
+ printf("%s\n", BTRFS_BUILD_VERSION);
return ret;
}
diff --git a/btrfsctl.c b/btrfsctl.c
index 7e7e79b5..0cdf2726 100644
--- a/btrfsctl.c
+++ b/btrfsctl.c
@@ -32,6 +32,7 @@
#include "ctree.h"
#include "transaction.h"
#include "utils.h"
+#include "version.h"
#ifdef __CHECKER__
#define BLKGETSIZE64 0
@@ -52,6 +53,7 @@ void print_usage(void)
printf("\t-A device scans the device for a Btrfs filesystem\n");
printf("\t-a scans all devices for Btrfs filesystems\n");
printf("\t-c forces a single FS sync\n");
+ printf("%s\n", BTRFS_BUILD_VERSION);
exit(1);
}
@@ -157,7 +159,15 @@ int main(int ac, char **av)
perror("ioctl:");
exit(1);
}
- printf("ioctl returns %d\n", ret);
- return 0;
+ if (ret == 0) {
+ printf("operation complete\n");
+ } else {
+ printf("ioctl failed with error %d\n", ret);
+ }
+ printf("%s\n", BTRFS_BUILD_VERSION);
+ if (ret)
+ exit(0);
+ else
+ exit(1);
}
diff --git a/debug-tree.c b/debug-tree.c
index fa5c90c3..e5de3032 100644
--- a/debug-tree.c
+++ b/debug-tree.c
@@ -26,10 +26,12 @@
#include "disk-io.h"
#include "print-tree.h"
#include "transaction.h"
+#include "version.h"
static int print_usage(void)
{
fprintf(stderr, "usage: debug-tree [ -e ] device\n");
+ fprintf(stderr, "%s\n", BTRFS_BUILD_VERSION);
exit(1);
}
@@ -212,5 +214,6 @@ int main(int ac, char **av)
uuidbuf[36] = '\0';
uuid_unparse(root->fs_info->super_copy.fsid, uuidbuf);
printf("uuid %s\n", uuidbuf);
+ printf("%s\n", BTRFS_BUILD_VERSION);
return 0;
}
diff --git a/mkfs.c b/mkfs.c
index e1b42971..6edc4c66 100644
--- a/mkfs.c
+++ b/mkfs.c
@@ -41,6 +41,7 @@
#include "volumes.h"
#include "transaction.h"
#include "utils.h"
+#include "version.h"
static u64 parse_size(char *s)
{
@@ -247,6 +248,7 @@ static void print_usage(void)
fprintf(stderr, "\t -l --leafsize size of btree leaves\n");
fprintf(stderr, "\t -n --nodesize size of btree leaves\n");
fprintf(stderr, "\t -s --sectorsize min block allocation\n");
+ fprintf(stderr, "%s\n", BTRFS_BUILD_VERSION);
exit(1);
}
@@ -467,6 +469,7 @@ raid_groups:
label, first_file, nodesize, leafsize, sectorsize,
pretty_sizes(btrfs_super_total_bytes(&root->fs_info->super_copy)));
+ printf("%s\n", BTRFS_BUILD_VERSION);
btrfs_commit_transaction(trans, root);
ret = close_ctree(root);
BUG_ON(ret);