Commit Graph

22 Commits

Author SHA1 Message Date
Toomas Soome
1ecc859193 dosfs support in libstand is broken since r298230
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
2016-12-30 19:06:29 +00:00
Toomas Soome
ef97c45728 Fix remaining bugs in libstancd/cd9660.c reported by Bruce Evans.
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
2016-10-03 14:07:15 +00:00
Toomas Soome
062b8022ac Fix remaining cstyle issues in libstand/cd9660.c
Reported by:	Bruce Evans <brde@optusnet.com.au>
Reviewed by:	allanjude
Approved by:	allanjude (mentor)
Differential Revision:	https://reviews.freebsd.org/D8107
2016-10-01 07:46:28 +00:00
Toomas Soome
6a21906bea cstyle fix of cd9660_open in libstand
rS306534 did create bad cstyle by my mistake, correcting it.

Reviewed by:	allanjude
Approved by:	allanjude (mentor)
Differential Revision:	https://reviews.freebsd.org/D8103
2016-09-30 23:19:08 +00:00
Toomas Soome
339e076e67 cd9660_open should check for padding
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
2016-09-30 22:28:20 +00:00
Allan Jude
87ed2b7f5a A new implementation of the loader block cache
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
2016-04-18 23:09:22 +00:00
Pedro F. Giffuni
d5808ebf65 libstand: use NULL instead of zero for pointers. 2016-04-18 14:45:56 +00:00
Nathan Whitehorn
149ae064ad Fix loader's ability to read the 10.1 release PowerPC ISOs. There appears to
be some kind of problem with the version of makefs used for these disks.
There may be a better way to handle this problem, so I've set the MFC
timer for a fairly long time period.

MFC after:	2 weeks
2014-12-30 16:55:53 +00:00
Ian Lepore
7668336c8e Add a divisor parameter to twiddle() so that callers can request that output
only happen on every Nth call.  Update the existing twiddle() calls done in
various IO loops to roughly reflect the relative IO sizes.  That is, tftp
and nfs call twiddle() on every 1K block, ufs on every filesystem block,
so the network calls now use a much larger divisor than disk IO calls.

Also add a new twiddle_divisor() function that allows an application to set
a global divisor that is applied on top of the per-call divisors.  Nothing
calls this yet, but loader(8) will be using it to further throttle the
cursor for slow serial consoles.
2014-12-22 20:42:36 +00:00
Craig Rodrigues
74ff69fe44 Switch to ANSI function prototypes in a few places.
Get rid of some unused parameter warnings.
2011-05-03 04:44:50 +00:00
Dag-Erling Smørgrav
a92fef8afc Implement the full range of ISO9660 number conversion routines in iso.h.
MFC after:	2 weeks
2005-10-18 13:35:08 +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
Matthew Dillon
e74b6a84ce Add __FBSDID()s to libstand 2001-09-30 22:28:01 +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
Andrew Gallatin
481184b805 fix cd9660 to work on files larger than ISO_DEFAULT_BLOCK_SIZE and unbreak
cdboot on alphas (which has been broken since just after 4.0-RELEASE)

submitted by: jlemon
2001-04-07 23:48:46 +00:00
Jonathan Lemon
efb8ff8532 Add a readdir function to the loader fsops vector, and implement the
functionality for some of the filesystesms.
2000-04-29 20:47:10 +00:00
David E. O'Brien
f8c1abb102 trailing white space removal. 2000-01-18 07:43:12 +00:00
David E. O'Brien
c35874acaa Add two new functions cd9660_readfile() & cd9660_readdir(), which
cd9660_read() now uses to read CDROMs.  With these changes FreeBSD/Alpha
can now boot from a bootable CDROM.

Submitted by:	dfr
2000-01-18 07:37:10 +00:00
Mike Smith
4ce36a791b Path arguments to *_open functions should be const, but we were mangling
them.

Submitted by:	write-protected text segment in BTX
1998-09-18 22:58:01 +00:00
Mike Smith
6b4f575cb1 This is libstand; a support library for standalone executables (eg. bootstrap
modules).
Obtained from: NetBSD, with some architectural changes and many additions.
1998-08-20 08:19:55 +00:00