[PATCH 4/7] Remove unused dirent.h

Kostiantyn Kostiuk posted 7 patches 1 week ago
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Kevin Wolf <kwolf@redhat.com>
There is a newer version of this series
[PATCH 4/7] Remove unused dirent.h
Posted by Kostiantyn Kostiuk 1 week ago
Signed-off-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>
---
 util/drm.c  | 1 -
 util/path.c | 1 -
 2 files changed, 2 deletions(-)

diff --git a/util/drm.c b/util/drm.c
index dae8ffebc8..afa9c400df 100644
--- a/util/drm.c
+++ b/util/drm.c
@@ -18,7 +18,6 @@
 #include "qemu/drm.h"
 
 #include <glob.h>
-#include <dirent.h>
 
 int qemu_drm_rendernode_open(const char *rendernode)
 {
diff --git a/util/path.c b/util/path.c
index 8e174eb436..72a255890e 100644
--- a/util/path.c
+++ b/util/path.c
@@ -5,7 +5,6 @@
 */
 #include "qemu/osdep.h"
 #include <sys/param.h>
-#include <dirent.h>
 #include "qemu/cutils.h"
 #include "qemu/path.h"
 #include "qemu/thread.h"
-- 
2.52.0
Re: [PATCH 4/7] Remove unused dirent.h
Posted by Peter Maydell 1 week ago
On Thu, 26 Mar 2026 at 16:02, Kostiantyn Kostiuk <kkostiuk@redhat.com> wrote:
>
> Signed-off-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>
> ---
>  util/drm.c  | 1 -
>  util/path.c | 1 -
>  2 files changed, 2 deletions(-)
>
> diff --git a/util/drm.c b/util/drm.c
> index dae8ffebc8..afa9c400df 100644
> --- a/util/drm.c
> +++ b/util/drm.c
> @@ -18,7 +18,6 @@
>  #include "qemu/drm.h"
>
>  #include <glob.h>
> -#include <dirent.h>
>
>  int qemu_drm_rendernode_open(const char *rendernode)
>  {

This file uses opendir()/readdir()/closedir(), all of which
are specified to be brought in by <dirent.h>, so we can't
drop this include.

> diff --git a/util/path.c b/util/path.c
> index 8e174eb436..72a255890e 100644
> --- a/util/path.c
> +++ b/util/path.c
> @@ -5,7 +5,6 @@
>  */
>  #include "qemu/osdep.h"
>  #include <sys/param.h>
> -#include <dirent.h>
>  #include "qemu/cutils.h"
>  #include "qemu/path.h"
>  #include "qemu/thread.h"

This one is OK to drop, because the rewrite of path.c in
commit f3a8bdc1d5b26 removed the uses of the dirent.h functions.

thanks
-- PMM
Re: [PATCH 4/7] Remove unused dirent.h
Posted by Paolo Bonzini 6 days, 9 hours ago
On 3/26/26 17:23, Peter Maydell wrote:
>>
>>   #include <glob.h>
>> -#include <dirent.h>
>>
>>   int qemu_drm_rendernode_open(const char *rendernode)
>>   {
>
> This file uses opendir()/readdir()/closedir(), all of which
> are specified to be brought in by <dirent.h>, so we can't
> drop this include.

It's also compiled only if host_os != 'windows', so it doesn't matter 
for the purpose of compiling qemu-ga with MSVC/clang-cl.

Paolo