Skip to content

Commit 2ca8838

Browse files
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 <[email protected]>
1 parent c9b2336 commit 2ca8838

File tree

2 files changed

+34
-11
lines changed

2 files changed

+34
-11
lines changed

src/include/platform_errno.h

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2+
// vim: ts=8 sw=2 smarttab
3+
/*
4+
* Ceph - scalable distributed file system
5+
*
6+
* Copyright (C) 2004-2006 Sage Weil <[email protected]>
7+
*
8+
* This is free software; you can redistribute it and/or
9+
* modify it under the terms of the GNU Lesser General Public
10+
* License version 2.1, as published by the Free Software
11+
* Foundation. See file COPYING.
12+
*
13+
*/
14+
15+
/* XXX: This definitions are placed here so that it's easy to import them into
16+
* CephFS python bindings. Otherwise, entire src/include/types.h would needed to
17+
* be imported, which is unneccessary and also complicated.
18+
*/
19+
20+
#pragma once
21+
22+
#if defined(__sun) || defined(_AIX) || defined(__APPLE__) || \
23+
defined(__FreeBSD__) || defined(_WIN32)
24+
extern "C" {
25+
__s32 ceph_to_hostos_errno(__s32 e);
26+
__s32 hostos_to_ceph_errno(__s32 e);
27+
}
28+
#else
29+
#define ceph_to_hostos_errno(e) (e)
30+
#define hostos_to_ceph_errno(e) (e)
31+
#endif
32+
33+

src/include/types.h

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
// this is needed for ceph_fs to compile in userland
1818
#include "int_types.h"
1919
#include "byteorder.h"
20+
#include "platform_errno.h"
2021

2122
#include "uuid.h"
2223

@@ -518,17 +519,6 @@ struct shard_id_t {
518519
WRITE_CLASS_ENCODER(shard_id_t)
519520
std::ostream &operator<<(std::ostream &lhs, const shard_id_t &rhs);
520521

521-
#if defined(__sun) || defined(_AIX) || defined(__APPLE__) || \
522-
defined(__FreeBSD__) || defined(_WIN32)
523-
extern "C" {
524-
__s32 ceph_to_hostos_errno(__s32 e);
525-
__s32 hostos_to_ceph_errno(__s32 e);
526-
}
527-
#else
528-
#define ceph_to_hostos_errno(e) (e)
529-
#define hostos_to_ceph_errno(e) (e)
530-
#endif
531-
532522
struct errorcode32_t {
533523
using code_t = __s32;
534524
code_t code;

0 commit comments

Comments
 (0)