Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-7]: src/external/bsd/iscsi/dist/src/lib Pull up following revisio...



details:   https://anonhg.NetBSD.org/src/rev/1cc53aaee36d
branches:  netbsd-7
changeset: 799331:1cc53aaee36d
user:      snj <snj%NetBSD.org@localhost>
date:      Fri May 15 04:00:50 2015 +0000

description:
Pull up following revision(s) (requested by joerg in ticket #771):
        external/bsd/iscsi/dist/src/lib/disk.c: revision 1.9
        external/bsd/iscsi/dist/src/lib/target.c: revision 1.8
the buffer is also used when there is no input
--
make seek test routine work with the configured block size.

diffstat:

 external/bsd/iscsi/dist/src/lib/disk.c   |  27 ++++++++++++++++-----------
 external/bsd/iscsi/dist/src/lib/target.c |   4 +---
 2 files changed, 17 insertions(+), 14 deletions(-)

diffs (99 lines):

diff -r 5d7b5398ed82 -r 1cc53aaee36d external/bsd/iscsi/dist/src/lib/disk.c
--- a/external/bsd/iscsi/dist/src/lib/disk.c    Fri May 15 03:58:06 2015 +0000
+++ b/external/bsd/iscsi/dist/src/lib/disk.c    Fri May 15 04:00:50 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: disk.c,v 1.8 2012/09/29 07:18:21 mlelstv Exp $ */
+/* $NetBSD: disk.c,v 1.8.10.1 2015/05/15 04:00:50 snj Exp $ */
 
 /*-
  * Copyright (c) 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -703,33 +703,38 @@
 /* allocate some space for a disk/extent, using an lseek, read and
 * write combination */
 static int
-de_allocate(disc_de_t *de, char *filename)
+de_allocate(disc_de_t *de, char *filename, uint64_t blocklen)
 {
        off_t   size;
-       char    block[DEFAULT_TARGET_BLOCK_LEN];
+       char     *block;
 
+       block = malloc(blocklen);
        size = de_getsize(de);
-       if (de_lseek(de, size - sizeof(block), SEEK_SET) == -1) {
+       if (de_lseek(de, size - blocklen, SEEK_SET) == -1) {
                iscsi_err(__FILE__, __LINE__,
                                "error seeking \"%s\"\n", filename);
+               free(block);
                return 0;
        }
-       if (de_read(de, block, sizeof(block)) == -1) {
+       if (de_read(de, block, blocklen) == -1) {
                iscsi_err(__FILE__, __LINE__,
                                "error reading \"%s\"\n", filename);
+               free(block);
                return 0;
        }
-       if (de_write(de, block, sizeof(block)) == -1) {
+       if (de_write(de, block, blocklen) == -1) {
                iscsi_err(__FILE__, __LINE__,
                                "error writing \"%s\"\n", filename);
+               free(block);
                return 0;
        }
+       free(block);
        return 1;
 }
 
 /* allocate space as desired */
 static int
-allocate_space(disc_target_t *tp)
+allocate_space(disc_target_t *tp, uint64_t blocklen)
 {
        uint32_t        i;
 
@@ -737,10 +742,10 @@
        following write() in de_allocate is non-destructive */
        switch(tp->de.type) {
        case DE_EXTENT:
-               return de_allocate(&tp->de, tp->target);
+               return de_allocate(&tp->de, tp->target, blocklen);
        case DE_DEVICE:
                for (i = 0 ; i < tp->de.u.dp->c ; i++) {
-                       if (!de_allocate(&tp->de.u.dp->xv[i], tp->target)) {
+                       if (!de_allocate(&tp->de.u.dp->xv[i], tp->target, blocklen)) {
                                return 0;
                        }
                }
@@ -877,7 +882,7 @@
                        "error opening \"%s\"\n", idisk->filename);
                return -1;
        }
-       if (!(tp->flags & TARGET_READONLY) && !allocate_space(tp)) {
+       if (!(tp->flags & TARGET_READONLY) && !allocate_space(tp, idisk->blocklen)) {
                iscsi_err(__FILE__, __LINE__,
                        "error allocating space for \"%s\"\n", tp->target);
                return -1;
@@ -1514,7 +1519,7 @@
                        (unsigned) bytec;
        args->length = (unsigned) bytec;
        args->send_sg_len = 1;
-       args->status = 0;
+       args->status = SCSI_SUCCESS;
        args->send_buffer = ptr;
        return 0;
 out:
diff -r 5d7b5398ed82 -r 1cc53aaee36d external/bsd/iscsi/dist/src/lib/target.c
--- a/external/bsd/iscsi/dist/src/lib/target.c  Fri May 15 03:58:06 2015 +0000
+++ b/external/bsd/iscsi/dist/src/lib/target.c  Fri May 15 04:00:50 2015 +0000
@@ -321,9 +321,7 @@
        * there is input data and set the length of the input to
        * either scsi_cmd.trans_len or scsi_cmd.bidi_trans_len,
        * depending on whether scsi_cmd.output was set.  */
-       if (scsi_cmd.input) {
-               scsi_cmd.send_data = sess->buff;
-       }
+       scsi_cmd.send_data = sess->buff;
        scsi_cmd.input = 0;
        cmd.scsi_cmd = &scsi_cmd;
        cmd.callback = NULL;



Home | Main Index | Thread Index | Old Index