- libgoogle-perftools-dev
- libkeyutils-dev
- uuid-dev
+- libblkid-dev
- libatomic-ops-dev
- libboost-program-options-dev
- libboost-thread-dev
For example:
- $ apt-get install automake autoconf pkg-config gcc g++ make libboost-dev libedit-dev libssl-dev libtool libfcgi libfcgi-dev libfuse-dev linux-kernel-headers libcrypto++-dev libaio-dev libgoogle-perftools-dev libkeyutils-dev uuid-dev libatomic-ops-dev libboost-program-options-dev libboost-thread-dev libexpat1-dev libleveldb-dev libsnappy-dev libcurl4-gnutls-dev python-argparse python-flask
+ $ apt-get install automake autoconf pkg-config gcc g++ make libboost-dev libedit-dev libssl-dev libtool libfcgi libfcgi-dev libfuse-dev linux-kernel-headers libcrypto++-dev libaio-dev libgoogle-perftools-dev libkeyutils-dev uuid-dev libblkid-dev libatomic-ops-dev libboost-program-options-dev libboost-thread-dev libexpat1-dev libleveldb-dev libsnappy-dev libcurl4-gnutls-dev python-argparse python-flask
rpm-based
---------
python-argparse
python-flask
libuuid-devel
+ libblkid-devel
keyutils-libs-devel
cryptopp-devel
nss-devel
For example:
- $ yum install autoconf automake gcc gcc-c++ make libtool python-argparse python-flask libuuid-devel keyutils-libs-devel cryptopp-devel nss-devel fcgi-devel expat-devel libcurl-devel fuse-devel gperftools-devel libedit-devel libatomic_ops-devel snappy-devel leveldb-devel libaio-devel boost-devel
+ $ yum install autoconf automake gcc gcc-c++ make libtool python-argparse python-flask libuuid-devel libblkid-devel keyutils-libs-devel cryptopp-devel nss-devel fcgi-devel expat-devel libcurl-devel fuse-devel gperftools-devel libedit-devel libatomic_ops-devel snappy-devel leveldb-devel libaio-devel boost-devel
BuildRequires: libcurl-devel
BuildRequires: libxml2-devel
BuildRequires: libuuid-devel
+BuildRequires: libblkid-devel >= 2.17
BuildRequires: leveldb-devel > 1.2
BuildRequires: yasm
%if 0%{?rhel_version} || 0%{?centos_version} || 0%{?fedora}
# Checks for libraries.
ACX_PTHREAD
+
AC_CHECK_LIB([uuid], [uuid_parse], [true], AC_MSG_FAILURE([libuuid not found]))
+if test x"$linux" = x"yes"; then
+ AC_CHECK_LIB([blkid], [blkid_devno_to_wholedisk], [true], AC_MSG_FAILURE([libblkid not found]))
+fi
+
#
# Check for res_nquery in libresolv. There are several variations. On OSX
# res_nquery is a macro defined in resolv.h, so the typical AC_CHECK_LIB
#include <sys/param.h>
#endif
+#include <blkid/blkid.h>
+
#define MAX_SECRET_LEN 1000
#define MAX_POOL_NAME_SIZE 128
return 0;
}
-static int get_rbd_seq(int major_num, string &seq)
+static int get_rbd_seq(dev_t devno, string &seq)
{
- int r;
+ // convert devno, which might be a partition major:minor pair, into
+ // a whole disk major:minor pair
+ dev_t wholediskno;
+ int r = blkid_devno_to_wholedisk(devno, NULL, 0, &wholediskno);
+ if (r) {
+ cerr << "rbd: could not compute wholediskno: " << r << std::endl;
+ // ignore the error: devno == wholediskno most of the time, and if
+ // it turns out it's not we will fail with -ENOENT later anyway
+ wholediskno = devno;
+ }
+
const char *devices_path = "/sys/bus/rbd/devices";
DIR *device_dir = opendir(devices_path);
if (!device_dir) {
continue;
}
- if (cur_major == major_num) {
+ if (cur_major == (int)major(wholediskno)) {
seq = string(dent->d_name);
closedir(device_dir);
return 0;
static int do_kernel_rm(const char *dev)
{
- struct stat dev_stat;
- int r = stat(dev, &dev_stat);
- if (!S_ISBLK(dev_stat.st_mode)) {
+ struct stat sbuf;
+ if (stat(dev, &sbuf) || !S_ISBLK(sbuf.st_mode)) {
cerr << "rbd: " << dev << " is not a block device" << std::endl;
return -EINVAL;
}
- int major = major(dev_stat.st_rdev);
string seq_num;
- r = get_rbd_seq(major, seq_num);
+ int r = get_rbd_seq(sbuf.st_rdev, seq_num);
if (r == -ENOENT) {
cerr << "rbd: " << dev << " is not an rbd device" << std::endl;
return -EINVAL;