]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
13 years agoFix typo in comment.
kib [Wed, 29 Sep 2010 07:40:11 +0000 (07:40 +0000)]
Fix typo in comment.

13 years ago- kern_sched_rr_get_interval should return interval for thread 1 in
davidxu [Wed, 29 Sep 2010 07:31:05 +0000 (07:31 +0000)]
- kern_sched_rr_get_interval should return interval for thread 1 in
  target process.
- eliminate a goto.

MFC after: 1 week

13 years agoCheck invalid mutex in _mutex_cv_unlock.
davidxu [Wed, 29 Sep 2010 06:06:58 +0000 (06:06 +0000)]
Check invalid mutex in _mutex_cv_unlock.

13 years agoRemove a redundant instruction for casuword.
davidxu [Wed, 29 Sep 2010 02:36:58 +0000 (02:36 +0000)]
Remove a redundant instruction for casuword.

13 years agoSet the number of RX frames to receive after RX MBUF low watermark
yongari [Wed, 29 Sep 2010 00:00:45 +0000 (00:00 +0000)]
Set the number of RX frames to receive after RX MBUF low watermark
has reached. This reduced number of dropped frames when
flow-control is enabled. Previously it dropped incoming frames once
RX MBUF low watermark has reached. The value used in MAC RX MBUF
low watermark is greater than or equal to 4 so receiving two more
RX frames should not be a problem.

Obtained from: OpenBSD

13 years agofix breakage in in-kernel NAT: the code did not honor
luigi [Tue, 28 Sep 2010 23:23:23 +0000 (23:23 +0000)]
fix breakage in in-kernel NAT: the code did not honor
net.inet.ip.fw.one_pass and always moved to the next rule
in case of a successful nat.

This should fix several related PR (waiting for feedback
before closing them)

PR: 145167 149572 150141
MFC after: 3 days

13 years agoWhitespace changes to reduce diffs wrt the most recent ipfw/dummynet code:
luigi [Tue, 28 Sep 2010 22:46:13 +0000 (22:46 +0000)]
Whitespace changes to reduce diffs wrt the most recent ipfw/dummynet code:
+ remove an unused macro,
+ adjust the constants in an enum
+ small whitespace changes

MFC after: 3 days

13 years agouse make from the toolchain, as the source tree may depend on
luigi [Tue, 28 Sep 2010 22:30:11 +0000 (22:30 +0000)]
use make from the toolchain, as the source tree may depend on
specific features (e.g. on recent HEAD, rtld fails with older 'make')

MFC after: 3 days

13 years agofix outdated comment
ticso [Tue, 28 Sep 2010 21:13:54 +0000 (21:13 +0000)]
fix outdated comment

13 years agoRemove copyright strings printed at login time via login(1) or sshd(8).
emaste [Tue, 28 Sep 2010 20:57:14 +0000 (20:57 +0000)]
Remove copyright strings printed at login time via login(1) or sshd(8).
It is not clear to what this copyright should apply, and this is in line
with what other operating systems do.

For ssh specifically, printing of the copyright string is not in the
upstream version so this reduces our FreeBSD-local diffs.

Approved by: core, des (ssh)

13 years agoThis file has been unused for ages. Retire it.
imp [Tue, 28 Sep 2010 15:33:30 +0000 (15:33 +0000)]
This file has been unused for ages.  Retire it.

Submitted by: pluknet

13 years agoIn linprocfs_doargv():
kib [Tue, 28 Sep 2010 11:32:17 +0000 (11:32 +0000)]
In linprocfs_doargv():
- handle compat32 processes;
- remove the checks for copied in addresses to belong into valid
  usermode range, proc_rwmem() does this;
- simplify loop reading single string, limit the total amount of strings
  collected by ARG_MAX bytes;
- correctly add '\0' at the end of each copied string;
- fix style.

In linprocfs_doprocenviron():
- unlock the process before calling copyin code [1]. The process is held
  by pseudofs.

In linprocfs_doproccmdline:
- use linprocfs_doargv() to handle !curproc case for which p_args is not cached.

Reported by: plulnet [1]
Tested by: pluknet
Approved by: des (linprocfs maintainer, previous
version of the patch)
MFC after: 3 weeks

13 years agoDocument recently added GPT attributes (bootme, bootonce, bootfailed) and
pjd [Tue, 28 Sep 2010 09:07:00 +0000 (09:07 +0000)]
Document recently added GPT attributes (bootme, bootonce, bootfailed) and
list other schemes attributes.

Reviewed by: simon, rpaulo
MFC after: 2 weeks

13 years agoIn current code, statically initialized and destroyed object have
davidxu [Tue, 28 Sep 2010 04:57:56 +0000 (04:57 +0000)]
In current code, statically initialized and destroyed object have
same null value, the code can not distinguish between them, to
fix the problem, now a destroyed object is assigned to a non-null
value, and it will be rejected by some pthread functions.
PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP is changed to number 1, so that
adaptive mutex can be statically initialized correctly.

