[patch 30/38] CKRM e18: use sizeof instead of #define for the array size in taskclass

Gerrit Huizenga
2005-06-23T07:58:31Z

[-- Attachment #1: use_sizeof_instead_of_define_for_the_array_size_in_taskclass --]
[-- Type: text/plain, Size: 1079 bytes --]

While creating the config files for taskclass, instead of using #define
use sizeof so that when the array size changes, things still work as
expected.

Note: Socketclass already follows this model.

Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com>
Signed-off-by: Gerrit Huizenga <gh@us.ibm.com>

Index: linux-2.6.12-ckrm1/fs/rcfs/tc_magic.c
===================================================================
--- linux-2.6.12-ckrm1.orig/fs/rcfs/tc_magic.c 2005-06-20 15:02:49.000000000 -0700
+++ linux-2.6.12-ckrm1/fs/rcfs/tc_magic.c 2005-06-20 15:37:43.000000000 -0700
@@ -34,8 +34,7 @@

#define TC_FILE_MODE (S_IFREG | S_IRUGO | S_IWUSR)

-#define NR_TCROOTMF 7
-struct rcfs_magf tc_rootdesc[NR_TCROOTMF] = {
+struct rcfs_magf tc_rootdesc[] = {
/* First entry must be root */
{
/* .name = should not be set, copy from classtype name */
@@ -89,5 +88,5 @@ struct rcfs_magf tc_rootdesc[NR_TCROOTMF

struct rcfs_mfdesc tc_mfdesc = {
.rootmf = tc_rootdesc,
- .rootmflen = NR_TCROOTMF,
+ .rootmflen = (sizeof(tc_rootdesc) / sizeof(struct rcfs_magf)),
};

--