Re: [PATCH 1/5] slab: rename obj_reallen to obj_size

From: Manfred Spraul
Date: Sat Nov 19 2005 - 07:34:42 EST


Pekka Enberg wrote:

user_offset is more readable.



Ok.

+ int user_size;





#endif
};
-static int obj_dbghead(kmem_cache_t *cachep)
+static int obj_user_off(kmem_cache_t *cachep)



So why not call the above obj_offset() ?



It would just cause confusion: The name of the function and the name of the member must be identical.
The purpose of obj_user_off() is to hide an optimization: cachep->user_off is always 0 when debugging is disabled. Therefore the member doesn't even exist with CONFIG_DEBUG_SLAB=n, and all accesses are hardcoded to 0.
This is achieved by using obj_user_off(cachep) instead of cachep->user_off. If the name of the helper and the name of the struct member differ, then noone would understand the code.
I'll do a new patch with user_offset instead of user_off, ok?

--
Manfred
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/