slang-users mailing list

[2005 Date Index] [2005 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: [slang-users] slang2 pre-release snapshot 4 available


Cool, just in time for more work I am doing on SLAG ...


Anyway, OT question for the group, since the announcement has
something about HASH'ing ...

Given the below structure's and definitions ....

Does anyone KNOW or can figure out what kind of hashing algorithms this is
using? I DO KNOW that _hashsize IS a parameter one must put in when creating these
files and it needs to be a prime number => 113.

------------------------------------------------------------------------

typedef struct
{
        unsign short    _padword;       /* space no longer used */
        unsign short    _opens;         /* number of opens on this db */
        byte    _openlock;              /* file opens have been locked out */
        byte    _flags;                 /* flag bits                 */
        byte    _fia_align[2];  /* 32-bit alignment                     */
        long    _reccount;              /* number of bytes in record */
        long    _hashsize;              /* current number of hash table slots */
                                /* in low 3 bytes, high byte determines  */
                                /* which of several functions to use     */
        DBOFF   _hashstart;             /* offset to the hash table      */
        long    _minsize;               /* Minimum record size       */
        long    _overpct;               /* Minimum percentage overhead */
        struct {
                long    size;           /* Max size on this list     */
                DBOFF   offset;         /* Offset to the first block */
        }       _freestart[DB_FREELISTS];       /* An array of Freelists     */
}   _db_fia;
/*
 *      _db_block maps a generalized block in a db
 */

typedef struct
{
        long    _blocklen;              /* current block length (bytes) */
        long    _bytesused;             /* number of bytes in use       */
        DBOFF   _next;                  /* -> to next block, or NULL    */
        DBOFF   _prev;                  /* -> to previous block, or NULL */
        byte    _type;                  /* type of this block           */
        byte    _reclock;               /* flag set if record is locked */
        unsign short    _rdcount;       /* number of non-lock reads     */
        char    _username[12];          /* user who locks the record */
        char    _reserved[4];
}   _db_block;

/*
 *      _db_data maps a block header plus a portion of the data area
 */

typedef struct
{
        long    _blocklen;              /* current block length (bytes) */
        long    _bytesused;             /* number of bytes in use       */
        DBOFF   _next;                  /* -> next block, or NULL       */
        DBOFF   _prev;                  /* -> previous block, or NULL   */
        byte    _type;                  /* record type (locked or unlocked) */
        byte    _reclock;               /* flag set if record is locked */
        unsign short    _rdcount;       /* number of non-lock reads     */
        char    _username[12];          /* user who locks the record */
        char    _reserved[4];
        char    _recdata[DB_MAXKEY];    /* a portion of the data        */
}   _db_data;

/*
 *      Data Record and Freelist Entry types:
 */

# define        EMPTY           1       /* this entry is not in use     */
                                        /* iff no one is reading it.    */
# define        DATA            2       /* contains live data           */
# define        HASHSTORE       5       /* this entry is a hash table   */

/*
 *      poly-functional hashing stuff
 */

# define HASHAPART(n)   ((int) ((n) >> 24) & 0x00ff)
# define HASHSPART(n)   ((n) & 0x00ffffff)
# define HASHSIZE(f)    HASHSPART((f)->_hashsize)
# define HASHPARM(s,a)  (HASHSPART(s) | (((long)(a)) << 24))

# define OLDHASH        0
# define NEWHASH        1

--------------------------------------------------------------------------------



--
Ben Duncan   - VersAccounting Software LLC 336 Elton Road  Jackson MS, 39212
"Never attribute to malice, that which can be adequately explained by stupidity"
       - Hanlon's Razor


_______________________________________________
To unsubscribe, visit http://jedsoft.org/slang/mailinglists.html


[2005 date index] [2005 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]