~n-muench/ubuntu/oneiric/open-vm-tools/open-vm-tools.fix-836277

« back to all changes in this revision

Viewing changes to modules/linux/vsock/include/vmci_infrastructure.h

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Baumann
  • Date: 2008-10-23 15:32:00 UTC
  • mfrom: (1.1.2 upstream) (2.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20081023153200-gc1bfx89hj35c799
Tags: 2008.10.10-123053-2
* Correcting typo in dh_installinit call.
* Downgrading depends on module-assistant to recommends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *********************************************************/
18
18
 
19
19
/*
20
 
 * vmci_infrastructure.h -- 
21
 
 * 
 
20
 * vmci_infrastructure.h --
 
21
 *
22
22
 *      This file implements the VMCI infrastructure.
23
 
 */ 
24
 
 
 
23
 */
 
24
 
25
25
#ifndef _VMCI_INFRASTRUCTURE_H_
26
26
#define _VMCI_INFRASTRUCTURE_H_
27
27
 
66
66
 *
67
67
 *  VMCI_Hash --
68
68
 *
69
 
 *     Hash function used by the Simple Datagram API. Based on the djb2 
 
69
 *     Hash function used by the Simple Datagram API. Based on the djb2
70
70
 *     hash function by Dan Bernstein.
71
 
 * 
 
71
 *
72
72
 *  Result:
73
73
 *     Returns guest call size.
74
 
 *     
 
74
 *
75
75
 *  Side effects:
76
76
 *     None.
77
77
 *
82
82
VMCI_Hash(VMCIHandle handle, // IN
83
83
          unsigned size)     // IN
84
84
{
85
 
   int i;
86
 
   int hash = 5381;
87
 
   uint64 handleValue = (uint64)handle.resource << 32 | handle.context;
 
85
   unsigned     i;
 
86
   int          hash        = 5381;
 
87
   const uint64 handleValue = QWORD(handle.resource, handle.context);
88
88
 
89
89
   for (i = 0; i < sizeof handle; i++) {
90
 
      hash = ((hash << 5) + hash) + (uint8)(handleValue >> (i*8));
 
90
      hash = ((hash << 5) + hash) + (uint8)(handleValue >> (i * 8));
91
91
   }
92
 
   return hash & (size -1);
 
92
   return hash & (size - 1);
93
93
}
94
94
 
95
95
#endif // _VMCI_INFRASTRUCTURE_H_