Path: blob/master/drivers/block/drbd/drbd_strings.c
15180 views
/*1drbd.h23This file is part of DRBD by Philipp Reisner and Lars Ellenberg.45Copyright (C) 2003-2008, LINBIT Information Technologies GmbH.6Copyright (C) 2003-2008, Philipp Reisner <[email protected]>.7Copyright (C) 2003-2008, Lars Ellenberg <[email protected]>.89drbd is free software; you can redistribute it and/or modify10it under the terms of the GNU General Public License as published by11the Free Software Foundation; either version 2, or (at your option)12any later version.1314drbd is distributed in the hope that it will be useful,15but WITHOUT ANY WARRANTY; without even the implied warranty of16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the17GNU General Public License for more details.1819You should have received a copy of the GNU General Public License20along with drbd; see the file COPYING. If not, write to21the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.2223*/2425#include <linux/drbd.h>2627static const char *drbd_conn_s_names[] = {28[C_STANDALONE] = "StandAlone",29[C_DISCONNECTING] = "Disconnecting",30[C_UNCONNECTED] = "Unconnected",31[C_TIMEOUT] = "Timeout",32[C_BROKEN_PIPE] = "BrokenPipe",33[C_NETWORK_FAILURE] = "NetworkFailure",34[C_PROTOCOL_ERROR] = "ProtocolError",35[C_WF_CONNECTION] = "WFConnection",36[C_WF_REPORT_PARAMS] = "WFReportParams",37[C_TEAR_DOWN] = "TearDown",38[C_CONNECTED] = "Connected",39[C_STARTING_SYNC_S] = "StartingSyncS",40[C_STARTING_SYNC_T] = "StartingSyncT",41[C_WF_BITMAP_S] = "WFBitMapS",42[C_WF_BITMAP_T] = "WFBitMapT",43[C_WF_SYNC_UUID] = "WFSyncUUID",44[C_SYNC_SOURCE] = "SyncSource",45[C_SYNC_TARGET] = "SyncTarget",46[C_PAUSED_SYNC_S] = "PausedSyncS",47[C_PAUSED_SYNC_T] = "PausedSyncT",48[C_VERIFY_S] = "VerifyS",49[C_VERIFY_T] = "VerifyT",50[C_AHEAD] = "Ahead",51[C_BEHIND] = "Behind",52};5354static const char *drbd_role_s_names[] = {55[R_PRIMARY] = "Primary",56[R_SECONDARY] = "Secondary",57[R_UNKNOWN] = "Unknown"58};5960static const char *drbd_disk_s_names[] = {61[D_DISKLESS] = "Diskless",62[D_ATTACHING] = "Attaching",63[D_FAILED] = "Failed",64[D_NEGOTIATING] = "Negotiating",65[D_INCONSISTENT] = "Inconsistent",66[D_OUTDATED] = "Outdated",67[D_UNKNOWN] = "DUnknown",68[D_CONSISTENT] = "Consistent",69[D_UP_TO_DATE] = "UpToDate",70};7172static const char *drbd_state_sw_errors[] = {73[-SS_TWO_PRIMARIES] = "Multiple primaries not allowed by config",74[-SS_NO_UP_TO_DATE_DISK] = "Need access to UpToDate data",75[-SS_NO_LOCAL_DISK] = "Can not resync without local disk",76[-SS_NO_REMOTE_DISK] = "Can not resync without remote disk",77[-SS_CONNECTED_OUTDATES] = "Refusing to be Outdated while Connected",78[-SS_PRIMARY_NOP] = "Refusing to be Primary while peer is not outdated",79[-SS_RESYNC_RUNNING] = "Can not start OV/resync since it is already active",80[-SS_ALREADY_STANDALONE] = "Can not disconnect a StandAlone device",81[-SS_CW_FAILED_BY_PEER] = "State change was refused by peer node",82[-SS_IS_DISKLESS] = "Device is diskless, the requested operation requires a disk",83[-SS_DEVICE_IN_USE] = "Device is held open by someone",84[-SS_NO_NET_CONFIG] = "Have no net/connection configuration",85[-SS_NO_VERIFY_ALG] = "Need a verify algorithm to start online verify",86[-SS_NEED_CONNECTION] = "Need a connection to start verify or resync",87[-SS_NOT_SUPPORTED] = "Peer does not support protocol",88[-SS_LOWER_THAN_OUTDATED] = "Disk state is lower than outdated",89[-SS_IN_TRANSIENT_STATE] = "In transient state, retry after next state change",90[-SS_CONCURRENT_ST_CHG] = "Concurrent state changes detected and aborted",91};9293const char *drbd_conn_str(enum drbd_conns s)94{95/* enums are unsigned... */96return s > C_BEHIND ? "TOO_LARGE" : drbd_conn_s_names[s];97}9899const char *drbd_role_str(enum drbd_role s)100{101return s > R_SECONDARY ? "TOO_LARGE" : drbd_role_s_names[s];102}103104const char *drbd_disk_str(enum drbd_disk_state s)105{106return s > D_UP_TO_DATE ? "TOO_LARGE" : drbd_disk_s_names[s];107}108109const char *drbd_set_st_err_str(enum drbd_state_rv err)110{111return err <= SS_AFTER_LAST_ERROR ? "TOO_SMALL" :112err > SS_TWO_PRIMARIES ? "TOO_LARGE"113: drbd_state_sw_errors[-err];114}115116117