Ignore:
Timestamp:
Nov 19, 2006, 1:27:46 AM (17 years ago)
Author:
Bruno Cornec
Message:
  • mondoarchive does not backup acl+xattr by default anymore
  • Add -z option to mondoarchive to support acl+xattr backup
  • small mindi fix
  • this may break mondo compatibility so tests are required before distributing that version.
  • this is still incomplete as that aprameter should be passed for mondorestore to know what to do.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/mondo/src/common/libmondo-stream.c

    r684 r948  
    115115extern bool g_sigpipe;
    116116extern int g_tape_buffer_size_MB;
     117
     118extern char *g_getfacl;
     119extern char *g_getfattr;
    117120
    118121/**
     
    443446
    444447// xattr
    445     res = read_header_block_from_stream(ptmp_size, tmp_fname, pctrl_chr);
    446     if (*pctrl_chr != BLK_START_EXAT_FILE) {
    447         wrong_marker(BLK_START_EXAT_FILE, *pctrl_chr);
    448     }
    449     if (!strstr(tmp_fname, "xattr")) {
    450         fatal_error("Wrong order, sunshine.");
    451     }
    452     read_file_from_stream_to_file(bkpinfo, xattr_fname, *ptmp_size);
    453     res = read_header_block_from_stream(ptmp_size, tmp_fname, pctrl_chr);
    454     if (*pctrl_chr != BLK_STOP_EXAT_FILE) {
    455         wrong_marker(BLK_STOP_EXAT_FILE, *pctrl_chr);
     448    if (g_getfattr) {
     449        res = read_header_block_from_stream(ptmp_size, tmp_fname, pctrl_chr);
     450        if (*pctrl_chr != BLK_START_EXAT_FILE) {
     451            wrong_marker(BLK_START_EXAT_FILE, *pctrl_chr);
     452        }
     453        if (!strstr(tmp_fname, "xattr")) {
     454            fatal_error("Wrong order, sunshine.");
     455        }
     456        read_file_from_stream_to_file(bkpinfo, xattr_fname, *ptmp_size);
     457        res = read_header_block_from_stream(ptmp_size, tmp_fname, pctrl_chr);
     458        if (*pctrl_chr != BLK_STOP_EXAT_FILE) {
     459            wrong_marker(BLK_STOP_EXAT_FILE, *pctrl_chr);
     460        }
     461        log_msg(1, "Got xattr");
    456462    }
    457463// acl
    458     res = read_header_block_from_stream(ptmp_size, tmp_fname, pctrl_chr);
    459     if (!strstr(tmp_fname, "acl")) {
    460         fatal_error("Wrong order, sunshine.");
    461     }
    462     if (*pctrl_chr != BLK_START_EXAT_FILE) {
    463         wrong_marker(BLK_START_EXAT_FILE, *pctrl_chr);
    464     }
    465     read_file_from_stream_to_file(bkpinfo, acl_fname, *ptmp_size);
    466     res = read_header_block_from_stream(ptmp_size, tmp_fname, pctrl_chr);
    467     if (*pctrl_chr != BLK_STOP_EXAT_FILE) {
    468         wrong_marker(BLK_STOP_EXAT_FILE, *pctrl_chr);
    469     }
    470     res = read_header_block_from_stream(ptmp_size, tmp_fname, pctrl_chr);
    471     if (*pctrl_chr != BLK_STOP_EXTENDED_ATTRIBUTES) {
    472         wrong_marker(BLK_STOP_EXTENDED_ATTRIBUTES, *pctrl_chr);
     464    if (g_getfacl) {
     465        res = read_header_block_from_stream(ptmp_size, tmp_fname, pctrl_chr);
     466        if (!strstr(tmp_fname, "acl")) {
     467            fatal_error("Wrong order, sunshine.");
     468        }
     469        if (*pctrl_chr != BLK_START_EXAT_FILE) {
     470            wrong_marker(BLK_START_EXAT_FILE, *pctrl_chr);
     471        }
     472        read_file_from_stream_to_file(bkpinfo, acl_fname, *ptmp_size);
     473        res = read_header_block_from_stream(ptmp_size, tmp_fname, pctrl_chr);
     474        if (*pctrl_chr != BLK_STOP_EXAT_FILE) {
     475            wrong_marker(BLK_STOP_EXAT_FILE, *pctrl_chr);
     476        }
     477        res = read_header_block_from_stream(ptmp_size, tmp_fname, pctrl_chr);
     478        if (*pctrl_chr != BLK_STOP_EXTENDED_ATTRIBUTES) {
     479            wrong_marker(BLK_STOP_EXTENDED_ATTRIBUTES, *pctrl_chr);
     480        }
     481        log_msg(1, "Got acl");
    473482    }
    474483// tarball itself
    475484    res = read_header_block_from_stream(ptmp_size, tmp_fname, pctrl_chr);
    476     log_msg(1, "Got xattr and acl; now looking for afioball");
     485    log_msg(1, "now looking for afioball");
    477486    return (retval);
    478487}
     
    483492{
    484493    int res = 0;
    485 // EXATs
    486     write_header_block_to_stream(length_of_file(xattr_fname), xattr_fname,
    487                                  BLK_START_EXTENDED_ATTRIBUTES);
     494    if (g_getfattr) {
    488495// xattr
    489     write_header_block_to_stream(length_of_file(xattr_fname), xattr_fname,
    490                                  BLK_START_EXAT_FILE);
    491     write_file_to_stream_from_file(bkpinfo, xattr_fname);
    492     write_header_block_to_stream((off_t)-1, xattr_fname, BLK_STOP_EXAT_FILE);
     496        write_header_block_to_stream(length_of_file(xattr_fname), xattr_fname,
     497                             BLK_START_EXTENDED_ATTRIBUTES);
     498        write_header_block_to_stream(length_of_file(xattr_fname), xattr_fname,
     499                             BLK_START_EXAT_FILE);
     500        write_file_to_stream_from_file(bkpinfo, xattr_fname);
     501        write_header_block_to_stream((off_t)-1, xattr_fname, BLK_STOP_EXAT_FILE);
     502    }
     503    if (g_getfacl) {
    493504// acl
    494     write_header_block_to_stream(length_of_file(acl_fname), acl_fname,
    495                                  BLK_START_EXAT_FILE);
    496     write_file_to_stream_from_file(bkpinfo, acl_fname);
    497     write_header_block_to_stream((off_t)-1, acl_fname, BLK_STOP_EXAT_FILE);
    498     write_header_block_to_stream(length_of_file(xattr_fname), xattr_fname,
    499                                  BLK_STOP_EXTENDED_ATTRIBUTES);
     505        write_header_block_to_stream(length_of_file(acl_fname), acl_fname,
     506                             BLK_START_EXAT_FILE);
     507        write_file_to_stream_from_file(bkpinfo, acl_fname);
     508        write_header_block_to_stream((off_t)-1, acl_fname, BLK_STOP_EXAT_FILE);
     509        write_header_block_to_stream(length_of_file(xattr_fname), xattr_fname,
     510                             BLK_STOP_EXTENDED_ATTRIBUTES);
     511    }
    500512    return (res);
    501513}
Note: See TracChangeset for help on using the changeset viewer.