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

From: Gerrit Huizenga
Date: Thu Jun 23 2005 - 06:02:16 EST


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@xxxxxxxxxx>
Signed-off-by: Gerrit Huizenga <gh@xxxxxxxxxx>

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)),
};

--
-
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/