[sheepdog] [PATCH V4 2/2] collie: optimize 'collie vdi check' command

Yunkai Zhang yunkai.me at gmail.com
Mon Sep 3 12:38:41 CEST 2012


On Mon, Sep 3, 2012 at 6:23 PM, Liu Yuan <namei.unix at gmail.com> wrote:
> On 09/02/2012 08:59 PM, Yunkai Zhang wrote:
>> --- a/sheep/farm/sha1_file.c
>> +++ b/sheep/farm/sha1_file.c
>> @@ -257,18 +257,3 @@ int get_sha1_hex(const char *hex, unsigned char *sha1)
>>       }
>>       return 0;
>>  }
>> -
>> -char *sha1_to_hex(const unsigned char *sha1)
>> -{
>> -     static char buffer[50];
>> -     static const char hex[] = "0123456789abcdef";
>> -     char *buf = buffer;
>> -     int i;
>> -
>> -     for (i = 0; i < SHA1_LEN; i++) {
>> -             unsigned int val = *sha1++;
>> -             *buf++ = hex[val >> 4];
>> -             *buf++ = hex[val & 0xf];
>> -     }
>> -     return buffer;
>> -}
>
> I'd like to keep it in sha1_file.c. Why you need to put it lib/sha1.c?

collie/vdi.c need to use this function, if we put it in
../farm/sha1_file.c, we should modify collie/Makefie.am to include
farm/sha1_file.c, it seems werid.

>
> Thanks,
> Yuan



-- 
Yunkai Zhang
Work at Taobao



More information about the sheepdog mailing list