+static int client_obd_connect(struct obd_device *obd, char *name,
+ struct lustre_handle *conn,
+ struct obd_connect_data *data,
+ unsigned long flags)
+{
+ struct obd_device *cli_obd;
+ int rc = 0;
+ ENTRY;
+
+ LASSERT(obd);
+ LASSERT(name);
+ LASSERT(conn);
+
+ cli_obd = class_name2obd(name);
+ if (cli_obd == NULL) {
+ CERROR("%s: unable to find a client for obd: %s\n",
+ obd->obd_name, name);
+ RETURN(-EINVAL);
+ }
+ rc = obd_connect(conn, cli_obd, &obd->obd_uuid, data, flags);
+ if (rc) {
+ CERROR("error connecting to %s, err %d\n",
+ name, rc);
+ }
+ RETURN(rc);
+}
+
+static int client_obd_disconnect(struct obd_device *obd,
+ struct obd_export *exp,
+ unsigned long flags)
+{
+ struct obd_device *cli_obd;
+ int rc = 0;
+ ENTRY;
+
+ cli_obd = class_exp2obd(exp);
+ cli_obd->obd_no_recov = obd->obd_no_recov;
+
+ rc = obd_disconnect(exp, flags);
+ if (rc) {
+ CERROR("error disconnecting from %s, err %d\n",
+ cli_obd->obd_name, rc);
+ class_export_put(exp);
+ }
+ RETURN(rc);
+}
+