@@ -124,23 +124,24 @@ constexpr inline flags to_flags(std::ios::ios_base::openmode mode) {
124124#if defined(ASIO_HAS_FILE)
125125template <bool seq, typename File, typename Executor>
126126inline bool open_native_async_file (File &file, Executor &executor,
127- std::string_view filepath,
128- flags open_flags, bool use_direct_io = false ) {
127+ std::string_view filepath, flags open_flags,
128+ bool use_direct_io = false ) {
129129 if (file && file->is_open ()) {
130130 return true ;
131131 }
132132
133133 try {
134- asio::file_base::flags asio_flags = static_cast <asio::file_base::flags>(open_flags);
135-
134+ asio::file_base::flags asio_flags =
135+ static_cast <asio::file_base::flags>(open_flags);
136+
136137 if (use_direct_io) {
137138#if defined(ASIO_WINDOWS)
138139#elif defined(__linux__)
139140 asio_flags = static_cast <asio::file_base::flags>(
140141 static_cast <int >(asio_flags) | O_DIRECT);
141142#endif
142143 }
143-
144+
144145 if constexpr (seq) {
145146 file = std::make_shared<asio::stream_file>(
146147 executor.get_asio_executor (), std::string (filepath), asio_flags);
@@ -149,7 +150,7 @@ inline bool open_native_async_file(File &file, Executor &executor,
149150 file = std::make_shared<asio::random_access_file>(
150151 executor.get_asio_executor (), std::string (filepath), asio_flags);
151152 }
152-
153+
153154 // On macOS, use F_NOCACHE as an alternative to O_DIRECT
154155 if (use_direct_io && file && file->is_open ()) {
155156#if defined(__APPLE__) || defined(__MACH__)
@@ -423,8 +424,8 @@ class basic_random_coro_file {
423424 open (filepath, open_flags);
424425 }
425426
426- bool open (std::string_view filepath,
427- std::ios::ios_base::openmode open_flags, bool use_direct_io = false ) {
427+ bool open (std::string_view filepath, std::ios::ios_base::openmode open_flags,
428+ bool use_direct_io = false ) {
428429 file_path_ = std::string{filepath};
429430 if constexpr (execute_type == execution_type::thread_pool) {
430431 return open_fd (filepath, to_flags (open_flags), use_direct_io);
@@ -538,7 +539,8 @@ class basic_random_coro_file {
538539 std::string_view file_path () const { return file_path_; }
539540
540541 private:
541- bool open_fd (std::string_view filepath, int open_flags, bool use_direct_io = false ) {
542+ bool open_fd (std::string_view filepath, int open_flags,
543+ bool use_direct_io = false ) {
542544 if (prw_random_file_) {
543545 return true ;
544546 }
0 commit comments