13 years agoAdd GPIO bus to config and hints. Also add sample gpioled device.
gonzo [Tue, 28 Sep 2010 03:34:51 +0000 (03:34 +0000)]
Add GPIO bus to config and hints. Also add sample gpioled device.

13 years agoAdd AR71XX GPIO bus driver.
gonzo [Tue, 28 Sep 2010 03:31:34 +0000 (03:31 +0000)]
Add AR71XX GPIO bus driver.

13 years agoAdd gpioctl(8). Utility for configuring/accessing GPIO pins
gonzo [Tue, 28 Sep 2010 03:28:20 +0000 (03:28 +0000)]
Add gpioctl(8). Utility for configuring/accessing GPIO pins

13 years agoInitial GPIO bus support. Includes:
gonzo [Tue, 28 Sep 2010 03:24:53 +0000 (03:24 +0000)]
Initial GPIO bus support. Includes:
  - GPIO bus controller interface
  - GPIO bus interface
  - Implementation of GPIO led(4) compatible device
  - Implementation of iic(4) bus over GPIO (author: Luiz Otavio O Souza)

Tested by: Luiz Otavio O Souza, Alexandr Rybalko

13 years agoRemove extra braces for style(9) (found while cleaning up an old work tree).
emaste [Tue, 28 Sep 2010 01:36:01 +0000 (01:36 +0000)]
Remove extra braces for style(9) (found while cleaning up an old work tree).

13 years agoIncrease maximum network timeout from 20s to 120s. Given that an ETIMEDOUT
emaste [Tue, 28 Sep 2010 01:30:49 +0000 (01:30 +0000)]
Increase maximum network timeout from 20s to 120s.  Given that an ETIMEDOUT
return from sendrecv probably means a failure to boot we might as well be
generous in the timeout period.

13 years agoUpdate code from Intel:
jfv [Tue, 28 Sep 2010 00:13:15 +0000 (00:13 +0000)]
Update code from Intel:
- Sync shared code with Intel internal
- New client chipset support added
- em driver - fixes to 82574, limit queues to 1 but use MSIX
- em driver - large changes in TX checksum offload and tso
  code, thanks to yongari.
- some small changes for watchdog issues.
- igb driver - local timer watchdog code was missing locking
  this and a couple other watchdog related fixes.
- bug in rx discard found by Andrew Boyer, check for null pointer

MFC: a week

13 years agoCorrect message.
pjd [Mon, 27 Sep 2010 21:10:37 +0000 (21:10 +0000)]
Correct message.

Pointed out by: jhb
MFC after: 2 weeks

13 years agoGive devices lots of time to settle around programming BARs and command
jmallett [Mon, 27 Sep 2010 20:35:40 +0000 (20:35 +0000)]
Give devices lots of time to settle around programming BARs and command
registers.  Without this, the settings do not seem to stick for Atheros NICs in
the PCI slot of the Lanner MR-320.

13 years agoUse the mii_data provided via mii_attach_args and mii_pdata respectively
marius [Mon, 27 Sep 2010 20:31:03 +0000 (20:31 +0000)]
Use the mii_data provided via mii_attach_args and mii_pdata respectively
instead of reaching out for the softc of the parent.

13 years agoo) Program the Lanner MR-320 for 32-bit mode, too.
jmallett [Mon, 27 Sep 2010 20:12:57 +0000 (20:12 +0000)]
o) Program the Lanner MR-320 for 32-bit mode, too.
o) Give a virtual address for I/O ports on n64.
o) On the Portwell CAM-0100, return the right IRQ for the on-board SATA.
o) Except on bridges, only set PORTEN and MEMEN on devices that have I/O or
   memory BARs respectively.
o) Disable PORTEN and MEMEN while reprogramming BARs.
o) On the Lanner MR-955, set the Tx DMA power register for the on-board Promise
   SATA controller.

13 years agoUse a single program header to fix loading 64-bit kernels on old versions of
jmallett [Mon, 27 Sep 2010 19:45:34 +0000 (19:45 +0000)]
Use a single program header to fix loading 64-bit kernels on old versions of
U-Boot.

13 years agoRewrite the i386 memory probe:
jhb [Mon, 27 Sep 2010 19:36:15 +0000 (19:36 +0000)]
Rewrite the i386 memory probe:
- Check for SMAP data from the loader first.  If it exists, don't bother
  doing any VM86 calls at all.  This will be more friendly for non-BIOS
  boot environments such as EFI, etc.
- Move the base memory setup into a new basemem_setup() routine instead
  of duplicating it.
- Simplify the XEN case by removing all of the VM86/SMAP parsing code rather
  than just jumping over it.
- Adjust some comments to better explain the code flow.

MFC after: 2 weeks

13 years agoAdd a bandaid for a long-standing race condition during route entry
delphij [Mon, 27 Sep 2010 19:26:56 +0000 (19:26 +0000)]
Add a bandaid for a long-standing race condition during route entry
un-expiring.

