summaryrefslogtreecommitdiffstats
path: root/lib/libstand
Commit message (Collapse)AuthorAgeFilesLines
* Unbreak zfsloader with LOADER_TFTP_SUPPORT onkan2013-10-091-2/+6
| | | | | | | | | | Only accept 'net' and 'pxe' devices as underlying transport in tftp.c on x86. Prior to this change tftp code would attempt to send packets over any boot device, including zfs one with predictably sad results. Approved by: re (gjb) MFC After: 1 month
* Move pos++ out of the complicated equation, introduced at r240780.mav2013-07-011-2/+3
| | | | | | | | There is an oppinion that result of that equation is compiler-specific. Submitted by: dt71@gmx.com, kientzle Reviewed by: rmacklem MFC after: 3 days
* libstand: Reset the seek pointer in ext2fs as done in UFS.pfg2013-06-091-0/+2
| | | | | | | | | | | | | | | | | | | | | Based on r134760: Reset the seek pointer to 0 when a file is successfully opened, since otherwise the initial seek offset will contain the directory offset of the filesystem block that contained its directory entry. This bug was mostly harmless because typically the directory is less than one filesystem block in size so the offset would be zero. It did however generally break loading a kernel from the (large) kernel compile directory. Also reset the seek pointer when a new inode is opened in read_inode(), though this is not actually necessary now because all callers set it afterwards. PR: 177328 Submitted by: Eric van Gyzen Reviewed by: iedowse MFC after: 5 days
* Remove an extra copy of _setjmp from libstand. We have used the libc versionandrew2013-06-071-106/+0
| | | | of this function since r183876.
* Enable building string functions as part of libstand on mips; the Makefilerwatson2013-04-281-3/+1
| | | | | | | | | is a bit obfuscated here, as ia64 adds string source files elsewhere, so simply exclude it here. Reviewed by: imp MFC after: 3 days Sponsored by: DARPA, AFRL
* Merge @228176 from Perforce to fix a bug introduced in r249553:rwatson2013-04-281-2/+0
| | | | | | | | | | Trim two now-unneeded (and likely harmful) lines from the libstand setjmp/longjmp for MIPS. Spotted by: jmallett MFC after: 3 days Sponsored by: DARPA, AFRL
* Use a suitable code generation when building libstand for MIPS.rwatson2013-04-161-0/+3
| | | | | | Reviewed by: imp Sponsored by: DARPA, AFRL MFC after: 3 days
* Adapt libstand's setjmp/longjmp MIPS support to be portable across 32-bitrwatson2013-04-161-56/+27
| | | | | | | | | and 64-bit MIPS. Don't use the floating-point coprocessor in the libstand context for MIPS. Reviewed by: imp MFC after: 3 days Sponsored by: DARPA, AFRL
* Add __clzsi2 and ctzsi2. They are required on ARMv4 and ARMv5 to implementandrew2013-03-071-0/+3
| | | | a number of builtin functions.
* Make this WARNS=9 clean on i386 w/ clang.marcel2013-03-021-15/+14
|
* Fix warnings (control reaches end of non-void function).marcel2013-03-021-1/+2
|
* Fix nandfs support by providing the same crc32 function as is usedmarcel2013-03-021-2/+23
| | | | | | in newfs_nandfs. In libstand we get crc32 from libz. The polynomial is not the same as used for nandfs, which is the crc32 used in the kernel.
* Fix includes for use in libstand.kientzle2013-02-191-3/+1
|
* Add strtoul() to libstand by copying from libc and clipping outkientzle2013-02-183-1/+125
| | | | locale code.
* * Add the integer div & mod functions and ARM EABI support functions toandrew2013-02-051-0/+13
| | | | | | libstand. * Stop linking the ARM U-Boot loader against libgcc now libstand has the required symbols.
* Remove unused file.glebius2013-01-291-261/+0
|
* Move the 64-bit _setjmp to lib/libstand.rpaulo2012-12-211-0/+93
|
* Correct detection of a superblock.gber2012-10-031-8/+7
| | | | Obtained from: Smartcom Bulgaria AD
* Revert r240850 and remove redundant NULL check before free(3).kevlo2012-09-241-8/+4
| | | | | | free(3) handles NULL parameter fine. Reviewed by: kib, Garrett Cooper
* Avoid NULL dereferencekevlo2012-09-231-2/+4
|
* Make nfs_readdir() more careful about using response data, cached in globalmav2012-09-211-20/+24
| | | | | | buffer. For now it fixes bug when following `ls` command will return data from previous one aborted by pager. Also it should allow to read several directories same time, for example, for recursive tracerse.
* Don't use global nfs_root_node variable as per-file storage. There aremav2012-09-211-51/+35
| | | | fields that should be file-specific.
* MFV: Update zlib to 1.2.7.delphij2012-06-211-6/+12
| | | | | | | | (x86 assembler optimization disabled for now because it requires the new .cfi_* directives that is not supported by base system binutils). MFC after: 1 week
* Consitently use "__LP64__".obrien2012-05-241-1/+1
| | | | | [there are 33 __LP64__'s in the kernel (minus cddl/ and contrib/), and 11 _LP64's]
* Import work done under project/nand (@235533) into head.gber2012-05-173-0/+1045
| | | | | | | | | | | | | | The NAND Flash environment consists of several distinct components: - NAND framework (drivers harness for NAND controllers and NAND chips) - NAND simulator (NANDsim) - NAND file system (NAND FS) - Companion tools and utilities - Documentation (manual pages) This work is still experimental. Please use with caution. Obtained from: Semihalf Supported by: FreeBSD Foundation, Juniper Networks
* Replace index() and rindex() calls with strchr() and strrchr().ed2012-01-031-3/+3
| | | | | | | | | | The index() and rindex() functions were marked LEGACY in the 2001 revision of POSIX and were subsequently removed from the 2008 revision. The strchr() and strrchr() functions are part of the C standard. This makes the source code a lot more consistent, as most of these C files also call into other str*() routines. In fact, about a dozen already perform strchr() calls.
* Merge index() and strchr() together.ed2012-01-031-8/+7
| | | | | | | | | | | | | | | | | As I looked through the C library, I noticed the FreeBSD MIPS port has a hand-written version of index(). This is nice, if it weren't for the fact that most applications call strchr() instead. Also, on the other architectures index() and strchr() are identical, meaning we have two identical pieces of code in the C library and statically linked applications. Solve this by naming the actual file strchr.[cS] and let it use __strong_reference()/STRONG_ALIAS() to provide the index() routine. Do the same for rindex()/strrchr(). This seems to make the C libraries and static binaries slightly smaller, but this reduction in size seems negligible.
* Add placeholder code for prepending pathnames to tftp.ed2011-12-221-0/+7
| | | | | | | | | | | | At work we have a single tftp server that provides installation data for a variety of operating systems. I'd rather place our FreeBSD-related files in a subdirectory, instead of the root. It would be nice if this setting could be run-time configurable, but at least in our specific case, this is not possible, as pxeboot is chainloaded through pxelinux. Sponsored by: Kumina bv
* - Removing some unneeded definitions of NULL(cruft related to 1970's C).avatar2011-07-106-29/+15
| | | | | | | | | | | | | | | | | | | | | | In C90, NULL is guaranteed to be declared in <stddef.h> and also in <string.h>. Though the correct way to define NULL in FreeBSD is to include <sys/_null.h>, other parts of libstand still require <string.h> to build; therefore, we keep <string.h> in stand.h and add a note about this; - Removing no longer used 'Prototype' definition. Quote from bde@: 'Cruft related to getting incomplete struct declarations within prototypes forward-declared before the structs. It doesn't mean "prototype" but only part of a prototype-related hack. No longer used.' - Replacing iaddr_t with uintptr_t; - Removing use of long double to determine alignment. Use a fixed 16 byte alignment instead; Reviewed by: bde Obtained from: DragonFlyBSD (partially) MFC after: 1 month
* style(9) cleanupkevlo2011-07-101-1/+1
|
* Fixing building bustage on 32 bits platforms when WARNS >= 2. Note thatavatar2011-07-082-5/+10
| | | | | | | | | this fix only applies to zalloc.c, the other part of libstand such like qdivrem.c still gives compilation warnings on sparc64 tinderbox builds; therefore, WARNS level isn't changed for now. Submitted by: Garrett Cooper <yanegomi@gmail.com> Reviewed by: bde
* Fixes to newer tftp code in libstand:rodrigc2011-06-241-51/+132
| | | | | | | | | | | | | | | | | | (1) Coding style changes. (2) If the server does not acknowledge any blocksize option, revert to the default blocksize of 512 bytes. (3) Send ACK if the first packet happens to be the last packet. (4) Do not accept blocksize greater than what was requested. (5) Drop any unwanted OACK received if a tftp transfer is already in progress. (6) Terminate incomplete transfers with a special no-error ERROR packet. Otherwise we rely on the tftp server to time out, which it does eventually, after re-sending the last packet several times and spamming the system log about it every time. This idea is borrowed from the PXE client, which does exactly that. Submitted by: Alexander Kabaev <kan@FreeBSD.org> Reviewed and Tested by: Santhanakrishnan Balraj <sbalraj at juniper dot net>
* Setting warnings without make universe considered harmful. Revert to WARNS=0imp2011-06-161-1/+1
| | | | until such time that the warnings at =2 are fixed for all platforms.
* Using the correct format string(%zu) for size_t type. This should fix 64avatar2011-06-161-1/+1
| | | | | | bits builds. Submitted by: Garrett Cooper <yanegomi@gmail.com>
* Unbreaking build on sparc64.avatar2011-06-161-3/+3
| | | | Submitted by: Garrett Cooper <yanegomi@gmail.com>
* Bring back following change which was undone in previous commit:rodrigc2011-06-151-4/+4
| | | | | | | | | | | | | | | | | | | ------------------------------------------------------------------------ r172854 | marius | 2007-10-21 10:03:18 -0700 (Sun, 21 Oct 2007) | 16 lines Changed paths: M /head/lib/libstand/tftp.c - Given that we tell the compiler that struct ip is packed and 32-bit aligned, GCC 4.2.1 also generates code for sendudp() that assumes this alignment. GCC 4.2.1 however doesn't 32-bit align wbuf, causing the loader to crash due to an unaligned access of wbuf in sendudp() when netbooting sparc64. Solve this by specifying wbuf as packed and 32-bit aligned, too. As for lastdata and readudp() this currently is no issue when compiled with GCC 4.2.1, though give lastdata the same treatment as wbuf for consistency and possibility of being affected in the future. [1] - Sprinkle const on a lookup table. ------------------------------------------------------------------------
* Increase WARNS level to 2.rodrigc2011-06-151-1/+1
|
* (1) When sending the TFTP RRQ packet to read a file,rodrigc2011-06-151-35/+229
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | send along the "blksize" option specified in RFC2348, and the "tsize" option specified in RFC2349. Add code to parse the TFTP Option Acknowledgement (OACK) packet as specified in RFC2347. For TFTP servers which support the "blksize" option, we can specify a TFTP Data block size larger than the default 512 bytes specified in RFC1350. This offers greater read performance when downloading files. We request an initial size of 1428 bytes, which is less than the Ethernet MTU of 1500 bytes. If the TFTP server sends back an OACK packet, then use the block size specified in the OACK packet. Most times it is usually the same value as what we request. If the TFTP server supports RFC2348, we will see performance improvements by transferring files over TFTP with larger block sizes. If we do not get back an OACK packet, then we most likely we are interoperating with a legacy TFTP server that does not support TFTP extension options, so default to the block size of 512 bytes. (2) If the "tftp.blksize" environment variable is set, then take that value and use it when sending the TFTP RRQ packet, instead of 1428. This allows us to set different values of "tftp.blksize" in the loader, so that we can test out different TFTP block sizes at run time. Obtained from: Juniper Networks Fixed by: rodrigc
* Currently tftp code in the loader retransmits the previous packet if it ↵rodrigc2011-06-151-0/+4
| | | | | | | | | | receives any unwanted packet(non-tftp). Change this to retransmit the packet(request or ack) only after a timeout. Obtained from: Juniper Networks Fixed by: Santhanakrishnan Balraj <sbalraj at juniper dot net>
* Added sendrecv_tftp function instead of sendrecv for use by tftp.rodrigc2011-06-151-2/+55
| | | | | | | | | | | In sendrecv_tftp: * Upon receving an unexpected block of data or error, resend the ACK immediately instead of waiting till the expiry of receive data timeout to resend the ACK. * change the receive timeout value between retries to be 2xMINTMO. Obtained from: Juniper Networks Fixed by: Santhanakrishnan Balraj <sbalraj at juniper dot net>
* In sendrecv function, change the receive timeout value between retriesrodrigc2011-06-151-1/+1
| | | | | | | | to increase in steps of MINTMO, instead of doubling the timeout for every retry. Obtained from: Juniper Networks Fixed by: Santhanakrishnan Balraj <sbalraj at juniper dot net>
* Obtain bswap64() function implementation fromrodrigc2011-06-101-10/+26
| | | | | | version 1.3 of src/common/lib/libc/gen/bswap64.c in NetBSD. Obtained from: NetBSD
* Rename DEBUG macro to TFTP_DEBUG, to be more consistent withrodrigc2011-05-031-5/+5
| | | | debug macros in other files.
* - Comment out unused variable.rodrigc2011-05-031-2/+2
| | | | - Add parentheses around expression to eliminate compiler warning.
* Add #include <netinet/in_pcb.h> for missing forward declation ofrodrigc2011-05-032-0/+2
| | | | struct inpcb.
* Switch to ANSI function prototypes in a few places.rodrigc2011-05-036-43/+22
| | | | Get rid of some unused parameter warnings.
* Fix typos - remove duplicate "the".brucec2011-02-211-1/+1
| | | | | | PR: bin/154928 Submitted by: Eitan Adler <lists at eitanadler.com> MFC after: 3 days
* On i386 and amd64, consistently use the following options whenever wedim2011-01-051-1/+1
| | | | | | want to avoid using any "advanced" CPU features: -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -msoft-float
* In lib/libstand, sys/boot/ficl and sys/boot/zfs, -mno-sse3 should alsodim2011-01-051-4/+1
| | | | be used for amd64, not just for i386.
* mdoc: drop redundant .Pp and .LP callsuqs2010-10-081-4/+0
| | | | They have no effect when coming in pairs, or before .Bl/.Bd
OpenPOWER on IntegriCloud