+#endif
+
+/* locate_nx_info()
+
+ * search for a nx_info and get() it
+ * negative id means current */
+
+struct nx_info *locate_nx_info(int id)
+{
+ struct nx_info *nxi = NULL;
+
+ if (id < 0) {
+ nxi = get_nx_info(current->nx_info);
+ } else if (id > 1) {
+ spin_lock(&nx_info_hash_lock);
+ nxi = get_nx_info(__lookup_nx_info(id));
+ spin_unlock(&nx_info_hash_lock);
+ }
+ return nxi;
+}
+
+/* nid_is_hashed()
+
+ * verify that nid is still hashed */
+
+int nid_is_hashed(nid_t nid)
+{
+ int hashed;
+
+ spin_lock(&nx_info_hash_lock);
+ hashed = (__lookup_nx_info(nid) != NULL);
+ spin_unlock(&nx_info_hash_lock);
+ return hashed;
+}
+
+
+#ifdef CONFIG_PROC_FS
+
+int get_nid_list(int index, unsigned int *nids, int size)
+{
+ int hindex, nr_nids = 0;
+
+ for (hindex = 0; hindex < NX_HASH_SIZE; hindex++) {
+ struct hlist_head *head = &nx_info_hash[hindex];
+ struct hlist_node *pos;
+
+ spin_lock(&nx_info_hash_lock);
+ hlist_for_each(pos, head) {
+ struct nx_info *nxi;
+
+ if (--index > 0)
+ continue;
+
+ nxi = hlist_entry(pos, struct nx_info, nx_hlist);
+ nids[nr_nids] = nxi->nx_id;
+ if (++nr_nids >= size) {
+ spin_unlock(&nx_info_hash_lock);
+ goto out;
+ }
+ }
+ /* keep the lock time short */
+ spin_unlock(&nx_info_hash_lock);
+ }
+out:
+ return nr_nids;
+}
+#endif
+
+