Skip to contentSkip to conversation

Size of raw_devices[]

PATCH New Mingming cao 1 participant 1 message Feb 8, 2002

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Size of raw_devices[]

Hi,

While I was looking at the static arrays in the drivers, I found global array raw_devices[] used for describing raw device infos is hard sized by 256. To better prepare for more minor bits in the future, this small patch is made to using MINORMASK to size raw_devices[] instead of hardcoding. Please consider it in 2.5.

Signature · 1 line
Mingming Cao
drivers/char/raw.c renamed from usr/src/linux-2.5.3/drivers/char/raw.c +2 -2
diff -urN -X dontdiff /usr/src/linux-2.5.3/drivers/char/raw.c 253.raw/drivers/char/raw.c
@@ -25,7 +25,7 @@
 	struct semaphore mutex;
 } raw_device_data_t;
 
-static raw_device_data_t raw_devices[256];
+static raw_device_data_t raw_devices[MINORMASK+1];
 
 static ssize_t rw_raw_dev(int rw, struct file *, char *, size_t, loff_t *);
 
@@ -53,7 +53,7 @@
 	int i;
 	register_chrdev(RAW_MAJOR, "raw", &raw_fops);
 
-	for (i = 0; i < 256; i++)
+	for (i = 0; i < MINORMASK+1; i++)
 		init_MUTEX(&raw_devices[i].mutex);
 
 	return 0;