Page MenuHomeFreeBSD

dump/restore: define variables in exactly one compilation unit
ClosedPublic

Authored by mckusick on Mar 28 2020, 3:29 PM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 23 2024, 11:55 AM
Unknown Object (File)
Dec 23 2023, 12:17 PM
Unknown Object (File)
Dec 22 2023, 6:14 AM
Unknown Object (File)
Dec 12 2023, 9:56 PM
Unknown Object (File)
Dec 3 2023, 12:44 PM
Unknown Object (File)
Dec 3 2023, 12:44 PM
Unknown Object (File)
Dec 3 2023, 12:44 PM
Unknown Object (File)
Dec 3 2023, 12:44 PM
Subscribers

Details

Summary

This fixes the build of the dump and restore utilities with -fno-common. Redundant initialization in itime.c have been removed.

The changes formerly in D24209 (primarily the change in <protocols/dumprestore.h>) have been merged into this change so that all the fixes to enable -fno-common for dump and restore are in one place.

Test Plan

Verify that dump | restore still works as previously.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

I prefer just using extern and then declaring the actual variables in the function in which they are most prominent, but using EXTERN as you have done does work fine.

This revision is now accepted and ready to land.Mar 30 2020, 10:42 PM

Rather than doing EXTERN, move the explicit declarations into file as this:
mapsize - main.c
usedinomap - main.c
dumpdirmap - main.c
dumpinomap - main.c
disk - main.c
tape - main.c
popenout - main.c
dumpdates - itime.c
temp - unused, remove from dump.h, main.c, and definition of _PATH_DTMP from pathnames.h
lastlevel - itime.c
level - main.c
uflag - main.c
diskfd - main.c
tapefd - tape.c
pipeout - main.c
curino - tape.c
newtape - tape.c
density - already declared in main.c
tapesize - main.c
tsize - main.c
asize - tape.c
etapes - main.c
nonodump - main.c
unlimited - main.c
cachesize - already declared in main.c
rsync_friendly - main.c
notify - already declared in main.c
blockswritten - already declared in main.c
tapeno - already declared in main.c
tstart_writing - main.c
tend_writing - main.c
passno - main.c
sblock - main.c
dev_bsize - already declared in main.c
dev_bshift - main.c
tp_bshift - main.c
dumpdates - leave in itime.c
nddates - leave in itime.c
If you would like me to take over this project, I am willing to do so.

mckusick edited reviewers, added: kevans; removed: mckusick.

Taking over with Kyle Evans blessing.

This revision now requires review to proceed.Apr 3 2020, 10:20 PM
mckusick edited the summary of this revision. (Show Details)
mckusick edited the test plan for this revision. (Show Details)

Rather than using EXTERN, place each global declaration into the file in which it is primarily used.

Looks good and compiles with -fno-common. Thanks much!

This revision is now accepted and ready to land.Apr 4 2020, 12:02 AM