Source-Changes-HG archive

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

[src/trunk]: src/sys min() -> MIN(), max() -> MAX().



details:   https://anonhg.NetBSD.org/src/rev/6d677e08de81
branches:  trunk
changeset: 504306:6d677e08de81
user:      chs <chs%NetBSD.org@localhost>
date:      Tue Feb 27 04:37:44 2001 +0000

description:
min() -> MIN(), max() -> MAX().
fixes more problems with file offsets > 4GB.

diffstat:

 sys/adosfs/advnops.c              |   8 ++++----
 sys/filecorefs/filecore_vnops.c   |  11 +++++------
 sys/isofs/cd9660/cd9660_vnops.c   |   9 ++++-----
 sys/msdosfs/msdosfs_vnops.c       |  16 ++++++++--------
 sys/nfs/nfs_bio.c                 |   6 +++---
 sys/ufs/ext2fs/ext2fs_readwrite.c |   8 ++++----
 sys/ufs/ufs/ufs_readwrite.c       |  10 +++++-----
 7 files changed, 33 insertions(+), 35 deletions(-)

diffs (295 lines):

diff -r 08cc6e384497 -r 6d677e08de81 sys/adosfs/advnops.c
--- a/sys/adosfs/advnops.c      Tue Feb 27 04:13:13 2001 +0000
+++ b/sys/adosfs/advnops.c      Tue Feb 27 04:37:44 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: advnops.c,v 1.56 2001/01/22 12:17:36 jdolecek Exp $    */
+/*     $NetBSD: advnops.c,v 1.57 2001/02/27 04:37:44 chs Exp $ */
 
 /*
  * Copyright (c) 1994 Christian E. Hopps
@@ -273,7 +273,7 @@
                error = 0;
                while (uio->uio_resid > 0) {
                        void *win;
-                       vsize_t bytelen = min(ap->fsize - uio->uio_offset,
+                       vsize_t bytelen = MIN(ap->fsize - uio->uio_offset,
                                              uio->uio_resid);
 
                        if (bytelen == 0) {
@@ -298,7 +298,7 @@
                size = amp->dbsize;
                lbn = uio->uio_offset / size;
                on = uio->uio_offset % size;
-               n = min((u_int)(size - on), uio->uio_resid);
+               n = MIN(size - on, uio->uio_resid);
                diff = ap->fsize - uio->uio_offset;
                /* 
                 * check for EOF
@@ -346,7 +346,7 @@
 #ifdef ADOSFS_DIAGNOSTIC
                printf(" %d+%d-%d+%d", lbn, on, lbn, n);
 #endif
-               n = min(n, (u_int)size - bp->b_resid);
+               n = MIN(n, size - bp->b_resid);
                error = uiomove(bp->b_data + on +
                                amp->bsize - amp->dbsize, (int)n, uio);
                brelse(bp);
diff -r 08cc6e384497 -r 6d677e08de81 sys/filecorefs/filecore_vnops.c
--- a/sys/filecorefs/filecore_vnops.c   Tue Feb 27 04:13:13 2001 +0000
+++ b/sys/filecorefs/filecore_vnops.c   Tue Feb 27 04:37:44 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: filecore_vnops.c,v 1.11 2001/01/22 13:32:23 jdolecek Exp $     */
+/*     $NetBSD: filecore_vnops.c,v 1.12 2001/02/27 04:37:45 chs Exp $  */
 
 /*-
  * Copyright (c) 1998 Andrew McMurry
@@ -167,7 +167,7 @@
                error = 0;
                while (uio->uio_resid > 0) {
                        void *win;
-                       vsize_t bytelen = min(ip->i_size - uio->uio_offset,
+                       vsize_t bytelen = MIN(ip->i_size - uio->uio_offset,
                                              uio->uio_resid);
 
                        if (bytelen == 0) {
@@ -187,8 +187,7 @@
        do {
                lbn = lblkno(fcmp, uio->uio_offset);
                on = blkoff(fcmp, uio->uio_offset);
-               n = min((u_int)(blksize(fcmp, ip, lbn) - on),
-                       uio->uio_resid);
+               n = MIN(blksize(fcmp, ip, lbn) - on, uio->uio_resid);
                diff = (off_t)ip->i_size - uio->uio_offset;
                if (diff <= 0)
                        return (0);
@@ -199,7 +198,7 @@
                if (ip->i_dirent.attr & FILECORE_ATTR_DIR) {
                        error = filecore_dbread(ip, &bp);
                        on = uio->uio_offset;
-                       n = min(FILECORE_DIR_SIZE-on, uio->uio_resid);
+                       n = MIN(FILECORE_DIR_SIZE - on, uio->uio_resid);
                        size = FILECORE_DIR_SIZE;
                } else {
                        if (vp->v_lastr + 1 == lbn &&
@@ -220,7 +219,7 @@
                        }
                }
                vp->v_lastr = lbn;
-               n = min(n, size - bp->b_resid);
+               n = MIN(n, size - bp->b_resid);
                if (error) {
 #ifdef FILECORE_DEBUG_BR
                        printf("brelse(%p) vn1\n", bp);
diff -r 08cc6e384497 -r 6d677e08de81 sys/isofs/cd9660/cd9660_vnops.c
--- a/sys/isofs/cd9660/cd9660_vnops.c   Tue Feb 27 04:13:13 2001 +0000
+++ b/sys/isofs/cd9660/cd9660_vnops.c   Tue Feb 27 04:37:44 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cd9660_vnops.c,v 1.62 2001/01/22 13:18:29 jdolecek Exp $       */
+/*     $NetBSD: cd9660_vnops.c,v 1.63 2001/02/27 04:37:45 chs Exp $    */
 
 /*-
  * Copyright (c) 1994
@@ -283,7 +283,7 @@
                error = 0;
                while (uio->uio_resid > 0) {
                        void *win;
-                       vsize_t bytelen = min(ip->i_size - uio->uio_offset,
+                       vsize_t bytelen = MIN(ip->i_size - uio->uio_offset,
                                              uio->uio_resid);
 
                        if (bytelen == 0)
@@ -301,8 +301,7 @@
        do {
                lbn = lblkno(imp, uio->uio_offset);
                on = blkoff(imp, uio->uio_offset);
-               n = min((u_int)(imp->logical_block_size - on),
-                       uio->uio_resid);
+               n = MIN(imp->logical_block_size - on, uio->uio_resid);
                diff = (off_t)ip->i_size - uio->uio_offset;
                if (diff <= 0)
                        return (0);
@@ -326,7 +325,7 @@
                                error = bread(vp, lbn, size, NOCRED, &bp);
                }
                vp->v_lastr = lbn;
-               n = min(n, size - bp->b_resid);
+               n = MIN(n, size - bp->b_resid);
                if (error) {
                        brelse(bp);
                        return (error);
diff -r 08cc6e384497 -r 6d677e08de81 sys/msdosfs/msdosfs_vnops.c
--- a/sys/msdosfs/msdosfs_vnops.c       Tue Feb 27 04:13:13 2001 +0000
+++ b/sys/msdosfs/msdosfs_vnops.c       Tue Feb 27 04:37:44 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msdosfs_vnops.c,v 1.106 2001/01/22 12:17:36 jdolecek Exp $     */
+/*     $NetBSD: msdosfs_vnops.c,v 1.107 2001/02/27 04:37:46 chs Exp $  */
 
 /*-
  * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -486,7 +486,7 @@
 
        if (vp->v_type == VREG) {
                while (uio->uio_resid > 0) {
-                       bytelen = min(dep->de_FileSize - uio->uio_offset,
+                       bytelen = MIN(dep->de_FileSize - uio->uio_offset,
                                      uio->uio_resid);
 
                        if (bytelen == 0)
@@ -506,7 +506,7 @@
        do {
                lbn = de_cluster(pmp, uio->uio_offset);
                on = uio->uio_offset & pmp->pm_crbomask;
-               n = min((u_long) (pmp->pm_bpcluster - on), uio->uio_resid);
+               n = MIN(pmp->pm_bpcluster - on, uio->uio_resid);
                if (uio->uio_offset >= dep->de_FileSize)
                        return (0);
                /* file size (and hence diff) may be up to 4GB */
