Skip to contentSkip to conversation

fs/file.c: __const_max is actually __const_min :-)

PATCH In review Rasmus Villemoes 2 participants 3 messages Oct 29, 2015 – Nov 23, 2015 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs/file.c: __const_max is actually __const_min :-)

7f4b36f9bb930 "get rid of files_defer_init()" inexplicably changed a min() to a __const_max() - but the __const_max macro actually gives the minimum... So no functional change, just less confusing naming.

---
 fs/file.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
fs/file.c +3 -3
index 6c672ad329e9..b2d74f6001eb 100644
@@ -25,9 +25,9 @@
 
 int sysctl_nr_open __read_mostly = 1024*1024;
 int sysctl_nr_open_min = BITS_PER_LONG;
-/* our max() is unusable in constant expressions ;-/ */
-#define __const_max(x, y) ((x) < (y) ? (x) : (y))
-int sysctl_nr_open_max = __const_max(INT_MAX, ~(size_t)0/sizeof(void *)) &
+/* our min() is unusable in constant expressions ;-/ */
+#define __const_min(x, y) ((x) < (y) ? (x) : (y))
+int sysctl_nr_open_max = __const_min(INT_MAX, ~(size_t)0/sizeof(void *)) &
 			 -BITS_PER_LONG;
 
 static void *alloc_fdmem(size_t size)
Signature · 1 line
2.6.1
#1 lore raw

2015-10-29 9:01 GMT-02:00 Rasmus Villemoes <[email protected]>:

Quoted 16 lines

7f4b36f9bb930 "get rid of files_defer_init()" inexplicably changed a min() to a __const_max() - but the __const_max macro actually gives the minimum... So no functional change, just less confusing naming.

---
 fs/file.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
fs/file.c +0 -0
index 6c672ad329e9..b2d74f6001eb 100644
@@ -25,9 +25,9 @@
 
 int sysctl_nr_open __read_mostly = 1024*1024;

fs/file.c line 33

Quoted 10 lines
fs/file.c +3 -3
 int sysctl_nr_open_min = BITS_PER_LONG;
-/* our max() is unusable in constant expressions ;-/ */
-#define __const_max(x, y) ((x) < (y) ? (x) : (y))
-int sysctl_nr_open_max = __const_max(INT_MAX, ~(size_t)0/sizeof(void *)) &
+/* our min() is unusable in constant expressions ;-/ */
+#define __const_min(x, y) ((x) < (y) ? (x) : (y))
+int sysctl_nr_open_max = __const_min(INT_MAX, ~(size_t)0/sizeof(void *)) &
                         -BITS_PER_LONG;
 
 static void *alloc_fdmem(size_t size)

Confused code or no ?

Albino

#2 lore raw
Quoted 26 lines · Albino B Neto

2015-10-29 9:01 GMT-02:00 Rasmus Villemoes <[email protected]>:

Quoted 25 lines

7f4b36f9bb930 "get rid of files_defer_init()" inexplicably changed a min() to a __const_max() - but the __const_max macro actually gives the minimum... So no functional change, just less confusing naming.

---
 fs/file.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
fs/file.c +3 -3
index 6c672ad329e9..b2d74f6001eb 100644
@@ -25,9 +25,9 @@
 
 int sysctl_nr_open __read_mostly = 1024*1024;
 int sysctl_nr_open_min = BITS_PER_LONG;
-/* our max() is unusable in constant expressions ;-/ */
-#define __const_max(x, y) ((x) < (y) ? (x) : (y))
-int sysctl_nr_open_max = __const_max(INT_MAX, ~(size_t)0/sizeof(void *)) &
+/* our min() is unusable in constant expressions ;-/ */
+#define __const_min(x, y) ((x) < (y) ? (x) : (y))
+int sysctl_nr_open_max = __const_min(INT_MAX, ~(size_t)0/sizeof(void *)) &
                         -BITS_PER_LONG;
 
Quoted 3 lines

fs/file.c line 33

Quoted 1 line
fs/file.c +0 -0
 static void *alloc_fdmem(size_t size)

Confused code or no ?

The code is fine, the macro name sucks. Al, ping?