From 7d5feb943f12f40e03bb7ecddb8c2407b6d5a9f2 Mon Sep 17 00:00:00 2001 From: "Justin C. Miller" Date: Thu, 3 Feb 2022 00:02:46 -0800 Subject: [PATCH] [kernel] Add handle badge to ctor/assignment Handles already had a field for badge, but did not touch it in the constructors or in assignment operators. --- src/kernel/objects/handle.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/kernel/objects/handle.h b/src/kernel/objects/handle.h index 0a58c78..9b07f4b 100644 --- a/src/kernel/objects/handle.h +++ b/src/kernel/objects/handle.h @@ -23,35 +23,35 @@ struct handle static_cast(obj ? obj->get_type() : kobject::type::none) << type_shift; } - inline handle() : id {j6_handle_invalid}, object {nullptr} {} + inline handle() : id {j6_handle_invalid}, badge {0}, object {nullptr} {} - inline handle(j6_handle_t in_id, kobject *in_obj, j6_cap_t caps) : - id {make_id(in_id, caps, in_obj)}, object {in_obj} { + inline handle(j6_handle_t in_id, kobject *in_obj, j6_cap_t caps, uint64_t in_badge = 0) : + id {make_id(in_id, caps, in_obj)}, badge {in_badge}, object {in_obj} { if (object) object->handle_retain(); } - inline handle(const handle &other) : - id {other.id}, object {other.object} { + inline handle(const handle &o) : + id {o.id}, badge {o.badge}, object {o.object} { if (object) object->handle_retain(); } - inline handle(handle &&other) : - id {other.id}, object {other.object} { - other.id = 0; - other.object = nullptr; + inline handle(handle &&o) : + id {o.id}, badge {o.badge}, object {o.object} { + o.id = 0; + o.object = nullptr; } - inline handle & operator=(const handle &other) { + inline handle & operator=(const handle &o) { if (object) object->handle_release(); - id = other.id; object = other.object; + id = o.id; badge = o.badge; object = o.object; if (object) object->handle_retain(); return *this; } - inline handle & operator=(handle &&other) { + inline handle & operator=(handle &&o) { if (object) object->handle_release(); - id = other.id; object = other.object; - other.id = 0; other.object = nullptr; + id = o.id; badge = o.badge; object = o.object; + o.id = 0; o.badge = 0; o.object = nullptr; return *this; }