Re: Confused about SnapMapper::get_prefix

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

 



Should probably be cast to long unsigned with lX conversion specifier?
-Sam

On Tue, Feb 3, 2015 at 9:21 AM, Samuel Just <sam.just@xxxxxxxxxxx> wrote:
> It looks like snapid_t is a uint64_t, but snprintf expects an unsigned there.
> -Sam
>
> On Tue, Feb 3, 2015 at 9:15 AM, Gregory Farnum <greg@xxxxxxxxxxx> wrote:
>> On Tue, Feb 3, 2015 at 4:12 AM, Ding Dinghua <dingdinghua85@xxxxxxxxx> wrote:
>>> Hi all:
>>>       I don't understand why SnapMapper::get_prefix   static_cast snap
>>> to unsigned:
>>>
>>> string SnapMapper::get_prefix(snapid_t snap)
>>> {
>>>   char buf[100];
>>>   int len = snprintf(
>>>     buf, sizeof(buf),
>>>     "%.*X_", (int)(sizeof(snap)*2),
>>>     static_cast<unsigned>(snap));
>>>   return MAPPING_PREFIX + string(buf, len);
>>> }
>>>
>>> Will this limit snapshot count in pool to 2^32 -1 ?
>>>
>>> Could anyone clarify ? Thanks
>>
>> I think the code base is a little confused about whether snaps should
>> be 32 or 64 bits in various places. :( That said, the size of unsigned
>> can vary across architectures, so this should probably be sized more
>> explicitly as whatever it's supposed to be on the disk...
--
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