node_device_driver.h 2.9 KB
Newer Older
1
/*
2
 * node_device_driver.h: node device enumeration
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
 *
 * 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
18
 * License along with this library.  If not, see
O
Osier Yang 已提交
19
 * <http://www.gnu.org/licenses/>.
20 21 22 23 24
 *
 * Author: David F. Lively <dlively@virtualiron.com>
 */

#ifndef __VIR_NODE_DEVICE_H__
25
# define __VIR_NODE_DEVICE_H__
26

27 28 29
# include "internal.h"
# include "driver.h"
# include "node_device_conf.h"
30

31
# define LINUX_NEW_DEVICE_WAIT_TIME 60
32

33
# ifdef WITH_HAL
34
int halNodeRegister(void);
35
# endif
36
# ifdef WITH_UDEV
37
int udevNodeRegister(void);
38
# endif
39

40 41 42 43
void nodeDeviceLock(void);
void nodeDeviceUnlock(void);

extern virNodeDeviceDriverStatePtr driver;
44

45 46
int nodedevRegister(void);

47 48 49
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);
50 51 52
int nodeConnectListAllNodeDevices(virConnectPtr conn,
                                  virNodeDevicePtr **devices,
                                  unsigned int flags);
53
virNodeDevicePtr nodeDeviceLookupByName(virConnectPtr conn, const char *name);
54 55 56 57
virNodeDevicePtr nodeDeviceLookupSCSIHostByWWN(virConnectPtr conn,
                                               const char *wwnn,
                                               const char *wwpn,
                                               unsigned int flags);
58 59 60 61 62 63 64 65
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);

66 67 68 69 70 71 72 73 74 75
int
nodeConnectNodeDeviceEventRegisterAny(virConnectPtr conn,
                                      virNodeDevicePtr dev,
                                      int eventID,
                                      virConnectNodeDeviceEventGenericCallback callback,
                                      void *opaque,
                                      virFreeCallback freecb);
int
nodeConnectNodeDeviceEventDeregisterAny(virConnectPtr conn,
                                        int callbackID);
76
#endif /* __VIR_NODE_DEVICE_H__ */