BIND 10 #2850: Define and implement ZoneTableSegmentMapped

BIND 10 Development do-not-reply at isc.org
Fri May 10 16:54:47 UTC 2013


#2850: Define and implement ZoneTableSegmentMapped
-------------------------------------+-------------------------------------
            Reporter:  jinmei        |                        Owner:  muks
                Type:  task          |                       Status:
            Priority:  medium        |  reviewing
           Component:  data source   |                    Milestone:
            Keywords:                |  Sprint-20130514
           Sensitive:  0             |                   Resolution:
         Sub-Project:  DNS           |                 CVSS Scoring:
Estimated Difficulty:  5             |              Defect Severity:  N/A
         Total Hours:  0             |  Feature Depending on Ticket:
                                     |  shared memory data source
                                     |          Add Hours to Ticket:  0
                                     |                    Internal?:  0
-------------------------------------+-------------------------------------

Comment (by jinmei):

 one more note: I've noticed another issue with
 `MemorySegmentMapped::setNamedAddress(Impl)`.  If the underlying
 segment grows inside this method, the given pointer can be invalidated
 by the time the storage is allocated.

 So, I think we need some more trick inside `MemorySegmentMapped`:

 - create a reserved, internal named address at the time of
   construction (in the read-write mode).  assume it's named
   "_reserved_set_named_address".
 - in setNamedAddressImpl(), first store the given address in the
   reserved storage.  when the storage for the given name is allocated,
   extract the address using the reserved name and set it with the
   created name:
 {{{#!cpp
 MemorySegmentMapped::setNamedAddressImpl(const char* name, void* addr) {
     // validation

     offset_ptr<void>* rsvd_storage =
         impl_->base_sgmt_->find<offset_ptr<void> >(
             "_reserved_set_named_address").first;
     assert(rsvd_storage);
     *rsvd_storage = addr;

     bool grown = false;
     while (true) {
         offset_ptr<void>* storage =
             impl_->base_sgmt_->find_or_construct<offset_ptr<void> >(
                 name, std::nothrow)();
         if (storage) {
             offset_ptr<void>* rsvd_storage =
                 impl_->base_sgmt_->find<offset_ptr<void> >(
                     "_reserved_set_named_address").first;
             assert(rsvd_storage);
             *storage = *rsvd_storage;
             return (grown);
         }

         impl_->growSegment();
         grown = true;
     }
 }
 }}}

 We may also want to specify some set of names (e.g. names beginning
 with _)are officially reserved and shouldn't be used by apps.

-- 
Ticket URL: <http://bind10.isc.org/ticket/2850#comment:20>
BIND 10 Development <http://bind10.isc.org>
BIND 10 Development


More information about the bind10-tickets mailing list