Skip to content
  • Claudio Fontana's avatar
    module: add Error arguments to module_load and module_load_qom · c551fb0b
    Claudio Fontana authored and Paolo Bonzini's avatar Paolo Bonzini committed
    improve error handling during module load, by changing:
    
    bool module_load(const char *prefix, const char *lib_name);
    void module_load_qom(const char *type);
    
    to:
    
    int module_load(const char *prefix, const char *name, Error **errp);
    int module_load_qom(const char *type, Error **errp);
    
    where the return value is:
    
     -1 on module load error, and errp is set with the error
      0 on module or one of its dependencies are not installed
      1 on module load success
      2 on module load success (module already loaded or built-in)
    
    module_load_qom_one has been introduced in:
    
    commit 28457744 ("module: qom module support"), which built on top of
    module_load_one, but discarded the bool return value. Restore it.
    
    Adapt all callers to emit errors, or ignore them, or fail hard,
    as appropriate in each context.
    
    Replace the previous emission of errors via fprintf in _some_ error
    conditions with Error and error_report, so as to emit to the appropriate
    target.
    
    A m...
    c551fb0b