The previous version of code have no locking when testing rt_refcnt.
The result of the lack of locking may result in a condition where
a routing entry have a reference count but at the same time have
RTPRF_OURS bit set and an expiration timer.  These would eventually
lead to a panic:

panic: rtqkill route really not free

When the system have ICMP redirects accepted from local gateway
in a moderate frequency, for instance.

Commit this workaround for now until we have some better solution.

PR: kern/149804
Reviewed by: bz
Tested by: Zhao Xin, Pete French
MFC after: 2 weeks

13 years agoAdd manpages for clang and tblgen. These were generated from upstream's
dim [Mon, 27 Sep 2010 19:03:18 +0000 (19:03 +0000)]
Add manpages for clang and tblgen.  These were generated from upstream's
tools/clang/docs/tools/clang.pod and docs/CommandGuide/tblgen.pod,
respectively.

Approved-by: rpaulo (mentor)

13 years agoAdd a new function devfs_dev_exists() to be able to find out if a
jh [Mon, 27 Sep 2010 18:20:56 +0000 (18:20 +0000)]
Add a new function devfs_dev_exists() to be able to find out if a
specific devfs path already exists.

The function will be used from kern_conf.c to detect duplicate device
registrations. Callers must hold the devmtx mutex.

Reviewed by: kib

13 years agoAdd reference counting for devfs paths containing user created symbolic
jh [Mon, 27 Sep 2010 17:47:09 +0000 (17:47 +0000)]
Add reference counting for devfs paths containing user created symbolic
links. The reference counting is needed to be able to determine if a
specific devfs path exists. For true device file paths we can traverse
the cdevp_list but a separate directory list is needed for user created
symbolic links.

Add a new directory entry flag DE_USER to mark entries which should
unreference their parent directory on deletion.

A new function to traverse cdevp_list and the directory list will be
introduced in a separate commit.

Idea from: kib
Reviewed by: kib

13 years agoThe TWI controller automatically stops if we don't fill up with new data in
ticso [Mon, 27 Sep 2010 15:58:19 +0000 (15:58 +0000)]
The TWI controller automatically stops if we don't fill up with new data in
time.

13 years agoPrefer echo over printf
imp [Mon, 27 Sep 2010 15:55:39 +0000 (15:55 +0000)]
Prefer echo over printf

13 years agofix off by one error for twi reads with len != 1.
ticso [Mon, 27 Sep 2010 15:55:30 +0000 (15:55 +0000)]
fix off by one error for twi reads with len != 1.
STOP must be requested before the last byte is received.

13 years agoXLS B0 revision PCI support and related changes.
jchandra [Mon, 27 Sep 2010 14:50:51 +0000 (14:50 +0000)]
XLS B0 revision PCI support and related changes.

- XLS B0 and later revision chips have PCIe link 2 & 3 mapped to different
  PIC interrupts. Update pic.h, board.h and xlr_pci.c to reflect this.
- remove debug prints in xlr_pci.c
- add more processor IDs to board.h, add function xlr_is_xls_b0()
- some style(9) and whitespace fixes

13 years agoProperly handle IO with B_FAILFAST
mm [Mon, 27 Sep 2010 09:42:31 +0000 (09:42 +0000)]
Properly handle IO with B_FAILFAST
Retry IO once with ZIO_FLAG_TRYHARD before declaring a pool faulted

OpenSolaris revision and Bug IDs:

9725:0bf7402e8022
6843014 ZFS B_FAILFAST handling is broken

Approved by: delphij (mentor)
Obtained from: OpenSolaris (Bug ID 6843014)
MFC after: 3 weeks

13 years agoEnable offlining of log devices.
mm [Mon, 27 Sep 2010 09:05:51 +0000 (09:05 +0000)]
Enable offlining of log devices.

OpenSolaris revision and Bug IDs:

9701:cc5b64682e64
6803605 should be able to offline log devices
6726045 vdev_deflate_ratio is not set when offlining a log device
6599442 zpool import has faults in the display

Approved by: delphij (mentor)
Obtained from: OpenSolaris (Bug ID 680360567260456599442)
MFC after: 3 weeks

13 years ago- Remove clause 3 and 4 from TNF licenses.
marius [Sun, 26 Sep 2010 22:11:41 +0000 (22:11 +0000)]
- Remove clause 3 and 4 from TNF licenses.
- Remove closes 3 & 4 from Manuel Bouyer's license.

Obtained from: NetBSD

13 years agoRemove superfluous word from "gpart bootcode" usage message.
ae [Sun, 26 Sep 2010 21:48:32 +0000 (21:48 +0000)]
Remove superfluous word from "gpart bootcode" usage message.

Approved by: kib (mentor)

13 years agoCheck for NULL link registers as found in initial stack frames when doing
nwhitehorn [Sun, 26 Sep 2010 14:20:09 +0000 (14:20 +0000)]
Check for NULL link registers as found in initial stack frames when doing
stack unwinding, instead of naively trying to check the instruction at
that location. This fixes signal handling in threaded applications after
recent changes regarding unwinding in libthr. While here, clean up our
MD_FROB_UPDATE_CONTEXT() implementation a little.

