iPXE
blob.h File Reference

Openable data blobs. More...

#include <stdint.h>
#include <ipxe/interface.h>

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 FILE_SECBOOT (PERMITTED)
int blob_open (struct interface *xfer, const void *data, size_t len)
 Open data blob.

Detailed Description

Openable data blobs.

Definition in file blob.h.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )

◆ FILE_SECBOOT()

FILE_SECBOOT ( PERMITTED )

References data, and len.

◆ blob_open()

int blob_open ( struct interface * xfer,
const void * data,
size_t len )
extern

Open data blob.

Parameters
xferData transfer interface
dataData
lenLength of data
Return values
rcReturn status code

Definition at line 110 of file blob.c.

110 {
111 struct blob *blob;
112 void *copy;
113
114 /* Allocate and initialise structure */
115 blob = zalloc ( sizeof ( *blob ) + len );
116 if ( ! blob )
117 return -ENOMEM;
118 ref_init ( &blob->refcnt, NULL );
121 copy = ( ( ( void * ) blob ) + sizeof ( *blob ) );
122 blob->data = copy;
123 blob->len = len;
124 memcpy ( copy, data, len );
125
126 /* Attach parent interface, mortalise self, and return */
128 ref_put ( &blob->refcnt );
129 return 0;
130}
#define NULL
NULL pointer (VOID *).
Definition Base.h:321
static struct process_descriptor blob_process_desc
Data blob process descriptor.
Definition blob.c:99
static struct interface_descriptor blob_xfer_desc
Data blob interface descriptor.
Definition blob.c:95
ring len
Length.
Definition dwmac.h:226
uint8_t data[48]
Additional event data.
Definition ena.h:11
#define ENOMEM
Not enough space.
Definition errno.h:535
void * memcpy(void *dest, const void *src, size_t len) __nonnull
void intf_plug_plug(struct interface *a, struct interface *b)
Plug two object interfaces together.
Definition interface.c:108
static void intf_init(struct interface *intf, struct interface_descriptor *desc, struct refcnt *refcnt)
Initialise an object interface.
Definition interface.h:204
void * zalloc(size_t size)
Allocate cleared memory.
Definition malloc.c:662
static void process_init(struct process *process, struct process_descriptor *desc, struct refcnt *refcnt)
Initialise process and add to process list.
Definition process.h:162
#define ref_put(refcnt)
Drop reference to object.
Definition refcnt.h:107
#define ref_init(refcnt, free)
Initialise a reference counter.
Definition refcnt.h:65
An openable data blob.
Definition blob.c:45
struct refcnt refcnt
Reference count.
Definition blob.c:47
struct interface xfer
Data transfer interface.
Definition blob.c:49
struct process process
Download process.
Definition blob.c:51
const void * data
Data.
Definition blob.c:53
size_t len
Length of data.
Definition blob.c:55

References blob_process_desc, blob_xfer_desc, blob::data, data, ENOMEM, intf_init(), intf_plug_plug(), blob::len, len, memcpy(), NULL, blob::process, process_init(), ref_init, ref_put, blob::refcnt, blob::xfer, and zalloc().

Referenced by datauri_open().