Commit Graph

706 Commits

Author SHA1 Message Date
tsutsui 4459b5fdab I really hate silly hacks inside #ifndef _STANDALONE in libsa sources... 2009-01-18 02:59:02 +00:00
tsutsui 3f38114d96 Remove __P(). 2009-01-17 14:00:36 +00:00
tsutsui 69cf32a782 Replace time_t values in libsa sources with the following two types
to avoid unnecessary 64 bit ops which would make binaries larger:

satime_t (currently unsigned int):
 numbers in seconds returned by the machine dependent getsecs() function
 which are used to measure relative time

saseconds_t (currently int):
 numbers in seconds used to specify timeout to network drivers

Per discussion on current-users.
2009-01-12 11:32:43 +00:00
ad 5d7468ebd2 msdosfs -> msdos 2008-11-24 11:27:20 +00:00
ad 5bf641af07 For the x86 boot loader, autoload a kernel module corresponding to the
root file system type.
2008-11-19 12:36:41 +00:00
christos a93db399ff add a LOAD_NOTE flag to make loading the note optional. 2008-09-25 20:59:38 +00:00
gmcgarry 3c9a95916d Wrap compiler-specific flags with HAVE_GCC and HAVE_PCC as necessary. Add a few flags for PCC. 2008-08-29 00:02:21 +00:00
ad e69aa3297c Take $MACHINE into account when looking for modules. 2008-05-20 16:04:08 +00:00
ad 5cb8dd92fe Extract kernel version from the note section and stuff into a global
netbsd_version.
2008-05-20 14:41:06 +00:00
chris f10d13fdee Extend tftp_stat to return the size of the file, rather than -1.
It's not very efficient, as it has to read the whole file, and count the
block sizes.  However, this is the only way to work out the size using the
tftp protocol.

This is needed to support loading modules from a tftp server with pxeboot.
2008-05-11 11:29:12 +00:00
mlelstv a4002c76a9 There is also ARP_DEBUG for those who need it. 2008-05-11 04:53:15 +00:00
ad 1717063e94 Let twiddle() be disabled at runtime. 2008-04-30 16:18:09 +00:00
martin ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
tsutsui 52dab5df0c Fix a warning in #ifdef RARP_DEBUG. PR kern/20314 2008-04-05 05:15:33 +00:00
christos 19d181b7f5 add bcopy and bzero for loadfile for now. Should get rid of it. 2008-03-25 23:12:31 +00:00
christos 9ebe85fa97 remove stray comment 2008-03-25 22:55:25 +00:00
christos 8f0af7be4b fix typo 2008-03-25 22:54:54 +00:00
christos e1b834bdd8 - use mem* instead of b* routines, and kill the b* routines.
- use the mem* routines from libc.
XXX: There will be some lossage, but I am fixing it.
2008-03-25 21:23:50 +00:00
rtr 16ebb0dc79 when the char being searched for is not found strchr() must return NULL
not a pointer to the terminating '\0'. the only time we return a pointer
to the terminating '\0' is when the char being searched for is '\0'.

fixes problem observed booting -current install
http://mail-index.netbsd.org/current-users/2008/03/20/msg001445.html
2008-03-21 10:24:13 +00:00
dsl 2bb9a33a0f Add a strchr() - for dosfs in particular.
The i386 asm version in src/common is rather larger than this one.
2008-03-14 22:27:32 +00:00
dsl 2694fcbd4b Add a local strcasecmp() instead of pulling the bloat from libkern. 2008-03-14 22:21:53 +00:00
tsutsui 5d07958fe3 Fix typo in comment. 2008-02-25 15:33:20 +00:00
ad 4a780c9ae2 Merge vmlocking2 to head. 2008-01-02 11:48:20 +00:00
tsutsui e5434d17a5 ANSIfy. 2007-12-29 17:54:41 +00:00
perry 970ad9314d Remove __attribute__((__noreturn__)) from things already marked __dead
Found by the department of redundancy department.
2007-12-24 15:46:45 +00:00
tsutsui 2dc9b9cb28 ufs_ls.c doesn't belong to lfs. 2007-12-08 16:00:25 +00:00
isaki 48e1704028 Use standard error code (EIO) instead of standalone error code
(ESHORT).  Because loadfile_*() is used with or without
_STANDALONE, therefore, don't use error code in "saerrno.h".
Pointed out by and discussed with he@.
2007-12-03 09:51:30 +00:00
tsutsui 0a953ce07e - also pass correct size on dealloc() of in-memory superblock data
- also call dealloc() for group descriptor blocks
2007-12-02 06:47:43 +00:00
tsutsui 8d7676534f Allocate correct size for in-memory data struct m_ext2fs
(which is larger than SBSIZE).
2007-12-02 06:12:35 +00:00
tsutsui 48db0a5603 - fix description about index structure of an inode to match ext2fs_dinode
- put more byteswap ops on reading block numbers in indirect blocks
  (XXX: untested on big endian machines)
2007-12-02 05:23:40 +00:00
tsutsui db898c555a unsigned -> unsigned int 2007-12-02 04:59:24 +00:00
tsutsui d8fc666005 - build ext2fs.c
- put SRCS per each file system.
2007-12-01 18:11:02 +00:00
tsutsui 28712e0756 Add ext2fs support for libsa.
Mostly based on ufs.c, and some ext2fs specific stuff is pulled from
sys/ufs/ext2fs/ext2fs_bswap.c and sys/ufs/ext2fs/ext2fs_vfsops.c.

