diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/ceph_fs.h | 4 | ||||
-rw-r--r-- | src/include/cephfs/ceph_ll_client.h | 3 | ||||
-rw-r--r-- | src/include/cephfs/libcephfs.h | 4 | ||||
-rw-r--r-- | src/include/compat.h | 51 | ||||
-rw-r--r-- | src/include/elist.h | 4 | ||||
-rw-r--r-- | src/include/rados/librados.hpp | 34 | ||||
-rw-r--r-- | src/include/random.h | 4 | ||||
-rw-r--r-- | src/include/str_list.h | 1 | ||||
-rw-r--r-- | src/include/uuid.h | 4 |
9 files changed, 47 insertions, 62 deletions
diff --git a/src/include/ceph_fs.h b/src/include/ceph_fs.h index 627f4a3e85b..137669c1963 100644 --- a/src/include/ceph_fs.h +++ b/src/include/ceph_fs.h @@ -1005,7 +1005,7 @@ extern const char *ceph_cap_op_name(int op); /* extra info for cap import/export */ struct ceph_mds_cap_peer { __le64 cap_id; - __le32 seq; + __le32 issue_seq; __le32 mseq; __le32 mds; __u8 flags; @@ -1058,7 +1058,7 @@ struct ceph_mds_cap_release { struct ceph_mds_cap_item { __le64 ino; __le64 cap_id; - __le32 migrate_seq, seq; + __le32 migrate_seq, issue_seq; } __attribute__ ((packed)); #define CEPH_MDS_LEASE_REVOKE 1 /* mds -> client */ diff --git a/src/include/cephfs/ceph_ll_client.h b/src/include/cephfs/ceph_ll_client.h index ac5b7c22471..458edce590b 100644 --- a/src/include/cephfs/ceph_ll_client.h +++ b/src/include/cephfs/ceph_ll_client.h @@ -110,6 +110,9 @@ struct ceph_statx { * others in the future, we disallow setting any that aren't recognized. */ #define CEPH_REQ_FLAG_MASK (AT_SYMLINK_NOFOLLOW|AT_STATX_DONT_SYNC) +#if defined(__linux__) && defined(AT_EMPTY_PATH) +#define CEPH_AT_EMPTY_PATH (CEPH_REQ_FLAG_MASK|AT_EMPTY_PATH) +#endif /* fallocate mode flags */ #ifndef FALLOC_FL_KEEP_SIZE diff --git a/src/include/cephfs/libcephfs.h b/src/include/cephfs/libcephfs.h index ba0b76e072b..f26eabfbd5c 100644 --- a/src/include/cephfs/libcephfs.h +++ b/src/include/cephfs/libcephfs.h @@ -937,7 +937,7 @@ int ceph_fstatx(struct ceph_mount_info *cmount, int fd, struct ceph_statx *stx, * @param relpath to the file/directory to get statistics of * @param stx the ceph_statx struct that will be filled in with the file's statistics. * @param want bitfield of CEPH_STATX_* flags showing designed attributes - * @param flags bitfield that can be used to set AT_* modifier flags (AT_STATX_SYNC_AS_STAT, AT_STATX_FORCE_SYNC, AT_STATX_DONT_SYNC and AT_SYMLINK_NOFOLLOW) + * @param flags bitfield that can be used to set AT_* modifier flags (AT_STATX_DONT_SYNC, AT_SYMLINK_NOFOLLOW and AT_EMPTY_PATH) * @returns 0 on success or negative error code on failure. */ int ceph_statxat(struct ceph_mount_info *cmount, int dirfd, const char *relpath, @@ -1104,7 +1104,7 @@ int ceph_lchown(struct ceph_mount_info *cmount, const char *path, int uid, int g * @param relpath the relpath of the file/directory to change the ownership of. * @param uid the user id to set on the file/directory. * @param gid the group id to set on the file/directory. - * @param flags bitfield that can be used to set AT_* modifier flags (AT_SYMLINK_NOFOLLOW) + * @param flags bitfield that can be used to set AT_* modifier flags (AT_SYMLINK_NOFOLLOW and AT_EMPTY_PATH) * @returns 0 on success or negative error code on failure. */ int ceph_chownat(struct ceph_mount_info *cmount, int dirfd, const char *relpath, diff --git a/src/include/compat.h b/src/include/compat.h index 53285243d91..a7d10fc5425 100644 --- a/src/include/compat.h +++ b/src/include/compat.h @@ -179,60 +179,12 @@ struct cpu_set_t; #define MSG_DONTWAIT MSG_NONBLOCK #endif -/* compiler warning free success noop */ -#define pthread_setname_noop_helper(thread, name) ({ \ - int __i = 0; \ - __i; }) - -#define pthread_getname_noop_helper(thread, name, len) ({ \ - if (name != NULL) \ - *name = '\0'; \ - 0; }) - #define pthread_kill_unsupported_helper(thread, signal) ({ \ int __i = -ENOTSUP; \ __i; }) #if defined(_WIN32) && defined(__clang__) && \ !defined(_LIBCPP_HAS_THREAD_API_PTHREAD) - // In this case, llvm doesn't use the pthread api for std::thread. - // We cannot use native_handle() with the pthread api, nor can we pass - // it to Windows API functions. - #define ceph_pthread_setname pthread_setname_noop_helper -#elif defined(HAVE_PTHREAD_SETNAME_NP) - #if defined(__APPLE__) - #define ceph_pthread_setname(thread, name) ({ \ - int __result = 0; \ - if (thread == pthread_self()) \ - __result = pthread_setname_np(name); \ - __result; }) - #else - #define ceph_pthread_setname pthread_setname_np - #endif -#elif defined(HAVE_PTHREAD_SET_NAME_NP) - /* Fix a small name diff and return 0 */ - #define ceph_pthread_setname(thread, name) ({ \ - pthread_set_name_np(thread, name); \ - 0; }) -#else - #define ceph_pthread_setname pthread_setname_noop_helper -#endif - -#if defined(_WIN32) && defined(__clang__) && \ - !defined(_LIBCPP_HAS_THREAD_API_PTHREAD) - #define ceph_pthread_getname pthread_getname_noop_helper -#elif defined(HAVE_PTHREAD_GETNAME_NP) - #define ceph_pthread_getname pthread_getname_np -#elif defined(HAVE_PTHREAD_GET_NAME_NP) - #define ceph_pthread_getname(thread, name, len) ({ \ - pthread_get_name_np(thread, name, len); \ - 0; }) -#else - #define ceph_pthread_getname pthread_getname_noop_helper -#endif - -#if defined(_WIN32) && defined(__clang__) && \ - !defined(_LIBCPP_HAS_THREAD_API_PTHREAD) #define ceph_pthread_kill pthread_kill_unsupported_helper #else #define ceph_pthread_kill pthread_kill @@ -244,6 +196,9 @@ int ceph_posix_fallocate(int fd, off_t offset, off_t len); extern "C" { #endif +int ceph_pthread_getname(char* name, size_t size); +int ceph_pthread_setname(const char* name); + int pipe_cloexec(int pipefd[2], int flags); char *ceph_strerror_r(int errnum, char *buf, size_t buflen); unsigned get_page_size(); diff --git a/src/include/elist.h b/src/include/elist.h index edfb7955494..e777873b045 100644 --- a/src/include/elist.h +++ b/src/include/elist.h @@ -15,6 +15,10 @@ #ifndef CEPH_ELIST_H #define CEPH_ELIST_H +#include <cstddef> // for size_t + +#include "include/ceph_assert.h" + /* * elist: embedded list. * diff --git a/src/include/rados/librados.hpp b/src/include/rados/librados.hpp index 4a7ac3ea6e0..0f5a9036eff 100644 --- a/src/include/rados/librados.hpp +++ b/src/include/rados/librados.hpp @@ -202,6 +202,8 @@ inline namespace v14_2_0 { int set_complete_callback(void *cb_arg, callback_t cb); int set_safe_callback(void *cb_arg, callback_t cb) __attribute__ ((deprecated)); + /// Request immediate cancellation as if by IoCtx::aio_cancel(). + int cancel(); int wait_for_complete(); int wait_for_safe() __attribute__ ((deprecated)); int wait_for_complete_and_cb(); @@ -772,17 +774,30 @@ inline namespace v14_2_0 { void tier_evict(); }; - /* IoCtx : This is a context in which we can perform I/O. - * It includes a Pool, + /** + * @brief A handle to a RADOS pool used to perform I/O operations. * * Typical use (error checking omitted): - * + * @code * IoCtx p; * rados.ioctx_create("my_pool", p); - * p->stat(&stats); - * ... etc ... + * p.stat("my_object", &size, &mtime); + * @endcode + * + * IoCtx holds a pointer to its underlying implementation. The dup() + * method performs a deep copy of this implementation, but the copy + * construction and assignment operations perform shallow copies by + * sharing that pointer. + * + * Function names starting with aio_ are asynchronous operations that + * return immediately after submitting a request, and whose completions + * are managed by the given AioCompletion pointer. The IoCtx's underlying + * implementation is involved in the delivery of these completions, so + * the caller must guarantee that its lifetime is preserved until then - + * if not by preserving the IoCtx instance that submitted the request, + * then by a copied/moved instance that shares the same implementation. * - * NOTE: be sure to call watch_flush() prior to destroying any IoCtx + * @note Be sure to call watch_flush() prior to destroying any IoCtx * that is used for watch events to ensure that racing callbacks * have completed. */ @@ -791,9 +806,13 @@ inline namespace v14_2_0 { public: IoCtx(); static void from_rados_ioctx_t(rados_ioctx_t p, IoCtx &pool); + /// Construct a shallow copy of rhs, sharing its underlying implementation. IoCtx(const IoCtx& rhs); + /// Assign a shallow copy of rhs, sharing its underlying implementation. IoCtx& operator=(const IoCtx& rhs); + /// Move construct from rhs, transferring its underlying implementation. IoCtx(IoCtx&& rhs) noexcept; + /// Move assign from rhs, transferring its underlying implementation. IoCtx& operator=(IoCtx&& rhs) noexcept; ~IoCtx(); @@ -1150,7 +1169,8 @@ inline namespace v14_2_0 { int aio_stat2(const std::string& oid, AioCompletion *c, uint64_t *psize, struct timespec *pts); /** - * Cancel aio operation + * Request immediate cancellation with error code -ECANCELED + * if the operation hasn't already completed. * * @param c completion handle * @returns 0 on success, negative error code on failure diff --git a/src/include/random.h b/src/include/random.h index f2e3e37bcd7..6b7c9405efd 100644 --- a/src/include/random.h +++ b/src/include/random.h @@ -16,9 +16,9 @@ #define CEPH_RANDOM_H 1 #include <mutex> +#include <optional> #include <random> #include <type_traits> -#include <boost/optional.hpp> // Workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85494 #ifdef __MINGW32__ @@ -123,7 +123,7 @@ void randomize_rng() template <typename EngineT> EngineT& engine() { - thread_local boost::optional<EngineT> rng_engine; + thread_local std::optional<EngineT> rng_engine; if (!rng_engine) { rng_engine.emplace(EngineT()); diff --git a/src/include/str_list.h b/src/include/str_list.h index cad76c1d6f5..a4c7432c6ef 100644 --- a/src/include/str_list.h +++ b/src/include/str_list.h @@ -2,7 +2,6 @@ #define CEPH_STRLIST_H #include <list> -#include <set> #include <string> #include <string_view> #include <vector> diff --git a/src/include/uuid.h b/src/include/uuid.h index f6ef9878dae..a5d63c37297 100644 --- a/src/include/uuid.h +++ b/src/include/uuid.h @@ -60,7 +60,11 @@ struct uuid_d { } const char *bytes() const { +#if BOOST_VERSION >= 108600 + return (const char*)uuid.data(); +#else return (const char*)uuid.data; +#endif } void encode(::ceph::buffer::list::contiguous_appender& p) const { |