13 years agoPlug memory leak on fork(2) failure.
pjd [Sun, 26 Sep 2010 10:39:01 +0000 (10:39 +0000)]
Plug memory leak on fork(2) failure.

Submitted by: Mikolaj Golub <to.my.trociny@gmail.com>
MFC after: 3 days

13 years agoReport death event to debugger before moving to gc list, otherwise
davidxu [Sun, 26 Sep 2010 06:45:24 +0000 (06:45 +0000)]
Report death event to debugger before moving to gc list, otherwise
debugger may can not find it on thread list.

13 years agoProtect the watchdog daemon against swap OOM killer. This is similar to
emaste [Sun, 26 Sep 2010 01:45:33 +0000 (01:45 +0000)]
Protect the watchdog daemon against swap OOM killer.  This is similar to
SVN r199804 which added protection to sshd, cron, syslogd, and inetd.

13 years agoFollow r213098, kernel POSIX semaphore module is no longer
davidxu [Sun, 26 Sep 2010 01:41:53 +0000 (01:41 +0000)]
Follow r213098, kernel POSIX semaphore module is no longer
needed.

13 years agoSome schemes can allocate memory for internal purposes but when
ae [Sat, 25 Sep 2010 18:27:29 +0000 (18:27 +0000)]
Some schemes can allocate memory for internal purposes but when
GEOM does withering this memory doesn't freed. Add G_PART_DESTROY
call to g_part_wither. Also add missed g_free() call to G_PART_READ
method for MBR and PC98 schemes.

Submitted by: jh (previous version)
Reviewed by: pjd
Approved by: kib (mentor)

13 years agoAdd some regression tests for newly added -J and -j options.
pjd [Sat, 25 Sep 2010 17:41:02 +0000 (17:41 +0000)]
Add some regression tests for newly added -J and -j options.

MFC after: 2 weeks

13 years ago- Add support for loading passphrase from a file (-J and -j options).
pjd [Sat, 25 Sep 2010 17:38:57 +0000 (17:38 +0000)]
- Add support for loading passphrase from a file (-J and -j options).
  This is especially useful for things like installers, where regular
  geli prompt can't be used.
- Add support for specifing multiple -K or -k options, so there is no
  need to cat all keyfiles and read them from standard input.

Requested by: Kris Moore <kris@pcbsd.org>, thompsa
MFC after: 2 weeks

13 years agoDon't hardcode md0 in message, use $md instead.
pjd [Sat, 25 Sep 2010 15:37:41 +0000 (15:37 +0000)]
Don't hardcode md0 in message, use $md instead.

Reported by: Ronald Klop <ronald-freebsd8@klop.yi.org>

13 years agoDon't leave zombies behind.
trasz [Sat, 25 Sep 2010 14:54:31 +0000 (14:54 +0000)]
Don't leave zombies behind.

13 years agoAdd a shell script to generate a test script for trivial ACLs.
trasz [Sat, 25 Sep 2010 14:33:35 +0000 (14:33 +0000)]
Add a shell script to generate a test script for trivial ACLs.

13 years agoUpdate regression tests after AES-XTS addition.
pjd [Sat, 25 Sep 2010 10:34:42 +0000 (10:34 +0000)]
Update regression tests after AES-XTS addition.

MFC after: 2 weeks

13 years ago- Use $md instead of md0, which fixes tests when md(4) device is already
pjd [Sat, 25 Sep 2010 10:34:11 +0000 (10:34 +0000)]
- Use $md instead of md0, which fixes tests when md(4) device is already
  present.
- Correct message - we create GPT, not MBR.

MFC after: 2 weeks

13 years agoFix two copy&paste bugs.
pjd [Sat, 25 Sep 2010 10:32:52 +0000 (10:32 +0000)]
Fix two copy&paste bugs.

MFC after: 2 weeks

13 years agoChange g_eli_debug to int, so one can turn off any GELI output by setting
pjd [Sat, 25 Sep 2010 10:32:04 +0000 (10:32 +0000)]
Change g_eli_debug to int, so one can turn off any GELI output by setting
kern.geom.eli.debug sysctl to -1.

MFC after: 2 weeks

13 years agoIgnore errors from BIO_FLUSH. It might confuse users that provider wasn't
pjd [Sat, 25 Sep 2010 10:31:05 +0000 (10:31 +0000)]
Ignore errors from BIO_FLUSH. It might confuse users that provider wasn't
really killed. What we really care about are write errors only.

MFC after: 2 weeks

13 years agoOnly access unwind_disabled when _PTHREAD_FORCED_UNWIND is defined.
davidxu [Sat, 25 Sep 2010 09:43:24 +0000 (09:43 +0000)]
Only access unwind_disabled when _PTHREAD_FORCED_UNWIND is defined.

