root/drivers/block/drbd/drbd_strings.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. drbd_conn_str
  2. drbd_role_str
  3. drbd_disk_str
  4. drbd_set_st_err_str

   1 // SPDX-License-Identifier: GPL-2.0-or-later
   2 /*
   3   drbd.h
   4 
   5   This file is part of DRBD by Philipp Reisner and Lars Ellenberg.
   6 
   7   Copyright (C) 2003-2008, LINBIT Information Technologies GmbH.
   8   Copyright (C) 2003-2008, Philipp Reisner <philipp.reisner@linbit.com>.
   9   Copyright (C) 2003-2008, Lars Ellenberg <lars.ellenberg@linbit.com>.
  10 
  11 
  12 */
  13 
  14 #include <linux/drbd.h>
  15 #include "drbd_strings.h"
  16 
  17 static const char * const drbd_conn_s_names[] = {
  18         [C_STANDALONE]       = "StandAlone",
  19         [C_DISCONNECTING]    = "Disconnecting",
  20         [C_UNCONNECTED]      = "Unconnected",
  21         [C_TIMEOUT]          = "Timeout",
  22         [C_BROKEN_PIPE]      = "BrokenPipe",
  23         [C_NETWORK_FAILURE]  = "NetworkFailure",
  24         [C_PROTOCOL_ERROR]   = "ProtocolError",
  25         [C_WF_CONNECTION]    = "WFConnection",
  26         [C_WF_REPORT_PARAMS] = "WFReportParams",
  27         [C_TEAR_DOWN]        = "TearDown",
  28         [C_CONNECTED]        = "Connected",
  29         [C_STARTING_SYNC_S]  = "StartingSyncS",
  30         [C_STARTING_SYNC_T]  = "StartingSyncT",
  31         [C_WF_BITMAP_S]      = "WFBitMapS",
  32         [C_WF_BITMAP_T]      = "WFBitMapT",
  33         [C_WF_SYNC_UUID]     = "WFSyncUUID",
  34         [C_SYNC_SOURCE]      = "SyncSource",
  35         [C_SYNC_TARGET]      = "SyncTarget",
  36         [C_PAUSED_SYNC_S]    = "PausedSyncS",
  37         [C_PAUSED_SYNC_T]    = "PausedSyncT",
  38         [C_VERIFY_S]         = "VerifyS",
  39         [C_VERIFY_T]         = "VerifyT",
  40         [C_AHEAD]            = "Ahead",
  41         [C_BEHIND]           = "Behind",
  42 };
  43 
  44 static const char * const drbd_role_s_names[] = {
  45         [R_PRIMARY]   = "Primary",
  46         [R_SECONDARY] = "Secondary",
  47         [R_UNKNOWN]   = "Unknown"
  48 };
  49 
  50 static const char * const drbd_disk_s_names[] = {
  51         [D_DISKLESS]     = "Diskless",
  52         [D_ATTACHING]    = "Attaching",
  53         [D_FAILED]       = "Failed",
  54         [D_NEGOTIATING]  = "Negotiating",
  55         [D_INCONSISTENT] = "Inconsistent",
  56         [D_OUTDATED]     = "Outdated",
  57         [D_UNKNOWN]      = "DUnknown",
  58         [D_CONSISTENT]   = "Consistent",
  59         [D_UP_TO_DATE]   = "UpToDate",
  60 };
  61 
  62 static const char * const drbd_state_sw_errors[] = {
  63         [-SS_TWO_PRIMARIES] = "Multiple primaries not allowed by config",
  64         [-SS_NO_UP_TO_DATE_DISK] = "Need access to UpToDate data",
  65         [-SS_NO_LOCAL_DISK] = "Can not resync without local disk",
  66         [-SS_NO_REMOTE_DISK] = "Can not resync without remote disk",
  67         [-SS_CONNECTED_OUTDATES] = "Refusing to be Outdated while Connected",
  68         [-SS_PRIMARY_NOP] = "Refusing to be Primary while peer is not outdated",
  69         [-SS_RESYNC_RUNNING] = "Can not start OV/resync since it is already active",
  70         [-SS_ALREADY_STANDALONE] = "Can not disconnect a StandAlone device",
  71         [-SS_CW_FAILED_BY_PEER] = "State change was refused by peer node",
  72         [-SS_IS_DISKLESS] = "Device is diskless, the requested operation requires a disk",
  73         [-SS_DEVICE_IN_USE] = "Device is held open by someone",
  74         [-SS_NO_NET_CONFIG] = "Have no net/connection configuration",
  75         [-SS_NO_VERIFY_ALG] = "Need a verify algorithm to start online verify",
  76         [-SS_NEED_CONNECTION] = "Need a connection to start verify or resync",
  77         [-SS_NOT_SUPPORTED] = "Peer does not support protocol",
  78         [-SS_LOWER_THAN_OUTDATED] = "Disk state is lower than outdated",
  79         [-SS_IN_TRANSIENT_STATE] = "In transient state, retry after next state change",
  80         [-SS_CONCURRENT_ST_CHG] = "Concurrent state changes detected and aborted",
  81         [-SS_OUTDATE_WO_CONN] = "Need a connection for a graceful disconnect/outdate peer",
  82         [-SS_O_VOL_PEER_PRI] = "Other vol primary on peer not allowed by config",
  83 };
  84 
  85 const char *drbd_conn_str(enum drbd_conns s)
  86 {
  87         /* enums are unsigned... */
  88         return s > C_BEHIND ? "TOO_LARGE" : drbd_conn_s_names[s];
  89 }
  90 
  91 const char *drbd_role_str(enum drbd_role s)
  92 {
  93         return s > R_SECONDARY   ? "TOO_LARGE" : drbd_role_s_names[s];
  94 }
  95 
  96 const char *drbd_disk_str(enum drbd_disk_state s)
  97 {
  98         return s > D_UP_TO_DATE    ? "TOO_LARGE" : drbd_disk_s_names[s];
  99 }
 100 
 101 const char *drbd_set_st_err_str(enum drbd_state_rv err)
 102 {
 103         return err <= SS_AFTER_LAST_ERROR ? "TOO_SMALL" :
 104                err > SS_TWO_PRIMARIES ? "TOO_LARGE"
 105                         : drbd_state_sw_errors[-err];
 106 }

/* [<][>][^][v][top][bottom][index][help] */