diff options
-rw-r--r-- | .gitignore | 15 | ||||
-rw-r--r-- | Makefile.am | 37 | ||||
-rwxr-xr-x | autogen.sh | 18 | ||||
-rw-r--r--[-rwxr-xr-x] | bcache-register | 0 | ||||
-rw-r--r-- | configure.ac | 24 | ||||
-rwxr-xr-x | initramfs/bcache (renamed from initramfs/hook) | 0 | ||||
-rw-r--r-- | make-bcache.c | 14 |
7 files changed, 102 insertions, 6 deletions
@@ -3,3 +3,18 @@ make-bcache probe-bcache .* *.o +tags +cscope* +Makefile.in +aclocal.m4 +autom4te.cache +compile +config.guess +config.h.in +config.sub +configure +depcomp +install-sh +ltmain.sh +m4 +missing diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 00000000..1f01b2ec --- /dev/null +++ b/Makefile.am @@ -0,0 +1,37 @@ + +AUTOMAKE_OPTIONS=subdir-objects + +PREFIX=/usr +AM_CFLAGS=-O2 -Wall -g + + +bin_PROGRAMS=make-bcache \ + probe-bcache \ + bcache-super-show + +noinst_PROGRAMS=bcache-test + +make_bcache_SOURCES=make-bcache.c bcache.c +make_bcache_LDADD= -lm -lssl -lcrypto -luuid + +probe_bcache_SOURCES=probe-bcache.c bcache.c +probe_bcache_LDADD=-luuid + +bcache_super_show_SOURCES=bcache-super-show.c bcache.c +bcache_super_show_LDADD=-luuid + +bcache_test_SOURCE=bcache-test.c +bcache_test_LDADD= -lm -lssl -lcrypto + +udevrule_DATA=61-bcache.rules +udevruledir=$(prefix)/lib/udev/rules.d + +udevr_DATA=bcache-register +udevrdir=$(prefix)/lib/udev/ + +initramfs_SCRIPTS=initramfs/bcache +initramfsdir=$(prefix)/etc/initramfs-tools/hooks/ + +man8_MANS= bcache-super-show.8 \ + make-bcache.8 \ + probe-bcache.8 diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 00000000..8a566d46 --- /dev/null +++ b/autogen.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +set -e + +export ACLOCAL_FLAGS="" +export ACLOCAL_AMFLAGS="-I m4" + +aclocal $ACLOCAL_FLAGS + +if glibtoolize -h > /dev/null 2>&1 ; then + glibtoolize --copy --force +else + libtoolize --copy --force +fi + +autoheader +automake --copy --add-missing --foreign -Wall -Wno-portability +autoconf diff --git a/bcache-register b/bcache-register index 9b592bcd..9b592bcd 100755..100644 --- a/bcache-register +++ b/bcache-register diff --git a/configure.ac b/configure.ac new file mode 100644 index 00000000..a8039c00 --- /dev/null +++ b/configure.ac @@ -0,0 +1,24 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +AC_PREREQ(2.61) +AC_INIT(bcache-tools, VERSION, BUG-REPORT-ADDRESS) +AM_INIT_AUTOMAKE +LT_INIT +AC_CONFIG_HEADER([config.h]) +AC_CONFIG_MACRO_DIR([m4]) + +# Checks for programs. +AC_PROG_CC + + +# Checks for libraries. + +# Checks for header files. + +# Checks for typedefs, structures, and compiler characteristics. + +# Checks for library functions. + +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT diff --git a/initramfs/hook b/initramfs/bcache index e618e1a5..e618e1a5 100755 --- a/initramfs/hook +++ b/initramfs/bcache diff --git a/make-bcache.c b/make-bcache.c index 27d49eb9..9e55fac1 100644 --- a/make-bcache.c +++ b/make-bcache.c @@ -171,7 +171,8 @@ static void write_sb(char *dev, unsigned block_size, unsigned bucket_size, bool writeback, bool discard, bool wipe_bcache, unsigned cache_replacement_policy, uint64_t data_offset, - uuid_t set_uuid, bool bdev) + uuid_t set_uuid, bool bdev, + uint16_t nr_in_set, uint16_t nr_this_dev) { int fd; char uuid_str[40], set_uuid_str[40], zeroes[SB_START] = {0}; @@ -243,7 +244,8 @@ static void write_sb(char *dev, unsigned block_size, unsigned bucket_size, data_offset); } else { sb.nbuckets = getblocks(fd) / sb.bucket_size; - sb.nr_in_set = 1; + sb.nr_in_set = nr_in_set; + sb.nr_this_dev = nr_this_dev; sb.first_bucket = (23 / sb.bucket_size) + 1; if (sb.nbuckets < 1 << 7) { @@ -446,14 +448,14 @@ int main(int argc, char **argv) for (i = 0; i < ncache_devices; i++) write_sb(cache_devices[i], block_size, bucket_size, writeback, discard, wipe_bcache, - cache_replacement_policy, - data_offset, set_uuid, false); + cache_replacement_policy, data_offset, + set_uuid, false, ncache_devices, i); for (i = 0; i < nbacking_devices; i++) write_sb(backing_devices[i], block_size, bucket_size, writeback, discard, wipe_bcache, - cache_replacement_policy, - data_offset, set_uuid, true); + cache_replacement_policy, data_offset, + set_uuid, true, nbacking_devices, i); return 0; } |