Commit 0e82f34d077dc254249edea9262174b1d3b44a01

Authored by aliguori
1 parent 0a1af395

Move some declarations around in the QEMU CharDriver code

The goal of this series is to move the CharDriverState code out of vl.c and
into its own file, qemu-char.c.  This patch moves around some declarations so
the next patch can be pure code motion.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>



git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5579 c046a42c-6fe2-441c-8c8c-71466251a162
qemu-char.h
@@ -78,6 +78,8 @@ void qemu_chr_read(CharDriverState *s, uint8_t *buf, int len); @@ -78,6 +78,8 @@ void qemu_chr_read(CharDriverState *s, uint8_t *buf, int len);
78 void qemu_chr_accept_input(CharDriverState *s); 78 void qemu_chr_accept_input(CharDriverState *s);
79 void qemu_chr_info(void); 79 void qemu_chr_info(void);
80 80
  81 +extern int term_escape_char;
  82 +
81 /* async I/O support */ 83 /* async I/O support */
82 84
83 int qemu_set_fd_handler2(int fd, 85 int qemu_set_fd_handler2(int fd,
qemu_socket.h
@@ -28,9 +28,15 @@ int inet_aton(const char *cp, struct in_addr *ia); @@ -28,9 +28,15 @@ int inet_aton(const char *cp, struct in_addr *ia);
28 #define socket_error() errno 28 #define socket_error() errno
29 #define closesocket(s) close(s) 29 #define closesocket(s) close(s)
30 30
  31 +int parse_unix_path(struct sockaddr_un *uaddr, const char *str);
  32 +
31 #endif /* !_WIN32 */ 33 #endif /* !_WIN32 */
32 34
33 void socket_set_nonblock(int fd); 35 void socket_set_nonblock(int fd);
34 int parse_host_port(struct sockaddr_in *saddr, const char *str); 36 int parse_host_port(struct sockaddr_in *saddr, const char *str);
  37 +int parse_host_src_port(struct sockaddr_in *haddr,
  38 + struct sockaddr_in *saddr,
  39 + const char *str);
  40 +int send_all(int fd, const uint8_t *buf, int len1);
35 41
36 #endif /* QEMU_SOCKET_H */ 42 #endif /* QEMU_SOCKET_H */
sysemu.h
@@ -98,7 +98,7 @@ extern int no_quit; @@ -98,7 +98,7 @@ extern int no_quit;
98 extern int semihosting_enabled; 98 extern int semihosting_enabled;
99 extern int old_param; 99 extern int old_param;
100 extern const char *bootp_filename; 100 extern const char *bootp_filename;
101 - 101 +extern DisplayState display_state;
102 102
103 #ifdef USE_KQEMU 103 #ifdef USE_KQEMU
104 extern int kqemu_allowed; 104 extern int kqemu_allowed;
@@ -155,6 +155,8 @@ extern CharDriverState *serial_hds[MAX_SERIAL_PORTS]; @@ -155,6 +155,8 @@ extern CharDriverState *serial_hds[MAX_SERIAL_PORTS];
155 155
156 extern CharDriverState *parallel_hds[MAX_PARALLEL_PORTS]; 156 extern CharDriverState *parallel_hds[MAX_PARALLEL_PORTS];
157 157
  158 +#define TFR(expr) do { if ((expr) != -1) break; } while (errno == EINTR)
  159 +
158 #ifdef NEED_CPU_H 160 #ifdef NEED_CPU_H
159 /* loader.c */ 161 /* loader.c */
160 int get_image_size(const char *filename); 162 int get_image_size(const char *filename);
@@ -179,7 +179,7 @@ int nb_drives; @@ -179,7 +179,7 @@ int nb_drives;
179 static BlockDriverState *bs_snapshots; 179 static BlockDriverState *bs_snapshots;
180 static int vga_ram_size; 180 static int vga_ram_size;
181 enum vga_retrace_method vga_retrace_method = VGA_RETRACE_DUMB; 181 enum vga_retrace_method vga_retrace_method = VGA_RETRACE_DUMB;
182 -static DisplayState display_state; 182 +DisplayState display_state;
183 int nographic; 183 int nographic;
184 static int curses; 184 static int curses;
185 const char* keyboard_layout = NULL; 185 const char* keyboard_layout = NULL;
@@ -252,8 +252,6 @@ static QEMUTimer *icount_vm_timer; @@ -252,8 +252,6 @@ static QEMUTimer *icount_vm_timer;
252 252
253 uint8_t qemu_uuid[16]; 253 uint8_t qemu_uuid[16];
254 254
255 -#define TFR(expr) do { if ((expr) != -1) break; } while (errno == EINTR)  
256 -  
257 /***********************************************************/ 255 /***********************************************************/
258 /* x86 ISA bus support */ 256 /* x86 ISA bus support */
259 257
@@ -1877,7 +1875,7 @@ static int mux_chr_write(CharDriverState *chr, const uint8_t *buf, int len) @@ -1877,7 +1875,7 @@ static int mux_chr_write(CharDriverState *chr, const uint8_t *buf, int len)
1877 int64_t ti; 1875 int64_t ti;
1878 int secs; 1876 int secs;
1879 1877
1880 - ti = get_clock(); 1878 + ti = qemu_get_clock(rt_clock);
1881 if (term_timestamps_start == -1) 1879 if (term_timestamps_start == -1)
1882 term_timestamps_start = ti; 1880 term_timestamps_start = ti;
1883 ti -= term_timestamps_start; 1881 ti -= term_timestamps_start;
@@ -1906,7 +1904,7 @@ static const char * const mux_help[] = { @@ -1906,7 +1904,7 @@ static const char * const mux_help[] = {
1906 NULL 1904 NULL
1907 }; 1905 };
1908 1906
1909 -static int term_escape_char = 0x01; /* ctrl-a is used for escape */ 1907 +int term_escape_char = 0x01; /* ctrl-a is used for escape */
1910 static void mux_print_help(CharDriverState *chr) 1908 static void mux_print_help(CharDriverState *chr)
1911 { 1909 {
1912 int i, j; 1910 int i, j;
@@ -2105,7 +2103,7 @@ static int socket_init(void) @@ -2105,7 +2103,7 @@ static int socket_init(void)
2105 return 0; 2103 return 0;
2106 } 2104 }
2107 2105
2108 -static int send_all(int fd, const uint8_t *buf, int len1) 2106 +int send_all(int fd, const uint8_t *buf, int len1)
2109 { 2107 {
2110 int ret, len; 2108 int ret, len;
2111 2109
@@ -2150,7 +2148,7 @@ static int unix_write(int fd, const uint8_t *buf, int len1) @@ -2150,7 +2148,7 @@ static int unix_write(int fd, const uint8_t *buf, int len1)
2150 return len1 - len; 2148 return len1 - len;
2151 } 2149 }
2152 2150
2153 -static inline int send_all(int fd, const uint8_t *buf, int len1) 2151 +inline int send_all(int fd, const uint8_t *buf, int len1)
2154 { 2152 {
2155 return unix_write(fd, buf, len1); 2153 return unix_write(fd, buf, len1);
2156 } 2154 }
@@ -2169,7 +2167,7 @@ static int stdio_nb_clients = 0; @@ -2169,7 +2167,7 @@ static int stdio_nb_clients = 0;
2169 static int fd_chr_write(CharDriverState *chr, const uint8_t *buf, int len) 2167 static int fd_chr_write(CharDriverState *chr, const uint8_t *buf, int len)
2170 { 2168 {
2171 FDCharDriver *s = chr->opaque; 2169 FDCharDriver *s = chr->opaque;
2172 - return unix_write(s->fd_out, buf, len); 2170 + return send_all(s->fd_out, buf, len);
2173 } 2171 }
2174 2172
2175 static int fd_chr_read_poll(void *opaque) 2173 static int fd_chr_read_poll(void *opaque)
@@ -2476,7 +2474,7 @@ static int pty_chr_write(CharDriverState *chr, const uint8_t *buf, int len) @@ -2476,7 +2474,7 @@ static int pty_chr_write(CharDriverState *chr, const uint8_t *buf, int len)
2476 pty_chr_update_read_handler(chr); 2474 pty_chr_update_read_handler(chr);
2477 return 0; 2475 return 0;
2478 } 2476 }
2479 - return unix_write(s->fd, buf, len); 2477 + return send_all(s->fd, buf, len);
2480 } 2478 }
2481 2479
2482 static int pty_chr_read_poll(void *opaque) 2480 static int pty_chr_read_poll(void *opaque)
@@ -3368,13 +3366,6 @@ static void udp_chr_update_read_handler(CharDriverState *chr) @@ -3368,13 +3366,6 @@ static void udp_chr_update_read_handler(CharDriverState *chr)
3368 } 3366 }
3369 } 3367 }
3370 3368
3371 -#ifndef _WIN32  
3372 -static int parse_unix_path(struct sockaddr_un *uaddr, const char *str);  
3373 -#endif  
3374 -int parse_host_src_port(struct sockaddr_in *haddr,  
3375 - struct sockaddr_in *saddr,  
3376 - const char *str);  
3377 -  
3378 static CharDriverState *qemu_chr_open_udp(const char *def) 3369 static CharDriverState *qemu_chr_open_udp(const char *def)
3379 { 3370 {
3380 CharDriverState *chr = NULL; 3371 CharDriverState *chr = NULL;
@@ -4034,7 +4025,7 @@ int parse_host_port(struct sockaddr_in *saddr, const char *str) @@ -4034,7 +4025,7 @@ int parse_host_port(struct sockaddr_in *saddr, const char *str)
4034 } 4025 }
4035 4026
4036 #ifndef _WIN32 4027 #ifndef _WIN32
4037 -static int parse_unix_path(struct sockaddr_un *uaddr, const char *str) 4028 +int parse_unix_path(struct sockaddr_un *uaddr, const char *str)
4038 { 4029 {
4039 const char *p; 4030 const char *p;
4040 int len; 4031 int len;