mirror of
https://github.com/Zygo/bees.git
synced 2025-05-17 21:35:45 +02:00
fiemap, fiewalk: drop dead example/test code
These tools are obsolete. fiemap was a thin wrapper around FIEMAP, but FIEMAP is not useful on btrfs. fiewalk was a thin wrapper around BtrfsExtentWalker, but development on BtrfsExtentWalker has been abandoned. Signed-off-by: Zygo Blaxell <bees@furryterror.org>
This commit is contained in:
parent
facf4121a6
commit
ccd8dcd43f
12
src/Makefile
12
src/Makefile
@ -1,11 +1,6 @@
|
|||||||
BEES = ../bin/bees
|
BEES = ../bin/bees
|
||||||
PROGRAMS = \
|
|
||||||
../bin/fiemap \
|
|
||||||
../bin/fiewalk \
|
|
||||||
|
|
||||||
PROGRAM_OBJS = $(foreach b,$(PROGRAMS),$(patsubst ../bin/%,%.o,$(b)))
|
all: $(BEES)
|
||||||
|
|
||||||
all: $(BEES) $(PROGRAMS)
|
|
||||||
|
|
||||||
include ../makeflags
|
include ../makeflags
|
||||||
-include ../localconf
|
-include ../localconf
|
||||||
@ -51,11 +46,6 @@ include depends.mk
|
|||||||
%.o: %.cc ../makeflags
|
%.o: %.cc ../makeflags
|
||||||
$(CXX) $(BEES_CXXFLAGS) -o $@ -c $<
|
$(CXX) $(BEES_CXXFLAGS) -o $@ -c $<
|
||||||
|
|
||||||
$(PROGRAMS): ../bin/%: %.o
|
|
||||||
$(CXX) $(BEES_CXXFLAGS) $(BEES_LDFLAGS) -o $@ $< $(LIBS)
|
|
||||||
|
|
||||||
$(PROGRAMS): ../lib/libcrucible.a
|
|
||||||
|
|
||||||
$(BEES): $(BEES_OBJS) bees-version.o bees-usage.o ../lib/libcrucible.a
|
$(BEES): $(BEES_OBJS) bees-version.o bees-usage.o ../lib/libcrucible.a
|
||||||
$(CXX) $(BEES_CXXFLAGS) $(BEES_LDFLAGS) -o $@ $^ $(LIBS)
|
$(CXX) $(BEES_CXXFLAGS) $(BEES_LDFLAGS) -o $@ $^ $(LIBS)
|
||||||
|
|
||||||
|
@ -1,55 +0,0 @@
|
|||||||
#include "crucible/fd.h"
|
|
||||||
#include "crucible/fs.h"
|
|
||||||
#include "crucible/error.h"
|
|
||||||
#include "crucible/string.h"
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
using namespace crucible;
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
int
|
|
||||||
main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
catch_all([&]() {
|
|
||||||
THROW_CHECK1(invalid_argument, argc, argc > 1);
|
|
||||||
string filename = argv[1];
|
|
||||||
|
|
||||||
|
|
||||||
cout << "File: " << filename << endl;
|
|
||||||
Fd fd = open_or_die(filename, O_RDONLY);
|
|
||||||
uint64_t start = 0;
|
|
||||||
uint64_t length = Fiemap::s_fiemap_max_offset;
|
|
||||||
if (argc > 2) { start = stoull(argv[2], nullptr, 0); }
|
|
||||||
if (argc > 3) { length = stoull(argv[3], nullptr, 0); }
|
|
||||||
length = min(length, Fiemap::s_fiemap_max_offset - start);
|
|
||||||
Fiemap fm(start, length);
|
|
||||||
fm.m_flags &= ~(FIEMAP_FLAG_SYNC);
|
|
||||||
fm.m_max_count = 100;
|
|
||||||
if (argc > 4) { fm.m_flags = stoull(argv[4], nullptr, 0); }
|
|
||||||
uint64_t stop_at = start + length;
|
|
||||||
uint64_t last_byte = start;
|
|
||||||
do {
|
|
||||||
fm.do_ioctl(fd);
|
|
||||||
// cerr << fm;
|
|
||||||
uint64_t last_logical = Fiemap::s_fiemap_max_offset;
|
|
||||||
for (auto &extent : fm.m_extents) {
|
|
||||||
if (extent.fe_logical > last_byte) {
|
|
||||||
cout << "Log " << to_hex(last_byte) << ".." << to_hex(extent.fe_logical) << " Hole" << endl;
|
|
||||||
}
|
|
||||||
cout << "Log " << to_hex(extent.fe_logical) << ".." << to_hex(extent.fe_logical + extent.fe_length)
|
|
||||||
<< " Phy " << to_hex(extent.fe_physical) << ".." << to_hex(extent.fe_physical + extent.fe_length)
|
|
||||||
<< " Flags " << fiemap_extent_flags_ntoa(extent.fe_flags) << endl;
|
|
||||||
last_logical = extent.fe_logical + extent.fe_length;
|
|
||||||
last_byte = last_logical;
|
|
||||||
}
|
|
||||||
fm.m_start = last_logical;
|
|
||||||
} while (fm.m_start < stop_at);
|
|
||||||
});
|
|
||||||
exit(EXIT_SUCCESS);
|
|
||||||
}
|
|
||||||
|
|
@ -1,40 +0,0 @@
|
|||||||
#include "crucible/extentwalker.h"
|
|
||||||
#include "crucible/error.h"
|
|
||||||
#include "crucible/string.h"
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
using namespace crucible;
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
int
|
|
||||||
main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
catch_all([&]() {
|
|
||||||
THROW_CHECK1(invalid_argument, argc, argc > 1);
|
|
||||||
string filename = argv[1];
|
|
||||||
|
|
||||||
cout << "File: " << filename << endl;
|
|
||||||
Fd fd = open_or_die(filename, O_RDONLY);
|
|
||||||
BtrfsExtentWalker ew(fd);
|
|
||||||
off_t pos = 0;
|
|
||||||
if (argc > 2) { pos = stoull(argv[2], nullptr, 0); }
|
|
||||||
ew.seek(pos);
|
|
||||||
do {
|
|
||||||
// cout << "\n\n>>>" << ew.current() << "<<<\n\n" << endl;
|
|
||||||
cout << ew.current() << endl;
|
|
||||||
} while (ew.next());
|
|
||||||
#if 0
|
|
||||||
cout << "\n\n\nAnd now, backwards...\n\n\n" << endl;
|
|
||||||
do {
|
|
||||||
cout << "\n\n>>>" << ew.current() << "<<<\n\n" << endl;
|
|
||||||
} while (ew.prev());
|
|
||||||
cout << "\n\n\nDone!\n\n\n" << endl;
|
|
||||||
#endif
|
|
||||||
});
|
|
||||||
exit(EXIT_SUCCESS);
|
|
||||||
}
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user