Changeset 1769 in MondoRescue for branches/stable/mondo/src/common
- Timestamp:
- Nov 6, 2007, 1:37:38 AM (17 years ago)
- Location:
- branches/stable/mondo/src/common
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mondo/src/common/libmondo-archive.c
r1693 r1769 230 230 mr_asprintf(&command, "star H=star list=%s -c " STAR_ACL_SZ " file=%s", 231 231 filelist, fname); 232 if (bkpinfo->use_lzo) { 233 fatal_error("Can't use lzop"); 234 } 232 235 233 if (bkpinfo->compression_level > 0) { 236 234 mr_asprintf(&tmp, "%s -bz", command); … … 289 287 * - @c scratchdir (only verifies existence) 290 288 * - @c tmpdir (only verifies existence) 291 * - @c zip_exe292 * - @c zip_suffix289 * - @c compression_tool 290 * - @c compression_suffix 293 291 * @param filelist The path to a file containing a list of files to be archived 294 292 * in this fileset. … … 339 337 340 338 if (bkpinfo->compression_level > 0) { 341 mr_asprintf(&zipparams, "-Z -P %s -G %d -T 3k", bkpinfo-> zip_exe,339 mr_asprintf(&zipparams, "-Z -P %s -G %d -T 3k", bkpinfo->compression_tool, 342 340 bkpinfo->compression_level); 343 341 mr_asprintf(&tmp, "%s/do-not-compress-these", MONDO_SHARE); … … 365 363 } 366 364 mr_asprintf(&command, "rm -f %s %s. %s.gz %s.%s", fname, fname, fname, 367 fname, bkpinfo-> zip_suffix);365 fname, bkpinfo->compression_suffix); 368 366 paranoid_system(command); 369 367 mr_free(command); … … 521 519 * - @c nonbootable_backup 522 520 * - @c tmpdir 523 * - @c use_lzo524 521 * 525 522 * @return The number of errors encountered (0 for success) … … 829 826 mr_fprintf(fd1, "use-comp=no\n"); 830 827 } 831 if (bkpinfo->use_gzip) { 832 mr_fprintf(fd1, "use-gzip=yes\n"); 833 } else { 834 mr_fprintf(fd1, "use-gzip=no\n"); 835 } 836 if (bkpinfo->use_lzo) { 837 mr_fprintf(fd1, "use-lzo=yes\n"); 838 } else { 839 mr_fprintf(fd1, "use-lzo=no\n"); 828 if (bkpinfo->compression_tool) { 829 mr_fprintf(fd1, "compression_tool=%s\n",bkpinfo->compression_tool); 830 } 831 if (bkpinfo->compression_suffix) { 832 mr_fprintf(fd1, "compression_suffix=%s\n",bkpinfo->compression_suffix); 833 } 834 if (bkpinfo->compression_type != none) { 835 mr_fprintf(fd1, "compression_type=%d\n",bkpinfo->compression_type); 840 836 } 841 837 if (bkpinfo->use_star) { … … 998 994 * structure. Fields used: 999 995 * - @c tmpdir 1000 * - @c zip_suffix996 * - @c compression_suffix 1001 997 * 1002 998 * Any of the above may be modified by the caller at any time. … … 1059 1055 /* backup this set of files */ 1060 1056 sprintf(archiving_afioball_fname, AFIOBALL_FNAME_RAW_SZ, 1061 bkpinfo->tmpdir, archiving_set_no, bkpinfo-> zip_suffix);1057 bkpinfo->tmpdir, archiving_set_no, bkpinfo->compression_suffix); 1062 1058 sprintf(archiving_filelist_fname, FILELIST_FNAME_RAW_SZ, 1063 1059 bkpinfo->tmpdir, archiving_set_no); … … 1071 1067 1072 1068 mr_asprintf(&tmp, AFIOBALL_FNAME_RAW_SZ, bkpinfo->tmpdir, 1073 archiving_set_no - ARCH_BUFFER_NUM, bkpinfo-> zip_suffix);1069 archiving_set_no - ARCH_BUFFER_NUM, bkpinfo->compression_suffix); 1074 1070 if (does_file_exist(tmp)) { 1075 1071 mr_msg(4, "[%d:%d] - waiting for storer", … … 1317 1313 * - @c scratchdir 1318 1314 * - @c tmpdir 1319 * - @c zip_suffix1315 * - @c compression_suffix 1320 1316 * 1321 1317 * @return The number of errors encountered (0 for success) … … 1427 1423 bkpinfo->tmpdir, storing_set_no); 1428 1424 sprintf(storing_afioball_fname, AFIOBALL_FNAME_RAW_SZ, 1429 bkpinfo->tmpdir, storing_set_no, bkpinfo-> zip_suffix);1425 bkpinfo->tmpdir, storing_set_no, bkpinfo->compression_suffix); 1430 1426 if (g_getfattr) { 1431 1427 sprintf(curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ, … … 2093 2089 /* backup this set of files */ 2094 2090 mr_asprintf(&curr_afioball_fname, AFIOBALL_FNAME_RAW_SZ, 2095 bkpinfo->tmpdir, curr_set_no, bkpinfo-> zip_suffix);2091 bkpinfo->tmpdir, curr_set_no, bkpinfo->compression_suffix); 2096 2092 2097 2093 mr_msg(1, "EXAT'g set %ld", curr_set_no); … … 2758 2754 * - @c tmpdir 2759 2755 * - @c use_lzo 2760 * - @c zip_exe2761 * - @c zip_suffix2756 * - @c compression_tool 2757 * - @c compression_suffix 2762 2758 * 2763 2759 * @param biggie_filename The file to chop up. … … 2909 2905 should_I_compress_slices = FALSE; 2910 2906 } else { 2911 mr_asprintf(&suffix, bkpinfo-> zip_suffix);2907 mr_asprintf(&suffix, bkpinfo->compression_suffix); 2912 2908 should_I_compress_slices = TRUE; 2913 2909 } … … 2957 2953 } 2958 2954 if (should_I_compress_slices && bkpinfo->compression_level > 0) { 2959 mr_asprintf(&command, "%s -%d %s", bkpinfo-> zip_exe,2955 mr_asprintf(&command, "%s -%d %s", bkpinfo->compression_tool, 2960 2956 bkpinfo->compression_level, 2961 2957 curr_slice_fname_uncompressed); … … 2979 2975 mr_msg(2, "Failed to compress the slice"); 2980 2976 } 2981 if ( bkpinfo->use_lzo2977 if ((bkpinfo->compression_type == lzo) 2982 2978 && strcmp(curr_slice_fname_compressed, 2983 2979 curr_slice_fname_uncompressed)) { -
branches/stable/mondo/src/common/libmondo-devices.c
r1669 r1769 1472 1472 bkpinfo->compression_level = 1473 1473 (bkpinfo->backup_media_type == cdstream) ? 1 : 5; 1474 bkpinfo->use_lzo =1475 (bkpinfo->backup_media_type == cdstream) ? TRUE : FALSE;1476 1474 mvaddstr_and_log_it(2, 0, " "); 1477 1475 … … 2019 2017 log_it("media type = %s", bkpinfo->backup_media_string); 2020 2018 log_it("prefix = %s", bkpinfo->prefix); 2021 log_it("compression = %ld", bkpinfo->compression_level); 2019 log_it("compression tool = %ld", bkpinfo->compression_tool); 2020 log_it("compression suffix = %ld", bkpinfo->compression_suffix); 2021 log_it("compression level = %ld", bkpinfo->compression_level); 2022 2022 log_it("include_paths = '%s'", bkpinfo->include_paths); 2023 2023 log_it("exclude_paths = '%s'", bkpinfo->exclude_paths); -
branches/stable/mondo/src/common/libmondo-files.c
r1669 r1769 1154 1154 * - @c bkpinfo->media_size 1155 1155 * - @c bkpinfo->optimal_set_size 1156 * - @c bkpinfo->use_lzo1157 1156 * @param noof_sets The number of filesets created. 1158 1157 * @ingroup archiveGroup … … 1178 1177 scratchLL = (scratchLL / 1024) / bkpinfo->media_size; 1179 1178 scratchLL++; 1180 if (bkpinfo->use_lzo) { 1181 scratchLL = (scratchLL * 2) / 3; 1182 } else if (bkpinfo->use_gzip) { 1183 scratchLL = (scratchLL * 2) / 3; 1184 } else { 1185 scratchLL = scratchLL / 2; 1186 } 1179 scratchLL = (scratchLL * 2) / 3; 1187 1180 if (!scratchLL) { 1188 1181 scratchLL++; -
branches/stable/mondo/src/common/libmondo-tools.c
r1671 r1769 329 329 * - Used: @c bkpinfo->backup_media_type 330 330 * - Used: @c bkpinfo->writer_speed 331 * - Used: @c bkpinfo->compression_level332 331 * - Used: @c bkpinfo->include_paths 333 332 * - Used: @c bkpinfo->prefix … … 340 339 * - Used: @c bkpinfo->scratchdir 341 340 * - Used: @c bkpinfo->tmpdir 342 * - Used: @c bkpinfo->use_lzo343 341 * - Modified: @c bkpinfo->call_before_iso 344 342 * - Modified: @c bkpinfo->call_make_iso 345 343 * - Modified: @c bkpinfo->optimal_set_size 346 * - Modified: @c bkpinfo->zip_exe347 * - Modified: @c bkpinfo->zip_suffix348 344 * 349 345 * @return number of errors, or 0 for success. … … 436 432 } 437 433 mr_free(command); 438 439 if (bkpinfo->use_lzo) {440 strcpy(bkpinfo->zip_exe, "lzop");441 strcpy(bkpinfo->zip_suffix, "lzo");442 } else if (bkpinfo->use_gzip) {443 strcpy(bkpinfo->zip_exe, "gzip");444 strcpy(bkpinfo->zip_suffix, "gz");445 } else if (bkpinfo->compression_level != 0) {446 strcpy(bkpinfo->zip_exe, "bzip2");447 strcpy(bkpinfo->zip_suffix, "bz2");448 } else {449 bkpinfo->zip_exe[0] = bkpinfo->zip_suffix[0] = '\0';450 }451 434 452 435 // CD-R or CD-RW or DVD … … 734 717 bkpinfo->manual_tray = mr_conf->manual_tray; 735 718 bkpinfo->internal_tape_block_size = mr_conf->internal_tape_blocksize; 719 bkpinfo->compression_level = mr_conf->compression_level; 720 mr_asprintf(&tmp,mr_conf->compression_suffix); 721 bkpinfo->compression_suffix = tmp; 722 mr_asprintf(&tmp,mr_conf->compression_tool); 723 bkpinfo->compression_tool = tmp; 736 724 mr_asprintf(&tmp,mr_conf->media_device); 737 725 bkpinfo->media_device = tmp; … … 762 750 } 763 751 bkpinfo->boot_device[0] = '\0'; 764 bkpinfo->zip_exe[0] = '\0';765 bkpinfo->zip_suffix[0] = '\0';766 752 bkpinfo->restore_path[0] = '\0'; 767 bkpinfo->use_lzo = FALSE;768 bkpinfo->use_gzip = FALSE;769 753 bkpinfo->do_not_compress_these[0] = '\0'; 770 754 bkpinfo->verify_data = FALSE; … … 798 782 bkpinfo->differential = FALSE; 799 783 bkpinfo->writer_speed = mr_conf->iso_burning_speed; 800 bkpinfo->compression_level = 3;801 784 } 802 785 … … 913 896 retval += whine_if_not_found(mr_conf->iso_burning_cmd); 914 897 retval += whine_if_not_found(MKE2FS_OR_NEWFS); 915 retval += whine_if_not_found( "bzip2");898 retval += whine_if_not_found(mr_conf->compresstion_tool); 916 899 retval += whine_if_not_found("gzip"); 917 900 retval += whine_if_not_found("awk"); -
branches/stable/mondo/src/common/libmondo-verify.c
r1663 r1769 41 41 /** 42 42 * Generate the filename of a tarball to verify. 43 * @param bkpinfo The backup information structure. @c bkpinfo-> zip_suffix is the only field used.43 * @param bkpinfo The backup information structure. @c bkpinfo->compression_suffix is the only field used. 44 44 * @param mountpoint The directory where the CD/DVD/ISO is mounted. 45 45 * @param setno The afioball number to get the location of. … … 56 56 assert_string_is_neither_NULL_nor_zerolength(mountpoint); 57 57 sprintf(output, "%s/archives/%d.star.%s", mountpoint, setno, 58 bkpinfo-> zip_suffix);58 bkpinfo->compression_suffix); 59 59 if (!does_file_exist(output)) { 60 60 sprintf(output, "%s/archives/%d.afio.%s", mountpoint, setno, 61 bkpinfo-> zip_suffix);61 bkpinfo->compression_suffix); 62 62 } 63 63 return (output); … … 211 211 * - @c compression_level 212 212 * - @c restore_path 213 * - @c use_lzo 214 * - @c zip_suffix 213 * - @c compression_suffix 215 214 * @param mtpt The mountpoint the CD/DVD/ISO is mounted on. 216 215 * @return The number of differences (0 for perfect biggiefiles). … … 224 223 char *mountpoint = NULL; 225 224 char *command = NULL; 226 char *sz_exe = NULL;227 225 static char *bufblkA = NULL; 228 226 static char *bufblkB = NULL; … … 252 250 assert(bkpinfo != NULL); 253 251 assert_string_is_neither_NULL_nor_zerolength(mtpt); 254 255 if (bkpinfo->compression_level > 0) {256 if (bkpinfo->use_lzo) {257 mr_asprintf(&sz_exe, "lzop");258 } else if (bkpinfo->use_gzip) {259 mr_asprintf(&sz_exe, "gzip");260 } else {261 mr_asprintf(&sz_exe, "bzip2");262 }263 } else {264 mr_asprintf(&sz_exe, "");265 }266 252 267 253 iamhere("before vsbf"); … … 286 272 while (does_file_exist 287 273 (slice_fname 288 (bigfile_num, slice_num, mountpoint, bkpinfo-> zip_suffix))274 (bigfile_num, slice_num, mountpoint, bkpinfo->compression_suffix)) 289 275 || 290 276 does_file_exist(slice_fname … … 340 326 g_current_media_number, bigfile_num, slice_num); 341 327 if (!does_file_exist(slice_fname(bigfile_num, slice_num, mountpoint, ""))) { 342 mr_asprintf(&command, "%s -dc %s 2>> %s", sz_exe,343 slice_fname(bigfile_num, slice_num, mountpoint, bkpinfo-> zip_suffix),328 mr_asprintf(&command, "%s -dc %s 2>> %s", bkpinfi->compression_tool, 329 slice_fname(bigfile_num, slice_num, mountpoint, bkpinfo->compression_suffix), 344 330 MONDO_LOGFILE); 345 331 } else { … … 392 378 mr_free(tmp); 393 379 mr_free(mountpoint); 394 mr_free(sz_exe);395 380 396 381 last_bigfile_num = bigfile_num; … … 414 399 * You should be changed to the root directory (/) for this to work. 415 400 * @param bkpinfo The backup information structure. Fields used: 416 * - @c bkpinfo->use_lzo417 401 * - @c bkpinfo->tmpdir 418 * - @c bkpinfo-> zip_exe419 * - @c bkpinfo-> zip_suffix402 * - @c bkpinfo->compression_tool 403 * - @c bkpinfo->compression_suffix 420 404 * @param tarball_fname The filename of the afioball to verify. 421 405 * @return 0, always. … … 442 426 443 427 mr_asprintf(&outlog, "%s/afio.log", bkpinfo->tmpdir); 444 445 /* if programmer forgot to say which compression thingy to use then find out */446 if (strstr(tarball_fname, ".lzo")447 && strcmp(bkpinfo->zip_suffix, "lzo")) {448 mr_msg(2, "OK, I'm going to start using lzop.");449 strcpy(bkpinfo->zip_exe, "lzop");450 strcpy(bkpinfo->zip_suffix, "lzo");451 bkpinfo->use_lzo = TRUE;452 bkpinfo->use_gzip = FALSE;453 }454 if (strstr(tarball_fname, ".gz")455 && strcmp(bkpinfo->zip_suffix, "gz")) {456 mr_msg(2, "OK, I'm going to start using gzip.");457 strcpy(bkpinfo->zip_exe, "gzip");458 strcpy(bkpinfo->zip_suffix, "gz");459 bkpinfo->use_lzo = FALSE;460 bkpinfo->use_gzip = TRUE;461 }462 if (strstr(tarball_fname, ".bz2")463 && strcmp(bkpinfo->zip_suffix, "bz2")) {464 mr_msg(2, "OK, I'm going to start using bzip2.");465 strcpy(bkpinfo->zip_exe, "bzip2");466 strcpy(bkpinfo->zip_suffix, "bz2");467 bkpinfo->use_lzo = FALSE;468 bkpinfo->use_gzip = FALSE;469 }470 428 unlink(outlog); 429 471 430 if (strstr(tarball_fname, ".star")) { 472 431 bkpinfo->use_star = TRUE; … … 483 442 bkpinfo->use_star = FALSE; 484 443 mr_asprintf(&command, "afio -r -P %s -Z %s >> %s 2>> %s", 485 bkpinfo-> zip_exe, tarball_fname, outlog, outlog);444 bkpinfo->compression_tool, tarball_fname, outlog, outlog); 486 445 } 487 446 mr_msg(6, "command=%s", command); -
branches/stable/mondo/src/common/mondostructures.h
r1669 r1769 168 168 udev ///< Back up to another unsupported device; just send a stream of bytes. 169 169 } t_bkptype; 170 171 /* 172 * Type of compression algorithm we're using 173 */ 174 typedef enum { 175 none = 0, //< No compression 176 gzip, //< Compression with gzip 177 bzip2, //< Compression with bzip2 178 lzo, //< Compression with lzo 179 lzma //< Compression with lzma 180 } t_mr_comp; 170 181 171 182 /** … … 344 355 /** 345 356 * The compression program to use. Currently supported 346 * choices are lzop and bzip2; gzip may also work. This is ignored if357 * choices are lzop, bzip2, and gzip. This is ignored if 347 358 * compression_level is 0. 348 359 */ 349 char zip_exe[MAX_STR_LEN / 4];360 char *compression_tool; 350 361 351 362 /** … … 353 364 * bz2, gzip uses gz, etc. Do not include the dot. 354 365 */ 355 char zip_suffix[MAX_STR_LEN / 4]; 366 char *compression_suffix; 367 368 /** 369 * The compression level (1-9) to use. 0 disables compression. 370 */ 371 int compression_level; 372 373 /** 374 * The type of compression 375 */ 376 t_mr_comp compression_type; 356 377 357 378 /** … … 369 390 */ 370 391 char image_devs[MAX_STR_LEN / 4]; 371 372 /**373 * The compression level (1-9) to use. 0 disables compression.374 */375 int compression_level;376 377 /**378 * If TRUE, then use @c lzop to compress data.379 * This is used mainly in estimates. The backup/restore may or may380 * not work if you do not set this. You should also set @p zip_exe381 * and @p zip_suffix.382 */383 bool use_lzo;384 385 /**386 * If TRUE, then use @c gzip to compress data.387 * This is used mainly in estimates. The backup/restore may or may388 * not work if you do not set this. You should also set @p zip_exe389 * and @p zip_suffix.390 */391 bool use_gzip;392 392 393 393 /**
Note:
See TracChangeset
for help on using the changeset viewer.