#include <sys/types.h>
#include <sys/queue.h>
+#ifdef HAVE_XTIO_H
+#include <xtio.h>
+#endif
#include <sysio.h>
#include <fs.h>
#include <mount.h>
#include <inode.h>
+#ifdef HAVE_FILE_H
#include <file.h>
+#endif
+
+/* env variables */
+#define ENV_LUSTRE_MNTPNT "LIBLUSTRE_MOUNT_POINT"
+#define ENV_LUSTRE_MNTTGT "LIBLUSTRE_MOUNT_TARGET"
+#define ENV_LUSTRE_TIMEOUT "LIBLUSTRE_TIMEOUT"
+#define ENV_LUSTRE_DUMPFILE "LIBLUSTRE_DUMPFILE"
+#define ENV_LUSTRE_DEBUG_MASK "LIBLUSTRE_DEBUG_MASK"
+#define ENV_LUSTRE_DEBUG_SUBSYS "LIBLUSTRE_DEBUG_SUBSYS"
+#define ENV_LUSTRE_NAL_NAME "LIBLUSTRE_NAL_NAME"
#ifdef REDSTORM
#define CSTART_INIT
int liblustre_process_log(struct config_llog_instance *cfg, int allow_recov)
{
- struct lustre_cfg lcfg;
+ struct lustre_cfg_bufs bufs;
+ struct lustre_cfg *lcfg;
+
char *peer = "MDS_PEER_UUID";
struct obd_device *obd;
struct lustre_handle mdc_conn = {0, };
struct llog_ctxt *ctxt;
ptl_nid_t nid = 0;
int nal, err, rc = 0;
+ char *nal_name;
ENTRY;
generate_random_uuid(uuid);
RETURN(-EINVAL);
}
- nal = ptl_name2nal(LIBLUSTRE_NAL_NAME);
+ nal_name = getenv(ENV_LUSTRE_NAL_NAME);
+ if (!nal_name)
+ nal_name = "tcp";
+ nal = ptl_name2nal(nal_name);
if (nal <= 0) {
- CERROR("Can't parse NAL %s\n", LIBLUSTRE_NAL_NAME);
+ CERROR("Can't parse NAL %s\n", nal_name);
RETURN(-EINVAL);
}
- LCFG_INIT(lcfg, LCFG_ADD_UUID, name);
- lcfg.lcfg_nid = nid;
- lcfg.lcfg_inllen1 = strlen(peer) + 1;
- lcfg.lcfg_inlbuf1 = peer;
- lcfg.lcfg_nal = nal;
- err = class_process_config(&lcfg);
+ lustre_cfg_bufs_reset(&bufs, NULL);
+ lustre_cfg_bufs_set_string(&bufs, 1, peer);
+ lcfg = lustre_cfg_new(LCFG_ADD_UUID, &bufs);
+ lcfg->lcfg_nid = nid;
+ lcfg->lcfg_nal = nal;
+ err = class_process_config(lcfg);
+ lustre_cfg_free(lcfg);
if (err < 0)
GOTO(out, err);
- LCFG_INIT(lcfg, LCFG_ATTACH, name);
- lcfg.lcfg_inlbuf1 = "mdc";
- lcfg.lcfg_inllen1 = strlen(lcfg.lcfg_inlbuf1) + 1;
- lcfg.lcfg_inlbuf2 = mdc_uuid.uuid;
- lcfg.lcfg_inllen2 = strlen(lcfg.lcfg_inlbuf2) + 1;
- err = class_process_config(&lcfg);
+ lustre_cfg_bufs_reset(&bufs, name);
+ lustre_cfg_bufs_set_string(&bufs, 1, OBD_MDC_DEVICENAME);
+ lustre_cfg_bufs_set_string(&bufs, 2, mdc_uuid.uuid);
+ lcfg = lustre_cfg_new(LCFG_ATTACH, &bufs);
+ err = class_process_config(lcfg);
+ lustre_cfg_free(lcfg);
if (err < 0)
GOTO(out_del_uuid, err);
- LCFG_INIT(lcfg, LCFG_SETUP, name);
- lcfg.lcfg_inlbuf1 = g_zconf_mdsname;
- lcfg.lcfg_inllen1 = strlen(lcfg.lcfg_inlbuf1) + 1;
- lcfg.lcfg_inlbuf2 = peer;
- lcfg.lcfg_inllen2 = strlen(lcfg.lcfg_inlbuf2) + 1;
- err = class_process_config(&lcfg);
+ lustre_cfg_bufs_reset(&bufs, name);
+ lustre_cfg_bufs_set_string(&bufs, 1, g_zconf_mdsname);
+ lustre_cfg_bufs_set_string(&bufs, 2, peer);
+ lcfg = lustre_cfg_new(LCFG_SETUP, &bufs);
+ err = class_process_config(lcfg);
+ lustre_cfg_free(lcfg);
if (err < 0)
GOTO(out_detach, err);
-
+
obd = class_name2obd(name);
if (obd == NULL)
GOTO(out_cleanup, err = -EINVAL);
strlen("initial_recov"), "initial_recov",
sizeof(allow_recov), &allow_recov);
- err = obd_connect(&mdc_conn, obd, &mdc_uuid, 0);
+ err = obd_connect(&mdc_conn, obd, &mdc_uuid, NULL, 0);
if (err) {
CERROR("cannot connect to %s: rc = %d\n",
g_zconf_mdsname, err);
GOTO(out_cleanup, err);
}
-
+
exp = class_conn2export(&mdc_conn);
-
+
ctxt = exp->exp_obd->obd_llog_ctxt[LLOG_CONFIG_REPL_CTXT];
rc = class_config_process_llog(ctxt, g_zconf_profile, cfg);
if (rc)
err = obd_disconnect(exp, 0);
out_cleanup:
- LCFG_INIT(lcfg, LCFG_CLEANUP, name);
- err = class_process_config(&lcfg);
+ lustre_cfg_bufs_reset(&bufs, name);
+ lcfg = lustre_cfg_new(LCFG_CLEANUP, &bufs);
+ err = class_process_config(lcfg);
+ lustre_cfg_free(lcfg);
if (err < 0)
GOTO(out, err);
out_detach:
- LCFG_INIT(lcfg, LCFG_DETACH, name);
- err = class_process_config(&lcfg);
+ lustre_cfg_bufs_reset(&bufs, name);
+ lcfg = lustre_cfg_new(LCFG_DETACH, &bufs);
+ err = class_process_config(lcfg);
+ lustre_cfg_free(lcfg);
if (err < 0)
GOTO(out, err);
out_del_uuid:
- LCFG_INIT(lcfg, LCFG_DEL_UUID, name);
- lcfg.lcfg_inllen1 = strlen(peer) + 1;
- lcfg.lcfg_inlbuf1 = peer;
- err = class_process_config(&lcfg);
-
+ lustre_cfg_bufs_reset(&bufs, name);
+ lustre_cfg_bufs_set_string(&bufs, 1, peer);
+ lcfg = lustre_cfg_new(LCFG_DEL_UUID, &bufs);
+ err = class_process_config(lcfg);
+ lustre_cfg_free(lcfg);
out:
if (rc == 0)
rc = err;
-
+
RETURN(rc);
}
if ((s = strchr(buf, ':'))) {
*mdsnid = buf;
*s = '\0';
-
+
while (*++s == '/')
;
*mdsname = s;
* or in the apps themselves. The NAMESPACE_STRING specifying
* the initial set of fs ops (creates, mounts, etc.) is passed
* as an environment variable.
- *
+ *
* _sysio_init();
* _sysio_incore_init();
* _sysio_native_init();
err = lllib_init();
if (err) {
perror("init llite driver");
- }
+ }
return err;
}
-/* env variables */
-#define ENV_LUSTRE_MNTPNT "LIBLUSTRE_MOUNT_POINT"
-#define ENV_LUSTRE_MNTTGT "LIBLUSTRE_MOUNT_TARGET"
-#define ENV_LUSTRE_TIMEOUT "LIBLUSTRE_TIMEOUT"
-#define ENV_LUSTRE_DUMPFILE "LIBLUSTRE_DUMPFILE"
-#define ENV_LUSTRE_DEBUG_MASK "LIBLUSTRE_DEBUG_MASK"
-#define ENV_LUSTRE_DEBUG_SUBSYS "LIBLUSTRE_DEBUG_SUBSYS"
-
extern int _sysio_native_init();
extern unsigned int obd_timeout;
-static char *lustre_path = NULL;
+char *lustre_path = NULL;
/* global variables */
char *g_zconf_mdsname = NULL; /* mdsname, for zeroconf */
portal_subsystem_debug =
(unsigned int) strtol(debug_subsys, NULL, 0);
-#ifndef CSTART_INIT
+
+#ifdef INIT_SYSIO
/* initialize libsysio & mount rootfs */
- if (_sysio_init()) {
- perror("init sysio");
- exit(1);
- }
+ if (_sysio_init()) {
+ perror("init sysio");
+ exit(1);
+ }
_sysio_native_init();
- err = _sysio_mount_root(root_path, root_driver, mntflgs, NULL);
- if (err) {
- perror(root_driver);
- exit(1);
- }
+ err = _sysio_mount_root(root_path, root_driver, mntflgs, NULL);
+ if (err) {
+ perror(root_driver);
+ exit(1);
+ }
if (_sysio_lustre_init())
- exit(1);
-#endif
+ exit(1);
+#endif /* INIT_SYSIO */
err = mount("/", lustre_path, lustre_driver, mntflgs, NULL);
- if (err) {
- errno = -err;
- perror(lustre_driver);
- exit(1);
- }
+ if (err) {
+ errno = -err;
+ perror(lustre_driver);
+ exit(1);
+ }
}
void __liblustre_cleanup_(void)
* liblutre. this delima lead to another hack in
* libsysio/src/file_hack.c FIXME
*/
+#ifdef INIT_SYSIO
_sysio_shutdown();
cleanup_lib_portals();
PtlFini();
+#else
+ /*
+ * don't do any libsysio or low level portals cleanups
+ * platform framework does it
+ */
+ cleanup_lib_portals();
+#endif
}