monitor: Add netdev_del id argument completion.
Signed-off-by: Hani Benhabiles <hani@linux.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
This commit is contained in:
		
							parent
							
								
									b162b49adc
								
							
						
					
					
						commit
						11b389f21e
					
				@ -1252,6 +1252,7 @@ ETEXI
 | 
				
			|||||||
        .params     = "id",
 | 
					        .params     = "id",
 | 
				
			||||||
        .help       = "remove host network device",
 | 
					        .help       = "remove host network device",
 | 
				
			||||||
        .mhandler.cmd = hmp_netdev_del,
 | 
					        .mhandler.cmd = hmp_netdev_del,
 | 
				
			||||||
 | 
					        .command_completion = netdev_del_completion,
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
STEXI
 | 
					STEXI
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										1
									
								
								hmp.h
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								hmp.h
									
									
									
									
									
								
							@ -102,5 +102,6 @@ void chardev_remove_completion(ReadLineState *rs, int nb_args, const char *str);
 | 
				
			|||||||
void chardev_add_completion(ReadLineState *rs, int nb_args, const char *str);
 | 
					void chardev_add_completion(ReadLineState *rs, int nb_args, const char *str);
 | 
				
			||||||
void set_link_completion(ReadLineState *rs, int nb_args, const char *str);
 | 
					void set_link_completion(ReadLineState *rs, int nb_args, const char *str);
 | 
				
			||||||
void netdev_add_completion(ReadLineState *rs, int nb_args, const char *str);
 | 
					void netdev_add_completion(ReadLineState *rs, int nb_args, const char *str);
 | 
				
			||||||
 | 
					void netdev_del_completion(ReadLineState *rs, int nb_args, const char *str);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										26
									
								
								monitor.c
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								monitor.c
									
									
									
									
									
								
							@ -4493,6 +4493,32 @@ void set_link_completion(ReadLineState *rs, int nb_args, const char *str)
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void netdev_del_completion(ReadLineState *rs, int nb_args, const char *str)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    int len, count, i;
 | 
				
			||||||
 | 
					    NetClientState *ncs[255];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (nb_args != 2) {
 | 
				
			||||||
 | 
					        return;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    len = strlen(str);
 | 
				
			||||||
 | 
					    readline_set_completion_index(rs, len);
 | 
				
			||||||
 | 
					    count = qemu_find_net_clients_except(NULL, ncs, NET_CLIENT_OPTIONS_KIND_NIC,
 | 
				
			||||||
 | 
					                                         255);
 | 
				
			||||||
 | 
					    for (i = 0; i < count; i++) {
 | 
				
			||||||
 | 
					        QemuOpts *opts;
 | 
				
			||||||
 | 
					        const char *name = ncs[i]->name;
 | 
				
			||||||
 | 
					        if (strncmp(str, name, len)) {
 | 
				
			||||||
 | 
					            continue;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        opts = qemu_opts_find(qemu_find_opts_err("netdev", NULL), name);
 | 
				
			||||||
 | 
					        if (opts) {
 | 
				
			||||||
 | 
					            readline_add_completion(rs, name);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void monitor_find_completion_by_table(Monitor *mon,
 | 
					static void monitor_find_completion_by_table(Monitor *mon,
 | 
				
			||||||
                                             const mon_cmd_t *cmd_table,
 | 
					                                             const mon_cmd_t *cmd_table,
 | 
				
			||||||
                                             char **args,
 | 
					                                             char **args,
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user