Commit graph

136 commits

Author SHA1 Message Date
David E. O'Brien 8321eb62f6 libstand needs _setjmp/_longjmp for FICL.
Submitted by:	jake
2002-04-13 22:09:53 +00:00
David E. O'Brien 168ca73831 Use -ffreestanding. It is REQUIRED by GCC 3.1 on all architectures.
I don't like putting this very-GCC centric option here; but no one as given
a better idea of handling it.

Reviewed by:	jhb
2002-04-09 20:38:29 +00:00
David E. O'Brien 1c47b73286 Break the sparc64 build. I expect those that complained about this commit
to fix the sparc64 case to their liking.
2002-04-09 05:34:22 +00:00
David E. O'Brien 5447d21d05 sparc64 grew _setjmp/_longjmp. 2002-04-08 20:46:07 +00:00
David E. O'Brien ae9b2dab02 Use -ffreestanding. 2002-04-08 20:45:44 +00:00
David E. O'Brien 69160b1eb7 Remove __P() usage. 2002-03-21 23:54:04 +00:00
David E. O'Brien be04b6d190 Remove 'register' keyword. 2002-03-21 23:39:28 +00:00
Maxim Sobolev 0414cddfc8 Kill debugging printf() slipped into my last commit.
Noticed by:		jhb
Hall of shame entry:	sobomax
2002-03-21 07:31:48 +00:00
Peter Wemm 2794bddccf Add -ffreestanding to CFLAGS for ia64. This should probably be global
like on the kernel.
2002-03-19 12:03:05 +00:00
Maxim Sobolev fb74e5f595 Add splitfs vfs layer into libstand, which allows loading big kernels and
modules split across several physical medias. Following is how it works:

The splitfs code, when asked to open "foo" looks for a file "foo.split"
which is a text file containing a list of filenames and media names, e.g.

	foo.aa "Kernel floppy 1"
	foo.ab "Kernel floppy 2"
	foo.ac "Kernel and modules floppy"

For each file segment, the process is:

- try to open the file
- prompt "Insert the disk labelled <whatever> and press any key..."
- try to open the file
- return error if file could not be located

RE team is free to use this feature in the upcoming 5.0-DP1.

Reviewed by:	msmith, dcs
2002-03-17 12:18:05 +00:00
Mike Barcroft d846855da8 o Don't require long long support in bswap64() functions.
o In i386's <machine/endian.h>, macros have some advantages over
  inlines, so change some inlines to macros.
o In i386's <machine/endian.h>, ungarbage collect word_swap_int()
  (previously __uint16_swap_uint32), it has some uses on i386's with
  PDP endianness.

Submitted by:	bde

o Move a comment up in <machine/endian.h> that was accidentially moved
  down a few revisions ago.
o Reenable userland's use of optimized inline-asm versions of
  byteorder(3) functions.
o Fix ordering of prototypes vs. redefinition of byteorder(3)
  functions, so that the non-GCC (libc asm) case has proper
  prototypes.
o Add proper prototypes for byteorder(3) functions in <sys/param.h>.
o Prevent redundant duplicate prototypes by making use of the
  _BYTEORDER_PROTOTYPED define.
o Move the bswap16(), bswap32(), bswap64() C functions into MD space
  for platforms in which asm versions don't exist.  This significantly
  reduces the complexity of some things at the cost of duplicate code.

Reviewed by:	bde
2002-03-09 21:02:16 +00:00
Thomas Moestl 90ce56c287 Add the following functions/macros to support byte order conversions and
device drivers for bus system with other endinesses than the CPU (using
interfaces compatible to NetBSD):

- bwap16() and bswap32(). These have optimized implementations on some
  architectures; for those that don't, there exist generic implementations.
- macros to convert from a certain byte order to host byte order and vice
  versa, using a naming scheme like le16toh(), htole16().
  These are implemented using the bswap functions.
- stream bus space access functions, which do not perform a byte order
  conversion (while the normal access functions would if the bus endianess
  differs from the CPU endianess).

htons(), htonl(), ntohs() and ntohl() are implemented using the new
functions above for kernel usage. None of the above interfaces is currently
exported to user land.

Make use of the new functions in a few places where local implementations
of the same functionality existed.

Reviewed by:	mike, bde
Tested on alpha by:	mike
2002-02-27 17:16:18 +00:00
Mike Barcroft fd8e4ebc8c o Move NTOHL() and associated macros into <sys/param.h>. These are
deprecated in favor of the POSIX-defined lowercase variants.
o Change all occurrences of NTOHL() and associated marcros in the
  source tree to use the lowercase function variants.
