This patch will make vhba module 1.0 compile with kernel 2.6.25

It fixes the following errors:

[code]/setup/work/cdemu-1.0/vhba-module-org/vhba.c:490: error: ‘struct scsi_cmnd’ has no member named ‘request_bufflen’
/setup/work/cdemu-1.0/vhba-module-org/vhba.c:491: error: ‘struct scsi_cmnd’ has no member named ‘request_bufflen’
/setup/work/cdemu-1.0/vhba-module-org/vhba.c:496: error: ‘struct scsi_cmnd’ has no member named ‘use_sg’
/setup/work/cdemu-1.0/vhba-module-org/vhba.c:500: error: ‘struct scsi_cmnd’ has no member named ‘request_buffer’[/code]

Click here to download it

Here comes the patch:

[code]--- vhba-module-org/vhba.c  2008-03-03 19:31:06.000000000 +0100
+++ vhba-module-1.0.0/vhba.c  2008-03-03 20:04:30.000000000 +0100
@@ -425,11 +425,11 @@
      ssize_t ret;

      scmd_dbg(cmd, "request %lu, cdb 0x%x, bufflen %d, use_sg %d\n",
-          cmd->serial_number, cmd->cmnd[0], cmd->request_bufflen, cmd->use_sg);
+          cmd->serial_number, cmd->cmnd[0], cmd->sdb.length, cmd->sdb.table.nents);

      ret = sizeof(vreq);
      if (DATA_TO_DEVICE(cmd->sc_data_direction))
-       ret += cmd->request_bufflen;
+       ret += cmd->sdb.length;

      if (ret > buf_len)
      {
@@ -442,7 +442,7 @@
      vreq.lun = cmd->device->lun;
      memcpy(vreq.cdb, cmd->cmnd, MAX_COMMAND_SIZE);
      vreq.cdb_len = cmd->cmd_len;
-     vreq.data_len = cmd->request_bufflen;
+     vreq.data_len = cmd->sdb.length;

      if (copy_to_user(buf, &vreq, sizeof(vreq)))
        return -EFAULT;
@@ -452,7 +452,7 @@
        buf += sizeof(vreq);

        /* XXX use_sg? */
-       if (copy_to_user(buf, cmd->request_buffer, vreq.data_len))
+       if (copy_to_user(buf, cmd->sdb.table.sgl, vreq.data_len))
           return -EFAULT;
      }

@@ -464,7 +464,7 @@
      ssize_t ret = 0;

      scmd_dbg(cmd, "response %lu, status %x, data len %d, use_sg %d\n",
-          cmd->serial_number, res->status, res->data_len, cmd->use_sg);
+          cmd->serial_number, res->status, res->data_len, cmd->sdb.table.nents);

      if (res->status)
      {
@@ -481,23 +481,23 @@

        ret += res->data_len;
      }
-     else if (DATA_FROM_DEVICE(cmd->sc_data_direction) && cmd->request_bufflen)
+     else if (DATA_FROM_DEVICE(cmd->sc_data_direction) && cmd->sdb.length)
      {
        size_t to_read;

-       if (res->data_len > cmd->request_bufflen)
+       if (res->data_len > cmd->sdb.length)
        {
-          scmd_warn(cmd, "truncate data (%d < %d)\n", cmd->request_bufflen, res->data_len);
-          res->data_len = cmd->request_bufflen;
+          scmd_warn(cmd, "truncate data (%d < %d)\n", cmd->sdb.length, res->data_len);
+          res->data_len = cmd->sdb.length;
        }

        to_read = res->data_len;

-       if (cmd->use_sg)
+       if (cmd->sdb.table.nents)
        {
           unsigned char buf_stack[64];
           unsigned char *kaddr, *uaddr, *kbuf;
-          struct scatterlist *sg = cmd->request_buffer;
+          struct scatterlist *sg = cmd->sdb.table.sgl;
           int i;

           uaddr = (unsigned char *) buf;
@@ -507,7 +507,7 @@
           else
                kbuf = buf_stack;

-          for (i = 0; i < cmd->use_sg; i++)
+          for (i = 0; i < cmd->sdb.table.nents; i++)
           {
                size_t len = (sg[i].length < to_read) ? sg[i].length : to_read;

@@ -534,13 +534,13 @@
        }
        else
        {
-          if (copy_from_user(cmd->request_buffer, buf, res->data_len))
+          if (copy_from_user(cmd->sdb.table.sgl, buf, res->data_len))
                return -EFAULT;

           to_read -= res->data_len;
        }

-       cmd->resid = to_read;
+       cmd->sdb.resid = to_read;

        ret += res->data_len - to_read;
      }[/code]