On 10:21 Wed 05 Aug     , Hal Rosenstock wrote:
> 
> Is this what you mean or am I missing your idea on how the p_lash->switches
> array is to be reordered ?

Thinking more about this I suppose that an original structure is good
enough for doing what you need without intermediate buffers. It could be
something like this:

        qsort(index....);

        for (i = 0; i < num_switches; i++)
                lash->switches[index[i].index]->id = i;

        for (i = 0; i < num_switches; i++) {
                s = lash->switches[i];
                for (j = 0; j < s->num_links; j++)
                        s->links[j]->switch_id =
                            lash->switches[s->links[j]->switch_id]->id;
        }

        for (i = 0; i < num_switches; i++) {
                s = lash->switches[i];
                while (s->id != i) {
                        s1 = lash->switches[s->id];
                        lash->switches[s->id] = s;
                        s = s1;
                }
        }

Would it work?

Sasha
_______________________________________________
general mailing list
general@lists.openfabrics.org
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to