Re: [PATCH 2/2] rbd: add an option for md5 checksumming (v3)

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

 



2011/8/26 Yehuda Sadeh Weinraub <yehudasa@xxxxxxxxx>:
> On Fri, Aug 26, 2011 at 11:51 AM, Christian Brunner <chb@xxxxxx> wrote:
>> +static int hash_read_cb(uint64_t ofs, size_t len, const char *buf, void *arg)
>> +{
>> +  ceph::crypto::Digest *Hash = (ceph::crypto::Digest *)arg;
>> +  byte *hashbuf = (byte *) buf;
>
> Looking at it again, hashbuf is pretty much useless, you can use buf directly.
>
>> +  byte *tempbuf = NULL;
>> +
>> +  if (!buf) {
>> +    len = ofs-lastofs;
>
> Why setting len here? len was already passed in.

Ah - then I didn't understand what read_iterate is doing. I was
thinking, that the callback is not called for missing objects.

>
>> +    tempbuf = (byte *) malloc(len);

Do we need a memset here?

>> +    if (!tempbuf)
>> +      return -ENOMEM;
>> +    hashbuf = tempbuf;
>
> buf = tempbuf;
>
>> +  }
>> +  Hash->Update((const byte *) hashbuf, len);
>> +
>> +  lastofs = ofs + len;
>
> you don't need lastofs either.
>
>> +
>> +  free(tempbuf);
>> +
>> +  return 0;
>> +}
>> +

Christian
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux