obj: object header is no longer allocated automatically
This commit is contained in:
10
dev/core.c
10
dev/core.c
@@ -2,6 +2,8 @@
|
||||
#include <socks/object.h>
|
||||
#include <socks/device.h>
|
||||
|
||||
#define DEVICE_CAST(p) OBJECT_C_CAST(struct device, dev_base, &device_type, p)
|
||||
|
||||
static struct device *root_device = NULL;
|
||||
static struct object_type device_type = {
|
||||
.ob_name = "device",
|
||||
@@ -20,10 +22,10 @@ kern_status_t device_init(void)
|
||||
kern_status_t set_root_device(struct device *dev)
|
||||
{
|
||||
if (root_device) {
|
||||
object_deref(object_header(root_device));
|
||||
object_deref(&root_device->dev_base);
|
||||
}
|
||||
|
||||
object_ref(object_header(dev));
|
||||
object_ref(&dev->dev_base);
|
||||
root_device = dev;
|
||||
|
||||
return KERN_OK;
|
||||
@@ -35,6 +37,6 @@ struct device *device_alloc(void)
|
||||
if (!dev_object) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return object_data(dev_object);
|
||||
|
||||
return DEVICE_CAST(dev_object);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user