#include "common/Timer.h"
#include "common/ceph_argparse.h"
+#include "common/linux_version.h"
#include "global/global_init.h"
#include "common/safe_io.h"
}
virtual ~RemountTest() {}
virtual void *entry() {
- struct utsname os_info;
- int tr = uname(&os_info);
- assert(tr == 0);
- assert(memcmp(os_info.sysname, "Linux", 5) == 0);
- int major, minor;
- char *end_num;
- major = strtol(os_info.release, &end_num, 10);
- assert(major > 0);
- ++end_num;
- minor = strtol(end_num, NULL, 10);
+ int ver = get_linux_version();
+ assert(ver != 0);
bool can_invalidate_dentries = g_conf->client_try_dentry_invalidate &&
- (major < 3 ||
- (major == 3 && minor < 18));
- tr = client->test_dentry_handling(can_invalidate_dentries);
+ ver < KERNEL_VERSION(3, 18, 0);
+ int tr = client->test_dentry_handling(can_invalidate_dentries);
if (tr != 0) {
cerr << "ceph-fuse[" << getpid()
<< "]: fuse failed dentry invalidate/remount test with error "
#include <xfs/xfs.h>
#include "common/errno.h"
+#include "common/linux_version.h"
#include "include/assert.h"
#include "include/compat.h"
// aff3a9edb7080f69f07fe76a8bd089b3dfa4cb5d
// for this set_extsize bug
// http://oss.sgi.com/bugzilla/show_bug.cgi?id=874
- struct utsname u;
- int r = uname(&u);
- assert(r == 0);
- int major = 0, minor = 0, patch = 0;
- r = sscanf(u.release, "%d.%d.%d", &major, &minor, &patch);
- if (r != 3) {
- ret = 0;
- dout(0) << __func__ << ": failed to parse kernel version "
- << u.release << " to verify extsize not buggy, disabling extsize"
- << dendl;
+ int ver = get_linux_version();
+ if (ver == 0) {
+ dout(0) << __func__ << ": couldn't verify extsize not buggy, disabling extsize" << dendl;
m_has_extsize = false;
- } else if (major < 3 || (major == 3 && minor < 5)) {
- dout(0) << __func__ << ": disabling extsize, kernel " << u.release
- << " is older than 3.5 and has buggy extsize ioctl" << dendl;
+ } else if (ver < KERNEL_VERSION(3, 5, 0)) {
+ dout(0) << __func__ << ": disabling extsize, your kernel < 3.5 and has buggy extsize ioctl" << dendl;
m_has_extsize = false;
} else {
- dout(0) << "detect_feature: extsize is supported and kernel "
- << u.release << " >= 3.5" << dendl;
+ dout(0) << __func__ << ": extsize is supported and your kernel >= 3.5" << dendl;
m_has_extsize = true;
}
} else {