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 <[EMAIL PROTECTED]>
Signed-off-by:  Gerrit Huizenga <[EMAIL PROTECTED]>

Index: linux-2.6.13-ckrm1/kernel/ckrm/rbce/rbce_fs.c
===================================================================
--- linux-2.6.13-ckrm1.orig/kernel/ckrm/rbce/rbce_fs.c  2005-09-09 
17:39:52.000000000 -0700
+++ linux-2.6.13-ckrm1/kernel/ckrm/rbce/rbce_fs.c       2005-09-09 
17:43:31.000000000 -0700
@@ -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);

--


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
ckrm-tech mailing list
https://lists.sourceforge.net/lists/listinfo/ckrm-tech

Reply via email to