mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-02-22 00:00:03 +03:00
debify
This commit is contained in:
parent
f2e0c20309
commit
dda0923eeb
@ -1,29 +0,0 @@
|
||||
# register bcache devices as they come up
|
||||
# man 7 udev for syntax
|
||||
|
||||
SUBSYSTEM!="block", GOTO="bcache_end"
|
||||
ACTION=="remove", GOTO="bcache_end"
|
||||
|
||||
# blkid was run by the standard udev rules
|
||||
# It recognised bcache (util-linux 2.24+)
|
||||
ENV{ID_FS_TYPE}=="bcache", GOTO="bcache_backing_found"
|
||||
# It recognised something else; bail
|
||||
ENV{ID_FS_TYPE}=="?*", GOTO="bcache_backing_end"
|
||||
|
||||
# Backing devices: scan, symlink, register
|
||||
IMPORT{program}="probe-bcache -o udev $tempnode"
|
||||
ENV{ID_FS_TYPE}!="bcache", GOTO="bcache_backing_end"
|
||||
ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
|
||||
|
||||
LABEL="bcache_backing_found"
|
||||
RUN+="bcache-register $tempnode"
|
||||
LABEL="bcache_backing_end"
|
||||
|
||||
# Cached devices: symlink
|
||||
DRIVER=="bcache", ENV{CACHED_UUID}=="?*", \
|
||||
SYMLINK+="bcache/by-uuid/$env{CACHED_UUID}"
|
||||
DRIVER=="bcache", ENV{CACHED_LABEL}=="?*", \
|
||||
SYMLINK+="bcache/by-label/$env{CACHED_LABEL}"
|
||||
|
||||
LABEL="bcache_end"
|
||||
|
33
Makefile
33
Makefile
@ -1,25 +1,23 @@
|
||||
|
||||
PREFIX=/usr
|
||||
UDEVLIBDIR=/lib/udev
|
||||
DRACUTLIBDIR=/lib/dracut
|
||||
INSTALL=install
|
||||
CFLAGS+=-std=gnu99 -O2 -Wall -g -D_FILE_OFFSET_BITS=64 -I.
|
||||
LDFLAGS+=-static
|
||||
|
||||
all: bcache probe-bcache
|
||||
ifeq ($(PREFIX), "/usr")
|
||||
ROOT_SBINDIR=/sbin
|
||||
else
|
||||
ROOT_SBINDIR=$(PREFIX)/sbin
|
||||
endif
|
||||
|
||||
install: bcache probe-bcache
|
||||
$(INSTALL) -m0755 bcache $(DESTDIR)${PREFIX}/bin/
|
||||
#$(INSTALL) -m0755 probe-bcache bcache-register $(DESTDIR)$(UDEVLIBDIR)/
|
||||
#$(INSTALL) -m0644 69-bcache.rules $(DESTDIR)$(UDEVLIBDIR)/rules.d/
|
||||
#-$(INSTALL) -T -m0755 initramfs/hook $(DESTDIR)/usr/share/initramfs-tools/hooks/bcache
|
||||
if [ -d $(DESTDIR)$(DRACUTLIBDIR)/modules.d ]; then\
|
||||
$(INSTALL) -D -m0755 dracut/module-setup.sh $(DESTDIR)$(DRACUTLIBDIR)/modules.d/90bcache/module-setup.sh; \
|
||||
fi
|
||||
$(INSTALL) -m0644 -- *.8 $(DESTDIR)${PREFIX}/share/man/man8/
|
||||
all: bcache
|
||||
|
||||
install: bcache
|
||||
$(INSTALL) -m0755 bcache $(DESTDIR)$(ROOT_SBINDIR)
|
||||
$(INSTALL) -m0644 -- bcache.8 $(DESTDIR)$(PREFIX)/share/man/man8/
|
||||
|
||||
clean:
|
||||
$(RM) -f probe-bcache bcache bcache-test *.o *.a
|
||||
$(RM) -f bcache *.o *.a
|
||||
|
||||
CCANSRCS=$(wildcard ccan/*/*.c)
|
||||
CCANOBJS=$(patsubst %.c,%.o,$(CCANSRCS))
|
||||
@ -33,13 +31,10 @@ bcache.o: CFLAGS += `pkg-config --cflags libnih`
|
||||
bcache-objs = bcache.o bcache-assemble.o bcache-device.o bcache-format.o\
|
||||
bcache-fs.o bcache-run.o
|
||||
|
||||
# have to build ccan first, as headers require config.h to be generated:
|
||||
#$(bcache-objs): ccan/libccan.a
|
||||
|
||||
bcache: LDLIBS += `pkg-config --libs uuid blkid libnih`
|
||||
bcache: $(bcache-objs) util.o libccan.a
|
||||
|
||||
probe-bcache.o: CFLAGS += `pkg-config --cflags uuid blkid`
|
||||
probe-bcache: LDLIBS += `pkg-config --libs uuid blkid`
|
||||
|
||||
bcache-test: LDLIBS += `pkg-config --libs openssl`
|
||||
|
||||
deb:
|
||||
debuild -nc -us -uc -i -I
|
||||
|
320
bcache-test.c
320
bcache-test.c
@ -1,320 +0,0 @@
|
||||
/*
|
||||
* Author: Kent Overstreet <kent.overstreet@gmail.com>
|
||||
*
|
||||
* GPLv2
|
||||
*/
|
||||
|
||||
#define _FILE_OFFSET_BITS 64
|
||||
#define _XOPEN_SOURCE 500
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#include <linux/fs.h>
|
||||
#include <math.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/klog.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <openssl/rc4.h>
|
||||
#include <openssl/md4.h>
|
||||
|
||||
static const unsigned char bcache_magic[] = {
|
||||
0xc6, 0x85, 0x73, 0xf6, 0x4e, 0x1a, 0x45, 0xca,
|
||||
0x82, 0x65, 0xf5, 0x7f, 0x48, 0xba, 0x6d, 0x81 };
|
||||
|
||||
unsigned char zero[4096];
|
||||
|
||||
bool klog = false;
|
||||
|
||||
#define Pread(fd, buf, size, offset) do { \
|
||||
int _read = 0, _r; \
|
||||
while (_read < size) { \
|
||||
_r = pread(fd, buf, (size) - _read, (offset) + _read); \
|
||||
if (_r <= 0) \
|
||||
goto err; \
|
||||
_read += _r; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define Pwrite(fd, buf, size, offset) do { \
|
||||
int _write = 0, _r; \
|
||||
while (_write < size) { \
|
||||
_r = pwrite(fd, buf, (size) - _write, offset + _write); \
|
||||
if (_r < 0) \
|
||||
goto err; \
|
||||
_write += _r; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/* Marsaglia polar method
|
||||
*/
|
||||
double normal()
|
||||
{
|
||||
double x, y, s;
|
||||
static double n = 0 / (double) 0;
|
||||
|
||||
if (n == n) {
|
||||
x = n;
|
||||
n = 0 / (double) 0;
|
||||
return x;
|
||||
}
|
||||
|
||||
do {
|
||||
x = random() / (double) (RAND_MAX / 2) - 1;
|
||||
y = random() / (double) (RAND_MAX / 2) - 1;
|
||||
|
||||
s = x * x + y * y;
|
||||
} while (s >= 1);
|
||||
|
||||
s = sqrt(-2 * log(s) / s);
|
||||
n = y * s;
|
||||
return x * s;
|
||||
}
|
||||
|
||||
long getblocks(int fd)
|
||||
{
|
||||
long ret;
|
||||
struct stat statbuf;
|
||||
if (fstat(fd, &statbuf)) {
|
||||
perror("stat error");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
ret = statbuf.st_size / 512;
|
||||
if (S_ISBLK(statbuf.st_mode))
|
||||
if (ioctl(fd, BLKGETSIZE, &ret)) {
|
||||
perror("ioctl error");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct pagestuff {
|
||||
unsigned char csum[16];
|
||||
unsigned char oldcsum[16];
|
||||
int readcount;
|
||||
int writecount;
|
||||
};
|
||||
|
||||
void flushlog(void)
|
||||
{
|
||||
char logbuf[1 << 21];
|
||||
int w = 0, len;
|
||||
static int fd;
|
||||
|
||||
if (!klog)
|
||||
return;
|
||||
|
||||
if (!fd) {
|
||||
klogctl(8, 0, 6);
|
||||
|
||||
sprintf(logbuf, "log.%i", abs(random()) % 1000);
|
||||
fd = open(logbuf, O_WRONLY|O_CREAT|O_TRUNC, 0644);
|
||||
|
||||
if (fd == -1) {
|
||||
perror("Error opening log file");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
len = klogctl(4, logbuf, 1 << 21);
|
||||
|
||||
if (len == -1) {
|
||||
perror("Error reading kernel log");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
while (w < len) {
|
||||
int r = write(fd, logbuf + w, len - w);
|
||||
if (r == -1) {
|
||||
perror("Error writing log");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
w += r;
|
||||
}
|
||||
}
|
||||
|
||||
void aio_loop(int nr)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void usage()
|
||||
{
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
bool walk = false, randsize = false, verbose = false, csum = false, rtest = false, wtest = false;
|
||||
int fd1, fd2 = 0, direct = 0, nbytes = 4096, j, o;
|
||||
unsigned long size, i, offset = 0, done = 0, unique = 0, benchmark = 0;
|
||||
void *buf1 = NULL, *buf2 = NULL;
|
||||
struct pagestuff *pages, *p;
|
||||
unsigned char c[16];
|
||||
time_t last_printed = 0;
|
||||
extern char *optarg;
|
||||
|
||||
RC4_KEY writedata;
|
||||
RC4_set_key(&writedata, 16, bcache_magic);
|
||||
|
||||
while ((o = getopt(argc, argv, "dnwvscwlb:")) != EOF)
|
||||
switch (o) {
|
||||
case 'd':
|
||||
direct = O_DIRECT;
|
||||
break;
|
||||
case 'n':
|
||||
walk = true;
|
||||
break;
|
||||
case 'v':
|
||||
verbose = true;
|
||||
break;
|
||||
case 's':
|
||||
randsize = true;
|
||||
break;
|
||||
case 'c':
|
||||
csum = true;
|
||||
break;
|
||||
case 'w':
|
||||
wtest = true;
|
||||
break;
|
||||
case 'r':
|
||||
rtest = true;
|
||||
break;
|
||||
case 'l':
|
||||
klog = true;
|
||||
break;
|
||||
case 'b':
|
||||
benchmark = atol(optarg);
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
}
|
||||
|
||||
argv += optind;
|
||||
argc -= optind;
|
||||
|
||||
if (!rtest && !wtest)
|
||||
rtest = true;
|
||||
|
||||
if (argc < 1) {
|
||||
printf("Please enter a device to test\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (!csum && !benchmark && argc < 2) {
|
||||
printf("Please enter a device to compare against\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
fd1 = open(argv[0], (wtest ? O_RDWR : O_RDONLY)|direct);
|
||||
if (!csum && !benchmark)
|
||||
fd2 = open(argv[1], (wtest ? O_RDWR : O_RDONLY)|direct);
|
||||
|
||||
if (fd1 == -1 || fd2 == -1) {
|
||||
perror("Error opening device");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
size = getblocks(fd1);
|
||||
if (!csum && !benchmark)
|
||||
size = MIN(size, getblocks(fd2));
|
||||
|
||||
size = size / 8 - 16;
|
||||
pages = calloc(size + 16, sizeof(*pages));
|
||||
printf("size %li\n", size);
|
||||
|
||||
if (posix_memalign(&buf1, 4096, 4096 * 16) ||
|
||||
posix_memalign(&buf2, 4096, 4096 * 16)) {
|
||||
printf("Could not allocate buffers\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
//setvbuf(stdout, NULL, _IONBF, 0);
|
||||
|
||||
for (i = 0; !benchmark || i < benchmark; i++) {
|
||||
bool writing = (wtest && (i & 1)) || !rtest;
|
||||
nbytes = randsize ? drand48() * 16 + 1 : 1;
|
||||
nbytes <<= 12;
|
||||
|
||||
offset >>= 12;
|
||||
offset += walk ? normal() * 20 : random();
|
||||
offset %= size;
|
||||
offset <<= 12;
|
||||
|
||||
if (!(i % 200))
|
||||
flushlog();
|
||||
|
||||
if (!verbose) {
|
||||
time_t now = time(NULL);
|
||||
if (now - last_printed >= 2) {
|
||||
last_printed = now;
|
||||
goto print;
|
||||
}
|
||||
} else
|
||||
print: printf("Loop %6li offset %9li sectors %3i, %6lu mb done, %6lu mb unique\n",
|
||||
i, offset >> 9, nbytes >> 9, done >> 11, unique >> 11);
|
||||
|
||||
done += nbytes >> 9;
|
||||
|
||||
if (!writing)
|
||||
Pread(fd1, buf1, nbytes, offset);
|
||||
if (!writing && !csum && !benchmark)
|
||||
Pread(fd2, buf2, nbytes, offset);
|
||||
|
||||
for (j = 0; j < nbytes; j += 4096) {
|
||||
p = &pages[(offset + j) / 4096];
|
||||
|
||||
if (writing)
|
||||
RC4(&writedata, 4096, zero, buf1 + j);
|
||||
|
||||
if (csum) {
|
||||
MD4(buf1 + j, 4096, &c[0]);
|
||||
|
||||
if (writing ||
|
||||
(!p->readcount && !p->writecount)) {
|
||||
memcpy(&p->oldcsum[0], &p->csum[0], 16);
|
||||
memcpy(&p->csum[0], c, 16);
|
||||
} else if (memcmp(&p->csum[0], c, 16))
|
||||
goto bad;
|
||||
} else if (!writing && !benchmark &&
|
||||
memcmp(buf1 + j,
|
||||
buf2 + j,
|
||||
4096))
|
||||
goto bad;
|
||||
|
||||
if (!p->writecount && !p->readcount)
|
||||
unique += 8;
|
||||
|
||||
writing ? p->writecount++ : p->readcount++;
|
||||
}
|
||||
if (writing)
|
||||
Pwrite(fd1, buf1, nbytes, offset);
|
||||
if (writing && !csum && !benchmark)
|
||||
Pwrite(fd2, buf2, nbytes, offset);
|
||||
}
|
||||
printf("Loop %6li offset %9li sectors %3i, %6lu mb done, %6lu mb unique\n",
|
||||
i, offset >> 9, nbytes >> 9, done >> 11, unique >> 11);
|
||||
exit(EXIT_SUCCESS);
|
||||
err:
|
||||
perror("IO error");
|
||||
flushlog();
|
||||
exit(EXIT_FAILURE);
|
||||
bad:
|
||||
printf("Bad read! loop %li offset %li readcount %i writecount %i\n",
|
||||
i, (offset + j) >> 9, p->readcount, p->writecount);
|
||||
|
||||
if (!memcmp(&p->oldcsum[0], c, 16))
|
||||
printf("Matches previous csum\n");
|
||||
|
||||
flushlog();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
3
debian/.gitignore
vendored
Normal file
3
debian/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
bcache-tools*
|
||||
debhelper-build-stamp
|
||||
files
|
2
debian/bcache-tools.dirs
vendored
Normal file
2
debian/bcache-tools.dirs
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
sbin/
|
||||
usr/share/man/man8/
|
25
debian/bcache-tools.preinst
vendored
Normal file
25
debian/bcache-tools.preinst
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
|
||||
oldscript=/etc/initramfs-tools/hooks/bcache
|
||||
dpkg-maintscript-helper rm_conffile $oldscript 1.0.1-1~ -- "$@"
|
||||
case "$1" in
|
||||
install|upgrade)
|
||||
if [ -f $oldscript ]; then
|
||||
for hash in ca5a1c3f716e3ec69057f657cb79cee2f47c7ef6619983d86e647ac1f9f1f099 \
|
||||
74c5338e21c926d3cbbc1b44c5525667dc964fe91189ffa6b11352974ef56950
|
||||
do
|
||||
if echo "$hash $oldscript" |
|
||||
sha256sum --check --status -; then
|
||||
# Old conffile was not modified, let's just remove it
|
||||
rm -f $oldscript
|
||||
fi
|
||||
done
|
||||
if [ -f $oldscript ]; then
|
||||
# Otherwise, disable and rename it
|
||||
chmod -x $oldscript
|
||||
mv $oldscript $oldscript.dpkg-remove
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
#DEBHELPER#
|
44
debian/changelog
vendored
Normal file
44
debian/changelog
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
bcache-tools (1.0.8-2~bpo8+1) jessie-backports; urgency=medium
|
||||
|
||||
* Rebuild for jessie-backports.
|
||||
|
||||
-- Mathieu Parent <sathieu@debian.org> Mon, 21 Sep 2015 21:18:39 +0200
|
||||
|
||||
bcache-tools (1.0.8-2) unstable; urgency=medium
|
||||
|
||||
* Only run update-initramfs if installed. Fix dracut. (Closes: #788442)
|
||||
|
||||
-- David Mohr <david@mcbf.net> Thu, 11 Jun 2015 10:23:48 -0600
|
||||
|
||||
bcache-tools (1.0.8-1) unstable; urgency=medium
|
||||
|
||||
[ James Page ]
|
||||
* d/control: Add Vcs fields.
|
||||
|
||||
[ David Mohr ]
|
||||
* Don't depend on initramfs-tools, instead recommend it (Closes: #775674)
|
||||
* New upstream release 1.0.8
|
||||
* Update changelog
|
||||
* Add patch to clean bcache-register
|
||||
* Update changelog
|
||||
* Adding dep3 headers to the 0001 patch
|
||||
* Update watch to use http://evilpiepirate.org/git/bcache-tools.git
|
||||
* Add patch for gcc-5 compatability.
|
||||
Thanks to James Cowgill (Closes: #777798)
|
||||
|
||||
-- David Mohr <david@mcbf.net> Tue, 26 May 2015 20:57:58 -0600
|
||||
|
||||
bcache-tools (1.0.7-1) unstable; urgency=medium
|
||||
|
||||
[ David Mohr ]
|
||||
* Based on work by Gabriel de Perthuis <g2p.code+debian@gmail.com>
|
||||
* Initial release. (Closes: #708132)
|
||||
|
||||
[ Robie Basak ]
|
||||
* Remove unnecessary file bcache-tools.postrm.
|
||||
* debian/copyright fixes.
|
||||
* Add shebang to bcache-tools.preinst.
|
||||
* Drop Vcs-* for now.
|
||||
* Add self to Uploaders.
|
||||
|
||||
-- Robie Basak <robie@justgohome.co.uk> Mon, 27 Oct 2014 13:32:08 +0000
|
1
debian/compat
vendored
Normal file
1
debian/compat
vendored
Normal file
@ -0,0 +1 @@
|
||||
9
|
23
debian/control
vendored
Normal file
23
debian/control
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
Source: bcache-tools
|
||||
Maintainer: David Mohr <david@mcbf.net>
|
||||
Uploaders: Robie Basak <robie@justgohome.co.uk>
|
||||
Section: utils
|
||||
Priority: optional
|
||||
Standards-Version: 3.9.5
|
||||
Build-Depends: debhelper (>= 9), pkg-config, uuid-dev, libblkid-dev
|
||||
Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/bcache-tools.git
|
||||
Vcs-Git: git://anonscm.debian.org/collab-maint/bcache-tools.git
|
||||
Homepage: http://bcache.evilpiepirate.org/
|
||||
|
||||
Package: bcache-tools
|
||||
Architecture: linux-any
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||
Recommends: initramfs-tools | linux-initramfs-tool
|
||||
Description: bcache userspace tools
|
||||
Bcache allows the use of SSDs to cache other block devices.
|
||||
.
|
||||
Documentation for the run-time interface is included in the kernel tree; in
|
||||
Documentation/bcache.txt.
|
||||
.
|
||||
This package includes udev rules, initramfs support, and the utilities to
|
||||
create a new bcache as well as inspect existing bcache partitions.
|
86
debian/copyright
vendored
Normal file
86
debian/copyright
vendored
Normal file
@ -0,0 +1,86 @@
|
||||
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Upstream-Contact: kmo@daterainc.com
|
||||
linux-bcache@vger.kernel.org
|
||||
Source: http://evilpiepirate.org/git/bcache-tools.git
|
||||
|
||||
Files: *
|
||||
Copyright: 2013 Kent Overstreet <kmo@daterainc.com>
|
||||
License: GPL-2
|
||||
|
||||
Files: bcache-super-show.c
|
||||
Copyright: 2013 Gabriel de Perthuis <g2p.code@gmail.com>
|
||||
License: GPL-2
|
||||
|
||||
Files: bcache.c
|
||||
Copyright: 1996-2001, PostgreSQL Global Development Group
|
||||
License: PostgreSQL
|
||||
|
||||
Files: debian/*
|
||||
Copyright: 2014 Tom Strickx <tstrickx@rootcu.be>,
|
||||
2014 David Mohr <david@mcbf.net>
|
||||
License: GPL-2+
|
||||
|
||||
License: GPL-2
|
||||
This program is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation;
|
||||
version 2 of the License.
|
||||
.
|
||||
This program is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE. See the GNU General Public License for more
|
||||
details.
|
||||
.
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this package; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
Boston, MA 02110-1301 USA
|
||||
.
|
||||
On Debian systems, the full text of the GNU General Public
|
||||
License version 2 can be found in the file
|
||||
`/usr/share/common-licenses/GPL-2'.
|
||||
|
||||
License: GPL-2+
|
||||
This program is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later
|
||||
version.
|
||||
.
|
||||
This program is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE. See the GNU General Public License for more
|
||||
details.
|
||||
.
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this package; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
Boston, MA 02110-1301 USA
|
||||
.
|
||||
On Debian systems, the full text of the GNU General Public
|
||||
License version 2 can be found in the file
|
||||
`/usr/share/common-licenses/GPL-2'.
|
||||
|
||||
License: PostgreSQL
|
||||
Permission to use, copy, modify, and distribute this
|
||||
software and its documentation for any purpose, without fee,
|
||||
and without a written agreement is hereby granted, provided
|
||||
that the above copyright notice and this paragraph and the
|
||||
following two paragraphs appear in all copies.
|
||||
.
|
||||
IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO
|
||||
ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR
|
||||
CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT
|
||||
OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
|
||||
THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
.
|
||||
THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
|
||||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS"
|
||||
BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS
|
||||
TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
|
||||
MODIFICATIONS.
|
5
debian/gbp.conf
vendored
Normal file
5
debian/gbp.conf
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
[DEFAULT]
|
||||
pristine-tar = True
|
||||
upstream-tag = v%(version)s
|
||||
ignore-branch = True
|
||||
|
7
debian/rules
vendored
Executable file
7
debian/rules
vendored
Executable file
@ -0,0 +1,7 @@
|
||||
#!/usr/bin/make -f
|
||||
%:
|
||||
dh $@
|
||||
|
||||
override_dh_auto_install:
|
||||
dh_auto_install -- DRACUTLIBDIR=/usr/lib/dracut
|
||||
|
8
debian/watch
vendored
Normal file
8
debian/watch
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
version=3
|
||||
|
||||
http://evilpiepirate.org/git/bcache-tools.git/refs/ /git/bcache-tools.git/tag/\?id=v(\d[\d.]*)
|
||||
|
||||
# tag/\?id=(v?\d[\d.]*)
|
||||
#opts="filenamemangle=s/(?:.*)?v?(\d[\d\.]*)\.tar\.gz/bcache-tools-$1.tar.gz/" \
|
||||
# (?:.*/)?v?(\d[\d\.]*)\.tar\.gz
|
||||
# http://evilpiepirate.org/git/bcache-tools.git/tag/?id=v1.0.8
|
@ -1,34 +0,0 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
#
|
||||
# At some point (util-linux v2.24) blkid will be able to identify bcache
|
||||
# but until every system has this version of util-linux, probe-bcache is
|
||||
# provided as an alternative.
|
||||
#
|
||||
|
||||
check() {
|
||||
if [[ $hostonly ]] || [[ $mount_needs ]]
|
||||
then
|
||||
for fs in "${host_fs_types[@]}"; do
|
||||
[[ $fs = "bcache" ]] && return 0
|
||||
done
|
||||
return 255
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
instmods bcache
|
||||
}
|
||||
|
||||
install() {
|
||||
inst_multiple ${udevdir}/probe-bcache ${udevdir}/bcache-register
|
||||
inst_rules 69-bcache.rules
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
PREREQ="udev"
|
||||
|
||||
prereqs()
|
||||
{
|
||||
echo "$PREREQ"
|
||||
}
|
||||
|
||||
case $1 in
|
||||
prereqs)
|
||||
prereqs
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
. /usr/share/initramfs-tools/hook-functions
|
||||
|
||||
cp -pt "${DESTDIR}/lib/udev/rules.d" /lib/udev/rules.d/69-bcache.rules
|
||||
copy_exec /lib/udev/bcache-register
|
||||
copy_exec /lib/udev/probe-bcache
|
||||
manual_add_modules bcache
|
@ -1,17 +0,0 @@
|
||||
.TH probe-bcache 8
|
||||
.SH NAME
|
||||
probe-bcache \- probe a bcache device
|
||||
.SH SYNOPSIS
|
||||
.B probe-bcache
|
||||
[\fB \-o\ \fIudev\fR ]
|
||||
.I device
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.BR \-o
|
||||
return UUID in udev style for invocation by udev rule as IMPORT{program}
|
||||
.SH USAGE
|
||||
Return UUID if device identified as bcache-formatted.
|
||||
|
||||
Only necessary until support for the bcache superblock is included
|
||||
in blkid; in the meantime, provides just enough functionality for a udev script
|
||||
to create the /dev/disk/by-uuid symlink.
|
@ -1,87 +0,0 @@
|
||||
/*
|
||||
* Author: Kent Overstreet <kent.overstreet@gmail.com>
|
||||
*
|
||||
* GPLv2
|
||||
*/
|
||||
|
||||
#define _FILE_OFFSET_BITS 64
|
||||
#define __USE_FILE_OFFSET64
|
||||
#define _XOPEN_SOURCE 500
|
||||
|
||||
#include <blkid/blkid.h>
|
||||
#include <fcntl.h>
|
||||
#include <linux/fs.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <uuid/uuid.h>
|
||||
|
||||
#include "bcache.h"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
bool udev = false;
|
||||
int i, o;
|
||||
extern char *optarg;
|
||||
struct cache_sb sb;
|
||||
char uuid[40];
|
||||
blkid_probe pr;
|
||||
|
||||
while ((o = getopt(argc, argv, "o:")) != EOF)
|
||||
switch (o) {
|
||||
case 'o':
|
||||
if (strcmp("udev", optarg)) {
|
||||
printf("Invalid output format %s\n", optarg);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
udev = true;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
argv += optind;
|
||||
argc -= optind;
|
||||
|
||||
for (i = 0; i < argc; i++) {
|
||||
int fd = open(argv[i], O_RDONLY);
|
||||
if (fd == -1)
|
||||
continue;
|
||||
|
||||
if (!(pr = blkid_new_probe()))
|
||||
continue;
|
||||
if (blkid_probe_set_device(pr, fd, 0, 0))
|
||||
continue;
|
||||
/* probe partitions too */
|
||||
if (blkid_probe_enable_partitions(pr, true))
|
||||
continue;
|
||||
/* bail if anything was found
|
||||
* probe-bcache isn't needed once blkid recognizes bcache */
|
||||
if (!blkid_do_probe(pr)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (pread(fd, &sb, sizeof(sb), SB_SECTOR << 9) != sizeof(sb))
|
||||
continue;
|
||||
|
||||
if (memcmp(&sb.magic, &BCACHE_MAGIC, sizeof(sb.magic)))
|
||||
continue;
|
||||
|
||||
uuid_unparse(sb.disk_uuid.b, uuid);
|
||||
|
||||
if (udev)
|
||||
printf("ID_FS_UUID=%s\n"
|
||||
"ID_FS_UUID_ENC=%s\n"
|
||||
"ID_FS_TYPE=bcache\n",
|
||||
uuid, uuid);
|
||||
else
|
||||
printf("%s: UUID=\"\" TYPE=\"bcache\"\n", uuid);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user