]> git.draconx.ca Git - upkg.git/blobdiff - src/upkg.c
uobject: Implement an interface for loading/unloading.
[upkg.git] / src / upkg.c
index 82a673d100ccc6c522bd597713608ab40d3cd7fb..87794cb6b1c3b6413e2d68383742a1b3c00e0b85 100644 (file)
@@ -28,6 +28,7 @@
 #include "module.h"
 #include "uobject.h"
 #include "exportable.h"
+#include "loadable.h"
 
 enum {
        MODE_INFO,
@@ -161,6 +162,11 @@ static int export(struct upkg *pkg, GObject *obj, unsigned idx)
        if (u_object_deserialize(obj, f) != 0) {
                goto out;
        }
+
+       if (U_OBJECT_IS_LOADABLE(obj) && u_object_load(obj) != 0) {
+               goto out;
+       }
+
        u_object_export_name(obj, name, sizeof name);
 
        printf("exporting %s to %s\n", upkg_export_name(pkg, idx), name);
@@ -178,6 +184,10 @@ static int export(struct upkg *pkg, GObject *obj, unsigned idx)
                goto out;
        }
 
+       if (U_OBJECT_IS_LOADABLE(obj)) {
+               u_object_unload(obj);
+       }
+
 out:
        upkg_export_close(f);
        return rc;