Conversation
|
I suppose we could also add and move the log.h header to private |
|
One possible concern I can think of might be a situation where an user supplied filedescriptor's buffer gets full and any writes become blocking. Say if I provide a pipe then running a side mainloop to read the other end might not be always feasible in a library. |
|
Whee. Now we're getting into obscure corner-cases. I guess one could always construct cases where any attempt will fail in one or the other way; eg the same argument could be brought if we would allow for a (user-provided) callback function to print out the messages. |
For some reason we have two versions of hostname2traddr(). Signed-off-by: Hannes Reinecke <hare@suse.de>
Add a 'nvme_root_t' argument to nvme_msg() to allow for error messages to be redirected to a different filedescriptor than 'stderr'. Signed-off-by: Hannes Reinecke <hare@suse.de>
Move the global logging variables into nvme_root_t to make them settable by the application. Signed-off-by: Hannes Reinecke <hare@suse.de>
No functionality anymore. Signed-off-by: Hannes Reinecke <hare@suse.de>
9898673 to
a6a09c1
Compare
Add the new 'root' argument to nvme.ctrl() Signed-off-by: Hannes Reinecke <hare@suse.de>
b86f686 to
2ed8492
Compare
|
I am working on adapting nvme-cli to these changes. One thing I noticed:
|
That's because 'nvme_scan()' takes the json config file as an argument, whereas nvme_scan_filter() is using the filedescriptor to redirect the error messages to. Prime reason here was that I didn't want to modify 'nvme_scan()', as this is the main entry point into libnvme, and modifying that would require a modification of all programs using libnvme. Which I've tried to avoid. But if you're fine with it I can easily add a 'log_level' parameter to nvme_scan() to make things more obvious. |
|
Well, it's just a bit irritating to me that one can set the log level and file descriptor directly and the other needs an extra step.
And my obvious question was, what happens when nvme_scan wants to log something? |
|
This should address it. |
|
Of course, that kills 'nvme_scan_filter()', but I always found the name slightly counter-intuitive, so I'm not that bothered. |
|
Looks good. I think we want to do the |
|
Just one nitpick. Why not |
2f1722c to
241296a
Compare
|
That should do it. |
|
Thanks. If you want to be extra correct the commit message would also need an update :) |
|
Let's get those things sorted out now. I'd like to spin the next release candidate today. |
Split off nvme_scan_filter() into nvme_create_root() and export the remaining functionality as nvme_scan_topology(). With that nvme_scan_filter() becomes pointless as the component functions can be called directly. Signed-off-by: Hannes Reinecke <hare@suse.de>
241296a to
3af35b9
Compare
|
Thanks! I'll update my PRs now. |
This patchset adds an 'nvme_root_t' argument to nvme_msg(), and allows to store a different filedescriptor than 'stderr' to store in nvme_root_t. With that applications can re-route the error messages.