static int lllib_init(void) { if (liblustre_init_current("liblustre") || init_lib_portals() || init_obdclass() || ptlrpc_init() || mgc_init() || lmv_init() || mdc_init() || lov_init() || osc_init() || slp_global_init()) return -1; return _sysio_fssw_register("lustre", &llu_fssw_ops); }
int main(int argc, char **argv) { int c, rc; int xindex = -1; /* index of -x option */ /* loop until all options are consumed or we hit * a -x option */ while ((c = getopt(argc, argv, "s:n:x:")) != -1 && xindex == -1) { switch (c) { case 's': echo_server_nid = optarg; break; case 'n': echo_server_ostname = optarg; break; case 'x': xindex = optind-1; break; default: usage(argv[0]); return 1; } } /* * Only warn with usage() if the -x option isn't specificed * because when using -x this check is not valid. */ if (optind != argc && xindex == -1) usage(argv[0]); if (!echo_server_nid) { usage(argv[0]); return 1; } libcfs_debug = 0; libcfs_subsystem_debug = 0; liblustre_init_random(); if (liblustre_init_current(argv[0]) || init_obdclass() || init_lib_portals() || ptlrpc_init() || lmv_init() || mdc_init() || lov_init() || osc_init() || echo_client_init()) { printf("error\n"); return 1; } rc = connect_echo_client(); if (rc) return rc; set_ioc_handler(liblustre_ioctl); /* * If the -x option is not specified pass no args to lctl * otherwise pass all the options after the "-x" to lctl * * HACK: in the case when the -x option is specified * lctl sees argv[0] == "-x" and not the real argv[0] seen * in this function. If that is a problem, a mapping will * have to be done to fix that. However for normal functioning * it seems to be irrelavant */ if( xindex == -1 ) rc = lctl_main(1, &argv[0]); else rc = lctl_main(argc-xindex+1, &argv[xindex-1]); rc |= disconnect_echo_client(); return rc; }