From: Kern Sibbald Date: Wed, 7 Apr 2010 12:04:53 +0000 (+0200) Subject: Stuff object in extended attributes X-Git-Tag: Release-7.0.0~1974 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=3cab7c71c5ec19b65372507f8e07b72f20855196;p=bacula%2Fbacula Stuff object in extended attributes --- diff --git a/bacula/src/filed/backup.c b/bacula/src/filed/backup.c index 5faeb259dc..a8303798bf 100644 --- a/bacula/src/filed/backup.c +++ b/bacula/src/filed/backup.c @@ -1095,7 +1095,8 @@ bool encode_and_send_attributes(JCR *jcr, FF_PKT *ff_pkt, int &data_stream) { BSOCK *sd = jcr->store_bsock; char attribs[MAXSTRING]; - char attribsEx[MAXSTRING]; + char attribsExBuf[MAXSTRING]; + char *attribsEx; int attr_stream; bool stat; #ifdef FD_NO_SEND_TEST @@ -1112,6 +1113,7 @@ bool encode_and_send_attributes(JCR *jcr, FF_PKT *ff_pkt, int &data_stream) encode_stat(attribs, &ff_pkt->statp, ff_pkt->LinkFI, data_stream); /** Now possibly extend the attributes */ + attribsEx = attribsExBuf; attr_stream = encode_attribsEx(jcr, attribsEx, ff_pkt); Dmsg3(300, "File %s\nattribs=%s\nattribsEx=%s\n", ff_pkt->fname, attribs, attribsEx); @@ -1164,6 +1166,9 @@ bool encode_and_send_attributes(JCR *jcr, FF_PKT *ff_pkt, int &data_stream) stat = sd->fsend("%ld %d %s%c%s%c%c%s%c", jcr->JobFiles, ff_pkt->type, ff_pkt->link, 0, attribs, 0, 0, attribsEx, 0); break; + case FT_RESTORE_FIRST: + attribsEx = ff_pkt->object; /* put object as extended attributes */ + /* Fall through wanted */ default: stat = sd->fsend("%ld %d %s%c%s%c%c%s%c", jcr->JobFiles, ff_pkt->type, ff_pkt->fname, 0, attribs, 0, 0, attribsEx, 0); diff --git a/bacula/src/filed/fd_plugins.c b/bacula/src/filed/fd_plugins.c index 6ea3005a6b..beefdef0c6 100644 --- a/bacula/src/filed/fd_plugins.c +++ b/bacula/src/filed/fd_plugins.c @@ -292,6 +292,10 @@ int plugin_save(JCR *jcr, FF_PKT *ff_pkt, bool top_level) ff_pkt->fname = fname.c_str(); ff_pkt->link = link.c_str(); ff_pkt->type = sp.type; + ff_pkt->object = sp.object; + if (sp.type == FT_RESTORE_FIRST) { + ff_pkt->LinkFI = sp.index; /* restore object index */ + } memcpy(&ff_pkt->statp, &sp.statp, sizeof(ff_pkt->statp)); Dmsg1(dbglvl, "Save_file: file=%s\n", fname.c_str()); save_file(jcr, ff_pkt, true); diff --git a/bacula/src/filed/fd_plugins.h b/bacula/src/filed/fd_plugins.h index 92235c868b..6858a5e16d 100644 --- a/bacula/src/filed/fd_plugins.h +++ b/bacula/src/filed/fd_plugins.h @@ -83,6 +83,7 @@ struct save_pkt { bool portable; /* set if data format is portable */ char *cmd; /* command */ char *object; /* restore object data to save */ + int32_t index; /* restore object index */ int32_t pkt_end; /* end packet sentinel */ }; diff --git a/bacula/src/findlib/find.h b/bacula/src/findlib/find.h index 4033ad316f..7d2cbb9b25 100644 --- a/bacula/src/findlib/find.h +++ b/bacula/src/findlib/find.h @@ -189,6 +189,7 @@ struct FF_PKT { char *top_fname; /* full filename before descending */ char *fname; /* full filename */ char *link; /* link if file linked */ + char *object; /* restore object */ POOLMEM *sys_fname; /* system filename */ POOLMEM *fname_save; /* save when stripping path */ POOLMEM *link_save; /* save when stripping path */ diff --git a/bacula/src/findlib/find_one.c b/bacula/src/findlib/find_one.c index 4d23539eef..ee739576f3 100644 --- a/bacula/src/findlib/find_one.c +++ b/bacula/src/findlib/find_one.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2000-2009 Free Software Foundation Europe e.V. + Copyright (C) 2000-2010 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -34,8 +34,6 @@ Thanks to the TAR programmers. - Version $Id$ - */ #include "bacula.h"