13 years agoLog the number of segments currently in the reassembly queue.
lstewart [Sat, 25 Sep 2010 09:16:46 +0000 (09:16 +0000)]
Log the number of segments currently in the reassembly queue.

Sponsored by: FreeBSD Foundation

13 years agoAdd missing field.
davidxu [Sat, 25 Sep 2010 08:36:46 +0000 (08:36 +0000)]
Add missing field.

13 years agoAdd Planex UE-200TX-G2 to list of supported devices.
sanpei [Sat, 25 Sep 2010 08:19:34 +0000 (08:19 +0000)]
Add Planex UE-200TX-G2 to list of supported devices.

MFC after: 1 day

13 years agoBecause old _pthread_cleanup_push/pop do not have frame address,
davidxu [Sat, 25 Sep 2010 06:27:09 +0000 (06:27 +0000)]
Because old _pthread_cleanup_push/pop do not have frame address,
it is incompatible with stack unwinding code, if they are invoked,
disable stack unwinding for current thread, and when thread is
exiting, print a warning message.

13 years agoInternalise reassembly queue related functionality and variables which should
lstewart [Sat, 25 Sep 2010 04:58:46 +0000 (04:58 +0000)]
Internalise reassembly queue related functionality and variables which should
not be used outside of the reassembly queue implementation. Provide a new
function to flush all segments from a reassembly queue and call it from the
appropriate places instead of manipulating the queue directly.

Sponsored by: FreeBSD Foundation
Reviewed by: andre, gnn, rpaulo
MFC after: 2 weeks

13 years agoRemove clauses 3 and 4, per changes to NetBSD versions of these files.
imp [Sat, 25 Sep 2010 04:41:42 +0000 (04:41 +0000)]
Remove clauses 3 and 4, per changes to NetBSD versions of these files.

13 years agoo) Send mbufs to BPF listeners from within cvm_oct_xmit().
jmallett [Sat, 25 Sep 2010 04:39:12 +0000 (04:39 +0000)]
o) Send mbufs to BPF listeners from within cvm_oct_xmit().
o) Pin receive threads when they're running since we do access some core-local
   resources.

13 years agoAdd test cases for stack unwinding.
davidxu [Sat, 25 Sep 2010 04:26:40 +0000 (04:26 +0000)]
Add test cases for stack unwinding.

13 years agoSimplify code, and in while loop, fix operator to match the unwinding
davidxu [Sat, 25 Sep 2010 04:21:31 +0000 (04:21 +0000)]
Simplify code, and in while loop, fix operator to match the unwinding
direction.

13 years agoTo support stack unwinding for cancellation points, add -fexceptions flag
davidxu [Sat, 25 Sep 2010 01:57:47 +0000 (01:57 +0000)]
To support stack unwinding for cancellation points, add -fexceptions flag
for them, two functions _pthread_cancel_enter and _pthread_cancel_leave
are added to let thread enter and leave a cancellation point, it also
makes it possible that other functions can be cancellation points in
libraries without having to be rewritten in libthr.

13 years agoHandle link updates in a task.
jmallett [Sat, 25 Sep 2010 01:18:01 +0000 (01:18 +0000)]
Handle link updates in a task.

13 years agoTake mpt_req_on_{free,pending}_list() out from under INVARIANTS as these
marius [Fri, 24 Sep 2010 23:54:03 +0000 (23:54 +0000)]
Take mpt_req_on_{free,pending}_list() out from under INVARIANTS as these
are generally useful and not just for debugging.

13 years agoMake the vast majority of Simple Executive files standard. Perhaps some of
jmallett [Fri, 24 Sep 2010 21:23:23 +0000 (21:23 +0000)]
Make the vast majority of Simple Executive files standard.  Perhaps some of
these could be made dependent on either of the octusb or octe options, but
making them standard fixes a number of option combinations that were previously
broken.

13 years agoAdd gptboot script that is responsible for:
pjd [Fri, 24 Sep 2010 19:53:55 +0000 (19:53 +0000)]
Add gptboot script that is responsible for:
- looking for partition with 'bootonce' attribute alone (without 'bootme'
  attribute), removing it and logging that we successfully booted from this
  partition.
- looking for partitions with 'bootfailed' attribute, removing it and
  logging that we failed to boot from this partition.

Reviewed by: arch (Message-ID: <20100917234542.GE1902@garage.freebsd.pl>)
Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com
MFC after: 2 weeks

13 years ago- Split code shared by almost any boot loader into separate files and
pjd [Fri, 24 Sep 2010 19:49:12 +0000 (19:49 +0000)]
- Split code shared by almost any boot loader into separate files and
  clean up most layering violations:

sys/boot/i386/common/rbx.h:

RBX_* defines
OPT_SET()
OPT_CHECK()

sys/boot/common/util.[ch]:

memcpy()
memset()
memcmp()
bcpy()
bzero()
bcmp()
strcmp()
strncmp() [new]
strcpy()
strcat()
strchr()
strlen()
printf()

sys/boot/i386/common/cons.[ch]:

