aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/btrfs/Makefile6
-rw-r--r--fs/btrfs/super.c3
-rw-r--r--fs/btrfs/version.sh43
3 files changed, 51 insertions, 1 deletions
diff --git a/fs/btrfs/Makefile b/fs/btrfs/Makefile
index 0e2dcc718de2..f8a38b0da7fb 100644
--- a/fs/btrfs/Makefile
+++ b/fs/btrfs/Makefile
@@ -14,8 +14,12 @@ else
14# Normal Makefile 14# Normal Makefile
15 15
16KERNELDIR := /lib/modules/`uname -r`/build 16KERNELDIR := /lib/modules/`uname -r`/build
17all: 17all: version
18 $(MAKE) -C $(KERNELDIR) M=`pwd` modules 18 $(MAKE) -C $(KERNELDIR) M=`pwd` modules
19
20version:
21 bash version.sh
22
19modules_install: 23modules_install:
20 $(MAKE) -C $(KERNELDIR) M=`pwd` modules_install 24 $(MAKE) -C $(KERNELDIR) M=`pwd` modules_install
21clean: 25clean:
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 5e28cf5c2e85..4cb6aac5122e 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -45,6 +45,7 @@
45#include "print-tree.h" 45#include "print-tree.h"
46#include "xattr.h" 46#include "xattr.h"
47#include "volumes.h" 47#include "volumes.h"
48#include "version.h"
48 49
49#define BTRFS_SUPER_MAGIC 0x9123683E 50#define BTRFS_SUPER_MAGIC 0x9123683E
50 51
@@ -605,6 +606,8 @@ static int __init init_btrfs_fs(void)
605 err = register_filesystem(&btrfs_fs_type); 606 err = register_filesystem(&btrfs_fs_type);
606 if (err) 607 if (err)
607 goto unregister_ioctl; 608 goto unregister_ioctl;
609
610 printk(KERN_INFO "%s loaded\n", BTRFS_BUILD_VERSION);
608 return 0; 611 return 0;
609 612
610unregister_ioctl: 613unregister_ioctl:
diff --git a/fs/btrfs/version.sh b/fs/btrfs/version.sh
new file mode 100644
index 000000000000..fd9b53d39860
--- /dev/null
+++ b/fs/btrfs/version.sh
@@ -0,0 +1,43 @@
1#!/bin/bash
2#
3# determine-version -- report a useful version for releases
4#
5# Copyright 2008, Aron Griffis <agriffis@n01se.net>
6# Copyright 2008, Oracle
7# Released under the GNU GPLv2
8
9v="Btrfs v0.15"
10
11which hg > /dev/null
12if [ $? == 0 ]; then
13 last=$(hg tags | grep -m1 -o '^v[0-9.]\+')
14
15 # now check if the repo has commits since then...
16 if [[ $(hg id -t) == $last || \
17 $(hg di -r "$last:." | awk '/^diff/{print $NF}' | sort -u) == .hgtags ]]
18 then
19 # check if it's dirty
20 if [[ $(hg id | cut -d' ' -f1) == *+ ]]; then
21 v=$last+
22 else
23 v=$last
24 fi
25 else
26 # includes dirty flag
27 v=$last+$(hg id -i)
28 fi
29fi
30
31echo "#ifndef __BUILD_VERSION" > .build-version.h
32echo "#define __BUILD_VERSION" >> .build-version.h
33echo "#define BTRFS_BUILD_VERSION \"Btrfs $v\"" >> .build-version.h
34echo "#endif" >> .build-version.h
35
36diff -q version.h .build-version.h >& /dev/null
37
38if [ $? == 0 ]; then
39 rm .build-version.h
40 exit 0
41fi
42
43mv .build-version.h version.h