Re: [sheepdog] [PATCH 2/3] util:add a new API atomic_create_and_write()

2013-04-16 Thread Liu Yuan
On 04/17/2013 02:28 PM, Hitoshi Mitake wrote: > BTW, def_fmode is currently declared in sheep/store.c. Is it allowed > to move the variable to util.c? Sure, go ahead, maybe better prefixed as "sd_def_fmode". Thanks, Yuan -- sheepdog mailing list sheepdog@lists.wpkg.org http://lists.wpkg.org/mail

Re: [sheepdog] [PATCH 2/3] util:add a new API atomic_create_and_write()

2013-04-16 Thread Hitoshi Mitake
At Wed, 17 Apr 2013 14:10:01 +0800, Liu Yuan wrote: > > On 04/17/2013 01:45 PM, Hitoshi Mitake wrote: > > + fd = open(tmp_path, O_WRONLY | O_CREAT | O_SYNC, > > + S_IWUSR | S_IRUSR | S_IWGRP | S_IRGRP); > > use def_fmode. BTW, def_fmode is currently declared in sheep/store.c. Is it a

Re: [sheepdog] [PATCH 2/3] util:add a new API atomic_create_and_write()

2013-04-16 Thread Hitoshi Mitake
At Wed, 17 Apr 2013 14:08:24 +0800, Liu Yuan wrote: > > On 04/17/2013 02:00 PM, Hitoshi Mitake wrote: > > At Wed, 17 Apr 2013 13:55:09 +0800, > > Liu Yuan wrote: > >> > >> On 04/17/2013 01:45 PM, Hitoshi Mitake wrote: > >>> + if (!access(tmp_path, F_OK)) > >>> + panic("temporal file: %s ex

Re: [sheepdog] [PATCH 2/3] util:add a new API atomic_create_and_write()

2013-04-16 Thread Hitoshi Mitake
At Wed, 17 Apr 2013 14:10:01 +0800, Liu Yuan wrote: > > On 04/17/2013 01:45 PM, Hitoshi Mitake wrote: > > + fd = open(tmp_path, O_WRONLY | O_CREAT | O_SYNC, > > + S_IWUSR | S_IRUSR | S_IWGRP | S_IRGRP); > > use def_fmode. Thanks for your pointing. I'll fix it in v2. Hitoshi -- sheep

Re: [sheepdog] [PATCH 2/3] util:add a new API atomic_create_and_write()

2013-04-16 Thread Liu Yuan
On 04/17/2013 01:45 PM, Hitoshi Mitake wrote: > + fd = open(tmp_path, O_WRONLY | O_CREAT | O_SYNC, > + S_IWUSR | S_IRUSR | S_IWGRP | S_IRGRP); use def_fmode. Thanks, Yuan -- sheepdog mailing list sheepdog@lists.wpkg.org http://lists.wpkg.org/mailman/listinfo/sheepdog

Re: [sheepdog] [PATCH 2/3] util:add a new API atomic_create_and_write()

2013-04-16 Thread Liu Yuan
On 04/17/2013 02:00 PM, Hitoshi Mitake wrote: > At Wed, 17 Apr 2013 13:55:09 +0800, > Liu Yuan wrote: >> >> On 04/17/2013 01:45 PM, Hitoshi Mitake wrote: >>> + if (!access(tmp_path, F_OK)) >>> + panic("temporal file: %s exists, this implies invalid usage of" >>> + " at

Re: [sheepdog] [PATCH 2/3] util:add a new API atomic_create_and_write()

2013-04-16 Thread Hitoshi Mitake
At Wed, 17 Apr 2013 13:55:09 +0800, Liu Yuan wrote: > > On 04/17/2013 01:45 PM, Hitoshi Mitake wrote: > > + if (!access(tmp_path, F_OK)) > > + panic("temporal file: %s exists, this implies invalid usage of" > > + " atomic_create_and_write() of sheepdog", tmp_path); >

Re: [sheepdog] [PATCH 2/3] util:add a new API atomic_create_and_write()

2013-04-16 Thread Liu Yuan
On 04/17/2013 01:45 PM, Hitoshi Mitake wrote: > + if (!access(tmp_path, F_OK)) > + panic("temporal file: %s exists, this implies invalid usage of" > + " atomic_create_and_write() of sheepdog", tmp_path); panic() is too stringent and not necessary. open(2) will r

[sheepdog] [PATCH 2/3] util:add a new API atomic_create_and_write()

2013-04-16 Thread Hitoshi Mitake
This patch adds a new API atomic_create_and_write(). As the name implies, the API creates and writes data to a file. atomic_create_and_write() creates a file path.tmp (path is a parameter) internally. During the initialization process of sheep, every user of this API should detect and clean tempor