ioctrl
putc()
xputc()
putchar()
getc()
xgetc()
keyhit() [now takes number of seconds as an argument]
getstr()

sys/boot/i386/common/drv.[ch]:

struct dsk
drvread()
drvwrite() [new]
drvsize() [new]

sys/boot/common/crc32.[ch] [new]

sys/boot/common/gpt.[ch] [new]

- Teach gptboot and gptzfsboot about new files. I haven't touched the
  rest, but there is still a lot of code duplication to be removed.

- Implement full GPT support. Currently we just read primary header and
  partition table and don't care about checksums, etc. After this change we
  verify checksums of primary header and primary partition table and if
  there is a problem we fall back to backup header and backup partition
  table.

- Clean up most messages to use prefix of boot program, so in case of an
  error we know where the error comes from, eg.:

gptboot: unable to read primary GPT header

- If we can't boot, print boot prompt only once and not every five
  seconds.

- Honour newly added GPT attributes:

bootme - this is bootable partition
bootonce - try to boot from this partition only once
bootfailed - we failed to boot from this partition

- Change boot order of gptboot to the following:

1. Try to boot from all the partitions that have both 'bootme'
   and 'bootonce' attributes one by one.
2. Try to boot from all the partitions that have only 'bootme'
   attribute one by one.
3. If there are no partitions with 'bootme' attribute, boot from
   the first UFS partition.

- The 'bootonce' functionality is implemented in the following way:

1. Walk through all the partitions and when 'bootonce'
   attribute is found without 'bootme' attribute, remove
   'bootonce' attribute and set 'bootfailed' attribute.
   'bootonce' attribute alone means that we tried to boot from
   this partition, but boot failed after leaving gptboot and
   machine was restarted.
2. Find partition with both 'bootme' and 'bootonce' attributes.
3. Remove 'bootme' attribute.
4. Try to execute /boot/loader or /boot/kernel/kernel from that
   partition. If succeeded we stop here.
5. If execution failed, remove 'bootonce' and set 'bootfailed'.
6. Go to 2.

   If whole boot succeeded there is new /etc/rc.d/gptboot script coming
   that will log all partitions that we failed to boot from (the ones with
   'bootfailed' attribute) and will remove this attribute. It will also
   find partition with 'bootonce' attribute - this is the partition we
   booted from successfully. The script will log success and remove the
   attribute.

   All the GPT updates we do here goes to both primary and backup GPT if
   they are valid. We don't touch headers or partition tables when
   checksum doesn't match.

Reviewed by: arch (Message-ID: <20100917234542.GE1902@garage.freebsd.pl>)
Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com
MFC after: 2 weeks

13 years agoAllow to configure GPT attributes. It shouldn't be allowed to set bootfailed
pjd [Fri, 24 Sep 2010 19:33:47 +0000 (19:33 +0000)]
Allow to configure GPT attributes. It shouldn't be allowed to set bootfailed
attribute (it should be allowed only to unset it), but for test purposes it
might be useful, so the current code allows it.

Reviewed by: arch@ (Message-ID: <20100917234542.GE1902@garage.freebsd.pl>)
MFC after: 2 weeks

13 years agoAdd three GPT attributes:
pjd [Fri, 24 Sep 2010 19:31:08 +0000 (19:31 +0000)]
Add three GPT attributes:

GPT_ENT_ATTR_BOOTME - this is bootable partition

GPT_ENT_ATTR_BOOTONCE - try to boot only once from this partition

GPT_ENT_ATTR_BOOTFAILED - set this flag if we cannot boot from partition
containing GPT_ENT_ATTR_BOOTONCE flag; note that if we cannot
boot from partition that contains only GPT_ENT_ATTR_BOOTME flag,
the GPT_ENT_ATTR_BOOTFAILED flag won't be set

According to wikipedia Microsoft TechNet says that attributes are divided into
two halves: the lower 4 bytes representing partition independent attributes,
and the upper 4 bytes are partition type dependent. Microsoft is already using
bits 60 (read-only), 62 (hidden) and 63 (do not automount) and I'd like to not
collide with those, so we are using bit 59 (bootme), 58 (bootonce) and 57
(bootfailed).

Reviewed by: arch (Message-ID: <20100917234542.GE1902@garage.freebsd.pl>)
MFC after: 2 weeks

13 years agoReported problem:
mckusick [Fri, 24 Sep 2010 19:08:56 +0000 (19:08 +0000)]
Reported problem:
Large (60GB) filesystems created using "newfs -U -O 1 -b 65536 -f 8192"
show incorrect results from "df" for free and used space when mounted
immediately after creation. fsck on the new filesystem (before ever
mounting it once) gives a "SUMMARY INFORMATION BAD" error in phase 5.

This error hasn't occurred in any runs of fsck immediately after
"newfs -U -b 65536 -f 8192" (leaving out the "-O 1" option).

