Date: Fri, 2 Dec 2016 22:44:43 -0600 From: Kyle Evans <kevans91@ksu.edu> To: "Kenneth D. Merry" <ken@freebsd.org> Cc: <src-committers@freebsd.org>, <svn-src-all@freebsd.org>, <svn-src-head@freebsd.org> Subject: Re: svn commit: r309374 - in head: sbin/camcontrol sys/cam/scsi Message-ID: <CACNAnaHaP3esEcudefF3JvtBt5Mv2Kkyo8eRpQXd_EzBD3TvdQ@mail.gmail.com> In-Reply-To: <201612012220.uB1MKSbR054941@repo.freebsd.org> References: <201612012220.uB1MKSbR054941@repo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Dec 1, 2016 at 4:20 PM, Kenneth D. Merry <ken@freebsd.org> wrote: > Author: ken > Date: Thu Dec 1 22:20:27 2016 > New Revision: 309374 > URL: https://svnweb.freebsd.org/changeset/base/309374 > > Log: > 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 > > Added: > head/sbin/camcontrol/timestamp.c (contents, props changed) > Modified: > head/sbin/camcontrol/Makefile > head/sbin/camcontrol/camcontrol.8 > head/sbin/camcontrol/camcontrol.c > head/sbin/camcontrol/camcontrol.h > head/sys/cam/scsi/scsi_all.c > head/sys/cam/scsi/scsi_all.h > > Modified: head/sbin/camcontrol/Makefile > ... > +timestamp(struct cam_device *device, int argc, char **argv, char *combinedopt, > + int retry_count, int timeout, int verbosemode __unused) > +{ > + int c; > + uint64_t ts; > + char *format_string = NULL; > + char *timestamp_string = NULL; > + int action = -1; > + int error = 0; > + int single_arg = 0; > + int do_utc = 0; > + > + if (action == TIMESTAMP_REPORT) { > + error = report_timestamp(device, &ts, retry_count, > + timeout); > + if (error != 0) { > + goto bailout; > + } else if (strcmp(format_string, MIL) == 0) { > + printf("Timestamp in milliseconds: %ju\n", > + (uintmax_t)ts); > + } else { > + char temp_timestamp_string[100]; > + time_t time_var = ts / 1000; Hi, FWIW: Building -CURRENT on mips.mips (w/ freebsd-wifi-build), mips-gcc gets upset at the above line with the following error: /wifi-build/src/sbin/camcontrol/timestamp.c: In function 'timestamp': /wifi-build/src/sbin/camcontrol/timestamp.c:459:25: error: 'ts' may be used uninitialized in this function [-Werror=maybe-uninitialized] time_t time_var = ts / 1000; I understand that this is a bogus error because at this point it pretty much *has* to be set by the report_timestamp call just prior, but is there a clean way to trick GCC into agreeing, or is it just a matter of explicitly initializing it to 0 before the report_timestamp call? Thanks, Kyle Evans
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACNAnaHaP3esEcudefF3JvtBt5Mv2Kkyo8eRpQXd_EzBD3TvdQ>