Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r73977 - in sandbox/mmap/boost/mmap: . handles handles/nt handles/posix handles/win32 mappble_objects/file mappble_objects/file/nt mappble_objects/file/posix mappble_objects/file/win32 mappble_objects/nt_file mappble_objects/nt_shared_memory mappble_objects/posix_file mappble_objects/posix_shared_memory mappble_objects/shared_memory/nt mappble_objects/shared_memory/posix mappble_objects/shared_memory/win32 mappble_objects/shared_memory/xsi mappble_objects/win32_file mappble_objects/win32_shared_memory mappble_objects/xsi_shared_memory
From: dsaritz_at_[hidden]
Date: 2011-08-21 05:17:27


Author: psiha
Date: 2011-08-21 05:17:22 EDT (Sun, 21 Aug 2011)
New Revision: 73977
URL: http://svn.boost.org/trac/boost/changeset/73977

Log:
Directory hierarchy reorganization:
 - moved file and shared_memory implementations into separate directories
 - extracted handle implementations (from file implementations) into separate module in a dedicated directory.
Added:
   sandbox/mmap/boost/mmap/handles/ (props changed)
   sandbox/mmap/boost/mmap/handles/nt/
      - copied from r73926, /sandbox/mmap/boost/mmap/mappble_objects/nt_file/
   sandbox/mmap/boost/mmap/handles/posix/
      - copied from r73926, /sandbox/mmap/boost/mmap/mappble_objects/posix_file/
   sandbox/mmap/boost/mmap/handles/win32/
      - copied from r73926, /sandbox/mmap/boost/mmap/mappble_objects/win32_file/
   sandbox/mmap/boost/mmap/mappble_objects/file/file.hpp
      - copied, changed from r73943, /sandbox/mmap/boost/mmap/mappble_objects/file/handle.hpp
   sandbox/mmap/boost/mmap/mappble_objects/file/file.inl
      - copied unchanged from r73943, /sandbox/mmap/boost/mmap/mappble_objects/file/handle.inl
   sandbox/mmap/boost/mmap/mappble_objects/file/nt/
      - copied from r73926, /sandbox/mmap/boost/mmap/mappble_objects/nt_file/
   sandbox/mmap/boost/mmap/mappble_objects/file/posix/
      - copied from r73926, /sandbox/mmap/boost/mmap/mappble_objects/posix_file/
   sandbox/mmap/boost/mmap/mappble_objects/file/posix/file.hpp
      - copied, changed from r73926, /sandbox/mmap/boost/mmap/mappble_objects/posix_file/handle.hpp
   sandbox/mmap/boost/mmap/mappble_objects/file/posix/file.inl
      - copied, changed from r73926, /sandbox/mmap/boost/mmap/mappble_objects/posix_file/handle.inl
   sandbox/mmap/boost/mmap/mappble_objects/file/win32/
      - copied from r73926, /sandbox/mmap/boost/mmap/mappble_objects/win32_file/
   sandbox/mmap/boost/mmap/mappble_objects/file/win32/file.hpp
      - copied, changed from r73926, /sandbox/mmap/boost/mmap/mappble_objects/win32_file/handle.hpp
   sandbox/mmap/boost/mmap/mappble_objects/file/win32/file.inl
      - copied, changed from r73926, /sandbox/mmap/boost/mmap/mappble_objects/win32_file/handle.inl
   sandbox/mmap/boost/mmap/mappble_objects/shared_memory/nt/
      - copied from r73926, /sandbox/mmap/boost/mmap/mappble_objects/nt_shared_memory/
   sandbox/mmap/boost/mmap/mappble_objects/shared_memory/posix/
      - copied from r73926, /sandbox/mmap/boost/mmap/mappble_objects/posix_shared_memory/
   sandbox/mmap/boost/mmap/mappble_objects/shared_memory/win32/
      - copied from r73926, /sandbox/mmap/boost/mmap/mappble_objects/win32_shared_memory/
   sandbox/mmap/boost/mmap/mappble_objects/shared_memory/xsi/
      - copied from r73926, /sandbox/mmap/boost/mmap/mappble_objects/xsi_shared_memory/
Removed:
   sandbox/mmap/boost/mmap/handles/posix/flags.hpp
   sandbox/mmap/boost/mmap/handles/posix/flags.inl
   sandbox/mmap/boost/mmap/handles/win32/flags.hpp
   sandbox/mmap/boost/mmap/handles/win32/flags.inl
   sandbox/mmap/boost/mmap/mappble_objects/file/handle.hpp
   sandbox/mmap/boost/mmap/mappble_objects/file/handle.inl
   sandbox/mmap/boost/mmap/mappble_objects/file/posix/handle.hpp
   sandbox/mmap/boost/mmap/mappble_objects/file/posix/handle.inl
   sandbox/mmap/boost/mmap/mappble_objects/file/win32/handle.hpp
   sandbox/mmap/boost/mmap/mappble_objects/file/win32/handle.inl
   sandbox/mmap/boost/mmap/mappble_objects/nt_file/
   sandbox/mmap/boost/mmap/mappble_objects/nt_shared_memory/
   sandbox/mmap/boost/mmap/mappble_objects/posix_file/
   sandbox/mmap/boost/mmap/mappble_objects/posix_shared_memory/
   sandbox/mmap/boost/mmap/mappble_objects/win32_file/
   sandbox/mmap/boost/mmap/mappble_objects/win32_shared_memory/
   sandbox/mmap/boost/mmap/mappble_objects/xsi_shared_memory/
Text files modified:
   sandbox/mmap/boost/mmap/handles/posix/handle.hpp | 27 ---------------
   sandbox/mmap/boost/mmap/handles/posix/handle.inl | 66 ------------------------------------
   sandbox/mmap/boost/mmap/handles/win32/handle.hpp | 26 +++----------
   sandbox/mmap/boost/mmap/handles/win32/handle.inl | 56 +++---------------------------
   sandbox/mmap/boost/mmap/mappble_objects/file/file.hpp | 27 +++++++-------
   sandbox/mmap/boost/mmap/mappble_objects/file/posix/file.hpp | 59 +++++---------------------------
   sandbox/mmap/boost/mmap/mappble_objects/file/posix/file.inl | 71 +++++----------------------------------
   sandbox/mmap/boost/mmap/mappble_objects/file/posix/flags.hpp | 1
   sandbox/mmap/boost/mmap/mappble_objects/file/posix/flags.inl | 2
   sandbox/mmap/boost/mmap/mappble_objects/file/win32/file.hpp | 45 +++++-------------------
   sandbox/mmap/boost/mmap/mappble_objects/file/win32/file.inl | 36 +++----------------
   sandbox/mmap/boost/mmap/mapped_view.hpp | 40 +++++++++++-----------
   sandbox/mmap/boost/mmap/mapped_view.inl | 26 +++++++-------
   13 files changed, 99 insertions(+), 383 deletions(-)

Deleted: /sandbox/mmap/boost/mmap/mappble_objects/posix_file/flags.hpp
==============================================================================
--- /sandbox/mmap/boost/mmap/mappble_objects/posix_file/flags.hpp 2011-08-21 05:17:22 EDT (Sun, 21 Aug 2011)
+++ (empty file)
@@ -1,118 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-///
-/// \file flags.hpp
-/// ---------------
-///
-/// Copyright (c) Domagoj Saric 2010.-2011.
-///
-/// Use, modification and distribution is subject to the Boost Software License, Version 1.0.
-/// (See accompanying file LICENSE_1_0.txt or copy at
-/// http://www.boost.org/LICENSE_1_0.txt)
-///
-/// For more information, see http://www.boost.org
-///
-////////////////////////////////////////////////////////////////////////////////
-//------------------------------------------------------------------------------
-
-#ifndef flags_hpp__0F422517_D9AA_4E3F_B3E4_B139021D068E
-#define flags_hpp__0F422517_D9AA_4E3F_B3E4_B139021D068E
-#pragma once
-//------------------------------------------------------------------------------
-#include "boost/assert.hpp"
-#include "boost/noncopyable.hpp"
-
-#include "fcntl.h"
-//------------------------------------------------------------------------------
-namespace boost
-{
-//------------------------------------------------------------------------------
-namespace mmap
-{
-//------------------------------------------------------------------------------
-
-// Implementation note:
-// Using structs with public members and factory functions to enable (almost)
-// zero-overhead 'link-time' conversion to native flag formats and to allow the
-// user to modify the created flags or create fully custom ones so that specific
-// platform-dependent use-cases, not otherwise covered through the generic
-// interface, can also be covered.
-// (10.10.2010.) (Domagoj Saric)
-
-struct posix_file_flags
-{
- struct handle_access_rights
- {
- static unsigned int const read ;
- static unsigned int const write ;
- static unsigned int const execute;
- };
-
- struct share_mode
- {
- static unsigned int const none ;
- static unsigned int const read ;
- static unsigned int const write ;
- static unsigned int const remove;
- };
-
- struct open_policy
- {
- enum value_type
- {
- create_new = O_CREAT | O_EXCL ,
- create_new_or_truncate_existing = O_CREAT | O_TRUNC,
- open_existing = 0 ,
- open_or_create = O_CREAT ,
- open_and_truncate_existing = O_TRUNC
- };
- };
- typedef open_policy::value_type open_policy_t;
-
- struct system_hints
- {
- static unsigned int const random_access ;
- static unsigned int const sequential_access;
- static unsigned int const non_cached ;
- static unsigned int const delete_on_close ;
- static unsigned int const temporary ;
- };
-
- struct on_construction_rights
- {
- static unsigned int const read ;
- static unsigned int const write ;
- static unsigned int const execute;
- };
-
- static posix_file_flags create
- (
- unsigned int handle_access_flags ,
- unsigned int share_mode ,
- open_policy_t ,
- unsigned int system_hints ,
- unsigned int on_construction_rights
- );
-
- static posix_file_flags create_for_opening_existing_files
- (
- unsigned int handle_access_flags,
- unsigned int share_mode ,
- bool truncate ,
- unsigned int system_hints
- );
-
- int oflag;
- int pmode;
-};
-
-//------------------------------------------------------------------------------
-} // namespace mmap
-//------------------------------------------------------------------------------
-} // namespace boost
-//------------------------------------------------------------------------------
-
-#ifdef BOOST_MMAP_HEADER_ONLY
- #include "flags.inl"
-#endif // BOOST_MMAP_HEADER_ONLY
-
-#endif // flags_hpp

