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

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

 



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.

> +    tempbuf = (byte *) malloc(len);
> +    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;
> +}
> +
--
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