Solution:
The default UFS1 superblock is located at offset 8K in the filesystem
partition; the default UFS2 superblock is located at offset 64K in
the filesystem partition. For UFS1 filesystems with a blocksize of
64K, the first alternate superblock resides at 64K which is the the
location used for the default UFS2 superblock. By default, the
system first checks for a valid superblock at the default location
for a UFS2 filoesystem. For a UFS1 filesystem with a blocksize of
64K, there is a valid UFS1 superblock at this location.  Thus, even
though it is expected to be a backup superblock, the system will
use it as its default superblock. So, we have to ensure that all the
statistcs on usage are correct in this first alternate superblock
as it is the superblock that will actually be used.

While tracking down this problem, another limitation of UFS1 became
evident. For UFS1, the number of inodes per cylinder group is stored
in an int16_t. Thus the maximum number of inodes per cylinder group
is limited to 2^15 - 1. This limit can easily be exceeded for block
sizes of 32K and above. Thus when building UFS1 filesystems, newfs
must limit the number of inodes per cylinder group to 2^15 - 1.

Reported by: Guy Helmer<ghelmer@palisadesys.com>
Followup by: Bruce Cran <brucec@freebsd.org>
PR:          107692
MFC after:   4 weeks

13 years agoImprove r56796; the reply handler actually may remove the request from
marius [Fri, 24 Sep 2010 16:40:46 +0000 (16:40 +0000)]
Improve r56796; the reply handler actually may remove the request from
the chain in which case it shouldn't be removed twice.
Reported by: Staale Kristoffersen

MFC after: 1 week

13 years agominor simplifications and cosmetics
marius [Fri, 24 Sep 2010 15:12:18 +0000 (15:12 +0000)]
minor simplifications and cosmetics

13 years agoMake the RPC specific __rpc_inet_ntop() and __rpc_inet_pton() general
attilio [Fri, 24 Sep 2010 15:01:45 +0000 (15:01 +0000)]
Make the RPC specific __rpc_inet_ntop() and __rpc_inet_pton() general
in the kernel (just as inet_ntoa() and inet_aton()) are and sync their
prototype accordingly with already mentioned functions.

Sponsored by: Sandvine Incorporated
Reviewed by: emaste, rstone
Approved by: dfr
MFC after: 2 weeks

13 years agoRemove the duplicate logging of failed read requests, whose error message
marius [Fri, 24 Sep 2010 14:44:04 +0000 (14:44 +0000)]
Remove the duplicate logging of failed read requests, whose error message
also was inappropriate as it triggered for every EACCESS and ENOTFOUND, not
just the case the -n option is intended to deal with and thus really spammed
us with ~20 messages in the default configuration when booting a diskless
FreeBSD client, introduced with r207608 again.

MFC after: 1 week

13 years agoIP_BINDANY is not correctly handled in getsockopt() case.
attilio [Fri, 24 Sep 2010 14:38:54 +0000 (14:38 +0000)]
IP_BINDANY is not correctly handled in getsockopt() case.
Fix it by specifying the correct bits.

Sponsored by: Sandvine Incorporated
Reviewed by: bz, emaste, rstone
Obtained from: Sandvine Incorporated
MFC after: 10 days

13 years agoinline testcancel() into thr_cancel_leave(), because cancel_pending is
davidxu [Fri, 24 Sep 2010 13:01:01 +0000 (13:01 +0000)]
inline testcancel() into thr_cancel_leave(), because cancel_pending is
almost false, this makes a slight better branch predicting.

13 years agoMake WARNS=6 clean.
marius [Fri, 24 Sep 2010 10:40:17 +0000 (10:40 +0000)]
Make WARNS=6 clean.

MFC after: 1 week

13 years agoNow userland POSIX semaphore is based on umtx. The kernel module
davidxu [Fri, 24 Sep 2010 09:04:16 +0000 (09:04 +0000)]
Now userland POSIX semaphore is based on umtx. The kernel module
is only used to support binary compatible, if want to run old
binary, you need to kldload the module.

13 years agoImplement "force" (-F) option for gpart destroy verb.
ae [Fri, 24 Sep 2010 08:40:43 +0000 (08:40 +0000)]
Implement "force" (-F) option for gpart destroy verb.
This option doesn't passed to kernel and handled in user-space.
With -F option gpart creates new "delete" request for each
partition in table. Each request has flags="X" that disables
auto-commit feature. Last request is the original "destroy" request.
It has own flags and can have disabled or enabled auto-commit feature.
If error is occurred when deleting partitions, then new "undo" request
is created and all changes will be rolled back.

Approved by: kib (mentor)

13 years agoIn most cases, cancel_point and cancel_async needn't be checked again,
davidxu [Fri, 24 Sep 2010 07:52:07 +0000 (07:52 +0000)]
In most cases, cancel_point and cancel_async needn't be checked again,
because cancellation is almostly checked at cancellation points.

13 years agoAdd missing le32toh(), same as recently done in ata-siliconimage.c.
mav [Fri, 24 Sep 2010 07:14:14 +0000 (07:14 +0000)]
Add missing le32toh(), same as recently done in ata-siliconimage.c.

