@@ -254,26 +254,58 @@ struct ChardevClass {
254
254
255
255
bool internal ; /* TODO: eventually use TYPE_USER_CREATABLE */
256
256
bool supports_yank ;
257
+
258
+ /* parse command line options and populate QAPI @backend */
257
259
void (* parse )(QemuOpts * opts , ChardevBackend * backend , Error * * errp );
258
260
261
+ /* called after construction, open/starts the backend */
259
262
void (* open )(Chardev * chr , ChardevBackend * backend ,
260
263
bool * be_opened , Error * * errp );
261
264
265
+ /* write buf to the backend */
262
266
int (* chr_write )(Chardev * s , const uint8_t * buf , int len );
267
+
268
+ /*
269
+ * Read from the backend (blocking). A typical front-end will instead rely
270
+ * on chr_can_read/chr_read being called when polling/looping.
271
+ */
263
272
int (* chr_sync_read )(Chardev * s , const uint8_t * buf , int len );
273
+
274
+ /* create a watch on the backend */
264
275
GSource * (* chr_add_watch )(Chardev * s , GIOCondition cond );
276
+
277
+ /* update the backend internal sources */
265
278
void (* chr_update_read_handler )(Chardev * s );
279
+
280
+ /* send an ioctl to the backend */
266
281
int (* chr_ioctl )(Chardev * s , int cmd , void * arg );
282
+
283
+ /* get ancillary-received fds during last read */
267
284
int (* get_msgfds )(Chardev * s , int * fds , int num );
285
+
286
+ /* set ancillary fds to be sent with next write */
268
287
int (* set_msgfds )(Chardev * s , int * fds , int num );
288
+
289
+ /* accept the given fd */
269
290
int (* chr_add_client )(Chardev * chr , int fd );
291
+
292
+ /* wait for a connection */
270
293
int (* chr_wait_connected )(Chardev * chr , Error * * errp );
294
+
295
+ /* disconnect a connection */
271
296
void (* chr_disconnect )(Chardev * chr );
297
+
298
+ /* called by frontend when it can read */
272
299
void (* chr_accept_input )(Chardev * chr );
300
+
301
+ /* set terminal echo */
273
302
void (* chr_set_echo )(Chardev * chr , bool echo );
303
+
304
+ /* notify the backend of frontend open state */
274
305
void (* chr_set_fe_open )(Chardev * chr , int fe_open );
306
+
307
+ /* handle various events */
275
308
void (* chr_be_event )(Chardev * s , QEMUChrEvent event );
276
- void (* chr_options_parsed )(Chardev * chr );
277
309
};
278
310
279
311
Chardev * qemu_chardev_new (const char * id , const char * typename ,
0 commit comments