Deleted: /sandbox/mmap/boost/mmap/mappble_objects/posix_file/flags.inl
==============================================================================
--- /sandbox/mmap/boost/mmap/mappble_objects/posix_file/flags.inl 2011-08-21 05:17:22 EDT (Sun, 21 Aug 2011)
+++ (empty file)
@@ -1,116 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-///
-/// \file flags.inl
-/// ---------------
-///
-/// Copyright (c) Domagoj Saric 2010.-2011.
-///
-/// Use, modification and distribution is subject to the Boost Software License, Version 1.0.
-/// (See accompanying file LICENSE_1_0.txt or copy at
-/// http://www.boost.org/LICENSE_1_0.txt)
-///
-/// For more information, see http://www.boost.org
-///
-////////////////////////////////////////////////////////////////////////////////
-//------------------------------------------------------------------------------
-#include "flags.hpp"
-
-#include "../../detail/impl_inline.hpp"
-
-#include "boost/assert.hpp"
-
-#ifdef _WIN32
- #define BOOST_AUX_IO_WIN32_OR_POSIX( win32, posix ) win32
- #pragma warning ( disable : 4996 ) // "The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name."
- #include "io.h"
- #include "sys/stat.h"
-#else
- #define BOOST_AUX_IO_WIN32_OR_POSIX( win32, posix ) posix
- #include "sys/mman.h" // mmap, munmap.
- #include "sys/stat.h"
- #include "sys/types.h" // struct stat.
- #include "unistd.h" // sysconf.
-#endif // _WIN32
-#include "errno.h"
-#include "fcntl.h"
-
-#ifndef _WIN32
- #ifdef __APPLE__
- #define BOOST_AUX_MMAP_POSIX_OR_OSX( posix, osx ) osx
- #else
- #define BOOST_AUX_MMAP_POSIX_OR_OSX( posix, osx ) posix
- #endif
-#endif
-//------------------------------------------------------------------------------
-namespace boost
-{
-//------------------------------------------------------------------------------
-namespace mmap
-{
-//------------------------------------------------------------------------------
-
-unsigned int const posix_file_flags::handle_access_rights::read = O_RDONLY;
-unsigned int const posix_file_flags::handle_access_rights::write = O_WRONLY;
-unsigned int const posix_file_flags::handle_access_rights::execute = O_RDONLY;
-
-unsigned int const posix_file_flags::share_mode::none = 0;
-unsigned int const posix_file_flags::share_mode::read = 0;
-unsigned int const posix_file_flags::share_mode::write = 0;
-unsigned int const posix_file_flags::share_mode::remove = 0;
-
-unsigned int const posix_file_flags::system_hints::random_access = BOOST_AUX_IO_WIN32_OR_POSIX( O_RANDOM , 0 );
-unsigned int const posix_file_flags::system_hints::sequential_access = BOOST_AUX_IO_WIN32_OR_POSIX( O_SEQUENTIAL , 0 );
-// http://stackoverflow.com/questions/2299402/how-does-one-do-raw-io-on-mac-os-x-ie-equivalent-to-linuxs-o-direct-flag
-unsigned int const posix_file_flags::system_hints::non_cached = BOOST_AUX_IO_WIN32_OR_POSIX( 0 , BOOST_AUX_MMAP_POSIX_OR_OSX( O_DIRECT, 0 ) );
-unsigned int const posix_file_flags::system_hints::delete_on_close = BOOST_AUX_IO_WIN32_OR_POSIX( O_TEMPORARY , 0 );
-unsigned int const posix_file_flags::system_hints::temporary = BOOST_AUX_IO_WIN32_OR_POSIX( _O_SHORT_LIVED, 0 );
-
-unsigned int const posix_file_flags::on_construction_rights::read = BOOST_AUX_IO_WIN32_OR_POSIX( _S_IREAD , S_IRUSR );
-unsigned int const posix_file_flags::on_construction_rights::write = BOOST_AUX_IO_WIN32_OR_POSIX( _S_IWRITE, S_IWUSR );
-unsigned int const posix_file_flags::on_construction_rights::execute = BOOST_AUX_IO_WIN32_OR_POSIX( _S_IEXEC , S_IXUSR );
-
-BOOST_IMPL_INLINE
-posix_file_flags posix_file_flags::create
-(
- unsigned int const handle_access_flags ,
- unsigned int const /*share_mode*/ ,
- open_policy_t const open_flags ,
- unsigned int const system_hints ,
- unsigned int const on_construction_rights
-)
-{
- posix_file_flags const flags =
- {
- ( ( handle_access_flags == ( O_RDONLY | O_WRONLY ) ) ? O_RDWR : handle_access_flags )
- |
- open_flags
- |
- system_hints, // oflag
- on_construction_rights // pmode
- };
-
- return flags;
-}
-
-
-BOOST_IMPL_INLINE
-posix_file_flags posix_file_flags::create_for_opening_existing_files( unsigned int const handle_access_flags, unsigned int const share_mode , bool const truncate, unsigned int const system_hints )
-{
- return create
- (
- handle_access_flags,
- share_mode,
- truncate
- ? open_policy::open_and_truncate_existing
- : open_policy::open_existing,
- system_hints,
- 0
- );
-}
-
-
-//------------------------------------------------------------------------------
-} // mmap
-//------------------------------------------------------------------------------
-} // boost
-//------------------------------------------------------------------------------

Modified: sandbox/mmap/boost/mmap/handles/posix/handle.hpp
==============================================================================
--- /sandbox/mmap/boost/mmap/mappble_objects/posix_file/handle.hpp (original)
+++ sandbox/mmap/boost/mmap/handles/posix/handle.hpp 2011-08-21 05:17:22 EDT (Sun, 21 Aug 2011)
@@ -19,14 +19,7 @@
 //------------------------------------------------------------------------------
 #include "boost/config.hpp"
 
-#ifdef BOOST_MSVC
- #include "../win32_file/handle.hpp"
-#endif
-
-#include "boost/assert.hpp"
 #include "boost/noncopyable.hpp"
-
-#include <cstddef>
 //------------------------------------------------------------------------------
 namespace boost
 {
@@ -35,12 +28,6 @@
 {
 //------------------------------------------------------------------------------
 
-struct posix_file_flags;
-
-namespace guard
-{
-//------------------------------------------------------------------------------
-
 class posix_handle
 #ifdef BOOST_MSVC
     : noncopyable
@@ -48,17 +35,12 @@
 {
 public:
     typedef int handle_t;
- typedef posix_file_flags flags;
 
     explicit posix_handle( handle_t );
     #ifndef BOOST_MSVC
         posix_handle( posix_handle const & );
     #endif // BOOST_MSVC
 
- #ifdef BOOST_MSVC
- explicit posix_handle( windows_handle::handle_t );
- #endif // _WIN32
-
     ~posix_handle();
 
     handle_t const & handle() const { return handle_; }
@@ -68,15 +50,6 @@
 };
 
 //------------------------------------------------------------------------------
-} // namespace guard
-
-guard::posix_handle create_file( char const * file_name, guard::posix_handle::flags const & );
-guard::posix_handle create_file( char const * file_name, guard::posix_handle::flags const &, unsigned int desired_size );
-
-bool set_file_size( guard::posix_handle::handle_t, std::size_t desired_size );
-std::size_t get_file_size( guard::posix_handle::handle_t );
-
-//------------------------------------------------------------------------------
 } // namespace mmap
 //------------------------------------------------------------------------------
 } // namespace boost

Modified: sandbox/mmap/boost/mmap/handles/posix/handle.inl
==============================================================================
--- /sandbox/mmap/boost/mmap/mappble_objects/posix_file/handle.inl (original)
+++ sandbox/mmap/boost/mmap/handles/posix/handle.inl 2011-08-21 05:17:22 EDT (Sun, 21 Aug 2011)
@@ -15,8 +15,7 @@
 //------------------------------------------------------------------------------
 #include "handle.hpp"
 
-#include "flags.hpp"
-#include "../../detail/impl_inline.hpp"
+#include "../../../detail/impl_inline.hpp"
 
 #include "boost/assert.hpp"
 
@@ -31,15 +30,6 @@
 #endif // BOOST_MSVC
 #include "errno.h"
 #include "fcntl.h"
