Blame src/status.c

Packit 7e09eb
/*
Packit 7e09eb
 * Intel(R) Enclosure LED Utilities
Packit 7e09eb
 * Copyright (C) 2009-2019 Intel Corporation.
Packit 7e09eb
 *
Packit 7e09eb
 * This program is free software; you can redistribute it and/or modify it
Packit 7e09eb
 * under the terms and conditions of the GNU General Public License,
Packit 7e09eb
 * version 2, as published by the Free Software Foundation.
Packit 7e09eb
 *
Packit 7e09eb
 * This program is distributed in the hope it will be useful, but WITHOUT
Packit 7e09eb
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
Packit 7e09eb
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
Packit 7e09eb
 * more details.
Packit 7e09eb
 *
Packit 7e09eb
 * You should have received a copy of the GNU General Public License along with
Packit 7e09eb
 * this program; if not, write to the Free Software Foundation, Inc.,
Packit 7e09eb
 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
Packit 7e09eb
 *
Packit 7e09eb
 */
Packit 7e09eb
Packit 7e09eb
#include "config.h"
Packit 7e09eb
#include "status.h"
Packit 7e09eb
Packit 7e09eb
/**
Packit 7e09eb
 */
Packit 7e09eb
#define _S_CODE(__code) \
Packit 7e09eb
	case __code: return #__code
Packit 7e09eb
Packit 7e09eb
/**
Packit 7e09eb
 */
Packit 7e09eb
char *strstatus(status_t scode)
Packit 7e09eb
{
Packit 7e09eb
	switch (scode) {
Packit 7e09eb
		_S_CODE(STATUS_SUCCESS);
Packit 7e09eb
		_S_CODE(STATUS_BUFFER_OVERFLOW);
Packit 7e09eb
		_S_CODE(STATUS_INVALID_NODE);
Packit 7e09eb
		_S_CODE(STATUS_OUT_OF_MEMORY);
Packit 7e09eb
		_S_CODE(STATUS_OUT_OF_RANGE);
Packit 7e09eb
		_S_CODE(STATUS_DATA_ERROR);
Packit 7e09eb
		_S_CODE(STATUS_IBPI_DETERMINE_ERROR);
Packit 7e09eb
		_S_CODE(STATUS_INVALID_PATH);
Packit 7e09eb
		_S_CODE(STATUS_INVALID_SUBOPTION);
Packit 7e09eb
		_S_CODE(STATUS_INVALID_STATE);
Packit 7e09eb
		_S_CODE(STATUS_NULL_POINTER);
Packit 7e09eb
		_S_CODE(STATUS_SIZE_ERROR);
Packit 7e09eb
		_S_CODE(STATUS_FILE_OPEN_ERROR);
Packit 7e09eb
		_S_CODE(STATUS_FILE_READ_ERROR);
Packit 7e09eb
		_S_CODE(STATUS_FILE_WRITE_ERROR);
Packit 7e09eb
		_S_CODE(STATUS_FILE_LOCK_ERROR);
Packit 7e09eb
		_S_CODE(STATUS_SYSFS_PATH_ERROR);
Packit 7e09eb
		_S_CODE(STATUS_SYSFS_INIT_ERROR);
Packit 7e09eb
		_S_CODE(STATUS_SYSFS_SCAN_ERROR);
Packit 7e09eb
		_S_CODE(STATUS_SYSFS_RESET_ERROR);
Packit 7e09eb
		_S_CODE(STATUS_DIR_OPEN_ERROR);
Packit 7e09eb
		_S_CODE(STATUS_LIST_EMPTY);
Packit 7e09eb
		_S_CODE(STATUS_LIST_INIT_ERROR);
Packit 7e09eb
		_S_CODE(STATUS_BLOCK_LIST_ERROR);
Packit 7e09eb
		_S_CODE(STATUS_VOLUM_LIST_ERROR);
Packit 7e09eb
		_S_CODE(STATUS_CNTRL_LIST_ERROR);
Packit 7e09eb
		_S_CODE(STATUS_SLAVE_LIST_ERROR);
Packit 7e09eb
		_S_CODE(STATUS_CNTNR_LIST_ERROR);
Packit 7e09eb
		_S_CODE(STATUS_INVALID_FORMAT);
Packit 7e09eb
		_S_CODE(STATUS_LEDMON_INIT);
Packit 7e09eb
		_S_CODE(STATUS_LEDMON_RUNNING);
Packit 7e09eb
		_S_CODE(STATUS_ONEXIT_ERROR);
Packit 7e09eb
		_S_CODE(STATUS_INVALID_CONTROLLER);
Packit 7e09eb
		_S_CODE(STATUS_NOT_SUPPORTED);
Packit 7e09eb
		_S_CODE(STATUS_STAT_ERROR);
Packit 7e09eb
		_S_CODE(STATUS_CMDLINE_ERROR);
Packit 7e09eb
		_S_CODE(STATUS_NOT_A_PRIVILEGED_USER);
Packit 7e09eb
		_S_CODE(STATUS_ENCLO_LIST_ERROR);
Packit 7e09eb
		_S_CODE(STATUS_SLOTS_LIST_ERROR);
Packit 7e09eb
		_S_CODE(STATUS_CONFIG_FILE_ERROR);
Packit 7e09eb
		_S_CODE(STATUS_LOG_FILE_ERROR);
Packit 7e09eb
	default:
Packit 7e09eb
		return "???";
Packit 7e09eb
	}
Packit 7e09eb
}