From: Gerrit Huizenga While creating the config files for rbce, instead of using #define use sizeof so that when the array size changes, things still work as expected. Signed-off-by: Chandra Seetharaman Signed-off-by: Gerrit Huizenga Signed-off-by: Andrew Morton --- kernel/ckrm/rbce/rbce_fs.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff -puN kernel/ckrm/rbce/rbce_fs.c~ckrm-use-sizeof-instead-of-define-for-the-array-size-in-rbce kernel/ckrm/rbce/rbce_fs.c --- 25/kernel/ckrm/rbce/rbce_fs.c~ckrm-use-sizeof-instead-of-define-for-the-array-size-in-rbce Wed Jul 13 14:44:58 2005 +++ 25-akpm/kernel/ckrm/rbce/rbce_fs.c Wed Jul 13 14:44:58 2005 @@ -273,8 +273,7 @@ rbce_symlink(struct inode *dir, struct d /******************************* Config files ********************/ -#define RBCE_NR_CONFIG 5 -struct rcfs_magf rbce_config_files[RBCE_NR_CONFIG] = { +struct rcfs_magf rbce_config_files[] = { { .name = CONFIG_CE_DIR, .mode = RCFS_DEFAULT_DIR_MODE, @@ -302,16 +301,17 @@ static struct dentry *ce_root_dentry; int rbce_create_config(void) { - int rc; + int rc, nr; + nr = sizeof(rbce_config_files) / sizeof(struct rcfs_magf); /* Make root dentry */ - rc = rcfs_mkroot(rbce_config_files, RBCE_NR_CONFIG, &ce_root_dentry); + rc = rcfs_mkroot(rbce_config_files, nr, &ce_root_dentry); if ((!ce_root_dentry) || rc) return rc; /* Create config files */ if ((rc = rcfs_create_magic(ce_root_dentry, &rbce_config_files[1], - RBCE_NR_CONFIG - 1))) { + nr - 1))) { printk(KERN_ERR "Failed to create c/rbce config files." " Deleting c/rbce root\n"); rcfs_rmroot(ce_root_dentry); _