diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:54:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:54:28 +0000 |
commit | e6918187568dbd01842d8d1d2c808ce16a894239 (patch) | |
tree | 64f88b554b444a49f656b6c656111a145cbbaa28 /src/include/win32 | |
parent | Initial commit. (diff) | |
download | ceph-b26c4052f3542036551aa9dec9caa4226e456195.tar.xz ceph-b26c4052f3542036551aa9dec9caa4226e456195.zip |
Adding upstream version 18.2.2.upstream/18.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/include/win32')
-rw-r--r-- | src/include/win32/arpa/inet.h | 1 | ||||
-rw-r--r-- | src/include/win32/dlfcn.h | 1 | ||||
-rw-r--r-- | src/include/win32/fs_compat.h | 47 | ||||
-rw-r--r-- | src/include/win32/ifaddrs.h | 39 | ||||
-rw-r--r-- | src/include/win32/netdb.h | 1 | ||||
-rw-r--r-- | src/include/win32/netinet/in.h | 1 | ||||
-rw-r--r-- | src/include/win32/netinet/ip.h | 0 | ||||
-rw-r--r-- | src/include/win32/netinet/tcp.h | 0 | ||||
-rw-r--r-- | src/include/win32/poll.h | 1 | ||||
-rw-r--r-- | src/include/win32/sys/errno.h | 1 | ||||
-rw-r--r-- | src/include/win32/sys/select.h | 0 | ||||
-rw-r--r-- | src/include/win32/sys/socket.h | 1 | ||||
-rw-r--r-- | src/include/win32/sys/statvfs.h | 36 | ||||
-rw-r--r-- | src/include/win32/sys/uio.h | 1 | ||||
-rw-r--r-- | src/include/win32/sys/un.h | 1 | ||||
-rw-r--r-- | src/include/win32/syslog.h | 64 | ||||
-rw-r--r-- | src/include/win32/win32_errno.h | 146 | ||||
-rw-r--r-- | src/include/win32/winsock_compat.h | 39 | ||||
-rw-r--r-- | src/include/win32/winsock_wrapper.h | 27 |
19 files changed, 407 insertions, 0 deletions
diff --git a/src/include/win32/arpa/inet.h b/src/include/win32/arpa/inet.h new file mode 100644 index 000000000..44983f03f --- /dev/null +++ b/src/include/win32/arpa/inet.h @@ -0,0 +1 @@ +#include "winsock_compat.h" diff --git a/src/include/win32/dlfcn.h b/src/include/win32/dlfcn.h new file mode 100644 index 000000000..32e51f16f --- /dev/null +++ b/src/include/win32/dlfcn.h @@ -0,0 +1 @@ +#include "../dlfcn_compat.h" diff --git a/src/include/win32/fs_compat.h b/src/include/win32/fs_compat.h new file mode 100644 index 000000000..deeedf071 --- /dev/null +++ b/src/include/win32/fs_compat.h @@ -0,0 +1,47 @@ +/* + * Ceph - scalable distributed file system + * + * Copyright (C) 2021 SUSE LINUX GmbH + * + * 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. + * + */ + +// Those definitions allow handling information coming from Ceph and should +// not be passed to Windows functions. + +#pragma once + +#define S_IFLNK 0120000 + +#define S_ISTYPE(m, TYPE) ((m & S_IFMT) == TYPE) +#define S_ISLNK(m) S_ISTYPE(m, S_IFLNK) +#define S_ISUID 04000 +#define S_ISGID 02000 +#define S_ISVTX 01000 + +#define LOCK_SH 1 +#define LOCK_EX 2 +#define LOCK_NB 4 +#define LOCK_UN 8 +#define LOCK_MAND 32 +#define LOCK_READ 64 +#define LOCK_WRITE 128 +#define LOCK_RW 192 + +#define AT_SYMLINK_NOFOLLOW 0x100 +#define AT_REMOVEDIR 0x200 + +#define MAXSYMLINKS 65000 + +#define O_DIRECTORY 0200000 +#define O_NOFOLLOW 0400000 + +#define XATTR_CREATE 1 +#define XATTR_REPLACE 2 + +typedef unsigned int uid_t; +typedef unsigned int gid_t; diff --git a/src/include/win32/ifaddrs.h b/src/include/win32/ifaddrs.h new file mode 100644 index 000000000..45e1a362c --- /dev/null +++ b/src/include/win32/ifaddrs.h @@ -0,0 +1,39 @@ +// -*- 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) 2002-2016 Free Software Foundation, Inc. + * Copyright (C) 2019 SUSE LINUX GmbH + * + * 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. + * + */ + +#ifndef IFADDRS_H +#define IFADDRS_H + +#include "winsock_compat.h" +#include <ifdef.h> + +struct ifaddrs { + struct ifaddrs *ifa_next; /* Next item in list */ + char *ifa_name; /* Name of interface */ + unsigned int ifa_flags; /* Flags from SIOCGIFFLAGS */ + struct sockaddr *ifa_addr; /* Address of interface */ + struct sockaddr *ifa_netmask; /* Netmask of interface */ + + struct sockaddr_storage in_addrs; + struct sockaddr_storage in_netmasks; + + char ad_name[IF_MAX_STRING_SIZE]; + size_t speed; +}; + +int getifaddrs(struct ifaddrs **ifap); +void freeifaddrs(struct ifaddrs *ifa); + +#endif diff --git a/src/include/win32/netdb.h b/src/include/win32/netdb.h new file mode 100644 index 000000000..44983f03f --- /dev/null +++ b/src/include/win32/netdb.h @@ -0,0 +1 @@ +#include "winsock_compat.h" diff --git a/src/include/win32/netinet/in.h b/src/include/win32/netinet/in.h new file mode 100644 index 000000000..44983f03f --- /dev/null +++ b/src/include/win32/netinet/in.h @@ -0,0 +1 @@ +#include "winsock_compat.h" diff --git a/src/include/win32/netinet/ip.h b/src/include/win32/netinet/ip.h new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/src/include/win32/netinet/ip.h diff --git a/src/include/win32/netinet/tcp.h b/src/include/win32/netinet/tcp.h new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/src/include/win32/netinet/tcp.h diff --git a/src/include/win32/poll.h b/src/include/win32/poll.h new file mode 100644 index 000000000..44983f03f --- /dev/null +++ b/src/include/win32/poll.h @@ -0,0 +1 @@ +#include "winsock_compat.h" diff --git a/src/include/win32/sys/errno.h b/src/include/win32/sys/errno.h new file mode 100644 index 000000000..339f4fc10 --- /dev/null +++ b/src/include/win32/sys/errno.h @@ -0,0 +1 @@ +#include <errno.h> diff --git a/src/include/win32/sys/select.h b/src/include/win32/sys/select.h new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/src/include/win32/sys/select.h diff --git a/src/include/win32/sys/socket.h b/src/include/win32/sys/socket.h new file mode 100644 index 000000000..44983f03f --- /dev/null +++ b/src/include/win32/sys/socket.h @@ -0,0 +1 @@ +#include "winsock_compat.h" diff --git a/src/include/win32/sys/statvfs.h b/src/include/win32/sys/statvfs.h new file mode 100644 index 000000000..73a892b88 --- /dev/null +++ b/src/include/win32/sys/statvfs.h @@ -0,0 +1,36 @@ +#ifndef _SYS_STATVFS_H +#define _SYS_STATVFS_H 1 + +typedef unsigned __int64 fsfilcnt64_t; +typedef unsigned __int64 fsblkcnt64_t; +typedef unsigned __int64 fsblkcnt_t; + +struct statvfs +{ + unsigned long int f_bsize; + unsigned long int f_frsize; + fsblkcnt64_t f_blocks; + fsblkcnt64_t f_bfree; + fsblkcnt64_t f_bavail; + fsfilcnt64_t f_files; + fsfilcnt64_t f_ffree; + fsfilcnt64_t f_favail; + unsigned long int f_fsid; + unsigned long int f_flag; + unsigned long int f_namemax; + int __f_spare[6]; +}; +struct flock { + short l_type; + short l_whence; + off_t l_start; + off_t l_len; + pid_t l_pid; +}; + +#define F_RDLCK 0 +#define F_WRLCK 1 +#define F_UNLCK 2 +#define F_SETLK 6 + +#endif /* _SYS_STATVFS_H */ diff --git a/src/include/win32/sys/uio.h b/src/include/win32/sys/uio.h new file mode 100644 index 000000000..15e95be7f --- /dev/null +++ b/src/include/win32/sys/uio.h @@ -0,0 +1 @@ +#include "include/compat.h" diff --git a/src/include/win32/sys/un.h b/src/include/win32/sys/un.h new file mode 100644 index 000000000..d08940b2c --- /dev/null +++ b/src/include/win32/sys/un.h @@ -0,0 +1 @@ +#include "include/win32/winsock_compat.h" diff --git a/src/include/win32/syslog.h b/src/include/win32/syslog.h new file mode 100644 index 000000000..28389e0b9 --- /dev/null +++ b/src/include/win32/syslog.h @@ -0,0 +1,64 @@ +/* + * Copyright 2013, 2015 Cloudbase Solutions Srl + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License.You may obtain + * a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +#ifndef SYSLOG_H +#define SYSLOG_H 1 + +#define LOG_EMERG 0 /* system is unusable */ +#define LOG_ALERT 1 /* action must be taken immediately */ +#define LOG_CRIT 2 /* critical conditions */ +#define LOG_ERR 3 /* error conditions */ +#define LOG_WARNING 4 /* warning conditions */ +#define LOG_NOTICE 5 /* normal but significant condition */ +#define LOG_INFO 6 /* informational */ +#define LOG_DEBUG 7 /* debug-level messages */ + +#define LOG_KERN (0<<3) /* kernel messages */ +#define LOG_USER (1<<3) /* user-level messages */ +#define LOG_MAIL (2<<3) /* mail system */ +#define LOG_DAEMON (3<<3) /* system daemons */ +#define LOG_AUTH (4<<3) /* security/authorization messages */ +#define LOG_SYSLOG (5<<3) /* messages generated internally by syslogd */ +#define LOG_LPR (6<<3) /* line printer subsystem */ +#define LOG_NEWS (7<<3) /* network news subsystem */ +#define LOG_UUCP (8<<3) /* UUCP subsystem */ +#define LOG_CRON (9<<3) /* clock daemon */ +#define LOG_AUTHPRIV (10<<3) /* security/authorization messages */ +#define LOG_FTP (11<<3) /* FTP daemon */ + +#define LOG_LOCAL0 (16<<3) /* reserved for local use */ +#define LOG_LOCAL1 (17<<3) /* reserved for local use */ +#define LOG_LOCAL2 (18<<3) /* reserved for local use */ +#define LOG_LOCAL3 (19<<3) /* reserved for local use */ +#define LOG_LOCAL4 (20<<3) /* reserved for local use */ +#define LOG_LOCAL5 (21<<3) /* reserved for local use */ +#define LOG_LOCAL6 (22<<3) /* reserved for local use */ +#define LOG_LOCAL7 (23<<3) /* reserved for local use */ + +#define LOG_PRIMASK 0x07 /* mask to extract priority part (internal) */ + /* extract priority */ +#define LOG_PRI(p) ((p) & LOG_PRIMASK) + + +static inline void +openlog(const char *ident, int option, int facility) +{ +} + +void +syslog(int priority, const char *format, ...); + +#endif /* syslog.h */ diff --git a/src/include/win32/win32_errno.h b/src/include/win32/win32_errno.h new file mode 100644 index 000000000..dd8ff8474 --- /dev/null +++ b/src/include/win32/win32_errno.h @@ -0,0 +1,146 @@ +// -*- 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) 2020 SUSE LINUX GmbH + * + * 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. + * + */ + +// We're going to preserve the error numbers defined by the Windows SDK but not +// by Mingw headers. For others, we're going to use numbers greater than 256 to +// avoid unintended overlaps. + +#ifndef WIN32_ERRNO_H +#define WIN32_ERRNO_H 1 + +#include <errno.h> + +#include "include/int_types.h" + +#ifndef EBADMSG +#define EBADMSG 104 +#endif + +#ifndef ENODATA +#define ENODATA 120 +#endif + +#ifndef ENOLINK +#define ENOLINK 121 +#endif + +#ifndef ENOMSG +#define ENOMSG 122 +#endif + +#ifndef ENOTRECOVERABLE +#define ENOTRECOVERABLE 127 +#endif + +#ifndef ETIME +#define ETIME 137 +#endif + +#ifndef ETXTBSY +#define ETXTBSY 139 +#endif + +#ifndef ENODATA +#define ENODATA 120 +#endif + +#define ESTALE 256 +#define EREMOTEIO 257 + +#ifndef EBADE +#define EBADE 258 +#endif + +#define EUCLEAN 259 +#define EREMCHG 260 +#define EKEYREJECTED 261 +#define EREMOTE 262 + +// Not used at moment. Full coverage ensures that remote errors will be +// converted and handled properly. +#define EADV 263 +#define EBADFD 264 +#define EBADR 265 +#define EBADRQC 266 +#define EBADSLT 267 +#define EBFONT 268 +#define ECHRNG 269 +#define ECOMM 270 +#define EDOTDOT 271 +#define EHOSTDOWN 272 +#define EHWPOISON 273 +// Defined by Boost. +#ifndef EIDRM +#define EIDRM 274 +#endif +#define EISNAM 275 +#define EKEYEXPIRED 276 +#define EKEYREVOKED 277 +#define EL2HLT 278 +#define EL2NSYNC 279 +#define EL3HLT 280 +#define EL3RST 281 +#define ELIBACC 282 +#define ELIBBAD 283 +#define ELIBEXEC 284 +#define ELIBMAX 285 +#define ELIBSCN 286 +#define ELNRNG 287 +#define EMEDIUMTYPE 288 +#define EMULTIHOP 289 +#define ENAVAIL 290 +#define ENOANO 291 +#define ENOCSI 292 +#define ENOKEY 293 +#define ENOMEDIUM 294 +#define ENONET 295 +#define ENOPKG 296 +#ifndef ENOSR +#define ENOSR 297 +#endif +#ifndef ENOSTR +#define ENOSTR 298 +#endif +#define ENOTNAM 299 +#define ENOTUNIQ 300 +#define EPFNOSUPPORT 301 +#define ERFKILL 302 +#define ESOCKTNOSUPPORT 303 +#define ESRMNT 304 +#define ESTRPIPE 305 +#define ETOOMANYREFS 306 +#define EUNATCH 307 +#define EUSERS 308 +#define EXFULL 309 +#define ENOTBLK 310 + +#ifndef EDQUOT +#define EDQUOT 311 +#endif + +#define ESHUTDOWN 312 + +#ifdef __cplusplus +extern "C" { +#endif + +__s32 wsae_to_errno(__s32 r); +__u32 errno_to_ntstatus(__s32 r); +__u32 cephfs_errno_to_ntstatus_map(int cephfs_errno); + +#ifdef __cplusplus +} +#endif + +#endif // WIN32_ERRNO_H diff --git a/src/include/win32/winsock_compat.h b/src/include/win32/winsock_compat.h new file mode 100644 index 000000000..990cc4823 --- /dev/null +++ b/src/include/win32/winsock_compat.h @@ -0,0 +1,39 @@ +// -*- 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) 2019 SUSE LLC + * + * 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. + * + */ + +#ifndef WINSOCK_COMPAT_H +#define WINSOCK_COMPAT_H 1 + +#include "winsock_wrapper.h" + +#ifndef poll +#define poll WSAPoll +#endif + +// afunix.h is available starting with Windows SDK 17063. Still, it wasn't +// picked up by mingw yet, for which reason we're going to define sockaddr_un +// here. +#ifndef _AFUNIX_ +#define UNIX_PATH_MAX 108 + +typedef struct sockaddr_un +{ + ADDRESS_FAMILY sun_family; /* AF_UNIX */ + char sun_path[UNIX_PATH_MAX]; /* pathname */ +} SOCKADDR_UN, *PSOCKADDR_UN; + +#define SIO_AF_UNIX_GETPEERPID _WSAIOR(IOC_VENDOR, 256) +#endif /* _AFUNIX */ + +#endif /* WINSOCK_COMPAT_H */ diff --git a/src/include/win32/winsock_wrapper.h b/src/include/win32/winsock_wrapper.h new file mode 100644 index 000000000..1bb951a9d --- /dev/null +++ b/src/include/win32/winsock_wrapper.h @@ -0,0 +1,27 @@ +// -*- 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) 2020 SUSE LLC + * + * 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. + * + */ + +#ifndef WINSOCK_WRAPPER_H +#define WINSOCK_WRAPPER_H 1 + +#ifdef __cplusplus +// Boost complains if winsock2.h (or windows.h) is included before asio.hpp. +#include <boost/asio.hpp> +#endif + +#include <winsock2.h> +#include <ws2ipdef.h> +#include <ws2tcpip.h> + +#endif /* WINSOCK_WRAPPER_H */ |