From: Rishabh Dave Date: Wed, 20 Aug 2025 07:41:04 +0000 (+0530) Subject: src/include: move ceph_to_hostos_errno() to separate header file X-Git-Tag: testing/wip-rishabh-testing-20251003.160027-debug~1^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=2ca88381cc5d9a2125900300b8d8e2e505fdb228;p=ceph-ci.git src/include: move ceph_to_hostos_errno() to separate header file Including src/include/types.h in src/pybind/cephfs/types.pxd leads to compilation error: "fatal error: acconfig.h: No such file or directory". types.h as well as int_types.h include acconfig.h header file. Move the code to be included in types.pxd to a separate file where acconfig.h won't be included, thus preventing this error. Signed-off-by: Rishabh Dave --- diff --git a/src/include/platform_errno.h b/src/include/platform_errno.h new file mode 100644 index 00000000000..b54636b2c44 --- /dev/null +++ b/src/include/platform_errno.h @@ -0,0 +1,33 @@ +// -*- 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) 2004-2006 Sage Weil + * + * 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. + * + */ + +/* XXX: This definitions are placed here so that it's easy to import them into + * CephFS python bindings. Otherwise, entire src/include/types.h would needed to + * be imported, which is unneccessary and also complicated. + */ + +#pragma once + +#if defined(__sun) || defined(_AIX) || defined(__APPLE__) || \ + defined(__FreeBSD__) || defined(_WIN32) +extern "C" { +__s32 ceph_to_hostos_errno(__s32 e); +__s32 hostos_to_ceph_errno(__s32 e); +} +#else +#define ceph_to_hostos_errno(e) (e) +#define hostos_to_ceph_errno(e) (e) +#endif + + diff --git a/src/include/types.h b/src/include/types.h index b52d5b27f69..6a9fc5c2175 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -17,6 +17,7 @@ // this is needed for ceph_fs to compile in userland #include "int_types.h" #include "byteorder.h" +#include "platform_errno.h" #include "uuid.h" @@ -518,17 +519,6 @@ struct shard_id_t { WRITE_CLASS_ENCODER(shard_id_t) std::ostream &operator<<(std::ostream &lhs, const shard_id_t &rhs); -#if defined(__sun) || defined(_AIX) || defined(__APPLE__) || \ - defined(__FreeBSD__) || defined(_WIN32) -extern "C" { -__s32 ceph_to_hostos_errno(__s32 e); -__s32 hostos_to_ceph_errno(__s32 e); -} -#else -#define ceph_to_hostos_errno(e) (e) -#define hostos_to_ceph_errno(e) (e) -#endif - struct errorcode32_t { using code_t = __s32; code_t code;