|
Packit Service |
db8df9 |
/*
|
|
Packit Service |
db8df9 |
* Intel(R) Enclosure LED Utilities
|
|
Packit Service |
db8df9 |
* Copyright (C) 2009-2018 Intel Corporation.
|
|
Packit Service |
db8df9 |
*
|
|
Packit Service |
db8df9 |
* This program is free software; you can redistribute it and/or modify it
|
|
Packit Service |
db8df9 |
* under the terms and conditions of the GNU General Public License,
|
|
Packit Service |
db8df9 |
* version 2, as published by the Free Software Foundation.
|
|
Packit Service |
db8df9 |
*
|
|
Packit Service |
db8df9 |
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
Packit Service |
db8df9 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
Packit Service |
db8df9 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
Packit Service |
db8df9 |
* more details.
|
|
Packit Service |
db8df9 |
*
|
|
Packit Service |
db8df9 |
* You should have received a copy of the GNU General Public License along with
|
|
Packit Service |
db8df9 |
* this program; if not, write to the Free Software Foundation, Inc.,
|
|
Packit Service |
db8df9 |
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
|
|
Packit Service |
db8df9 |
*
|
|
Packit Service |
db8df9 |
*/
|
|
Packit Service |
db8df9 |
|
|
Packit Service |
db8df9 |
#ifndef _ENCLOSURE_H_INCLUDED_
|
|
Packit Service |
db8df9 |
#define _ENCLOSURE_H_INCLUDED_
|
|
Packit Service |
db8df9 |
|
|
Packit Service |
db8df9 |
#include <stdint.h>
|
|
Packit Service |
db8df9 |
|
|
Packit Service |
db8df9 |
#include "ses.h"
|
|
Packit Service |
db8df9 |
|
|
Packit Service |
db8df9 |
/**
|
|
Packit Service |
db8df9 |
* @brief Enclosure device structure.
|
|
Packit Service |
db8df9 |
*
|
|
Packit Service |
db8df9 |
* This structure describes an enclosure device connected to one of
|
|
Packit Service |
db8df9 |
* SAS controllers existing in the system.
|
|
Packit Service |
db8df9 |
*/
|
|
Packit Service |
db8df9 |
struct enclosure_device {
|
|
Packit Service |
db8df9 |
/**
|
|
Packit Service |
db8df9 |
* Path to an enclosure device in sysfs tree. This is controller base
|
|
Packit Service |
db8df9 |
* canonical path.
|
|
Packit Service |
db8df9 |
*/
|
|
Packit Service |
db8df9 |
char *sysfs_path;
|
|
Packit Service |
db8df9 |
|
|
Packit Service |
db8df9 |
/**
|
|
Packit Service |
db8df9 |
* SAS address as identifier of an enclosure.
|
|
Packit Service |
db8df9 |
*/
|
|
Packit Service |
db8df9 |
uint64_t sas_address;
|
|
Packit Service |
db8df9 |
|
|
Packit Service |
db8df9 |
/**
|
|
Packit Service |
db8df9 |
* Path to enclosure's sg device.
|
|
Packit Service |
db8df9 |
*/
|
|
Packit Service |
db8df9 |
char *dev_path;
|
|
Packit Service |
db8df9 |
|
|
Packit Service |
db8df9 |
struct ses_pages *ses_pages;
|
|
Packit Service |
db8df9 |
};
|
|
Packit Service |
db8df9 |
|
|
Packit Service |
db8df9 |
/**
|
|
Packit Service |
db8df9 |
* @brief Allocates memory for an enclosure device structure.
|
|
Packit Service |
db8df9 |
*
|
|
Packit Service |
db8df9 |
* This function allocates memory for a new structure describing an enclosure
|
|
Packit Service |
db8df9 |
* device. It reads the sysfs entries and populates structure fields.
|
|
Packit Service |
db8df9 |
* The function uses libsas abstraction layer to extract required information.
|
|
Packit Service |
db8df9 |
*
|
|
Packit Service |
db8df9 |
* @param[in] path Path to an enclosure device in sysfs tree.
|
|
Packit Service |
db8df9 |
* The path begins with "/sys/class/enclosure/".
|
|
Packit Service |
db8df9 |
*
|
|
Packit Service |
db8df9 |
* @return Pointer to enclosure device structure if successful, otherwise the
|
|
Packit Service |
db8df9 |
* function returns NULL pointer. The NULL pointer means either the
|
|
Packit Service |
db8df9 |
* specified path is invalid or there's not enough memory in the system
|
|
Packit Service |
db8df9 |
* to allocated new structure.
|
|
Packit Service |
db8df9 |
*/
|
|
Packit Service |
db8df9 |
struct enclosure_device *enclosure_device_init(const char *path);
|
|
Packit Service |
db8df9 |
|
|
Packit Service |
db8df9 |
/**
|
|
Packit Service |
db8df9 |
* @brief Releases an enclosure device structure.
|
|
Packit Service |
db8df9 |
*
|
|
Packit Service |
db8df9 |
* This function releases memory allocated for enclosure device structure.
|
|
Packit Service |
db8df9 |
*
|
|
Packit Service |
db8df9 |
* @param[in] device Pointer to enclosure device structure.
|
|
Packit Service |
db8df9 |
*
|
|
Packit Service |
db8df9 |
* @return The function does not return a value.
|
|
Packit Service |
db8df9 |
*/
|
|
Packit Service |
db8df9 |
void enclosure_device_fini(struct enclosure_device *enclosure);
|
|
Packit Service |
db8df9 |
|
|
Packit Service |
db8df9 |
#endif /* _ENCLOSURE_H_INCLUDED_ */
|