@@ -525,7 +525,7 @@
                 * vnode for the directory.
                 */
                error = bread(pmp->pm_devvp, lbn, blsize, NOCRED, &bp);
-               n = min(n, pmp->pm_bpcluster - bp->b_resid);
+               n = MIN(n, pmp->pm_bpcluster - bp->b_resid);
                if (error) {
                        brelse(bp);
                        return (error);
@@ -646,7 +646,7 @@
                        error = ENOSPC;
                        break;
                }
-               bytelen = min(dep->de_FileSize - oldoff, uio->uio_resid);
+               bytelen = MIN(dep->de_FileSize - oldoff, uio->uio_resid);
 
                /*
                 * XXXUBC if file is mapped and this is the last block,
@@ -1549,11 +1549,11 @@
        while (uio->uio_resid > 0) {
                lbn = de_cluster(pmp, offset - bias);
                on = (offset - bias) & pmp->pm_crbomask;
-               n = min(pmp->pm_bpcluster - on, uio->uio_resid);
+               n = MIN(pmp->pm_bpcluster - on, uio->uio_resid);
                diff = dep->de_FileSize - (offset - bias);
                if (diff <= 0)
                        break;
-               n = min(n, diff);
+               n = MIN(n, diff);
                if ((error = pcbmap(dep, lbn, &bn, &cn, &blsize)) != 0)
                        break;
                error = bread(pmp->pm_devvp, bn, blsize, NOCRED, &bp);
@@ -1561,7 +1561,7 @@
                        brelse(bp);
                        return (error);
                }
-               n = min(n, blsize - bp->b_resid);
+               n = MIN(n, blsize - bp->b_resid);
 
                /*
                 * Convert from dos directory entries to fs-independent
diff -r 08cc6e384497 -r 6d677e08de81 sys/nfs/nfs_bio.c
--- a/sys/nfs/nfs_bio.c Tue Feb 27 04:13:13 2001 +0000
+++ b/sys/nfs/nfs_bio.c Tue Feb 27 04:37:44 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nfs_bio.c,v 1.62 2001/02/18 15:52:32 chs Exp $ */
+/*     $NetBSD: nfs_bio.c,v 1.63 2001/02/27 04:37:46 chs Exp $ */
 
 /*
  * Copyright (c) 1989, 1993
@@ -259,7 +259,7 @@
                                return (error);
                        }
                }
-               n = min(uio->uio_resid, NFS_MAXPATHLEN - bp->b_resid);
+               n = MIN(uio->uio_resid, NFS_MAXPATHLEN - bp->b_resid);
                got_buf = 1;
                on = 0;
                break;
@@ -894,7 +894,7 @@
                        len = np->n_size - ((((off_t)bp->b_blkno) << DEV_BSHIFT)
                                + diff);
                        if (len > 0) {
-                               len = min(len, uiop->uio_resid);
+                               len = MIN(len, uiop->uio_resid);
                                memset((char *)bp->b_data + diff, 0, len);
                        }
                }
diff -r 08cc6e384497 -r 6d677e08de81 sys/ufs/ext2fs/ext2fs_readwrite.c
--- a/sys/ufs/ext2fs/ext2fs_readwrite.c Tue Feb 27 04:13:13 2001 +0000
+++ b/sys/ufs/ext2fs/ext2fs_readwrite.c Tue Feb 27 04:37:44 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ext2fs_readwrite.c,v 1.15 2000/12/01 07:02:40 chs Exp $        */
+/*     $NetBSD: ext2fs_readwrite.c,v 1.16 2001/02/27 04:37:47 chs Exp $        */
 
 /*-
  * Copyright (c) 1997 Manuel Bouyer.
@@ -113,7 +113,7 @@
                error = 0;
                while (uio->uio_resid > 0) {
 
-                       bytelen = min(ip->i_e2fs_size - uio->uio_offset,
+                       bytelen = MIN(ip->i_e2fs_size - uio->uio_offset,
                            uio->uio_resid);
 
                        if (bytelen == 0) {
@@ -268,7 +268,7 @@
                while (uio->uio_resid > 0) {
                        oldoff = uio->uio_offset;
                        blkoffset = blkoff(fs, uio->uio_offset);
-                       bytelen = min(fs->e2fs_bsize - blkoffset,
+                       bytelen = MIN(fs->e2fs_bsize - blkoffset,
                            uio->uio_resid);
 
                        /*
@@ -309,7 +309,7 @@
        for (error = 0; uio->uio_resid > 0;) {
                lbn = lblkno(fs, uio->uio_offset);
                blkoffset = blkoff(fs, uio->uio_offset);
-               xfersize = min(fs->e2fs_bsize - blkoffset, uio->uio_resid);
+               xfersize = MIN(fs->e2fs_bsize - blkoffset, uio->uio_resid);
                if (xfersize < fs->e2fs_bsize)
                        flags |= B_CLRBUF;
                else
diff -r 08cc6e384497 -r 6d677e08de81 sys/ufs/ufs/ufs_readwrite.c
--- a/sys/ufs/ufs/ufs_readwrite.c       Tue Feb 27 04:13:13 2001 +0000
+++ b/sys/ufs/ufs/ufs_readwrite.c       Tue Feb 27 04:37:44 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ufs_readwrite.c,v 1.29 2001/02/26 17:12:08 lukem Exp $ */
+/*     $NetBSD: ufs_readwrite.c,v 1.30 2001/02/27 04:37:47 chs Exp $   */
 
 /*-
  * Copyright (c) 1993
@@ -111,7 +111,7 @@
 #ifndef LFS_READWRITE
        if (vp->v_type == VREG) {
                while (uio->uio_resid > 0) {
-                       bytelen = min(ip->i_ffs_size - uio->uio_offset,
+                       bytelen = MIN(ip->i_ffs_size - uio->uio_offset,
                            uio->uio_resid);
                        if (bytelen == 0)
                                break;
@@ -135,7 +135,7 @@
                nextlbn = lbn + 1;
                size = BLKSIZE(fs, ip, lbn);
                blkoffset = blkoff(fs, uio->uio_offset);
-               xfersize = min(min(fs->fs_bsize - blkoffset, uio->uio_resid),
+               xfersize = MIN(MIN(fs->fs_bsize - blkoffset, uio->uio_resid),
                    bytesinfile);
 
 #ifdef LFS_READWRITE
@@ -275,7 +275,7 @@
        while (uio->uio_resid > 0) {
                oldoff = uio->uio_offset;
                blkoffset = blkoff(fs, uio->uio_offset);
-               bytelen = min(fs->fs_bsize - blkoffset, uio->uio_resid);
+               bytelen = MIN(fs->fs_bsize - blkoffset, uio->uio_resid);
 
                /*
                 * XXXUBC if file is mapped and this is the last block,
@@ -323,7 +323,7 @@
        while (uio->uio_resid > 0) {
                lbn = lblkno(fs, uio->uio_offset);
                blkoffset = blkoff(fs, uio->uio_offset);
-               xfersize = min(fs->fs_bsize - blkoffset, uio->uio_resid);
+               xfersize = MIN(fs->fs_bsize - blkoffset, uio->uio_resid);
                if (fs->fs_bsize > xfersize)
                        flags |= B_CLRBUF;
                else



Home | Main Index | Thread Index | Old Index