-
-#ifndef _WIN32
- #ifdef __APPLE__
- #define BOOST_AUX_MMAP_POSIX_OR_OSX( posix, osx ) osx
- #else
- #define BOOST_AUX_MMAP_POSIX_OR_OSX( posix, osx ) posix
- #endif
-#endif
-
 //------------------------------------------------------------------------------
 namespace boost
 {
@@ -47,8 +37,6 @@
 namespace mmap
 {
 //------------------------------------------------------------------------------
-namespace guard
-{
 
 BOOST_IMPL_INLINE
 posix_handle::posix_handle( handle_t const handle )
@@ -56,23 +44,6 @@
     handle_( handle )
 {}
 
-#ifdef BOOST_MSVC
-BOOST_IMPL_INLINE
-posix_handle::posix_handle( windows_handle::handle_t const native_handle )
- :
- handle_( ::_open_osfhandle( reinterpret_cast<intptr_t>( native_handle ), _O_APPEND ) )
-{
- if ( handle_ == -1 )
- {
- BOOST_VERIFY
- (
- ( ::CloseHandle( native_handle ) != false ) ||
- ( native_handle == 0 || native_handle == INVALID_HANDLE_VALUE )
- );
- }
-}
-#endif // BOOST_MSVC
-
 BOOST_IMPL_INLINE
 posix_handle::~posix_handle()
 {
@@ -87,41 +58,6 @@
 }
 
 //------------------------------------------------------------------------------
-} // guard
-
-
-BOOST_IMPL_INLINE
-guard::posix_handle create_file( char const * const file_name, posix_file_flags const & flags )
-{
- BOOST_ASSERT( file_name );
-
- int const current_mask( ::umask( 0 ) );
- int const file_handle ( ::open( file_name, flags.oflag, flags.pmode ) );
- //...zzz...investigate posix_fadvise, posix_madvise, fcntl for the system hints...
- BOOST_VERIFY( ::umask( current_mask ) == 0 );
-
- return guard::posix_handle( file_handle );
-}
-
-
-#ifndef BOOST_MSVC
-BOOST_IMPL_INLINE
-bool set_file_size( guard::posix_handle::handle_t const file_handle, std::size_t const desired_size )
-{
- return ::ftruncate( file_handle, desired_size ) != -1;
-}
-#endif // BOOST_MSVC
-
-
-BOOST_IMPL_INLINE
-std::size_t get_file_size( guard::posix_handle::handle_t const file_handle )
-{
- struct stat file_info;
- BOOST_VERIFY( ::fstat( file_handle, &file_info ) == 0 );
- return file_info.st_size;
-}
-
-//------------------------------------------------------------------------------
 } // mmap
 //------------------------------------------------------------------------------
 } // boost

Deleted: /sandbox/mmap/boost/mmap/mappble_objects/win32_file/flags.hpp
==============================================================================
--- /sandbox/mmap/boost/mmap/mappble_objects/win32_file/flags.hpp 2011-08-21 05:17:22 EDT (Sun, 21 Aug 2011)
+++ (empty file)
@@ -1,117 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-///
-/// \file flags.hpp
-/// ---------------
-///
-/// Copyright (c) Domagoj Saric 2010.-2011.
-///
-/// Use, modification and distribution is subject to the Boost Software License, Version 1.0.
-/// (See accompanying file LICENSE_1_0.txt or copy at
-/// http://www.boost.org/LICENSE_1_0.txt)
-///
-/// For more information, see http://www.boost.org
-///
-////////////////////////////////////////////////////////////////////////////////
-//------------------------------------------------------------------------------
-#ifndef flags_hpp__77AE8A6F_0E93_433B_A1F2_531BBBB353FC
-#define flags_hpp__77AE8A6F_0E93_433B_A1F2_531BBBB353FC
-#pragma once
-//------------------------------------------------------------------------------
-#include "boost/assert.hpp"
-#include "boost/noncopyable.hpp"
-//------------------------------------------------------------------------------
-namespace boost
-{
-//------------------------------------------------------------------------------
-namespace mmap
-{
-//------------------------------------------------------------------------------
-
-// Implementation note:
-// Using structs with public members and factory functions to enable (almost)
-// zero-overhead 'link-time' conversion to native flag formats and to allow the
-// user to modify the created flags or create fully custom ones so that specific
-// platform-dependent use-cases, not otherwise covered through the generic
-// interface, can also be covered.
-// (10.10.2010.) (Domagoj Saric)
-
-struct win32_file_flags
-{
- struct handle_access_rights
- {
- static unsigned int const read ;
- static unsigned int const write ;
- static unsigned int const execute;
- };
-
- struct share_mode
- {
- static unsigned int const none ;
- static unsigned int const read ;
- static unsigned int const write ;
- static unsigned int const remove;
- };
-
- struct open_policy
- {
- enum value_type
- {
- create_new = 1,
- create_new_or_truncate_existing = 2,
- open_existing = 3,
- open_or_create = 4,
- open_and_truncate_existing = 5
- };
- };
- typedef open_policy::value_type open_policy_t;
-
- struct system_hints
- {
- static unsigned int const random_access ;
- static unsigned int const sequential_access;
- static unsigned int const non_cached ;
- static unsigned int const delete_on_close ;
- static unsigned int const temporary ;
- };
-
- struct on_construction_rights
- {
- static unsigned int const read ;
- static unsigned int const write ;
- static unsigned int const execute;
- };
-
- static win32_file_flags create
- (
- unsigned int handle_access_flags ,
- unsigned int share_mode ,
- open_policy_t ,
- unsigned int system_hints ,
- unsigned int on_construction_rights
- );
-
- static win32_file_flags create_for_opening_existing_files
- (
- unsigned int handle_access_flags,
- unsigned int share_mode ,
- bool truncate ,
- unsigned int system_hints
- );
-
- unsigned long desired_access ;
- unsigned long share_mode ;
- unsigned long creation_disposition;
- unsigned long flags_and_attributes;
-};
-
-//------------------------------------------------------------------------------
-} // namespace mmap
-//------------------------------------------------------------------------------
-} // namespace boost
-//------------------------------------------------------------------------------
-
-#ifdef BOOST_MMAP_HEADER_ONLY
- #include "flags.inl"
-#endif // BOOST_MMAP_HEADER_ONLY
-
-#endif // flags_hpp

Deleted: /sandbox/mmap/boost/mmap/mappble_objects/win32_file/flags.inl
==============================================================================
--- /sandbox/mmap/boost/mmap/mappble_objects/win32_file/flags.inl 2011-08-21 05:17:22 EDT (Sun, 21 Aug 2011)
+++ (empty file)
@@ -1,101 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-///
-/// \file flags.inl
-/// ---------------
-///
-/// Copyright (c) Domagoj Saric 2010.-2011.
-///
-/// Use, modification and distribution is subject to the Boost Software License, Version 1.0.
-/// (See accompanying file LICENSE_1_0.txt or copy at
-/// http://www.boost.org/LICENSE_1_0.txt)
-///
-/// For more information, see http://www.boost.org
-///
-////////////////////////////////////////////////////////////////////////////////
-//------------------------------------------------------------------------------
-#include "flags.hpp"
-
-#include "../../detail/impl_inline.hpp"
-
-#include "boost/assert.hpp"
-
-#ifndef WIN32_LEAN_AND_MEAN
- #define WIN32_LEAN_AND_MEAN
-#endif // WIN32_LEAN_AND_MEAN
-#include "windows.h"
-//------------------------------------------------------------------------------
-namespace boost
-{
-//------------------------------------------------------------------------------
-namespace mmap
-{
-//------------------------------------------------------------------------------
-
-unsigned int const win32_file_flags::handle_access_rights::read = GENERIC_READ ;
-unsigned int const win32_file_flags::handle_access_rights::write = GENERIC_WRITE ;
-unsigned int const win32_file_flags::handle_access_rights::execute = GENERIC_EXECUTE;
-
-unsigned int const win32_file_flags::share_mode::none = 0 ;
-unsigned int const win32_file_flags::share_mode::read = FILE_SHARE_READ ;
-unsigned int const win32_file_flags::share_mode::write = FILE_SHARE_WRITE ;
-unsigned int const win32_file_flags::share_mode::remove = FILE_SHARE_DELETE;
-
-unsigned int const win32_file_flags::system_hints::random_access = FILE_FLAG_RANDOM_ACCESS ;
-unsigned int const win32_file_flags::system_hints::sequential_access = FILE_FLAG_SEQUENTIAL_SCAN ;
-unsigned int const win32_file_flags::system_hints::non_cached = FILE_FLAG_NO_BUFFERING | FILE_FLAG_WRITE_THROUGH;
-unsigned int const win32_file_flags::system_hints::delete_on_close = FILE_FLAG_DELETE_ON_CLOSE ;
-unsigned int const win32_file_flags::system_hints::temporary = FILE_ATTRIBUTE_TEMPORARY ;
-
-unsigned int const win32_file_flags::on_construction_rights::read = FILE_ATTRIBUTE_READONLY;
-unsigned int const win32_file_flags::on_construction_rights::write = FILE_ATTRIBUTE_NORMAL ;
-unsigned int const win32_file_flags::on_construction_rights::execute = FILE_ATTRIBUTE_NORMAL ;
-
-BOOST_IMPL_INLINE
-win32_file_flags win32_file_flags::create
-(
- unsigned int const handle_access_flags ,
- unsigned int const share_mode ,
- open_policy_t const open_flags ,
- unsigned int const system_hints ,
- unsigned int const on_construction_rights
-)
-{
- win32_file_flags const flags =
- {
- handle_access_flags, // desired_access
- share_mode, // share_mode
- open_flags, // creation_disposition
- system_hints
- |
- (
- ( on_construction_rights & FILE_ATTRIBUTE_NORMAL )
- ? ( on_construction_rights & ~FILE_ATTRIBUTE_READONLY )
- : on_construction_rights
- ) // flags_and_attributes
- };
-
- return flags;
-}
-
-
-BOOST_IMPL_INLINE
-win32_file_flags win32_file_flags::create_for_opening_existing_files( unsigned int const handle_access_flags, unsigned int const share_mode , bool const truncate, unsigned int const system_hints )
-{
- return create
- (
- handle_access_flags,
- share_mode,
- truncate
- ? open_policy::open_and_truncate_existing
- : open_policy::open_existing,
- system_hints,
- 0
- );
-}
-
-
-//------------------------------------------------------------------------------
-} // mmap
-//------------------------------------------------------------------------------
-} // boost
-//------------------------------------------------------------------------------

