lkml.org 
[lkml]   [1996]   [Nov]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    SubjectRe: 2.1.10 FYI

    On Fri, 15 Nov 1996, Erik B. Andersen wrote:

    > >From the latest version of Documentation/cdrom/cdrom-standard.tex:
    >
    > ... These parameters are declared $const$ because they describe properties
    > of the drive, which don't change after registration. ... The
    > capability flag is declared $const$, to prevent drivers from
    > accidentally tampering with the contents.
    >
    > The patch you submitted for ucdrom.h is the WrongThing(tm). These values
    > must be set during drive registration, but they should be declared const so
    > that nothing can change them subsequently (thereby screwing up the kernel).
    > [ ... ]
    > The ide-cd driver simply adds a cast to suppress the compiler warning.
    > This allows you to set the const values on drive initialization without
    > warnings. Just don't do this somewhere else in your code... This is the
    > RightThing(tm) to do, IMHO. Do something like this to sr.c:
    >
    > ---> *(int *)&devinfo->speed = 0;
    > ---> *(int *)&devinfo->capacity = nslots;

    Hmm, does'nt sound perfect either. But maybe the best way we have to
    handle these "write-once" variables. Here comes the patch for sr.c.

    Gerd

    ---------------------------------------------------------------------
    --- linux/drivers/scsi/sr.c-2.1.10 Sat Nov 16 09:17:18 1996
    +++ linux/drivers/scsi/sr.c Sat Nov 16 09:22:38 1996
    @@ -793,8 +793,8 @@
    scsi_CDs[i].cdi.handle = &scsi_CDs[i];
    scsi_CDs[i].cdi.dev = MKDEV(MAJOR_NR,i);
    scsi_CDs[i].cdi.mask = 0;
    - scsi_CDs[i].cdi.speed = 1;
    - scsi_CDs[i].cdi.capacity = 1;
    + (int)scsi_CDs[i].cdi.speed = 1;
    + (int)scsi_CDs[i].cdi.capacity = 1;
    register_cdrom(&scsi_CDs[i].cdi, "sr");

    #ifdef CONFIG_BLK_DEV_SR_VENDOR

    \
     
     \ /
      Last update: 2005-03-22 13:38    [W:0.019 / U:0.628 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site