o Add missing license bits to sparc64's <machine/endian.h>.
  Approved by: jake
o Clean up <machine/endian.h> files.
o Remove unused __uint16_swap_uint32() from i386's <machine/endian.h>.
o Remove prototypes for non-existent bswapXX() functions.
o Include <machine/endian.h> in <arpa/inet.h> to define the
  POSIX-required ntohl() family of functions.
o Do similar things to expose the ntohl() family in libstand, <netinet/in.h>,
  and <sys/param.h>.
o Prepend underscores to the ntohl() family to help deal with
  complexities associated with having MD (asm and inline) versions, and
  having to prevent exposure of these functions in other headers that
  happen to make use of endian-specific defines.
o Create weak aliases to the canonical function name to help deal with
  third-party software forgetting to include an appropriate header.
o Remove some now unneeded pollution from <sys/types.h>.
o Add missing <arpa/inet.h> includes in userland.

Tested on:	alpha, i386
Reviewed by:	bde, jake, tmm
2002-02-18 20:35:27 +00:00
Bruce Evans c973d5e76c Fixed world breakage in previous commit. The generated headers are in
the current directory which is rarely ${.CURDIR}.
2002-02-02 00:20:32 +00:00
Maxim Sobolev de78df64c7 Complete bzip2-1.0.2 import.
MFC in:		14 days
2002-02-01 16:33:40 +00:00
John Baldwin 7244e93850 We support writing to at least one filesystem now.
PR:		kern/32389
Submitted by:	Jonathan Mini <mini@haikugeek.com>
Sponsored by:	ClickArray, Inc.
2001-12-11 00:04:28 +00:00
John Baldwin 126a0854a7 Add support for overwriting the existing contents of a file to the UFS
driver in libstand.  This specifically does not expand or truncate files
since the filesystem may be dirty or inconsistent.

PR:		kern/32389
Submitted by:	Jonathan Mini <mini@haikugeek.com>
Sponsored by:	ClickArray, Inc.
2001-12-11 00:03:10 +00:00
Alfred Perlstein 25993d3a47 Back out my 'fix', resid is different for strategy than for write 2001-11-30 06:24:34 +00:00
Alfred Perlstein 58cbb07307 Make the same fix for writes to RAW objects. 2001-11-30 05:59:47 +00:00
Alfred Perlstein fd19a949b4 write should return the number of bytes written, not 0 on success.
Submitted by: Jonathan Mini <mini@haikugeek.com>
PR: kern/32350
2001-11-30 05:54:30 +00:00
John Baldwin a577b96977 - Change the f_isdir field of struct file to be a flags field and two
new flags: F_ROOTDIR and F_RR (Rock Ridge present).
- Cache the SUSP LEN_SKP parameter in struct file as well.
- If we open() '/', then force a read of the directory's contents so we
  can examine the directory record of '.' to see if Rock Ridge is present.
- If Rock Ridge extensions are present, lookup Rock Ridge names in
  readdir().
2001-11-06 22:31:10 +00:00
John Baldwin 417dee22b4 - Add a simple SUSP parser.
- Use the SUSP parser to detect Rock Ridge (RRIP) extensions and to look
  up alternate names when opening files.
2001-11-06 19:59:19 +00:00
John Baldwin d917674e85 Switch to using ANSI function declarations and add missing function
prototypes.  I'm tired of getting stupid bugs from changing function
parameters and not getting warnings from the compiler when I goof it up.
2001-11-06 17:13:05 +00:00
Mike Barcroft 762e881bab Make the output from assert() look more like the example in the C99
standard.

Requested by:	bde
2001-10-29 07:07:25 +00:00
Mike Barcroft cb5f460523 Only provide function information in compile environments that support
the C99 variable __func__ and never for C++.  Provide a more meaningful
example in the assert(3) manual.

