osdc/Striper.cc \
cls/lock/cls_lock_client.cc \
cls/lock/cls_lock_types.cc \
- cls/lock/cls_lock_ops.cc
+ cls/lock/cls_lock_ops.cc \
+ common/util.cc
librbd_la_CFLAGS = ${AM_CFLAGS} ${CRYPTO_CFLAGS}
librbd_la_CXXFLAGS = ${AM_CXXFLAGS}
librbd_la_LIBADD = librados.la
include/rbd/features.h\
include/rbd/librbd.h\
include/rbd/librbd.hpp\
+ include/util.h\
librados/AioCompletionImpl.h\
librados/IoCtxImpl.h\
librados/PoolAsyncCompletionImpl.h\
--- /dev/null
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+/*
+ * Ceph - scalable distributed file system
+ *
+ * Copyright (C) 2012 Inktank Storage, Inc.
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software
+ * Foundation. See file COPYING.
+ *
+ */
+
+#include "include/util.h"
+
+// test if an entire buf is zero in 8-byte chunks
+bool buf_is_zero(const char *buf, size_t len)
+{
+ size_t ofs;
+ int chunk = sizeof(uint64_t);
+
+ for (ofs = 0; ofs < len; ofs += sizeof(uint64_t)) {
+ if (*(uint64_t *)(buf + ofs) != 0) {
+ return false;
+ }
+ }
+ for (ofs = (len / chunk) * chunk; ofs < len; ofs++) {
+ if (buf[ofs] != '\0') {
+ return false;
+ }
+ }
+ return true;
+}
+
+
--- /dev/null
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+/*
+ * Ceph - scalable distributed file system
+ *
+ * Copyright (C) 2012 Inktank Storage, Inc.
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software
+ * Foundation. See file COPYING.
+ */
+
+// is buf~len completely zero (in 8-byte chunks)
+
+#include "include/types.h"
+
+bool buf_is_zero(const char *buf, size_t len);
+
#include "librbd/internal.h"
#include "librbd/parent_types.h"
+#include "include/util.h"
#define dout_subsys ceph_subsys_rbd
#undef dout_prefix
delete ictx;
}
- // test if an entire buf is zero in 8-byte chunks
- static bool buf_is_zero(char *buf, size_t len)
- {
- size_t ofs;
- int chunk = sizeof(uint64_t);
-
- for (ofs = 0; ofs < len; ofs += sizeof(uint64_t)) {
- if (*(uint64_t *)(buf + ofs) != 0) {
- return false;
- }
- }
- for (ofs = (len / chunk) * chunk; ofs < len; ofs++) {
- if (buf[ofs] != '\0') {
- return false;
- }
- }
- return true;
- }
-
// 'flatten' child image by copying all parent's blocks
int flatten(ImageCtx *ictx, ProgressContext &prog_ctx)
{