summaryrefslogtreecommitdiff
path: root/lib/resource.c
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2021-03-30 16:03:33 +0200
committerMaria Matejka <mq@ucw.cz>2021-03-30 21:56:08 +0200
commita9938b179203a4d5c54eae6c814bfa8766f4fde0 (patch)
treeda8e01b5e1c5c2c2f5f0676a28c18f51f24def26 /lib/resource.c
parent4635314cefd55aaa2a0146b6722df55e7efba4b8 (diff)
Resources: added mb_move() to complement rmove() for memory blocks
Diffstat (limited to 'lib/resource.c')
-rw-r--r--lib/resource.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/resource.c b/lib/resource.c
index 5589373e..4c4b92ec 100644
--- a/lib/resource.c
+++ b/lib/resource.c
@@ -393,6 +393,21 @@ mb_realloc(void *m, unsigned size)
return b->data;
}
+/**
+ * mb_move - move a memory block
+ * @m: memory block
+ * @p: target pool
+ *
+ * mb_move() moves the given memory block to another pool in the same way
+ * as rmove() moves a plain resource.
+ */
+void
+mb_move(void *m, pool *p)
+{
+ struct mblock *b = SKIP_BACK(struct mblock, data, m);
+ rmove(b, p);
+}
+
/**
* mb_free - free a memory block