···194194 * @what: What is being allocated (for error logging)195195 * @ptr: A pointer to hold the allocated memory196196 *197197- * Return: UDS_SUCCESS or an error code197197+ * Return: VDO_SUCCESS or an error code198198 */199199int vdo_allocate_memory(size_t size, size_t align, const char *what, void *ptr)200200{···216216 unsigned long start_time;217217 void *p = NULL;218218219219- if (ptr == NULL)220220- return UDS_INVALID_ARGUMENT;219219+ if (unlikely(ptr == NULL))220220+ return -EINVAL;221221222222 if (size == 0) {223223 *((void **) ptr) = NULL;224224- return UDS_SUCCESS;224224+ return VDO_SUCCESS;225225 }226226227227 if (allocations_restricted)···245245 } else {246246 struct vmalloc_block_info *block;247247248248- if (vdo_allocate(1, struct vmalloc_block_info, __func__, &block) == UDS_SUCCESS) {248248+ if (vdo_allocate(1, struct vmalloc_block_info, __func__, &block) == VDO_SUCCESS) {249249 /*250250 * It is possible for __vmalloc to fail to allocate memory because there251251 * are no pages available. A short sleep may allow the page reclaimer···290290 }291291292292 *((void **) ptr) = p;293293- return UDS_SUCCESS;293293+ return VDO_SUCCESS;294294}295295296296/*···335335 * @what: What is being allocated (for error logging)336336 * @new_ptr: A pointer to hold the reallocated pointer337337 *338338- * Return: UDS_SUCCESS or an error code338338+ * Return: VDO_SUCCESS or an error code339339 */340340int vdo_reallocate_memory(void *ptr, size_t old_size, size_t size, const char *what,341341 void *new_ptr)···345345 if (size == 0) {346346 vdo_free(ptr);347347 *(void **) new_ptr = NULL;348348- return UDS_SUCCESS;348348+ return VDO_SUCCESS;349349 }350350351351 result = vdo_allocate(size, char, what, new_ptr);352352- if (result != UDS_SUCCESS)352352+ if (result != VDO_SUCCESS)353353 return result;354354355355 if (ptr != NULL) {···360360 vdo_free(ptr);361361 }362362363363- return UDS_SUCCESS;363363+ return VDO_SUCCESS;364364}365365366366int vdo_duplicate_string(const char *string, const char *what, char **new_string)···369369 u8 *dup;370370371371 result = vdo_allocate(strlen(string) + 1, u8, what, &dup);372372- if (result != UDS_SUCCESS)372372+ if (result != VDO_SUCCESS)373373 return result;374374375375 memcpy(dup, string, strlen(string) + 1);376376 *new_string = dup;377377- return UDS_SUCCESS;377377+ return VDO_SUCCESS;378378}379379380380void vdo_memory_init(void)
+4-4
drivers/md/dm-vdo/memory-alloc.h
···3535 * @what: What is being allocated (for error logging)3636 * @ptr: A pointer to hold the allocated memory3737 *3838- * Return: UDS_SUCCESS or an error code3838+ * Return: VDO_SUCCESS or an error code3939 */4040static inline int __vdo_do_allocation(size_t count, size_t size, size_t extra,4141 size_t align, const char *what, void *ptr)···6565 * @WHAT: What is being allocated (for error logging)6666 * @PTR: A pointer to hold the allocated memory6767 *6868- * Return: UDS_SUCCESS or an error code6868+ * Return: VDO_SUCCESS or an error code6969 */7070#define vdo_allocate(COUNT, TYPE, WHAT, PTR) \7171 __vdo_do_allocation(COUNT, sizeof(TYPE), 0, __alignof__(TYPE), WHAT, PTR)···8181 * @WHAT: What is being allocated (for error logging)8282 * @PTR: A pointer to hold the allocated memory8383 *8484- * Return: UDS_SUCCESS or an error code8484+ * Return: VDO_SUCCESS or an error code8585 */8686#define vdo_allocate_extended(TYPE1, COUNT, TYPE2, WHAT, PTR) \8787 __extension__({ \···105105 * @what: What is being allocated (for error logging)106106 * @ptr: A pointer to hold the allocated memory107107 *108108- * Return: UDS_SUCCESS or an error code108108+ * Return: VDO_SUCCESS or an error code109109 */110110static inline int __must_check vdo_allocate_cache_aligned(size_t size, const char *what, void *ptr)111111{