Modified: sandbox/mmap/boost/mmap/handles/win32/handle.hpp
==============================================================================
--- /sandbox/mmap/boost/mmap/mappble_objects/win32_file/handle.hpp (original)
+++ sandbox/mmap/boost/mmap/handles/win32/handle.hpp 2011-08-21 05:17:22 EDT (Sun, 21 Aug 2011)
@@ -17,10 +17,11 @@
 #define handle_hpp__1CEA6D65_D5C0_474E_833D_2CE927A1C74D
 #pragma once
 //------------------------------------------------------------------------------
-#include "boost/assert.hpp"
-#include "boost/noncopyable.hpp"
+#ifdef BOOST_MSVC
+ #include "../posix/handle.hpp"
+#endif
 
-#include <cstddef>
+#include "boost/noncopyable.hpp"
 //------------------------------------------------------------------------------
 namespace boost
 {
@@ -29,19 +30,11 @@
 {
 //------------------------------------------------------------------------------
 
-struct win32_file_flags;
-
-namespace guard
-{
-//------------------------------------------------------------------------------
-
 class windows_handle : noncopyable
 {
 public:
     typedef void * handle_t;
 
- typedef win32_file_flags flags;
-
     explicit windows_handle( handle_t );
     ~windows_handle();
 
@@ -51,14 +44,9 @@
     handle_t const handle_;
 };
 
-//------------------------------------------------------------------------------
-} // namespace guard
-
-guard::windows_handle create_file( char const * file_name, guard::windows_handle::flags const & );
-guard::windows_handle create_file( char const * file_name, guard::windows_handle::flags const &, unsigned int desired_size );
-
-bool set_file_size( guard::windows_handle::handle_t, std::size_t desired_size );
-std::size_t get_file_size( guard::windows_handle::handle_t );
+#ifdef BOOST_MSVC
+ posix_handle make_posix_handle( windows_handle::handle_t, int const flags );
+#endif // BOOST_MSVC
 
 //------------------------------------------------------------------------------
 } // namespace mmap

Modified: sandbox/mmap/boost/mmap/handles/win32/handle.inl
==============================================================================
--- /sandbox/mmap/boost/mmap/mappble_objects/win32_file/handle.inl (original)
+++ sandbox/mmap/boost/mmap/handles/win32/handle.inl 2011-08-21 05:17:22 EDT (Sun, 21 Aug 2011)
@@ -15,7 +15,6 @@
 //------------------------------------------------------------------------------
 #include "handle.hpp"
 
-#include "flags.hpp"
 #include "../../detail/impl_inline.hpp"
 
 #include "boost/assert.hpp"
@@ -31,8 +30,6 @@
 namespace mmap
 {
 //------------------------------------------------------------------------------
-namespace guard
-{
 
 BOOST_IMPL_INLINE
 windows_handle::windows_handle( handle_t const handle )
@@ -50,53 +47,14 @@
     );
 }
 
-//------------------------------------------------------------------------------
-} // guard
-
-
-BOOST_IMPL_INLINE
-guard::windows_handle create_file( char const * const file_name, guard::windows_handle::flags const & flags )
-{
- BOOST_ASSERT( file_name );
-
- HANDLE const file_handle
- (
- ::CreateFileA
- (
- file_name, flags.desired_access, flags.share_mode, 0, flags.creation_disposition, flags.flags_and_attributes, 0
- )
- );
- BOOST_ASSERT( ( file_handle == INVALID_HANDLE_VALUE ) || ( ::GetLastError() == NO_ERROR ) || ( ::GetLastError() == ERROR_ALREADY_EXISTS ) );
-
- return guard::native_handle( file_handle );
-}
-
 
-BOOST_IMPL_INLINE
-bool set_file_size( guard::windows_handle::handle_t const file_handle, std::size_t const desired_size )
-{
- // It is 'OK' to send null/invalid handles to Windows functions (they will
- // simply fail), this simplifies error handling (it is enough to go through
- // all the logic, inspect the final result and then throw on error).
- DWORD const new_size( ::SetFilePointer( file_handle, desired_size, 0, FILE_BEGIN ) );
- BOOST_ASSERT( ( new_size == desired_size ) || ( file_handle == INVALID_HANDLE_VALUE ) );
- ignore_unused_variable_warning( new_size );
-
- BOOL const success( ::SetEndOfFile( file_handle ) );
-
- BOOST_VERIFY( ( ::SetFilePointer( file_handle, 0, 0, FILE_BEGIN ) == 0 ) || ( file_handle == INVALID_HANDLE_VALUE ) );
-
- return success != false;
-}
-
-
-BOOST_IMPL_INLINE
-std::size_t get_file_size( guard::windows_handle::handle_t const file_handle )
-{
- DWORD const file_size( ::GetFileSize( file_handle, 0 ) );
- BOOST_ASSERT( ( file_size != INVALID_FILE_SIZE ) || ( file_handle == INVALID_HANDLE_VALUE ) || ( ::GetLastError() == NO_ERROR ) );
- return file_size;
-}
+#ifdef BOOST_MSVC
+ BOOST_IMPL_INLINE
+ posix_handle make_posix_handle( windows_handle::handle_t const native_handle, int const flags )
+ {
+ return posix_handle( ::_open_osfhandle( reinterpret_cast<intptr_t>( native_handle ), flags ) );
+ }
+#endif // BOOST_MSVC
 
 //------------------------------------------------------------------------------
 } // mmap

Copied: sandbox/mmap/boost/mmap/mappble_objects/file/file.hpp (from r73943, /sandbox/mmap/boost/mmap/mappble_objects/file/handle.hpp)
==============================================================================
--- /sandbox/mmap/boost/mmap/mappble_objects/file/handle.hpp (original)
+++ sandbox/mmap/boost/mmap/mappble_objects/file/file.hpp 2011-08-21 05:17:22 EDT (Sun, 21 Aug 2011)
@@ -1,7 +1,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 ///
-/// \file handle.hpp
-/// ----------------
+/// \file file.hpp
+/// --------------
 ///
 /// Copyright (c) Domagoj Saric 2010.-2011.
 ///
@@ -13,14 +13,16 @@
 ///
 ////////////////////////////////////////////////////////////////////////////////
 //------------------------------------------------------------------------------
-#ifndef handle_hpp__D3705ED0_EC0D_4747_A789_1EE17252B6E2
-#define handle_hpp__D3705ED0_EC0D_4747_A789_1EE17252B6E2
+#ifndef file_hpp__D3705ED0_EC0D_4747_A789_1EE17252B6E2
+#define file_hpp__D3705ED0_EC0D_4747_A789_1EE17252B6E2
 #pragma once
 //------------------------------------------------------------------------------
 #ifdef _WIN32
-#include "../win32_file/handle.hpp"
+ #include "win32/file.hpp"
+ #include "win32/flags.hpp"
 #else
-#include "../posix_file/handle.hpp"
+ #include "posix/file.hpp"
+ #include "posix/flags.hpp"
 #endif
 //------------------------------------------------------------------------------
 namespace boost
@@ -29,22 +31,19 @@
 namespace mmap
 {
 //------------------------------------------------------------------------------
-namespace guard
-{
-//------------------------------------------------------------------------------
 
 #ifdef _WIN32
- typedef windows_handle native_handle;
+ typedef windows_handle native_handle;
+ typedef win32_file_flags native_file_flags;
 #else
- typedef posix_handle native_handle;
+ typedef posix_handle native_handle;
+ typedef posix_file_flags native_file_flags;
 #endif // _WIN32
 typedef native_handle::handle_t native_handle_t;
 
 //------------------------------------------------------------------------------
-} // namespace guard
-//------------------------------------------------------------------------------
 } // namespace mmap
 //------------------------------------------------------------------------------
 } // namespace boost
 //------------------------------------------------------------------------------
-#endif // handle_hpp
+#endif // file_hpp

