Selaa lähdekoodia

[Feat] [1.0.0] vmnet 使用 vmprocess 通信

xcbosa mbp16 2 kuukautta sitten
vanhempi
commit
0e7e4396a9
1 muutettua tiedostoa jossa 47 lisäystä ja 47 poistoa
  1. 47 47
      post_sbin/getty.c

+ 47 - 47
post_sbin/getty.c

@@ -27,8 +27,50 @@
 #define VMP_TX_POOL_SIZE 64
 #define VMP_STRBUF_LEN 256
 
-extern int vmnetproxy_main(void);
-extern void tx_push(tx_command cmd);
+typedef struct {
+    short width;
+    short height;
+    short xpixel;
+    short ypixel;
+} rx_command_win_size;
+
+typedef enum {
+    rx_command_type_runproc,
+    rx_command_type_runpipe,
+    rx_command_type_killproc,
+    rx_command_type_lsproc,
+    rx_command_type_sstdin,
+    rx_command_type_winsize,
+    rx_command_type_ping,
+    rx_command_type_vmnet
+} rx_command_type;
+
+typedef struct {
+    rx_command_type type;
+    int8_t tid;
+    int signal;
+    long magic;
+    char sstdin[VMP_STRBUF_LEN];
+    int sstdin_len;
+    rx_command_win_size win_size;
+} rx_command;
+
+typedef enum {
+    tx_command_type_online,
+    tx_command_type_stdout,
+    tx_command_type_cb,
+    tx_command_type_stoped,
+    tx_command_type_vmnet
+} tx_command_type;
+
+typedef struct {
+    tx_command_type type;
+    int8_t tid;
+    int8_t error;
+    long magic;
+    char sstdout[VMP_STRBUF_LEN];
+    int sstdout_len;
+} tx_command;
 
 typedef struct vmnet_queue_elem {
     char buffer[MAX_BUFFER_SIZE];
@@ -40,6 +82,9 @@ vmnet_queue_elem *vmnet_queue_front;
 vmnet_queue_elem *vmnet_queue_waiting_buffer;
 pthread_mutex_t vmnet_queue_lock;
 
+extern int vmnetproxy_main(void);
+extern void tx_push(tx_command cmd);
+
 void vmnet_queue_setup(void) {
     vmnet_queue_front = NULL;
     vmnet_queue_waiting_buffer = NULL;
@@ -85,51 +130,6 @@ int vmnet_read_message(char *buffer, int length) {
     return write_len;
 }
 
-typedef struct {
-    short width;
-    short height;
-    short xpixel;
-    short ypixel;
-} rx_command_win_size;
-
-typedef enum {
-    rx_command_type_runproc,
-    rx_command_type_runpipe,
-    rx_command_type_killproc,
-    rx_command_type_lsproc,
-    rx_command_type_sstdin,
-    rx_command_type_winsize,
-    rx_command_type_ping,
-    rx_command_type_vmnet
-} rx_command_type;
-
-typedef struct {
-    rx_command_type type;
-    int8_t tid;
-    int signal;
-    long magic;
-    char sstdin[VMP_STRBUF_LEN];
-    int sstdin_len;
-    rx_command_win_size win_size;
-} rx_command;
-
-typedef enum {
-    tx_command_type_online,
-    tx_command_type_stdout,
-    tx_command_type_cb,
-    tx_command_type_stoped,
-    tx_command_type_vmnet
-} tx_command_type;
-
-typedef struct {
-    tx_command_type type;
-    int8_t tid;
-    int8_t error;
-    long magic;
-    char sstdout[VMP_STRBUF_LEN];
-    int sstdout_len;
-} tx_command;
-
 typedef int FD;
 typedef int pipe_t[2];