obj: add read() and write() object callbacks
This commit is contained in:
30
obj/object.c
30
obj/object.c
@@ -121,6 +121,36 @@ struct object *object_header(void *p)
|
||||
return obj;
|
||||
}
|
||||
|
||||
kern_status_t object_read(struct object *obj, void *p, size_t max,
|
||||
size_t *nr_read, socks_flags_t flags)
|
||||
{
|
||||
kern_status_t status = KERN_UNSUPPORTED;
|
||||
|
||||
if (obj->ob_type->ob_ops.read) {
|
||||
status = obj->ob_type->ob_ops.read(obj, p, &max, flags);
|
||||
} else {
|
||||
max = 0;
|
||||
}
|
||||
|
||||
if (nr_read) {
|
||||
*nr_read = max;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
kern_status_t object_write(struct object *obj, const void *p, size_t max,
|
||||
size_t *nr_written, socks_flags_t flags)
|
||||
{
|
||||
kern_status_t status = KERN_UNSUPPORTED;
|
||||
|
||||
if (obj->ob_type->ob_ops.write) {
|
||||
status = obj->ob_type->ob_ops.write(obj, p, &max, flags);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
kern_status_t object_get_child_named(struct object *obj, const char *name, struct object **out)
|
||||
{
|
||||
kern_status_t status = KERN_UNSUPPORTED;
|
||||
|
||||
Reference in New Issue
Block a user