* enums
@ 2002-06-27 12:56 Manik Raina
2002-06-27 13:03 ` enums Manik Raina
2002-06-28 4:31 ` enums Manik Raina
0 siblings, 2 replies; 3+ messages in thread
From: Manik Raina @ 2002-06-27 12:56 UTC (permalink / raw)
To: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 166 bytes --]
is there a particular reason we dislike constructs as attached in the
diffs below ?
with enums, we dont have to increment MAX_NR_ZONES everytime a new one
is added .
[-- Attachment #2: a --]
[-- Type: text/plain, Size: 711 bytes --]
diff -u -r -U 6 cmp/include/linux/mmzone.h linux-2.5.24/include/linux/mmzone.h
--- cmp/include/linux/mmzone.h Fri Jun 21 04:23:42 2002
+++ linux-2.5.24/include/linux/mmzone.h Thu Jun 27 18:00:25 2002
@@ -88,16 +88,21 @@
* rarely used fields:
*/
char *name;
unsigned long size;
} zone_t;
-#define ZONE_DMA 0
-#define ZONE_NORMAL 1
-#define ZONE_HIGHMEM 2
-#define MAX_NR_ZONES 3
+enum zone_type {
+
+ ZONE_DMA,
+ ZONE_NORMAL,
+ ZONE_HIGHMEM,
+ MAX_NR_ZONES,
+
+};
+
/*
* One allocation request operates on a zonelist. A zonelist
* is a list of zones, the first one is the 'goal' of the
* allocation, the other zones are fallback zones, in decreasing
* priority.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: enums
2002-06-27 12:56 enums Manik Raina
@ 2002-06-27 13:03 ` Manik Raina
2002-06-28 4:31 ` enums Manik Raina
1 sibling, 0 replies; 3+ messages in thread
From: Manik Raina @ 2002-06-27 13:03 UTC (permalink / raw)
To: linux-kernel
Manik Raina wrote:
> with enums, we dont have to increment MAX_NR_ZONES everytime a new one
s/one/zonetype
> is added .
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: enums
2002-06-27 12:56 enums Manik Raina
2002-06-27 13:03 ` enums Manik Raina
@ 2002-06-28 4:31 ` Manik Raina
1 sibling, 0 replies; 3+ messages in thread
From: Manik Raina @ 2002-06-28 4:31 UTC (permalink / raw)
To: linux-kernel; +Cc: torvalds
If no one has any objections, Can this be applied as a patch ?
Manik Raina wrote:
>
> is there a particular reason we dislike constructs as attached in the
> diffs below ?
> with enums, we dont have to increment MAX_NR_ZONES everytime a new one
> is added .
>
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> diff -u -r -U 6 cmp/include/linux/mmzone.h linux-2.5.24/include/linux/mmzone.h
> --- cmp/include/linux/mmzone.h Fri Jun 21 04:23:42 2002
> +++ linux-2.5.24/include/linux/mmzone.h Thu Jun 27 18:00:25 2002
> @@ -88,16 +88,21 @@
> * rarely used fields:
> */
> char *name;
> unsigned long size;
> } zone_t;
>
> -#define ZONE_DMA 0
> -#define ZONE_NORMAL 1
> -#define ZONE_HIGHMEM 2
> -#define MAX_NR_ZONES 3
> +enum zone_type {
> +
> + ZONE_DMA,
> + ZONE_NORMAL,
> + ZONE_HIGHMEM,
> + MAX_NR_ZONES,
> +
> +};
> +
>
> /*
> * One allocation request operates on a zonelist. A zonelist
> * is a list of zones, the first one is the 'goal' of the
> * allocation, the other zones are fallback zones, in decreasing
> * priority.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-06-28 4:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-06-27 12:56 enums Manik Raina
2002-06-27 13:03 ` enums Manik Raina
2002-06-28 4:31 ` enums Manik Raina
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox