Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Patching hpt3xx-opensource-v2.0 sources for newer Kernels
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
hirschman
n00b
n00b


Joined: 17 May 2005
Posts: 4

PostPosted: Tue Jun 13, 2006 6:22 pm    Post subject: Patching hpt3xx-opensource-v2.0 sources for newer Kernels Reply with quote

Hi, i have searched for a patch for my raid controler and found one. But how can i apply the following patch to the source files?

Here is the link for orginal forum post:
http://forums.fedoraforum.org/archive/index.php/t-110222.html


Code:

 diff -r -N hpt3xx-opensource-v2.0/array.h hpt3xx_patched/array.h
 239c239
 -#if SUPPORT_RAID5
 ---
 +#ifdef SUPPORT_RAID5
 diff -r -N hpt3xx-opensource-v2.0/entry.c hpt3xx_patched/entry.c
 10c10
 -#if DBG
 ---
 +#ifdef DBG
 38c38
 -#if CONFIG_SMP && defined(SUPPORT_ARRAY) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
 ---
 +#if defined(CONFIG_SMP) && defined(SUPPORT_ARRAY) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
 533c533,535
 - scsi_set_pci_device(hpt_vhost, pPciDev);
 ---
 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12)
 +scsi_set_pci_device(hpt_vhost, pPciDev);
 +#endif
 564,567c566,574
 - scsi_set_pci_device(hpt_vhost, pPciDev);
 -#endif
 - i++;
 - }
 ---
 +
 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12)
 + scsi_set_pci_device(hpt_vhost, pPciDev);
 + #endif
 +#endif
 + i++;
 + }
 +
 +
 596c603,606
 - scsi_set_pci_device(hpt_vhost, pPciDev);
 ---
 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12)
 +scsi_set_pci_device(hpt_vhost, pPciDev);
 +#endif
 +
 737,739c747,749
 - hpt_printk(("Abort called pid:%ld target: %x lun: %x flags: %x"
 - " reason %x\n", SCpnt->pid, sc_target(SCpnt), sc_lun(SCpnt),
 - sc_flags(SCpnt), SCpnt->abort_reason));
 ---
 + hpt_printk(("Abort called pid:%ld target: %x lun: %x flags: %x",
 + SCpnt->pid, sc_target(SCpnt), sc_lun(SCpnt),
 + sc_flags(SCpnt)));
 903,904c913,914
 - sgList, SCpnt->use_sg, scsi_to_pci_dma_dir(SCpnt->sc_data_direction));
 - for (idx = 0; idx < sgcnt; idx++) {
 ---
 + sgList, SCpnt->use_sg, SCpnt->sc_data_direction);
 + for (idx = 0; idx < sgcnt; idx++) {
 diff -r -N hpt3xx-opensource-v2.0/gui_lib.c hpt3xx_patched/gui_lib.c
 149a150
 + pInfo->u.array.Flags =0x0;
 270,271d270
 -#ifdef ARRAY_V2_ONLY
 - PVDevice pvdev1;
 273,285d271
 - if ((pVDevice->VDeviceType == VD_RAID_1)&&(pVDevice->vf_format_v2) && (pInfo->u.array.nDisk == 2)) {
 - for(pvdev1 = pVDevStart; pvdev1 < pVDevEnd; pvdev1++) {
 - if ((pvdev1->VDeviceType==VD_SPARE)
 - &&(pvdev1->vf_format_v2 == 1)
 - &&(pvdev1->u.disk.pChannel->pChipInstance==pVDevice->u.array.pMember[0]->u.disk.pChannel->pChipInstance)
 - &&(pvdev1->u.disk.df_on_line == 1)) {
 -
 - pInfo->u.array.Members[pInfo->u.array.nDisk] = VDEV_TO_ID(pvdev1);
 - pInfo->u.array.nDisk++;
 - }
 - }
 - }
 -#endif
 404c390
 -#if SUPPORT_RAID5
 ---
 +#ifdef SUPPORT_RAID5
 630,647d615
 -/*
 - if ((pVDev->VDeviceType==VD_RAID_0) && (pArray->VDeviceType==VD_RAID_1))
 - {
 - pArray->u.array.bArnMember = pParam->nDisk;
 - pArray->u.array.bArRealnMember = pParam->nDisk;
 - pArray->u.array.bArBlockSizeShift = pVDev->u.array.bArBlockSizeShift;
 - pArray->u.array.bStripeWitch = (1 << pVDev->u.array.bArBlockSizeShift);
 - pArray->u.array.dArStamp = Stamp;
 - for (i=0;i<pParam->nDisk ;i++ )
 - (ID_TO_VDEV(pParam->Members[i]))->u.array.dArStamp = Stamp;
 - pArray->u.array.rf_need_sync = 1;
 - pArray->u.array.rf_newly_created = 1;
 - pArray->u.array.RebuildSectors = pArray->u.array.rf_need_rebuild? 0 : MAX_LBA_T;
 - memcpy(pArray->u.array.ArrayName, pParam->ArrayName, MAX_ARRAY_NAME);
 -
 - }
 - else {
 -*/
 657a626,630
 +
 +
 +
 +
 +
 782,784c755
 -#ifdef ARRAY_V2_ONLY
 - pArray->vf_format_v2 = 1;
 -#endif
 ---
 +
 787a759,760
 +
 +
 diff -r -N hpt3xx-opensource-v2.0/hpt.c hpt3xx_patched/hpt.c
 45,48c45,55
 -#include "scsi.h"
 -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
 -#include "sd.h"
 -#endif
 ---
 +#include <linux/stat.h>
 +#include <linux/types.h>
 +#include <linux/kdev_t.h>
 +#include <linux/major.h>
 +#include <linux/genhd.h>
 +#include <linux/fs.h>
 +#include <linux/highmem.h>
 +#include <scsi/scsi.h>
 +#include <scsi/scsi_device.h>
 +#include <scsi/scsi_cmnd.h>
 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,4)
 49a57,60
 +#else
 +#include <scsi/scsi_host.h>
 +#endif
 +
 60a72,82
 +typedef struct scsi_cmnd Scsi_Cmnd;
 +typedef struct scsi_device Scsi_Device;
 +typedef struct scsi_host_template Scsi_Host_Template;
 +#ifndef FALSE
 +#define FALSE 0
 +#endif
 +#ifndef TRUE
 +#define TRUE 1
 +#endif
 +#define scsi_to_pci_dma_dir(x) (x)
 +
 116,117c138,141
 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
 -#define scsi_set_pci_device(pshost, pcidev) scsi_set_device(pshost, &pcidev->dev)
 ---
 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13)
 +#define scsi_set_pci_device(pshost, pcidev) do { ;} while (0)
 +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
 +#define scsi_set_pci_device(pshost, pcidev) scsi_set_device(pshost, &pcidev->dev)
 119c143
 -#define scsi_set_pci_device(pshost, pcidev) do { ;} while (0)
 ---
 +#define scsi_set_pci_device(pshost, pcidev) do { ;} while (0)
 diff -r -N hpt3xx-opensource-v2.0/hptproc.c hpt3xx_patched/hptproc.c
 182c182
 -#if DBG
 ---
 +#ifdef DBG
 230c230
 - if (verify_area(VERIFY_READ, (void *)(ULONG_PTR)piop->lpInBuffer, piop->nInBufferSize)) {
 ---
 + if (!access_ok(VERIFY_READ, (void *)(ULONG_PTR)piop->lpInBuffer, piop->nInBufferSize)) {
 236c236
 - if (verify_area(VERIFY_WRITE, (void *)(ULONG_PTR)piop->lpOutBuffer, piop->nOutBufferSize)) {
 ---
 + if (!access_ok(VERIFY_WRITE, (void *)(ULONG_PTR)piop->lpOutBuffer, piop->nOutBufferSize)) {
 242c242
 - if (verify_area(VERIFY_WRITE, (void *)(ULONG_PTR)piop->lpBytesReturned, sizeof(DWORD))) {
 ---
 + if (!access_ok(VERIFY_WRITE, (void *)(ULONG_PTR)piop->lpBytesReturned, sizeof(DWORD))) {
 260c260,270
 - copy_from_user(ke_area, (void *)(ULONG_PTR)piop->lpInBuffer, piop->nInBufferSize);
 ---
 +
 + if (copy_from_user(ke_area, (void *)(ULONG_PTR)piop->lpInBuffer, piop->nInBufferSize)) {
 +
 + kfree(ke_area);
 +
 + KdPrintE(("copy_from_user error\n"));
 +
 + return -EINVAL;
 +
 + }
 +
 268c278,280
 - copy_to_user((void *)(ULONG_PTR)piop->lpOutBuffer,
 ---
 +
 + if (copy_to_user((void *)(ULONG_PTR)piop->lpOutBuffer,
 +
 270c282,292
 - piop->nOutBufferSize);
 ---
 +
 + piop->nOutBufferSize)) {
 +
 + kfree(ke_area);
 +
 + KdPrintE(("copy_to_user 1 error\n"));
 +
 + return -EINVAL;
 +
 + }
 +
 272c294,304
 - copy_to_user((void *)(ULONG_PTR)piop->lpBytesReturned, &dwRet, sizeof(DWORD));
 ---
 +
 + if (copy_to_user((void*)(ULONG_PTR)piop->lpBytesReturned, &dwRet, sizeof(DWORD))) {
 +
 + kfree(ke_area);
 +
 + KdPrintE(("copy_to_user 2 error\n"));
 +
 + return -EINVAL;
 +
 + }
 +
 352a385
 + UINT chan = 0;
 376,377c409,413
 -
 -
 ---
 +
 + chan++;
 +
 + chan &= ~4;
 +
 diff -r -N hpt3xx-opensource-v2.0/osheader.h hpt3xx_patched/osheader.h
 111c111
 -#if DBG
 ---
 +#ifdef DBG
 diff -r -N hpt3xx-opensource-v2.0/scsi_module.c hpt3xx_patched/scsi_module.c
 0a1,65
 +#include <linux/init.h>
 +#include <linux/kernel.h>
 +#include <linux/module.h>
 +
 +#include <scsi/scsi_host.h>
 +
 +
 +static int __init init_this_scsi_driver(void)
 +{
 +struct scsi_host_template *sht = &driver_template;
 +struct Scsi_Host *shost;
 +struct list_head *l;
 +int error;
 +
 +if (!sht->release) {
 +printk(KERN_ERR
 +"scsi HBA driver %s didn't set a release method.\n",
 +sht->name);
 +return -EINVAL;
 +}
 +
 +sht->module = THIS_MODULE;
 +INIT_LIST_HEAD(&sht->legacy_hosts);
 +
 +sht->detect(sht);
 +if (list_empty(&sht->legacy_hosts))
 +return -ENODEV;
 +
 +list_for_each_entry(shost, &sht->legacy_hosts, sht_legacy_list) {
 +error = scsi_add_host(shost, NULL);
 +if (error)
 +goto fail;
 +scsi_scan_host(shost);
 +}
 +return 0;
 +fail:
 +l = &shost->sht_legacy_list;
 +while ((l = l->prev) != &sht->legacy_hosts)
 +scsi_remove_host(list_entry(l, struct Scsi_Host, sht_legacy_list));
 +return error;
 +}
 +
 +static void __exit exit_this_scsi_driver(void)
 +{
 +struct scsi_host_template *sht = &driver_template;
 +struct Scsi_Host *shost, *s;
 +
 +list_for_each_entry(shost, &sht->legacy_hosts, sht_legacy_list)
 +scsi_remove_host(shost);
 +list_for_each_entry_safe(shost, s, &sht->legacy_hosts, sht_legacy_list)
 +sht->release(shost);
 +
 +if (list_empty(&sht->legacy_hosts))
 +return;
 +
 +printk(KERN_WARNING "%s did not call scsi_unregister\n", sht->name);
 +dump_stack();
 +
 +list_for_each_entry_safe(shost, s, &sht->legacy_hosts, sht_legacy_list)
 +scsi_unregister(shost);
 +}
 +
 +module_init(init_this_scsi_driver);
 +module_exit(exit_this_scsi_driver);
 +
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum