vms_tdb.c modifications

Dave Jones JONESD at er6s1.eng.ohio-state.edu
Thu Jun 26 13:13:53 GMT 2003


I did some further modifications to vms_tdb.c/tdb.h, available at
http://www.er6.eng.ohio-state.edu/~jonesd/samba/vms_tdb.zip.

Changes:

   - Increase the maximum record size to 2036 bytes.

   - Fixed a bug in the TDB_INTERNAL mode operation (only the [.locking]posix.c
     module appears to use an 'internal' tdb.

   - Save the last key as well as the last hash in the TDB_CONTEXT structure.
     The optimization in fetch() now checks the last key is the same as
     well as the last hash.

   - The TDB_DATA items returned by the external functions now point to
     dynamically allocated copies of the data rather have the dptr field point
     to internal data buffers.  The main samba code assumes the dptr field
     contains an address returned by malloc() and can free() or realloc it.

   - Redid the CLEAR_IF_FIRST handling, the initialization logic is
     now:
        
          Generate resource name (SMBTDB_'fname').

          if CLEAR_IF_FIRST then
	     lock resource with CR (concurrent read) mode lock.
             convert lock to PW (protected write) mode lock with NOQUEUE flag.
             if conversion succeeds then
                  zero the database.
             end
             convert lock to PR (protected read) mode. 
             
          else
             lock resource with PR (protected read) mode lock.

          end

      The idea is that the first person can get the PW mode lock because
      there is no contention.  Subsequent users will fail to get the PW
      mode lock and then the conversion to PR mode will force them to wait
      until the guy with the PW lock completes the file initialization (and
      lowers his lock to PR mode.  Passing through CR mode is probably
      superflous.

--------------------------------------------------------------------------
David L. Jones               |      Phone:    (614) 292-6929
Ohio State University        |      Internet:
140 W. 19th St. Rm. 231a     |               jonesd at er6s1.eng.ohio-state.edu
Columbus, OH 43210           |               vman+ at osu.edu

Disclaimer: I'm looking for marbles all day long.



More information about the samba-vms mailing list