13 years ago- Do not place variables to memory allocated by busdma. pre/post ops
gonzo [Fri, 24 Sep 2010 04:46:46 +0000 (04:46 +0000)]
- Do not place variables to memory allocated by busdma. pre/post ops
    might invalidate cache and hence effectively void validity of values

13 years agoo) Add bus_teardown_intr for pci and ciu. This allows the Promise SATA
jmallett [Fri, 24 Sep 2010 02:41:52 +0000 (02:41 +0000)]
o) Add bus_teardown_intr for pci and ciu.  This allows the Promise SATA
   driver to try to switch interrupt handlers at setup.  It's not a very
   good implementation of bus_teardown_intr, though.
o) Set cache line size and latency timers for PCI devices per Linux.

13 years agoFlesh out PCI bus support some:
jmallett [Fri, 24 Sep 2010 00:14:24 +0000 (00:14 +0000)]
Flesh out PCI bus support some:
o) Reset and configure the bus from scratch rather than expecting U-Boot to
   do it for us.  Values and configuration from Linux, U-Boot and comments
   in the Cavium Simple Executive sources.
o) Do a resource assignment and bus numbering pass in the absence of a PCI
   BIOS or firmware that will do it for us.
   XXX This has to be the third or fourth instance of this in FreeBSD and
       it would be nice to have it become part of the PCI bus driver itself,
       like it is on Linux.
o) Fix interrupt mapping for and adjust bus configuration for the Lanner
   MR-955, based on information provided by Lanner.

13 years agoAlways show asic/chip revision in device attach phase. There are
yongari [Thu, 23 Sep 2010 18:55:54 +0000 (18:55 +0000)]
Always show asic/chip revision in device attach phase. There are
too many bge(4) controllers there and model name does not
necessarily match asic/chip revision. Relying on VPD string made
it hard to identify exact asic/chip revision so the first step to
debug bge(4) was getting exact asic/chip information with verbose
boot which may not be available on production server.

13 years agoRemove unnecessary weak reference that was apparently copied from the
emaste [Thu, 23 Sep 2010 17:47:46 +0000 (17:47 +0000)]
Remove unnecessary weak reference that was apparently copied from the
version of this function in lib/libc/inet/inet_pton.c

MFC after:     1 week

13 years agoClean up stray line in 213077
imp [Thu, 23 Sep 2010 17:29:59 +0000 (17:29 +0000)]
Clean up stray line in 213077

13 years agoSimplify how we find the kernel source. Rather than depending on sys,
imp [Thu, 23 Sep 2010 17:12:47 +0000 (17:12 +0000)]
Simplify how we find the kernel source.  Rather than depending on sys,
or some variation in the path, the new version assumes that $0 is
newvers.sh path, and that dirname $0/.. is the same as $S aka $SYSDIR.
It also removes knowledge of ${MACHINE} and ${MACHINE_ARCH}, which is
also good.

# I've had this in my tree for about 6 months now, which is why I
# didn't notice that I broke it in r209510 and that was fixed in
# r212954.  This should finally resolve the issues people had with
# r204824 as well as address the issues that motivated r204824.

13 years agoTry to adhere to style.Makefile(5).
marius [Thu, 23 Sep 2010 14:06:15 +0000 (14:06 +0000)]
Try to adhere to style.Makefile(5).

MFC after: 3 days

13 years ago- Simplify code by using g_*() API.
pjd [Thu, 23 Sep 2010 12:04:12 +0000 (12:04 +0000)]
- Simplify code by using g_*() API.
- Don't use u_char and u_int in userland.
- Change 'unsigned' to 'unsigned int'.
- Update copyright years.

MFC after: 1 week

13 years agoUpdate copyright years.
pjd [Thu, 23 Sep 2010 12:02:42 +0000 (12:02 +0000)]
Update copyright years.

MFC after: 1 week

13 years agoUpdate copyright years.
pjd [Thu, 23 Sep 2010 12:02:08 +0000 (12:02 +0000)]
Update copyright years.

MFC after: 1 week

13 years agoDocument AES-XTS.
pjd [Thu, 23 Sep 2010 12:00:40 +0000 (12:00 +0000)]
Document AES-XTS.

MFC after: 1 week

13 years agoAdd support for AES-XTS. This will be the default now.
pjd [Thu, 23 Sep 2010 11:58:36 +0000 (11:58 +0000)]
Add support for AES-XTS. This will be the default now.

MFC after: 1 week

13 years agoAdd support for CRYPTO_AES_XTS.
pjd [Thu, 23 Sep 2010 11:57:25 +0000 (11:57 +0000)]
Add support for CRYPTO_AES_XTS.

MFC after: 1 week

13 years agoAdd support for AES-XTS.
pjd [Thu, 23 Sep 2010 11:52:32 +0000 (11:52 +0000)]
Add support for AES-XTS.

Obtained from: OpenBSD
MFC after: 1 week