X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lnet%2Futils%2Fdebugctl.c;h=93c208fc40b744743d83b5a521096e2f83ac43d3;hb=8e2f5a3a919073a91dd987e36f15678cf0cbdbc8;hp=cf70fd8b115b9cb68135eb5cc38f9e1dee9fd170;hpb=ed88907a96ba81d3558e71ade9def98bdc785169;p=fs%2Flustre-release.git diff --git a/lnet/utils/debugctl.c b/lnet/utils/debugctl.c index cf70fd8..93c208f 100644 --- a/lnet/utils/debugctl.c +++ b/lnet/utils/debugctl.c @@ -1,7 +1,5 @@ -/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- - * vim:expandtab:shiftwidth=8:tabstop=8: - * - * Copyright (C) 2001, 2002 Cluster File Systems, Inc. +/* + * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * * This file is part of Portals, http://www.sf.net/projects/lustre/ * @@ -20,14 +18,12 @@ * * Some day I'll split all of this functionality into a cfs_debug module * of its own. That day is not today. - * */ #include #include -#include #include -#include "parser.h" +#include command_t list[] = { @@ -50,18 +46,31 @@ command_t list[] = { int main(int argc, char **argv) { - if (dbg_initialize(argc, argv) < 0) - exit(2); + int rc = 0; + + rc = libcfs_arch_init(); + if (rc < 0) + return rc; + + rc = dbg_initialize(argc, argv); + if (rc < 0) + goto errorout; register_ioc_dev(LNET_DEV_ID, LNET_DEV_PATH, LNET_DEV_MAJOR, LNET_DEV_MINOR); Parser_init("debugctl > ", list); - if (argc > 1) - return Parser_execarg(argc - 1, &argv[1], list); + if (argc > 1) { + rc = Parser_execarg(argc - 1, &argv[1], list); + unregister_ioc_dev(LNET_DEV_ID); + goto errorout; + } Parser_commands(); unregister_ioc_dev(LNET_DEV_ID); - return 0; + +errorout: + libcfs_arch_cleanup(); + return rc; }