Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
* parse_and_open without closing the fd
@ 2017-11-20 20:04 Thomas Tai
  2017-11-20 20:13 ` Keith Busch
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Tai @ 2017-11-20 20:04 UTC (permalink / raw)


Hi there,
I am trying to add a new command in nvme-cli and use flush() in nvme.c 
as an example. The flush command use parse_and_open() to open the fd, 
but it never close the fd. I am wondering where about the fd is being 
closed.

Thank you very much.
Thomas

^ permalink raw reply	[flat|nested] 4+ messages in thread

* parse_and_open without closing the fd
  2017-11-20 20:13 ` Keith Busch
@ 2017-11-20 20:11   ` Thomas Tai
  2017-11-20 20:21     ` Keith Busch
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Tai @ 2017-11-20 20:11 UTC (permalink / raw)




On 2017-11-20 03:13 PM, Keith Busch wrote:
> On Mon, Nov 20, 2017@03:04:36PM -0500, Thomas Tai wrote:
>> I am trying to add a new command in nvme-cli and use flush() in nvme.c as an
>> example. The flush command use parse_and_open() to open the fd, but it never
>> close the fd. I am wondering where about the fd is being closed.
> 
> It's implicitly closed on exit. This is a short-lived one-shot program,
> so there is some laziness with accounting for all resources that are
> automatically reclaimed. That said, it's still nice to clean this up as
> we find such examples.
> 

I see. Thanks Keith for your quick response.

-Thomas

^ permalink raw reply	[flat|nested] 4+ messages in thread

* parse_and_open without closing the fd
  2017-11-20 20:04 parse_and_open without closing the fd Thomas Tai
@ 2017-11-20 20:13 ` Keith Busch
  2017-11-20 20:11   ` Thomas Tai
  0 siblings, 1 reply; 4+ messages in thread
From: Keith Busch @ 2017-11-20 20:13 UTC (permalink / raw)


On Mon, Nov 20, 2017@03:04:36PM -0500, Thomas Tai wrote:
> I am trying to add a new command in nvme-cli and use flush() in nvme.c as an
> example. The flush command use parse_and_open() to open the fd, but it never
> close the fd. I am wondering where about the fd is being closed.

It's implicitly closed on exit. This is a short-lived one-shot program,
so there is some laziness with accounting for all resources that are
automatically reclaimed. That said, it's still nice to clean this up as
we find such examples.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* parse_and_open without closing the fd
  2017-11-20 20:11   ` Thomas Tai
@ 2017-11-20 20:21     ` Keith Busch
  0 siblings, 0 replies; 4+ messages in thread
From: Keith Busch @ 2017-11-20 20:21 UTC (permalink / raw)


On Mon, Nov 20, 2017@03:11:28PM -0500, Thomas Tai wrote:
> > It's implicitly closed on exit. This is a short-lived one-shot program,
> > so there is some laziness with accounting for all resources that are
> > automatically reclaimed. That said, it's still nice to clean this up as
> > we find such examples.
> > 
> 
> I see. Thanks Keith for your quick response.

Fixed now. :)

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-11-20 20:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-20 20:04 parse_and_open without closing the fd Thomas Tai
2017-11-20 20:13 ` Keith Busch
2017-11-20 20:11   ` Thomas Tai
2017-11-20 20:21     ` Keith Busch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox