mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-02-22 00:00:03 +03:00
bcacheadm fixes
Change-Id: I3f6024d54aee263ef843705a0e9a02869e2a53e9
This commit is contained in:
parent
7763a86ca8
commit
7916b2eb3b
19
Makefile
19
Makefile
@ -3,15 +3,16 @@ PREFIX=/usr
|
|||||||
UDEVLIBDIR=/lib/udev
|
UDEVLIBDIR=/lib/udev
|
||||||
DRACUTLIBDIR=/lib/dracut
|
DRACUTLIBDIR=/lib/dracut
|
||||||
INSTALL=install
|
INSTALL=install
|
||||||
CFLAGS+=-O2 -Wall -Werror -g
|
CFLAGS+=-O2 -Wall -Werror -g -I.
|
||||||
|
|
||||||
all: make-bcache probe-bcache bcache-super-show bcachectl
|
all: bcacheadm make-bcache probe-bcache bcachectl
|
||||||
|
|
||||||
install: make-bcache probe-bcache bcache-super-show
|
install: bcacheadm make-bcache probe-bcache
|
||||||
$(INSTALL) -m0755 make-bcache bcache-super-show bcachectl $(DESTDIR)${PREFIX}/sbin/
|
$(INSTALL) -m0755 bcacheadm bcachectl $(DESTDIR)${PREFIX}/sbin/
|
||||||
|
$(INSTALL) -m0755 make-bcache bcachectl $(DESTDIR)${PREFIX}/sbin/
|
||||||
$(INSTALL) -m0755 probe-bcache bcache-register $(DESTDIR)$(UDEVLIBDIR)/
|
$(INSTALL) -m0755 probe-bcache bcache-register $(DESTDIR)$(UDEVLIBDIR)/
|
||||||
$(INSTALL) -m0644 69-bcache.rules $(DESTDIR)$(UDEVLIBDIR)/rules.d/
|
$(INSTALL) -m0644 69-bcache.rules $(DESTDIR)$(UDEVLIBDIR)/rules.d/
|
||||||
-$(INSTALL) -T -m0755 initramfs/hook $(DESTDIR)/usr/share/initramfs-tools/hooks/bcache
|
#-$(INSTALL) -T -m0755 initramfs/hook $(DESTDIR)/usr/share/initramfs-tools/hooks/bcache
|
||||||
if [ -d $(DESTDIR)$(DRACUTLIBDIR)/modules.d ]; \
|
if [ -d $(DESTDIR)$(DRACUTLIBDIR)/modules.d ]; \
|
||||||
then $(INSTALL) -D -m0755 dracut/module-setup.sh $(DESTDIR)$(DRACUTLIBDIR)/modules.d/90bcache/module-setup.sh; \
|
then $(INSTALL) -D -m0755 dracut/module-setup.sh $(DESTDIR)$(DRACUTLIBDIR)/modules.d/90bcache/module-setup.sh; \
|
||||||
fi
|
fi
|
||||||
@ -22,12 +23,20 @@ clean:
|
|||||||
$(RM) -f make-bcache probe-bcache bcache-super-show bcache-test bcachectl *.o
|
$(RM) -f make-bcache probe-bcache bcache-super-show bcache-test bcachectl *.o
|
||||||
|
|
||||||
bcache-test: LDLIBS += `pkg-config --libs openssl`
|
bcache-test: LDLIBS += `pkg-config --libs openssl`
|
||||||
|
|
||||||
|
bcacheadm: LDLIBS += `pkg-config --libs uuid blkid libnih`
|
||||||
|
bcacheadm: CFLAGS += `pkg-config --cflags uuid blkid libnih`
|
||||||
|
bcacheadm: bcache.o
|
||||||
|
|
||||||
make-bcache: LDLIBS += `pkg-config --libs uuid blkid`
|
make-bcache: LDLIBS += `pkg-config --libs uuid blkid`
|
||||||
make-bcache: CFLAGS += `pkg-config --cflags uuid blkid`
|
make-bcache: CFLAGS += `pkg-config --cflags uuid blkid`
|
||||||
make-bcache: bcache.o
|
make-bcache: bcache.o
|
||||||
|
|
||||||
probe-bcache: LDLIBS += `pkg-config --libs uuid blkid`
|
probe-bcache: LDLIBS += `pkg-config --libs uuid blkid`
|
||||||
probe-bcache: CFLAGS += `pkg-config --cflags uuid blkid`
|
probe-bcache: CFLAGS += `pkg-config --cflags uuid blkid`
|
||||||
|
|
||||||
bcache-super-show: LDLIBS += `pkg-config --libs uuid`
|
bcache-super-show: LDLIBS += `pkg-config --libs uuid`
|
||||||
bcache-super-show: CFLAGS += -std=gnu99
|
bcache-super-show: CFLAGS += -std=gnu99
|
||||||
bcache-super-show: bcache.o
|
bcache-super-show: bcache.o
|
||||||
|
|
||||||
bcachectl: bcachectl.o
|
bcachectl: bcachectl.o
|
||||||
|
1
bcache.c
1
bcache.c
@ -1042,7 +1042,6 @@ char *list_cachesets(char *cset_dir, bool list_devs)
|
|||||||
while ((ent = readdir(dir)) != NULL) {
|
while ((ent = readdir(dir)) != NULL) {
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
char entry[MAX_PATH];
|
char entry[MAX_PATH];
|
||||||
struct dirent *cache_ent;
|
|
||||||
|
|
||||||
if (!strcmp(ent->d_name, ".") || !strcmp(ent->d_name, ".."))
|
if (!strcmp(ent->d_name, ".") || !strcmp(ent->d_name, ".."))
|
||||||
continue;
|
continue;
|
||||||
|
16
bcacheadm.c
16
bcacheadm.c
@ -125,6 +125,8 @@ static int set_cache(NihOption *option, const char *arg)
|
|||||||
|
|
||||||
devs++;
|
devs++;
|
||||||
nr_cache_devices++;
|
nr_cache_devices++;
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int set_bdev(NihOption *option, const char *arg)
|
static int set_bdev(NihOption *option, const char *arg)
|
||||||
@ -398,12 +400,14 @@ int bcache_query_devs(NihCommand *command, char *const *args)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; args[i] != NULL; i++){
|
for (i = 0; args[i] != NULL; i++) {
|
||||||
char dev_uuid[40];
|
char dev_uuid[40];
|
||||||
query_dev(args[i], force_csum, true, uuid_only, dev_uuid);
|
query_dev(args[i], force_csum, true, uuid_only, dev_uuid);
|
||||||
if(uuid_only)
|
if(uuid_only)
|
||||||
printf("%s\n", dev_uuid);
|
printf("%s\n", dev_uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bcache_status(NihCommand *command, char *const *args)
|
int bcache_status(NihCommand *command, char *const *args)
|
||||||
@ -418,19 +422,23 @@ int bcache_status(NihCommand *command, char *const *args)
|
|||||||
sb->nr_this_dev;
|
sb->nr_this_dev;
|
||||||
long long unsigned cache_tier = CACHE_TIER(m);
|
long long unsigned cache_tier = CACHE_TIER(m);
|
||||||
|
|
||||||
if (!cache_tier)
|
if (!cache_tier) {
|
||||||
if (!sb_tier0 || sb->seq > sb_tier0->seq) {
|
if (!sb_tier0 || sb->seq > sb_tier0->seq) {
|
||||||
sb_tier0 = sb;
|
sb_tier0 = sb;
|
||||||
dev0 = args[i];
|
dev0 = args[i];
|
||||||
}
|
}
|
||||||
else if (cache_tier == 1)
|
} else if (cache_tier == 1) {
|
||||||
if (!sb_tier1 || sb->seq > sb_tier1->seq) {
|
if (!sb_tier1 || sb->seq > sb_tier1->seq) {
|
||||||
sb_tier1 = sb;
|
sb_tier1 = sb;
|
||||||
dev1 = args[i];
|
dev1 = args[i];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sb_tier0) sb_state(sb_tier0, dev0);
|
if (sb_tier0) sb_state(sb_tier0, dev0);
|
||||||
if (sb_tier1) sb_state(sb_tier1, dev1);
|
if (sb_tier1) sb_state(sb_tier1, dev1);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *stats_subdir(char* stats_dir)
|
static char *stats_subdir(char* stats_dir)
|
||||||
@ -562,4 +570,6 @@ int main(int argc, char *argv[])
|
|||||||
exit (1);
|
exit (1);
|
||||||
|
|
||||||
nih_signal_reset();
|
nih_signal_reset();
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user