Blame tools/fpgad/command_line.h

Packit 6639f8
// Copyright(c) 2018-2019, Intel Corporation
Packit 6639f8
//
Packit 6639f8
// Redistribution  and  use  in source  and  binary  forms,  with  or  without
Packit 6639f8
// modification, are permitted provided that the following conditions are met:
Packit 6639f8
//
Packit 6639f8
// * Redistributions of  source code  must retain the  above copyright notice,
Packit 6639f8
//   this list of conditions and the following disclaimer.
Packit 6639f8
// * Redistributions in binary form must reproduce the above copyright notice,
Packit 6639f8
//   this list of conditions and the following disclaimer in the documentation
Packit 6639f8
//   and/or other materials provided with the distribution.
Packit 6639f8
// * Neither the name  of Intel Corporation  nor the names of its contributors
Packit 6639f8
//   may be used to  endorse or promote  products derived  from this  software
Packit 6639f8
//   without specific prior written permission.
Packit 6639f8
//
Packit 6639f8
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Packit 6639f8
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,  BUT NOT LIMITED TO,  THE
Packit 6639f8
// IMPLIED WARRANTIES OF  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Packit 6639f8
// ARE DISCLAIMED.  IN NO EVENT  SHALL THE COPYRIGHT OWNER  OR CONTRIBUTORS BE
Packit 6639f8
// LIABLE  FOR  ANY  DIRECT,  INDIRECT,  INCIDENTAL,  SPECIAL,  EXEMPLARY,  OR
Packit 6639f8
// CONSEQUENTIAL  DAMAGES  (INCLUDING,  BUT  NOT LIMITED  TO,  PROCUREMENT  OF
Packit 6639f8
// SUBSTITUTE GOODS OR SERVICES;  LOSS OF USE,  DATA, OR PROFITS;  OR BUSINESS
Packit 6639f8
// INTERRUPTION)  HOWEVER CAUSED  AND ON ANY THEORY  OF LIABILITY,  WHETHER IN
Packit 6639f8
// CONTRACT,  STRICT LIABILITY,  OR TORT  (INCLUDING NEGLIGENCE  OR OTHERWISE)
Packit 6639f8
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,  EVEN IF ADVISED OF THE
Packit 6639f8
// POSSIBILITY OF SUCH DAMAGE.
Packit 6639f8
Packit 6639f8
#ifndef __FPGAD_COMMAND_LINE_H__
Packit 6639f8
#define __FPGAD_COMMAND_LINE_H__
Packit 6639f8
Packit 6639f8
#include <stdio.h>
Packit 6639f8
#include <unistd.h>
Packit 6639f8
#include <sys/types.h>
Packit 6639f8
#include <linux/limits.h>
Packit 6639f8
#include "bitstream.h"
Packit 6639f8
Packit 6639f8
struct _fpgad_supported_device;
Packit 6639f8
Packit 6639f8
#define MAX_NULL_GBS 32
Packit 6639f8
Packit 6639f8
struct fpgad_config {
Packit 6639f8
	useconds_t poll_interval_usec;
Packit 6639f8
Packit 6639f8
	bool daemon;
Packit 6639f8
	char directory[PATH_MAX];
Packit 6639f8
	char logfile[PATH_MAX];
Packit 6639f8
	char pidfile[PATH_MAX];
Packit 6639f8
	char cfgfile[PATH_MAX];
Packit 6639f8
	mode_t filemode;
Packit 6639f8
Packit 6639f8
	bool running;
Packit 6639f8
Packit 6639f8
	const char *api_socket;
Packit 6639f8
Packit 6639f8
	opae_bitstream_info null_gbs[MAX_NULL_GBS];
Packit 6639f8
	unsigned num_null_gbs;
Packit 6639f8
Packit 6639f8
	pthread_t bmc_monitor_thr;
Packit 6639f8
	pthread_t monitor_thr;
Packit 6639f8
	pthread_t event_dispatcher_thr;
Packit 6639f8
	pthread_t events_api_thr;
Packit 6639f8
Packit 6639f8
	struct _fpgad_supported_device *supported_devices;
Packit 6639f8
};
Packit 6639f8
Packit 6639f8
extern struct fpgad_config global_config;
Packit 6639f8
Packit 6639f8
/*
Packit 6639f8
** Returns
Packit 6639f8
**  -2 if --help requested
Packit 6639f8
**  -1 on parse error
Packit 6639f8
**   0 on success
Packit 6639f8
*/
Packit 6639f8
int cmd_parse_args(struct fpgad_config *c, int argc, char *argv[]);
Packit 6639f8
Packit 6639f8
void cmd_show_help(FILE *fptr);
Packit 6639f8
Packit 6639f8
// 0 on success
Packit 6639f8
int cmd_canonicalize_paths(struct fpgad_config *c);
Packit 6639f8
Packit 6639f8
void cmd_destroy(struct fpgad_config *c);
Packit 6639f8
Packit 6639f8
bool cmd_path_is_symlink(const char *path);
Packit 6639f8
Packit 6639f8
#endif /* __FPGAD_COMMAND_LINE_H__ */