diff options
author | Oleg Sidorkin <[email protected]> | 2022-02-10 16:49:36 +0300 |
---|---|---|
committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:49:36 +0300 |
commit | 5ce74d4fee2d42a4b86efc02dfdc704d458760e1 (patch) | |
tree | f16a3558ca40d453a1c6a2ed764bd75d64cffade /util/system | |
parent | cd33f9aa8461f8e2b0b9e68efbb6bc9856197dc9 (diff) |
Restoring authorship annotation for Oleg Sidorkin <[email protected]>. Commit 1 of 2.
Diffstat (limited to 'util/system')
-rw-r--r-- | util/system/compat.h | 2 | ||||
-rw-r--r-- | util/system/filemap.cpp | 14 | ||||
-rw-r--r-- | util/system/filemap.h | 10 | ||||
-rw-r--r-- | util/system/filemap_ut.cpp | 70 |
4 files changed, 48 insertions, 48 deletions
diff --git a/util/system/compat.h b/util/system/compat.h index c53dbcca178..e7394d2cfff 100644 --- a/util/system/compat.h +++ b/util/system/compat.h @@ -4,7 +4,7 @@ #include <cstdarg> -#include <csignal> +#include <csignal> #if defined(_unix_) #include <unistd.h> diff --git a/util/system/filemap.cpp b/util/system/filemap.cpp index 7454a4cb948..b64e2d53148 100644 --- a/util/system/filemap.cpp +++ b/util/system/filemap.cpp @@ -214,10 +214,10 @@ public: ; } - inline bool IsWritable() const noexcept { + inline bool IsWritable() const noexcept { return (Mode_ & oRdWr || Mode_ & oCopyOnWr); - } - + } + inline TMapResult Map(i64 offset, size_t size) { assert(File_.IsOpen()); @@ -427,10 +427,10 @@ bool TMemoryMap::IsOpen() const noexcept { return Impl_->IsOpen(); } -bool TMemoryMap::IsWritable() const noexcept { - return Impl_->IsWritable(); -} - +bool TMemoryMap::IsWritable() const noexcept { + return Impl_->IsWritable(); +} + TMemoryMap::EOpenMode TMemoryMap::GetMode() const noexcept { return Impl_->GetMode(); } diff --git a/util/system/filemap.h b/util/system/filemap.h index 11be64bff47..8be30c0a71a 100644 --- a/util/system/filemap.h +++ b/util/system/filemap.h @@ -88,7 +88,7 @@ public: i64 Length() const noexcept; bool IsOpen() const noexcept; - bool IsWritable() const noexcept; + bool IsWritable() const noexcept; EOpenMode GetMode() const noexcept; TFile GetFile() const noexcept; @@ -146,10 +146,10 @@ public: return Map_.IsOpen(); } - inline bool IsWritable() const noexcept { - return Map_.IsWritable(); - } - + inline bool IsWritable() const noexcept { + return Map_.IsWritable(); + } + EOpenMode GetMode() const noexcept { return Map_.GetMode(); } diff --git a/util/system/filemap_ut.cpp b/util/system/filemap_ut.cpp index 73f109dc880..91ab5026b80 100644 --- a/util/system/filemap_ut.cpp +++ b/util/system/filemap_ut.cpp @@ -317,43 +317,43 @@ Y_UNIT_TEST_SUITE(TFileMapTest) { } NFs::Remove(FileName_); } - + Y_UNIT_TEST(TestMemoryMapIsWritable) { - TFile file(FileName_, CreateAlways | WrOnly); - file.Close(); - - { - TMemoryMap mappedMem(FileName_, TMemoryMap::oRdOnly); - UNIT_ASSERT(!mappedMem.IsWritable()); - } - { - TMemoryMap mappedMem(FileName_, TMemoryMap::oRdWr); - UNIT_ASSERT(mappedMem.IsWritable()); - } + TFile file(FileName_, CreateAlways | WrOnly); + file.Close(); + + { + TMemoryMap mappedMem(FileName_, TMemoryMap::oRdOnly); + UNIT_ASSERT(!mappedMem.IsWritable()); + } + { + TMemoryMap mappedMem(FileName_, TMemoryMap::oRdWr); + UNIT_ASSERT(mappedMem.IsWritable()); + } NFs::Remove(FileName_); - } - + } + Y_UNIT_TEST(TestFileMapIsWritable) { - TFile file(FileName_, CreateAlways | WrOnly); - file.Close(); - { - TMemoryMap mappedMem(FileName_, TMemoryMap::oRdOnly); - TFileMap fileMap(mappedMem); - UNIT_ASSERT(!fileMap.IsWritable()); - } - { - TMemoryMap mappedMem(FileName_, TMemoryMap::oRdWr); - TFileMap fileMap(mappedMem); - UNIT_ASSERT(fileMap.IsWritable()); - } - { - TFileMap fileMap(FileName_, TFileMap::oRdOnly); - UNIT_ASSERT(!fileMap.IsWritable()); - } - { - TFileMap fileMap(FileName_, TFileMap::oRdWr); - UNIT_ASSERT(fileMap.IsWritable()); - } + TFile file(FileName_, CreateAlways | WrOnly); + file.Close(); + { + TMemoryMap mappedMem(FileName_, TMemoryMap::oRdOnly); + TFileMap fileMap(mappedMem); + UNIT_ASSERT(!fileMap.IsWritable()); + } + { + TMemoryMap mappedMem(FileName_, TMemoryMap::oRdWr); + TFileMap fileMap(mappedMem); + UNIT_ASSERT(fileMap.IsWritable()); + } + { + TFileMap fileMap(FileName_, TFileMap::oRdOnly); + UNIT_ASSERT(!fileMap.IsWritable()); + } + { + TFileMap fileMap(FileName_, TFileMap::oRdWr); + UNIT_ASSERT(fileMap.IsWritable()); + } NFs::Remove(FileName_); - } + } }; |