at v5.2-rc3 100 lines 2.3 kB view raw
1/* 2 * Intel MIC Platform Software Stack (MPSS) 3 * 4 * Copyright(c) 2013 Intel Corporation. 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, version 2, as 8 * published by the Free Software Foundation. 9 * 10 * This program is distributed in the hope that it will be useful, but 11 * WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * General Public License for more details. 14 * 15 * The full GNU General Public License is included in this distribution in 16 * the file called "COPYING". 17 * 18 * Intel MIC User Space Tools. 19 */ 20#ifndef _MPSSD_H_ 21#define _MPSSD_H_ 22 23#include <stdio.h> 24#include <stdlib.h> 25#include <string.h> 26#include <fcntl.h> 27#include <unistd.h> 28#include <dirent.h> 29#include <libgen.h> 30#include <pthread.h> 31#include <stdarg.h> 32#include <time.h> 33#include <errno.h> 34#include <sys/dir.h> 35#include <sys/ioctl.h> 36#include <sys/poll.h> 37#include <sys/types.h> 38#include <sys/socket.h> 39#include <sys/stat.h> 40#include <sys/mman.h> 41#include <sys/utsname.h> 42#include <sys/wait.h> 43#include <netinet/in.h> 44#include <arpa/inet.h> 45#include <netdb.h> 46#include <signal.h> 47#include <limits.h> 48#include <syslog.h> 49#include <getopt.h> 50#include <net/if.h> 51#include <linux/if_tun.h> 52#include <linux/virtio_ids.h> 53 54#define MICSYSFSDIR "/sys/class/mic" 55#define LOGFILE_NAME "/var/log/mpssd" 56#define PAGE_SIZE 4096 57 58struct mic_console_info { 59 pthread_t console_thread; 60 int virtio_console_fd; 61 void *console_dp; 62}; 63 64struct mic_net_info { 65 pthread_t net_thread; 66 int virtio_net_fd; 67 int tap_fd; 68 void *net_dp; 69}; 70 71struct mic_virtblk_info { 72 pthread_t block_thread; 73 int virtio_block_fd; 74 void *block_dp; 75 volatile sig_atomic_t signaled; 76 char *backend_file; 77 int backend; 78 void *backend_addr; 79 long backend_size; 80}; 81 82struct mic_info { 83 int id; 84 char *name; 85 pthread_t config_thread; 86 pthread_t init_thread; 87 pid_t pid; 88 struct mic_console_info mic_console; 89 struct mic_net_info mic_net; 90 struct mic_virtblk_info mic_virtblk; 91 int restart; 92 int boot_on_resume; 93 struct mic_info *next; 94}; 95 96__attribute__((format(printf, 1, 2))) 97void mpsslog(char *format, ...); 98char *readsysfs(char *dir, char *entry); 99int setsysfs(char *dir, char *entry, char *value); 100#endif