Eric Blake wrote:
On 07/31/2013 11:27 PM, Roman Bogorodskiy wrote:
> Build without cgroups support started to fail again recently. Do the
> following to fix it:
>
> - Add missing 'partition' arg that was added to the
> virCgroupValidateMachineGroup() but forgotten for the stub
> of the same function
> - Add stubs for virCgroupMakeGroup() and virCgroupNew()
> ---
> src/util/vircgroup.c | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
Fails 'make syntax-check':
flags_usage
src/util/vircgroup.c:1001: unsigned int
flags ATTRIBUTE_UNUSED)
maint.mk: flags should be checked with virCheckFlags
Don't know whether it makes more sense to add virCheckFlags(0, -1) or
rename the parameter.
> +#else
> +static int virCgroupMakeGroup(virCgroupPtr parent ATTRIBUTE_UNUSED,
> + virCgroupPtr group ATTRIBUTE_UNUSED,
> + bool create ATTRIBUTE_UNUSED,
> + unsigned int flags ATTRIBUTE_UNUSED)
> +{
> + return -1;
Returning failure without setting an error message is awkward.
On 07/31/2013 11:34 PM, Roman Bogorodskiy wrote:
> One more comment on that. It's probably the time to think how to
> refactor this code, because it's becoming very hard to navigate through
> preprocessor macros' mess...
Indeed; part of the confusion is figuring out which static functions are
compiled under which conditions. And since cgroups are really a
Linux-only concept, maybe it's easier to just have one giant #if/else
switch up front, rather than different conditionals for all the
intermediate functions:
#if defined(__linux__) && HAVE_MNTENT_H && defined(HAVE_GETMNTENT_R) \
&& defined(_DIRENT_HAVE_D_TYPE) && defined(major) &&
defined(minor)
real implementation of everything
#else
placeholder implementation of all functions in the header
#endif
Looking forward to v2.
Hi,
I've just published a patch with macros refactoring. As it's a different
thing I decided to go with a new patch instead of 'v2'.
Roman Bogorodskiy