void instr_lld(t_list *list, t_game *game, t_fork *fork) { (void)list; reset_param(fork); recup_flag(fork, game); put_arg(fork, game); fork->fptr = &exec_lld; fork->nb_cycle_end_instr = NB_CYCLE_LLD; }
int main(int argc, char **argv) { static char short_options[] = "hCvr:fszbWt"; static struct option long_options[] = { {"remove-area", required_argument, NULL, 'r'}, {"nodeps", optional_argument, NULL, 'f'}, {"nostart", no_argument, NULL, 's'}, {"run-as", required_argument, NULL, RUNAS_OPTS}, {"ssh", required_argument, NULL, SSH_OPTS}, {"help", no_argument, NULL, 'h'}, {"keeper", optional_argument, NULL, KEEPER_OPTS}, {"keep-dst", no_argument, NULL, KEEPDST_OPTS}, {"online", no_argument, NULL, ONLINE_OPTS}, {"lazy", no_argument, NULL, LAZY_OPTS}, {"eztempl", no_argument, NULL, 'z'}, {"readonly", no_argument, NULL, SKIP_LOCKVE_OPTS}, {"dry-run", no_argument, NULL, DRY_RUN_OPTS}, {"noiter", no_argument, NULL, NOITER_OPTS}, {"require-realtime", no_argument, NULL, REAL_TIME_OPTS}, {"new-name", required_argument, NULL, NEW_NAME_OPTS}, {"new-id", required_argument, NULL, NEW_ID_OPTS}, {"new-private", required_argument, NULL, NEW_PRIVATE_OPTS}, {"dst", required_argument, NULL, DST_OPTS}, {"new-root", required_argument, NULL, NEW_ROOT_OPTS}, {"batch", no_argument, NULL, 'b'}, {"nonsharedfs", no_argument, NULL, NONSHAREDFS_OPTS}, {"whole-file", no_argument, NULL, WHOLE_FILE_OPTS}, {"verbose", no_argument, NULL, 'v'}, {"timeout", required_argument, NULL, TIMEOUT_OPTS}, {"no-ssl", no_argument, NULL, NO_SSL_OPTS}, {"certificate", required_argument, NULL, CERTIFICATE_OPTS}, {"privatekey", required_argument, NULL, PRIVATEKEY_OPTS}, {"ciphers", required_argument, NULL, CIPHERS_OPTS}, {"keep-images", no_argument, NULL, KEEP_IMAGES_OPTS}, {"nocompress", no_argument, NULL, NOCOMPRESS_OPTS}, {"ignore-backup-disk", no_argument, NULL, IGNORE_BACKUP_DISK_OPTS}, {"noevent", no_argument, NULL, NOEVENT_OPTS}, {0, 0, 0, 0} }; char **new_args, *dst_host, *dst_ct = NULL, c; int new_argc, new_syntax = 0, i; char buffer[BUFSIZ]; /* * in the worst case we'll need approx argc * 2 arguments * (one for arg and the other one for opt) plus 2 for types * and 1 for terminating NULL * and +2 for dst private & dst root in old syntax: * 101:101:/vz/private/101:/vz/root/101 */ new_args = malloc((argc * 2 + 3 + 2) * sizeof(char *)); if (new_args == NULL) { perror("Not enough memory"); exit(1); } memset(new_args, 0, (argc * 2 + 3) * sizeof(char *)); new_args[0] = "pmigrate.c2c"; new_args[1] = NULL; /* will be set later */ new_args[2] = NULL; /* will be set later */ new_argc = 3; /* according to mesk@ vzmigrate is never called by agent directly */ while ((c = getopt_long(argc, argv, short_options, long_options, NULL)) != -1) { switch (c) { CHECK_OOPT_ARG(KEEPER_OPTS, "--keeper"); CHECK_OOPT_ARG('f', "--nodeps"); CHECK_NOOPT_ARG(KEEPDST_OPTS, "--keep-dst"); CHECK_NOOPT_ARG(DRY_RUN_OPTS, "--dry-run"); CHECK_NOOPT_ARG(ONLINE_OPTS, "--online"); CHECK_NOOPT_ARG(LAZY_OPTS, "--lazy"); CHECK_NOOPT_ARG(SKIP_LOCKVE_OPTS, "--readonly"); CHECK_NOOPT_ARG(NOITER_OPTS, "--noiter"); CHECK_NOOPT_ARG(REAL_TIME_OPTS, "--require-realtime"); CHECK_NOOPT_ARG('s', "--nostart"); CHECK_NOOPT_ARG('z', "--eztempl"); CHECK_NOOPT_ARG('v', "--verbose"); CHECK_NOOPT_ARG(NONSHAREDFS_OPTS, "--nonsharedfs"); CHECK_NOOPT_ARG(WHOLE_FILE_OPTS, "--whole-file"); CHECK_NOOPT_ARG(NO_SSL_OPTS, "--no-ssl"); CHECK_NOOPT_ARG(KEEP_IMAGES_OPTS, "--keep-images"); CHECK_NOOPT_ARG('b', "--batch"); CHECK_NOOPT_ARG(NOCOMPRESS_OPTS, "--nocompress"); CHECK_NOOPT_ARG(NOEVENT_OPTS, "--noevent"); CHECK_MOPT_ARG(TIMEOUT_OPTS, "--timeout"); CHECK_MOPT_ARG(CERTIFICATE_OPTS, "--certificate"); CHECK_MOPT_ARG(SSH_OPTS, "--ssh"); CHECK_MOPT_ARG(RUNAS_OPTS, "--run-as"); CHECK_MOPT_ARG(PRIVATEKEY_OPTS, "--privatekey"); CHECK_MOPT_ARG(CIPHERS_OPTS, "--ciphers"); CHECK_MOPT_ARG('r', "--remove-area"); CHECK_MOPT_NEW_ARG(NEW_PRIVATE_OPTS, "--new-private"); CHECK_MOPT_NEW_ARG(DST_OPTS, "--dst"); CHECK_MOPT_NEW_ARG(NEW_ROOT_OPTS, "--new-root"); CHECK_MOPT_NEW_ARG(NEW_NAME_OPTS, "--new-name"); CHECK_NOOPT_ARG(IGNORE_BACKUP_DISK_OPTS, "--ignore-backup-disk"); case NEW_ID_OPTS: if (optarg == NULL) usage(); new_syntax = 1; dst_ct = optarg; break; case 'h': default: usage(); } } argc -= optind; argv += optind; if (argc < 2) usage(); dst_host = *argv; argv++; argc--; if (argc > MAX_VE_AVAILABLE) { fprintf(stderr, "Maximum number of VEs is limited by %d", MAX_VE_AVAILABLE); usage(); } if (new_syntax) { if (argc != 1) { fprintf(stderr, "Only one veid/vename should be used " "with --new-* options"); usage(); } if (strchr(argv[0], ':')) { fprintf(stderr, "Old ve list syntax can not be used " "with --new-* options: %s", argv[0]); usage(); } if (dst_ct == NULL) dst_ct = argv[0]; return call_pmigrate_once(argv[0], dst_host, dst_ct, new_args); } for (i = 0; i < argc; i++) { char *arg; char *src_ct; char *dst_ct; char *p; int err; arg = strdup(argv[i]); if (arg == NULL) { perror("Not enough memory"); exit(1); } p = arg; src_ct = p; dst_ct = p; // Read 'source' veid if ((p = strchr(p, ':'))) { *p = '\0'; // Read 'dst' veid dst_ct = ++p; if ((p = strchr(p, ':'))) { *p = '\0'; // Read 'dst' priv_path put_arg("--dst"); put_arg(++p); if ((p = strchr(p, ':'))) { *p = '\0'; // Read 'dst' root_path put_arg("--new-root"); put_arg(++p); } } } if (argc == 1) return call_pmigrate_once(src_ct, dst_host, dst_ct, new_args); err = call_pmigrate(src_ct, dst_host, dst_ct, new_args); free(arg); if (err) return err; } return 0; }