|
Packit Service |
db8df9 |
/*
|
|
Packit Service |
db8df9 |
* Intel(R) Enclosure LED Utilities
|
|
Packit Service |
db8df9 |
* Copyright (C) 2017-2019 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 _UDEV_H_INCLUDED_
|
|
Packit Service |
db8df9 |
#define _UDEV_H_INCLUDED_
|
|
Packit Service |
db8df9 |
|
|
Packit Service |
db8df9 |
#include "list.h"
|
|
Packit Service |
db8df9 |
|
|
Packit Service |
db8df9 |
/**
|
|
Packit Service |
db8df9 |
*/
|
|
Packit Service |
db8df9 |
enum udev_action {
|
|
Packit Service |
db8df9 |
UDEV_ACTION_UNKNOWN = 0,
|
|
Packit Service |
db8df9 |
UDEV_ACTION_ADD,
|
|
Packit Service |
db8df9 |
UDEV_ACTION_REMOVE
|
|
Packit Service |
db8df9 |
};
|
|
Packit Service |
db8df9 |
|
|
Packit Service |
db8df9 |
/**
|
|
Packit Service |
db8df9 |
* @brief Deletes udev context and udev monitor.
|
|
Packit Service |
db8df9 |
*
|
|
Packit Service |
db8df9 |
* @return The function does not return a value..
|
|
Packit Service |
db8df9 |
*/
|
|
Packit Service |
db8df9 |
void stop_udev_monitor(void);
|
|
Packit Service |
db8df9 |
|
|
Packit Service |
db8df9 |
/**
|
|
Packit Service |
db8df9 |
* @brief Returns udev monitor file descriptor or creates udev context and
|
|
Packit Service |
db8df9 |
* udev monitor if monitor does not exist.
|
|
Packit Service |
db8df9 |
*
|
|
Packit Service |
db8df9 |
* @return Udev monitor file descriptor if successful, otherwise the
|
|
Packit Service |
db8df9 |
* function returns -1 on libudev error and libudev sets errno.
|
|
Packit Service |
db8df9 |
*/
|
|
Packit Service |
db8df9 |
int get_udev_monitor(void);
|
|
Packit Service |
db8df9 |
|
|
Packit Service |
db8df9 |
/**
|
|
Packit Service |
db8df9 |
* @brief Handles udev event.
|
|
Packit Service |
db8df9 |
*
|
|
Packit Service |
db8df9 |
* This function checks event type and if it is 'add' or remove
|
|
Packit Service |
db8df9 |
* function sets custom IBPI pattern to block device which is affected
|
|
Packit Service |
db8df9 |
* by this event.
|
|
Packit Service |
db8df9 |
*
|
|
Packit Service |
db8df9 |
* @param[in] ledmon_block_list list containing block devices, it is
|
|
Packit Service |
db8df9 |
* used to match device from udev event.
|
|
Packit Service |
db8df9 |
*
|
|
Packit Service |
db8df9 |
* @return 0 if 'add' or 'remove' event handled successfully;
|
|
Packit Service |
db8df9 |
* 1 if registered event is not 'add' or 'remove';
|
|
Packit Service |
db8df9 |
* -1 on libudev error.
|
|
Packit Service |
db8df9 |
*/
|
|
Packit Service |
db8df9 |
int handle_udev_event(struct list *ledmon_block_list);
|
|
Packit Service |
db8df9 |
|
|
Packit Service |
db8df9 |
#endif /* _UDEV_H_INCLUDED_ */
|