2018-02-12 03:26:03 +00:00
|
|
|
#ifndef _KERNEL_RF_REF_H_
|
|
|
|
#define _KERNEL_RF_REF_H_
|
2017-02-01 03:26:08 +00:00
|
|
|
|
2018-01-26 08:43:22 +00:00
|
|
|
#include "type.h"
|
2018-02-12 03:26:03 +00:00
|
|
|
#include "status.h"
|
2017-02-23 02:36:00 +00:00
|
|
|
|
|
|
|
typedef uint32_t handle_t;
|
2017-02-01 03:26:08 +00:00
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2018-02-18 04:06:57 +00:00
|
|
|
int32_t ref_count;
|
|
|
|
callback_func_t free_routine;
|
2017-02-01 03:26:08 +00:00
|
|
|
} ref_node_t;
|
|
|
|
|
|
|
|
#define K_HANDLE_BASE 0x80000000
|
|
|
|
|
|
|
|
//
|
|
|
|
// All functions are sx since users or kernel devs should not be
|
|
|
|
// specifying where the allocations take place
|
|
|
|
//
|
|
|
|
|
2018-02-07 05:42:59 +00:00
|
|
|
status_t KABI rf_reference_setup(void);
|
2017-02-01 03:26:08 +00:00
|
|
|
|
|
|
|
status_t KABI rf_reference_create(ref_node_t *ref,
|
|
|
|
callback_func_t free_func);
|
|
|
|
|
|
|
|
status_t KABI rf_reference_obj(ref_node_t *ref);
|
|
|
|
|
|
|
|
status_t KABI rf_dereference_obj(ref_node_t *ref);
|
|
|
|
|
|
|
|
// HANDLES
|
|
|
|
status_t KABI sx_open_obj_by_handle(handle_t handle, ref_node_t **out);
|
|
|
|
|
|
|
|
status_t KABI sx_create_handle(ref_node_t *ref, handle_t *out);
|
|
|
|
|
|
|
|
status_t KABI sx_close_handle(handle_t handle);
|
|
|
|
|
|
|
|
#endif
|