Changeset 2321 in MondoRescue for branches/2.2.10/mondo/src/common/libmondo-filelist.c
- Timestamp:
- Aug 18, 2009, 2:37:55 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.10/mondo/src/common/libmondo-filelist.c
r2320 r2321 36 36 37 37 38 int mondo_makefilelist(char *logfile, char *tmpdir, char *scratchdir, 39 char *include_paths, char *excp, int differential, 40 char *userdef_filelist); 38 int mondo_makefilelist(char *logfile, char *include_paths, char *excp, int differential, char *userdef_filelist); 41 39 42 40 … … 106 104 } 107 105 108 noof_sets = chop_filelist(filelist, bkpinfo-> tmpdir, bkpinfo->optimal_set_size);106 noof_sets = chop_filelist(filelist, bkpinfo->optimal_set_size); 109 107 mr_free(filelist); 110 108 estimate_noof_media_required(noof_sets); // for cosmetic purposes … … 194 192 * 195 193 * @param filelist The big filelist (filelist.full) to chop up. 196 * @param outdir The directory to place the files (filelist.N where N is197 * an integer, biggielist.txt, and LAST-FILELIST-NUMBER) created198 194 * @param maxsetsizeK Optimal size of a fileset (X above). 199 195 * @return number of errors encountered (0 for success). 200 196 */ 201 int chop_filelist(char *filelist, char *outdir,long maxsetsizeK)197 int chop_filelist(char *filelist, long maxsetsizeK) 202 198 { 203 199 /*@ long ****************************************/ … … 228 224 229 225 assert_string_is_neither_NULL_nor_zerolength(filelist); 230 assert_string_is_neither_NULL_nor_zerolength(outdir);231 226 assert(maxsetsizeK > 0); 232 227 … … 245 240 curr_set_no = 0; 246 241 curr_set_size = 0; 247 mr_asprintf(&outfname, "%s/filelist.%ld", outdir, curr_set_no);248 mr_asprintf(&biggie_fname, "%s/biggielist.txt", outdir);242 mr_asprintf(&outfname, "%s/filelist.%ld", bkpinfo->tmpdir, curr_set_no); 243 mr_asprintf(&biggie_fname, "%s/biggielist.txt", bkpinfo->tmpdir); 249 244 log_it("outfname=%s; biggie_fname=%s", outfname, biggie_fname); 250 245 if (!(fbig = fopen(biggie_fname, "w"))) { … … 298 293 curr_set_size = 0; 299 294 300 mr_asprintf(&outfname, "%s/filelist.%ld", outdir, curr_set_no);295 mr_asprintf(&outfname, "%s/filelist.%ld", bkpinfo->tmpdir, curr_set_no); 301 296 if (!(fout = fopen(outfname, "w"))) { 302 297 log_OS_error("Unable to openout outfname"); … … 328 323 mr_free(biggie_fname); 329 324 330 mr_asprintf(&outfname, "%s/LAST-FILELIST-NUMBER", outdir);325 mr_asprintf(&outfname, "%s/LAST-FILELIST-NUMBER", bkpinfo->tmpdir); 331 326 mr_asprintf(&tmp, "%ld", curr_set_no); 332 327 if (write_one_liner_data_file(outfname, tmp)) { … … 1307 1302 if (bkpinfo->make_filelist) { 1308 1303 res = 1309 mondo_makefilelist(MONDO_LOGFILE, bkpinfo-> tmpdir, bkpinfo->scratchdir, bkpinfo->include_paths, bkpinfo->exclude_paths, bkpinfo->differential, NULL);1304 mondo_makefilelist(MONDO_LOGFILE, bkpinfo->include_paths, bkpinfo->exclude_paths, bkpinfo->differential, NULL); 1310 1305 } else { 1311 1306 res = 1312 mondo_makefilelist(MONDO_LOGFILE, bkpinfo->tmpdir, bkpinfo->scratchdir,NULL, bkpinfo->exclude_paths, bkpinfo->differential, bkpinfo->include_paths);1307 mondo_makefilelist(MONDO_LOGFILE, NULL, bkpinfo->exclude_paths, bkpinfo->differential, bkpinfo->include_paths); 1313 1308 } 1314 1309 … … 1377 1372 while((token = mr_strtok(sth, delims, &lastpos))) { 1378 1373 mr_strcat(find_excludes," -path %s -prune -o", token); 1374 mr_free(token); 1379 1375 } 1380 1376 } … … 1542 1538 * Create the filelist for the backup. It will be stored in [scratchdir]/archives/filelist.full. 1543 1539 * @param logfile Unused. 1544 * @param tmpdir The tmpdir of the backup.1545 * @param scratchdir The scratchdir of the backup.1546 1540 * @param include_paths The paths to back up, or NULL if you're using a user-defined filelist. 1547 1541 * @param excp The paths to NOT back up. … … 1552 1546 * @bug Return value is meaningless. 1553 1547 */ 1554 int mondo_makefilelist(char *logfile, char *tmpdir, char *scratchdir, 1555 char *include_paths, char *excp, int differential, 1556 char *userdef_filelist) 1548 int mondo_makefilelist(char *logfile, char *include_paths, char *excp, int differential, char *userdef_filelist) 1557 1549 { 1558 1550 char *p, *q; … … 1577 1569 } 1578 1570 // make hole for filelist 1579 mr_asprintf(&command, "mkdir -p %s/archives", scratchdir);1571 mr_asprintf(&command, "mkdir -p %s/archives", bkpinfo->scratchdir); 1580 1572 paranoid_system(command); 1581 1573 mr_free(command); 1582 1574 1583 mr_asprintf(&sz_filelist, "%s/tmpfs/filelist.full", tmpdir);1575 mr_asprintf(&sz_filelist, "%s/tmpfs/filelist.full", bkpinfo->tmpdir); 1584 1576 make_hole_for_file(sz_filelist); 1585 1577 … … 1640 1632 mr_free(tmp1); 1641 1633 1642 mr_asprintf(&exclude_paths, " %s %s %s %s %s . .. " MNT_CDROM " " MNT_FLOPPY " /media /tmp /proc /sys " MINDI_CACHE, MONDO_CACHE, (excp == NULL) ? "" : excp, tmp2, ( tmpdir[0] == '/' && tmpdir[1] == '/') ? (tmpdir + 1) : tmpdir, (scratchdir[0] == '/' && scratchdir[1] == '/') ? (scratchdir + 1) :scratchdir);1634 mr_asprintf(&exclude_paths, " %s %s %s %s %s . .. " MNT_CDROM " " MNT_FLOPPY " /media /tmp /proc /sys " MINDI_CACHE, MONDO_CACHE, (excp == NULL) ? "" : excp, tmp2, (bkpinfo->tmpdir[0] == '/' && bkpinfo->tmpdir[1] == '/') ? (bkpinfo->tmpdir + 1) : bkpinfo->tmpdir, (bkpinfo->scratchdir[0] == '/' && bkpinfo->scratchdir[1] == '/') ? (bkpinfo->scratchdir + 1) : bkpinfo->scratchdir); 1643 1635 mr_free(tmp2); 1644 1636 1645 1637 log_msg(2, "Excluding paths = '%s'", exclude_paths); 1646 1638 log_msg(2, "Generating skeleton filelist so that we can track our progress"); 1647 sprintf(g_skeleton_filelist, "%s/tmpfs/skeleton.txt", tmpdir);1639 sprintf(g_skeleton_filelist, "%s/tmpfs/skeleton.txt", bkpinfo->tmpdir); 1648 1640 make_hole_for_file(g_skeleton_filelist); 1649 1641 log_msg(4, "g_skeleton_entries = %ld", g_skeleton_entries); … … 1675 1667 } 1676 1668 log_msg(2, "Copying new filelist to scratchdir"); 1677 mr_asprintf(&command, "mkdir -p %s/archives", scratchdir);1669 mr_asprintf(&command, "mkdir -p %s/archives", bkpinfo->scratchdir); 1678 1670 paranoid_system(command); 1679 1671 mr_free(command); 1680 1672 1681 mr_asprintf(&command, "cp -f %s %s/archives/", sz_filelist, scratchdir);1673 mr_asprintf(&command, "cp -f %s %s/archives/", sz_filelist, bkpinfo->scratchdir); 1682 1674 paranoid_system(command); 1683 1675 mr_free(command); 1684 1676 1685 mr_asprintf(&command, "mv -f %s %s", sz_filelist, tmpdir);1677 mr_asprintf(&command, "mv -f %s %s", sz_filelist, bkpinfo->tmpdir); 1686 1678 paranoid_system(command); 1687 1679 mr_free(command);
Note:
See TracChangeset
for help on using the changeset viewer.