XXX1: Should we share ufs.c with #ifdef LIBSA_EXT2FS as ffs and lfs do?
XXX2: Maybe we should share ext2fs_bswap.c with kernel.
2007-12-01 18:06:22 +00:00
tsutsui c3af9178e9 Use "uint" rather than "unsigned" without a type. 2007-12-01 17:44:16 +00:00
isaki 1c038e6834 style, indent, and ANSI-fy. 2007-11-24 13:20:53 +00:00
isaki 33469b0e28 loadfile_*() must set errno when it returns -1. 2007-11-23 04:32:14 +00:00
isaki 3a7a8e72de x68k's floppy is 8*2 sect/cyl, not 18*2 sect/cyl. 2007-11-11 13:23:07 +00:00
tsutsui fe9146d494 Add an extern decl of try_bootp variable here since MD sources could set it. 2007-10-27 12:21:17 +00:00
tsutsui 03f68714d2 Include "bootp.h" for a function declaration of bootp(). 2007-10-27 12:19:41 +00:00
martin db90818494 Make a few debug outputs only happen when debugging. 2007-10-01 13:15:06 +00:00
martin aa444a36a0 When compiled with COMPAT_SOLARIS_UFS, always calculate fs_qbmask and
fs_qfmask on the fly. This allows libsa to read newer Solaris ufs
filesystems (which have a slightly incompatible superblock).
Suggested by Antti Kantee when discussing PR kern/37000.
2007-09-29 21:36:56 +00:00
martin cf9773f5c0 It is "data_start" not "data" - pointed out by Tom Spindler 2007-06-06 07:56:39 +00:00
martin 933b671bfa Add a MARK_DATA marker containing the effective VA of the first loaded
data segment.
2007-06-05 08:48:49 +00:00
he fdcc1ff67a We need char* for pointer arithmetic. 2007-03-05 14:49:04 +00:00
christos 53524e44ef Kill caddr_t; there will be some MI fallout, but it will be fixed shortly. 2007-03-04 05:59:00 +00:00
uwe e918be7b93 Add missing newlines to debug messages. 2007-02-25 04:46:32 +00:00
yamt ce9d4b0004 remove nqnfs from comments. from Arnaud Lacombe.
(no functional changes.)
2006-12-29 13:05:48 +00:00
chs 088fbfd7aa in fdloadfile(), fail if we can't read the entire exec header. 2006-12-09 22:11:36 +00:00
dogcow 437f8cc149 make bootxx_msdos fit in 8k again; thanks, __internal_memset_, for spilling
registers all over the place.
2006-12-02 00:38:22 +00:00
mrg 696ab05f50 add (char *) cast to quieten GCC. 2006-05-20 19:40:46 +00:00
mrg abeaa4f60d apply -Wno-pointer-sign with GCC4. 2006-05-12 03:29:11 +00:00
mrg 22406ced78 ssize_t -> size_t to match variable and functions. 2006-05-11 01:13:44 +00:00
cherry c988ba8700 Pass by reference to MD_LOADSEG(). Thanks to Matt Thomas for pointing this out. 2006-04-06 09:25:58 +00:00
cherry 3627104dbe Encapsulated the MD test: phdr[i].p_type & PT_LOPROC out of MI code,
and into MD_LOADSEG() as suggested by Christos.
2006-04-03 15:45:36 +00:00
cherry 50756fb219 Allows processor ABI specific ELF segment loads.
If the macro MD_LOADSEG defined in
machine/loadfile_machdep.h evaluates to 1, the machine
specific segment is loaded.

See: http://mail-index.netbsd.org/tech-kern/2005/12/30/0003.html
2006-04-03 14:08:41 +00:00
uwe fe55d8a997 /* fall through */ -> /* FALLTHROUGH */ 2006-01-27 02:28:36 +00:00
uwe b04e9bed57 Support 'z' (size_t) and 't' (ptrdiff_t) specifiers.
XXX: ptrdiff_t is only ever defined in <stddef.h> and is defined
unconditionally, without the ifndef dance.  Until we have an expert
opinion, abuse intptr_t for the 't' size check.
2006-01-27 01:53:13 +00:00
uwe 090e596149 Don't omit int arguments in the K&R style function definitions. 2006-01-27 01:11:27 +00:00
christos e72f06abb2 Add the source directory of zlib in the include paths so that cread.c can
find zlib.h which is needed from <lib/libz/libz.h>.
2006-01-26 14:05:49 +00:00
uwe ba7d6bc890 Sync alloc/dealloc prototypes with unsigned int -> size_t change. 2006-01-25 22:44:37 +00:00
christos 6645a4f37b free -> dealloc 2006-01-25 18:27:23 +00:00
christos 8c98cc0872 - Add attributes to printf functions
- Fix attributes to noreturn functions
- free -> dealloc
- unsigned -> size_t for alloc, dealloc
2006-01-25 18:26:59 +00:00
christos 426a2fdd3b Changing len from int to size_t caused an infinite loop. Noticed by chuq. 2006-01-25 13:46:09 +00:00
christos 8f67218a4b PR/32613: Yves-Emmanuel JUTARD: Incoherencies in file sys/lib/libsa/net.h
- Make prototype of ether_sprintf() match the one in sys/net.
- Rename in_cksum to ip_cksum and fix its prototype. in_cksum() operates
  on an mbuf and ip_cksum() operates on a plain buffer. We should not call
  functions that operate on different arguments the same name (this is not
  c++).
