12522fe45SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only 2e7fd4179SDavid Teigland /****************************************************************************** 3e7fd4179SDavid Teigland ******************************************************************************* 4e7fd4179SDavid Teigland ** 5dbcfc347SDavid Teigland ** Copyright (C) 2005-2008 Red Hat, Inc. All rights reserved. 6e7fd4179SDavid Teigland ** 7e7fd4179SDavid Teigland ** 8e7fd4179SDavid Teigland ******************************************************************************* 9e7fd4179SDavid Teigland ******************************************************************************/ 10e7fd4179SDavid Teigland 11e7fd4179SDavid Teigland #include "dlm_internal.h" 12e7fd4179SDavid Teigland #include "rcom.h" 13e7fd4179SDavid Teigland #include "util.h" 14e7fd4179SDavid Teigland 15861e2369SDavid Teigland #define DLM_ERRNO_EDEADLK 35 16861e2369SDavid Teigland #define DLM_ERRNO_EBADR 53 17861e2369SDavid Teigland #define DLM_ERRNO_EBADSLT 57 18861e2369SDavid Teigland #define DLM_ERRNO_EPROTO 71 19861e2369SDavid Teigland #define DLM_ERRNO_EOPNOTSUPP 95 20861e2369SDavid Teigland #define DLM_ERRNO_ETIMEDOUT 110 21861e2369SDavid Teigland #define DLM_ERRNO_EINPROGRESS 115 22861e2369SDavid Teigland 23861e2369SDavid Teigland /* higher errno values are inconsistent across architectures, so select 24861e2369SDavid Teigland one set of values for on the wire */ 25861e2369SDavid Teigland 26*00e99ccdSAlexander Aring int to_dlm_errno(int err) 27861e2369SDavid Teigland { 28861e2369SDavid Teigland switch (err) { 29861e2369SDavid Teigland case -EDEADLK: 30861e2369SDavid Teigland return -DLM_ERRNO_EDEADLK; 31861e2369SDavid Teigland case -EBADR: 32861e2369SDavid Teigland return -DLM_ERRNO_EBADR; 33861e2369SDavid Teigland case -EBADSLT: 34861e2369SDavid Teigland return -DLM_ERRNO_EBADSLT; 35861e2369SDavid Teigland case -EPROTO: 36861e2369SDavid Teigland return -DLM_ERRNO_EPROTO; 37861e2369SDavid Teigland case -EOPNOTSUPP: 38861e2369SDavid Teigland return -DLM_ERRNO_EOPNOTSUPP; 39861e2369SDavid Teigland case -ETIMEDOUT: 40861e2369SDavid Teigland return -DLM_ERRNO_ETIMEDOUT; 41861e2369SDavid Teigland case -EINPROGRESS: 42861e2369SDavid Teigland return -DLM_ERRNO_EINPROGRESS; 43861e2369SDavid Teigland } 44861e2369SDavid Teigland return err; 45861e2369SDavid Teigland } 46861e2369SDavid Teigland 47*00e99ccdSAlexander Aring int from_dlm_errno(int err) 48861e2369SDavid Teigland { 49861e2369SDavid Teigland switch (err) { 50861e2369SDavid Teigland case -DLM_ERRNO_EDEADLK: 51861e2369SDavid Teigland return -EDEADLK; 52861e2369SDavid Teigland case -DLM_ERRNO_EBADR: 53861e2369SDavid Teigland return -EBADR; 54861e2369SDavid Teigland case -DLM_ERRNO_EBADSLT: 55861e2369SDavid Teigland return -EBADSLT; 56861e2369SDavid Teigland case -DLM_ERRNO_EPROTO: 57861e2369SDavid Teigland return -EPROTO; 58861e2369SDavid Teigland case -DLM_ERRNO_EOPNOTSUPP: 59861e2369SDavid Teigland return -EOPNOTSUPP; 60861e2369SDavid Teigland case -DLM_ERRNO_ETIMEDOUT: 61861e2369SDavid Teigland return -ETIMEDOUT; 62861e2369SDavid Teigland case -DLM_ERRNO_EINPROGRESS: 63861e2369SDavid Teigland return -EINPROGRESS; 64861e2369SDavid Teigland } 65861e2369SDavid Teigland return err; 66861e2369SDavid Teigland } 67