From: Kern Sibbald Date: Tue, 16 Mar 2010 09:24:36 +0000 (+0100) Subject: Tweak: comments X-Git-Tag: Release-5.2.1~1589 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=f510b3985e8f8f6dcfdb95b0bf6a12a18bdeb85b;p=bacula%2Fbacula Tweak: comments --- diff --git a/bacula/src/baconfig.h b/bacula/src/baconfig.h index f1f2f71ef5..3bf4b52342 100644 --- a/bacula/src/baconfig.h +++ b/bacula/src/baconfig.h @@ -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. @@ -25,11 +25,10 @@ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, Switzerland, email:ftf@fsfeurope.org. */ -/* +/** * General header file configurations that apply to * all daemons. System dependent stuff goes here. * - * Version $Id$ */ @@ -182,7 +181,7 @@ void InitWinAPIWrapper(); #define B_DEV_BSIZE 512 #endif -/* +/** * Set to time limit for other end to respond to * authentication. Normally 10 minutes is *way* * more than enough. The idea is to keep the Director @@ -196,7 +195,7 @@ void InitWinAPIWrapper(); */ #define DEFAULT_NETWORK_BUFFER_SIZE (64 * 1024) -/* +/** * Stream definitions. Once defined these must NEVER * change as they go on the storage media. * Note, the following streams are passed from the SD to the DIR @@ -241,7 +240,7 @@ void InitWinAPIWrapper(); #define STREAM_PLUGIN_NAME 26 /* Plugin "file" string */ #define STREAM_PLUGIN_DATA 27 /* Plugin specific data */ -/* +/** * Additional Stream definitions. Once defined these must NEVER * change as they go on the storage media. * @@ -302,7 +301,7 @@ void InitWinAPIWrapper(); #define STREAM_XATTR_LINUX 1998 /* Linux specific extended attributes */ #define STREAM_XATTR_NETBSD 1999 /* NetBSD specific extended attributes */ -/* +/** * File type (Bacula defined). * NOTE!!! These are saved in the Attributes record on the tape, so * do not change them. If need be, add to them. @@ -329,7 +328,8 @@ void InitWinAPIWrapper(); #define FT_NOOPEN 15 /* Could not open directory */ #define FT_RAW 16 /* Raw block device */ #define FT_FIFO 17 /* Raw fifo device */ -/* The DIRBEGIN packet is sent to the FD file processing routine so +/** + * The DIRBEGIN packet is sent to the FD file processing routine so * that it can filter packets, but otherwise, it is not used * or saved */ #define FT_DIRBEGIN 18 /* Directory at beginning (not saved) */ @@ -343,14 +343,14 @@ void InitWinAPIWrapper(); /* Definitions for upper part of type word (see above). */ #define AR_DATA_STREAM (1<<16) /* Data stream id present */ -/* +/** * Tape label types -- stored in catalog */ #define B_BACULA_LABEL 0 #define B_ANSI_LABEL 1 #define B_IBM_LABEL 2 -/* +/** * Actions on purge (bit mask) */ #define AOP_TRUNCATE 1 @@ -362,7 +362,8 @@ void InitWinAPIWrapper(); #define CRYPTO_LEN_SIZE ((int)sizeof(uint32_t)) -/* This is for dumb compilers/libraries like Solaris. Linux GCC +/** + * This is for dumb compilers/libraries like Solaris. Linux GCC * does it correctly, so it might be worthwhile * to remove the isascii(c) with ifdefs on such * "smart" systems. @@ -372,7 +373,7 @@ void InitWinAPIWrapper(); #define B_ISUPPER(c) (isascii((int)(c)) && isupper((int)(c))) #define B_ISDIGIT(c) (isascii((int)(c)) && isdigit((int)(c))) -/* For multiplying by 10 with shift and addition */ +/** For multiplying by 10 with shift and addition */ #define B_TIMES10(d) ((d<<3)+(d<<1)) @@ -389,7 +390,7 @@ typedef int (INTHANDLER)(); #define S_ISLNK(m) (((m) & S_IFM) == S_IFLNK) #endif -/* Added by KES to deal with Win32 systems */ +/** Added by KES to deal with Win32 systems */ #ifndef S_ISWIN32 #define S_ISWIN32 020000 #endif @@ -450,12 +451,12 @@ void b_memset(const char *file, int line, void *mem, int val, size_t num); #endif -/* +/** * The digit following Dmsg and Emsg indicates the number of substitutions in * the message string. We need to do this kludge because non-GNU compilers * do not handle varargs #defines. */ -/* Debug Messages that are printed */ +/** Debug Messages that are printed */ #ifdef DEBUG #define Dmsg0(lvl, msg) if ((lvl)<=debug_level) d_msg(__FILE__, __LINE__, lvl, msg) #define Dmsg1(lvl, msg, a1) if ((lvl)<=debug_level) d_msg(__FILE__, __LINE__, lvl, msg, a1) @@ -518,7 +519,7 @@ void b_memset(const char *file, int line, void *mem, int val, size_t num); -/* Messages that are printed (uses d_msg) */ +/** Messages that are printed (uses d_msg) */ #define Pmsg0(lvl, msg) p_msg(__FILE__, __LINE__, lvl, msg) #define Pmsg1(lvl, msg, a1) p_msg(__FILE__, __LINE__, lvl, msg, a1) #define Pmsg2(lvl, msg, a1, a2) p_msg(__FILE__, __LINE__, lvl, msg, a1, a2) @@ -536,7 +537,7 @@ void b_memset(const char *file, int line, void *mem, int val, size_t num); #define Pmsg14(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14) p_msg(__FILE__,__LINE__,lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14) -/* Daemon Error Messages that are delivered according to the message resource */ +/** Daemon Error Messages that are delivered according to the message resource */ #define Emsg0(typ, lvl, msg) e_msg(__FILE__, __LINE__, typ, lvl, msg) #define Emsg1(typ, lvl, msg, a1) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1) #define Emsg2(typ, lvl, msg, a1, a2) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2) @@ -545,7 +546,7 @@ void b_memset(const char *file, int line, void *mem, int val, size_t num); #define Emsg5(typ, lvl, msg, a1, a2, a3, a4, a5) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2, a3, a4, a5) #define Emsg6(typ, lvl, msg, a1, a2, a3, a4, a5, a6) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2, a3, a4, a5, a6) -/* Job Error Messages that are delivered according to the message resource */ +/** Job Error Messages that are delivered according to the message resource */ #define Jmsg0(jcr, typ, lvl, msg) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg) #define Jmsg1(jcr, typ, lvl, msg, a1) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1) #define Jmsg2(jcr, typ, lvl, msg, a1, a2) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2) @@ -554,7 +555,7 @@ void b_memset(const char *file, int line, void *mem, int val, size_t num); #define Jmsg5(jcr, typ, lvl, msg, a1, a2, a3, a4, a5) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4, a5) #define Jmsg6(jcr, typ, lvl, msg, a1, a2, a3, a4, a5, a6) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4, a5, a6) -/* Queued Job Error Messages that are delivered according to the message resource */ +/** Queued Job Error Messages that are delivered according to the message resource */ #define Qmsg0(jcr, typ, lvl, msg) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg) #define Qmsg1(jcr, typ, lvl, msg, a1) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1) #define Qmsg2(jcr, typ, lvl, msg, a1, a2) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2) @@ -564,7 +565,7 @@ void b_memset(const char *file, int line, void *mem, int val, size_t num); #define Qmsg6(jcr, typ, lvl, msg, a1, a2, a3, a4, a5, a6) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4, a5, a6) -/* Memory Messages that are edited into a Pool Memory buffer */ +/** Memory Messages that are edited into a Pool Memory buffer */ #define Mmsg0(buf, msg) m_msg(__FILE__, __LINE__, buf, msg) #define Mmsg1(buf, msg, a1) m_msg(__FILE__, __LINE__, buf, msg, a1) #define Mmsg2(buf, msg, a1, a2) m_msg(__FILE__, __LINE__, buf, msg, a1, a2) @@ -594,7 +595,7 @@ int m_msg(const char *file, int line, POOLMEM **msgbuf, const char *fmt,...); int m_msg(const char *file, int line, POOLMEM *&pool_buf, const char *fmt, ...); -/* Use our strdup with smartalloc */ +/** Use our strdup with smartalloc */ #ifndef HAVE_WXCONSOLE #undef strdup #define strdup(buf) bad_call_on_strdup_use_bstrdup(buf) @@ -608,11 +609,11 @@ int m_msg(const char *file, int line, POOLMEM *&pool_buf, const char *fmt, ...) #endif #endif -/* Use our fgets which handles interrupts */ +/** Use our fgets which handles interrupts */ #undef fgets #define fgets(x,y,z) bfgets((x), (y), (z)) -/* Use our sscanf, which is safer and works with known sizes */ +/** Use our sscanf, which is safer and works with known sizes */ #define sscanf bsscanf #ifdef DEBUG @@ -625,10 +626,10 @@ int m_msg(const char *file, int line, POOLMEM *&pool_buf, const char *fmt, ...) #define bmalloc(size) b_malloc(__FILE__, __LINE__, (size)) #endif -/* Macro to simplify free/reset pointers */ +/** Macro to simplify free/reset pointers */ #define bfree_and_null(a) do{if(a){free(a); (a)=NULL;}} while(0) -/* +/** * Replace codes needed in both file routines and non-file routines * Job replace codes -- in "replace" */ @@ -637,8 +638,8 @@ int m_msg(const char *file, int line, POOLMEM *&pool_buf, const char *fmt, ...) #define REPLACE_NEVER 'n' #define REPLACE_IFOLDER 'o' -/* This probably should be done on a machine by machine basis, but it works */ -/* This is critical for the smartalloc routines to properly align memory */ +/** This probably should be done on a machine by machine basis, but it works */ +/** This is critical for the smartalloc routines to properly align memory */ #define ALIGN_SIZE (sizeof(double)) #define BALIGN(x) (((x) + ALIGN_SIZE - 1) & ~(ALIGN_SIZE -1)) @@ -663,7 +664,7 @@ int m_msg(const char *file, int line, POOLMEM *&pool_buf, const char *fmt, ...) #ifdef HAVE_SUN_OS - /* + /** * On Solaris 2.5, threads are not timesliced by default, so we need to * explictly increase the conncurrency level. */ @@ -675,7 +676,7 @@ extern int thr_setconcurrency(int); #else -/* Not needed on most systems */ +/** Not needed on most systems */ #define set_thread_concurrency(x) #endif @@ -712,12 +713,12 @@ inline const char *first_path_separator(const char *path) { return strchr(path, #endif -/* HP-UX 11 specific workarounds */ +/** HP-UX 11 specific workarounds */ #ifdef HAVE_HPUX_OS # undef h_errno extern int h_errno; -/* the {get,set}domainname() functions exist in HPUX's libc. +/** the {get,set}domainname() functions exist in HPUX's libc. * the configure script detects that correctly. * the problem is no system headers declares the prototypes for these functions * this is done below @@ -734,7 +735,7 @@ extern "C" int mknod(const char *path, int mode, dev_t device ); #endif -/* Disabled because it breaks internationalisation... +/** Disabled because it breaks internationalisation... #undef HAVE_SETLOCALE #ifdef HAVE_SETLOCALE #include @@ -748,7 +749,7 @@ extern "C" int mknod(const char *path, int mode, dev_t device ); #endif */ -/* Determine endiannes */ +/** Determine endianes */ static inline bool bigendian() { return htonl(1) == 1L; } #endif /* _BACONFIG_H */ diff --git a/bacula/src/filed/backup.c b/bacula/src/filed/backup.c index c033342b8f..b2fad4c302 100644 --- a/bacula/src/filed/backup.c +++ b/bacula/src/filed/backup.c @@ -25,7 +25,7 @@ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, Switzerland, email:ftf@fsfeurope.org. */ -/* +/** * Bacula File Daemon backup.c send file attributes and data * to the Storage daemon. * @@ -138,7 +138,7 @@ bool blast_data_to_storage_daemon(JCR *jcr, char *addr) set_find_options((FF_PKT *)jcr->ff, jcr->incremental, jcr->mtime); - /* in accurate mode, we overwrite the find_one check function */ + /** in accurate mode, we overwrite the find_one check function */ if (jcr->accurate) { set_find_changed_function((FF_PKT *)jcr->ff, accurate_check_file); } @@ -157,7 +157,7 @@ bool blast_data_to_storage_daemon(JCR *jcr, char *addr) jcr->xattr_data->content = get_pool_memory(PM_MESSAGE); } - /* Subroutine save_file() is called for each file */ + /** Subroutine save_file() is called for each file */ if (!find_files(jcr, (FF_PKT *)jcr->ff, save_file, plugin_save)) { ok = false; /* error */ set_jcr_job_status(jcr, JS_ErrorTerminated); @@ -223,28 +223,28 @@ static bool crypto_session_start(JCR *jcr) if (jcr->crypto.pki_encrypt) { uint32_t size = 0; - /* Create per-job session encryption context */ + /** Create per-job session encryption context */ jcr->crypto.pki_session = crypto_session_new(cipher, jcr->crypto.pki_recipients); - /* Get the session data size */ + /** Get the session data size */ if (!crypto_session_encode(jcr->crypto.pki_session, (uint8_t *)0, &size)) { Jmsg(jcr, M_FATAL, 0, _("An error occurred while encrypting the stream.\n")); return false; } - /* Allocate buffer */ + /** Allocate buffer */ jcr->crypto.pki_session_encoded = get_memory(size); - /* Encode session data */ + /** Encode session data */ if (!crypto_session_encode(jcr->crypto.pki_session, (uint8_t *)jcr->crypto.pki_session_encoded, &size)) { Jmsg(jcr, M_FATAL, 0, _("An error occurred while encrypting the stream.\n")); return false; } - /* ... and store the encoded size */ + /** ... and store the encoded size */ jcr->crypto.pki_session_encoded_size = size; - /* Allocate the encryption/decryption buffer */ + /** Allocate the encryption/decryption buffer */ jcr->crypto.crypto_buf = get_memory(CRYPTO_CIPHER_MAX_BLOCK_SIZE); } return true; @@ -269,7 +269,7 @@ static bool crypto_session_send(JCR *jcr, BSOCK *sd) { POOLMEM *msgsave; - /* Send our header */ + /** Send our header */ Dmsg2(100, "Send hdr fi=%ld stream=%d\n", jcr->JobFiles, STREAM_ENCRYPTED_SESSION_DATA); sd->fsend("%ld %d 0", jcr->JobFiles, STREAM_ENCRYPTED_SESSION_DATA); @@ -422,7 +422,7 @@ int save_file(JCR *jcr, FF_PKT *ff_pkt, bool top_level) Dmsg1(130, "bfiled: sending %s to stored\n", ff_pkt->fname); - /* Digests and encryption are only useful if there's file data */ + /** Digests and encryption are only useful if there's file data */ if (has_file_data) { /** * Setup for digest handling. If this fails, the digest will be set to NULL @@ -452,7 +452,7 @@ int save_file(JCR *jcr, FF_PKT *ff_pkt, bool top_level) digest_stream = STREAM_SHA512_DIGEST; } - /* Did digest initialization fail? */ + /** Did digest initialization fail? */ if (digest_stream != STREAM_NONE && digest == NULL) { Jmsg(jcr, M_WARNING, 0, _("%s digest initialization failed\n"), stream_to_ascii(digest_stream)); @@ -468,7 +468,7 @@ int save_file(JCR *jcr, FF_PKT *ff_pkt, bool top_level) if (jcr->crypto.pki_sign) { signing_digest = crypto_digest_new(jcr, signing_algorithm); - /* Full-stop if a failure occurred initializing the signature digest */ + /** Full-stop if a failure occurred initializing the signature digest */ if (signing_digest == NULL) { Jmsg(jcr, M_NOTSAVED, 0, _("%s signature digest initialization failed\n"), stream_to_ascii(signing_algorithm)); @@ -477,13 +477,13 @@ int save_file(JCR *jcr, FF_PKT *ff_pkt, bool top_level) } } - /* Enable encryption */ + /** Enable encryption */ if (jcr->crypto.pki_encrypt) { ff_pkt->flags |= FO_ENCRYPT; } } - /* Initialize the file descriptor we use for data and other streams. */ + /** Initialize the file descriptor we use for data and other streams. */ binit(&ff_pkt->bfd); if (ff_pkt->flags & FO_PORTABLE) { set_portable_backup(&ff_pkt->bfd); /* disable Win32 BackupRead() */ @@ -495,19 +495,19 @@ int save_file(JCR *jcr, FF_PKT *ff_pkt, bool top_level) send_plugin_name(jcr, sd, true); /* signal start of plugin data */ } - /* Send attributes -- must be done after binit() */ + /** Send attributes -- must be done after binit() */ if (!encode_and_send_attributes(jcr, ff_pkt, data_stream)) { goto bail_out; } - /* Set up the encryption context and send the session data to the SD */ + /** Set up the encryption context and send the session data to the SD */ if (has_file_data && jcr->crypto.pki_encrypt) { if (!crypto_session_send(jcr, sd)) { goto bail_out; } } - /* + /** * Open any file with data that we intend to save, then save it. * * Note, if is_win32_backup, we must open the Directory so that @@ -570,7 +570,7 @@ int save_file(JCR *jcr, FF_PKT *ff_pkt, bool top_level) } if (have_darwin_os) { - /* Regular files can have resource forks and Finder Info */ + /** Regular files can have resource forks and Finder Info */ if (ff_pkt->type != FT_LNKSAVED && (S_ISREG(ff_pkt->statp.st_mode) && ff_pkt->flags & FO_HFSPLUS)) { if (ff_pkt->hfsinfo.rsrclength > 0) { @@ -618,7 +618,7 @@ int save_file(JCR *jcr, FF_PKT *ff_pkt, bool top_level) } } - /* + /** * Save ACLs when requested and available for anything not being a symlink and not being a plugin. */ if (have_acl) { @@ -627,7 +627,7 @@ int save_file(JCR *jcr, FF_PKT *ff_pkt, bool top_level) case bacl_exit_fatal: goto bail_out; case bacl_exit_error: - /* + /** * Non-fatal errors, count them and when the number is under ACL_REPORT_ERR_MAX_PER_JOB * print the error message set by the lower level routine in jcr->errmsg. */ @@ -642,7 +642,7 @@ int save_file(JCR *jcr, FF_PKT *ff_pkt, bool top_level) } } - /* + /** * Save Extended Attributes when requested and available for all files not being a plugin. */ if (have_xattr) { @@ -651,7 +651,7 @@ int save_file(JCR *jcr, FF_PKT *ff_pkt, bool top_level) case bxattr_exit_fatal: goto bail_out; case bxattr_exit_error: - /* + /** * Non-fatal errors, count them and when the number is under XATTR_REPORT_ERR_MAX_PER_JOB * print the error message set by the lower level routine in jcr->errmsg. */ @@ -666,7 +666,7 @@ int save_file(JCR *jcr, FF_PKT *ff_pkt, bool top_level) } } - /* Terminate the signing digest and send it to the Storage daemon */ + /** Terminate the signing digest and send it to the Storage daemon */ if (signing_digest) { uint32_t size = 0; @@ -680,22 +680,22 @@ int save_file(JCR *jcr, FF_PKT *ff_pkt, bool top_level) goto bail_out; } - /* Get signature size */ + /** Get signature size */ if (!crypto_sign_encode(sig, NULL, &size)) { Jmsg(jcr, M_FATAL, 0, _("An error occurred while signing the stream.\n")); goto bail_out; } - /* Grow the bsock buffer to fit our message if necessary */ + /** Grow the bsock buffer to fit our message if necessary */ if (sizeof_pool_memory(sd->msg) < (int32_t)size) { sd->msg = realloc_pool_memory(sd->msg, size); } - /* Send our header */ + /** Send our header */ sd->fsend("%ld %ld 0", jcr->JobFiles, STREAM_SIGNED_DIGEST); Dmsg1(300, "bfiled>stored:header %s\n", sd->msg); - /* Encode signature data */ + /** Encode signature data */ if (!crypto_sign_encode(sig, (uint8_t *)sd->msg, &size)) { Jmsg(jcr, M_FATAL, 0, _("An error occurred while signing the stream.\n")); goto bail_out; @@ -706,7 +706,7 @@ int save_file(JCR *jcr, FF_PKT *ff_pkt, bool top_level) sd->signal(BNET_EOD); /* end of checksum */ } - /* Terminate any digest and send it to Storage daemon */ + /** Terminate any digest and send it to Storage daemon */ if (digest) { uint32_t size; @@ -715,7 +715,7 @@ int save_file(JCR *jcr, FF_PKT *ff_pkt, bool top_level) size = CRYPTO_DIGEST_MAX_SIZE; - /* Grow the bsock buffer to fit our message if necessary */ + /** Grow the bsock buffer to fit our message if necessary */ if (sizeof_pool_memory(sd->msg) < (int32_t)size) { sd->msg = realloc_pool_memory(sd->msg, size); } @@ -808,7 +808,7 @@ static int send_data(JCR *jcr, int stream, FF_PKT *ff_pkt, DIGEST *digest, */ if (((z_stream*)jcr->pZLIB_compress_workset)->total_in == 0) { - /* set gzip compression level - must be done per file */ + /** set gzip compression level - must be done per file */ if ((zstat=deflateParams((z_stream*)jcr->pZLIB_compress_workset, ff_pkt->GZIP_level, Z_DEFAULT_STRATEGY)) != Z_OK) { Jmsg(jcr, M_FATAL, 0, _("Compression deflateParams error: %d\n"), zstat); @@ -826,7 +826,7 @@ static int send_data(JCR *jcr, int stream, FF_PKT *ff_pkt, DIGEST *digest, Jmsg0(jcr, M_FATAL, 0, _("Encrypting sparse data not supported.\n")); goto err; } - /* Allocate the cipher context */ + /** Allocate the cipher context */ if ((cipher_ctx = crypto_cipher_new(jcr->crypto.pki_session, true, &cipher_block_size)) == NULL) { /* Shouldn't happen! */ @@ -869,7 +869,7 @@ static int send_data(JCR *jcr, int stream, FF_PKT *ff_pkt, DIGEST *digest, rbuf += SPARSE_FADDR_SIZE; rsize -= SPARSE_FADDR_SIZE; #ifdef HAVE_FREEBSD_OS - /* + /** * To read FreeBSD partitions, the read size must be * a multiple of 512. */ @@ -877,7 +877,7 @@ static int send_data(JCR *jcr, int stream, FF_PKT *ff_pkt, DIGEST *digest, #endif } - /* a RAW device read on win32 only works if the buffer is a multiple of 512 */ + /** a RAW device read on win32 only works if the buffer is a multiple of 512 */ #ifdef HAVE_WIN32 if (S_ISBLK(ff_pkt->statp.st_mode)) rsize = (rsize/512) * 512; @@ -888,7 +888,7 @@ static int send_data(JCR *jcr, int stream, FF_PKT *ff_pkt, DIGEST *digest, */ while ((sd->msglen=(uint32_t)bread(&ff_pkt->bfd, rbuf, rsize)) > 0) { - /* Check for sparse blocks */ + /** Check for sparse blocks */ if (ff_pkt->flags & FO_SPARSE) { ser_declare; bool allZeros = false; @@ -899,12 +899,12 @@ static int send_data(JCR *jcr, int stream, FF_PKT *ff_pkt, DIGEST *digest, allZeros = is_buf_zero(rbuf, rsize); } if (!allZeros) { - /* Put file address as first data in buffer */ + /** Put file address as first data in buffer */ ser_begin(wbuf, SPARSE_FADDR_SIZE); ser_uint64(fileAddr); /* store fileAddr in begin of buffer */ } fileAddr += sd->msglen; /* update file address */ - /* Skip block of all zeros */ + /** Skip block of all zeros */ if (allZeros) { continue; /* skip block of zeros */ } @@ -912,21 +912,21 @@ static int send_data(JCR *jcr, int stream, FF_PKT *ff_pkt, DIGEST *digest, jcr->ReadBytes += sd->msglen; /* count bytes read */ - /* Uncompressed cipher input length */ + /** Uncompressed cipher input length */ cipher_input_len = sd->msglen; - /* Update checksum if requested */ + /** Update checksum if requested */ if (digest) { crypto_digest_update(digest, (uint8_t *)rbuf, sd->msglen); } - /* Update signing digest if requested */ + /** Update signing digest if requested */ if (signing_digest) { crypto_digest_update(signing_digest, (uint8_t *)rbuf, sd->msglen); } #ifdef HAVE_LIBZ - /* Do compression if turned on */ + /** Do compression if turned on */ if (ff_pkt->flags & FO_GZIP && jcr->pZLIB_compress_workset) { Dmsg3(400, "cbuf=0x%x rbuf=0x%x len=%u\n", cbuf, rbuf, sd->msglen); @@ -941,7 +941,7 @@ static int send_data(JCR *jcr, int stream, FF_PKT *ff_pkt, DIGEST *digest, goto err; } compress_len = ((z_stream*)jcr->pZLIB_compress_workset)->total_out; - /* reset zlib stream to be able to begin from scratch again */ + /** reset zlib stream to be able to begin from scratch again */ if ((zstat=deflateReset((z_stream*)jcr->pZLIB_compress_workset)) != Z_OK) { Jmsg(jcr, M_FATAL, 0, _("Compression deflateReset error: %d\n"), zstat); set_jcr_job_status(jcr, JS_ErrorTerminated); @@ -976,7 +976,7 @@ static int send_data(JCR *jcr, int stream, FF_PKT *ff_pkt, DIGEST *digest, cipher_input_len += SPARSE_FADDR_SIZE; } - /* Encrypt the length of the input block */ + /** Encrypt the length of the input block */ uint8_t packet_len[sizeof(uint32_t)]; ser_begin(packet_len, sizeof(uint32_t)); @@ -985,23 +985,23 @@ static int send_data(JCR *jcr, int stream, FF_PKT *ff_pkt, DIGEST *digest, if (!crypto_cipher_update(cipher_ctx, packet_len, sizeof(packet_len), (uint8_t *)jcr->crypto.crypto_buf, &initial_len)) { - /* Encryption failed. Shouldn't happen. */ + /** Encryption failed. Shouldn't happen. */ Jmsg(jcr, M_FATAL, 0, _("Encryption error\n")); goto err; } - /* Encrypt the input block */ + /** Encrypt the input block */ if (crypto_cipher_update(cipher_ctx, cipher_input, cipher_input_len, (uint8_t *)&jcr->crypto.crypto_buf[initial_len], &encrypted_len)) { if ((initial_len + encrypted_len) == 0) { - /* No full block of data available, read more data */ + /** No full block of data available, read more data */ continue; } Dmsg2(400, "encrypted len=%d unencrypted len=%d\n", encrypted_len, sd->msglen); sd->msglen = initial_len + encrypted_len; /* set encrypted length */ } else { - /* Encryption failed. Shouldn't happen. */ + /** Encryption failed. Shouldn't happen. */ Jmsg(jcr, M_FATAL, 0, _("Encryption error\n")); goto err; } @@ -1034,7 +1034,7 @@ static int send_data(JCR *jcr, int stream, FF_PKT *ff_pkt, DIGEST *digest, Jmsg(jcr, M_FATAL, 0, _("Too many errors. JobErrors=%d.\n"), jcr->JobErrors); } } else if (ff_pkt->flags & FO_ENCRYPT) { - /* + /** * For encryption, we must call finalize to push out any * buffered data. */ @@ -1045,7 +1045,7 @@ static int send_data(JCR *jcr, int stream, FF_PKT *ff_pkt, DIGEST *digest, goto err; } - /* Note, on SSL pre-0.9.7, there is always some output */ + /** Note, on SSL pre-0.9.7, there is always some output */ if (encrypted_len > 0) { sd->msglen = encrypted_len; /* set encrypted length */ sd->msg = jcr->crypto.crypto_buf; /* set correct write buffer */ @@ -1070,14 +1070,14 @@ static int send_data(JCR *jcr, int stream, FF_PKT *ff_pkt, DIGEST *digest, goto err; } - /* Free the cipher context */ + /** Free the cipher context */ if (cipher_ctx) { crypto_cipher_free(cipher_ctx); } return 1; err: - /* Free the cipher context */ + /** Free the cipher context */ if (cipher_ctx) { crypto_cipher_free(cipher_ctx); } @@ -1099,7 +1099,7 @@ bool encode_and_send_attributes(JCR *jcr, FF_PKT *ff_pkt, int &data_stream) #endif Dmsg1(300, "encode_and_send_attrs fname=%s\n", ff_pkt->fname); - /* Find what data stream we will use, then encode the attributes */ + /** Find what data stream we will use, then encode the attributes */ if ((data_stream = select_data_stream(ff_pkt)) == STREAM_NONE) { /* This should not happen */ Jmsg0(jcr, M_FATAL, 0, _("Invalid file flags, no supported data stream type.\n")); @@ -1107,7 +1107,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 */ + /** Now possibly extend the attributes */ attr_stream = encode_attribsEx(jcr, attribsEx, ff_pkt); Dmsg3(300, "File %s\nattribs=%s\nattribsEx=%s\n", ff_pkt->fname, attribs, attribsEx); @@ -1118,7 +1118,7 @@ bool encode_and_send_attributes(JCR *jcr, FF_PKT *ff_pkt, int &data_stream) pm_strcpy(jcr->last_fname, ff_pkt->fname); jcr->unlock(); - /* + /** * Send Attributes header to Storage daemon * */ @@ -1131,7 +1131,7 @@ bool encode_and_send_attributes(JCR *jcr, FF_PKT *ff_pkt, int &data_stream) } Dmsg1(300, ">stored: attrhdr %s\n", sd->msg); - /* + /** * Send file attributes to Storage daemon * File_index * File type @@ -1184,7 +1184,7 @@ static bool do_strip(int count, char *in) int stripped; int numsep = 0; - /* Copy to first path separator -- Win32 might have c: ... */ + /** Copy to first path separator -- Win32 might have c: ... */ while (*in && !IsPathSeparator(*in)) { out++; in++; } diff --git a/bacula/src/findlib/attribs.c b/bacula/src/findlib/attribs.c index 6160706369..10d0b22a88 100644 --- a/bacula/src/findlib/attribs.c +++ b/bacula/src/findlib/attribs.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2002-2009 Free Software Foundation Europe e.V. + Copyright (C) 2002-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. @@ -25,15 +25,13 @@ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, Switzerland, email:ftf@fsfeurope.org. */ -/* +/** * Encode and decode standard Unix attributes and * Extended attributes for Win32 and * other non-Unix systems, or Unix systems with ACLs, ... * * Kern Sibbald, October MMII * - * Version $Id$ - * */ #include "bacula.h" @@ -63,23 +61,22 @@ HANDLE bget_handle(BFILE *bfd); /* */ /*=============================================================*/ -/* +/** * Return the data stream that will be used */ int select_data_stream(FF_PKT *ff_pkt) { int stream; - /* + /** * Fix all incompatible options */ - - /* No sparse option for encrypted data */ + /** No sparse option for encrypted data */ if (ff_pkt->flags & FO_ENCRYPT) { ff_pkt->flags &= ~FO_SPARSE; } - /* Note, no sparse option for win32_data */ + /** Note, no sparse option for win32_data */ if (!is_portable_backup(&ff_pkt->bfd)) { stream = STREAM_WIN32_DATA; ff_pkt->flags &= ~FO_SPARSE; @@ -89,18 +86,18 @@ int select_data_stream(FF_PKT *ff_pkt) stream = STREAM_FILE_DATA; } - /* Encryption is only supported for file data */ + /** Encryption is only supported for file data */ if (stream != STREAM_FILE_DATA && stream != STREAM_WIN32_DATA && stream != STREAM_MACOS_FORK_DATA) { ff_pkt->flags &= ~FO_ENCRYPT; } - /* Compression is not supported for Mac fork data */ + /** Compression is not supported for Mac fork data */ if (stream == STREAM_MACOS_FORK_DATA) { ff_pkt->flags &= ~FO_GZIP; } - /* + /** * Handle compression and encryption options */ #ifdef HAVE_LIBZ @@ -116,8 +113,10 @@ int select_data_stream(FF_PKT *ff_pkt) stream = STREAM_GZIP_DATA; break; default: - /* All stream types that do not support gzip should clear out - * FO_GZIP above, and this code block should be unreachable. */ + /** + * All stream types that do not support gzip should clear out + * FO_GZIP above, and this code block should be unreachable. + */ ASSERT(!(ff_pkt->flags & FO_GZIP)); return STREAM_NONE; } @@ -151,7 +150,7 @@ int select_data_stream(FF_PKT *ff_pkt) } -/* +/** * Encode a stat structure into a base64 character string * All systems must create such a structure. * In addition, we tack on the LinkFI, which is non-zero in @@ -166,7 +165,7 @@ void encode_stat(char *buf, struct stat *statp, int32_t LinkFI, int data_stream) { char *p = buf; - /* + /** * Encode a stat packet. I should have done this more intelligently * with a length so that it could be easily expanded. */ @@ -236,7 +235,7 @@ void encode_stat(char *buf, struct stat *statp, int32_t LinkFI, int data_stream) #endif -/* Decode a stat packet from base64 characters */ +/** Decode a stat packet from base64 characters */ int decode_stat(char *buf, struct stat *statp, int32_t *LinkFI) { char *p = buf; @@ -321,7 +320,7 @@ int decode_stat(char *buf, struct stat *statp, int32_t *LinkFI) return (int)val; } -/* Decode a LinkFI field of encoded stat packet */ +/** Decode a LinkFI field of encoded stat packet */ int32_t decode_LinkFI(char *buf, struct stat *statp) { char *p = buf; @@ -363,7 +362,7 @@ int32_t decode_LinkFI(char *buf, struct stat *statp) return 0; } -/* +/** * Set file modes, permissions and times * * fname is the original filename @@ -404,7 +403,7 @@ bool set_attributes(JCR *jcr, ATTR *attr, BFILE *ofd) } - /* + /** * If Windows stuff failed, e.g. attempt to restore Unix file * to Windows, simply fall through and we will do it the * universal way. @@ -424,7 +423,7 @@ bool set_attributes(JCR *jcr, ATTR *attr, BFILE *ofd) } } - /* + /** * We do not restore sockets, so skip trying to restore their * attributes. */ @@ -436,12 +435,12 @@ bool set_attributes(JCR *jcr, ATTR *attr, BFILE *ofd) ut.modtime = attr->statp.st_mtime; /* ***FIXME**** optimize -- don't do if already correct */ - /* + /** * For link, change owner of link using lchown, but don't * try to do a chmod as that will update the file behind it. */ if (attr->type == FT_LNK) { - /* Change owner of link, not of real file */ + /** Change owner of link, not of real file */ if (lchown(attr->ofname, attr->statp.st_uid, attr->statp.st_gid) < 0 && my_uid == 0) { berrno be; Jmsg2(jcr, M_ERROR, 0, _("Unable to set file owner %s: ERR=%s\n"), @@ -462,7 +461,7 @@ bool set_attributes(JCR *jcr, ATTR *attr, BFILE *ofd) ok = false; } - /* + /** * Reset file times. */ if (utime(attr->ofname, &ut) < 0 && my_uid == 0) { @@ -472,7 +471,7 @@ bool set_attributes(JCR *jcr, ATTR *attr, BFILE *ofd) ok = false; } #ifdef HAVE_CHFLAGS - /* + /** * FreeBSD user flags * * Note, this should really be done before the utime() above, @@ -503,7 +502,7 @@ bail_out: #if !defined(HAVE_WIN32) -/* +/** * It is possible to piggyback additional data e.g. ACLs on * the encode_stat() data by returning the extended attributes * here. They must be "self-contained" (i.e. you keep track @@ -515,7 +514,7 @@ bail_out: int encode_attribsEx(JCR *jcr, char *attribsEx, FF_PKT *ff_pkt) { #ifdef HAVE_DARWIN_OS - /* + /** * We save the Mac resource fork length so that on a * restore, we can be sure we put back the whole resource. */ @@ -562,7 +561,7 @@ int encode_attribsEx(JCR *jcr, char *attribsEx, FF_PKT *ff_pkt) unix_name_to_win32(&ff_pkt->sys_fname, ff_pkt->fname); - // try unicode version + /** try unicode version */ if (p_GetFileAttributesExW) { POOLMEM* pwszBuf = get_pool_memory(PM_FNAME); make_win32_path_UTF8_2_wchar(&pwszBuf, ff_pkt->fname); @@ -608,7 +607,7 @@ int encode_attribsEx(JCR *jcr, char *attribsEx, FF_PKT *ff_pkt) return STREAM_UNIX_ATTRIBUTES_EX; } -/* Define attributes that are legal to set with SetFileAttributes() */ +/** Define attributes that are legal to set with SetFileAttributes() */ #define SET_ATTRS ( \ FILE_ATTRIBUTE_ARCHIVE| \ FILE_ATTRIBUTE_HIDDEN| \ @@ -620,7 +619,7 @@ int encode_attribsEx(JCR *jcr, char *attribsEx, FF_PKT *ff_pkt) FILE_ATTRIBUTE_TEMPORARY) -/* +/** * Set Extended File Attributes for Win32 * * fname is the original filename @@ -637,7 +636,7 @@ static bool set_win32_attributes(JCR *jcr, ATTR *attr, BFILE *ofd) ULARGE_INTEGER li; POOLMEM *win32_ofile; - // if we have neither ansi nor wchar version, we leave + /** if we have neither Win ansi nor wchar API, get out */ if (!(p_SetFileAttributesW || p_SetFileAttributesA)) { return false; } @@ -676,11 +675,11 @@ static bool set_win32_attributes(JCR *jcr, ATTR *attr, BFILE *ofd) p += from_base64(&val, p); plug(atts.nFileSizeLow, val); - /* Convert to Windows path format */ + /** Convert to Windows path format */ win32_ofile = get_pool_memory(PM_FNAME); unix_name_to_win32(&win32_ofile, attr->ofname); - /* At this point, we have reconstructed the WIN32_FILE_ATTRIBUTE_DATA pkt */ + /** At this point, we have reconstructed the WIN32_FILE_ATTRIBUTE_DATA pkt */ if (!is_bopen(ofd)) { Dmsg1(100, "File not open: %s\n", attr->ofname);