[patch 37/38] CKRM e18: Use sizeof instead of define for the array size in RBCE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.12-ckrm1/kernel/ckrm/rbce/rbce_fs.c
===================================================================
--- linux-2.6.12-ckrm1.orig/kernel/ckrm/rbce/rbce_fs.c	2005-06-20 15:02:49.000000000 -0700
+++ linux-2.6.12-ckrm1/kernel/ckrm/rbce/rbce_fs.c	2005-06-20 16:01:57.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);

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

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux