From 639e07bead189626dc2b1e02fb30cd74d39c01bd Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Thu, 22 Oct 2009 19:59:04 +0200 Subject: [PATCH] ntdll: Abstract the support for comparing file identities. --- dlls/ntdll/directory.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/dlls/ntdll/directory.c b/dlls/ntdll/directory.c index ce9e81dfa13..2e0aba01d4d 100644 --- a/dlls/ntdll/directory.c +++ b/dlls/ntdll/directory.c @@ -139,11 +139,13 @@ static inline int getdents64( int fd, char *de, unsigned int size ) #define MAX_IGNORED_FILES 4 -static struct +struct file_identity { dev_t dev; ino_t ino; -} ignored_files[MAX_IGNORED_FILES]; +}; + +static struct file_identity ignored_files[MAX_IGNORED_FILES]; static int ignored_files_count; static const unsigned int max_dir_info_size = FIELD_OFFSET( FILE_BOTH_DIR_INFORMATION, FileName[MAX_DIR_ENTRY_LEN] ); @@ -197,13 +199,17 @@ static inline void ignore_file( const char *name ) } } +static inline BOOL is_same_file( const struct file_identity *file, const struct stat *st ) +{ + return st->st_dev == file->dev && st->st_ino == file->ino; +} + static inline BOOL is_ignored_file( const struct stat *st ) { unsigned int i; for (i = 0; i < ignored_files_count; i++) - if (ignored_files[i].dev == st->st_dev && ignored_files[i].ino == st->st_ino) - return TRUE; + if (is_same_file( &ignored_files[i], st )) return TRUE; return FALSE; } -- 2.11.4.GIT