Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/fs/tmpfs tmpfs_bytes_max: use MIN() rather than min(), w...
details: https://anonhg.NetBSD.org/src/rev/79fa0c924502
branches: trunk
changeset: 755924:79fa0c924502
user: rmind <rmind%NetBSD.org@localhost>
date: Mon Jun 28 19:32:43 2010 +0000
description:
tmpfs_bytes_max: use MIN() rather than min(), which returns int.
Spotted by Wolfgang Solfrank.
diffstat:
sys/fs/tmpfs/tmpfs_mem.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diffs (39 lines):
diff -r 9af8016cbb08 -r 79fa0c924502 sys/fs/tmpfs/tmpfs_mem.c
--- a/sys/fs/tmpfs/tmpfs_mem.c Mon Jun 28 19:08:53 2010 +0000
+++ b/sys/fs/tmpfs/tmpfs_mem.c Mon Jun 28 19:32:43 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tmpfs_mem.c,v 1.1 2010/06/22 18:32:07 rmind Exp $ */
+/* $NetBSD: tmpfs_mem.c,v 1.2 2010/06/28 19:32:43 rmind Exp $ */
/*
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tmpfs_mem.c,v 1.1 2010/06/22 18:32:07 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tmpfs_mem.c,v 1.2 2010/06/28 19:32:43 rmind Exp $");
#include <sys/param.h>
#include <sys/atomic.h>
@@ -110,7 +110,7 @@
freepages -= TMPFS_PAGES_RESERVED;
}
avail_mem = round_page(mp->tm_bytes_used) + (freepages << PAGE_SHIFT);
- return min(mp->tm_mem_limit, avail_mem);
+ return MIN(mp->tm_mem_limit, avail_mem);
}
size_t
@@ -123,9 +123,10 @@
bool
tmpfs_mem_incr(struct tmpfs_mount *mp, size_t sz)
{
- const uint64_t lim = tmpfs_bytes_max(mp);
+ uint64_t lim;
mutex_enter(&mp->tm_acc_lock);
+ lim = tmpfs_bytes_max(mp);
if (mp->tm_bytes_used + sz >= lim) {
mutex_exit(&mp->tm_acc_lock);
return false;
Home |
Main Index |
Thread Index |
Old Index