mpssd.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. #include <stdio.h>
  23. #include <stdlib.h>
  24. #include <string.h>
  25. #include <fcntl.h>
  26. #include <unistd.h>
  27. #include <dirent.h>
  28. #include <libgen.h>
  29. #include <pthread.h>
  30. #include <stdarg.h>
  31. #include <time.h>
  32. #include <errno.h>
  33. #include <sys/dir.h>
  34. #include <sys/ioctl.h>
  35. #include <sys/poll.h>
  36. #include <sys/types.h>
  37. #include <sys/socket.h>
  38. #include <sys/stat.h>
  39. #include <sys/types.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 <pthread.h>
  47. #include <signal.h>
  48. #include <limits.h>
  49. #include <syslog.h>
  50. #include <getopt.h>
  51. #include <net/if.h>
  52. #include <linux/if_tun.h>
  53. #include <linux/if_tun.h>
  54. #include <linux/virtio_ids.h>
  55. #define MICSYSFSDIR "/sys/class/mic"
  56. #define LOGFILE_NAME "/var/log/mpssd"
  57. #define PAGE_SIZE 4096
  58. struct mic_console_info {
  59. pthread_t console_thread;
  60. int virtio_console_fd;
  61. void *console_dp;
  62. };
  63. struct mic_net_info {
  64. pthread_t net_thread;
  65. int virtio_net_fd;
  66. int tap_fd;
  67. void *net_dp;
  68. };
  69. struct mic_virtblk_info {
  70. pthread_t block_thread;
  71. int virtio_block_fd;
  72. void *block_dp;
  73. volatile sig_atomic_t signaled;
  74. char *backend_file;
  75. int backend;
  76. void *backend_addr;
  77. long backend_size;
  78. };
  79. struct mic_info {
  80. int id;
  81. char *name;
  82. pthread_t config_thread;
  83. pthread_t init_thread;
  84. pid_t pid;
  85. struct mic_console_info mic_console;
  86. struct mic_net_info mic_net;
  87. struct mic_virtblk_info mic_virtblk;
  88. int restart;
  89. int boot_on_resume;
  90. struct mic_info *next;
  91. };
  92. __attribute__((format(printf, 1, 2)))
  93. void mpsslog(char *format, ...);
  94. char *readsysfs(char *dir, char *entry);
  95. int setsysfs(char *dir, char *entry, char *value);
  96. #endif