mirror of
https://github.com/martijnvanbrummelen/nwipe.git
synced 2026-02-20 13:42:14 +00:00
Added logging for O_DIRECT if devices supports direct i/o
This commit is contained in:
10
src/nwipe.c
10
src/nwipe.c
@@ -493,15 +493,17 @@ int main( int argc, char** argv )
|
||||
c2[i]->device_fd = open( c2[i]->device_name, open_flags );
|
||||
|
||||
#ifdef NWIPE_USE_DIRECT_IO
|
||||
/* If O_DIRECT is not supported (or rejected by the FS), fall back to buffered I/O. */
|
||||
if( c2[i]->device_fd < 0 && ( errno == EINVAL || errno == EOPNOTSUPP ) )
|
||||
{
|
||||
nwipe_log( NWIPE_LOG_WARNING,
|
||||
"O_DIRECT not supported on '%s', retrying without O_DIRECT.",
|
||||
c2[i]->device_name );
|
||||
nwipe_log( NWIPE_LOG_WARNING, "O_DIRECT not supported on '%s', retrying without.", c2[i]->device_name );
|
||||
|
||||
open_flags &= ~O_DIRECT;
|
||||
c2[i]->device_fd = open( c2[i]->device_name, open_flags );
|
||||
}
|
||||
else if( c2[i]->device_fd >= 0 && ( open_flags & O_DIRECT ) )
|
||||
{
|
||||
nwipe_log( NWIPE_LOG_NOTICE, "Using O_DIRECT on device '%s'.", c2[i]->device_name );
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Check the open() result. */
|
||||
|
||||
Reference in New Issue
Block a user