X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fmgc%2Flibmgc.c;h=42956d84e82ce0adc5b41138770a4d513086f8fa;hb=ef6225af104b9138638c71b80e87786b8e5e75e5;hp=49a8260c8cec3dcdb61759edc1bbccf62f31cdde;hpb=113303973ec9f8484eb2355a1a6ef3c4c7fd6a56;p=fs%2Flustre-release.git diff --git a/lustre/mgc/libmgc.c b/lustre/mgc/libmgc.c index 49a8260..42956d8 100644 --- a/lustre/mgc/libmgc.c +++ b/lustre/mgc/libmgc.c @@ -1,34 +1,47 @@ -/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- - * vim:expandtab:shiftwidth=8:tabstop=8: +/* + * GPL HEADER START * - * lustre/mgc/mgc_request.c - * Lustre Management Client + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright (C) 2006 Cluster File Systems, Inc. - * Author: Nathan Rutman + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 only, + * as published by the Free Software Foundation. * - * This file is part of Lustre, http://www.lustre.org + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License version 2 for more details (a copy is included + * in the LICENSE file that accompanied this code). * - * Lustre is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * You should have received a copy of the GNU General Public License + * version 2 along with this program; If not, see + * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf * - * Lustre is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. * - * You should have received a copy of the GNU General Public License - * along with Lustre; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * GPL HEADER END + */ +/* + * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. + * Use is subject to license terms. + * + * Copyright (c) 2011, Whamcloud, Inc. + */ +/* + * This file is part of Lustre, http://www.lustre.org/ + * Lustre is a trademark of Sun Microsystems, Inc. * + * lustre/mgc/libmgc.c + * + * Lustre Management Client + * Author: Nathan Rutman */ + /* Minimal MGC for liblustre: only used to read the config log from the MGS at setup time, no updates. */ - -#ifndef EXPORT_SYMTAB -# define EXPORT_SYMTAB -#endif + #define DEBUG_SUBSYSTEM S_MGC #include @@ -39,18 +52,22 @@ #include #include -static int mgc_setup(struct obd_device *obd, obd_count len, void *buf) + +static int mgc_setup(struct obd_device *obd, struct lustre_cfg *lcfg) { int rc; ENTRY; ptlrpcd_addref(); - rc = client_obd_setup(obd, len, buf); + rc = client_obd_setup(obd, lcfg); if (rc) GOTO(err_decref, rc); - rc = obd_llog_init(obd, obd, 0, NULL, NULL); + /* liblustre only support null flavor to MGS */ + obd->u.cli.cl_flvr_mgc.sf_rpc = SPTLRPC_FLVR_NULL; + + rc = obd_llog_init(obd, &obd->obd_olg, obd, NULL); if (rc) { CERROR("failed to setup llogging subsystems\n"); GOTO(err_cleanup, rc); @@ -71,16 +88,13 @@ static int mgc_precleanup(struct obd_device *obd, enum obd_cleanup_stage stage) ENTRY; switch (stage) { - case OBD_CLEANUP_EARLY: + case OBD_CLEANUP_EARLY: case OBD_CLEANUP_EXPORTS: - break; - case OBD_CLEANUP_SELF_EXP: + obd_cleanup_client_import(obd); rc = obd_llog_finish(obd, 0); if (rc != 0) CERROR("failed to cleanup llogging subsystems\n"); break; - case OBD_CLEANUP_OBD: - break; } RETURN(rc); } @@ -92,26 +106,27 @@ static int mgc_cleanup(struct obd_device *obd) ENTRY; LASSERT(cli->cl_mgc_vfsmnt == NULL); - + ptlrpcd_decref(); rc = client_obd_cleanup(obd); RETURN(rc); } -static int mgc_llog_init(struct obd_device *obd, struct obd_device *tgt, - int count, struct llog_catid *logid, - struct obd_uuid *uuid) +static int mgc_llog_init(struct obd_device *obd, struct obd_llog_group *olg, + struct obd_device *tgt, int *index) { struct llog_ctxt *ctxt; int rc; ENTRY; - rc = llog_setup(obd, LLOG_CONFIG_REPL_CTXT, tgt, 0, NULL, + LASSERT(olg == &obd->obd_olg); + rc = llog_setup(obd, olg, LLOG_CONFIG_REPL_CTXT, tgt, 0, NULL, &llog_client_ops); if (rc == 0) { - ctxt = llog_get_context(obd, LLOG_CONFIG_REPL_CTXT); - ctxt->loc_imp = obd->u.cli.cl_import; + ctxt = llog_group_get_ctxt(olg, LLOG_CONFIG_REPL_CTXT); + llog_initiator_connect(ctxt); + llog_ctxt_put(ctxt); } RETURN(rc); @@ -142,6 +157,6 @@ struct obd_ops mgc_obd_ops = { int __init mgc_init(void) { - return class_register_type(&mgc_obd_ops, NULL, LUSTRE_MGC_NAME); + return class_register_type(&mgc_obd_ops, NULL, + NULL, LUSTRE_MGC_NAME, NULL); } -