ZestCode
 
Loading...
Searching...
No Matches
gid.h File Reference
#include <stdint.h>
#include "api.h"

Go to the source code of this file.

Classes

struct  gid_metadata
 

Macros

#define UINT32_WIDTH   32
 
#define gid_size_to_words(size)
 

Functions

void gid_init (struct gid_metadata *const metadata)
 
uint32_t gid_alloc (struct gid_metadata *const metadata)
 
void gid_free (struct gid_metadata *const metadata, uint32_t id)
 
bool gid_check (struct gid_metadata *metadata, uint32_t id)
 

Detailed Description

Globally unique Identifer facility header

See common/gid.c for discussion

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

Macro Definition Documentation

◆ gid_size_to_words

#define gid_size_to_words ( size)
Value:
(((size) + UINT32_WIDTH - 1) / UINT32_WIDTH)

convert the maximum number of gids into a number of words needed to store the bitmap

Function Documentation

◆ gid_alloc()

uint32_t gid_alloc ( struct gid_metadata *const metadata)

Allocates a gid from the gid structure and returns it.

Parameters
[in]metadataThe gid_metadata to record to the gid structure
Returns
The gid, or 0 if there are no more gids left.

◆ gid_check()

bool gid_check ( struct gid_metadata * metadata,
uint32_t id )

Checks if the gid specified is allocated.

Parameters
[in]metadataThe gid_metadata to check
idThe gid value indicating the metadata's position in the gid structure
Returns
True if the given metadata/id combo is present in the gid structure, false otherwise.

◆ gid_free()

void gid_free ( struct gid_metadata *const metadata,
uint32_t id )

Frees the gid specified from the structure.

Parameters
[in]metadataThe gid_metadata to free from the gid structure
idThe gid value indicating the metadata's position in the gid structure

◆ gid_init()

void gid_init ( struct gid_metadata *const metadata)

Initializes a gid_metadata structure by "freeing" all IDs in the bitmap

Parameters
[in]metadataThe gid_metadata structure to initialize