libocpf/ocpf_context.c File Reference

OCPF context API. More...

#include "libocpf/ocpf.h"

Functions

struct ocpf_context * ocpf_context_add (struct ocpf *ocpf_ctx, const char *filename, uint32_t *context_id, uint8_t flags, bool *existing)
int ocpf_context_delete (struct ocpf *ocpf_ctx, struct ocpf_context *ctx)
stat h stat h struct ocpf_context * ocpf_context_init (TALLOC_CTX *mem_ctx, const char *filename, uint8_t flags, uint32_t context_id)
struct ocpf_context * ocpf_context_search_by_context_id (struct ocpf_context *ctx, uint32_t context_id)
struct ocpf_context * ocpf_context_search_by_filename (struct ocpf_context *ctx, const char *filename)

Detailed Description

OCPF context API.


Function Documentation

struct ocpf_context* ocpf_context_add ( struct ocpf ocpf_ctx,
const char *  filename,
uint32_t *  context_id,
uint8_t  flags,
bool *  existing 
) [read]

Add an OCPF context to the list

Parameters:
ocpf_ctx pointer to the global ocpf context
filename pointer to the
context_id pointer to the context_id the function returns
flags Flags controlling how the OCPF should be opened
existing boolean returned by the function to specify if the context was already existing or not
Returns:
valid ocpf context pointer on success, otherwise NULL

References ocpf_context_init().

Referenced by ocpf_new_context().

int ocpf_context_delete ( struct ocpf ocpf_ctx,
struct ocpf_context *  ctx 
)

Delete an OCPF context

Parameters:
ocpf_ctx pointer to the global ocpf context
ctx pointer to the OCPF context to delete
Returns:
0 on success, 1 if there were still a ref_count, otherwise -1 on errors.

Referenced by ocpf_del_context().

stat h stat h struct ocpf_context* ocpf_context_init ( TALLOC_CTX *  mem_ctx,
const char *  filename,
uint8_t  flags,
uint32_t  context_id 
) [read]

Initialize a new OCPF context

Parameters:
mem_ctx pointer to the memory context
filename the OCPF filename used for this context
flags Flags controlling how the OCPF should be opened
context_id the identifier representing the context
context_id the context identifier to use for this context
Returns:
new allocated OCPF context on success, otherwise NULL

Referenced by ocpf_context_add().

struct ocpf_context* ocpf_context_search_by_context_id ( struct ocpf_context *  ctx,
uint32_t  context_id 
) [read]
struct ocpf_context* ocpf_context_search_by_filename ( struct ocpf_context *  ctx,
const char *  filename 
) [read]

Search a context given its filename

Parameters:
ctx pointer to the ocpf context list
filename the filename to use for search
Returns:
pointer to valid ocpf context on success, otherwise NULL

Creative Commons License
Creative Commons Attribution icon Creative Commons Share Alike icon
This content is licensed under the Creative Commons
Attribution ShareAlike License v. 3.0:
http://creativecommons.org/licenses/by-sa/3.0/