Include it in the .c files instead that use the error reporting functions. Message-Id: <20230210111931.1115489-1-thuth@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Thomas Huth <thuth@redhat.com>
		
			
				
	
	
		
			30 lines
		
	
	
		
			600 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
		
			600 B
		
	
	
	
		
			C
		
	
	
	
	
	
/*
 | 
						|
 * udmabuf helper functions.
 | 
						|
 *
 | 
						|
 * This work is licensed under the terms of the GNU GPL, version 2 or later.
 | 
						|
 * See the COPYING file in the top-level directory.
 | 
						|
 */
 | 
						|
#include "qemu/osdep.h"
 | 
						|
#include "qapi/error.h"
 | 
						|
#include "ui/console.h"
 | 
						|
#include "qemu/error-report.h"
 | 
						|
 | 
						|
#include <sys/ioctl.h>
 | 
						|
 | 
						|
int udmabuf_fd(void)
 | 
						|
{
 | 
						|
    static bool first = true;
 | 
						|
    static int udmabuf;
 | 
						|
 | 
						|
    if (!first) {
 | 
						|
        return udmabuf;
 | 
						|
    }
 | 
						|
    first = false;
 | 
						|
 | 
						|
    udmabuf = open("/dev/udmabuf", O_RDWR);
 | 
						|
    if (udmabuf < 0) {
 | 
						|
        warn_report("open /dev/udmabuf: %s", strerror(errno));
 | 
						|
    }
 | 
						|
    return udmabuf;
 | 
						|
}
 |