[libvirt] [PATCH] cgroup: Fix compilation broken on MinGW due to dirent->d_type

As pointed out by Eric Blake, using dirent->d_type breaks compilation on MinGW. This patch addresses this by using '#if defined' as same as doing for virCgroupForDriver. --- src/util/cgroup.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/src/util/cgroup.c b/src/util/cgroup.c index 9fa64dc..024036a 100644 --- a/src/util/cgroup.c +++ b/src/util/cgroup.c @@ -608,6 +608,7 @@ cleanup: } #endif +#if defined _DIRENT_HAVE_D_TYPE static int virCgroupRemoveRecursively(char *grppath) { DIR *grpdir; @@ -656,6 +657,13 @@ static int virCgroupRemoveRecursively(char *grppath) return rc; } +#else +static int virCgroupRemoveRecursively(char *grppath ATTRIBUTE_UNUSED) +{ + /* Claim no support */ + return -ENXIO; +} +#endif /** * virCgroupRemove: -- 1.6.5.2

On Wed, Jun 30, 2010 at 8:49 PM, Ryota Ozaki <ozaki.ryota@gmail.com> wrote:
As pointed out by Eric Blake, using dirent->d_type breaks compilation on MinGW. This patch addresses this by using '#if defined' as same as doing for virCgroupForDriver.
Note that I didn't test this patch because I don't have Windows/MinGW environment and fails to cross-compile on Linux for some reason. So please test before applying the patch. Thanks ozaki-r
--- src/util/cgroup.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/src/util/cgroup.c b/src/util/cgroup.c index 9fa64dc..024036a 100644 --- a/src/util/cgroup.c +++ b/src/util/cgroup.c @@ -608,6 +608,7 @@ cleanup: } #endif
+#if defined _DIRENT_HAVE_D_TYPE static int virCgroupRemoveRecursively(char *grppath) { DIR *grpdir; @@ -656,6 +657,13 @@ static int virCgroupRemoveRecursively(char *grppath)
return rc; } +#else +static int virCgroupRemoveRecursively(char *grppath ATTRIBUTE_UNUSED) +{ + /* Claim no support */ + return -ENXIO; +} +#endif
/** * virCgroupRemove: -- 1.6.5.2

On 06/30/2010 05:49 AM, Ryota Ozaki wrote:
As pointed out by Eric Blake, using dirent->d_type breaks compilation on MinGW. This patch addresses this by using '#if defined' as same as doing for virCgroupForDriver. --- src/util/cgroup.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
ACK, and tested on a cross compile to mingw. Pushed. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

On Wed, Jun 30, 2010 at 11:34 PM, Eric Blake <eblake@redhat.com> wrote:
On 06/30/2010 05:49 AM, Ryota Ozaki wrote:
As pointed out by Eric Blake, using dirent->d_type breaks compilation on MinGW. This patch addresses this by using '#if defined' as same as doing for virCgroupForDriver. --- src/util/cgroup.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
ACK, and tested on a cross compile to mingw. Pushed.
Thanks a lot! ozaki-r
-- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org
participants (2)
-
Eric Blake
-
Ryota Ozaki