Commit 639e07be authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Abstract the support for comparing file identities.

parent 4e772228
...@@ -139,11 +139,13 @@ static inline int getdents64( int fd, char *de, unsigned int size ) ...@@ -139,11 +139,13 @@ static inline int getdents64( int fd, char *de, unsigned int size )
#define MAX_IGNORED_FILES 4 #define MAX_IGNORED_FILES 4
static struct struct file_identity
{ {
dev_t dev; dev_t dev;
ino_t ino; ino_t ino;
} ignored_files[MAX_IGNORED_FILES]; };
static struct file_identity ignored_files[MAX_IGNORED_FILES];
static int ignored_files_count; static int ignored_files_count;
static const unsigned int max_dir_info_size = FIELD_OFFSET( FILE_BOTH_DIR_INFORMATION, FileName[MAX_DIR_ENTRY_LEN] ); 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 ) ...@@ -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 ) static inline BOOL is_ignored_file( const struct stat *st )
{ {
unsigned int i; unsigned int i;
for (i = 0; i < ignored_files_count; i++) for (i = 0; i < ignored_files_count; i++)
if (ignored_files[i].dev == st->st_dev && ignored_files[i].ino == st->st_ino) if (is_same_file( &ignored_files[i], st )) return TRUE;
return TRUE;
return FALSE; return FALSE;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment