Freeing storage/cnfs/cnfs-private.h from subst

Russ Allbery rra at
Wed Sep 8 00:53:44 UTC 1999

cnfs-private.h is the only thing outside of the hairy include files in
include that still gets subst'd.  It only uses three values; we should be
able to clean that up.

The three things it wants are the following:

  ||##  C type to use for offsets (should be a big integer like "off_t" 
  ||##  (or "offset_t" (64 bits) for Solaris 2.5).
  ||##  WARNING: we use "atol" to convert these values ... look in the code
  ||##           for "Danger, Will Robinson!"
  ||#### =()<CYCBUFF_OFF_T              @<CYCBUFF_OFF_T>@>()=
  ||CYCBUFF_OFF_T               off_t

  ||##  Page boundary on which to mmap() the CNFS article usage header.
  ||##  Should be a multiple of the pagesize for all the architectures you
  ||##  expect might need access to your CNFS buffer.  If you don't expect
  ||##  to share your buffer across several platforms, you can use
  ||##  'pagesize' here.
  ||#### =()<CNFS_HDR_PAGESIZE          @<CNFS_HDR_PAGESIZE>@>()=
  ||CNFS_HDR_PAGESIZE           16384

  ||##  Which seek system call to use?  If CYCBUFF_OFF_T is "off_t", then
  ||##  lseek().  If, like Solaris, CYCBUFF_OFF_T is bigger than "off_t",
  ||##  then we must use a different system call, namedly llseek().
  ||#### =()<CNFSseekcall               @<CNFSseekcall>@>()=
  ||CNFSseekcall                lseek

Note that all three of these appear to currently be constants; configure
doesn't change them at all.

The first and the last appear to have originally been intended as the
large file support for CNFS buffers, but on Solaris if you compile for
large file support (-D_FILE_OFFSET_BITS=64 in particular), off_t is
actually a 64 bit data type itself, and you don't need to change any of

Note that Solaris doesn't seem to actually recommend this approach in its
man pages.  It recommends instead that you use lseek64() and off64_t
explicitly.  Checking IRIX 6.5 and HP-UX 11.00, the situation looks the
same there.  The current code in configure for doing large files appears
to be very Solaris-specific; I've yet to see another system that supports
getconf LFS_CFLAGS.

One approach would be to hard-code off_t and lseek in cnfs-private.h,
which is about equivalent to right now but reduces the visibility of the

Unfortunately, in this case we can't just use preprocessor magic on off_t,
because off_t exists as well as off64_t and using the preprocessor is too
likely to cause include file failures.  I think the right thing to do is
to provide an OFFSET_T type in macros.h/libinn.h, along with wrappers for
lseek(), open(), fopen(), fseeko(), mmap(), and whatever other functions
may need to access large files and need special names to do it.  In the
short term, cnfs-private.h will be the only file that uses those defines,
and can just use them to set the CNFS variables.

Sound okay?

For the page size, is there any reason not to make this just a constant in
cnfs-private.h?  Are people likely to be tweaking this?

Russ Allbery (rra at         <URL:>

More information about the inn-workers mailing list