pkg.re/essentialkaos/ek.v11@v12.41.0+incompatible/directio/directio_linux.go (about)

     1  package directio
     2  
     3  // ////////////////////////////////////////////////////////////////////////////////// //
     4  //                                                                                    //
     5  //                         Copyright (c) 2022 ESSENTIAL KAOS                          //
     6  //      Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0>     //
     7  //                                                                                    //
     8  // ////////////////////////////////////////////////////////////////////////////////// //
     9  
    10  import (
    11  	"os"
    12  	"syscall"
    13  )
    14  
    15  // ////////////////////////////////////////////////////////////////////////////////// //
    16  
    17  const (
    18  	BLOCK_SIZE = 4096 // Minimal block size
    19  	ALIGN_SIZE = 4096 // Align size
    20  )
    21  
    22  // ////////////////////////////////////////////////////////////////////////////////// //
    23  
    24  func openFile(file string, flag int, perm os.FileMode) (*os.File, error) {
    25  	return os.OpenFile(file, syscall.O_DIRECT|flag, perm)
    26  }