2008-11-21 12:27:11 +00:00
|
|
|
/*
|
|
|
|
* node_device.h: node device enumeration
|
|
|
|
*
|
|
|
|
* Copyright (C) 2008 Virtual Iron Software, Inc.
|
|
|
|
* Copyright (C) 2008 David F. Lively
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*
|
|
|
|
* Author: David F. Lively <dlively@virtualiron.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __VIR_NODE_DEVICE_H__
|
2010-03-09 18:22:22 +00:00
|
|
|
# define __VIR_NODE_DEVICE_H__
|
2008-11-21 12:27:11 +00:00
|
|
|
|
2010-03-09 18:22:22 +00:00
|
|
|
# include "internal.h"
|
|
|
|
# include "driver.h"
|
|
|
|
# include "node_device_conf.h"
|
2008-11-21 12:27:11 +00:00
|
|
|
|
2010-08-17 15:21:16 +00:00
|
|
|
# define LINUX_SYSFS_SCSI_HOST_PREFIX "/sys/class/scsi_host/"
|
2010-03-09 18:22:22 +00:00
|
|
|
# define LINUX_SYSFS_SCSI_HOST_POSTFIX "device"
|
|
|
|
# define LINUX_SYSFS_FC_HOST_PREFIX "/sys/class/fc_host/"
|
2009-06-02 15:12:53 +00:00
|
|
|
|
2010-03-09 18:22:22 +00:00
|
|
|
# define VPORT_CREATE 0
|
|
|
|
# define VPORT_DELETE 1
|
|
|
|
# define LINUX_SYSFS_VPORT_CREATE_POSTFIX "/vport_create"
|
|
|
|
# define LINUX_SYSFS_VPORT_DELETE_POSTFIX "/vport_delete"
|
2009-06-02 15:12:53 +00:00
|
|
|
|
2010-03-09 18:22:22 +00:00
|
|
|
# define LINUX_NEW_DEVICE_WAIT_TIME 60
|
2009-06-02 15:12:53 +00:00
|
|
|
|
2010-03-09 18:22:22 +00:00
|
|
|
# ifdef HAVE_HAL
|
2008-11-21 12:27:11 +00:00
|
|
|
int halNodeRegister(void);
|
2010-03-09 18:22:22 +00:00
|
|
|
# endif
|
|
|
|
# ifdef HAVE_UDEV
|
2009-11-12 21:48:24 +00:00
|
|
|
int udevNodeRegister(void);
|
2010-03-09 18:22:22 +00:00
|
|
|
# endif
|
2008-11-21 12:27:11 +00:00
|
|
|
|
2008-12-04 21:48:31 +00:00
|
|
|
void nodeDeviceLock(virDeviceMonitorStatePtr driver);
|
|
|
|
void nodeDeviceUnlock(virDeviceMonitorStatePtr driver);
|
|
|
|
|
2008-11-21 12:27:11 +00:00
|
|
|
int nodedevRegister(void);
|
|
|
|
|
2010-03-09 18:22:22 +00:00
|
|
|
# ifdef __linux__
|
2009-11-12 21:48:24 +00:00
|
|
|
|
2010-03-09 18:22:22 +00:00
|
|
|
# define check_fc_host(d) check_fc_host_linux(d)
|
2009-11-12 21:48:24 +00:00
|
|
|
int check_fc_host_linux(union _virNodeDevCapData *d);
|
|
|
|
|
2010-03-09 18:22:22 +00:00
|
|
|
# define check_vport_capable(d) check_vport_capable_linux(d)
|
2009-11-12 21:48:24 +00:00
|
|
|
int check_vport_capable_linux(union _virNodeDevCapData *d);
|
|
|
|
|
2010-03-09 18:22:22 +00:00
|
|
|
# define read_wwn(host, file, wwn) read_wwn_linux(host, file, wwn)
|
2009-11-12 21:48:24 +00:00
|
|
|
int read_wwn_linux(int host, const char *file, char **wwn);
|
|
|
|
|
2010-03-09 18:22:22 +00:00
|
|
|
# else /* __linux__ */
|
2009-11-12 21:48:24 +00:00
|
|
|
|
2011-03-31 20:40:34 +00:00
|
|
|
# define check_fc_host(d) (-1)
|
|
|
|
# define check_vport_capable(d) (-1)
|
2010-03-09 18:22:22 +00:00
|
|
|
# define read_wwn(host, file, wwn)
|
2009-11-12 21:48:24 +00:00
|
|
|
|
2010-03-09 18:22:22 +00:00
|
|
|
# endif /* __linux__ */
|
2009-11-12 21:48:24 +00:00
|
|
|
|
2011-06-04 21:24:54 +00:00
|
|
|
int nodeNumOfDevices(virConnectPtr conn, const char *cap, unsigned int flags);
|
|
|
|
int nodeListDevices(virConnectPtr conn, const char *cap, char **const names,
|
|
|
|
int maxnames, unsigned int flags);
|
|
|
|
virNodeDevicePtr nodeDeviceLookupByName(virConnectPtr conn, const char *name);
|
|
|
|
char *nodeDeviceGetXMLDesc(virNodeDevicePtr dev, unsigned int flags);
|
|
|
|
char *nodeDeviceGetParent(virNodeDevicePtr dev);
|
|
|
|
int nodeDeviceNumOfCaps(virNodeDevicePtr dev);
|
|
|
|
int nodeDeviceListCaps(virNodeDevicePtr dev, char **const names, int maxnames);
|
|
|
|
virNodeDevicePtr nodeDeviceCreateXML(virConnectPtr conn,
|
|
|
|
const char *xmlDesc, unsigned int flags);
|
|
|
|
int nodeDeviceDestroy(virNodeDevicePtr dev);
|
|
|
|
|
2008-11-21 12:27:11 +00:00
|
|
|
#endif /* __VIR_NODE_DEVICE_H__ */
|