Print the version string in a few programs

This commit is contained in:
Chris Mason 2008-07-24 12:13:30 -04:00 committed by David Woodhouse
parent cbfe93f68f
commit 9864c90760
6 changed files with 28 additions and 3 deletions

View File

@ -29,7 +29,10 @@ endif
$(CC) $(DEPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c $< $(CC) $(DEPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c $<
all: $(progs) all: version $(progs)
version:
bash version.sh
btrfsctl: $(objects) btrfsctl.o btrfsctl: $(objects) btrfsctl.o
gcc $(CFLAGS) -o btrfsctl btrfsctl.o $(objects) $(LDFLAGS) $(LIBS) gcc $(CFLAGS) -o btrfsctl btrfsctl.o $(objects) $(LDFLAGS) $(LIBS)

View File

@ -36,6 +36,7 @@
#include "transaction.h" #include "transaction.h"
#include "utils.h" #include "utils.h"
#include "volumes.h" #include "volumes.h"
#include "version.h"
static int uuid_search(struct btrfs_fs_devices *fs_devices, char *search) 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) static void print_usage(void)
{ {
fprintf(stderr, "usage: btrfs-show [search label or device]\n"); fprintf(stderr, "usage: btrfs-show [search label or device]\n");
fprintf(stderr, "%s\n", BTRFS_BUILD_VERSION);
exit(1); exit(1);
} }
@ -143,6 +145,7 @@ int main(int ac, char **av)
continue; continue;
print_one_uuid(fs_devices); print_one_uuid(fs_devices);
} }
printf("%s\n", BTRFS_BUILD_VERSION);
return 0; return 0;
} }

View File

@ -27,6 +27,7 @@
#include "print-tree.h" #include "print-tree.h"
#include "transaction.h" #include "transaction.h"
#include "list.h" #include "list.h"
#include "version.h"
static u64 bytes_used = 0; static u64 bytes_used = 0;
static u64 total_csum_bytes = 0; static u64 total_csum_bytes = 0;
@ -719,6 +720,7 @@ int check_extent_refs(struct btrfs_root *root,
void print_usage(void) { void print_usage(void) {
fprintf(stderr, "usage: btrfsck dev\n"); fprintf(stderr, "usage: btrfsck dev\n");
fprintf(stderr, "%s\n", BTRFS_BUILD_VERSION);
exit(1); exit(1);
} }
@ -821,5 +823,6 @@ int main(int ac, char **av) {
printf("file data blocks allocated: %llu\n referenced %llu\n", printf("file data blocks allocated: %llu\n referenced %llu\n",
(unsigned long long)data_bytes_allocated, (unsigned long long)data_bytes_allocated,
(unsigned long long)data_bytes_referenced); (unsigned long long)data_bytes_referenced);
printf("%s\n", BTRFS_BUILD_VERSION);
return ret; return ret;
} }

View File

@ -32,6 +32,7 @@
#include "ctree.h" #include "ctree.h"
#include "transaction.h" #include "transaction.h"
#include "utils.h" #include "utils.h"
#include "version.h"
#ifdef __CHECKER__ #ifdef __CHECKER__
#define BLKGETSIZE64 0 #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 device scans the device for a Btrfs filesystem\n");
printf("\t-a scans all devices for Btrfs filesystems\n"); printf("\t-a scans all devices for Btrfs filesystems\n");
printf("\t-c forces a single FS sync\n"); printf("\t-c forces a single FS sync\n");
printf("%s\n", BTRFS_BUILD_VERSION);
exit(1); exit(1);
} }
@ -157,7 +159,15 @@ int main(int ac, char **av)
perror("ioctl:"); perror("ioctl:");
exit(1); exit(1);
} }
printf("ioctl returns %d\n", ret); if (ret == 0) {
return 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);
} }

View File

@ -26,10 +26,12 @@
#include "disk-io.h" #include "disk-io.h"
#include "print-tree.h" #include "print-tree.h"
#include "transaction.h" #include "transaction.h"
#include "version.h"
static int print_usage(void) static int print_usage(void)
{ {
fprintf(stderr, "usage: debug-tree [ -e ] device\n"); fprintf(stderr, "usage: debug-tree [ -e ] device\n");
fprintf(stderr, "%s\n", BTRFS_BUILD_VERSION);
exit(1); exit(1);
} }
@ -212,5 +214,6 @@ int main(int ac, char **av)
uuidbuf[36] = '\0'; uuidbuf[36] = '\0';
uuid_unparse(root->fs_info->super_copy.fsid, uuidbuf); uuid_unparse(root->fs_info->super_copy.fsid, uuidbuf);
printf("uuid %s\n", uuidbuf); printf("uuid %s\n", uuidbuf);
printf("%s\n", BTRFS_BUILD_VERSION);
return 0; return 0;
} }

3
mkfs.c
View File

@ -41,6 +41,7 @@
#include "volumes.h" #include "volumes.h"
#include "transaction.h" #include "transaction.h"
#include "utils.h" #include "utils.h"
#include "version.h"
static u64 parse_size(char *s) 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 -l --leafsize size of btree leaves\n");
fprintf(stderr, "\t -n --nodesize 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, "\t -s --sectorsize min block allocation\n");
fprintf(stderr, "%s\n", BTRFS_BUILD_VERSION);
exit(1); exit(1);
} }
@ -467,6 +469,7 @@ raid_groups:
label, first_file, nodesize, leafsize, sectorsize, label, first_file, nodesize, leafsize, sectorsize,
pretty_sizes(btrfs_super_total_bytes(&root->fs_info->super_copy))); pretty_sizes(btrfs_super_total_bytes(&root->fs_info->super_copy)));
printf("%s\n", BTRFS_BUILD_VERSION);
btrfs_commit_transaction(trans, root); btrfs_commit_transaction(trans, root);
ret = close_ctree(root); ret = close_ctree(root);
BUG_ON(ret); BUG_ON(ret);