static int lash_process(void *context) { lash_t *p_lash = context; osm_log_t *p_log = &p_lash->p_osm->log; int status = 0; OSM_LOG_ENTER(p_log); p_lash->balance_limit = 6; /* everything starts here */ lash_cleanup(p_lash); status = discover_network_properties(p_lash); if (status) goto Exit; status = init_lash_structures(p_lash); if (status) goto Exit; process_switches(p_lash); status = lash_core(p_lash); if (status) goto Exit; populate_fwd_tbls(p_lash); Exit: if (p_lash->vl_min) free_lash_structures(p_lash); OSM_LOG_EXIT(p_log); return status; }
/** * Populate @p bkpinfo from the command-line parameters stored in @p argc and @p argv. * @param argc The argument count, including the program name; @p argc passed to main(). * @param argv The argument vector; @p argv passed to main(). * @param bkpinfo The backup information structure to populate. * @return The number of problems with the command line (0 for success). */ int handle_incoming_parameters(int argc, char *argv[], struct s_bkpinfo *bkpinfo) { /*@ int *** */ int res = 0; int retval = 0; int i = 0, j; /*@ buffers *************** */ char *tmp; char flag_val[128][MAX_STR_LEN]; bool flag_set[128]; malloc_string(tmp); sensibly_set_tmpdir_and_scratchdir(bkpinfo); for (i = 0; i < 128; i++) { flag_val[i][0] = '\0'; flag_set[i] = FALSE; } // strcpy (bkpinfo->tmpdir, "/root/images/mondo"); // strcpy (bkpinfo->scratchdir, "/home"); for (j = 1; j <= MAX_NOOF_MEDIA; j++) { bkpinfo->media_size[j] = 650; } /* default */ res = retrieve_switches_from_command_line(argc, argv, flag_val, flag_set); retval += res; if (!retval) { res = process_switches(bkpinfo, flag_val, flag_set); retval += res; } /* if (!retval) { */ log_msg(3, "Switches:-"); for (i = 0; i < 128; i++) { if (flag_set[i]) { sprintf(tmp, "-%c %s", i, flag_val[i]); log_msg(3, tmp); } } // } sprintf(tmp, "rm -Rf %s/tmp.mondo.*", bkpinfo->tmpdir); paranoid_system(tmp); sprintf(tmp, "rm -Rf %s/mondo.scratch.*", bkpinfo->scratchdir); paranoid_system(tmp); sprintf(bkpinfo->tmpdir + strlen(bkpinfo->tmpdir), "/tmp.mondo.%ld", random() % 32767); sprintf(bkpinfo->scratchdir + strlen(bkpinfo->scratchdir), "/mondo.scratch.%ld", random() % 32767); sprintf(tmp, "mkdir -p %s/tmpfs", bkpinfo->tmpdir); paranoid_system(tmp); sprintf(tmp, "mkdir -p %s", bkpinfo->scratchdir); paranoid_system(tmp); if (bkpinfo->nfs_mount[0] != '\0') { store_nfs_config(bkpinfo); } paranoid_free(tmp); return (retval); }