int main (int argc, char **argv) { int i; char *target = NULL; bool found_target = false; int uniform_restart = false; pid_t uniform_rank = 0; for (i = 1; i < argc; i++) { plfs_handle_version_arg(argc, argv[i]); if (strcmp(argv[i], "-nc") == 0) { // silently ignore deprecated argument } else if (strcmp(argv[i], "--uniform") == 0) { i++; uniform_restart = true; uniform_rank = (pid_t)atoi(argv[i]); printf("# Building map for only rank %d\n", uniform_rank); } else if (!found_target) { target = argv[i]; found_target = true; } else { // Found more than one target. This is an error. show_usage(argv[0]); exit(1); } } if (!found_target) { show_usage(argv[0]); exit(1); } plfs_error_t ret = PLFS_SUCCESS; ret = container_dump_index(stderr,target,0,uniform_restart,uniform_rank); if ( ret != PLFS_SUCCESS ) { fprintf(stderr, "Error: %s is not in a PLFS mountpoint" " configured with 'workload n-1'\n", target); } exit( plfs_error_to_errno(ret) ); }
int main (int argc, char **argv) { if (argc>=2) { if(!strcmp(argv[1],"--help")||!strcmp(argv[1],"-h")) { printf("Usage: %s [filepathi | -version]\n", argv[0]); exit(0); } } // print version that was used to build this printf("PLFS library:\n\t%s (Built %s)\n", plfs_version(), plfs_buildtime()); // check version of a particular file if (argc>=2 && argv[1]) { if (strcmp(argv[1], "-version") != 0) { printf("file: %s\n\t", argv[1]); const char *version; plfs_error_t ret = PLFS_SUCCESS; ret = container_file_version(argv[1], &version); if ( ret != PLFS_SUCCESS ) { printf("Error: %s\n", strerror(-plfs_error_to_errno(ret))); printf("%s may not be on an n-1 mount point\n", argv[1]); } else { printf("%s\n", version); } } else { exit(0); } } // search each mountpoint FILE *fpipe; const char *command="mount"; char line[256]; if ( !(fpipe = (FILE*)popen(command,"r")) ) { perror("Problems with pipe"); exit(1); } while ( fgets( line, sizeof line, fpipe)) { if(strstr(line,"plfs")) { vector<string> tokens; Util::tokenize(line," ",tokens); if (tokens.size() >= 3) { printf("mount: %s\n", tokens[2].c_str()); FILE *fpipe2; char command2[1024]; snprintf(command2,1024,"cat %s/.plfsdebug",tokens[2].c_str()); char line2[256]; if ( !(fpipe2 = (FILE*)popen(command2,"r")) ) { perror("Problems with pipe\n"); exit(1); } while( fgets(line2, sizeof line2, fpipe2) ) { if(strstr(line2,"Version") ||strstr(line2,"Build") ||strstr(line2,"checksum")) { printf("\t%s",line2); } } pclose(fpipe2); } } } pclose(fpipe); }