+ if (obd->obd_type == NULL)
+ continue;
+ if ((strncmp(obd->obd_type->typ_name, typ_name,
+ strlen(typ_name)) == 0)) {
+ struct client_obd *cli = &obd->u.cli;
+ struct obd_import *imp = cli->cl_import;
+ if (tgt_uuid == NULL) {
+ LASSERT(grp_uuid);
+ if (obd_uuid_equals(grp_uuid, &obd->obd_uuid))
+ return obd;
+ continue;
+ }
+ if (obd_uuid_equals(tgt_uuid, &imp->imp_target_uuid) &&
+ ((grp_uuid)? obd_uuid_equals(grp_uuid,
+ &obd->obd_uuid) : 1)) {
+ return obd;
+ }
+ }
+ }
+
+ return NULL;
+}
+
+/* Iterate the obd_device list looking devices have grp_uuid. Start
+ searching at *next, and if a device is found, the next index to look
+ it is saved in *next. If next is NULL, then the first matching device
+ will always be returned. */
+struct obd_device * class_devices_in_group(struct obd_uuid *grp_uuid, int *next)
+{
+ int i;
+ if (next == NULL)
+ i = 0;
+ else if (*next >= 0 && *next < MAX_OBD_DEVICES)
+ i = *next;
+ else
+ return NULL;
+
+ for (; i < MAX_OBD_DEVICES; i++) {
+ struct obd_device *obd = &obd_dev[i];
+ if (obd->obd_type == NULL)
+ continue;
+ if (obd_uuid_equals(grp_uuid, &obd->obd_uuid)) {
+ if (next != NULL)
+ *next = i+1;