Commit Graph

4 Commits

Author SHA1 Message Date
Enji Cooper
f2a12bce27 Cut to the chase and just call free instead of free(x) + x = NULL
NULLing out x wasn't required as the memory was immediately scribbled
over with strdup in the following call.

MFC after:	1 week
Submitted by:	imp
2016-12-10 23:58:14 +00:00
Enji Cooper
110559ba69 free/NULL out variables prior to calling strdup to avoid leaking memory
if arguments are specified more than once with "camcontrol timestamp".

CID:		1366829, 1366831
MFC after:	1 week
2016-12-10 23:26:34 +00:00
Adrian Chadd
a1fa23910c [camcontrol] init ts=0 to quieten gcc.
It "looks" like ts is set to something on success, and not modified on
error.

Checked on IRC with: cem
2016-12-03 20:35:39 +00:00
Kenneth D. Merry
28db0a5e74 Add SCSI REPORT TIMESTAMP and SET TIMESTAMP support.
This adds support to camcontrol(8) and libcam(3) for getting and setting
the time on SCSI protocol drives.  This is more commonly found on tape
drives, but is a SPC (SCSI Primary Commands) command, and may be found
on any device that speaks SCSI.

The new camcontrol timestamp subcommand allows getting the current device
time or setting the time to the current system time or any arbitrary time.

sbin/camcontrol/Makefile:
	Add timestamp.c.

sbin/camcontrol/camcontrol.8:
	Document the new timestamp subcommand.

sbin/camcontrol/camcontrol.c:
	Add the timestamp subcommand to camcontrol.

sbin/camcontrol/camcontrol.h:
	Add the timestamp() function prototype.

sbin/camcontrol/timestamp.c:
	Timestamp setting and reporting functionality.

sys/cam/scsi/scsi_all.c:
	Add two new CCB building functions, scsi_set_timestamp() and
	scsi_report_timestamp().  Also, add a new helper function,
	scsi_create_timestamp().

sys/cam/scsi/scsi_all.h:
	Add CDB and parameter data for the the set and report timestamp
	commands.

	Add function declarations for the new CCB building and helper
	functions.

Submitted by:	Sam Klopsch
Sponsored by:	Spectra Logic
MFC After:	2 weeks
2016-12-01 22:20:27 +00:00