Deleted: sandbox/mmap/boost/mmap/mappble_objects/file/handle.hpp
==============================================================================
--- sandbox/mmap/boost/mmap/mappble_objects/file/handle.hpp 2011-08-21 05:17:22 EDT (Sun, 21 Aug 2011)
+++ (empty file)
@@ -1,50 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-///
-/// \file handle.hpp
-/// ----------------
-///
-/// Copyright (c) Domagoj Saric 2010.-2011.
-///
-/// Use, modification and distribution is subject to the Boost Software License, Version 1.0.
-/// (See accompanying file LICENSE_1_0.txt or copy at
-/// http://www.boost.org/LICENSE_1_0.txt)
-///
-/// For more information, see http://www.boost.org
-///
-////////////////////////////////////////////////////////////////////////////////
-//------------------------------------------------------------------------------
-#ifndef handle_hpp__D3705ED0_EC0D_4747_A789_1EE17252B6E2
-#define handle_hpp__D3705ED0_EC0D_4747_A789_1EE17252B6E2
-#pragma once
-//------------------------------------------------------------------------------
-#ifdef _WIN32
-#include "../win32_file/handle.hpp"
-#else
-#include "../posix_file/handle.hpp"
-#endif
-//------------------------------------------------------------------------------
-namespace boost
-{
-//------------------------------------------------------------------------------
-namespace mmap
-{
-//------------------------------------------------------------------------------
-namespace guard
-{
-//------------------------------------------------------------------------------
-
-#ifdef _WIN32
- typedef windows_handle native_handle;
-#else
- typedef posix_handle native_handle;
-#endif // _WIN32
-typedef native_handle::handle_t native_handle_t;
-
-//------------------------------------------------------------------------------
-} // namespace guard
-//------------------------------------------------------------------------------
-} // namespace mmap
-//------------------------------------------------------------------------------
-} // namespace boost
-//------------------------------------------------------------------------------
-#endif // handle_hpp

Deleted: sandbox/mmap/boost/mmap/mappble_objects/file/handle.inl
==============================================================================
--- sandbox/mmap/boost/mmap/mappble_objects/file/handle.inl 2011-08-21 05:17:22 EDT (Sun, 21 Aug 2011)
+++ (empty file)
@@ -1,21 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-///
-/// \file handle.inl
-/// ----------------
-///
-/// Copyright (c) Domagoj Saric 2010.-2011.
-///
-/// Use, modification and distribution is subject to the Boost Software License, Version 1.0.
-/// (See accompanying file LICENSE_1_0.txt or copy at
-/// http://www.boost.org/LICENSE_1_0.txt)
-///
-/// For more information, see http://www.boost.org
-///
-////////////////////////////////////////////////////////////////////////////////
-//------------------------------------------------------------------------------
-#ifdef _WIN32
- #include "../win32_file/handle.inl"
-#else
- #include "../posix_file/handle.inl"
-#endif
-//------------------------------------------------------------------------------

Copied: sandbox/mmap/boost/mmap/mappble_objects/file/posix/file.hpp (from r73926, /sandbox/mmap/boost/mmap/mappble_objects/posix_file/handle.hpp)
==============================================================================
--- /sandbox/mmap/boost/mmap/mappble_objects/posix_file/handle.hpp (original)
+++ sandbox/mmap/boost/mmap/mappble_objects/file/posix/file.hpp 2011-08-21 05:17:22 EDT (Sun, 21 Aug 2011)
@@ -13,18 +13,11 @@
 ///
 ////////////////////////////////////////////////////////////////////////////////
 //------------------------------------------------------------------------------
-#ifndef handle_hpp__63113526_C3F1_46DC_850E_D8D8C62031DB
-#define handle_hpp__63113526_C3F1_46DC_850E_D8D8C62031DB
+#ifndef file_hpp__1E2F9841_1C6C_40D9_9AA7_BAC0003CD909
+#define file_hpp__1E2F9841_1C6C_40D9_9AA7_BAC0003CD909
 #pragma once
 //------------------------------------------------------------------------------
-#include "boost/config.hpp"
-
-#ifdef BOOST_MSVC
- #include "../win32_file/handle.hpp"
-#endif
-
-#include "boost/assert.hpp"
-#include "boost/noncopyable.hpp"
+#include "../../../handles/posix/handle.hpp"
 
 #include <cstddef>
 //------------------------------------------------------------------------------
@@ -37,44 +30,12 @@
 
 struct posix_file_flags;
 
-namespace guard
-{
-//------------------------------------------------------------------------------
-
-class posix_handle
-#ifdef BOOST_MSVC
- : noncopyable
-#endif // BOOST_MSVC
-{
-public:
- typedef int handle_t;
- typedef posix_file_flags flags;
-
- explicit posix_handle( handle_t );
- #ifndef BOOST_MSVC
- posix_handle( posix_handle const & );
- #endif // BOOST_MSVC
-
- #ifdef BOOST_MSVC
- explicit posix_handle( windows_handle::handle_t );
- #endif // _WIN32
-
- ~posix_handle();
-
- handle_t const & handle() const { return handle_; }
-
-private:
- handle_t const handle_;
-};
-
-//------------------------------------------------------------------------------
-} // namespace guard
-
-guard::posix_handle create_file( char const * file_name, guard::posix_handle::flags const & );
-guard::posix_handle create_file( char const * file_name, guard::posix_handle::flags const &, unsigned int desired_size );
+posix_handle create_file( char const * file_name, posix_file_flags const & );
 
-bool set_file_size( guard::posix_handle::handle_t, std::size_t desired_size );
-std::size_t get_file_size( guard::posix_handle::handle_t );
+#ifdef BOOST_HAS_UNISTD_H
+bool set_file_size( posix_handle::handle_t, std::size_t desired_size );
+#endif // BOOST_HAS_UNISTD_H
+std::size_t get_file_size( posix_handle::handle_t );
 
 //------------------------------------------------------------------------------
 } // namespace mmap
@@ -83,7 +44,7 @@
 //------------------------------------------------------------------------------
 
 #ifdef BOOST_MMAP_HEADER_ONLY
- #include "handle.inl"
+ #include "file.inl"
 #endif
 
-#endif // handle_hpp
+#endif // file_hpp

Copied: sandbox/mmap/boost/mmap/mappble_objects/file/posix/file.inl (from r73926, /sandbox/mmap/boost/mmap/mappble_objects/posix_file/handle.inl)
==============================================================================
--- /sandbox/mmap/boost/mmap/mappble_objects/posix_file/handle.inl (original)
+++ sandbox/mmap/boost/mmap/mappble_objects/file/posix/file.inl 2011-08-21 05:17:22 EDT (Sun, 21 Aug 2011)
@@ -1,7 +1,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 ///
-/// \file handle.inl
-/// ----------------
+/// \file file.inl
+/// --------------
 ///
 /// Copyright (c) Domagoj Saric 2010.-2011.
 ///
@@ -13,10 +13,10 @@
 ///
 ////////////////////////////////////////////////////////////////////////////////
 //------------------------------------------------------------------------------
-#include "handle.hpp"
+#include "file.hpp"
 
 #include "flags.hpp"
-#include "../../detail/impl_inline.hpp"
+#include "../../../detail/impl_inline.hpp"
 
 #include "boost/assert.hpp"
 
@@ -31,15 +31,6 @@
 #endif // BOOST_MSVC
 #include "errno.h"
 #include "fcntl.h"
