Files
SystemPaw3/paw/stos/head/ob/object.h
T
Chloe M. 283547058e stos: ob: Implement ObCreateObject() helper
The ObCreateObject() is responsible for creating and allocating new
objects, we'll need this to even have directories and such.

Signed-off-by: Chloe M. <chloe@mensia.org>
2026-06-25 00:09:54 +00:00

73 lines
1.4 KiB
C

/*
* Copyright (c) 2026, Chloe M.
* Provided under the BSD-3 clause.
*
* Description: Object manager
* Author: Chloe M.
*/
#ifndef _OB_OBJECT_H_
#define _OB_OBJECT_H_ 1
#include <stapi/status.h>
#include <stdef.h>
/* Maximum size of system object names */
#define OBJECT_NAMESZ 32
/* Slut tag for pool allocations */
#define OBJECT_POOL_TAG 'OB'
/*
* Represents valid object types
*
* @OBJECT_TYPE_DIRECTORY: Object is directory
*/
typedef enum {
OBJECT_TYPE_DIRECTORY
} OBJECT_TYPE;
/*
* Represents a Slut Technology system object
*
* @Name: Name of object
* @RefCount: Object reference count
* @Type: Object type
* @Data: Object data
*/
typedef struct {
CHAR Name[OBJECT_NAMESZ];
ULONG RefCount;
OBJECT_TYPE Type;
VOID *Data;
} ST_OBJECT;
/*
* Represents a directory object containing one or more
* objects.
*
* @First: First entry in object directory
* @Last: Last entry in object directory
* @EntryCount: Number of entries in directory
*/
typedef struct {
ST_OBJECT *First;
ST_OBJECT *Last;
USIZE EntryCount;
} OBJECT_DIRECTORY;
/*
* Allocate and create a new objec
*
* @Name: Object name
* @Type: Object type
* @Data: Actual backing data
* @Result: Result is written here
*/
ST_STATUS ObCreateObject(
const CHAR *Name, OBJECT_TYPE Type,
VOID *Data, ST_OBJECT **Result
);
#endif /* !_OB_OBJECT_H_ */