qapi: Support unregistering QMP commands
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20160912091913.15831-7-marcandre.lureau@redhat.com>
This commit is contained in:
		
							parent
							
								
									edcfaefe07
								
							
						
					
					
						commit
						60b03e4e6a
					
				@ -36,6 +36,7 @@ typedef struct QmpCommand
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void qmp_register_command(const char *name, QmpCommandFunc *fn,
 | 
					void qmp_register_command(const char *name, QmpCommandFunc *fn,
 | 
				
			||||||
                          QmpCommandOptions options);
 | 
					                          QmpCommandOptions options);
 | 
				
			||||||
 | 
					void qmp_unregister_command(const char *name);
 | 
				
			||||||
QmpCommand *qmp_find_command(const char *name);
 | 
					QmpCommand *qmp_find_command(const char *name);
 | 
				
			||||||
QObject *qmp_dispatch(QObject *request);
 | 
					QObject *qmp_dispatch(QObject *request);
 | 
				
			||||||
void qmp_disable_command(const char *name);
 | 
					void qmp_disable_command(const char *name);
 | 
				
			||||||
 | 
				
			|||||||
@ -30,6 +30,14 @@ void qmp_register_command(const char *name, QmpCommandFunc *fn,
 | 
				
			|||||||
    QTAILQ_INSERT_TAIL(&qmp_commands, cmd, node);
 | 
					    QTAILQ_INSERT_TAIL(&qmp_commands, cmd, node);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void qmp_unregister_command(const char *name)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    QmpCommand *cmd = qmp_find_command(name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    QTAILQ_REMOVE(&qmp_commands, cmd, node);
 | 
				
			||||||
 | 
					    g_free(cmd);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
QmpCommand *qmp_find_command(const char *name)
 | 
					QmpCommand *qmp_find_command(const char *name)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    QmpCommand *cmd;
 | 
					    QmpCommand *cmd;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user