tech-kern archive

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

Re: API/ABI rank of headers in /usr/include/isofs/cd9660



Hi,

assessment of includers of cd9660 entrails.

The following files where found including isofs/cd9660 files
other than cd9660_mount.h, iso.h, iso_rrip.h :

------------------------------------------------------------------------
/usr/src/usr.bin/fstat/isofs.c:#include <isofs/cd9660/cd9660_extern.h>
/usr/src/usr.bin/fstat/isofs.c:#include <isofs/cd9660/cd9660_node.h>

The inclusion of cd9660_extern.h is not needed.
cd9660_node.h is used to access several members of struct iso_node.

I disabled
  #include <isofs/cd9660/cd9660_extern.h>
and had to work around this unrelated error at compile time
  In file included from /usr/src/sys/sys/mbuf.h:84:0,
                   from /usr/src/sys/sys/domain.h:40,
                   from fstat.c:54:
  /usr/include/stddef.h:41:25: error: expected '=', ',', ';', 'asm' or 
'__attribute__' before 'ptrdiff_t'

After hacking /usr/include/stddef.h to
  /*
  typedef _BSD_PTRDIFF_T_ ptrdiff_t;
  */
  typedef int     ptrdiff_t;
i could get it compiled up to a linker failure
  fstat.c:(.text+0x13a6): undefined reference to `inet6_getscopeid'
  fstat.c:(.text+0x20b0): undefined reference to `_ctype_tab_'

Thus kern/48808 will not affect ./fstat if only the proposal is
retracted to make cd9660_extern.h private.

The planned support for large files will affect
cd9660_node.h : struct iso_node with its members .i_size and .inode.
This will show up as API change in ./fstat.

Side observation:
man 8 lsof points by its SEE ALSO to fstat(8).
But in NetBSD-6.1.3 and in /usr/src the man page is fstat.1.

------------------------------------------------------------------------
/usr/src/usr.bin/pmap/pmap.h:#include <isofs/cd9660/cd9660_node.h>

pmap.c accesses struct iso_node.i_dev and struct iso_node.i_number
via the macro
  V_DATA_IS(vp, iso_node, i_dev, i_number);

Both are not affected by kern/48808 except by the privatisation.
Both will most probably not be affected by changes in
struct iso_node for large file support.

A compile test with the emerging new cd9660_node.h succeeded.

------------------------------------------------------------------------
/usr/src/usr.sbin/makefs/cd9660/iso9660_rrip.h:#include <cd9660_rrip.h>

Should be not affected by changes.
It compiles up to a linker error:
  cd9660.o: In function `cd9660_level2_convert_filename':
  cd9660.c:(.text+0x271): undefined reference to `_ctype_tab_'

Probably because /usr/include/sys/ctype_bits.h defines
  extern const unsigned char      *_ctype_;
where /usr/src/sys/sys/ctype_bits.h has
  extern const unsigned short     *_ctype_tab_;

I do not know how to work around.

------------------------------------------------------------------------

The compile time problems happen when trying to compile /usr/src from
CVS on a 6.1.3 userland system.
Am i doing something wrong that i do not get included the /usr/src
but rather the /usr/include files ?

------------

Do i make too much thoughts about compatibility of the files
cd9660_node.h and cd9660_extern.h which are obviously entrails of
cd9660, although published ?

Shall i just get ./fstat to work after changing cd9660_node.h
and trust that the installation of ./fstat stays in sync with
the kernel ?

How to get the compilation of /usr/src/usr.bin/fstat right ?

------------
Summary:

It turns out that the file cd9660_rrip.h is more "on-disk format"
than the file iso_rrip.h.
So the legitimatley published files would be
  cd9660_mount.h
  iso.h
  iso_rrip.h
  cd9660_rrip.h
As a funny misnomer, the only effectively private header is
  cd9660_extern.h

The file
  cd9660_node.h
is obviously used to bypass stat(2) when having a vnode.

(Wouldn't it be nice to offer the commoners an API/ABI-stable
 VFS method to obtain a struct stat from its .st_ino ?)


Have a nice day :)

Thomas



Home | Main Index | Thread Index | Old Index