• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* vbushelper.h
2  *
3  * Copyright (C) 2011 - 2013 UNISYS CORPORATION
4  * All rights reserved.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or (at
9  * your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
14  * NON INFRINGEMENT.  See the GNU General Public License for more
15  * details.
16  */
17 
18 #ifndef __VBUSHELPER_H__
19 #define __VBUSHELPER_H__
20 
21 #include "vbusdeviceinfo.h"
22 
23 /* TARGET_HOSTNAME specified as -DTARGET_HOSTNAME=\"thename\" on the
24  * command line */
25 
26 #define TARGET_HOSTNAME "linuxguest"
27 
bus_device_info_init(ULTRA_VBUS_DEVICEINFO * bus_device_info_ptr,const char * dev_type,const char * drv_name,const char * ver,const char * ver_tag)28 static inline void bus_device_info_init(
29 		ULTRA_VBUS_DEVICEINFO * bus_device_info_ptr,
30 		const char *dev_type, const char *drv_name,
31 		const char *ver, const char *ver_tag)
32 {
33 	memset(bus_device_info_ptr, 0, sizeof(ULTRA_VBUS_DEVICEINFO));
34 	snprintf(bus_device_info_ptr->devType,
35 		 sizeof(bus_device_info_ptr->devType),
36 		 "%s", (dev_type) ? dev_type : "unknownType");
37 	snprintf(bus_device_info_ptr->drvName,
38 		 sizeof(bus_device_info_ptr->drvName),
39 		 "%s", (drv_name) ? drv_name : "unknownDriver");
40 	snprintf(bus_device_info_ptr->infoStrings,
41 		 sizeof(bus_device_info_ptr->infoStrings), "%s\t%s\t%s",
42 		 (ver) ? ver : "unknownVer",
43 		 (ver_tag) ? ver_tag : "unknownVerTag",
44 		 TARGET_HOSTNAME);
45 }
46 
47 #endif
48