summaryrefslogtreecommitdiffstats
path: root/lib/libstand
Commit message (Collapse)AuthorAgeFilesLines
* Add pkgfs, a file system implementation for reading files out of amarcel2014-07-313-0/+793
| | | | | | | | | | | | | | | | | | compressed tarball, aka package. The file system assumes that the files are layed-out in the same order as needed to allow for the package to be streamed. As such, it does not read an entire package into memory first. Some properties of the file system: o Files that start with '+' are silently skipped. These are found in FreeBSD package files. o Files smaller than or equal to 4KB will be cached in memory and as such allow for some flexibility in accessing files out of order. o Files with the .tgz suffix are assumed to be (sub-)packages and signal the end for a directory scan. Obtained from: Juniper Networks, Inc.
* Provide a means for loaders to control which file system to use. Thismarcel2014-07-302-9/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | to counteract the default behaviour of always trying each and every file system until one succeeds, or the open fails. The problem with the loader is that we've implemented features based on this behavior. The handling of compressed files is a good example of this. However, it is in general highly undesirable to not have a one-time probe (or taste in the geom lingo), followed by something similar to a mount whenever we (first) read from a device. Everytime we go to the same device, we can reasonably assume it (still) has the same file system. For file systems that need to do far more that a trivial read of a super block, not having something similar to a mount operation is disastrous from a performance (and thus usability) perspective. But, again, since we've implemented features based on this stateless approach, things can get complicated quickly if and when we want to change this. And yet, we sometimes do need stateful behaviour. For this reason, this change simply introduces exclusive_file_system. When set to the fsops of the file system to use, the open call will only try this file system. Setting it to NULL restores the default behaviour. It's a low-cost (low-brow?) approach to provide enough control without re-implementing the guts of the loader. A good example of when this is useful is when we're trying to load files out of a container (say, a software packaga) that itself lives on a file system or is fetched over the network. While opening the container can be done in the normal stateless manner, once it is opened, subsequent opens should only consider the container. Obtained from: Juniper Networks, Inc.
* libstand's qdivrem.c assumes that sizeof(int) == sizeof(long), this is notsbruno2014-07-242-13/+14
| | | | | | | | | | | | | | | true on amd64 I'm not quite positive this is the "correct" solution for this but it does seem to compile and shut up the spew of warnings when compiling libstand for userboot. Add two _Static_asserts() so that in the future somebody will get a compile failure if an architecture develops that violates the assumptions of this code. (strongly suggested by jmg) Change commetns to indicate int types instead of long. (noted by ian in phabric review) Phabric: https://phabric.freebsd.org/D443
* Remove ia64.marcel2014-07-071-13/+0
| | | | | | | | | | | | | | | | | This includes: o All directories named *ia64* o All files named *ia64* o All ia64-specific code guarded by __ia64__ o All ia64-specific makefile logic o Mention of ia64 in comments and documentation This excludes: o Everything under contrib/ o Everything under crypto/ o sys/xen/interface o sys/sys/elf_common.h Discussed at: BSDcan
* use .Mt to mark up email addresses consistently (part3)bapt2014-06-231-2/+2
| | | | | PR: 191174 Submitted by: Franco Fichtner <franco at lastsummer.de>
* style(9) requires an empty line when function have no local variables.hselasky2014-05-301-0/+2
| | | | | Suggested by: ae @ Sponsored by: DARPA, AFRL
* Add support for snprintf() to libstand.hselasky2014-05-302-6/+54
| | | | | Reviewed by: brooks @ Sponsored by: DARPA, AFRL
* Use src.opts.mk in preference to bsd.own.mk except where we need stuffimp2014-05-061-1/+1
| | | | from the latter.
* Spell NO_PROFILE= as MK_PROFILE=no.imp2014-04-251-2/+3
|
* Build libstand as a 64-bit library on ppc64emaste2014-02-092-7/+0
| | | | | | | | | The 32-bit bootloaders now link against libstand.a in sys/boot/libstand32, so there is no need to force /usr/lib/libstand.a to be 32-bit. This is equivalent to r261568 for amd64. Sponsored by: The FreeBSD Foundation
* Make libstand setjmp work for both 64- and 32-bit ABIs.nwhitehorn2014-02-071-27/+106
|
* Build libstand as a 64-bit library on amd64emaste2014-02-062-15/+9
| | | | | | | The 32-bit bootloaders now link against libstand.a in sys/boot/libstand32, so there is no need to force /usr/lib/libstand.a to be 32-bit. Sponsored by: The FreeBSD Foundation
* Set the malloc alignment to 64 bytes on platforms that use the U-Boot APIian2014-02-054-8/+25
| | | | | | | | | | | device drivers. Recent versions of u-boot run with the MMU enabled, and require DMA-based I/O to be aligned to cache line boundaries. These changes are based on a patch originally submitted by Juergen Weiss, but I reworked them and thus any problems are purely my fault. Submitted by: "Juergen Weiss" <weiss@uni-mainz.de> Reviewed by: imp, nwhitehorn, jhb
* For libstand and sys/boot, split off gcc-only flags into CFLAGS.gcc.dim2013-12-261-1/+1
| | | | | MFC after: 3 days X-MFC-With: r259730
* Fix readdir for the root directory on a FAT32 file system. The rootmarcel2013-12-192-5/+16
| | | | | | | | | | directory is like any subdirectory and as such needs to use a real cluster number. To this end, keep a DE structure for the root in the DOS_FS structure and populate it accordingly. While here: o allow consecutive path separators by skipping them all. o add missing $FreeBSD$ keyword to dosfs.h.
* Fix an inappropriate free of a non-dynamic value. While here, make themarcel2013-12-181-9/+12
| | | | | | | | | | | | | | | | | code more naive and robust: 1. When setting ev_value, also always set ev_flags appropriately 2. Always check ev_value and ev_flags before calling free. Both the value and the EV_DYNAMIC property can come directly from the consumers of the environment functionality, so it's good to be careful. And since this code is typically not looked at for long periods of time, it's good to have it be a little "dumb-looking". Trigger case for the bug: env_setenv("foo", 0, "1", NULL, NULL); env_setenv("foo", 0, "2", NULL, NULL); Obtained from: Juniper Networks, Inc.
* Clear f_rabuf after freeing the memory it points to. This prevents amarcel2013-12-181-1/+3
| | | | | | possible double free. Obtained from: Juniper Networks, Inc.
* Support long filenames.marcel2013-12-181-13/+24
| | | | Obtained from: Juniper Networks, Inc.
* Note that libstand is 32-bit on amd64 and powerpc64emaste2013-11-291-0/+4
| | | | Sponsored by: The FreeBSD Foundation
* 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
OpenPOWER on IntegriCloud