diff options
| author | Mattias Andrée <maandree@kth.se> | 2024-09-21 08:57:08 +0200 | 
|---|---|---|
| committer | Mattias Andrée <maandree@kth.se> | 2024-09-21 08:57:08 +0200 | 
| commit | 0ac99ad7100334933a993413333521087e29297b (patch) | |
| tree | cdcb989d9a079327f605752caa6134ece4fadfee | |
| parent | m (diff) | |
| download | deadshred-0ac99ad7100334933a993413333521087e29297b.tar.gz deadshred-0ac99ad7100334933a993413333521087e29297b.tar.bz2 deadshred-0ac99ad7100334933a993413333521087e29297b.tar.xz  | |
Update documentation and adjust blocksize if larger than the device size
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
| -rw-r--r-- | README | 11 | ||||
| -rw-r--r-- | deadshred.1 | 27 | ||||
| -rw-r--r-- | deadshred.c | 4 | 
3 files changed, 38 insertions, 4 deletions
@@ -2,7 +2,8 @@ NAME  	deadshred - override the contents of a device that may be broken  SYNOPSIS -	deadshred [-o offset] [-l length | -e postend] device [< random-source] +	deadshred [-b blocksize] [-o offset] [-l length | -e postend] +	          [-r] device [< random-source]  DESCRIPTION  	The deadshred utility fills a file or block devices with @@ -14,6 +15,10 @@ DESCRIPTION  OPTIONS  	The following options are supported: +	-b blocksize +		Selects the initial block-size for writing on the +		first pass over the device. +  	-e postend  		Position in the device to stop writing at. The byte  		indexed by the value postend will not be overwritten. @@ -27,6 +32,10 @@ OPTIONS  	-o offset  		The index of the first byte in the device to overwrite. +	-r +		Start writing from the end instead of from the +		beginning on the first pass over the device. +  OPERANDS  	The following operand is supported: diff --git a/deadshred.1 b/deadshred.1 index 5c3eb63..e445c05 100644 --- a/deadshred.1 +++ b/deadshred.1 @@ -4,6 +4,8 @@ deadshred \- override the contents of a device that may be broken  .SH SYNOPSIS  .B deadshred +[-b +.IR blocksize ]  [-o  .IR offset ]  [-l @@ -11,6 +13,7 @@ deadshred \- override the contents of a device that may be broken  |  -e  .IR postend ] +[-r]  .I device  [<  .IR random-source ] @@ -29,6 +32,10 @@ to override and retries it later.  .SH OPTIONS  The following options are supported:  .TP +.BR -b \ \fIblocksize\fP +Selects the initial block-size for writing on the +first pass over the device. +.TP  .BR -e \ \fIpostend\fP  Position in the  .I device @@ -56,9 +63,13 @@ bytes past  The index of the first byte in the  .I device  to overwrite. +.TP +.B -r +Start writing from the end instead of from the +beginning on the first pass over the device.  .PP  The value of the -.B -elo +.B -belo  flags can be expressed a sum of terms (delimited by  SP  .RB (' " " '), @@ -95,6 +106,20 @@ Unless the standard input is a terminal device, it shall be an  unless source of either random data or a particular byte to  fill the device with. +.SH STDOUT +If the process is terminated using either of the signals +SIGTERM or SIGINT, the process will write to standard output +a map of sections that has not been overwritten yet. The +output will be the concatenation of one string per section, +each on the format +.PP +.nf +\fB\(dq%s%x-%x/%x\(dq,\fP <\fB\(dq0x\(dq\fP for the first section, \fB\(dq,\(dq\fP otherwise>\fB,\fP +              <\fIindex of the first byte in the section\fP>\fB,\fP +              <\fIindex of the byte after the last in the section\fP>\fB,\fP +              <\fIthe block size that should be used when trying to overwrite\fP> +.fi +  .SH NOTES  While the  .B deadshred diff --git a/deadshred.c b/deadshred.c index c471982..d7f2f5f 100644 --- a/deadshred.c +++ b/deadshred.c @@ -4,7 +4,6 @@  USAGE("[-b blocksize] [-o offset] [-l length | -e postend] [-r] device [< random-source]"); -/* TODO document (also in README and man pages) options -b and -r */  struct status status = STATUS_INIT; @@ -417,6 +416,8 @@ main(int argc, char *argv[])  		close(fd);  		return 0;  	} +	while ((off_t)spans[0].blocksize >> 1 > total_size) +		spans[0].blocksize >>= 1;  	humansize1000(total_size, total_size_1000);  	humansize1024(total_size, total_size_1024); @@ -473,7 +474,6 @@ main(int argc, char *argv[])  	print_status(1, &status);  	if (nspans) { -		/* TODO document in man page */  		dump_map(STDOUT_FILENO, "<stdout>");  		if (close(STDOUT_FILENO))  			eprintf("write <stdout>");  | 
