+static struct entry *entry_from_card(pa_card *card) {
+ struct port_info *p_info;
+ struct entry *entry;
+ pa_device_port *port;
+ void *state;
+
+ pa_assert(card);
+
+ entry = entry_new();
+ if (card->save_profile)
+ entry->profile = pa_xstrdup(card->active_profile->name);
+
+ PA_HASHMAP_FOREACH(port, card->ports, state) {
+ p_info = port_info_new(port);
+ pa_assert_se(pa_hashmap_put(entry->ports, p_info->name, p_info) >= 0);
+ }
+
+ return entry;
+}
+
+static bool entrys_equal(struct entry *a, struct entry *b) {
+ struct port_info *Ap_info, *Bp_info;
+ void *state;
+
+ pa_assert(a);
+ pa_assert(b);
+
+ if (!pa_streq(a->profile, b->profile) ||
+ pa_hashmap_size(a->ports) != pa_hashmap_size(b->ports))
+ return false;
+
+ PA_HASHMAP_FOREACH(Ap_info, a->ports, state) {
+ if ((Bp_info = pa_hashmap_get(b->ports, Ap_info->name))) {
+ if (Ap_info->offset != Bp_info->offset)
+ return false;
+ } else
+ return false;
+ }
+
+ return true;
+}
+
+static bool entry_write(struct userdata *u, const char *name, const struct entry *e) {