static void init(int use_slice) { #if 0 char logfile[] = "test.log"; char logpre[] = "thread_test"; acl_msg_open(logfile, logpre); #endif if (use_slice) acl_mem_slice_init(8, 10240, 100000, ACL_SLICE_FLAG_GC2 | ACL_SLICE_FLAG_RTGC_OFF | ACL_SLICE_FLAG_LP64_ALIGN); acl_init(); echo_client_init(ECHO_CTL_SERV_ADDR, __svr_addr, ECHO_CTL_MAX_CONNECT, __nconnect, ECHO_CTL_MAX_LOOP, __nloop, ECHO_CTL_TIMEOUT, __timeout, ECHO_CTL_DATA_LEN, __dlen, ECHO_CTL_NCONN_PERSEC, __nconn_per_sec, ECHO_CTL_EVENT_MODE, __event_mode, ECHO_CTL_END); }
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; }