]> git.proxmox.com Git - ceph.git/blob - ceph/src/global/global_context.cc
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / global / global_context.cc
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) 2011 New Dream Network
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 #include "common/ceph_context.h"
16 #include "global/global_context.h"
17
18 #include <string.h>
19
20
21 /*
22 * Global variables for use from process context.
23 */
24 CephContext *g_ceph_context = NULL;
25 ConfigProxy& g_conf() {
26 #ifdef WITH_SEASTAR
27 return ceph::common::local_conf();
28 #else
29 return g_ceph_context->_conf;
30 #endif
31 }
32
33 const char *g_assert_file = 0;
34 int g_assert_line = 0;
35 const char *g_assert_func = 0;
36 const char *g_assert_condition = 0;
37 unsigned long long g_assert_thread = 0;
38 char g_assert_thread_name[4096] = { 0 };
39 char g_assert_msg[8096] = { 0 };
40 char g_process_name[NAME_MAX + 1] = { 0 };
41
42 bool g_eio = false;
43 char g_eio_devname[1024] = { 0 };
44 char g_eio_path[PATH_MAX] = { 0 };
45 int g_eio_error = 0; // usually -EIO...
46 int g_eio_iotype = 0; // 1 = read, 2 = write
47 unsigned long long g_eio_offset = 0;
48 unsigned long long g_eio_length = 0;
49
50 int note_io_error_event(
51 const char *devname,
52 const char *path,
53 int error,
54 int iotype,
55 unsigned long long offset,
56 unsigned long long length)
57 {
58 g_eio = true;
59 if (devname) {
60 strncpy(g_eio_devname, devname, sizeof(g_eio_devname));
61 }
62 if (path) {
63 strncpy(g_eio_path, path, sizeof(g_eio_path));
64 }
65 g_eio_error = error;
66 g_eio_iotype = iotype;
67 g_eio_offset = offset;
68 g_eio_length = length;
69 return 0;
70 }