-
-#ifndef _WIN32
- #ifdef __APPLE__
- #define BOOST_AUX_MMAP_POSIX_OR_OSX( posix, osx ) osx
- #else
- #define BOOST_AUX_MMAP_POSIX_OR_OSX( posix, osx ) posix
- #endif
-#endif
-
 //------------------------------------------------------------------------------
 namespace boost
 {
@@ -47,51 +38,9 @@
 namespace mmap
 {
 //------------------------------------------------------------------------------
-namespace guard
-{
-
-BOOST_IMPL_INLINE
-posix_handle::posix_handle( handle_t const handle )
- :
- handle_( handle )
-{}
 
-#ifdef BOOST_MSVC
 BOOST_IMPL_INLINE
-posix_handle::posix_handle( windows_handle::handle_t const native_handle )
- :
- handle_( ::_open_osfhandle( reinterpret_cast<intptr_t>( native_handle ), _O_APPEND ) )
-{
- if ( handle_ == -1 )
- {
- BOOST_VERIFY
- (
- ( ::CloseHandle( native_handle ) != false ) ||
- ( native_handle == 0 || native_handle == INVALID_HANDLE_VALUE )
- );
- }
-}
-#endif // BOOST_MSVC
-
-BOOST_IMPL_INLINE
-posix_handle::~posix_handle()
-{
- BOOST_VERIFY
- (
- ( ::close( handle() ) == 0 ) ||
- (
- ( handle() == -1 ) &&
- ( errno == EBADF )
- )
- );
-}
-
-//------------------------------------------------------------------------------
-} // guard
-
-
-BOOST_IMPL_INLINE
-guard::posix_handle create_file( char const * const file_name, posix_file_flags const & flags )
+posix_handle create_file( char const * const file_name, posix_file_flags const & flags )
 {
     BOOST_ASSERT( file_name );
 
@@ -100,21 +49,21 @@
     //...zzz...investigate posix_fadvise, posix_madvise, fcntl for the system hints...
     BOOST_VERIFY( ::umask( current_mask ) == 0 );
 
- return guard::posix_handle( file_handle );
+ return posix_handle( file_handle );
 }
 
 
-#ifndef BOOST_MSVC
+#ifdef BOOST_HAS_UNISTD_H
 BOOST_IMPL_INLINE
-bool set_file_size( guard::posix_handle::handle_t const file_handle, std::size_t const desired_size )
+bool set_file_size( posix_handle::handle_t const file_handle, std::size_t const desired_size )
 {
     return ::ftruncate( file_handle, desired_size ) != -1;
 }
-#endif // BOOST_MSVC
+#endif // BOOST_HAS_UNISTD_H
 
 
 BOOST_IMPL_INLINE
-std::size_t get_file_size( guard::posix_handle::handle_t const file_handle )
+std::size_t get_file_size( posix_handle::handle_t const file_handle )
 {
     struct stat file_info;
     BOOST_VERIFY( ::fstat( file_handle, &file_info ) == 0 );

Modified: sandbox/mmap/boost/mmap/mappble_objects/file/posix/flags.hpp
==============================================================================
--- /sandbox/mmap/boost/mmap/mappble_objects/posix_file/flags.hpp (original)
+++ sandbox/mmap/boost/mmap/mappble_objects/file/posix/flags.hpp 2011-08-21 05:17:22 EDT (Sun, 21 Aug 2011)
@@ -13,7 +13,6 @@
 ///
 ////////////////////////////////////////////////////////////////////////////////
 //------------------------------------------------------------------------------
-
 #ifndef flags_hpp__0F422517_D9AA_4E3F_B3E4_B139021D068E
 #define flags_hpp__0F422517_D9AA_4E3F_B3E4_B139021D068E
 #pragma once

Modified: sandbox/mmap/boost/mmap/mappble_objects/file/posix/flags.inl
==============================================================================
--- /sandbox/mmap/boost/mmap/mappble_objects/posix_file/flags.inl (original)
+++ sandbox/mmap/boost/mmap/mappble_objects/file/posix/flags.inl 2011-08-21 05:17:22 EDT (Sun, 21 Aug 2011)
@@ -15,7 +15,7 @@
 //------------------------------------------------------------------------------
 #include "flags.hpp"
 
-#include "../../detail/impl_inline.hpp"
+#include "../../../detail/impl_inline.hpp"
 
 #include "boost/assert.hpp"
 

Deleted: /sandbox/mmap/boost/mmap/mappble_objects/posix_file/handle.hpp
==============================================================================
--- /sandbox/mmap/boost/mmap/mappble_objects/posix_file/handle.hpp 2011-08-21 05:17:22 EDT (Sun, 21 Aug 2011)
+++ (empty file)
@@ -1,89 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-///
-/// \file handle.hpp
-/// ----------------
-///
-/// Copyright (c) Domagoj Saric 2010.-2011.
-///
-/// Use, modification and distribution is subject to the Boost Software License, Version 1.0.
-/// (See accompanying file LICENSE_1_0.txt or copy at
-/// http://www.boost.org/LICENSE_1_0.txt)
-///
-/// For more information, see http://www.boost.org
-///
-////////////////////////////////////////////////////////////////////////////////
-//------------------------------------------------------------------------------
-#ifndef handle_hpp__63113526_C3F1_46DC_850E_D8D8C62031DB
-#define handle_hpp__63113526_C3F1_46DC_850E_D8D8C62031DB
-#pragma once
-//------------------------------------------------------------------------------
-#include "boost/config.hpp"
-
-#ifdef BOOST_MSVC
- #include "../win32_file/handle.hpp"
-#endif
-
-#include "boost/assert.hpp"
-#include "boost/noncopyable.hpp"
-
-#include <cstddef>
-//------------------------------------------------------------------------------
-namespace boost
-{
-//------------------------------------------------------------------------------
-namespace mmap
-{
-//------------------------------------------------------------------------------
-
-struct posix_file_flags;
-
-namespace guard
-{
-//------------------------------------------------------------------------------
-
-class posix_handle
-#ifdef BOOST_MSVC
- : noncopyable
-#endif // BOOST_MSVC
-{
-public:
- typedef int handle_t;
- typedef posix_file_flags flags;
-
- explicit posix_handle( handle_t );
- #ifndef BOOST_MSVC
- posix_handle( posix_handle const & );
- #endif // BOOST_MSVC
-
- #ifdef BOOST_MSVC
- explicit posix_handle( windows_handle::handle_t );
- #endif // _WIN32
-
- ~posix_handle();
-
- handle_t const & handle() const { return handle_; }
-
-private:
- handle_t const handle_;
-};
-
-//------------------------------------------------------------------------------
-} // namespace guard
-
-guard::posix_handle create_file( char const * file_name, guard::posix_handle::flags const & );
-guard::posix_handle create_file( char const * file_name, guard::posix_handle::flags const &, unsigned int desired_size );
-
-bool set_file_size( guard::posix_handle::handle_t, std::size_t desired_size );
-std::size_t get_file_size( guard::posix_handle::handle_t );
-
-//------------------------------------------------------------------------------
-} // namespace mmap
-//------------------------------------------------------------------------------
-} // namespace boost
-//------------------------------------------------------------------------------
-
-#ifdef BOOST_MMAP_HEADER_ONLY
- #include "handle.inl"
-#endif
-
-#endif // handle_hpp

Deleted: /sandbox/mmap/boost/mmap/mappble_objects/posix_file/handle.inl
==============================================================================
--- /sandbox/mmap/boost/mmap/mappble_objects/posix_file/handle.inl 2011-08-21 05:17:22 EDT (Sun, 21 Aug 2011)
+++ (empty file)
@@ -1,128 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-///
-/// \file handle.inl
-/// ----------------
-///
-/// Copyright (c) Domagoj Saric 2010.-2011.
-///
-/// Use, modification and distribution is subject to the Boost Software License, Version 1.0.
-/// (See accompanying file LICENSE_1_0.txt or copy at
-/// http://www.boost.org/LICENSE_1_0.txt)
-///
-/// For more information, see http://www.boost.org
-///
-////////////////////////////////////////////////////////////////////////////////
-//------------------------------------------------------------------------------
-#include "handle.hpp"
-
-#include "flags.hpp"
-#include "../../detail/impl_inline.hpp"
-
-#include "boost/assert.hpp"
-
-#ifdef BOOST_MSVC
- #pragma warning ( disable : 4996 ) // "The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name."
- #include "io.h"
-#else
- #include "sys/mman.h" // mmap, munmap.
- #include "sys/stat.h"
- #include "sys/types.h" // struct stat.
- #include "unistd.h" // sysconf.
-#endif // BOOST_MSVC
-#include "errno.h"
-#include "fcntl.h"
-
-#ifndef _WIN32
- #ifdef __APPLE__
- #define BOOST_AUX_MMAP_POSIX_OR_OSX( posix, osx ) osx
- #else
- #define BOOST_AUX_MMAP_POSIX_OR_OSX( posix, osx ) posix
- #endif
-#endif
-
-//------------------------------------------------------------------------------
-namespace boost
-{
-//------------------------------------------------------------------------------
-namespace mmap
-{
-//------------------------------------------------------------------------------
-namespace guard
-{
-
-BOOST_IMPL_INLINE
-posix_handle::posix_handle( handle_t const handle )
- :
- handle_( handle )
-{}
-
-#ifdef BOOST_MSVC
-BOOST_IMPL_INLINE
-posix_handle::posix_handle( windows_handle::handle_t const native_handle )
- :
- handle_( ::_open_osfhandle( reinterpret_cast<intptr_t>( native_handle ), _O_APPEND ) )
-{
- if ( handle_ == -1 )
- {
- BOOST_VERIFY
- (
- ( ::CloseHandle( native_handle ) != false ) ||
- ( native_handle == 0 || native_handle == INVALID_HANDLE_VALUE )
- );
- }
-}
-#endif // BOOST_MSVC
-
-BOOST_IMPL_INLINE
-posix_handle::~posix_handle()
-{
- BOOST_VERIFY
- (
- ( ::close( handle() ) == 0 ) ||
- (
- ( handle() == -1 ) &&
- ( errno == EBADF )
- )
- );
-}
-
-//------------------------------------------------------------------------------
-} // guard
-
-
-BOOST_IMPL_INLINE
-guard::posix_handle create_file( char const * const file_name, posix_file_flags const & flags )
-{
- BOOST_ASSERT( file_name );
-
- int const current_mask( ::umask( 0 ) );
- int const file_handle ( ::open( file_name, flags.oflag, flags.pmode ) );
- //...zzz...investigate posix_fadvise, posix_madvise, fcntl for the system hints...
- BOOST_VERIFY( ::umask( current_mask ) == 0 );
-
- return guard::posix_handle( file_handle );
-}
-
-
-#ifndef BOOST_MSVC
-BOOST_IMPL_INLINE
-bool set_file_size( guard::posix_handle::handle_t const file_handle, std::size_t const desired_size )
-{
- return ::ftruncate( file_handle, desired_size ) != -1;
-}
-#endif // BOOST_MSVC
-
-
-BOOST_IMPL_INLINE
-std::size_t get_file_size( guard::posix_handle::handle_t const file_handle )
-{
- struct stat file_info;
- BOOST_VERIFY( ::fstat( file_handle, &file_info ) == 0 );
- return file_info.st_size;
-}
-
-//------------------------------------------------------------------------------
-} // mmap
-//------------------------------------------------------------------------------
-} // boost
-//------------------------------------------------------------------------------

Copied: sandbox/mmap/boost/mmap/mappble_objects/file/win32/file.hpp (from r73926, /sandbox/mmap/boost/mmap/mappble_objects/win32_file/handle.hpp)
==============================================================================
--- /sandbox/mmap/boost/mmap/mappble_objects/win32_file/handle.hpp (original)
+++ sandbox/mmap/boost/mmap/mappble_objects/file/win32/file.hpp 2011-08-21 05:17:22 EDT (Sun, 21 Aug 2011)
@@ -1,7 +1,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 ///
-/// \file handle.hpp
-/// ----------------
+/// \file file.hpp
+/// --------------
 ///
 /// Copyright (c) Domagoj Saric 2010.-2011.
 ///
@@ -13,12 +13,11 @@
 ///
 ////////////////////////////////////////////////////////////////////////////////
 //------------------------------------------------------------------------------
-#ifndef handle_hpp__1CEA6D65_D5C0_474E_833D_2CE927A1C74D
-#define handle_hpp__1CEA6D65_D5C0_474E_833D_2CE927A1C74D
+#ifndef file_hpp__FB482005_18D9_4E3B_9193_A13DBFE88F45
+#define file_hpp__FB482005_18D9_4E3B_9193_A13DBFE88F45
 #pragma once
 //------------------------------------------------------------------------------
-#include "boost/assert.hpp"
-#include "boost/noncopyable.hpp"
+#include "../../../handles/win32/handle.hpp"
 
 #include <cstddef>
 //------------------------------------------------------------------------------
@@ -31,34 +30,10 @@
 
 struct win32_file_flags;
 
-namespace guard
-{
-//------------------------------------------------------------------------------
-
-class windows_handle : noncopyable
-{
-public:
- typedef void * handle_t;
-
- typedef win32_file_flags flags;
-
- explicit windows_handle( handle_t );
- ~windows_handle();
-
- handle_t const & handle() const { return handle_; }
-
-private:
- handle_t const handle_;
-};
-
-//------------------------------------------------------------------------------
-} // namespace guard
-
-guard::windows_handle create_file( char const * file_name, guard::windows_handle::flags const & );
-guard::windows_handle create_file( char const * file_name, guard::windows_handle::flags const &, unsigned int desired_size );
+windows_handle create_file( char const * file_name, win32_file_flags const & );
 
-bool set_file_size( guard::windows_handle::handle_t, std::size_t desired_size );
-std::size_t get_file_size( guard::windows_handle::handle_t );
+bool set_file_size( windows_handle::handle_t, std::size_t desired_size );
+std::size_t get_file_size( windows_handle::handle_t );
 
 //------------------------------------------------------------------------------
 } // namespace mmap
@@ -67,7 +42,7 @@
 //------------------------------------------------------------------------------
 
 #ifdef BOOST_MMAP_HEADER_ONLY
- #include "handle.inl"
+ #include "file.inl"
 #endif
 
-#endif // handle_hpp
+#endif // file_hpp

Copied: sandbox/mmap/boost/mmap/mappble_objects/file/win32/file.inl (from r73926, /sandbox/mmap/boost/mmap/mappble_objects/win32_file/handle.inl)
==============================================================================
--- /sandbox/mmap/boost/mmap/mappble_objects/win32_file/handle.inl (original)
+++ sandbox/mmap/boost/mmap/mappble_objects/file/win32/file.inl 2011-08-21 05:17:22 EDT (Sun, 21 Aug 2011)
@@ -1,7 +1,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 ///
-/// \file handle.inl
-/// ----------------
+/// \file file.inl
+/// --------------
 ///
 /// Copyright (c) Domagoj Saric 2010.-2011.
 ///
@@ -13,7 +13,7 @@
 ///
 ////////////////////////////////////////////////////////////////////////////////
 //------------------------------------------------------------------------------
-#include "handle.hpp"
+#include "file.hpp"
 
 #include "flags.hpp"
 #include "../../detail/impl_inline.hpp"
@@ -31,31 +31,9 @@
 namespace mmap
 {
 //------------------------------------------------------------------------------
-namespace guard
-{
-
-BOOST_IMPL_INLINE
-windows_handle::windows_handle( handle_t const handle )
- :
- handle_( handle )
-{}
-
-BOOST_IMPL_INLINE
-windows_handle::~windows_handle()
-{
- BOOST_VERIFY
- (
- ( ::CloseHandle( handle_ ) != false ) ||
- ( handle_ == 0 || handle_ == INVALID_HANDLE_VALUE )
- );
-}
-
-//------------------------------------------------------------------------------
-} // guard
-
 
 BOOST_IMPL_INLINE
-guard::windows_handle create_file( char const * const file_name, guard::windows_handle::flags const & flags )
+windows_handle create_file( char const * const file_name, win32_file_flags const & flags )
 {
     BOOST_ASSERT( file_name );
 
@@ -68,12 +46,12 @@
     );
     BOOST_ASSERT( ( file_handle == INVALID_HANDLE_VALUE ) || ( ::GetLastError() == NO_ERROR ) || ( ::GetLastError() == ERROR_ALREADY_EXISTS ) );
 
- return guard::native_handle( file_handle );
+ return windows_handle( file_handle );
 }
 
 
 BOOST_IMPL_INLINE
-bool set_file_size( guard::windows_handle::handle_t const file_handle, std::size_t const desired_size )
+bool set_file_size( windows_handle::handle_t const file_handle, std::size_t const desired_size )
 {
     // It is 'OK' to send null/invalid handles to Windows functions (they will
     // simply fail), this simplifies error handling (it is enough to go through
@@ -91,7 +69,7 @@
 
 
 BOOST_IMPL_INLINE
-std::size_t get_file_size( guard::windows_handle::handle_t const file_handle )
+std::size_t get_file_size( windows_handle::handle_t const file_handle )
 {
     DWORD const file_size( ::GetFileSize( file_handle, 0 ) );
     BOOST_ASSERT( ( file_size != INVALID_FILE_SIZE ) || ( file_handle == INVALID_HANDLE_VALUE ) || ( ::GetLastError() == NO_ERROR ) );

Deleted: /sandbox/mmap/boost/mmap/mappble_objects/win32_file/handle.hpp
==============================================================================
--- /sandbox/mmap/boost/mmap/mappble_objects/win32_file/handle.hpp 2011-08-21 05:17:22 EDT (Sun, 21 Aug 2011)
+++ (empty file)
@@ -1,73 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-///
-/// \file handle.hpp
-/// ----------------
-///
-/// Copyright (c) Domagoj Saric 2010.-2011.
-///
-/// Use, modification and distribution is subject to the Boost Software License, Version 1.0.
-/// (See accompanying file LICENSE_1_0.txt or copy at
-/// http://www.boost.org/LICENSE_1_0.txt)
-///
-/// For more information, see http://www.boost.org
-///
-////////////////////////////////////////////////////////////////////////////////
-//------------------------------------------------------------------------------
-#ifndef handle_hpp__1CEA6D65_D5C0_474E_833D_2CE927A1C74D
-#define handle_hpp__1CEA6D65_D5C0_474E_833D_2CE927A1C74D
-#pragma once
-//------------------------------------------------------------------------------
-#include "boost/assert.hpp"
-#include "boost/noncopyable.hpp"
-
-#include <cstddef>
-//------------------------------------------------------------------------------
-namespace boost
-{
-//------------------------------------------------------------------------------
-namespace mmap
-{
-//------------------------------------------------------------------------------
-
-struct win32_file_flags;
-
-namespace guard
-{
-//------------------------------------------------------------------------------
-
-class windows_handle : noncopyable
-{
-public:
- typedef void * handle_t;
-
- typedef win32_file_flags flags;
-
- explicit windows_handle( handle_t );
- ~windows_handle();
-
- handle_t const & handle() const { return handle_; }
-
-private:
- handle_t const handle_;
-};
-
-//------------------------------------------------------------------------------
-} // namespace guard
-
-guard::windows_handle create_file( char const * file_name, guard::windows_handle::flags const & );
-guard::windows_handle create_file( char const * file_name, guard::windows_handle::flags const &, unsigned int desired_size );
-
-bool set_file_size( guard::windows_handle::handle_t, std::size_t desired_size );
-std::size_t get_file_size( guard::windows_handle::handle_t );
-
-//------------------------------------------------------------------------------
-} // namespace mmap
-//------------------------------------------------------------------------------
-} // namespace boost
-//------------------------------------------------------------------------------
-
-#ifdef BOOST_MMAP_HEADER_ONLY
- #include "handle.inl"
-#endif
-
-#endif // handle_hpp

Deleted: /sandbox/mmap/boost/mmap/mappble_objects/win32_file/handle.inl
==============================================================================
--- /sandbox/mmap/boost/mmap/mappble_objects/win32_file/handle.inl 2011-08-21 05:17:22 EDT (Sun, 21 Aug 2011)
+++ (empty file)
@@ -1,105 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-///
-/// \file handle.inl
-/// ----------------
-///
-/// Copyright (c) Domagoj Saric 2010.-2011.
-///
-/// Use, modification and distribution is subject to the Boost Software License, Version 1.0.
-/// (See accompanying file LICENSE_1_0.txt or copy at
-/// http://www.boost.org/LICENSE_1_0.txt)
-///
-/// For more information, see http://www.boost.org
-///
-////////////////////////////////////////////////////////////////////////////////
-//------------------------------------------------------------------------------
-#include "handle.hpp"
-
-#include "flags.hpp"
-#include "../../detail/impl_inline.hpp"
-
-#include "boost/assert.hpp"
-
-#ifndef WIN32_LEAN_AND_MEAN
- #define WIN32_LEAN_AND_MEAN
-#endif // WIN32_LEAN_AND_MEAN
-#include "windows.h"
-//------------------------------------------------------------------------------
-namespace boost
-{
-//------------------------------------------------------------------------------
-namespace mmap
-{
-//------------------------------------------------------------------------------
-namespace guard
-{
-
-BOOST_IMPL_INLINE
-windows_handle::windows_handle( handle_t const handle )
- :
- handle_( handle )
-{}
-
-BOOST_IMPL_INLINE
-windows_handle::~windows_handle()
-{
- BOOST_VERIFY
- (
- ( ::CloseHandle( handle_ ) != false ) ||
- ( handle_ == 0 || handle_ == INVALID_HANDLE_VALUE )
- );
-}
-
-//------------------------------------------------------------------------------
-} // guard
-
-
-BOOST_IMPL_INLINE
-guard::windows_handle create_file( char const * const file_name, guard::windows_handle::flags const & flags )
-{
- BOOST_ASSERT( file_name );
-
- HANDLE const file_handle
- (
- ::CreateFileA
- (
- file_name, flags.desired_access, flags.share_mode, 0, flags.creation_disposition, flags.flags_and_attributes, 0
- )
- );
- BOOST_ASSERT( ( file_handle == INVALID_HANDLE_VALUE ) || ( ::GetLastError() == NO_ERROR ) || ( ::GetLastError() == ERROR_ALREADY_EXISTS ) );
-
- return guard::native_handle( file_handle );
-}
-
-
-BOOST_IMPL_INLINE
-bool set_file_size( guard::windows_handle::handle_t const file_handle, std::size_t const desired_size )
-{
- // It is 'OK' to send null/invalid handles to Windows functions (they will
- // simply fail), this simplifies error handling (it is enough to go through
- // all the logic, inspect the final result and then throw on error).
- DWORD const new_size( ::SetFilePointer( file_handle, desired_size, 0, FILE_BEGIN ) );
- BOOST_ASSERT( ( new_size == desired_size ) || ( file_handle == INVALID_HANDLE_VALUE ) );
- ignore_unused_variable_warning( new_size );
-
- BOOL const success( ::SetEndOfFile( file_handle ) );
-
- BOOST_VERIFY( ( ::SetFilePointer( file_handle, 0, 0, FILE_BEGIN ) == 0 ) || ( file_handle == INVALID_HANDLE_VALUE ) );
-
- return success != false;
-}
-
-
-BOOST_IMPL_INLINE
-std::size_t get_file_size( guard::windows_handle::handle_t const file_handle )
-{
- DWORD const file_size( ::GetFileSize( file_handle, 0 ) );
- BOOST_ASSERT( ( file_size != INVALID_FILE_SIZE ) || ( file_handle == INVALID_HANDLE_VALUE ) || ( ::GetLastError() == NO_ERROR ) );
- return file_size;
-}
-
-//------------------------------------------------------------------------------
-} // mmap
-//------------------------------------------------------------------------------
-} // boost
-//------------------------------------------------------------------------------

Modified: sandbox/mmap/boost/mmap/mapped_view.hpp
==============================================================================
--- sandbox/mmap/boost/mmap/mapped_view.hpp (original)
+++ sandbox/mmap/boost/mmap/mapped_view.hpp 2011-08-21 05:17:22 EDT (Sun, 21 Aug 2011)
@@ -18,10 +18,10 @@
 #pragma once
 //------------------------------------------------------------------------------
 //...zzz...
-#include "mappble_objects/file/handle.hpp"
-#include "mappble_objects/posix_file/handle.hpp"
+#include "mappble_objects/file/file.hpp"
+#include "mappble_objects/file/posix/file.hpp"
 #ifdef _WIN32
-#include "mappble_objects/win32_file/handle.hpp"
+#include "mappble_objects/file/win32/file.hpp"
 #endif // _WIN32
 
 #include "boost/assert.hpp"
@@ -165,7 +165,7 @@
 public: // Factory methods.
     static mapped_view_reference map
     (
- guard::native_handle_t,
+ native_handle_t,
         mapping_flags const &,
         std::size_t desired_size = 0,
         std::size_t offset = 0
@@ -194,10 +194,10 @@
 public: // Factory methods.
     static mapped_view_reference map
     (
- guard::native_handle_t object_handle,
- std::size_t desired_size = 0,
- std::size_t offset = 0,
- bool map_for_code_execution = false
+ native_handle_t object_handle,
+ std::size_t desired_size = 0,
+ std::size_t offset = 0,
+ bool map_for_code_execution = false
     );
 
 private:
@@ -263,21 +263,21 @@
 template <typename Handle>
 struct is_mappable : mpl::false_ {};
 
-template <> struct is_mappable<char *> : mpl::true_ {};
-template <> struct is_mappable<char const *> : mpl::true_ {};
-template <> struct is_mappable<FILE *> : mpl::true_ {};
-template <> struct is_mappable<guard::posix_handle::handle_t > : mpl::true_ {};
+template <> struct is_mappable<char *> : mpl::true_ {};
+template <> struct is_mappable<char const *> : mpl::true_ {};
+template <> struct is_mappable<FILE *> : mpl::true_ {};
+template <> struct is_mappable<posix_handle::handle_t > : mpl::true_ {};
 #ifdef _WIN32
-template <> struct is_mappable<wchar_t *> : mpl::true_ {};
-template <> struct is_mappable<wchar_t const *> : mpl::true_ {};
-template <> struct is_mappable<guard::windows_handle::handle_t > : mpl::true_ {};
+template <> struct is_mappable<wchar_t *> : mpl::true_ {};
+template <> struct is_mappable<wchar_t const *> : mpl::true_ {};
+template <> struct is_mappable<windows_handle::handle_t > : mpl::true_ {};
 #endif // _WIN32
 
 
 template <>
 mapped_view_reference<unsigned char> mapped_view_reference<unsigned char>::map
 (
- guard::native_handle_t,
+ native_handle_t,
     mapping_flags const &,
     std::size_t desired_size,
     std::size_t offset
@@ -286,10 +286,10 @@
 template <>
 mapped_view_reference<unsigned char const> mapped_view_reference<unsigned char const>::map
 (
- guard::native_handle_t object_handle,
- std::size_t desired_size,
- std::size_t offset,
- bool map_for_code_execution
+ native_handle_t object_handle,
+ std::size_t desired_size,
+ std::size_t offset,
+ bool map_for_code_execution
 );
 
 

Modified: sandbox/mmap/boost/mmap/mapped_view.inl
==============================================================================
--- sandbox/mmap/boost/mmap/mapped_view.inl (original)
+++ sandbox/mmap/boost/mmap/mapped_view.inl 2011-08-21 05:17:22 EDT (Sun, 21 Aug 2011)
@@ -107,10 +107,10 @@
 template <> BOOST_IMPL_INLINE
 mapped_view_reference<unsigned char> mapped_view_reference<unsigned char>::map
 (
- guard::native_handle_t const object_handle,
- mapping_flags const & flags,
- std::size_t const desired_size,
- std::size_t const offset
+ native_handle_t const object_handle,
+ mapping_flags const & flags,
+ std::size_t const desired_size,
+ std::size_t const offset
 )
 {
     typedef mapped_view_reference<unsigned char>::iterator iterator_t;
@@ -128,7 +128,7 @@
     // CreateFileMapping accepts INVALID_HANDLE_VALUE as valid input but only if
     // the size parameter is not null.
     large_integer.QuadPart = desired_size;
- guard::windows_handle const mapping
+ windows_handle const mapping
     (
         ::CreateFileMapping( object_handle, 0, flags.create_mapping_flags, large_integer.HighPart, large_integer.LowPart, 0 )
     );
@@ -176,10 +176,10 @@
 template <> BOOST_IMPL_INLINE
 mapped_view_reference<unsigned char const> mapped_view_reference<unsigned char const>::map
 (
- guard::native_handle_t const object_handle,
- std::size_t const desired_size,
- std::size_t const offset,
- bool const map_for_code_execution
+ native_handle_t const object_handle,
+ std::size_t const desired_size,
+ std::size_t const offset,
+ bool const map_for_code_execution
 )
 {
     return mapped_view_reference<unsigned char>::map
@@ -200,8 +200,8 @@
 BOOST_IMPL_INLINE
 basic_mapped_view_ref map_file( char const * const file_name, std::size_t desired_size )
 {
- typedef guard::native_handle::flags file_flags;
- guard::native_handle const file_handle
+ typedef native_file_flags file_flags;
+ native_handle const file_handle
     (
         create_file
         (
@@ -240,8 +240,8 @@
 BOOST_IMPL_INLINE
 basic_mapped_read_only_view_ref map_read_only_file( char const * const file_name )
 {
- typedef guard::native_handle::flags file_flags;
- guard::native_handle const file_handle
+ typedef native_file_flags file_flags;
+ native_handle const file_handle
     (
         create_file
         (


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk