diff options
author | Douglas Gilbert <dgilbert@interlog.com> | 2012-12-11 12:56:34 +0000 |
---|---|---|
committer | Douglas Gilbert <dgilbert@interlog.com> | 2012-12-11 12:56:34 +0000 |
commit | fb2bb1d405f644838718d009b8729e0e2ea73d88 (patch) | |
tree | 500d96fa3ba2f87a9a25421f0d1ea3eebfd1bfbc /src/sg_read.c | |
parent | 59d30db8fe57032c0f469967159af3009eb95faa (diff) | |
download | sg3_utils-fb2bb1d405f644838718d009b8729e0e2ea73d88.tar.gz |
run cleanfile over C source and headers
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@470 6180dd3e-e324-4e3e-922d-17de1ae2f315
Diffstat (limited to 'src/sg_read.c')
-rw-r--r-- | src/sg_read.c | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/src/sg_read.c b/src/sg_read.c index b18bfa33..d5e5a8bd 100644 --- a/src/sg_read.c +++ b/src/sg_read.c @@ -1,3 +1,23 @@ +/* A utility program for the Linux OS SCSI generic ("sg") device driver. +* Copyright (C) 2001 - 2012 D. Gilbert +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2, or (at your option) +* any later version. + + This program reads data from the given SCSI device (typically a disk + or cdrom) and discards that data. Its primary goal is to time + multiple reads all starting from the same logical address. Its interface + is a subset of another member of this package: sg_dd which is a + "dd" variant. The input file can be a scsi generic device, a block device, + a raw device or a seekable file. Streams such as stdin are not acceptable. + The block size ('bs') is assumed to be 512 if not given. + + This version should compile with Linux sg drivers with version numbers + >= 30000 . For mmap-ed IO the sg version number >= 30122 . + +*/ + #define _XOPEN_SOURCE 500 #ifndef _GNU_SOURCE #define _GNU_SOURCE @@ -27,27 +47,8 @@ #include "sg_lib.h" #include "sg_io_linux.h" -/* A utility program for the Linux OS SCSI generic ("sg") device driver. -* Copyright (C) 2001 - 2007 D. Gilbert -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2, or (at your option) -* any later version. - - This program reads data from the given SCSI device (typically a disk - or cdrom) and discards that data. Its primary goal is to time - multiple reads all starting from the same logical address. Its interface - is a subset of another member of this package: sg_dd which is a - "dd" variant. The input file can be a scsi generic device, a block device, - a raw device or a seekable file. Streams such as stdin are not acceptable. - The block size ('bs') is assumed to be 512 if not given. - - This version should compile with Linux sg drivers with version numbers - >= 30000 . For mmap-ed IO the sg version number >= 30122 . - -*/ -static const char * version_str = "1.18 20071226"; +static const char * version_str = "1.19 20121211"; #define DEF_BLOCK_SIZE 512 #define DEF_BLOCKS_PER_TRANSFER 128 @@ -189,7 +190,8 @@ static void usage() " no_dxfer 1->DMA to kernel buffers only, not user space, " "0->normal(def)\n" " odir 1->open block device O_DIRECT, 0->don't (def)\n" - " skip each transfer starts at this logical address (def=0)\n" + " skip each transfer starts at this logical address " + "(def=0)\n" " time 0->do nothing(def), 1->time from 1st cmd, 2->time " "from 2nd, ...\n" " verbose increase level of verbosity (def: 0)\n" @@ -316,7 +318,8 @@ static int sg_bread(int sg_fd, unsigned char * buff, int blocks, if (blocks > 0) { io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; io_hdr.dxfer_len = bs * blocks; - if (! do_mmap) /* not required: shows dxferp unused during mmap-ed IO */ + /* next: shows dxferp unused during mmap-ed IO */ + if (! do_mmap) io_hdr.dxferp = buff; if (diop && *diop) io_hdr.flags |= SG_FLAG_DIRECT_IO; |