2006-01-24 17:07:19 +00:00
dsl 9813905f44 If _STANDALONE is defined, #include </lib/libsa/iodesc.h> instead of requiring
that the source that #includes net.h have lib/libsa in its include path.
In the non-_STANDALONE case make it easy for the user to supply their own iodesc.h.
2006-01-22 16:05:42 +00:00
dsl 05b5a4b77a Adjust code so that it will work when _STANDALONE isn't defined.
Allows it to be used for mount_nfs when SMALL is set - eg install floppies/
2006-01-21 10:06:06 +00:00
uwe ed89efb8bf Define indp_t as signed int32_t, like ffsv1.c does. 2006-01-18 02:52:22 +00:00
christos ddce00bf3c Don't include zlib.h directly; redirect through libz.h; this mirrors how
libkern is done and let's us abstract where the real zlib.h is kept.
2006-01-14 20:16:44 +00:00
christos a6d61f6709 constify write prototype. 2006-01-13 22:32:10 +00:00
perry 0f0296d88a Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete. 2005-12-24 20:45:08 +00:00
christos 95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
christos 50f8955b6e 64 bit inode changes. 2005-08-19 02:04:03 +00:00
christos 773f5f5489 rearrange free's and add a missing one. 2005-07-14 02:36:49 +00:00
junyoung f465530831 Remove bcmp(). Use memcmp() instead. 2005-06-13 12:11:07 +00:00
junyoung 0ddaa77ca6 Oops, missed a semicolon. 2005-06-13 12:06:36 +00:00
junyoung 9bf0710d63 ANSI, De-__P(), and some cosmetic changes including
bcmp -> memcmp, bzero -> memset, bcopy -> memcpy.
2005-06-13 12:03:01 +00:00
jmc 6f594a3510 Provide HEXDIGITS as well (needed on mvme68k/stand) 2005-05-23 19:05:00 +00:00
christos 362a4a0bd5 Yes, it was a cool trick >20 years ago to use "0123456789abcdef"[a] to
implement, xtoa(), but I think defining the samestring 50 times is a bit
too much. Defined HEXDIGITS and hexdigits in subr_prf.c and use it...
2005-05-17 04:14:57 +00:00
dsl 0f5f503c2e Use std form for a multi-line comment 2005-04-09 13:04:35 +00:00
perry 477853c351 nuke trailing whitespace 2005-02-26 22:58:54 +00:00
christos af06392139 DECONST -> UNCONST 2004-07-01 19:04:43 +00:00
christos b508e54615 constification fixes. 2004-06-30 13:59:22 +00:00
christos 84a3bc854d - multiple inclusion protection.
- constify some prototypes.
2004-06-30 13:59:05 +00:00
christos 049fd5eb10 help with casts, and lint hints. 2004-06-30 13:58:16 +00:00
abs 3c2fbd8521 Add qsort to libsa (taken from sys/dev/vinum/vinumqsort.c) and use instead of
bubblesort in acorn32 bootloader. Reduces time to sort memory on A710 equipped
RiscPC from over twenty seconds to effectively instantaneous.
Update boot version to 3.30
2004-05-19 23:37:41 +00:00
drochner ef369e0ed6 remove license clauses 3 and 4 from my cpoyright notices 2004-03-24 17:26:53 +00:00
drochner ba017f8305 I was told I'm just an "author", not a "regent" 2004-03-24 16:21:06 +00:00
drochner 4281485619 remove license clauses 3 and 4 from my copyright notice 2004-03-24 16:03:06 +00:00
dsl 5101188f02 When searching for the superblock, check that the fs_sblockloc field
matches the location we read it from to ensure we don't have one of the
alternate superblocks.
Fixes part of PR kern/24809
2004-03-20 14:24:59 +00:00
dsl 7dbd0e094b Make 'dependall' generate dependencies in these libraries. 2003-11-07 23:34:28 +00:00
he 202ba2bdcf Add a prototype for memset(). 2003-10-30 22:15:28 +00:00
he 91d100ed41 The paddr_t type is integral, so no longer compatible with NULL,
so use 0 instead.
2003-10-23 15:06:26 +00:00
itohy faf6cfae4c Rename local variables `read' to `nread' to shut up -Wshadow. 2003-10-18 06:39:12 +00:00
he 9ac0a9ed26 Um, undo last; libsa printf doesn't do %z. 2003-09-04 12:02:10 +00:00
he bd42895755 Use the %zu format for size_t printing instead of cast + %lu. 2003-09-04 11:42:52 +00:00
he 022f01cef7 Cast size_t to u_long before printing, and use %lu instead of %d as format.
Fixes compilation on alpha.
2003-09-03 12:43:41 +00:00
dsl fafabf93cc Another attempt to get libsa to contain the right things.
- put a 'standards conforming' memcmp into memcmp.c
- make bcmp be a second label on the same code
- make bcmp.c be just #include "memcmp.c"
This means that libsa.o might contain both a memcmp.o and a bcmp.o, but
both contain the same code (defining both symbols) so it doesn't matter
which ld uses.
Saves worrying about which of bcmp.c and memcmp.c the architecture specific
Makefile requests.
2003-09-01 12:28:03 +00:00
fvdl 60ae17c7ae Fix signed/unsigned warnings. 2003-08-31 22:40:13 +00:00
dsl 22588a3d36 The __strong_alias() seems to have to be in the file with the definition.
So make bcmp.c define bcmp and memcmp.
This should (?) fix the atari build.
(I've now no idea why the previous change defined memcpy for the alpha build.)
2003-08-29 19:53:18 +00:00
dsl 904ed3bb04 An ever sneakier way of making memcmp and bcmp use the same code:
__strong_alias(memcmp,bcmp)
2003-08-27 22:53:18 +00:00
dsl d0db314661 Use memset not bzero to help shrink alpha bootxx_lfs
(sys/arch/alpha/stand/common/start.S also uses bzero, I don't know
any alpha opcodes so cant change that one...)
2003-08-27 22:42:08 +00:00
dsl db4706faf9 Reduce memory footprint:
- use file buffer for all block reads
- only save a small amount of the indirect block list
Allows i386 bootxx_ufs code to load /boot from a filesystem with 32k blocks
while still fitting inside 64k of memory.
Code size reduced as well (by ~1k on i386).
It ought to be possible to use a buffer that is smaller than a filesystem
block.  This might be needed in order to boot from filesystems with larger
block sizes.
2003-08-22 21:33:52 +00:00
elric 72e3ec4b0c Should call ufs_close() if it isn't being built in. 2003-08-21 00:01:28 +00:00
elric 2a56d40c5c make 'path' argument to cd9660_open 'const char *' and fix the fallout. 2003-08-21 00:00:52 +00:00
dsl 8453fb0040 make 'path' argument to ufs_open 'const char *' and fix the fallout. 2003-08-18 15:45:27 +00:00
dsl d678060c05 KNF, fix a comment or two 2003-08-18 08:00:52 +00:00
agc aad01611e7 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22364, verified by myself.
2003-08-07 16:26:28 +00:00
scw 5d91e08442 In lookup(), don't free "dir" on exit if we found a matching entry.
Otherwise the caller ends up with a pointer to free'd memory...
2003-07-15 13:27:07 +00:00
martin 34718fb25a Protect opt_*.h include by _KERNEL_OPT 2003-06-23 14:17:24 +00:00
martin d505b18964 Make sure to include opt_foo.h if a defflag option FOO is used. 2003-06-23 11:00:59 +00:00
scw 3722390978 Allow the default location of "machine/loadfile_machdep.h" to be
overridden if MACHINE_LOADFILE_MACHDEP is defined.
This makes life much simpler in the face of the myriad of
different boot options for the evb* ports.
2003-04-29 13:03:55 +00:00
tron e71f089777 Remove two unused variable to fix a build problem. 2003-04-27 11:12:14 +00:00
bjh21 01f90db242 Remove %b support.
Encouraged by thorpej.
2003-04-26 13:25:47 +00:00
bjh21 2456c80578 If the format string ends with "%" or "%l", print those characters, just
as we would if they were part of an invalid conversion specification.
Code-size neutral on ARM; not tested elsewhere.
2003-04-20 22:23:59 +00:00
bjh21 94c13ff2cd ANSIfy, assume __STDC__, un-__P, KNF.
Generated code unchanged.
2003-04-20 19:31:29 +00:00
dsl 35632a80ac lfs code is built from ufs.c 2003-04-16 19:52:58 +00:00
dsl 7c8e4cdaea Add interface to boot password checking code that takes password parameter. 2003-04-15 22:26:42 +00:00
dsl 4efa73a16e Build ffsv1 and ffsv2 2003-04-11 11:31:44 +00:00
dsl ef32565239 Add externs for ffsv1_xxx and ffsv2_xxx 2003-04-11 11:30:12 +00:00
dsl f671893500 Files to build ffsv1 and ffsv2 versions of ufs.c 2003-04-11 11:28:54 +00:00
dsl af3660bcdb Use common ffs/lfs file ufs.c instead of lfs specific version. 2003-04-11 11:27:06 +00:00
dsl 5a0534abeb Merge in lfs.c, use defines to build ffsv1, ffsv2, lfsv1 or lfsv2.
(removes the ability to build a single ufs.o that supports ffs v1 and v2,
that animal was too large for some of the boot code.)
Use shifts and masks to avoid pulling in 64bit divide.
2003-04-11 11:24:49 +00:00
dsl fbf4bd0cfe Put extern definition of bcopy in () to avoid macro expansion when
LIBSA_USE_MEMCPY is defined. Fixes breakage because the return
type of memcpy() is different to that of bcopy.
2003-04-11 10:34:38 +00:00
dsl cff85b34d5 Fix prototypes of null_read and null_write, change to return errno values.
This code can't actually be used anywhere!  I don't think its obvious use
would compile!
2003-04-10 14:44:05 +00:00
dsl 4a16b1cc1d Add FS_DEF() and FS_OPS() defines to save typing (and errors) elsewhere.
Kill __P() and argument names in prototypes.
(approved by christos)
2003-04-10 14:39:46 +00:00
he 97b6d5bf4f Conditionalize declaration of local variable ``i'', now that the
code which uses it is also conditionalized.
2003-04-02 19:47:25 +00:00
fvdl 42614ed3f3 Add support for UFS2. UFS2 is an enhanced FFS, adding support for
64 bit block pointers, extended attribute storage, and a few
other things.

This commit does not yet include the code to manipulate the extended
storage (for e.g. ACLs), this will be done later.

Originally written by Kirk McKusick and Network Associates Laboratories for
FreeBSD.
2003-04-02 10:39:19 +00:00
mycroft 0b87bcb397 constify a couple of pointers. 2003-04-01 21:09:32 +00:00
drochner 8b0843a5b2 There is no point in initializing "rootpath" to "/".
Move it into BSS.
2003-03-27 12:28:58 +00:00
mycroft c6052ec21f const! const! 2003-03-25 22:35:36 +00:00
drochner f81c1c504b remove stuff just moved to bootparam.c and some variables which are
never used.
2003-03-19 17:19:32 +00:00
drochner 3906113e15 Move global variables which are used only by bootparam here.
("domainname" is useless and could be removed, but adding code to
skip this in the RPC reply would probably be more expensive than leaving
it as a dummy variable.)
2003-03-19 17:18:07 +00:00
mycroft f6258762e1 Move some stuff into .rodata. 2003-03-18 19:20:09 +00:00
drochner 68edf0e576 separate ether_sprintf() from the rest of ethernet support -- sometimes
it makes sense to use the former w/o the latter (eg PXE)
2003-03-12 16:46:31 +00:00
drochner 7b3b2ea783 no need to include "netif.h" anymore
(shared interface stuff is in iodesc.h, included by net.h)
2003-03-12 14:51:31 +00:00
drochner 7816074c59 separate the netif interface from the rest of the networking code,
so that it can be replaced easily in md code
2003-03-12 14:49:19 +00:00
jmmv 5649a49e43 After the "insert disk <number>, and press return..." message, check only
for the return keypress.
2003-03-11 19:43:04 +00:00
drochner dd688f888f translate EACCES (happens with NFS) 2003-03-11 15:02:54 +00:00
dsl ef50700873 LIBSA_NO_CLOSE is LIBSA_NO_FS_CLOSE everywhere else. 2003-03-07 00:46:37 +00:00
ragge e8d062d58b Remove bogus check for bogus netmask. 2003-02-25 14:42:30 +00:00
pk d71686ab26 Introduce fdloadfile() to load an image from an open file descriptor;
implement loadfile() in terms of it.

This allows clients to open a file once and "load" it multiple times (e.g.
first with COUNT_KERNEL, then with LOAD_KERNEL) without the side-effects
of multiple open calls.
2003-02-24 10:51:05 +00:00
simonb 6e4342ca79 Add support for LFSv2 filesystems. From a libsa standpoint, LFSv1 and
LFSv2 are treated as separate filesystem types for size considerations.
2003-02-23 23:17:42 +00:00
simonb 7d43baad24 Use the MAX() macro from <sys/param.h> instead of a local inline. Results
in same code size in ufs.c and removes an unused inline function in lfs.c.
2003-02-23 22:47:43 +00:00
simonb 8d6004faf3 We can't use <string.h> for standalone programs;
use <lib/libkern/libkern.h> for str*() prototypes instead.
2003-02-23 12:31:29 +00:00
dsl 2d1837c8fc KNR, removing ugly 'unsigned' variables.
Probably should be size_t, but now matched prototype.
(mainly agreed with christos - he wanted size_t....)
2003-02-01 14:57:02 +00:00
dsl 912fab6ec9 Beautify a little 2003-02-01 14:54:22 +00:00
dsl 2c4edf02a4 Save some space
(agreed by christos)
2003-02-01 14:53:38 +00:00
dsl 3080e19ff3 Support limited filename globbing
- agreed by christos
2003-02-01 14:52:13 +00:00
fvdl a3ff3a3038 Bump daddr_t to 64 bits. Replace it with int32_t in all places where
it was used on-disk, so that on-disk formats remain the same.
Remove ufs_daddr_t and ufs_lbn_t for the time being.
2003-01-24 21:55:02 +00:00
christos 8453828bf1 PR/19607: Bernd Ernesti: libsa does not have access to arpa/tftp.h. Put a
copy of it in our tftp.h
2003-01-12 18:59:15 +00:00
veego a64314e402 Fix broken build due too the move of the cd9660 and msdosfs kernel source code. 2002-12-30 16:41:53 +00:00
pk bd20047a69 Only display the final progress counter if any of the LOAD_ flags was given.
Fix comment describing the return value.
2002-12-11 09:55:20 +00:00
thorpej e8cc3884de Rename __LDPGSZ to AOUT_LDPGSZ, to accurately reflect what it is. 2002-12-10 17:14:02 +00:00
provos 0f09ed48a5 remove trailing \n in panic(). approved perry. 2002-09-27 15:35:29 +00:00
thorpej 2699791533 Do not #include "/usr/include/arpa/tftp.h" directly. Doing so is
VERY BAD for cross-compiling.
2002-09-16 16:53:45 +00:00
itojun 937b671271 use exit(int), not exit(void), consistently - even if the arg has no meaning. 2002-06-01 11:40:31 +00:00
bjh21 a20462dc6e Implement LIBSA_NO_FS_CLOSE, LIBSA_NO_FS_WRITE and LIBSA_NO_FS_SEEK.
LIBSA_NO_FS_SYMLINK and LIBSA_FS_SINGLECOMPONENT are irrelevant here.
2002-05-28 14:30:53 +00:00
bjh21 43079a573b KNF. 2002-05-28 14:26:01 +00:00
lukem e34d4e21de fix comment 2002-05-10 11:07:01 +00:00
simonb 5457f78a34 Don't bother testing if a uint8_t is > 256 -- that test is always false. 2002-05-09 02:44:39 +00:00
simonb 67c33ffcda Remove two shadowed variables, one of which was set to what it was
shadowing(!) and the other a temporary variable (as was it's shadow).
Code generated with "gcc -O2" is the same before and after.
2002-05-07 02:02:41 +00:00
ragge b0fa7eb2c1 Someone had a braino here; IP_TTL != IPDEFTTL. This caused the standalone
udp traffic to only have a ttl of 4.
Found by Jens Nilsson, jens@rockstorm.se.
2002-04-23 09:16:09 +00:00
matt fd1c084a68 Add a 1byte pad to make the ustar_t word aligned so the uas_1cyl after it
will also be word aligned.  This makes the VAX VMB bootrom happy since it
doesn't support odd-aligned buffers.
2002-03-30 01:29:48 +00:00
thorpej 6440db6488 * Add a NetBSD Vendor Class Identifier option as proposed on tech-net
in message <20020216172527.C23901@dr-evil.shagadelic.org>.
* Print the bootp/dhcp response, as is done for rarp/bootparam
  responses.
* Nuke bootp_flags and BOOTP_PXE; they're not used, nor should they be.
2002-03-20 23:10:39 +00:00
gmcgarry d16aceedcc Protect remaining references to 'debug' with NETIF_DEBUG. 2002-03-17 05:46:37 +00:00
simonb f28e18332c Move files[] from globals.c to its own file. Including all of globals.o
breaks the size limit for at least the pmax bootblocks.

Fixes PR port-pmax/15924 from Gregory McGarry.
2002-03-15 13:23:34 +00:00
thorpej 0b91bc440f Move files[] from open.c to globals.c, so that it's possible to
use libsa in an application where there are no file systems or
devices.
2002-02-23 05:44:24 +00:00
lukem da694bd77b fix spelos 2002-02-22 12:46:53 +00:00
thorpej 15bffcdeed Add a comment describing what SA_USE_LOADFILE is for. 2002-02-17 23:22:22 +00:00
thorpej 0d210931e3 Add a missing "static". 2002-02-17 23:19:00 +00:00
thorpej bf9a052aa4 Add EOFFSET. 2002-02-17 23:18:32 +00:00
reinoud e858ed8fa4 Not all ports use the `offset' in their calulations and on those platforms
compile errors are generated due to it. By explicitly using `offset=offset'
the variable is used in the compilers view and is optimised away anyway.
2002-02-11 20:25:56 +00:00
tv 8e6f7afb5b MKfoo=no -> NOfoo 2001-12-12 01:48:43 +00:00
jmc 2229499bfb Don't make clean and cleandir depend on the lib subdir. Just check for it's
existance before running the submake. This makes it possible to run a
make build (which runs cleandir before make obj) in a r/o source tree
2001-11-21 22:10:54 +00:00
lukem 2565646230 don't need <sys/types.h> when including <sys/param.h> 2001-11-15 09:47:59 +00:00
tv 4446c00002 Undefine DESTDIR; we don't want the special DESTDIR <bsd.lib.mk>
handling for kernel libraries.

XXX this build method should be replaced by something more sane
2001-11-14 21:59:31 +00:00
christos c89e803d30 Remove USB copyrights. The coff and elf loading code did not come with BSD4.4. 2001-11-09 19:27:25 +00:00
scw f1defc3543 To avoid backwards seeks on sequential devices (eq. QIC tapes), read all
the program headers in one operation into an internal buffer.
2001-11-09 18:31:08 +00:00
thorpej 0971f93345 Make the ELF loadfile routines byte-order independent when used in
a non-_STANDALONE environment (e.g. installboot(8)): internalize and
externalize the exec, program, and section headers as necessary.

Reviewed and OK'd by Christos.
2001-10-31 21:24:09 +00:00
thorpej a43b4351a8 Oops, committed wrong copy of file in previous revision. 2001-10-31 20:22:22 +00:00
thorpej 90aee7593a Add standalone 64-bit to/from {big,little}-endian routines. 2001-10-31 20:19:52 +00:00
thorpej e727e3f180 Split elf32 vs. elf64 handling in loadfile(), including support for
each separately and explicitly.  BOOT_ELF is now BOOT_ELF32 and
BOOT_ELF64, and ELFSIZE should no longer be defined in loadfile_machdep.h.
2001-10-31 17:20:45 +00:00
thorpej 4810d73020 Build the loadfile() a.out, ECOFF, and ELF back-ends as separate
objects.
2001-10-31 01:51:42 +00:00
thorpej 91626c3515 Split the exec formats included by loadfile() into separate files.
Primary goal: explcitly select which ELF format (elf32 or elf64) to
support for a cross tool which uses loadfile().
2001-10-30 23:51:03 +00:00
thorpej 74eebee33c Add standalone byte-swapping routines that don't require testing
the system's byte-order:
- host to {big,little}-endian {16,32}
- {big,little}-endian {16,32} to host

These are not intended to be used in libsa directly, but are rather
intended to be used by host tools which may use libsa routines (such
as loadfile()) which need to use explicit byte-ordering.
2001-10-30 23:35:33 +00:00
jdolecek a8fcba2901 Fix compilation on Alpha with ARP_DEBUG.
Fixes kern/6440 by R. C. Dowdeswell
2001-10-18 19:00:38 +00:00
minoura 12ea5d8238 Add changedisk_hook().
Machine-dependent code can eject the floppy to prompt the next volume in it.
(Or add another method in devsw?)
2001-09-28 15:15:24 +00:00
wiz 4c99916337 va_{start,end} audit:
Make sure that each va_start has one and only one matching va_end,
especially in error cases.
If the va_list is used multiple times, do multiple va_starts/va_ends.
If a function gets va_list as argument, don't let it use va_end (since
it's the callers responsibility).

Improved by comments from enami and christos -- thanks!

Heimdal/krb4/KAME changes already fed back, rest to follow.

Inspired by, but not not based on, OpenBSD.
2001-09-24 13:22:25 +00:00
tsutsui cf574991b8 Add a small version of memmove() for libsa.
Mostly identical with libsa/bcopy.c.
2001-09-02 07:04:16 +00:00
bjh21 acf574f63e When loading ELF, zero out:
The e_shstrndx field in the ELF header, since we don't load .shstrtab.
The sh_name field in each section header, for the same reason.
The sh_offset field for any section we don't load.

This means the kernel has some chance of knowing what it's being given.  It
also means that the behaviour of old kernels with new loaders should be
deterministic (if not terribly useful: they still can't find the symbol
table).
2001-07-31 22:11:57 +00:00
bjh21 30f144749a G/C "off", since it was just tracking the difference between maxp and elfp. 2001-07-31 21:09:52 +00:00
bjh21 67a82e1d4e Fix a small memory leak when counting the size of the symbol table (shp was
ALLOC'ed if (LOAD_SYM|COUNT_SYM), but FREEd if (LOAD_SYM)).
2001-07-31 20:03:03 +00:00
bjh21 1a35da3617 When loading an ELF kernel, don't load all the STRTAB sections. Instead, just
load those STRTAB sections that are referenced by a SYMTAB that we're loading.

The main advantage of this is that (at least with the binaries output by my
ARM ELF linker) this removes the need to seek backwards through the file, which
is a big win when loading a gzipped kernel.

While we're here, don't allocate space for string tables we don't load.
2001-07-31 19:20:29 +00:00
fvdl 3350f68f80 Avoid warnings about uninitialised usage. 2001-07-19 18:55:38 +00:00
wiz 1bc6d2cee9 Fix typo (`information' has an 'r'). 2001-07-19 16:13:00 +00:00
christos 366971a414 Back out previous. The booter will need to find the symbol table itself,
as explained in the code.
2001-07-13 17:43:23 +00:00
christos 6711e49228 From Nigel Pearson: Make SYMS and NSYMS work on ELF.
The MacOS booter needs them.
2001-07-13 17:17:12 +00:00
thorpej 23a3a54650 libkern.h now has the ctype routines. 2001-04-05 04:39:02 +00:00
hubertf 267271c1b2 Explain some SA_* options - reading compressed kernels, netboot
Useful for stripping down bootcode.
2001-03-31 09:45:11 +00:00
sommerfeld 5348dfb6ac Have recursive make invocations depend on the .MAKE pseudo-target so
make knows to handle them specially.
2000-12-05 17:01:19 +00:00
tsutsui 99d2177add Don't try to load a.out header if there is no space for it before text. 2000-12-03 02:53:04 +00:00
simonb cdfbd303f9 Fix tyop in comment. 2000-11-26 03:31:20 +00:00
tsutsui 071bf9bca9 Don't print "]" if loading kernel does not have symbol table. 2000-11-11 09:25:12 +00:00
matt c4e14613b2 dos_unmount is only is dos_close is present but so conditionalize it like
dos_close.
2000-11-09 01:55:31 +00:00
matt 6c15ee2986 avoid pointer addition on void pointers 2000-11-08 19:38:12 +00:00
thorpej 29b685b9f0 Introduce a way for boot programs to modify the behavior of
bootp().  Add a BOOTP_PXE flag which causes bootp() to send
"PXEClient" in the DHCP class field.

Derived from similar code in FreeBSD.
2000-11-02 03:22:23 +00:00
thorpej abf350ddcf Sprinkle some const -- gets things out of the .data segment, which
is important in the i386 boot blocks (grmumble).
2000-11-02 00:34:51 +00:00
thorpej 904d7ceb3c Add a standalone MS-DOS file system reader package, lifted
from FreeBSD, and modified use NetBSD's already-existing
MS-DOS file system data structure definitions, rather than
defining our own.
2000-11-02 00:25:05 +00:00
ragge aeb756f1b5 Add define NO_MID_CHECK that avoids checking of the a.out mid field. 2000-11-01 14:23:04 +00:00
thorpej 9516ee90da Split the UDP routines out of net.c. 2000-10-25 01:49:55 +00:00
takemura c6304c954b Add LIBSA_RENAME_PRINTF to solve conflict with prototype definition of
printf() and etc in header files of Windows CE native compiler.
2000-10-21 13:48:06 +00:00
lukem 2a5013bcd3 show "press return" instead of "type return", since it's a key name and
not the actual word...
2000-10-02 23:35:54 +00:00
castor 5e29a96b48 Make standalone in_cksum work on little-endian machines, too, courtesy of
Jeff Smith, <jeffs@geocast.com>.
2000-03-31 19:55:09 +00:00
augustss 1279e67b6e Kill some more register declarations. 2000-03-30 12:19:46 +00:00
drochner f458367b3f cosmetics: remove double semicolon, whitespace 2000-02-03 19:53:03 +00:00
cgd fbf9177d1b provide stat() and fstat() here for standalone programs' use 2000-02-03 02:00:31 +00:00
tsutsui 11c8f56d48 Revert STRIPPROG -> STRIP 2000-02-01 05:25:24 +00:00
tsutsui e61f177ab1 STRIP -> STRIPPROG 2000-01-19 16:29:54 +00:00
hannken 2b8c4ea32e Fix IS_DATA and IS_TEXT. PF_X and PF_W are valid on p_pflags, not p_ptype. 1999-12-29 11:08:02 +00:00
simonb a09d3191a0 Remove leading '/' from pathnames, using same logic as ufs.c. Allows new
style (but not yet committed) pmax bootblocks to open "/boot.pmax" on an
ISO image.  Same problem reported for NFS by Jason Thorpe.
1999-11-23 12:20:53 +00:00
thorpej ee03a4e035 Backout my libsa changes. 1999-11-13 21:29:12 +00:00
thorpej 36ff5d93e8 Backout my libsa changes. 1999-11-13 21:17:56 +00:00
thorpej 1e544cc5eb Backout my libsa changes. 1999-11-13 21:06:46 +00:00
lukem e8dc21a13a add -DNET_DEBUG to the list of commented-out debug options 1999-11-12 13:13:59 +00:00
lukem 053d3c3702 fix pointer size in debug message 1999-11-12 13:12:09 +00:00
simonb 7a03e8cda8 Add memset() prototype. 1999-11-12 12:24:42 +00:00
simonb 3f691021a6 Add strncpy().
Add prototypes for bcmp(), bzero() so the libsa compiles with WARNS=1
1999-11-12 01:26:28 +00:00
thorpej ab395306cd Small, MI strcat() and strcpy(). 1999-11-11 21:23:27 +00:00
thorpej a7abffa1f2 The hack needed to work around gcc lameness. 1999-11-11 20:36:52 +00:00
thorpej 471a3aa8e4 Update for the improvements to libsa, and don't reference libkern.h. 1999-11-11 20:23:16 +00:00
thorpej 38200dd3e4 Networking routines needed for libsa to be self-contained. 1999-11-11 20:21:59 +00:00
thorpej c29af30c3c Minimal quad routines needed for libsa to be self-contained. The compiler
emits a reference to this one in the UFS code.
1999-11-11 20:20:35 +00:00
thorpej cad7e97082 Add small, MI strcmp(), strlen(), and strncmp() functions. Modules within
libsa depend on them, to it seems rather silly to have to build an additional
library (e.g. libkern) to get them.
1999-11-11 18:11:25 +00:00
kleink 522cbf0248 Update to match new SVR4-style definition names in <sys/exec_elf.h>. 1999-10-25 13:55:06 +00:00
itohy e72ef17380 - a.out header is not a part of text segment in NMAGIC.
- Fix section alignment code.
Patch supplied by Izumi Tsutsui, PR #8575.
1999-10-08 03:55:06 +00:00
ross 80fd51b82b Fix error flow that was broken 10 days ago in the previous commit.
Fixes the broken i386 boot blocks and closes port-i386/8432.
1999-09-20 11:58:15 +00:00
ross 54ab5cdc54 * Fix the volume zero recognition bug; it was interacting with a
feature to avoid rereads (which was added to work around bugs in
  old SRM versions that wouldn't rewind DATs, but would return no
  error on rewind callbacks)
* Initialize the volzero signature in ustarfs_open(), rather than as a
  side effect of the first read.
* Centralize error retry.
1999-09-10 07:22:03 +00:00
drochner 9b5129f15a add a function to verify a password against an in-core md5 sum 1999-09-09 15:52:37 +00:00
ross ad3beb5695 Fix read retry error case. Closes kern/8300.
While here, add automatic error retry up to 3 times.
1999-09-01 02:32:26 +00:00
simonb 9e0209e2c8 Remove prototype for find_inode(). 1999-08-19 00:19:16 +00:00
cgd b43600a96e note that these files should be easily diffable (until they share common code 1999-08-18 21:33:50 +00:00
cgd b4ecb1b468 Add a standalone LFS implementation. Currently not merged with ufs (FFS),
but should be (and will be before too long).  Until then, it and ufs.?
should be easily diffable.
1999-08-18 20:04:39 +00:00
cgd cd10ee60f6 set f_seekp to 0 in ufs_open() before returning. It ended up being 0
in most situations, but not always: if the terminal path name component
being opened couldn't be found in the first fs block of the directory
that contained it, f_seekp would be non-zero (and Bad Things would result).
1999-08-17 02:26:32 +00:00
drochner 756fbc1ee8 fix damage in error handling crept in in 1.4 1999-07-12 12:34:57 +00:00
christos b953fb0414 bring back my friend the twiddle. 1999-06-22 22:44:16 +00:00
christos 16e8020994 Nuke obsolete printf comment. 1999-06-22 22:09:49 +00:00
cgd bb7cdd7c0b don't bother initializing 'freelist' -- it can be bss 1999-05-28 19:31:51 +00:00
drochner e6b49c7863 move intoa() from libsa:net.c to libkern, turn inet_ntoa() into a macro,
nuke ip_convertaddr()
1999-05-07 14:49:52 +00:00
drochner 192b3c733c Build libraries for kernel/standalone code from within their compilation
directories and use .PATH to lookup the source files.
(Formerly, the libs were built from the source dirs, with MAKEOBJDIR
set to the compilation directory.)
This solves 2 problems:
-"mkdep" and "make" are now consistent about the file lookup, this fixes
 bad interactions with amd reported in PR bin/7374 (Arne Juul) and
 lossage reported by Andrew Gillham ("obj" dirs and relative paths still
 don't work well together)
-kernel compile trees can be moved around without forcing a new
 "make depend" - fixing PR kern/4021 by Martin Husemann
1999-05-07 14:28:50 +00:00
christos a2c49bf69e Nuke local prototype for closeall(). Add a new define LIBSA_NO_CLOSE so that
we don't try to close files, if we are not using any other I/O.
1999-04-28 13:24:12 +00:00