Source-Changes-HG archive

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

[src/trunk]: src/lib/libperfuse Use sysconf(_SC_PAGESIZE) instead of PAGE_SIZE.



details:   https://anonhg.NetBSD.org/src/rev/7d12abe6d180
branches:  trunk
changeset: 764908:7d12abe6d180
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Wed May 11 14:52:48 2011 +0000

description:
Use sysconf(_SC_PAGESIZE) instead of PAGE_SIZE.

diffstat:

 lib/libperfuse/fuse.h       |   4 ++--
 lib/libperfuse/ops.c        |  12 ++++++------
 lib/libperfuse/perfuse_if.h |   4 ++--
 3 files changed, 10 insertions(+), 10 deletions(-)

diffs (82 lines):

diff -r ff59caf9a5c9 -r 7d12abe6d180 lib/libperfuse/fuse.h
--- a/lib/libperfuse/fuse.h     Wed May 11 14:17:29 2011 +0000
+++ b/lib/libperfuse/fuse.h     Wed May 11 14:52:48 2011 +0000
@@ -1,4 +1,4 @@
-/*  $NetBSD: fuse.h,v 1.2 2010/09/15 01:51:43 manu Exp $ */
+/*  $NetBSD: fuse.h,v 1.3 2011/05/11 14:52:48 jakllsch Exp $ */
 
 /*-
  *  Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@@ -35,7 +35,7 @@
 
 #ifndef FUSE_BUFSIZE
 #define FUSE_MIN_BUFSIZE 0x21000
-#define FUSE_PREF_BUFSIZE (PAGE_SIZE + 0x1000)
+#define FUSE_PREF_BUFSIZE (sysconf(_SC_PAGESIZE) + 0x1000)
 #define FUSE_BUFSIZE MAX(FUSE_PREF_BUFSIZE /* CONSTCOND */, FUSE_MIN_BUFSIZE)
 #endif /* FUSE_BUFSIZE */
 
diff -r ff59caf9a5c9 -r 7d12abe6d180 lib/libperfuse/ops.c
--- a/lib/libperfuse/ops.c      Wed May 11 14:17:29 2011 +0000
+++ b/lib/libperfuse/ops.c      Wed May 11 14:52:48 2011 +0000
@@ -1,4 +1,4 @@
-/*  $NetBSD: ops.c,v 1.25 2011/05/03 13:19:50 manu Exp $ */
+/*  $NetBSD: ops.c,v 1.26 2011/05/11 14:52:48 jakllsch Exp $ */
 
 /*-
  *  Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved.
@@ -808,7 +808,7 @@
        fii = GET_INPAYLOAD(ps, pm, fuse_init_in);
        fii->major = FUSE_KERNEL_VERSION;
        fii->minor = FUSE_KERNEL_MINOR_VERSION;
-       fii->max_readahead = 32 * PAGE_SIZE; 
+       fii->max_readahead = 32 * sysconf(_SC_PAGESIZE); 
        fii->flags = (FUSE_ASYNC_READ|FUSE_POSIX_LOCKS|FUSE_ATOMIC_O_TRUNC);
 
        if ((error = xchg_msg(pu, 0, pm, sizeof(*fio), wait_reply)) != 0)
@@ -2801,15 +2801,15 @@
                size_t max_write;
                /*
                 * There is a writepage flag when data
-                * is PAGE_SIZE-aligned. Use it for
+                * is aligned to page size. Use it for
                 * everything but the data after the last
                 * page boundary.
                 */
                max_write = ps->ps_max_write - sizeof(*fwi); 
 
                data_len = MIN(*resid, max_write);
-               if (data_len > PAGE_SIZE)
-                       data_len = data_len & ~(PAGE_SIZE - 1);
+               if (data_len > (size_t)sysconf(_SC_PAGESIZE))
+                       data_len = data_len & ~(sysconf(_SC_PAGESIZE) - 1);
 
                payload_len = data_len + sizeof(*fwi);
 
@@ -2823,7 +2823,7 @@
                fwi->fh = perfuse_get_fh(opc, FWRITE);
                fwi->offset = offset;
                fwi->size = (uint32_t)data_len;
-               fwi->write_flags = (fwi->size % PAGE_SIZE) ? 0 : 1;
+               fwi->write_flags = (fwi->size % sysconf(_SC_PAGESIZE)) ? 0 : 1;
                fwi->lock_owner = pnd->pnd_lock_owner;
                fwi->flags = 0;
                fwi->flags |= (fwi->lock_owner != 0) ? FUSE_WRITE_LOCKOWNER : 0;
diff -r ff59caf9a5c9 -r 7d12abe6d180 lib/libperfuse/perfuse_if.h
--- a/lib/libperfuse/perfuse_if.h       Wed May 11 14:17:29 2011 +0000
+++ b/lib/libperfuse/perfuse_if.h       Wed May 11 14:52:48 2011 +0000
@@ -1,4 +1,4 @@
-/*  $NetBSD: perfuse_if.h,v 1.10 2010/10/11 05:37:58 manu Exp $ */
+/*  $NetBSD: perfuse_if.h,v 1.11 2011/05/11 14:52:48 jakllsch Exp $ */
 
 /*-
  *  Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@@ -175,7 +175,7 @@
  */
 #ifndef FUSE_BUFSIZE
 #define FUSE_MIN_BUFSIZE 0x21000
-#define FUSE_PREF_BUFSIZE (PAGE_SIZE + 0x1000)
+#define FUSE_PREF_BUFSIZE (sysconf(_SC_PAGESIZE) + 0x1000)
 #define FUSE_BUFSIZE MAX(FUSE_PREF_BUFSIZE /* CONSTCOND */, FUSE_MIN_BUFSIZE)
 #endif /* FUSE_BUFSIZE */
 



Home | Main Index | Thread Index | Old Index