|
Packit Service |
75d76b |
/*
|
|
Packit Service |
75d76b |
* Copyright (c) 2020 Red Hat, Inc.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* This program is free software; you can redistribute it and/or
|
|
Packit Service |
75d76b |
* modify it under the terms of the GNU General Public License
|
|
Packit Service |
75d76b |
* as published by the Free Software Foundation; either version 2
|
|
Packit Service |
75d76b |
* of the License, or (at your option) any later version.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* This program is distributed in the hope that it will be useful,
|
|
Packit Service |
75d76b |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
75d76b |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit Service |
75d76b |
* GNU General Public License for more details.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* You should have received a copy of the GNU General Public License
|
|
Packit Service |
75d76b |
* along with this program; if not, write to the Free Software
|
|
Packit Service |
75d76b |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
Packit Service |
75d76b |
* 02110-1301, USA.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* $Id: //eng/vdo-releases/aluminum/src/c++/vdo/kernel/errors.h#1 $
|
|
Packit Service |
75d76b |
*/
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
#ifndef ERRORS_H
|
|
Packit Service |
75d76b |
#define ERRORS_H
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
#include <linux/types.h>
|
|
Packit Service |
75d76b |
#include "uds-error.h"
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
enum udsInternalErrorCodes {
|
|
Packit Service |
75d76b |
/** Used as a base value for reporting internal errors */
|
|
Packit Service |
75d76b |
UDS_INTERNAL_ERROR_CODE_BASE = 66560,
|
|
Packit Service |
75d76b |
/** Client/server protocol framing error */
|
|
Packit Service |
75d76b |
UDS_PROTOCOL_ERROR = UDS_INTERNAL_ERROR_CODE_BASE + 0,
|
|
Packit Service |
75d76b |
/** Index overflow */
|
|
Packit Service |
75d76b |
UDS_OVERFLOW = UDS_INTERNAL_ERROR_CODE_BASE + 1,
|
|
Packit Service |
75d76b |
/** Fill phase done (intended for albfill only) */
|
|
Packit Service |
75d76b |
UDS_FILLDONE = UDS_INTERNAL_ERROR_CODE_BASE + 2,
|
|
Packit Service |
75d76b |
/** Invalid argument passed to internal routine */
|
|
Packit Service |
75d76b |
UDS_INVALID_ARGUMENT = UDS_INTERNAL_ERROR_CODE_BASE + 3,
|
|
Packit Service |
75d76b |
/** UDS data structures are in an invalid state */
|
|
Packit Service |
75d76b |
UDS_BAD_STATE = UDS_INTERNAL_ERROR_CODE_BASE + 4,
|
|
Packit Service |
75d76b |
/** Attempt to enter the same name into an internal structure twice */
|
|
Packit Service |
75d76b |
UDS_DUPLICATE_NAME = UDS_INTERNAL_ERROR_CODE_BASE + 5,
|
|
Packit Service |
75d76b |
/** An internal protocol violation between system components */
|
|
Packit Service |
75d76b |
UDS_UNEXPECTED_RESULT = UDS_INTERNAL_ERROR_CODE_BASE + 6,
|
|
Packit Service |
75d76b |
/** An error created by test case processing */
|
|
Packit Service |
75d76b |
UDS_INJECTED_ERROR = UDS_INTERNAL_ERROR_CODE_BASE + 7,
|
|
Packit Service |
75d76b |
/** An assertion failed */
|
|
Packit Service |
75d76b |
UDS_ASSERTION_FAILED = UDS_INTERNAL_ERROR_CODE_BASE + 8,
|
|
Packit Service |
75d76b |
/** A file or stream is not scannable with the current scanner */
|
|
Packit Service |
75d76b |
UDS_UNSCANNABLE = UDS_INTERNAL_ERROR_CODE_BASE + 9,
|
|
Packit Service |
75d76b |
/** Not an actual error, but reporting that the result will be delayed */
|
|
Packit Service |
75d76b |
UDS_QUEUED = UDS_INTERNAL_ERROR_CODE_BASE + 10,
|
|
Packit Service |
75d76b |
/** Queue already connected */
|
|
Packit Service |
75d76b |
UDS_QUEUE_ALREADY_CONNECTED = UDS_INTERNAL_ERROR_CODE_BASE + 11,
|
|
Packit Service |
75d76b |
/** Fill phase not supported */
|
|
Packit Service |
75d76b |
UDS_BAD_FILL_PHASE = UDS_INTERNAL_ERROR_CODE_BASE + 12,
|
|
Packit Service |
75d76b |
/** A problem has occurred with a Buffer */
|
|
Packit Service |
75d76b |
UDS_BUFFER_ERROR = UDS_INTERNAL_ERROR_CODE_BASE + 13,
|
|
Packit Service |
75d76b |
/** A network connection was lost */
|
|
Packit Service |
75d76b |
UDS_CONNECTION_LOST = UDS_INTERNAL_ERROR_CODE_BASE + 14,
|
|
Packit Service |
75d76b |
/** A time out has occurred */
|
|
Packit Service |
75d76b |
UDS_TIMEOUT = UDS_INTERNAL_ERROR_CODE_BASE + 15,
|
|
Packit Service |
75d76b |
/** No directory was found where one was expected */
|
|
Packit Service |
75d76b |
UDS_NO_DIRECTORY = UDS_INTERNAL_ERROR_CODE_BASE + 16,
|
|
Packit Service |
75d76b |
/** Checkpoint not completed */
|
|
Packit Service |
75d76b |
UDS_CHECKPOINT_INCOMPLETE = UDS_INTERNAL_ERROR_CODE_BASE + 17,
|
|
Packit Service |
75d76b |
/** Invalid albGenTest server run ID */
|
|
Packit Service |
75d76b |
UDS_INVALID_RUN_ID = UDS_INTERNAL_ERROR_CODE_BASE + 18,
|
|
Packit Service |
75d76b |
/** albGenTest server run canceled */
|
|
Packit Service |
75d76b |
UDS_RUN_CANCELED = UDS_INTERNAL_ERROR_CODE_BASE + 19,
|
|
Packit Service |
75d76b |
/** this error range has already been registered */
|
|
Packit Service |
75d76b |
UDS_ALREADY_REGISTERED = UDS_INTERNAL_ERROR_CODE_BASE + 20,
|
|
Packit Service |
75d76b |
/** One more than the last UDS_INTERNAL error code */
|
|
Packit Service |
75d76b |
UDS_INTERNAL_ERROR_CODE_LAST,
|
|
Packit Service |
75d76b |
/** One more than the last error this block will ever use */
|
|
Packit Service |
75d76b |
UDS_INTERNAL_ERROR_CODE_BLOCK_END = UDS_INTERNAL_ERROR_CODE_BASE + 440
|
|
Packit Service |
75d76b |
};
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
enum {
|
|
Packit Service |
75d76b |
ERRBUF_SIZE = 128 // default size for buffer passed to stringError
|
|
Packit Service |
75d76b |
};
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
const char *stringError(int errnum, char *buf, size_t buflen);
|
|
Packit Service |
75d76b |
const char *stringErrorName(int errnum, char *buf, size_t buflen);
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
int makeUnrecoverable(int resultCode) __attribute__((warn_unused_result));
|
|
Packit Service |
75d76b |
bool isUnrecoverable(int resultCode) __attribute__((warn_unused_result));
|
|
Packit Service |
75d76b |
int sansUnrecoverable(int resultCode) __attribute__((warn_unused_result));
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
typedef struct errorInfo {
|
|
Packit Service |
75d76b |
const char *name;
|
|
Packit Service |
75d76b |
const char *message;
|
|
Packit Service |
75d76b |
} ErrorInfo;
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
/**
|
|
Packit Service |
75d76b |
* Initialize UDS error code blocks.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @note Must be called once, before any of the other routines in this
|
|
Packit Service |
75d76b |
* file.
|
|
Packit Service |
75d76b |
**/
|
|
Packit Service |
75d76b |
void initializeStandardErrorBlocks(void);
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
/**
|
|
Packit Service |
75d76b |
* Register an error code block for stringError and stringErrorName.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @param blockName the name of the block of error codes
|
|
Packit Service |
75d76b |
* @param firstError the first error code in the block
|
|
Packit Service |
75d76b |
* @param lastReservedError one past the highest possible error in the block
|
|
Packit Service |
75d76b |
* @param infos a pointer to the error info array for the block
|
|
Packit Service |
75d76b |
* @param infoSize the size of the error info array, which determines
|
|
Packit Service |
75d76b |
* the last actual error for which information is
|
|
Packit Service |
75d76b |
* available
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @return a success or error code, particularly UDS_DUPLICATE_NAME if the
|
|
Packit Service |
75d76b |
* block name is already present, or UDS_ALREADY_REGISTERED if a
|
|
Packit Service |
75d76b |
* block with the specified error code is present
|
|
Packit Service |
75d76b |
**/
|
|
Packit Service |
75d76b |
int registerErrorBlock(const char *blockName,
|
|
Packit Service |
75d76b |
int firstError,
|
|
Packit Service |
75d76b |
int lastReservedError,
|
|
Packit Service |
75d76b |
const ErrorInfo *infos,
|
|
Packit Service |
75d76b |
size_t infoSize);
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
#endif /* ERRORS_H */
|