svn commit: r351319 - in head/usr.sbin/makefs: ffs msdos

Bruce Evans brde at optusnet.com.au
Fri Aug 30 04:29:23 UTC 2019


On Wed, 21 Aug 2019, Ed Maste wrote:

> Author: emaste
> Date: Wed Aug 21 01:45:29 2019
> New Revision: 351319
> URL: https://svnweb.freebsd.org/changeset/base/351319
>
> Log:
>  makefs: use `char *` not `void *` for buf b_data, drop casts in msdos
>
>  (The kernel uses caddr_t.)

This is much better than churning the copy of the working code.

However, the kernel type is still bogus.  caddr_t should not exist, and
should have been more like vm_offset_t to begin with.  void * is no good
as an opaque type for it, since void * is only good for C addresses within
a single address space, but caddr_t is supposed to be able to represent
anything in a (possibly multiple) "core" address space.  [u]intptr_t has
the same problem.  Bus space addresses are also withing a single address
space and in general need a tag for uniqueness.

caddr_t has been char * for too long, so too much code including buf b_data
depends on it being precisely char * or u_char * to work.  char * is an
honestly broken variant of void *.  It is similarly limited to a single
address space.  This is hard to fix.  It works for [Free]BSD since no arches
with more than a single address space are supported (i386 with PAE or
pae_mode=1 or pae_mode has a larger physical address space where addresses
aren't unique, but only the kernel can see this).

Bruce


More information about the svn-src-all mailing list