Reviewed by:	asmodai, bde
2001-10-27 20:11:10 +00:00
Peter Wemm 3f5f44ebe8 Remove the -I../libc/${MACHINE_ARCH} that was there solely for
the #include "DEFS.h" that was only used on i386 (which has been fixed).
2001-10-26 21:20:23 +00:00
Peter Wemm 9d91d74d2b Change #include "DEFS.h" to <machine/asm.h>. 2001-10-25 01:30:54 +00:00
Jeroen Ruigrok van der Werven d4c54c0c46 Add __FBSDID.
Change __assert() function to print failing function name.
This makes us C99 conforming.
2001-10-24 18:12:43 +00:00
Robert Drehmel f048d52363 Make this Makefile suitable for sparc64. 2001-10-15 14:27:37 +00:00
Robert Drehmel 8a56180f76 Define the types iaddr_t and saddr_t for sparc64. 2001-10-15 13:50:47 +00:00
Bruce Evans 6eabd84580 Compensate for "Compensate for header dethreading" by backing it out. 2001-10-10 17:48:44 +00:00
Ruslan Ermilov 32eef9aeb1 mdoc(7) police: Use the new .In macro for #include statements. 2001-10-01 16:09:29 +00:00
Ruslan Ermilov 00ba66fcf2 mdoc(7) police: markup nits. 2001-10-01 12:52:24 +00:00
Matthew Dillon e74b6a84ce Add __FBSDID()s to libstand 2001-09-30 22:28:01 +00:00
Maxim Sobolev 13b21828a8 Add support for loading bzip2-compressed filesystems. Among other things
this would allow to load bzip2-compressed kernels/modules from the loader(8)
(support for that will be committer separately).

MFC after:	1 month
2001-09-18 13:01:12 +00:00
Doug Rabson d66de00d95 Remove bogus implementation of _setjmp/_longjmp 2001-09-03 14:19:02 +00:00
Kris Kennaway af42d47866 Check for malloc failure in a couple of cases
MFC after:	2 weeks
2001-09-03 05:57:06 +00:00
John Polstra 719077d1be Fix a bug in lseek which caused the loader to fail on some gzipped
kernels.  The error message was "elf_loadexec: cannot seek".

Libstand maintains a read-ahead buffer for each open file, so that
it can read in chunks of 512 bytes for greater efficiency.  When
the loader tries to lseek forward in a file by a small amount, it
sometimes happens that the target file offset is already in the
read-ahead buffer.  But the lseek code simply discarded the contents
of that buffer and performed a seek directly on the underlying
file.  This resulted in an attempt to seek backwards in the file,
since some of the data has already been read into the read-ahead
buffer.  Gzipped data streams cannot seek backwards, so an error
was returned.

This commit adds code which checks to see if the desired file offset
is already in the read-ahead buffer.  If it is, the code simply
adjusts the buffer pointer and length, thereby avoiding a reverse
seek on the gzipped data stream.

I incorporated a suggestion from Matt Dillon which saved a little
bit of code in this fix.

Reviewed by:	dillon, gallatin, jhb
2001-08-29 23:33:22 +00:00
Andrew Gallatin c18092b2fb Bail if we go beyond the directory size, not just if we hit it.
Certain ISO fs's (like the one for 4.4-RC1 disc1 on alpha)
trigger this, and we end up opening a null file name.  This causes us to get
a false match for "kernel.ko" when it does not exist.
2001-08-23 17:08:26 +00:00
Ruslan Ermilov 753d686d34 mdoc(7) police: s/BSD/.Bx/ where appropriate. 2001-08-14 10:01:54 +00:00
Ruslan Ermilov c5e7e03a14 Spell "FreeBSD" with "F" and "BSD" in uppercase. 2001-08-13 16:33:00 +00:00
Ruslan Ermilov 8af1452cf8 Removed duplicate VCS ID tags, as per style(9). 2001-08-13 14:06:34 +00:00
Mark Peek 44af2e3166 Make include file consistent with the rest of libstand. 2001-07-31 15:49:50 +00:00
Dima Dorfman 7ebcc426ef Remove whitespace at EOL. 2001-07-15 07:53:42 +00:00
Ruslan Ermilov a307d59838 mdoc(7) police: removed HISTORY info from the .Os call. 2001-07-10 13:41:46 +00:00
Dima Dorfman 70d51341bf mdoc(7) police: remove extraneous .Pp before and/or after .Sh. 2001-07-09 09:54:33 +00:00
Mike Heffner 646bd49ed1 Reset errno so that subsequent TFTP requests don't fail after the
first failure.

PR:		misc/25502
MFC after:	2 weeks
2001-06-30 21:39:09 +00:00
Mike Smith a5af32a054 Correct the returned UDP datagram length. See the PR for a more comprehensive
description of the fix.

PR:		misc/25503
Submitted by:	Jim Browne <jbrowne@jbrowne.com>
MFC after:	1 week
2001-05-28 22:27:06 +00:00
Mike Smith dc46262eaa The shortest valid TFTP packet is 4 bytes, not 8.
PR:		misc/25503
Submitted by:	Jim Browne <jbrowne@jbrowne.com>
MFC after:	1 week
2001-05-28 22:25:44 +00:00
Daniel C. Sobral 1d7d62d1e0 Replace functional bugs of ctypish functions in libstand with style
bugs.

reviewed by:	bde
MFC after:	1 week
2001-05-14 16:49:20 +00:00