+ struct upkg_priv *pkg = (struct upkg_priv *)pub;
+ struct upkg_export *parent = NULL;
+
+ if (parent_index >= 0) {
+ if (parent_index >= pkg->pub.export_count)
+ return -1;
+ parent = &pkg->exports[parent_index].pub;
+ }
+
+ for (unsigned long i = 0; i < pkg->pub.export_count; i++) {
+ struct upkg_export_priv *e = &pkg->exports[i];
+
+ if (e->pub.parent == parent && !strcmp(e->pub.name, name))
+ return i;
+ }
+
+ return -1;
+}
+
+const struct upkg_export *upkg_get_export(struct upkg *pub, unsigned long idx)
+{
+ struct upkg_priv *pkg = (struct upkg_priv *)pub;
+
+ if (idx < pkg->pub.export_count)
+ return &pkg->exports[idx].pub;
+ return NULL;
+}
+
+const struct upkg_import *upkg_get_import(struct upkg *pub, unsigned long idx)
+{
+ struct upkg_priv *pkg = (struct upkg_priv *)pub;
+
+ if (idx < pkg->pub.import_count)
+ return &pkg->imports[idx];
+ return NULL;
+}
+
+struct upkg_file *upkg_export_open(struct upkg *pub, unsigned long idx)
+{
+ struct upkg_priv *pkg = (struct upkg_priv *)pub;