-
Notifications
You must be signed in to change notification settings - Fork 1
/
alloc_request.go
46 lines (41 loc) · 2.12 KB
/
alloc_request.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package metadata
// AllocationRequestType is an enum that indicates the type of allocation that is being made.
// It is returned in AllocationRequest from CreateAllocationRequest
type AllocationRequestType uint32
const (
// AllocationRequestTLSF indicates that the allocation request was sourced from metadata.TLSFBlockMetadata
AllocationRequestTLSF AllocationRequestType = iota
// AllocationRequestUpperAddress indicates that the allocation request was sourced from metadata.LinearBlockMetadata
// and that it is an allocation for the upper side of a double stack
AllocationRequestUpperAddress
// AllocationRequestEndOf1st indicates that the allocation request was sourced from metadata.LinearBlockMetadata
// and that it is an allocation to be added to the end of the first memory vector
AllocationRequestEndOf1st
// AllocationRequestEndOf2nd indicates that the allocation request was sourced from metadata.LinearBlockMetadata
// and that it is an allocation to be added to the end of the second memory vector
AllocationRequestEndOf2nd
)
var allocationRequestMapping = map[AllocationRequestType]string{
AllocationRequestTLSF: "TLSF",
AllocationRequestUpperAddress: "UpperAddress",
AllocationRequestEndOf1st: "EndOf1st",
AllocationRequestEndOf2nd: "EndOf2nd",
}
func (t AllocationRequestType) String() string {
return allocationRequestMapping[t]
}
// AllocationRequest is a type returned from BlockMetadata.CreateAllocationRequest which indicates where and how
// the metadata intends to allocate new memory. This allocation can be applied to the actual memory pool consuming
// memutils, and then committed to the metadata with BlockMetadata.Alloc
type AllocationRequest struct {
// BlockAllocationHandle is a numeric handle used to identify individual allocations within the metadata
BlockAllocationHandle BlockAllocationHandle
// Size the total size of the allocation, maybe larger than what was originally requested
Size int
// Item is a Suballocation object indicating basic information about the allocation
Item Suballocation
// CustomData
CustomData uint32
AlgorithmData uint64
Type AllocationRequestType
}