Whamcloud - gitweb
libext2fs: don't use O_DIRECT for files on tmpfs
[tools/e2fsprogs.git] / lib / ext2fs / nt_io.c
index 93b94f1..234f6b1 100644 (file)
@@ -7,8 +7,8 @@
  * Copyright (C) 1998 Andrey Shedel (andreys@ns.cr.cyco.com)
  *
  * %Begin-Header%
- * This file may be redistributed under the terms of the GNU Public
- * License.
+ * This file may be redistributed under the terms of the GNU Library
+ * General Public License, version 2.
  * %End-Header%
  */
 
@@ -178,7 +178,7 @@ NtDelayExecution(
 #include <malloc.h>
 
 #include <linux/types.h>
-#include <linux/ext2_fs.h>
+#include "ext2_fs.h"
 #include <errno.h>
 
 #include "et/com_err.h"
@@ -230,18 +230,16 @@ static errcode_t nt_write_blk(io_channel channel, unsigned long block,
 static errcode_t nt_flush(io_channel channel);
 
 static struct struct_io_manager struct_nt_manager = {
-       EXT2_ET_MAGIC_IO_MANAGER,
-       "NT I/O Manager",
-       nt_open,
-       nt_close,
-       nt_set_blksize,
-       nt_read_blk,
-       nt_write_blk,
-       nt_flush
+       .magic          = EXT2_ET_MAGIC_IO_MANAGER,
+       .name           = "NT I/O Manager",
+       .open           = nt_open,
+       .close          = nt_close,
+       .set_blksize    = nt_set_blksize,
+       .read_blk       = nt_read_blk,
+       .write_blk      = nt_write_blk,
+       .flush          = nt_flush
 };
 
-
-
 //
 // function to get API
 //
@@ -380,7 +378,7 @@ _MapNtStatus(
 
 
 //
-// Helper functions to make things easyer
+// Helper functions to make things easier
 //
 
 static
@@ -400,7 +398,7 @@ _OpenNtName(
        IO_STATUS_BLOCK IoStatusBlock;
 
        //
-       // Make Unicode name from inlut string
+       // Make Unicode name from input string
        //
 
        UnicodeString.Buffer = &Buffer[0];
@@ -413,7 +411,7 @@ _OpenNtName(
 
        if(!NT_SUCCESS(Status))
        {
-               return Status; // Unpappable character?
+               return Status; // Unmappable character?
        }
 
        //
@@ -675,7 +673,7 @@ _NormalizeDeviceName(
        else if('f' == *Device)
        {
                //
-               // 3-d letted should be a digit.
+               // 3-d letter should be a digit.
                //
 
                if((*(Device + 3) != '\0') ||
@@ -1191,11 +1189,7 @@ nt_open(const char *name, int flags, io_channel *channel)
 
                        if (NULL != io)
                        {
-                               if(NULL != io->name)
-                               {
-                                       free(io->name);
-                               }
-
+                               free(io->name);
                                free(io);
                        }
 
@@ -1207,11 +1201,7 @@ nt_open(const char *name, int flags, io_channel *channel)
                                        _CloseDisk(NtData->Handle);
                                }
 
-                               if(NULL != NtData->Buffer)
-                               {
-                                       free(NtData->Buffer);
-                               }
-
+                               free(NtData->Buffer);
                                free(NtData);
                        }
                }
@@ -1245,12 +1235,7 @@ nt_close(io_channel channel)
                return 0;
        }
 
-       if(NULL != channel->name)
-       {
-               free(channel->name);
-       }
-
-
+       free(channel->name);
        free(channel);
 
        if (NULL != NtData)
@@ -1262,11 +1247,7 @@ nt_close(io_channel channel)
                        _CloseDisk(NtData->Handle);
                }
 
-               if(NULL != NtData->Buffer)
-               {
-                       free(NtData->Buffer);
-               }
-
+               free(NtData->Buffer);
                free(NtData);
        }