Re: [libvirt] [PATCH] [3/6] Add hook utilities

2010-03-29 Thread Daniel Veillard
On Fri, Mar 26, 2010 at 10:53:01AM -0600, Eric Blake wrote: On 03/26/2010 09:43 AM, Daniel Veillard wrote: +if (stat(path, sb) 0) { +ret = 0; +VIR_DEBUG(No hook script %s, path); +} else { +if (access(path, X_OK) != 0) { Should we also check for

Re: [libvirt] [PATCH] [3/6] Add hook utilities

2010-03-29 Thread Hugh O. Brock
On Mon, Mar 29, 2010 at 04:47:54PM +0200, Daniel Veillard wrote: On Fri, Mar 26, 2010 at 10:53:01AM -0600, Eric Blake wrote: On 03/26/2010 09:43 AM, Daniel Veillard wrote: +if (stat(path, sb) 0) { +ret = 0; +VIR_DEBUG(No hook script %s, path); +} else { +

[libvirt] [PATCH] [3/6] Add hook utilities

2010-03-26 Thread Daniel Veillard
Add hook utilities This exports 3 basic routines: - virHookInitialize() initializing the hook support by looking for scripts availability - virHookPresent() used to test if there is a hook for a given driver - virHookCall() which actually calls a synchronous script hook with the

Re: [libvirt] [PATCH] [3/6] Add hook utilities

2010-03-26 Thread Eric Blake
On 03/26/2010 09:43 AM, Daniel Veillard wrote: +if (stat(path, sb) 0) { +ret = 0; +VIR_DEBUG(No hook script %s, path); +} else { +if (access(path, X_OK) != 0) { Should we also check for !S_ISDIR(sb.st_mode), so that we explicitly reject directories here,

Re: [libvirt] [PATCH] [3/6] Add hook utilities

2010-03-26 Thread Daniel P. Berrange
On Fri, Mar 26, 2010 at 10:53:01AM -0600, Eric Blake wrote: On 03/26/2010 09:43 AM, Daniel Veillard wrote: + */ +if ((virHooksFound == -1) || +((driver == VIR_HOOK_DRIVER_DAEMON) + (op == VIR_HOOK_DAEMON_OP_RELOAD))) +virHookInitialize(); + ... +

Re: [libvirt] [PATCH] [3/6] Add hook utilities

2010-03-26 Thread Eric Blake
On 03/26/2010 11:09 AM, Daniel P. Berrange wrote: Duplicating the definition of all these helpers is a bit of a long distraction in the middle of this function; is it worth a helper file, where we could #include command_line_builder.h to get all these helpers defined, and to reduce the