update moveToFbString()'s handling of flags_
[folly.git] / folly / MemoryMapping.h
index 244727b4a6db12ff46249ea7a78c0c632eeaee01..3a355892ed01397808a43e1ee9248ca95a941ac8 100644 (file)
@@ -87,7 +87,6 @@ class MemoryMapping : boost::noncopyable {
    */
   template<class T>
   Range<const T*> asRange() const {
-    CHECK(mapStart_);
     size_t count = data_.size() / sizeof(T);
     return Range<const T*>(static_cast<const T*>(
                              static_cast<const void*>(data_.data())),
@@ -104,14 +103,16 @@ class MemoryMapping : boost::noncopyable {
   /**
    * Return the memory area where the file was mapped.
    */
-  ByteRange data() const {
-    return range();
+  StringPiece data() const {
+    return asRange<const char>();
   }
 
   bool mlocked() const {
     return locked_;
   }
 
+  int fd() const { return file_.fd(); }
+
  protected:
   MemoryMapping();
 
@@ -143,7 +144,6 @@ class WritableMemoryMapping : public MemoryMapping {
    */
   template<class T>
   Range<T*> asWritableRange() const {
-    CHECK(mapStart_);
     size_t count = data_.size() / sizeof(T);
     return Range<T*>(static_cast<T*>(
                        static_cast<void*>(data_.data())),