Skip to content

Commit c1ed666

Browse files
authored
Delete FILE_FLAG_NO_BUFFERING from win32 PAL (#129063)
Unused and non-portable: #124911 (comment).
1 parent 35096b5 commit c1ed666

6 files changed

Lines changed: 8 additions & 51 deletions

File tree

src/coreclr/pal/inc/pal.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,6 @@ typedef struct _SECURITY_ATTRIBUTES {
416416
#define FILE_ATTRIBUTE_NORMAL 0x00000080
417417

418418
#define FILE_FLAG_WRITE_THROUGH 0x80000000
419-
#define FILE_FLAG_NO_BUFFERING 0x20000000
420419
#define FILE_FLAG_RANDOM_ACCESS 0x10000000
421420
#define FILE_FLAG_SEQUENTIAL_SCAN 0x08000000
422421
#define FILE_FLAG_BACKUP_SEMANTICS 0x02000000

src/coreclr/pal/src/config.h.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
#cmakedefine01 HAVE_SIGALTSTACK
4949
#cmakedefine01 HAVE_VM_ALLOCATE
5050
#cmakedefine01 HAVE_VM_READ
51-
#cmakedefine01 HAVE_DIRECTIO
5251
#cmakedefine01 HAVE_SEMAPHORE_H
5352
#cmakedefine01 HAS_SYSV_SEMAPHORES
5453
#cmakedefine01 HAS_PTHREAD_MUTEXES

src/coreclr/pal/src/configure.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ int main(int argc, char **argv) {
136136
}" HAVE_SIGALTSTACK)
137137
check_function_exists(vm_allocate HAVE_VM_ALLOCATE)
138138
check_function_exists(vm_read HAVE_VM_READ)
139-
check_function_exists(directio HAVE_DIRECTIO)
140139
check_function_exists(semget HAS_SYSV_SEMAPHORES)
141140
check_function_exists(pthread_mutex_init HAS_PTHREAD_MUTEXES)
142141
check_function_exists(ttrace HAVE_TTRACE)

src/coreclr/pal/src/file/file.cpp

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ typedef enum
149149
#define PAL_LEGAL_FLAGS_ATTRIBS (FILE_ATTRIBUTE_NORMAL| \
150150
FILE_FLAG_SEQUENTIAL_SCAN| \
151151
FILE_FLAG_WRITE_THROUGH| \
152-
FILE_FLAG_NO_BUFFERING| \
153152
FILE_FLAG_RANDOM_ACCESS| \
154153
FILE_FLAG_BACKUP_SEMANTICS)
155154

@@ -576,18 +575,6 @@ CorUnix::InternalCreateFile(
576575
goto done;
577576
}
578577

579-
if ( dwFlagsAndAttributes & FILE_FLAG_NO_BUFFERING )
580-
{
581-
TRACE("I/O will be unbuffered\n");
582-
#ifdef O_DIRECT
583-
open_flags |= O_DIRECT;
584-
#endif
585-
}
586-
else
587-
{
588-
TRACE("I/O will be buffered\n");
589-
}
590-
591578
filed = InternalOpen(lpUnixPath, open_flags, create_flags);
592579
TRACE("Allocated file descriptor [%d]\n", filed);
593580

@@ -606,31 +593,6 @@ CorUnix::InternalCreateFile(
606593
dwCreationDisposition == OPEN_ALWAYS) &&
607594
!fFileExists;
608595

609-
#ifndef O_DIRECT
610-
if ( dwFlagsAndAttributes & FILE_FLAG_NO_BUFFERING )
611-
{
612-
#ifdef F_NOCACHE
613-
if (-1 == fcntl(filed, F_NOCACHE, 1))
614-
{
615-
ASSERT("Can't set F_NOCACHE; fcntl() failed. errno is %d (%s)\n",
616-
errno, strerror(errno));
617-
palError = ERROR_INTERNAL_ERROR;
618-
goto done;
619-
}
620-
#elif HAVE_DIRECTIO
621-
if (-1 == directio(filed, DIRECTIO_ON))
622-
{
623-
ASSERT("Can't set DIRECTIO_ON; directio() failed. errno is %d (%s)\n",
624-
errno, strerror(errno));
625-
palError = ERROR_INTERNAL_ERROR;
626-
goto done;
627-
}
628-
#else
629-
#error Insufficient support for uncached I/O on this platform
630-
#endif
631-
}
632-
#endif
633-
634596
/* make file descriptor close-on-exec; inheritable handles will get
635597
"uncloseonexeced" in CreateProcess if they are actually being inherited*/
636598
if(-1 == fcntl(filed,F_SETFD, FD_CLOEXEC))

src/coreclr/pal/tests/palsuite/file_io/CreateFileA/test1/CreateFileA.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ BOOL Cleanup_CreateFileA_test1(void)
1919
BOOL bRet = TRUE; // assume success
2020

2121
// loop through all accesses, modes, dispositions and flags
22-
for (i=0; i<4*8*4*5; ++i) {
22+
for (i=0; i<4*8*4*4; ++i) {
2323
sprintf_s(FileName, ARRAY_SIZE(FileName), "test%03d.txt", i);
2424
if (DeleteFileA(FileName) == FALSE) {
2525
if (GetLastError() != ERROR_FILE_NOT_FOUND) {
@@ -57,11 +57,10 @@ PALTEST(file_io_CreateFileA_test1_paltest_createfilea_test1, "file_io/CreateFile
5757
CREATE_ALWAYS, // 1
5858
OPEN_EXISTING, // 2
5959
OPEN_ALWAYS}; // 3
60-
DWORD dwFlagsAttrib[5] = {FILE_ATTRIBUTE_NORMAL, // 0
60+
DWORD dwFlagsAttrib[4] = {FILE_ATTRIBUTE_NORMAL, // 0
6161
FILE_FLAG_SEQUENTIAL_SCAN, // 1
6262
FILE_FLAG_WRITE_THROUGH, // 2
63-
FILE_FLAG_NO_BUFFERING, // 3
64-
FILE_FLAG_RANDOM_ACCESS}; // 4
63+
FILE_FLAG_RANDOM_ACCESS}; // 3
6564
HANDLE hTemplate = NULL;
6665

6766

@@ -95,7 +94,7 @@ PALTEST(file_io_CreateFileA_test1_paltest_createfilea_test1, "file_io/CreateFile
9594
for (k = 0; k < 4; k++)
9695
{
9796
// creation disp loop
98-
for (l = 0; l < 5; l++)
97+
for (l = 0; l < 4; l++)
9998
{
10099
sprintf_s(lpFileName, ARRAY_SIZE(lpFileName), "test%03d.txt", nCounter);
101100
hFile = CreateFile(lpFileName,

src/coreclr/pal/tests/palsuite/file_io/CreateFileW/test1/CreateFileW.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ BOOL Cleanup_CreateFileW_test1(void)
1919
BOOL bRet = TRUE; // assume success
2020

2121
// loop through all accesses, modes, dispositions and flags
22-
for (i=0; i<4*8*4*5; ++i) {
22+
for (i=0; i<4*8*4*4; ++i) {
2323
sprintf_s(FileName, ARRAY_SIZE(FileName), "test%03d.txt", i);
2424
if (DeleteFileA(FileName) == FALSE) {
2525
if (GetLastError() != ERROR_FILE_NOT_FOUND) {
@@ -59,11 +59,10 @@ PALTEST(file_io_CreateFileW_test1_paltest_createfilew_test1, "file_io/CreateFile
5959
CREATE_ALWAYS, // 1
6060
OPEN_EXISTING, // 2
6161
OPEN_ALWAYS}; // 3
62-
DWORD dwFlagsAttrib[5] = {FILE_ATTRIBUTE_NORMAL, // 0
62+
DWORD dwFlagsAttrib[4] = {FILE_ATTRIBUTE_NORMAL, // 0
6363
FILE_FLAG_SEQUENTIAL_SCAN, // 1
6464
FILE_FLAG_WRITE_THROUGH, // 2
65-
FILE_FLAG_NO_BUFFERING, // 3
66-
FILE_FLAG_RANDOM_ACCESS}; // 4
65+
FILE_FLAG_RANDOM_ACCESS}; // 3
6766
HANDLE hTemplate = NULL;
6867

6968

@@ -96,7 +95,7 @@ PALTEST(file_io_CreateFileW_test1_paltest_createfilew_test1, "file_io/CreateFile
9695
for (k = 0; k < 4; k++)
9796
{
9897
// creation disp loop
99-
for (l = 0; l < 5; l++)
98+
for (l = 0; l < 4; l++)
10099
{
101100
sprintf_s(string, ARRAY_SIZE(string), "test%03d.txt", nCounter);
102101
lpFileName = convert(string);

0 commit comments

Comments
 (0)