From d0a6ae340f6911686e3740553cb20e177881f93c Mon Sep 17 00:00:00 2001 From: zrj Date: Tue, 14 Nov 2017 22:30:57 +0200 Subject: [PATCH] cpdup(1): Whitespace cleanup. No functional change. --- bin/cpdup/BACKUPS | 12 ++++++------ bin/cpdup/PORTING | 2 +- bin/cpdup/cpdup.c | 28 ++++++++++++++-------------- bin/cpdup/fsmid.c | 8 ++++---- bin/cpdup/hcproto.c | 3 +-- bin/cpdup/md5.c | 8 ++++---- bin/cpdup/scripts/params | 2 +- 7 files changed, 31 insertions(+), 32 deletions(-) diff --git a/bin/cpdup/BACKUPS b/bin/cpdup/BACKUPS index 1e3a2d15bf..29c217ae96 100644 --- a/bin/cpdup/BACKUPS +++ b/bin/cpdup/BACKUPS @@ -85,7 +85,7 @@ $DragonFly: src/bin/cpdup/BACKUPS,v 1.4 2007/05/17 08:19:00 swildner Exp $ PART 3 - DO AN INCREMENTAL BACKUP An incremental backup is exactly the same as a level 0 backup EXCEPT - you use the -H option to specify the location of the most recent + you use the -H option to specify the location of the most recent completed backup. We simply maintain the handy softlink pointing at the most recent completed backup and the cpdup required to do this becomes trivial. @@ -116,7 +116,7 @@ $DragonFly: src/bin/cpdup/BACKUPS,v 1.4 2007/05/17 08:19:00 swildner Exp $ and copy the file instead. Generally speaking only a few special cases will hit the hardlink limit for a filesystem. For example, the CVS/Root file in a checked out cvs repository is often hardlinked, and - the sheer number of hardlinked 'Root' files multiplied by the number + the sheer number of hardlinked 'Root' files multiplied by the number of backups can often hit the filesystem hardlink limit. PART 4 - DO AN INCREMENTAL VERIFIED BACKUP @@ -125,7 +125,7 @@ $DragonFly: src/bin/cpdup/BACKUPS,v 1.4 2007/05/17 08:19:00 swildner Exp $ might exist on the physical /backup disk in only one place even though it may be present in dozens of daily mirrors. To ensure that the file being hardlinked does not get corrupted cpdup's -f option can be - used in conjunction with -H to force cpdup to validate the contents + used in conjunction with -H to force cpdup to validate the contents of the file, even if all the stat info looks identical. cpdup -f -H /backup/mirrors/box1 ... @@ -154,14 +154,14 @@ $DragonFly: src/bin/cpdup/BACKUPS,v 1.4 2007/05/17 08:19:00 swildner Exp $ Making an off-site backup involves similar methodology, but you use cpdup's remote host capability to generate the backup. To avoid complications it is usually best to take a mirror already generated on - your LAN backup box and copy that to the remote box. + your LAN backup box and copy that to the remote box. The remote backup box does not use NFS, so setup is trivial. Just create your super-large /backup partition and mkdir /backup/mirrors. Your LAN backup box will need root access via ssh to your remote backup box. See the section "SSH SECURITY TIPS" below. - You can use the handy softlink to get the latest 'box1.date' mirror + You can use the handy softlink to get the latest 'box1.date' mirror directory and since the mirror is all in one partition you can just cpdup the entire machine in one command. Use the same dated directory name on the remote box, so: @@ -232,7 +232,7 @@ $DragonFly: src/bin/cpdup/BACKUPS,v 1.4 2007/05/17 08:19:00 swildner Exp $ Once done you can do incremental backups using './do_mirror 1' to do a verified incremental, or './do_mirror 2' to do a stat-optimized - incremental. You can enable the cron jobs that run do_mirror and + incremental. You can enable the cron jobs that run do_mirror and do_cleanup now. -- diff --git a/bin/cpdup/PORTING b/bin/cpdup/PORTING index 2b3d7a8250..aaaa8f09db 100644 --- a/bin/cpdup/PORTING +++ b/bin/cpdup/PORTING @@ -15,7 +15,7 @@ $DragonFly: src/bin/cpdup/PORTING,v 1.2 2008/04/11 17:33:11 dillon Exp $ This script should suffice when compiling under linux. For some reason that I cannot fathom, linux defaults to using a 32 bit off_t. It makes no sense at all to me why they would want to do this, BSDs went to - a 64 bit default off_t over 15 years ago. In anycase, fixing it + a 64 bit default off_t over 15 years ago. In anycase, fixing it requires a few -D options. #!/bin/csh diff --git a/bin/cpdup/cpdup.c b/bin/cpdup/cpdup.c index 40aea2248f..993f64a216 100644 --- a/bin/cpdup/cpdup.c +++ b/bin/cpdup/cpdup.c @@ -7,9 +7,9 @@ * use and distribute based on the FreeBSD copyright. Supplied as-is, * USE WITH EXTREME CAUTION. * - * This program attempts to duplicate the source onto the destination as + * This program attempts to duplicate the source onto the destination as * exactly as possible, retaining modify times, flags, perms, uid, and gid. - * It can duplicate devices, files (including hardlinks), softlinks, + * It can duplicate devices, files (including hardlinks), softlinks, * directories, and so forth. It is recursive by default! The duplication * is inclusive of removal of files/directories on the destination that do * not exist on the source. This program supports a per-directory exception @@ -34,10 +34,10 @@ * - copies uid, gid, mtime, perms, flags, softlinks, devices, hardlinks, * and recurses through directories. * - * - accesses a per-directory exclusion file, .cpignore, containing + * - accesses a per-directory exclusion file, .cpignore, containing * standard wildcarded ( ? / * style, NOT regex) exclusions. * - * - tries to play permissions and flags smart in regards to overwriting + * - tries to play permissions and flags smart in regards to overwriting * schg files and doing related stuff. * * - Can do MD5 consistancy checks @@ -750,7 +750,7 @@ DoCopy(copy_info_t info, struct stat *stat1, int depth) * hard link is not correct, attempt to unlink it */ if (xremove(&DstHost, dpath) < 0) { - logerr("%-32s hardlink: unable to unlink: %s\n", + logerr("%-32s hardlink: unable to unlink: %s\n", ((dpath) ? dpath : spath), strerror(errno)); hltdelete(hln); hln = NULL; @@ -780,7 +780,7 @@ DoCopy(copy_info_t info, struct stat *stat1, int depth) } if (r == 0) { if (VerboseOpt) { - logstd("%-32s hardlink: %s\n", + logstd("%-32s hardlink: %s\n", (dpath ? dpath : spath), (st2Valid ? "relinked" : "linked") ); @@ -1111,7 +1111,7 @@ relink: #ifndef NOMD5 if (mres < 0) logerr("%-32s md5-CHECK-FAILED\n", (dpath) ? dpath : spath); - else + else #endif if (fres < 0) logerr("%-32s fsmid-CHECK-FAILED\n", (dpath) ? dpath : spath); @@ -1274,7 +1274,7 @@ skip_copy: if (DstRootPrivs || ChgrpAllowed(stat1->st_gid)) hc_lchown(&DstHost, path, stat1->st_uid, stat1->st_gid); /* - * there is no lchmod() or lchflags(), we + * there is no lchmod() or lchflags(), we * cannot chmod or chflags a softlink. */ if (st2Valid && xrename(path, dpath, st2_flags) != 0) { @@ -1301,7 +1301,7 @@ skip_copy: } CountSourceBytes += n1; CountSourceReadBytes += n1; - if (n2 > 0) + if (n2 > 0) CountTargetReadBytes += n2; CountSourceItems++; } else { @@ -1315,7 +1315,7 @@ skip_copy: char *path = NULL; if (ForceOpt || - st2Valid == 0 || + st2Valid == 0 || stat1->st_mode != st2.st_mode || stat1->st_rdev != st2.st_rdev || !OwnerMatch(stat1, &st2) @@ -1343,7 +1343,7 @@ skip_copy: CountCopiedItems++; } else { r = 1; - logerr("%-32s dev failed: %s\n", + logerr("%-32s dev failed: %s\n", (dpath ? dpath : spath), strerror(errno) ); } @@ -1631,8 +1631,8 @@ shash(const char *s) hv = 0xA4FB3255; while (*s) { - if (*s == '*' || *s == '?' || - *s == '{' || *s == '}' || + if (*s == '*' || *s == '?' || + *s == '{' || *s == '}' || *s == '[' || *s == ']' || *s == '|' ) { @@ -1661,7 +1661,7 @@ YesNo(const char *path) /* * xrename() - rename with override * - * If the rename fails, attempt to override st_flags on the + * If the rename fails, attempt to override st_flags on the * destination and rename again. If that fails too, try to * set the flags back the way they were and give up. */ diff --git a/bin/cpdup/fsmid.c b/bin/cpdup/fsmid.c index 405d34c603..d1b17f434f 100644 --- a/bin/cpdup/fsmid.c +++ b/bin/cpdup/fsmid.c @@ -24,7 +24,7 @@ static FSMIDNode *FSMIDBase; static int FSMIDDCacheDirLen; static int FSMIDDCacheDirty; -void +void fsmid_flush(void) { if (FSMIDDCacheDirty && FSMIDDCache && NotForRealOpt == 0) { @@ -35,8 +35,8 @@ fsmid_flush(void) for (node = FSMIDBase; node; node = node->fid_Next) { if (node->fid_Accessed && node->fid_Code) { - fprintf(fo, "%016jx %zu %s\n", - (intmax_t)node->fid_Code, + fprintf(fo, "%016jx %zu %s\n", + (intmax_t)node->fid_Code, strlen(node->fid_Name), node->fid_Name ); @@ -117,7 +117,7 @@ fsmid_cache(const char *dpath, int ddirlen) free(s); } /* - * extracting fid_Name - name may contain embedded control + * extracting fid_Name - name may contain embedded control * characters. */ CountSourceReadBytes += nlen+1; diff --git a/bin/cpdup/hcproto.c b/bin/cpdup/hcproto.c index b52ef337ba..6424074ad6 100644 --- a/bin/cpdup/hcproto.c +++ b/bin/cpdup/hcproto.c @@ -122,7 +122,6 @@ hc_slave(int fdin, int fdout) { hcc_slave(fdin, fdout, HCDispatchTable, sizeof(HCDispatchTable) / sizeof(HCDispatchTable[0])); - } /* @@ -1720,7 +1719,7 @@ hc_rename(struct HostConf *hc, const char *name1, const char *name2) { hctransaction_t trans; struct HCHead *head; - + if (NotForRealOpt) return(0); if (hc == NULL || hc->host == NULL) diff --git a/bin/cpdup/md5.c b/bin/cpdup/md5.c index 482f9ffaf2..990d864b48 100644 --- a/bin/cpdup/md5.c +++ b/bin/cpdup/md5.c @@ -26,7 +26,7 @@ static MD5Node *MD5Base; static int MD5SCacheDirLen; static int MD5SCacheDirty; -void +void md5_flush(void) { if (MD5SCacheDirty && MD5SCache && NotForRealOpt == 0) { @@ -37,8 +37,8 @@ md5_flush(void) for (node = MD5Base; node; node = node->md_Next) { if (node->md_Accessed && node->md_Code) { - fprintf(fo, "%s %zu %s\n", - node->md_Code, + fprintf(fo, "%s %zu %s\n", + node->md_Code, strlen(node->md_Name), node->md_Name ); @@ -123,7 +123,7 @@ md5_cache(const char *spath, int sdirlen) free(s); } /* - * extracting md_Name - name may contain embedded control + * extracting md_Name - name may contain embedded control * characters. */ CountSourceReadBytes += nlen+1; diff --git a/bin/cpdup/scripts/params b/bin/cpdup/scripts/params index 0e392a7292..9033594367 100644 --- a/bin/cpdup/scripts/params +++ b/bin/cpdup/scripts/params @@ -1,6 +1,6 @@ # sourced by do* scripts # -# do not include the BLAH/mirrors subdirectory when specifying the backup +# do not include the BLAH/mirrors subdirectory when specifying the backup # path and the remote path. The scripts will add it themselves, as a safety # feature. # -- 2.41.0