lkml.org 
[lkml]   [2008]   [Jan]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 2/7] udf: create common function for tag checksumming
    > --- a/fs/udf/udfdecl.h
    > +++ b/fs/udf/udfdecl.h
    > @@ -36,6 +36,18 @@
    >
    > #define udf_get_lb_pblock(sb,loc,offset) udf_get_pblock((sb), (loc).logicalBlockNum, (loc).partitionReferenceNum, (offset))
    >
    > +/* computes tag checksum */
    > +static inline uint8_t udf_tag_checksum(const tag *t)
    > +{
    > + uint8_t *data = (uint8_t *)t;
    > + uint8_t checksum = 0;
    > + int i;
    > + for (i = 0; i < sizeof(tag); ++i)
    > + if (i != 4) /* that's the position of checksum */
    > + checksum += data[i];
    > + return checksum;
    > +}

    This function is large enough that it should be out of line in a .c
    file. Also I'd prefer using the Linux native types ala:

    /* computes tag checksum */
    static u8 udf_tag_checksum(const tag *t)
    {
    u8 *data = (u8 *)t;
    u8 checksum = 0;
    int i;

    for (i = 0; i < sizeof(tag); i++) {
    if (i != 4) /* position of the checksum */
    checksum += data[i];
    }

    return checksum;
    }


    \
     
     \ /
      Last update: 2008-01-07 13:33    [W:0.022 / U:31.208 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site