aboutsummaryrefslogtreecommitdiff
path: root/lib/libstand
Commit message (Collapse)AuthorAgeFilesLines
* prefix UFS symbols with UFS_ to reduce namespace pollutionEd Maste2017-02-153-50/+50
| | | | | | | | | | | | | | | | | | | | | Specifically: ROOTINO -> UFS_ROOTINO WINO -> UFS_WINO NXADDR -> UFS_NXADDR NDADDR -> UFS_NDADDR NIADDR -> UFS_NIADDR MAXSYMLINKLEN_UFS[12] -> UFS[12]_MAXSYMLINKLEN (for consistency) Also prefix ext2's and nandfs's NDADDR and NIADDR with EXT2_ and NANDFS_ Reviewed by: kib, mckusick Obtained from: NetBSD MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D9536 Notes: svn path=/head/; revision=313780
* ufs: Use UFS_MAXNAMLEN constantConrad Meyer2017-02-091-1/+1
| | | | | | | | | | | | | | (like NFS, EXT2FS, SVR4, IBCS2) instead of redefining the MAXNAMLEN constant. No functional change. Reviewed by: kib@, markj@ Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D9500 Notes: svn path=/head/; revision=313475
* loader: Replace EFI part devices.Toomas Soome2017-02-061-0/+1
| | | | | | | | | | | | | | | | | | | | Rewrite EFI part device interface to present disk devices in more user friendly way. We keep list of three types of devices: floppy, cd and disk, the visible names: fdX: cdX: and diskX: Use common/disk.c and common/part.c interfaces to manage the partitioning. The lsdev -l will additionally list the device path. Reviewed by: imp, allanjude Approved by: imp (mentor), allanjude (mentor) Differential Revision: https://reviews.freebsd.org/D8581 Notes: svn path=/head/; revision=313333
* remove network mask calculation for Classful networkBaptiste Daroussin2017-01-071-23/+10
| | | | | | | | | | | | | Nowadays it's not necessary to compute network mask from the IP address and compare to given by DHCP. Submitted by: kczekirda Reviewed by: glebius, bapt MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D8740 Notes: svn path=/head/; revision=311659
* Restructure libz, place vendor files in contrib/zlib like other thirdXin LI2017-01-041-3/+3
| | | | | | | | | | | | | | | | | | | | | | | party software, this provides more standarized import workflow and makes future upgrades easier. The following files are new with this commit: zconf.h.in zlib.map zlib.pc.in They are not connected to build, but were kept in tree for reference for future maintenance. All our local trivial changes were applied to contrib/zlib, and the contrib/zlib vendor source code is intended to 100% match lib/libz before this commit. MFC after: 2 weeks Notes: svn path=/head/; revision=311275
* loader: nandfs calls strategy with one extra argument.Toomas Soome2016-12-301-1/+1
| | | | | | | | | | | | | The strategy argument cleanup in r310850 did miss another call to strategy(), and left it with extra argument. Reviewed by: allanjude Approved by: allanjude (mentor) MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D9003 Notes: svn path=/head/; revision=310853
* dosfs support in libstand is broken since r298230Toomas Soome2016-12-308-52/+38
| | | | | | | | | | | | | | | | | | | | | | Apparently the libstand dosfs optimization is a bit too optimistic and did introduce possible memory corruption. This patch is backing out the bad part and since this results in dosfs reading full blocks now, we can also remove extra offset argument from dv_strategy callback. The analysis of the issue and the backout patch is provided by Mikhail Kupchik. PR: 214423 Submitted by: Mikhail Kupchik Reported by: Mikhail Kupchik Reviewed by: bapt, allanjude Approved by: allanjude (mentor) MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D8644 Notes: svn path=/head/; revision=310850
* libstand: dosfs cstyle cleanup for return keyword.Toomas Soome2016-12-011-48/+48
| | | | | | | | | Reviewed by: bapt, imp, allanjude Approved by: imp (mentor), allanjude (mentor) Differential Revision: https://reviews.freebsd.org/D8678 Notes: svn path=/head/; revision=309369
* Loader paged/pageable data is not always paged.Toomas Soome2016-11-081-1/+1
| | | | | | | | | | | | | | | | | | | This change does modify devsw dv_print() to return the int value, enabling walkers to interrupt the walk on non zero value from dv_print(). This will allow the pager_print actually to stop displaying data on user input, and additionally pager is used in various *dev_print callbacks, where it was missing. For test, lsdev [-v] command should display data by screenfuls and should stop when the key 'q' is pressed on pager prompt. Reviewed by: allanjude Approved by: allanjude (mentor) Differential Revision: https://reviews.freebsd.org/D5461 Notes: svn path=/head/; revision=308434
* When issuing a PXE dhcp request, always issue a param request (DHCP option 55)Baptiste Daroussin2016-10-311-1/+11
| | | | | | | | | | | | | | | with all dhcp parameters we might be interested in. Some DHCP server like the new kea (by ISC) expect it. This makes pxeboot functional with ISC kea. Submitted by: Vincent Legout <vincent.legout@gandi.net> MFC after: 1 month Sponsored by: Gandi.net Notes: svn path=/head/; revision=308129
* Fix remaining bugs in libstancd/cd9660.c reported by Bruce Evans.Toomas Soome2016-10-031-2/+2
| | | | | | | | | | | | Fixed text in comments. Reported by: Bruce Evans <brde@optusnet.com.au> Reviewed by: allanjude Approved by: allanjude (mentor) Differential Revision: https://reviews.freebsd.org/D8119 Notes: svn path=/head/; revision=306638
* Fix remaining cstyle issues in libstand/cd9660.cToomas Soome2016-10-011-3/+1
| | | | | | | | | | Reported by: Bruce Evans <brde@optusnet.com.au> Reviewed by: allanjude Approved by: allanjude (mentor) Differential Revision: https://reviews.freebsd.org/D8107 Notes: svn path=/head/; revision=306552
* cstyle fix of cd9660_open in libstandToomas Soome2016-09-301-4/+4
| | | | | | | | | | | rS306534 did create bad cstyle by my mistake, correcting it. Reviewed by: allanjude Approved by: allanjude (mentor) Differential Revision: https://reviews.freebsd.org/D8103 Notes: svn path=/head/; revision=306538
* cd9660_open should check for paddingToomas Soome2016-09-301-1/+9
| | | | | | | | | | | The libstand cd9660 reader code must check for extents having padding. Reviewed by: jhb Approved by: allanjude (mentor) Differential Revision: https://reviews.freebsd.org/D8101 Notes: svn path=/head/; revision=306534
* Add a comment on the #endif related to the guardsBaptiste Daroussin2016-09-131-1/+1
| | | | | | | Reported by: tsoome Notes: svn path=/head/; revision=305770
* pxeboot: Add nfs.read_size tunable.Sepherosa Ziehau2016-09-081-9/+24
| | | | | | | | | | | | | | Increase this tunable improves kernel loading speed. Submitted by: Jun Su <junsu microsoft com> Reviewed by: rpokala, wblock (previous version) Obtained from: DragonFlyBSD MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7756 Notes: svn path=/head/; revision=305588
* Renumber the advertising clause.Warner Losh2016-09-061-1/+1
| | | | Notes: svn path=/head/; revision=305480
* Netboot: allow both tftpfs and nfs in both pxeboot and loader.efiBaptiste Daroussin2016-08-316-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a new 'netproto' variable which can be set for now to NET_TFTP or NET_NFS (default to NET_NONE) From the dhcp options if one sets the root-path option to: "ip:path", the loader will consider it is booting over NFS (meaning same behaviour as the default current behaviour) if the dhcp option "tftp server address" is set (option 150) the loader will consider it is booting over tftpfs, it will then consider the root-path options with 2 possible case 1. "path" then the IP of the tftp server will be the one passed by the option 150, and the files will be retrieved under "path" on the tftp server 2. "ip:path" then the IP of the tftp server will be the one passed in the option "overwritting the IP from the option 150. We could not "abuse" the rootpath option in the form or tftp://ip:path because this is already used for other purpose by iPXE preventing any chainload from iPXE to the FreeBSD loader. Given at each open(), the loader loops over all available filesystems and keep the "best" error, we needed to prevent tftpfs to fallback on nfs and vice versa. the tftpfs and nfs implementation in libstand now return EINVAL early if 'netproto' for that purpose. Reviewed by: tsoome Relnotes: yes Sponsored by: Gandi.net Differential Revision: https://reviews.freebsd.org/D7628 Notes: svn path=/head/; revision=305125
* recvtftp() is broken for large files, report file sizeToomas Soome2016-08-311-2/+4
| | | | | | | | | | | | | | | | The tftp download for large files will cause internal block id to wrap to 0 as the data type is unsigned short. Also provide file size information for stat. PR: 200500 Reported by: tsoome Reviewed by: allanjude Approved by: allanjude (mentor) Differential Revision: https://reviews.freebsd.org/D7660 Notes: svn path=/head/; revision=305116
* Unused variables and cstyle fix for loader dosfsToomas Soome2016-08-261-4/+4
| | | | | | | | | Reviewed by: imp, allanjude Approved by: imp (mentor), allanjude (mentor) Differential Revision: https://reviews.freebsd.org/D7659 Notes: svn path=/head/; revision=304850
* Fix a bug in the parsing code: always use the len and not 8.Warner Losh2016-05-201-1/+1
| | | | Notes: svn path=/head/; revision=300264
* Add support for %S to libstand as well so /boot/loader and friends canWarner Losh2016-05-171-0/+5
| | | | | | | use it. Notes: svn path=/head/; revision=300078
* libstand: make more use of the howmany() macro when available.Pedro F. Giffuni2016-04-261-1/+1
| | | | | | | | We have a howmany() macro in the <sys/param.h> header that is convenient to re-use as it makes things easier to read. Notes: svn path=/head/; revision=298601
* Unbreak the build if you enable WITH_NANDAllan Jude2016-04-191-2/+2
| | | | | | | | | | Followup to r298230 Submitted by: Nikolai Lifanov <lifanov@mail.lifanov.com> (original version) Sponsored by: ScaleEngine Inc. Notes: svn path=/head/; revision=298242
* A new implementation of the loader block cacheAllan Jude2016-04-188-103/+189
| | | | | | | | | | | | | | | | | | | | The block cache implementation in loader has proven to be almost useless, and in worst case even slowing down the disk reads due to insufficient cache size and extra memory copy. Also the current cache implementation does not cache reads from CDs, or work with zfs built on top of multiple disks. Instead of an LRU, this code uses a simple hash (O(1) read from cache), and instead of a single global cache, a separate cache per block device. The cache also implements limited read-ahead to increase performance. To simplify read ahead management, the read ahead will not wrap over bcache end, so in worst case, single block physical read will be performed to fill the last block in bcache. Booting from a virtual CD over IPMI: 0ms latency, before: 27 second, after: 7 seconds 60ms latency, before: over 12 minutes, after: under 5 minutes. Submitted by: Toomas Soome <tsoome@me.com> Reviewed by: delphij (previous version), emaste (previous version) Relnotes: yes Differential Revision: https://reviews.freebsd.org/D4713 Notes: svn path=/head/; revision=298230
* libstand: use NULL instead of zero for pointers.Pedro F. Giffuni2016-04-183-10/+10
| | | | Notes: svn path=/head/; revision=298210
* MFHGlen Barber2016-04-047-64/+13
|\ | | | | | | | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/projects/release-pkg/; revision=297567
| * Correct comment.Bjoern A. Zeeb2016-03-221-1/+1
| | | | | | | | | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=297191
| * If the dhcp server delivers an interface-mtu option, parse it and storeIan Lepore2016-03-214-0/+11
| | | | | | | | | | | | | | | | | | | | | | the value in a new global intf_mtu for use by the application. These changes were inspired by the patch provided by Robert Blayzor in PR 187094, and will allow loader(8) to propagate the value to the kernel along with the other nfs_diskless parms delivered via environment vars. Notes: svn path=/head/; revision=297150
| * Actually garbage collect the unused code, as mentioned in r297147, whichIan Lepore2016-03-211-57/+0
| | | | | | | | | | | | | | this change should have been part of. Notes: svn path=/head/; revision=297148
| * Garbage collect the bswap routines from libstand. The declaration wasIan Lepore2016-03-212-6/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | wrapped in an i386 ifdef with a comment questioning their usefulness even there. It turns out they aren't referenced anywhere, but their presence prevents using sys/endian.h in libstand code. These days, sys/endian.h provides much better support for such things, using compiler builtins and inline functions (and creating connections between libstand code and header files from sys/ would not be breaking new ground). Notes: svn path=/head/; revision=297147
* | MFHGlen Barber2016-03-061-0/+4
|\| | | | | | | | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/projects/release-pkg/; revision=296422
| * Merge ^/head r295902 through r296006.Dimitry Andric2016-02-241-42/+0
| |\ | | | | | | | | | Notes: svn path=/projects/clang380-import/; revision=296007
| * \ Merge ^/head r294169 through r294598.Dimitry Andric2016-01-221-2/+2
| |\ \ | | | | | | | | | | | | Notes: svn path=/projects/clang380-import/; revision=294599
| * \ \ Merge ^/head r293430 through r293685.Dimitry Andric2016-01-111-2/+2
| |\ \ \ | | | | | | | | | | | | | | | Notes: svn path=/projects/clang380-import/; revision=293687
| * \ \ \ Merge ^/head r293280 through r293429.Dimitry Andric2016-01-081-1/+1
| |\ \ \ \ | | | | | | | | | | | | | | | | | | Notes: svn path=/projects/clang380-import/; revision=293430
| * | | | | Similar to r293384, for libstand, also use the new -mno-movt flag withDimitry Andric2016-01-081-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | clang >= 3.8.0 targeting arm. Notes: svn path=/projects/clang380-import/; revision=293426
* | | | | | MFHGlen Barber2016-03-021-42/+0
|\ \ \ \ \ \ | | |_|_|_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/projects/release-pkg/; revision=296318
| * | | | | DIRDEPS_BUILD: Regenerate without local dependencies.Bryan Drewery2016-02-241-42/+0
| | |_|_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These are no longer needed after the recent 'beforebuild: depend' changes and hooking DIRDEPS_BUILD into a subset of FAST_DEPEND which supports skipping 'make depend'. Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=295989
* / | | | First pass through library packaging.Glen Barber2016-02-041-0/+1
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/projects/release-pkg/; revision=295278
* | | / Bring in initial libc and libstand support for RISC-V.Ruslan Bukin2016-01-171-2/+2
| |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | Reviewed by: andrew, emaste, kib Sponsored by: DARPA, AFRL Sponsored by: HEIF5 Differential Revision: https://reviews.freebsd.org/D4943 Notes: svn path=/head/; revision=294227
* | | Make tohex() work as expected.Andrey V. Elsukov2016-01-091-1/+1
| | | | | | | | | | | | Notes: svn path=/head/; revision=293468
* | | Fix a typo.Andrey V. Elsukov2016-01-091-1/+1
| |/ |/| | | | | | | | | | | PR: 205722 Notes: svn path=/head/; revision=293467
* | Don't install /usr/include/stand.h twice after r293040.Bryan Drewery2016-01-071-1/+1
|/ | | | | | | | | Only install it from lib/libstand. Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=293341
* Add fls() to libstandEd Maste2016-01-061-2/+3
| | | | | | | | | | Although we don't use it in tree yet libstand is installed as user- facing /usr/liblibstand.a, and some work in progress makes use of it. Instead of conflicting with ongoing libstand Makefile deduplication, just add it now. Notes: svn path=/head/; revision=293241
* Reduce libstand Makefile duplicationEd Maste2016-01-011-3/+4
| | | | | | | | | | | | | | | | | | | libstand is built in three places (lib/libstand, sys/boot/libstand32, and sys/boot/userboot/libstand). Reduce Makefile duplication by .including libstand/Makefile from sys/boot/libstand32/Makefile. sys/boot/userboot/libstand/Makefile will be addressed later, as it contains additional differences yet to be handled. This change also switches libstand32 to use the new uuid_from_string and uuid_to_string, which was not included in r292473. Reviewed by: jhb Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D4747 Notes: svn path=/head/; revision=293040
* When building libstand for arm, don't emit instructions that requireIan Lepore2015-12-311-0/+6
| | | | | | | | | relocation fixups unsupported by the self_reloc() code, and don't optimize memcpy/memset using floating point registers, because in a standalone environment nothing has initialized the fpu hardware. Notes: svn path=/head/; revision=292993
* Allow dhcp/bootp server-provided values to be overriden from environmentIan Lepore2015-12-221-6/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | variables in loader(8) and other libstand applications. Sometimes a dhcp server provides incorrect information along with the IP address. It would be useful to have a way to override this with locally-supplied information, such as command line parameters passed from a prior-stage bootloader. This change allows pre-existing env vars to take precedence over values delivered by the dhcp or bootp server. The bootp/dhcp code in libstand automatically creates environment variables from the data provided by the server (dhcp.root-path, dhcp.domain-name, etc). It also transcribes the values to some global variables such as 'rootpath' and 'hostname'. This change does two things: When adding dhcp.* vars to the environment, don't replace existing vars/values. When setting the global vars rootpath and hostname, use the dhcp.root-path and dhcp.host-name env var values if they exist. This allows the platform-specific part of loader(8) to obtain override values in some platform-specific way and store them in the environment before opening the network device. The set of values that can be overriden is currently limited to just string options. The values that are delivered as binary data are things that probably shouldn't be overridden (IP, netmask, gateway, etc). The original patch this evolved from was submitted by martymac@ PR: 202098 Differential Revision: https://reviews.freebsd.org/D4559 Notes: svn path=/head/; revision=292583
* Create libstand version of uuid_from_string and uuid_to_string. TheWarner Losh2015-12-193-1/+244
| | | | | | | | | | | | | | normal libc versions of these functions use asprintf and sscanf, both of which aren't available in the libstand world. It's easier to rewrite these than to try to claw those functions into libstand. Also include uuid_create_nil, since it's safe to include. These were written from scratch, except for bits of comments that I got from the libc version, which are acknowledged in the source. Differential Revision: https://reviews.freebsd.org/D4540 Notes: svn path=/head/; revision=292473
* pxeboot: make the tftp loader use the option root-path directiveBaptiste Daroussin2015-12-161-3/+17
| | | | | | | | | | | | | | | | | | | | | | | pxeboot in tftp loader mode (when built with LOADER_TFTP_SUPPORT) now prefix all the path to open with the path obtained via the option 'root-path' directive. This allows to be able to use the traditional content /boot out of box. Meaning it now works pretty much like all other loaders. It simplifies hosting hosting multiple version of FreeBSD on a tftp server. As a consequence, pxeboot does not look anymore for a pxeboot.4th (which was never provided) Note: that pxeboot in tftp loader mode is not built by default. Reviewed by: rpokala Relnotes: yes Sponsored by: Gandi.net Differential Revision: https://reviews.freebsd.org/D4590 Notes: svn path=/head/; revision=292344