1
0
mirror of https://github.com/Zygo/bees.git synced 2025-05-17 13:25:45 +02:00

uuid: drop dependency on uuid.h

The weird things distros do to the path where uuid.h gets installed
have broken bees builds for the last time.

We were only using uuid to support a legacy feature that was removed
over four years ago.

Hypothetical users who are upgrading directly from bees v0.1 should
probably restart all the crawlers anyway--there were bugs.  Also, if any
such users exist, I respect their tremendous patience with the horrible
performance all these years--bees got about 30x faster since v0.1.

Signed-off-by: Zygo Blaxell <bees@furryterror.org>
This commit is contained in:
Zygo Blaxell 2021-04-23 08:03:09 -04:00
parent 6465a7c37c
commit bcf3e7de3e
10 changed files with 5 additions and 74 deletions

View File

@ -17,11 +17,6 @@ Dependencies
Needed at runtime by the service wrapper script.
* libuuid-dev
This library is only required for a feature that was removed after v0.1.
The lingering support code can be removed.
* [Linux kernel version](btrfs-kernel.md) gets its own page.
* markdown for documentation
@ -73,10 +68,10 @@ Both of the latter use the filesystem UUID to mount the root subvolume
within a temporary runtime directory.
### Ubuntu 16.04 - 17.04:
`$ apt -y install build-essential btrfs-tools uuid-dev markdown && make`
`$ apt -y install build-essential btrfs-tools markdown && make`
### Ubuntu 18.10:
`$ apt -y install build-essential btrfs-progs uuid-dev markdown && make`
`$ apt -y install build-essential btrfs-progs markdown && make`
### Ubuntu 14.04:
You can try to carry on the work done here: <https://gist.github.com/dagelf/99ee07f5638b346adb8c058ab3d57492>

View File

@ -238,7 +238,6 @@ namespace crucible {
struct BtrfsIoctlFsInfoArgs : public btrfs_ioctl_fs_info_args_v2 {
BtrfsIoctlFsInfoArgs();
void do_ioctl(int fd);
string uuid() const;
uint16_t csum_type() const;
uint16_t csum_size() const;
};

View File

@ -1,14 +0,0 @@
#ifndef CRUCIBLE_UUID_H
#define CRUCIBLE_UUID_H
#include <string>
#include <uuid/uuid.h>
namespace crucible {
using namespace std;
string uuid_unparse(const unsigned char a[16]);
}
#endif // CRUCIBLE_UUID_H

View File

@ -18,7 +18,6 @@ CRUCIBLE_OBJS = \
string.o \
task.o \
time.o \
uuid.o \
include ../makeflags
-include ../localconf

View File

@ -5,7 +5,6 @@
#include "crucible/limits.h"
#include "crucible/ntoa.h"
#include "crucible/string.h"
#include "crucible/uuid.h"
// FS_IOC_FIEMAP
#include <linux/fs.h>
@ -1071,7 +1070,6 @@ namespace crucible {
os << "BtrfsIoctlFsInfoArgs {"
<< " max_id = " << a.max_id << ","
<< " num_devices = " << a.num_devices << ","
<< " fsid = " << a.uuid() << ","
#if 0
<< " nodesize = " << a.nodesize << ","
<< " sectorsize = " << a.sectorsize << ","
@ -1099,12 +1097,6 @@ namespace crucible {
}
}
string
BtrfsIoctlFsInfoArgs::uuid() const
{
return uuid_unparse(fsid);
}
uint16_t
BtrfsIoctlFsInfoArgs::csum_type() const
{

View File

@ -1,16 +0,0 @@
#include "crucible/uuid.h"
namespace crucible {
using namespace std;
const size_t uuid_unparsed_size = 37; // "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\0"
string
uuid_unparse(const unsigned char in[16])
{
char out[uuid_unparsed_size];
::uuid_unparse(in, out);
return string(out);
}
}

View File

@ -10,7 +10,7 @@ all: $(BEES) $(PROGRAMS)
include ../makeflags
-include ../localconf
LIBS = -lcrucible -luuid -lpthread
LIBS = -lcrucible -lpthread
BEES_LDFLAGS = -L../lib $(LDFLAGS)
BEES_OBJS = \

View File

@ -941,10 +941,6 @@ BeesContext::set_root_fd(Fd fd)
Stat st(fd);
THROW_CHECK1(invalid_argument, st.st_ino, st.st_ino == BTRFS_FIRST_FREE_OBJECTID);
m_root_fd = fd;
BtrfsIoctlFsInfoArgs fsinfo;
fsinfo.do_ioctl(fd);
m_root_uuid = fsinfo.uuid();
BEESLOGINFO("Filesystem UUID is " << m_root_uuid);
// 65536 is big enough for two max-sized extents.
// Need enough total space in the cache for the maximum number of active threads.

View File

@ -84,20 +84,8 @@ BeesRoots::set_workaround_btrfs_send(bool do_avoid)
string
BeesRoots::crawl_state_filename() const
{
string rv;
// Legacy filename included UUID
rv += "beescrawl.";
rv += m_ctx->root_uuid();
rv += ".dat";
struct stat buf;
if (fstatat(m_ctx->home_fd(), rv.c_str(), &buf, AT_SYMLINK_NOFOLLOW)) {
// Use new filename
rv = "beescrawl.dat";
}
return rv;
// Legacy filename included UUID. That feature was removed in 2016.
return "beescrawl.dat";
}
ostream &
@ -149,12 +137,6 @@ BeesRoots::state_save()
m_crawl_state_file.write(ofs.str());
// Renaming things is hard after release
if (m_crawl_state_file.name() != "beescrawl.dat") {
renameat(m_ctx->home_fd(), m_crawl_state_file.name().c_str(), m_ctx->home_fd(), "beescrawl.dat");
m_crawl_state_file.name("beescrawl.dat");
}
BEESNOTE("relocking crawl state");
lock.lock();
// Not really correct but probably close enough

View File

@ -734,7 +734,6 @@ class BeesContext : public enable_shared_from_this<BeesContext> {
string m_root_path;
Fd m_root_fd;
string m_root_uuid;
mutable mutex m_blacklist_mutex;
set<BeesFileId> m_blacklist;
@ -771,7 +770,6 @@ public:
Fd root_fd() const { return m_root_fd; }
Fd home_fd();
string root_path() const { return m_root_path; }
string root_uuid() const { return m_root_uuid; }
BeesFileRange scan_forward(const BeesFileRange &bfr);