[sheepdog] [disscuss] Design of Libsheepdog

Liu Yuan namei.unix at gmail.com
Mon Jul 1 04:05:35 CEST 2013


On 07/01/2013 09:58 AM, Kai Zhang wrote:
>
> On Jul 1, 2013, at 7:29 AM, MORITA Kazutaka <morita.kazutaka at gmail.com
> <mailto:morita.kazutaka at gmail.com>> wrote:
>
>> At Sun, 30 Jun 2013 17:29:28 +0800,
>> Kai Zhang wrote:
>>>
>>> On Jun 27, 2013, at 11:34 AM, MORITA Kazutaka
>>> <morita.kazutaka at lab.ntt.co.jp
>>> <mailto:morita.kazutaka at lab.ntt.co.jp>> wrote:
>>>
>>>>>
>>>>> /* connection */
>>>>> int sd_init(char *addr, const sd_t *sd);
>>>>
>>>> I think the syntax of addr needs discussion:
>>>> - How to specify a port number?
>>>> - How to connect to a unix domain socket?
>>>>
>>>>
>>>
>>> I think we can use a unified form: "ip:port".
>>>
>>> If the ip is local, sd_init() will try to use unix domain socket.
>>
>> Do you mean "localhost:<unix domain socket path>"?
>
> Well, what I meant is that user don't need to care about unix domain socket.
> They always use string "x.x.x.x:nnnn" as the argument.
> However, libsheepdog can detect whether x.x.x.x is a local ip.
> It it is, I think we can predicate a unix domain socket path based on
> the ip and port number.
> For example, we can have a rule that if a sheep is listening on
> 127.0.0.1:1234,
> it's unix domain socket path should be something like
> /tmp/sheepdog/127_0_0_1-1234.sock
>

char * string can't both mean 'ip:port' and unix socket path? I think it 
is very easy to detect whether it is IP format or unix socket path by 
strchr(3) ":". just don't allow ":" for path. Or we can prefix the 
string, like tcp://ip:port, unix://path.

Thanks,
Yuan




More information about the sheepdog mailing list