Compare commits

...
1260 Commits
Author SHA1 Message Date
Colin Percival 52876b70cd Extend the character set accepted by freebsd-update(8) in file
names in order to allow upgrades to FreeBSD 9.0-RELEASE.

Approved by:	so (cperciva)
Errata Notice:	FreeBSD-EN-12:01.freebsd-update
2012-01-04 23:47:20 +00:00
Colin Percival d7071cce13 Fix a problem whereby a corrupt DNS record can cause named to crash. [11:06]
Add an API for alerting internal libc routines to the presence of
"unsafe" paths post-chroot, and use it in ftpd. [11:07]

Fix a buffer overflow in telnetd. [11:08]

Make pam_ssh ignore unpassphrased keys unless the "nullok" option is
specified. [11:09]

Add sanity checking of service names in pam_start. [11:10]

Approved by:    so (cperciva)
Approved by:    re (bz)
Security:       FreeBSD-SA-11:06.bind
Security:       FreeBSD-SA-11:07.chroot
Security:       FreeBSD-SA-11:08.telnetd
Security:       FreeBSD-SA-11:09.pam_ssh
Security:       FreeBSD-SA-11:10.pam
2011-12-23 15:00:37 +00:00
Colin Percival 52bc579fa2 Fix a bug in UNIX socket handling in the linux emulator which was
exposed by the security fix in FreeBSD-SA-11:05.unix.

Approved by:	so (cperciva)
Approved by:	re (kib)
Security:	Related to FreeBSD-SA-11:05.unix, but not actually
		a security fix.
2011-10-04 19:07:38 +00:00
Bjoern A. Zeeb e7bf24ad0e Fix handling of corrupt compress(1)ed data. [11:04]
Add missing length checks on unix socket addresses. [11:05]

Approved by:	so (cperciva)
Approved by:	re (kensmith)
Security:	FreeBSD-SA-11:04.compress
Security:	CVE-2011-2895 [11:04]
Security:	FreeBSD-SA-11:05.unix
2011-09-28 08:47:17 +00:00
Simon L. B. Nielsen 3d530be3df Fix an off by one which can result in a assertion failure in BIND
related to large RRSIG RRsets and Negative Caching. This can cause
named to crash.

Security:	FreeBSD-SA-11:02.bind
Security:	CVE-2011-1910
Security:	https://www.isc.org/software/bind/advisories/cve-2011-1910
Obtained from:	ISC
Approved by:	so (simon)
2011-05-28 08:44:39 +00:00
Colin Percival c86a3ed652 Fix CIDR parsing bug in mountd ACLs.
Approved by:	so (cperciva)
Security:	FreeBSD-SA-11:01.mountd
2011-04-20 21:00:24 +00:00
Simon L. B. Nielsen cb122a13fc Fix a race condition exists in the OpenSSL TLS server extension code and
a double free in the SSL client ECDH handling code.

Approved by:	so (simon)
Security:	CVE-2010-2939, CVE-2010-3864
Security:	FreeBSD-SA-10:10.openssl
2010-11-29 20:43:06 +00:00
Colin Percival a4c47c73d2 Fix an integer overflow in RLE length parsing when decompressing
corrupt bzip2 data.

Approved by:	so (cperciva)
Security:	FreeBSD-SA-10:08.bzip2
2010-09-20 14:58:08 +00:00
Colin Percival 3e4fe68b17 Correctly copy the M_RDONLY flag when duplicating a reference
to an mbuf external buffer.

Approved by:	so (cperciva)
Approved by:	re (kensmith)
Security:	FreeBSD-SA-10:07.mbuf
2010-07-13 02:45:17 +00:00
Colin Percival 48a2dfb359 Change the current working directory to be inside the jail created by
the jail(8) command. [10:04]

Fix a one-NUL-byte buffer overflow in libopie. [10:05]

Correctly sanity-check a buffer length in nfs mount. [10:06]

Approved by:	so (cperciva)
Approved by:	re (kensmith)
Security:	FreeBSD-SA-10:04.jail
Security:	FreeBSD-SA-10:05.opie
Security:	FreeBSD-SA-10:06.nfsclient
2010-05-27 03:15:04 +00:00
Ken Smith 1c808b47a2 Ready for the 7.3-RELEASE builds to begin.
Approved by:	re (implicit)
2010-03-21 01:03:49 +00:00
Ken Smith ec323c5251 Merge r205400:
> Guess at the date the 7.3-RELEASE builds will be finished and everything
> will be in place for the announcement.

Approved by:	re (implicit)
2010-03-21 00:05:29 +00:00
Hiroki Sato 520cccc1a9 Update release notes:
merge two SysV IPC entries into one,
	rtld(1) entries revised:
		- dynamic string token subst
		- PIE support improvement
		- ELF object mapping change

Suggested by:	kib
Approved by:	re (implicitly)
2010-03-20 16:39:28 +00:00
Hiroki Sato 4ab7e1440e Remove an entry of "superpages enabled by default on amd64" because it
has been reverted on releng/7.3.

Spotted by:	ivoras
Approved by:	re (implicitly)
2010-03-20 14:57:24 +00:00
Hiroki Sato a85ae14254 Update release notes:
URL of Errata doc added[1],
	s/release candidate/release/[1],
	grammatical fixes[1],
	description on pc98 boot2 fixed[2],
	description on gstripe(8) improved[2],
	description on vfs.flushbufqtarget improved[2], and
	description on tzcode2009k improved[3].

Submitted by:	dhw[1], ivoras[2], and edwin[3]
Approved by:	re (implicitly)
2010-03-20 14:36:39 +00:00
Hiroki Sato 192a58e309 Bump copyright year and trim old entries.
Approved by:	re (implicitly)
2010-03-19 18:43:15 +00:00
Hiroki Sato 3dc91d0a7d Remove obsolete translations.
Approved by:	re (implicitly)
2010-03-19 18:35:23 +00:00
Hiroki Sato 5ab2afd87d Update relnotes (final round, hopefully):
SA-09:09,10,11,12,14,15,16,17,10:01,02,03,
	security.jail.ip[46]_saddrsel,
	acpidump(8) SRAT support (acpi(4) entry removed)[1],
	sched_ule(4) deadlock fixed (EN-10:02),
	superpages enabled by default on amd64 (superpages entry revised)[1],
	security.bsd.map_at_zero,
	boot2 on pc98 reimplemented,
	vgapci(4) MSI/MSI-X proxying (item of the old pci(4) item removed)[1],
	bce(4) bugfix,
	cxgb(4) firmware 7.8.0[2],
	fxp(4) + TSO = poor performance fixed,
	mxge(4) firmware 1.4.48b,
	ste(4) improvements,
	vlan(4) now in GENERIC,
	gstripe(8) default stripe size is now 64KB,
	fetch(1) HTTP digest auth support,
	fetch(1) NO_PROXY/no_proxy support,
	getpagesize(3) added,
	mergemaster(8) DELETE_STALE_RC_FILES support,
	tftp(1) exit status fixed,
	traceroute(8) address selection in jail,
	whois(1) -d removed,
	$vlans_IF in rc.conf added,
	ISC BIND 9.4-ESV,
	tzdata2010b,
	GNOME 2.28.2, and
	KDE 4.3.5.

Spotted by:	jhb[1] and np[2]
Approved by:	re (implicitly)
2010-03-19 18:33:40 +00:00
Hiroki Sato 1282b3c592 Update relnotes for 7.3R (second round):
acpi(4) SRAT parsing support,
	closefrom(2) added,
	utimes(2) vfs.timestamp_precision support,
	kmem_map increased to 512GB on amd64,
	lindev(4) added,
	linux(4) improvements,
	PECOFF support removed,
	P1003_1B_SEMAPHORES is now default,
	>2GB shared mem segment for SYSV IPC,
	sglist(9) added,
	SYSV IPC API changed with backward compatibility,
	superpages,
	zfsboot 64-bit LBA, fd shortage fix, /boot.config fix,
	zfsloader added,
	boot loader GPT issue fixed,
	amdsbwd(4) added,
	cpuctl(4) CPUCTL_MSR[CS]BIT support,
	cpufreq(4) Phenon support,
	ipmi(4) bugfix,
	hw.mca.enabled added,
	hw.pagesizes added,
	VIA Nano processor support,
	DRM RS880, RV740, R6/7xx 3D, Intel G41 support,
	alc(4) added,
	bge(4) improvements,
	cas(4) added,
	et(4) checksum offloading support,
	msk(4) improvements,
	mxge(4) improvements,
	vge(4) improvements,
	xl(4) bugfix,
	gif(4)+if_bridge(4) EtherIP bugfix,
	IPcomp net.inet.ipcomp.ipcomp_enable change,
	ng_iface(4) bugfix,
	tap(4) TAPGIFNAME ioctl added,
	aac(4) upgraded,
	ahc(4) Adaptec 39320LPE support,
	ata(4) timeout increased and some bugfixes,
	gmirror balancing algorithm change,
	gpart(8) bugfix,
	hptrr(4) hw.hptrr.attach_generic added,
	mfi(4) LSI MegaRAID SAS 1078 and Dell PERC6 support,
	ext2fs(5) improvements,
	pseudofs(9) MPSAFE,
	UFS_DIRHASH improvements,
	apropos(1) change,
	cp(1) symlink handling bugfix,
	cpucontrol(8) atomic AND/OR for MSR,
	crontab(5) no longer has HOME= line,
	df(1) -h/-H supports inode counts,
	dhclient(8) uses 68 as the source port for unicast DHCPREQUEST,
	symlink handling bugfix in find(1) and rm(1),
	gzip(1) pack'd file support,
	libradius(3) RADIUS server support,
	lp(1) -m/-t added,
	lpq(1) EoL char handling fixed,
	mfiutil(8) added,
	mptutil(8) added,
	ntpd(8) IPv6 anycast addr bind issue fixed,
	ppp(8) race fixed,
	pwait(1) added,
	strptime(3) %z added,
	sysintall(8) now uses 400MB for EFI partition on IA64,
	tail(1) -F never returns with ENOENT,
	traceroute{,6}(8) AS num lookup,
	tzsetup(8) -s added,
	yp(8) shadow.* map added,
	service(8) added,
	$create_args_IF added to rc.conf,
	$fsck_y_flags added,
	rc.d/named improvements,
	crashinfo(8) support in rc.d/savecore,
	rc.d/static_arp added,
	ISC BIND 9.4.3-P4,
	tzdata2009u,
	tzcode2009k,
	unifdef 1.188, and
	release ISO image filenames changed to "FreeBSD-*".

Approved by:	re (implicitly)
2010-03-19 09:20:06 +00:00
Hiroki Sato 0c1c8b75ed Update relnotes for 7.3R (first round):
ddb(8) pager support for show_geom*,
	deadlock involving malloc(3) and fork(2) fixed,
	gptzfsboot added,
	zfsboot # of fd increased,
	hwpmc added,
	s/k8temp/amdtemp/,
	pci(4) improvement,
	bge(4) panic on shutdown fixed,
	cxgb upgraded,
	fxp(4)+TSO IP length issue fixed,
	nfe(4) improved,
	nge(4) improved,
	net.inet.ip.fw.default_to_accept added,
	NFS client negative pathname lookup cache added,
	vfs.flushbufqtarget added,
	Bluetooth(3) HCI API support,
	btpand(8) -d device name support,
	chflags(1) -h bugfix,
	cpuset -x option,
	dhclient NUL-terminated text bugfix,
	fdisk(8) size qualifiers support,
	fetch(1) *_TIMEOUT and HTTPS parameters bugfix,
	find(1) -L + -delete bugfix,
	ktrace(1) new record for  sysctl,
	fdopendir(3) added,
	feature_present(3) added,
	man(1) UTF-8 support,
	mergemaster now passes -L to mtree(8),
	newfs_msdos(8) non-CHS media support,
	pkill now ignores itself and ancestors, -a option added,
	ps -p option added,
	pwd_mkdb -C now checks MAXLOGNAME,
	rtld(1) LD_ELF_HINTS_PATH support,
	sysinstall(8) comma-separated list of interfaces in netDev,
	tzdata2009i,
	sendmail 8.14.4, and
	pkg_info(1) segfault fix.

Approved by:	re (implicitly)
2010-03-18 07:28:02 +00:00
Ken Smith 08add50b93 Back out r203073 due to issues recently discovered with machine check
hardware on some AMD processors that causes problems with running
FreeBSD as a guest on some virtual machine monitors.  What is believed
to be the correct fix has been committed but should receive more testing
before it becomes part of a release.

Submitted by:	alc
Approved by:	re (kib)
2010-03-10 19:55:27 +00:00
Ken Smith 468632bd00 Merge r204967: Package set for 7.3-RELEASE.
Reviewed by:	portmgr@, re@
Approved by:	re (implicit)
2010-03-10 19:18:19 +00:00
Hiroki Sato 338628efb1 - Bump &release.*; for the upcoming 7.3R.
- Bump copyright year.

Approved by:	re (implicitly)
2010-03-04 15:54:06 +00:00
Ken Smith e550a97c18 Ready for 7.3-RC2.
Approved by:	re (implicit)
2010-03-01 04:46:07 +00:00
John Baldwin d4a0383caa MFC 204090:
Fix mptutil's method for locating disk devices attached to a specific
mpt(4) controller.  Previously, the code assumed that multiple match
patterns provided to an XPT_DEV_MATCH request were ANDed together.
Instead, they are ORed.  Instead, to match peripherals for a specific bus,
one query needs to be performed to lookup the path ID of the bus.  A second
query can then be performed matching peripherals attached to that path.
This approach also makes the code a bit cleaner as the returned match
results do not mix buses and perphierals.

Approved by:	re (kib)
2010-02-24 21:29:45 +00:00
Konstantin Belousov 20ef491f0b MFC r203818:
Clear the bp pointer when buffer is already brelse()d.

Approved by:	re (bz)
2010-02-20 12:34:14 +00:00
John Baldwin 2c957515d0 Fix a bug where MSI interrupts on x86 were always routed to APIC ID 0 rather
than the APIC ID of the boot CPU prior to SI_SUB_SMP.  This resulted in
some storage controllers not being able to enumerate attached devices when
using MSI/MSI-X interrupts.  This only affects <= 7.x, so it is a direct
commit to 7.3 rather than an MFC.

Approved by:	re (kib)
2010-02-17 21:19:10 +00:00
Konstantin Belousov 0e31d1a9d8 MFC r203441:
Placate new binutils, by using 16-bit %ax instead of 32-bit %eax as an
argument for fnstsw. Explicitely specify sizes for the XMM control and
status word and X87 control and status words.

Approved by:	re (bz)
2010-02-17 10:39:39 +00:00
Konstantin Belousov 9814250d30 MFC r203875:
Do not leak process lock when current thread is not allowed to see target.

Approved by:	re (bz)
2010-02-17 10:21:00 +00:00
Doug Barton a759723f3b Merge from stable/7, version 203948:
Upgrade to BIND 9.4-ESV. This version incorporates all bug and security
fixes since the release of 9.4.3, including the most recent -P5 security
fix detailed below.

From the README:
BIND 9.4-ESV will be supported until December 31, 2010, at
which time you will need to upgrade to the current release
of BIND.

This versions address the following vulnerabilities:

BIND 9 Cache Update from Additional Section
https://www.isc.org/advisories/CVE-2009-4022v6
http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2009-4022
A nameserver with DNSSEC validation enabled may incorrectly add
unauthenticated records to its cache that are received during the
resolution of a recursive client query

BIND 9 DNSSEC validation code could cause bogus NXDOMAIN responses
https://www.isc.org/advisories/CVE-2010-0097
http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2010-0097
There was an error in the DNSSEC NSEC/NSEC3 validation code that could
cause bogus NXDOMAIN responses (that is, NXDOMAIN responses for records
proven by NSEC or NSEC3 to exist) to be cached as if they had validated
correctly

These issues only affect systems with DNSSEC validation enabled.

Approved by:	re (kensmith)
2010-02-16 18:10:35 +00:00
Konstantin Belousov 7294ca01f6 MFC r195635:
Properly set MAP_ENTRY_WIRE_SKIPPED when aborting the loop.

PR:	kern/143717 (for RELENG_7)
Approved by:	re (bz)
2010-02-13 11:24:11 +00:00
Ken Smith 7cfa6ebe39 Ready for 7.3-RC1.
Approved by:	re (implicit)
2010-02-10 04:10:36 +00:00
Ken Smith 710004612a Adjust __FreeBSD_version for this being the 7.3-RELEASE release branch.
Approved by:	re (implicit)
2010-02-10 04:09:33 +00:00
Ken Smith 4c992a1695 Update branch tag.
Approved by:	re (implicit)
2010-02-10 04:06:29 +00:00
Ken Smith 368fcebf4d Update branch tag for 'make update'.
Approved by:	re (implicit)
2010-02-10 04:01:45 +00:00
Ruslan Ermilov d181269898 MFC: r198231: Properly re-create "-s size" argument to newfs(8).
Approved by:	re (kib)
2010-02-09 16:18:44 +00:00
Attilio Rao 2b0ebd550a MFC r202889, r202940:
- Fix a race in sched_switch() of sched_4bsd.
  Block the td_lock when acquiring explicitly sched_lock in order to prevent
  races with other td_lock contenders.
- Merge the ULE's internal function thread_block_switch() into the global
  thread_lock_block() and make the former semantic as the default for
  thread_lock_block().
- Split out an invariant in order to have better checks.

Tested by:	Giovanni Trematerra
		<giovanni dot trematerra at gmail dot com>
Approved by:	re (kib)
2010-02-09 14:56:10 +00:00
David Xu eb3f7c0c72 MFC r203414:
After busied the lock, re-read state word before checking waiters flag,
otherwise, the waiters bit may not be set and a wakeup is lost.

Approved by:	re (kib)
2010-02-09 01:19:10 +00:00
Ruslan Ermilov 93524e0516 MFC: r203486: Shortening a passphrase caused wrong authentication key
to be used.

Approved by:	re (kib)
2010-02-07 16:55:45 +00:00
Marius Strobl f53fd5963e MFC: r203185
Implement handling of the third argument of cpu_switch().

PR:		143215
Approved by:	re (kib)
2010-02-06 21:12:27 +00:00
Pyun YongHyeon 963a382e3f MFC r203082:
Add initial support for RTL8103E PCIe fastethernet.

  PR:	kern/142974
  Approved by:	re (kensmith)
2010-02-02 17:28:50 +00:00
John Baldwin a95d10fd60 MFC 203070:
Initialize the ifnet before calling mii_phy_probe() as some phy drivers
(e.g. e1000phy(4)) expect if_dname to be valid when they are probed.

Approved by:	re (kensmith)
2010-02-01 22:16:44 +00:00
John Baldwin 07f47e1db3 MFC: Disable the alignment restrictions in the bus dma tags for RX and TX
buffers.  Recent fixes to bus dma exposed a bug somewhere (igb?) that
caused igb(4) to no longer receive packets without this change.

Approved by:	re (kib)
2010-02-01 18:27:19 +00:00
Xin LI 9aba7c3da2 MFC r201406:
Reduce diff against OpenSolaris - move Giant acquire/release to
zfs_znode.c.  As a side effect this also eliminates two potential
Giant leaks.

Approved by:  re (kib)
2010-02-01 11:05:19 +00:00
Marius Strobl 1b280f9ca9 MFC: r203094
- Zero the MSI/MSI-X queue argument, otherwise mtx_init(9) can panic
  indicating an already initialized lock.
- Check for an empty MSI/MSI-X queue entry before asserting that we have
  received a MSI/MSI-X message in order to not panic in case of stray MSI/
  MSI-X queue interrupts which may happen in case of using an interrupt
  handler rather than a filter.

Approved by:	re (kib)
2010-01-31 22:21:08 +00:00
Marius Strobl 23006f1afa MFC: r202903
On LP64 struct ifid is 64-bit aligned while struct fid is 32-bit aligned
so on architectures with strict alignment requirements we can't just simply
cast the latter to the former but need to copy it bytewise instead.

PR:		143010
Approved by:	re (kib)
2010-01-31 22:16:27 +00:00
Gregory Neil Shapiro 17ef3b5f88 Note sendmail 8.14.4 upgrade
Approved by:	re (kensmith)
2010-01-31 20:01:28 +00:00
Gregory Neil Shapiro 42f546b96e MFC: Minor changes to force commit these files so new freebsd*.cf files are
built to use the new sendmail-8.14.4/cf tree.

Approved by:	re (kensmith)
2010-01-31 19:21:03 +00:00
Gregory Neil Shapiro c459a6990e MFC: Update FreeBSD information
Approved by:	re (kensmith)
2010-01-31 19:18:52 +00:00
Gregory Neil Shapiro 7e3ee9fae9 MFC: Merge sendmail 8.14.4
Approved by:	re (kensmith)
2010-01-31 19:17:12 +00:00
Gregory Neil Shapiro 0c5c14b474 MFC: Merge from vendor dist: Bring in a change already in the sendmail
repository that will allow sendmail to be built with the c99 compiler.

Approved by:	re (kensmith)
2010-01-31 19:15:47 +00:00
Edwin Groothuis 7108f4725f MFC of 203066, 203067
Git has been added as port 9418:
http://www.iana.org/assignments/port-numbers

The Erlang Port Mapper Daemon (from ports/lang/erlang) has been
assigned official port number 4369 by IANA.

PR:           conf/143259 conf/113265
Submitted by: Denny Lin <[email protected]>, Jimmy Olgeni <[email protected]>
Approved by:	re (kib)
2010-01-30 21:55:43 +00:00
Alan Cox b0b1308fca MFC r202894
Handle a race between pmap_kextract() and pmap_promote_pde().

Approved by:	re (kib)
2010-01-30 18:17:43 +00:00
Konstantin Belousov 84c9668843 MFC r202880:
Do not check for existence of symlink source for the link action.

Approved by:	re (bz)
2010-01-30 15:00:33 +00:00
John Baldwin be3de0b626 MFC 197331, 197394:
Add getpagesizes(3) function that returns either the number of page sizes
supported by the system or a specified subset of the supported page sizes.

Approved by:	re (kib)
2010-01-29 15:58:12 +00:00
Ken Smith ad7e0c5ae2 Add packages-7.3-release directory.
Approved by:	re (implicit)
2010-01-27 20:30:50 +00:00
Ken Smith 9ef1cfbd68 Update version to 7.3.
Approved by:	re (implicit)
2010-01-27 20:25:46 +00:00
Ken Smith d8ed8c7281 Update what version of FreeBSD man(1) says this is.
Approved by:	re (implicit)
2010-01-27 20:24:28 +00:00
Konstantin Belousov 23a745b971 MFC r196921:
Do not decrement pfs_vncache_entries for the vnode that was not in the
list.

Reminded by:	des
Approved by:	re (kensmith)
2010-01-27 20:09:20 +00:00
John Baldwin cc1892fa5e MFC 185715:
Change the default value for the flag enabling superpage mapping and
promotion to "on".

Approved by:	re (kib)
2010-01-27 15:29:09 +00:00
Dag-Erling Smørgrav 99221e6464 Synch with head: avoid namespace collisions (r177447), plug resource leak
in FTP code (r199801), add support for HTTP (r202613, r202623, r203028).
Also record mergeinfo for previously merged patches (r174752, r174588).

Approved by:	re (kib)
2010-01-27 14:54:48 +00:00
Bjoern A. Zeeb a25be352ec MFC r202915:
Correct a typo.

  Submitted by: kensmith

Approved by:	re (kib)
2010-01-27 10:20:10 +00:00
John Baldwin 65e8ef7df7 MFC 195820, 195940, 196643, 197663, 199067, 199215, and 199253:
Optimize the cache flushing done when changing caching attributes of pages
by doing nothing for CPUs that support self-snooping and using CLFLUSH
instead of a full cache invalidate when possible.
- On i386 take care of possible mappings of the page by sf buffer by
  utilizing the mapping for clflush, otherwise map the page transiently.
  Amd64 uses the direct map.
- Do not use CLFLUSH on Intel CPUs due to problems with flushing the local
  APIC range by default.  This can be further controlled via the
  hw.clflush_disable loader tunable.  A setting of 1 disables the
  use of CLFLUSH.  A setting of 0 allows CLFLUSH to be used for Intel
  CPUs when CPUID_SS is not present.

Approved by:	re (kib)
2010-01-26 20:58:09 +00:00
Edwin Groothuis 775d2409d8 MFC of tzdata2010b, r203019
Mexico's House of Representatives has approved a proposal for
northern Mexico's border cities to share the same daylight saving
schedule as the United States.

Approved by:	re (kib)
2010-01-26 19:49:03 +00:00
Doug Barton 41d2993f2a MFC r202817:
Make -U once again honor -D after my change to consolidate setting
of MTREEDB with DESTDIR.

PR:             bin/143089
Submitted by:   Anton Yuzhaninov <[email protected]>

Approved by:	re (kensmith)
2010-01-26 18:25:22 +00:00
Konstantin Belousov 2ec956bdab MFC r202884:
Document pthread_timedjoin_np.
Note implementation-defined EOPNOTSUPP error [1].

Approved by:	re (bz)
2010-01-26 09:37:51 +00:00
Colin Percival 04368fba20 Add support for "at vp" lookups to namei. This functionality was added
to HEAD in r185029; but this is an "inspired by" commit rather than a
literal merge, since this region of code in HEAD has other non-MFCable
changes.

The namei lookups this unbreaks are required for ZFS extended attributes;
prior to this commit, an attempt to look up (list, read, write, delete)
extended attributes would be handled as an attempt to look up a file in
the current directory if an extended attribute directory existed ("at vp"
was mishandled as "right here").

Reviewed by:	jhb
Approved by:	re (kib)
Found by:	Henrik Wiest & libarchive
2010-01-25 23:48:47 +00:00
John Baldwin 570f289715 MFC 194607:
Implement a mechanism within vm_phys_alloc_contig() to defer all necessary
calls to vdrop() until after the free page queues lock is released.  This
eliminates repeatedly releasing and reacquiring the free page queues lock
each time the last cached page is reclaimed from a vnode-backed object.

Approved by:	re (kib)
2010-01-25 18:15:10 +00:00
John Baldwin 14667f98de MFC 193842:
Eliminate an unnecessary restriction on the vm object type from
vm_map_pmap_enter().  The immediate effect of this change is that automatic
prefaulting by mmap() for small mappings is performed on POSIX shared memory
objects just the same as it is on ordinary files.

Approved by:	re (kib)
2010-01-25 17:51:34 +00:00
John Baldwin ca5a19668d MFC 190239:
In general, the kernel virtual address of the pml4 page table page that is
stored in the pmap is from the direct map region.  The two exceptions have
been the kernel pmap and the swapper's pmap.  These pmaps have used a
kernel virtual address established by pmap_bootstrap() for their shared
pml4 page table page.  However, there is no reason not to use the direct
map for these pmaps as well.

Approved by:	re (kib)
2010-01-25 15:50:52 +00:00
Bjoern A. Zeeb eadc3e0b45 MFC r202469:
Garbage collect references to the no longer implemented tcp_fasttimo().

Approved by:	re (kib)
2010-01-24 18:18:52 +00:00
Ruslan Ermilov 97326dd32e MFC: r191620: Added (pre|post)(start|stop) jail hooks.
PR:		143137
Approved by:	re (bz)
2010-01-24 16:59:04 +00:00
Max Khon 25886371eb MFC rev. 201924: Send link state change control messages
to "orphans" hook as well.

Approved by:	re (kib)
2010-01-24 14:58:49 +00:00
Bjoern A. Zeeb dd997f0430 MFC r202468:
Add security.jail.ip4_saddrsel/ip6_nosaddrsel sysctls to control
 whether to use source address selection (default) or the primary
 jail address for unbound outgoing connections.

 This is intended to be used by people upgrading from single-IP
 jails to multi-IP jails but not having to change firewall rules,
 application ACLs, ... but to force their connections (unless
 otherwise changed) to the primry jail IP they had been used for
 years, as well as for people prefering to implement similar policies.

 Note that for IPv6, if configured incorrectly, this might lead to
 scope violations, which single-IPv6 jails could as well, as by the
 design of jails. [1]

 Note that in contrast to FreeBSD 8.x and newer, where we have
 per-jail options, the sysctls are global for all jails.

 Reviewed by:		jamie, hrs (ipv6 part) [for HEAD]
 Pointed out by:	hrs [1]
 Tested by:		Jase Thew (bazerka beardz.net) (IPv4)

Approved by:	re (kib)
2010-01-24 14:05:56 +00:00
Bjoern A. Zeeb a42a1f8f8f MFC r194777:
Make callers to in6_selectsrc() and in6_pcbladdr() pass in memory
  to save the selected source address rather than returning an
  unreferenced copy to a pointer that might long be gone by the
  time we use the pointer for anything meaningful.

  Asked for by:	rwatson
  Reviewed by:		rwatson

Approved by:	re (kensmith)
2010-01-24 10:08:54 +00:00
Konstantin Belousov 6c00438049 Fix vfs_unbusy() calls in r202895.
Reported by:	Michael Butler <imb protected-networks net>
Approved by:	re (bz)
2010-01-23 22:37:34 +00:00
Konstantin Belousov bcd9c86bcc MFC r186277:
The quotactl, statfs and fstatfs syscall implementations may dereference
NULL pointer to struct mount if the looked up vnode is reclaimed. Also,
these syscalls only mnt_ref() the mp, still allowing it to be unmounted;
only struct mount memory is kept from being reused.

Lock the vnode when doing name lookup, then reference its mount point,
unlock the vnode and vfs_busy the mountpoint. This sequence shall take
care of both races.

MFC r188141 (by trasz):
In some situations, mnt_lockref could go negative due to vfs_unbusy() being
called without calling vfs_busy() first.  This made umount(8) hang waiting
for mnt_lockref to become zero, which would never happen.

MFC r196887:
In fhopen, vfs_ref() the mount point while vnode is unlocked, to prevent
vn_start_write(NULL, &mp) from operating on potentially freed or reused
struct mount *.

Remove unmatched vfs_rel() in cleanup.

Approved by:	re (bz)
2010-01-23 19:01:25 +00:00
Ken Smith ea9efe89d3 Adjust to indicate we've begun the 7.3-RELEASE release cycle.
Approved by:	re (implicit)
2010-01-23 15:28:18 +00:00
Christian Brueffer b386ba9289 MFC: r202162
Various fixes.
2010-01-23 14:13:21 +00:00
Navdeep Parhar e0714e1a51 MFC r202863
Don't forget to release the adapter lock for a no-op.
2010-01-23 08:43:11 +00:00
Xin LI ae5035e0c7 MFC r202268:
o Add PCI ID for BCM 5756.
 o Don't enable BGE_FLAG_BER_BUG on both 5722 and 5756, and based
   on their PCI IDs rather than their chip IDs.

Reported by:    several PC-BSD users via kmoore
Reviewed by:    yongari, imp, jhb, davidch
Sponsored by:   iXsystems, Inc.
2010-01-23 01:20:59 +00:00
Xin LI 4206327f7b MFC r202709:
Give the right value when complaining it being wrong.

Reported by:	danfe
2010-01-23 00:53:03 +00:00
Xin LI 09c7d7cdc5 MFC r201894:
Fix formatting.
2010-01-23 00:49:50 +00:00
Xin LI c52a220d61 MFC r201892:
Add a set of manual pages for pthread[_attr]_[sg]etaffinity(3).

Reviewed by:	davidxu
2010-01-23 00:46:55 +00:00
Xin LI c372c4053f MFC r200930:
Adapt OpenBSD pf's "sloopy" TCP state machine which is useful for Direct
Server Return mode, where not all packets would be visible to the load
balancer or gateway.

This commit should be reverted when we merge future pf versions.  The
benefit it would provide is that this version does not break any existing
public interface and thus won't be a problem if we want to MFC it to
earlier FreeBSD releases.

Discussed with:	mlaier
Obtained from:	OpenBSD
Sponsored by:	iXsystems, Inc.
2010-01-23 00:41:04 +00:00
Florent Thoumie fac9e4b66e Synchronize pkg_install with HEAD. 2010-01-22 23:17:07 +00:00
John Baldwin bff3a8463d MFC 189783:
Correct accounting errors in _pmap_allocpte().  Specifically, the pmap's
resident page count and the global wired page count were not correctly
maintained when page table page allocation failed.
2010-01-22 21:36:34 +00:00
John Baldwin 7cbb833b88 MFC 189698,192035:
Optimize the inner loop of pmap_copy().

Correct a rare use-after-free error in pmap_copy().  This error was
introduced in amd64 revision 1.540 and i386 revision 1.547.  However, it
had no harmful effects until after a recent change, r189698, on amd64.
(In other words, the error is harmless in RELENG_7.)

The error is triggered by the failure to allocate a pv entry for the one
and only mapping in a page table page.  I am addressing the error by
changing pmap_copy() to abort if either pv entry allocation or page
table page allocation fails.  This is appropriate because the creation of
mappings by pmap_copy() is optional.  They are a (possible) optimization,
and not a requirement.

Correct a nearby whitespace error in the i386 pmap_copy().
2010-01-22 21:23:09 +00:00
John Baldwin 3b650903a5 MFC 189610:
Eliminate the last use of the recursive mapping to access user-space page
table pages.  Now, all accesses to user-space page table pages are
performed through the direct map.  (The recursive mapping is only used
to access kernel-space page table pages.)

Eliminate the TLB invalidation on the recursive mapping when a user-space
page table page is removed from the page table and when a user-space
superpage is demoted.
2010-01-22 20:52:31 +00:00
John Baldwin dcf21a120f MFC 189551:
Change pmap_enter_quick_locked() so that it uses the kernel's direct map
instead of the pmap's recursive mapping to access the lowest level of the
page table when it maps a user-space virtual address.
2010-01-22 20:46:11 +00:00
John Baldwin c7f7f451a8 MFC 189415:
Make pmap_copy() more TLB friendly.  Specifically, make it use the kernel's
direct map instead of the pmap's recursive mapping to access the lowest
level in the page table.
2010-01-22 20:30:54 +00:00
Gavin Atkinson f799911bcd Merge r201647 from head:
Print leading zeros in the UFS2 FSID.

PR:		bin/142155
Submitted by:	Efstratios Karatzas  gpf.kira gmail.com
Approved by:	ed (mentor, implicit)
2010-01-22 20:06:57 +00:00
Doug Barton 5213394a5a MFC r202582:
Update named.conf for documentation IP addresses and domains
2010-01-22 17:31:54 +00:00
Christian Brueffer a172f16fe6 MFC: r201848
Free allocated sbufs before returning ENOMEM.
2010-01-22 17:08:05 +00:00
John Baldwin fc06b1e95e MFC 193951:
Adapt vfs kqfilter to the shared vnode lock used by zfs write vop. Use
vnode interlock to protect the knote fields. The locking assumes
that shared vnode lock is held, thus we get exclusive access to knote
either by exclusive vnode lock protection, or by shared vnode lock +
vnode interlock.

Unlike the change in HEAD, this does not remove kl_locked() and replace it
with kl_assert_locked() and kl_assert_unlocked().  Instead, the kl_locked
can now be set to NULL in which case no assertion checks are performed on
the lock.  The vfs kqfilter code uses this mode to disable assertion checks.
This preserves the existing ABI for knlist_init().

Add convenience function knlist_init_mtx to reduce number of arguments
for typical knlist initialization.

Reviewed by:	kib
2010-01-22 17:02:07 +00:00
John Baldwin fa8299b049 MFC 191028:
Use a shared vnode lock for reads in vn_rdwr().
2010-01-22 15:12:01 +00:00
John Baldwin 686fc2a73c MFC 193440,193442,193762,194019:
- Support shared vnode locks for write operations when the offset is
  provided on filesystems that support it.  This really improves mysql
  + innodb performance on ZFS.
- When checking for shared writes, use the struct mount returned from
  vn_start_write.
- Simply shared vnode locking and extend it to also include fsync.
  Also, in vop_write, no longer assert for exclusive locks on the
  vnode.
- Stop asserting on exclusive locks in fsync since it can now support
  shared vnode locking on ZFS.
2010-01-22 14:44:15 +00:00
Edward Tomasz Napierala 0466d839c2 MFC c195785:
Fix permission handling for extended attributes in ZFS.  Without
this change, ZFS uses SunOS Alternate Data Streams semantics - each
EA has its own permissions, which are set at EA creation time
and - unlike SunOS - invisible to the user and impossible to change.
From the user point of view, it's just broken: sometimes access
is granted when it shouldn't be, sometimes it's denied when
it shouldn't be.

This patch makes it behave just like UFS, i.e. depend on current
file permissions.  Also, it fixes returned error codes (ENOATTR
instead of ENOENT) and makes listextattr(2) return 0 instead
of EPERM where there is no EA directory (i.e. the file never had
any EA).

Tested by:	cperciva
2010-01-22 11:42:44 +00:00
Andriy Gapon 7ee86647ec MFC r202567: acpi_ec: remove redundant acpi_disabled check 2010-01-22 09:42:41 +00:00
Andriy Gapon f842b2ead5 MFC r202558: acpi_ec: clean up 'private' ivar when freeing memory 2010-01-22 09:37:47 +00:00
Andriy Gapon 4832016d3d MFC r202585: fix a comment typo 2010-01-22 09:30:09 +00:00
Navdeep Parhar 9fc390d90a Remove debug printf. 2010-01-22 02:35:40 +00:00
Christian Brueffer 5d2b9a80b9 MFC: r189773 by rpaulo
Rename the k8temp(4) man page to amdtemp(4) and update its contents for
the new families.

PR:		142925
Submitted by:	Tsurutani Naoki <[email protected]>
2010-01-21 21:12:36 +00:00
John Baldwin 1335148631 Revert part of the previous change that partially reverted an earlier MFC
of 199156.
2010-01-21 21:04:29 +00:00
John Baldwin 5ca0dcdbd8 MFC 198411:
- Fix several off-by-one errors when using MAXCOMLEN.  The p_comm[] and
  td_name[] arrays are actually MAXCOMLEN + 1 in size and a few places that
  created shadow copies of these arrays were just using MAXCOMLEN.
- Prefer using sizeof() of an array type to explicit constants for the
  array length in a few places.
- Ensure that all of p_comm[] is always zero'd during execve() to guard
  against any possible information leaks.  Previously trailing garbage in
  p_comm[] could be leaked to userland in ktrace record headers.
2010-01-21 19:17:42 +00:00
John Baldwin c3895badf7 MFC 198134,198149,198170,198171,198391,200948:
Add a facility for associating optional descriptions with active interrupt
handlers.  This is primarily intended as a way to allow devices that use
multiple interrupts (e.g. MSI) to meaningfully distinguish the various
interrupt handlers.
- Add a new BUS_DESCRIBE_INTR() method to the bus interface to associate
  a description with an active interrupt handler setup by BUS_SETUP_INTR.
  It has a default method (bus_generic_describe_intr()) which simply passes
  the request up to the parent device.
- Add a bus_describe_intr() wrapper around BUS_DESCRIBE_INTR() that supports
  printf(9) style formatting using var args.
- Reserve MAXCOMLEN bytes in the intr_handler structure to hold the name of
  an interrupt handler and copy the name passed to intr_event_add_handler()
  into that buffer instead of just saving the pointer to the name.
- Add a new intr_event_describe_handler() which appends a description string
  to an interrupt handler's name.
- Implement support for interrupt descriptions on amd64, i386, and sparc64 by
  having the nexus(4) driver supply a custom bus_describe_intr method that
  invokes a new intr_describe() MD routine which in turn looks up the
  associated interrupt event and invokes intr_event_describe_handler().
2010-01-21 17:55:47 +00:00
Marius Strobl 219503bacf MFC: r202587
Add epic(4) also here.
2010-01-21 17:37:26 +00:00
Christian Brueffer 636afe2025 MFC: r202290
Build iwi(4) and iwifw(4) modules on amd64 as well.
2010-01-21 16:41:13 +00:00
John Baldwin 5aa5990719 MFC 189696,189697:
Add a new internal mount flag (MNTK_EXTENDED_SHARED) to indicate that a
filesystem supports additional operations using shared vnode locks.
Currently this is used to enable shared locks for open() and close() of
read-only file descriptors.
- When an ISOPEN namei() request is performed with LOCKSHARED, use a
  shared vnode lock for the leaf vnode only if the mount point has the
  extended shared flag set.
- Set LOCKSHARED in vn_open_cred() for requests that specify O_RDONLY but
  not O_CREAT.
- Use a shared vnode lock around VOP_CLOSE() if the file was opened with
  O_RDONLY and the mountpoint has the extended shared flag set.
- Adjust md(4) to upgrade the vnode lock on the vnode it gets back from
  vn_open() since it now may only have a shared vnode lock.
- Don't enable shared vnode locks on FIFO vnodes in ZFS and UFS since
  FIFO's require exclusive vnode locks for their open() and close()
  routines.  (My recent MPSAFE patches for UDF and cd9660 already included
  this change.)
- Enable extended shared operations on UFS, cd9660, and UDF.
2010-01-21 14:33:18 +00:00
Navdeep Parhar 2d3d90a060 MFC r194917,r194918,r197043,r197791,r199239,r199240,r200003,r201907,r202671,r202678:
r194917:
About to add 10Gbase-T to known media types, this is just a whitespace
cleanup before that commit.  No functional impact.

r194918:
Add 10Gbase-T to known ethernet media types

Some parts of r194521 (convert the port and adapter locks from sx_locks to
regular mutexes).

r197043:
There is no need to log anything for a ctrlq stall or restart.  These are
normal events.

r197791:
cxgb(4) updates, including:
- support for the new Gen-2, BT, and LP-CR cards.
- T3 firmware 7.7.0
- shared "common code" updates.

r199239:
The 10GBASE-T card should use an IPG of 1.  Also enable the check
for low power startup on this card.

r199240:
Don't disable the XGMAC's tx on ifconfig down.  It is unnecessary
and can cause false backpressure in the chip.  Fix a us/ms mixup
while here.

r200003:
T3 firmware 7.8.0 for cxgb(4)

r201907:
Extra parantheses to keep certain compilers happy.

r202671:
Fix for a cxgb(4) panic.  cxgb_ioctl can be called by the IP and IPv6
layers with non-sleepable locks held.  Don't (potentially) sleep in
those situations.

r202678:
Complain if freelist queue sizes are significantly less than desired.
2010-01-21 12:18:29 +00:00
Edwin Groothuis 1a1d29ecc9 MFC of 202280, 202281
- Remove -d option, whois.nic.mil doesn't exist anymore.

- Make whois capable of searching for IPv6 addresses just like it can
  do for IPv4 addresses without having to explicetly specify that the
  ARIN server should be used to get the initial information.

PR:             bin/142507, bin/128725
Submitted by:   Dan Mahoney <[email protected]>, "Matt D. Harris" <mdh_lists@
2010-01-21 10:16:32 +00:00
Pyun YongHyeon ecb07d8300 MFC r202406:
Don't free mbuf chains when bge(4) fails to collapse the mbuf
  chains. This part of code is to enhance performance so failing the
  collapsing should not free TX frames. Otherwise bge(4) will
  unnecessarily drop frames which in turn can freeze the network
  connection.

  Reported by:	Igor Sysoev (is <> rambler-co dot ru)
  Tested by:	Igor Sysoev (is <> rambler-co dot ru)
2010-01-21 00:54:22 +00:00
Pyun YongHyeon 5b42a6f3fe MFC r202294:
Add check for fiber mode for BCM5714 PHY. This PHY supports both
  copper and fiber interfaces over GMII so an explicit check is
  necessary to know whether it was configured for fiber interface.
  This change make BCM5715S work.

  Tested by:	olli
  PR:	kern/122551
2010-01-21 00:50:46 +00:00
Pyun YongHyeon 81521c06fa MFC r202293:
For controllers that has dual mode PHY(copper or fiber) interfaces
  over GMII, make sure to enable GMII. With this change brgphy(4) is
  used to handle the dual mode PHY. Since we still don't have a sane
  way to pass PHY specific information to mii(4) layer special
  handling is needed in brgphy(4) to determine which mode of PHY was
  configured in parent interface.
  This change make BCM5715S work.

  Tested by:	olli
  Obtained from:	OpenBSD
  PR:	kern/122551
2010-01-21 00:46:54 +00:00
Pyun YongHyeon dd8e00b736 MFC r202269:
Add BCM5754 PHY id that is found on Dell Studio XPS 16.
2010-01-21 00:39:45 +00:00
Michael Tuexen e94309da4f MFC 197868
Use correct arguments when calling SCTP_RTALLOC().
2010-01-20 19:20:31 +00:00
Michael Tuexen 4d0520ccc9 MFC 199866
Use the default stack size for the iterator thread.
This fixes a crash reported by Irene Ruengeler.
2010-01-20 19:14:34 +00:00
Michael Tuexen 502a2f99f4 MFC 199369
Do not hold the lock longer than necessary.
2010-01-20 19:11:31 +00:00
Michael Tuexen b550de4d9a MFC 201523
Correct usage of parenthesis.
2010-01-20 18:58:23 +00:00
Michael Tuexen f939416b0a MFC 199437
Use always LIST_EMPTY instead of sometime SCTP_LIST_EMPTY,
which is defined as LIST_EMPTY.
2010-01-20 18:55:40 +00:00
Michael Tuexen 9c6596ec20 MFC 199372
Do not start the iterator when there are no associations.
This fixes a bug found by Irene Ruengeler.
2010-01-20 18:50:49 +00:00
John Baldwin 8dde8dd41f MFC 198344:
Change gcc to assume a default machine architecture of 486 instead of 386
on "i386".  Doing it in the compiler is deemed to be less fragile then
attempting to provide a default -march setting via bsd.cpu.mk.  FreeBSD
itself has not supported plain 386 CPUs since 5.x.
2010-01-20 15:14:20 +00:00
John Baldwin ae2619ebff MFC 202285:
- Note that if_xname, if_dname, and if_dunit are usually initialized via
  if_initname().
- Document if_drv_flags and replace references to IFF_(RUNNING|OACTIVE)
  with references to IFF_DRV_(RUNNING|OACTIVE).
2010-01-20 14:48:58 +00:00
Xin LI c5f18c9143 MFC r200799:
K&R -> ANSI prototype.
2010-01-20 00:54:51 +00:00
Xin LI 77871494cc MFC r200795:
Add support of using environment variable BURNCD_SPEED to specify
recodring speed.

PR:		bin/140530
Submitted by:	Alexander Best <alexbestms wwu.de>
2010-01-20 00:46:55 +00:00
Marius Strobl e275ef0962 MFC: r202453
Update the sparc64 hardware list regarding machines that will be supported
by 7.3-RELEASE.
2010-01-19 22:09:45 +00:00
Marius Strobl d25687bf77 MFC: r197368
- Update the list of known-working machines based on feedback for 7.2.
- Update the V440 entry regarding added support for the on-board NICs
  in 7.3 and 8.0.
2010-01-19 22:03:45 +00:00
Fabien Thomas cdf0386dcd MFC 202157:
Bug fix: add a missing initializer.
2010-01-19 20:56:57 +00:00
John Baldwin 0e8aa9c23c MFC 202284,202650:
- Update required headers for namei() to remove <sys/proc.h>.
- Add RETURN VALUES and ERROR sections for namei()'s error return values.
- Add a missing link to NDHASGIANT.9.
2010-01-19 20:48:57 +00:00
Konstantin Belousov 73a48544aa MFC r200038:
Properly support -fPIE by linking PIE binaries with specially-built
Scrt1.o instead of crt1.o.

Separate i386-elf crt1.c into the pure assembler part and C code.

Tested by:	Mykola Dzham <i levsha me>
2010-01-19 20:19:52 +00:00
Konstantin Belousov c941ee2b68 MFC r197931:
Calculate relocation base for the main object, and apply the relocation
adjustment for all virtual addresses encoded into the ELF structures of it.

Tested by:	Mykola Dzham <i levsha me>
2010-01-19 20:05:20 +00:00
Konstantin Belousov f92a42f532 MFC r198202:
If ET_DYN binary has non-zero base address for some reason, honour it
and do not relocate the binary to ET_DYN_LOAD_ADDR. Communicate the
relocation bias of the mapping for interpeter-less ET_DYN binary.

Tested by:	Mykola Dzham <i levsha me>
2010-01-19 19:59:03 +00:00
Konstantin Belousov f0748b69ec MFC r197934:
Map PIE binaries at non-zero base address.

Tested by:	Mykola Dzham <i levsha me>
2010-01-19 19:56:50 +00:00
Konstantin Belousov e9cdbe555d MFC r197932:
Do not map segments of zero length.

Tested by:	Mykola Dzham <i levsha me>
2010-01-19 19:54:18 +00:00
Konstantin Belousov a83eeda2c6 MFC r197933:
Define architectural load bases for PIE binaries.

MFC r198203:
Change the load base to below 2GB for sparc64/sun4v.
2010-01-19 19:51:54 +00:00
Christian Brueffer b39e766214 MFC: r202176
Miscellaneous mdoc, spelling and inconsistency fixes.
2010-01-19 17:10:34 +00:00
Christian Brueffer b9aa796e9e MFC: r201603
Fix a double free().
2010-01-19 16:58:50 +00:00
Alan Cox f0dd762537 MFC r202085
Simplify pmap_init().  Additionally, correct a harmless misbehavior on
  i386.
2010-01-18 22:48:41 +00:00
Michael Tuexen 531812861e MFC 195894:
Add a missing unlock for the inp lock when
returning early from sctp_add_to_readq().
2010-01-18 21:28:11 +00:00
Michael Tuexen e4bea23fa6 MFC 193089:
Fix a small memory leak from the nr-sack code - the mapping array
was not being freed at term of association. Also get rid of
the MICHAELS_EXP code.
2010-01-18 21:25:12 +00:00
Michael Tuexen 4443d59a90 MFC 198522:
Bugfix: Use formula from section 7.2.3 of RFC 4960. Reported by Martin Becke.
2010-01-18 20:57:50 +00:00
Yoshihiro Takahashi d770c39e72 MFC: part of revision 201415
Re-enable more options and devices.  Now kernel size problem is gone.
2010-01-18 11:08:47 +00:00
Yoshihiro Takahashi e48f357d12 MFC: revision 201392
Use UFS2 as default filesystem on pc98.  Now pc98's boot2 works for UFS2.
2010-01-18 10:56:31 +00:00
Yoshihiro Takahashi 54ebaf565d MFC: revision 201391
Do kgzip to the loader on pc98, too.  Now pc98's boot2 works for ELF.
2010-01-18 10:53:59 +00:00
Xin LI 40a6c09d05 MFC r202129:
Report ZFS filesystem version instead of the zpool version when we say it.

Reported by:	Yuri Pankov (on -fs@)
Submitted by:	delphij
2010-01-18 05:24:51 +00:00
Xin LI b52db0f00c MFC r201520:
Test index value is within the range before using it to reference
array member.

PR:		bin/141838
Submitted by:	Henning Petersen <[email protected]>
2010-01-18 05:22:27 +00:00
Warner Losh d9798c89db MFC 202019:
Add INCLUDE_CONFIG_FILE in GENERIC on all non-embedded platforms.
  # This is the resolution of removing it from DEFAULTS...
2010-01-18 04:08:43 +00:00
Christian Brueffer 93720086cf MFC: r201870, r201889
Various language fixes.  Also fixed the URL to totd, obtained from NetBSD.
2010-01-17 17:36:25 +00:00
Bjoern A. Zeeb 9a13393d70 MFC r201806:
Switch traceroute over to make use of proper in-kernel source
  address selection.

  Reviewed by:  rwatson, fenner
  PR:           kern/139454
  Tested by:    Frank Steinborn (steinex nognu.de)

MFC r201897:
  Correct spelling.

  Submitted by: (pluknet gmail.com)
2010-01-17 15:21:24 +00:00
Bjoern A. Zeeb 2e52e28e9d MFC r202116:
Adjust a comment to reflect reality, as we have proper source
  address selection, even for IPv4, since r183571.

  Pointed out by:       Jase Thew (bazerka beardz.net)
2010-01-17 13:45:33 +00:00
Bjoern A. Zeeb 79eb5750da MFC r201898:
Add comments trying to explain what bad things happen here, i.e.
  how hashed MD5/SHA are implemented, abusing Final() for padding and
  sw_octx to transport the key from the beginning to the end.

  Enlightened about what was going on here by: cperciva
  Reviewed by:  cperciva
2010-01-17 13:36:25 +00:00
Bjoern A. Zeeb cc8c2f9be5 MFC r187826:
While OpenBSD's crypto/ framework has sha1 and md5 implementations that
  can cope with a result buffer of NULL in the "Final" function, we cannot.
  Thus pass in a temporary buffer long enough for either md5 or sha1 results
  so that we do not panic.

PR:		bin/126468
Reviewed by:	cperciva
2010-01-17 13:31:48 +00:00
Bjoern A. Zeeb 996698f24a MFC r201742:
After adding an SDT provider for opencrypto in r199884 we should also
  depend on opt_kdtrace.h for the module build.

  Submitted by: (Andre.Albsmeier siemens.com)
2010-01-17 13:28:25 +00:00
Bjoern A. Zeeb 3de5347a7f MFC r201688:
Correct a typo.

  Submitted by: sn_ (sn_ gmx.net) on hackers@
2010-01-17 13:24:15 +00:00
Gavin Atkinson f91ab5c409 Merge r197308 from head (originally by ed):
Spell Israel correctly.

PR:		bin/138580
Submitted by:	Alexey Savartsov <asavartsov gmail com>
Approved by:	ed (mentor, implicit)
2010-01-17 11:21:18 +00:00
Gavin Atkinson e65b7d7cae Merge r201440, r201445 from head:
Don't complain when we encounter the "cache" source, it's valid.  Also fix
  the error message to include a line feed and not include a stray comma.

  Submitted by: Artis Caune  artis.caune gmail.com

  While here, change "> /dev/stderr" for more usual ">&2"

  Submitted by: jilles

PR:		bin/121671
Approved by:	ed (mentor, implicit)
2010-01-17 11:10:32 +00:00
Gavin Atkinson d554b3e8ac Merge r201429 from head:
Fix return code in the case of successful file transfer, broken in
  tftp.c 1.13

PR:		bin/117452
Submitted by:	Spencer Minear  minear securecomputing.com
Approved by:	ed (mentor, implicit)
2010-01-17 10:59:07 +00:00
Mitsuru IWASAKI 4d4c5ea7a2 MFC r201605: Update acpi_ibm syctl nodes on resume. 2010-01-17 06:24:24 +00:00
Christian Brueffer c0063d32dc MFC: r201888
bridge(4) acts like a switch, not like a hub.
2010-01-16 09:24:12 +00:00
Alexander Motin 3873da2e9a MFC r201658:
Increase default block size from 4K to 64K. It was reduces 6 yeard ago,
when trees were big and FAST mode was enabled by default.

So small block size doesn't benefits linear I/O operations in FAST and
significantly slowdowns in ECONOMIC (default) mode. For single stream random
I/Os so small block doesn't give much benefits, as access time is usually
bigger then transfer time there. Same time it requires all heads to seek
together for every single request, reducing performance on parallel load.
2010-01-15 23:54:14 +00:00
Marius Strobl b89688c16c MFC: r201052, r201200, r202003, r202010, r202023
Add a driver for the `Fire' JBus to PCIe bridges found in at least
the Sun Fire V215/V245 and Sun Ultra 25/45 machines. This driver also
already includes all the code to support the `Oberon' Uranus to PCIe
bridges found in the Fujitsu-Siemens based Mx000 machines but due to
lack of access to such a system for testing, probing of these bridges
is currently disabled.
Unfortunately, the event queue mechanism of these bridges for MSIs/
MSI-Xs matches our current MD and MI interrupt frameworks like square
pegs fit into round holes so for now we are generous and use one event
queue per MSI, which limits us to 35 MSIs/MSI-Xs per Host-PCIe-bridge
(we use one event queue for the PCIe error messages). This seems
tolerable as long as most devices just use one MSI/MSI-X anyway.
Adding knowledge about MSIs/MSI-Xs to the MD interrupt code should
allow us to decouple the 1:1 mapping at the cost of no longer being
able to bind MSIs/MSI-Xs to specific CPUs as we currently have no
reliable way to quiesce a device during the transition of its MSIs/
MSI-Xs to another event queue. This would still require the problem
of interrupt storms generated by devices which have no one-shot
behavior or can't/don't mask interrupts while the filter/handler is
executed (like the older PCIe NICs supported by bge(4)) to be solved
though.
2010-01-15 21:45:55 +00:00
Christian Brueffer 75b808f38c MFC: r202159
Remove useless .TE groff macro.
2010-01-15 19:54:12 +00:00
Christian Brueffer a61ac5f8a0 MFC: r201836
Remove unnecessary quoting and markup, add missing punctuation.
2010-01-15 19:44:40 +00:00
Marius Strobl 00f92d2909 MFC: r202006
Add epic(4), a driver for the front panel LEDs in Sun Fire V215/V245.
It's named after the driver doing the same job in OpenSolaris.
2010-01-15 19:12:34 +00:00
Marius Strobl fc5335db38 MFC: r201932
- Add code allowing a network device to only be open and closed once
  by keeping it opened after the first open and closing it via the
  cleanup handler when NETIF_OPEN_CLOSE_ONCE is defined. Note that
  due to the fact that the part of r177108 which reverts r60506 and
  causes the open-close-dance on every file access as the remaining
  problems with powerpc should be sorted out first, in stable/7 the
  only difference in behavior between when NETIF_OPEN_CLOSE_ONCE is
  defined and not currently is that with that macro defined the
  network device is eventually closed before entering the kernel and
  before rebooting.
- Define NETIF_OPEN_CLOSE_ONCE on sparc64 in order to not keep the
  network device opened forever, as at least with some firmware
  versions received packets are DMA'ed to stale memory otherwise.
2010-01-15 19:06:47 +00:00
Marius Strobl 2239fe60d3 MFC: r201901
Remove clause 3 and 4 from TNF licenses (this was the only 4-clause TNF
license FreeBSD had in sys/boot).

Obtained from:	NetBSD
2010-01-15 16:57:53 +00:00
Marius Strobl 835dd37ac1 MFC: r201396, r201410
- Demapping unused kernel TLB slots has proven to work reliably so move
  the associated debugging under bootverbose.
- Remove freebsd4_sigreturn(); given that FreeBSD 4 didn't supported
  sparc64 this only ever served as a transition aid prior to FreeBSD
  5.0 and is unused by default since COMPAT_FREEBSD4 was removed from
  GENERIC in r143072 nearly 5 years ago.
2010-01-15 16:55:00 +00:00
Marius Strobl 539909981c MFC: r201395
- Preserve the PROM IOMMU in order to allow OFW drivers to continue to
  work.
- Sanity check the parameters passed to the implementations of the
  pcib_{read,write}_config() methods. Using illegal values can cause
  no real harm but it doesn't hurt to avoid unnecessary data error
  traps requiring to flush and re-enable the level 1 caches.
2010-01-15 16:46:06 +00:00
Marius Strobl c8d724d42b MFC: r201199
- Prefer i and j over i and n for temporary integer variables.
- Wrap/shorten too long lines.
- Remove a redundant variable and an unnecessary cast in schizo(4).
2010-01-15 16:43:19 +00:00
Marius Strobl fb1162cd57 MFC: r201126
Account for firmware versions which include the CDMA interrupts in
the OFW device tree.
2010-01-15 16:41:10 +00:00
Marius Strobl cf3a41c4e3 MFC: r201009
Remove clause 3 from Izumi Tsutsui's licenses.

Obtained from:	NetBSD
2010-01-15 16:29:41 +00:00
Marius Strobl 3be6f25287 MFC: r201008
Style changes

Obtained from:	NetBSD (mc146818reg.h)
2010-01-15 16:28:02 +00:00
Marius Strobl ab56a9f7bf MFC: r201007
Correct my e-mail address.
2010-01-15 16:25:19 +00:00
Marius Strobl 04f1cd92a1 MFC: r201007
Add a man page for mk48txx(4).

Requested by:	n_hibma
Obtained from:	NetBSD (original version)
2010-01-15 16:21:32 +00:00
Marius Strobl b0088fdadc MFC: r201005, r201371
- Take advantage of bus_{read,write}_*(9).
- Set dow = -1 in mk48txx_gettime() because some drivers (for example
  the NetBSD and OpenBSD mk48txx(4)) don't set it correctly.
2010-01-15 15:47:31 +00:00
Marius Strobl d023fdb252 MFC: r201004
Remove clause 3 and 4 from TNF licenses.

Obtained from:	NetBSD
2010-01-15 15:42:16 +00:00
Marius Strobl 4fc1abc158 MFC: r201003
Style changes
2010-01-15 15:41:04 +00:00
Marius Strobl c0d18674e7 - Hook up the default implementations of the MSI/MSI-X pcib_if methods
so requests may bubble up to a host-PCI bridge driver.
- Distinguish between PCI and PCIe bridges in the device description
  so it's a bit easier to follow what hangs off of what in the dmesg.
  Unfortunately we can't also tell PCI and PCI-X apart based on the
  information provided in the OFW device tree.
- Add quirk handling for the ALi M5249 found in Fire-based machines
  which are used as a PCIe-PCIe bridge there. These are obviously
  subtractive decoding as as they have a PCI-ISA bridge on their
  secondary side (and likewise don't include the ISA I/O range in
  their bridge decode) but don't indicate this via the class code.
  Given that this quirk isn't likely to apply to all ALi M5249 and
  I have no datasheet for these chips so I could implement a check
  using the chip specific bits enabling subtractive decoding this
  quirk handling is added to the MD code rather than the MI one.
2010-01-15 15:38:53 +00:00
Marius Strobl a4d05c0c49 MFC: r200947
Add missing locking in intr_bind().
2010-01-15 15:36:24 +00:00
Marius Strobl c0f15e5970 MFC: r200946
Execute the cleanup handlers before jumping to the kernel just
like the other architectures do.
2010-01-15 15:28:58 +00:00
Marius Strobl a704d1dcc0 MFC: r200945
- Consistently wrap debugging in NETIF_DEBUG. This basically merges
  NetBSD rev 1.19.
- Make the functions match their prototypes regarding static.
2010-01-15 15:26:03 +00:00
Marius Strobl 6b54872ee4 MFC: r182731
Show info about net devices in loader's 'lsdev' command. While there fix style.
2010-01-15 15:23:38 +00:00
Marius Strobl 733c09fdf8 MFC: r177108 (partial)
Suppress excessive output while netbooting via loader, unless debugging.
2010-01-15 15:16:49 +00:00
Antoine Brodin 2518668b2a MFC r200440 to stable/7:
Install firmware(9) examples.
2010-01-15 14:30:20 +00:00
Yoshihiro Takahashi 9911c9f1cd MFC: revision 201342
Reimplement the boot2 for pc98 completely.
  It's based on the newest i386's one and has the advantage of:

   - ELF binary support.
   - UFS2 filesystem support.
   - Many FreeBSD slices support on a disk.
2010-01-15 12:45:23 +00:00
Dmitry Morozovsky a86a13e276 MFH r201051:
To remove a server, one should use double backslash, and half of them
  are eaten by shell.  Fix this.
2010-01-15 12:07:00 +00:00
Yoshihiro Takahashi 02b0f70ba5 MFC: revision 201339 and 201340
- Add setting machine type support to the loader.
  - Don't use 15M-16M area on pc98.  It's reserved for some devices.
2010-01-15 11:28:36 +00:00
Doug Barton 2f69776fde MFC r200416:
Simplify handling of MTREEFILE relative to DESTDIR

Make the message about a missing MTREEFILE combined with -U
more informative

MFC r200425:
Over time things that used to be files/directories/links can change
to something else. So add code to detect when things don't match and
give the user choices about how to fix it.

If we're using -P and something in the above check needs to be moved
we need to have the directory there for it, so create it at the
beginning and delete empty versions of it at the end.

The case where something used to be a file or link and now is supposed
to be a directory (e.g., /etc/security) is especially dangerous, so
make failure to install a necessary directory in $DESTDIR a fatal error.

MFC r200700:
In the places where find is used that the user may see the results,
first pipe it to sort so that order of processing will be deterministic
and like things will be grouped together.

MFC r200701:
Fix an indentation issue, no functional changes

MFC r200708:
Fix a problem with how mergemaster handles the hard links for /.cshrc
and /.profile. The problem is that install(1) will unlink the old file
before it installs the new one, which means that in the best case we
have to compare the changes for the old file twice.

So, change the logic to first test to see if the link exists, then
install the file. Then if the link was there and we're using -i, just
create the link in /root and be done with it. Otherwise display the
message to the user and give them the option.

Because we are now sorting things before doing the comparison we can
know conclusively that the files in / should be the sources, and the
files in /root will be the targets, so adjust the paths accordingly.

While I'm here, split a too-long error message into two lines and
just return at the end of handling these files instead of setting
the variable that says "do nothing" and then returning at the end
of the function anyway.

MFC r201291:
Add some patches contributed by jhb:
1. Don't prompt the user for "-U but no db" error if we're using -a
2. Add an option to delete stale rc.d files automatically if the user
has DELETE_STALE_RC_FILES in their rc file. Lack of command line option
for this is not an oversight.
3. Add []'s around the terminal $ for the $FreeBSD$ test for -F

For one bug raised by jhb I did a more thorough solution:
There were a lot of things that "snuck in" between the end of the test
for -r and the start of the comparison. One of them is the creation of
the mtree db, as pointed out by jhb. Fix this problem more thoroughly
by moving the end of the test down to where it should/used to be, right
before the comparison. As a result, indent the interloping code to match.

MFC r201292:
Document the DELETE_STALE_RC_FILES option introduced in r201291. This is
an "rc file only" option by design.

While I'm here, update the comments in the example rc file to indicate
which command line options they relate to, and correct the defaults
for a couple of options.

MFC r201293:
It's not necessary to include both Op and Fl for command line options
included in the text, so use only the latter.

Clarify that using -U doesn't make sense in combination with -a

MFC r201323:
If we are using -p it does not make any sense to even create the
MTREENEW file since it will never be used.

MFC r201765:
Update copyright date

Update delete_temproot() to include the error message if it fails,
and clean up the places where it's called.

If there are no files left in temproot when the comparison is done
delete it without prompting. This should make "automated" runs of
mergemaster without -a a little easier.

Document the new behavior in the man page.
2010-01-15 03:39:03 +00:00
Doug Barton ec243f852b MFC r201368:
Update named_flags comment regarding not using it for -u and -c
2010-01-15 03:06:39 +00:00
Doug Barton d9ac9cfefa MFC r201367, r201370:
Virtualize the location of "the configuration directory" instead of
hard-coding it to be /etc/namedb
2010-01-15 03:05:46 +00:00
Doug Barton 786e5f5953 MFC r201626:
- Move potentially offensive quotes I committed recently to fortunes-o.
- Reference date.
- Be more clear on context.

MFC r201764:
For the now-infamous Rumsfeld quote:

Change "there're" to "there are" which is consistent with the vast
majority of on line references.

Remove a spurious trailing "

Update the citation text with a suggestion from des.
2010-01-15 02:58:22 +00:00
Doug Barton 2d10002c94 MFC r201601:
Remove more duplicates
Minor reformatting on a few
2010-01-15 02:21:54 +00:00
Pyun YongHyeon 02974f34d8 MFC r201769:
Enable ste(4). ste(4) should work on all architectures.
2010-01-14 22:37:06 +00:00
Pyun YongHyeon 3f06872202 MFC r200958:
Document newly added loader tunable/sysctl variable
  dev.ste.%d.int_rx_mod.
  While I'm here add .Xr vlan as ste(4) supports long frames.
2010-01-14 22:34:24 +00:00
Pyun YongHyeon 6cf56f8f34 MFC r200950,200955,200965-200966,201767-201768
r200950:
  Implement RX interrupt moderation using one-shot timer interrupt.
  Unlike TX interrupt, ST201 does not provide any mechanism to
  suppress RX interrupts. ste(4) can generate more than 70k RX
  interrupts under heavy RX traffics such that these excessive
  interrupts make system useless to process other useful things.
  Maybe this was the major reason why polling support code was
  introduced to ste(4).
  The STE_COUNTDOWN register provides a programmable counter that
  will generate an interrupt upon its expiration. We program
  STE_DMACTL register to use 3.2us clock rate to drive the counter
  register. Whenever ste(4) serves RX interrupt, the driver rearm
  the timer to expire after STE_IM_RX_TIMER_DEFAULT time and disables
  further generation of RX interrupts. This trick seems to work well
  and ste(4) generates less than 8k RX interrupts even under 64 bytes
  UDP torture test. Combined with TX interrupts, the total number of
  interrupts are less than 10k which looks reasonable on heavily
  loaded controller.

  The default RX interrupt moderation time is 150us. Users can change
  the value at any time with dev.ste.%d.int_rx_mod sysctl node.
  Setting it 0 effectively disables the RX interrupt moderation
  feature. Now we have both TX/RX interrupt moderation code so remove
  loop of interrupt handler which resulted in sub-optimal performance
  as well as more register accesses.

r200955:
  Add suspend/resume support as well as basic WOL.
  While I'm here simplify SIOCSIFCAP handler.

r200965:
  Update if_iqdrops in case of RX buffer allocation failure.

r200966:
  ether_ifattach sets if_mtu, remove unnecessary code.

r201767:
  Fix EEPROM access code to return data in host byte order.
  EEPROM on ST201 always returns 16bits data with little endian
  format so conversion to host order is required.
  This change fixes inversed ethernet address on sparc64.

r201768:
  Make sure to store dma address of RX buffer in little endian form.
  This fixes the last bug which keeps ste(4) from working on sparc64.
2010-01-14 22:29:29 +00:00
Pyun YongHyeon 11746e918c MFC r200904-200908,200910-200913
r200904:
  Don't reinitialize controller if driver is already running. This
  reduces number of link state UP/DOWN changes.

r200905:
  Reimplement controller reset. Datasheet says full reset takes about
  1ms. Since we switched to memory register mapping make sure to
  flush PCI posted write by reading the register again.
  While I'm here add additional delays in loop while driver waits the
  completion of the reset.

r200906:
  Overhaul RX filter programming.
   o Let RX filter handler program promiscuous/multicast filter as
     well as broadcasting.
   o Remove unnecessary register access.
   o Simplify ioctl handler and have set_rxfilter to handle
     IFF_PROMISC and IFF_ALLMULTI change instead of directly
     programming the controller.
   o Removed unnecessary error variable reinitialization in ioctl
     handler.
   o Add IFF_DRV_RUNNING check before programming multicast filter.
   o Configure maximum allowed frame length before enabling MAC.
     Datasheet didn't say the exact ordering of programming sequence
     but it looks more natural to set maximum allowed frame length
     first prior to enabling controller.

r200907:
  Don't report link status if driver is not running.

r200908:
  Report the correct result of mii_mediachg(). Previously it always
  used to return success without respect to the result.
  While I'm here use mii_mediachg() in ste_init_locked which allows
  driver to use currently configured media. ste_ifmedia_upd() is
  supposed to be called whenever user changes current media settings.

r200910:
  Implement hardware MAC statistics counter support. The counters
  could be accessed with dev.ste.0.stats sysctl node.

r200911:
  Remove unused duplicated register definition. It seems the
  definition was made to access STE_ASICCTL register as 16bits but
  ste(4) always access the register as 32bits so it was never used
  before.

r200912:
  Correct STE_COUNTDOWN register offset. The datasheet was wrong.

r200913:
  We don't need to generate DMA complete interrupt for every
  transmitted frames. So request interrupt for every 16th frames. Due
  to the limitation of hardware we can't suppress the interrupt as
  driver should have to check TX status register. The TX status
  register can store up to 31 TX status so driver can't send more
  than 31 frames without reading TX status register.
  With this change controller would not generate TX completion
  interrupt for every frame, so reclaim transmitted frames in
  ste_tick().
2010-01-14 22:18:55 +00:00
Pyun YongHyeon ac91e9e995 MFC r200854,200856,200865,200873,200875,200877,200884
r200854:
  Add minimal dealy while ste(4) is waiting for the end of active DMA
  cycle.

r200856:
  Introduce sc_flags member variable and use it to keep track of
  link state and PHY related information.
  Remove ste_link and ste_one_phy variable of softc as it's not used
  anymore.
  While I'm here add IFF_DRV_RUNNING check in ste_start_locked().

r200865:
  Reimplement miibus_statchg method. Don't rely on link state change
  interrupt. If we want to use link state change interrupt ste(4)
  should also implement auto-negotiation complete handler as well as
  various PHY access handling. Now link state change is handled by
  mii(4) polling so it will automatically update link state UP/DOWN
  events which in turn make ste(4) usable with lagg(4).

  r199559 added a private timer to drive watchdog and the timer also
  used to drive MAC statistics update. Because the MAC statistics
  update is called whenever statistics counter reaches near-full, it
  drove watchdog timer too fast such that it caused false watchdog
  timeouts under heavy TX traffic conditions.
  Fix the regression by separating ste_stats_update() from driving
  watchdog timer and introduce a new function ste_tick() that handles
  periodic job such as driving watchdog, MAC statistics update and
  link state check etc.
  While I'm here clear armed watchdog timer in ste_stop().

r200873:
  Instead of relying on hard resetting of controller to stop
  receiving incoming traffics, try harder to gracefully stop active
  DMA cycles and then stop MACs. This is the way what datasheet
  recommends and seems to work reliably. Resetting controller while
  active DMAs are in progress is bad thing as we can't predict how
  DMAs touche allocated TX/RX buffers. This change ensures controller
  stop state before attempting to release allocated TX/RX buffers.
  Also update MAC statistics which could have been updated during the
  wait time of MAC stop.

  While I'm here remove unnecessary controller resets in various
  location. ste(4) no longer relies on hard controller reset to stop
  controller and resetting controller also clears all configured
  settings which makes it hard to implement WOL in near future.
  Now resetting a controller is performed in ste_init_locked().

r200875:
  Prefer memory space register mapping over io space. If memory space
  mapping fails fall back to old io space mapping.
  While I'm here use PCIR_BAR macro.

r200877:
  Prefer bus_write_{1,2,4}/bus_read_{1,2,4} to
  bus_space_write_{1,2,4}/bus_space_read_{1,2,4}.
  Remove unused ste_bhandle and ste_btag in softc.

r200884:
  Reimplement Tx status error handler as recommended by datasheet.
  If ste(4) encounter TX underrun or excessive collisions the TX MAC
  of controller is stalled so driver should wake it up again. TX
  underrun requires increasing TX threshold value to minimize
  further TX underruns. Previously ste(4) used to reset controller
  to recover from TX underrun, excessive collision and reclaiming
  error. However datasheet says only TX underrun requires resetting
  entire controller. So implement ste_restart_tx() that restarts TX
  MAC and do not perform full reset except TX underrun case.
  Now ste(4) uses CSR_READ_2 instead of CSR_READ_1 to read
  STE_TX_STATUS register. This way ste(4) will also read frame id
  value and we can write the same value back to STE_TX_FRAMEID
  register instead of overwriting it to 0. The datasheet was wrong
  in write back of STE_TX_STATUS so add some comments why we do so.
  Also always invoke ste_txeoc() after ste_txeof() in ste_poll as
  without reading TX status register can stall TX MAC.
2010-01-14 22:04:32 +00:00
Pyun YongHyeon 043dd16c5d MFC r200853:
Add bus_dma(9) and endianness support to ste(4).
   o Sorted includes and added missing header files.
   o Added basic endianness support. In theory ste(4) should work on
     any architectures.
   o Remove the use of contigmalloc(9), contigfree(9) and vtophys(9).
   o Added 8 byte alignment limitation of TX/RX descriptor.
   o Added 1 byte alignment requirement for TX/RX buffers.
   o ste(4) controllers does not support DAC. Limit DMA address space
     to be within 32bit address.
   o Added spare DMA map to gracefully recover from DMA map failure.
   o Removed dead code for checking STE_RXSTAT_DMADONE bit. The bit
     was already checked in each iteration of loop so it can't be true.
   o Added second argument count to ste_rxeof(). It is used to limit
     number of iterations done in RX handler. ATM polling is the only
     consumer.
   o Removed ste_rxeoc() which was added to address RX stuck issue
     (cvs rev 1.66). Unlike TX descriptors, ST201 supports chaining
     descriptors to form a ring for RX descriptors. If RX descriptor
     chaining is not supported it's possible for controller to stop
     receiving incoming frames once controller pass the end of RX
     descriptor which in turn requires driver post new RX
     descriptors to receive more frames. For TX descriptors which
     does not support chaning, we exactly do manual chaining in
     driver by concatenating new descriptors to the end of previous
     TX chain.
     Maybe the workaround was borrowed from other drivers that does
     not support RX descriptor chaining, which is not valid for ST201
     controllers. I still have no idea how this address RX stuck
     issue and I can't reproduce the RX stuck issue on DFE-550TX
     controller.
   o Removed hw.ste_rxsyncs sysctl as the workaround was removed.
   o TX/RX side bus_dmamap_load_mbuf_sg(9) support.
   o Reimplemented optimized ste_encap().
   o Simplified TX logic of ste_start_locked().
   o Added comments for TFD/RFD requirements.
   o Increased number of RX descriptors to 128 from 64. 128 gave much
     better performance than 64 under high network loads.
2010-01-14 21:54:20 +00:00
Pyun YongHyeon 679d58f99a MFC r200798,200801,200803-200804,200808,200810
r200798:
  Use ANSI function definations.

r200801:
   o Remove unnecessary return statement.
   o Remove register keyword.

r200803:
  s/u_intXX_t/uintXX_t/g

r200804:
  Remove trailing white spaces.

r200808:
  style(9)

r200810:
  Sort function prototyes.

Also remove mergeinfo recorded in if_ste.c/if_stereg.h.
2010-01-14 21:37:40 +00:00
Andrew Gallatin 62a9a3a156 MFC: r194747,r202120:
Update mxge(4) firmware to 1.4.48b (latest available) from Myricom.
2010-01-14 21:30:22 +00:00
Andrew Gallatin 23fe7fc6c3 MFC r202121:
Use better default RSS hash (src + dst, rather than just src port)
2010-01-14 21:10:41 +00:00
Andrew Gallatin 205adfcf0f MFC 202119: Fix reporting of 10G Twinax media 2010-01-14 20:58:19 +00:00
Pyun YongHyeon cda63e17d8 Partial merge r199559:
- Add a private timer to drive the transmit watchdog instead of using
    if_watchdog and if_timer.
  - Fix some issues in detach for sn(4), ste(4), and ti(4).  Primarily this
    means calling ether_ifdetach() before anything else.
2010-01-14 20:40:37 +00:00
Pyun YongHyeon 3295db4ae6 MFC r181739:
Move the ste driver from sys/pci to sys/dev/ste.
2010-01-14 20:20:26 +00:00
Marius Strobl fb6a59e140 MFC: r200938
- Don't check for a valid interrupt controller on every interrupt
  in intr_execute_handlers(). If we managed to get here without an
  associated interrupt controller we have way bigger problems.
  While at it predict stray vector interrupts as false as they are
  rather unlikely.
- Don't blindly call the clear function of an interrupt controller
  when adding a handler in inthand_add() as interrupt controllers
  like the one driven by upa(4) are auto-clearing and thus provide
  NULL instead.
2010-01-13 21:23:29 +00:00
Marius Strobl b8b4d8455d MFC: r200926
Recognize the NS16552 found in PCIe-based sun4u machines.
2010-01-13 21:21:32 +00:00
Marius Strobl 3d042d3141 MFC: r200925
- By re-arranging the code in OF_decode_addr() somewhat and accepting
  a bit of a detour we can just iterate through the banks array instead
  of having to calculate every offset. This change is inspired by the
  powerpc version of this function.
- Add support for the JBus to EBus bridges which hang off of nexus(4).
2010-01-13 21:19:46 +00:00
Marius Strobl d4f1f3e199 MFC: r200924
Style changes.
2010-01-13 21:17:48 +00:00
Marius Strobl 2632bbf93d MFC: r200923
- Add support for the IOMMUs of Fire JBus to PCIe and Oberon Uranus
  to PCIe bridges.
- Add support for talking the PROM mappings over to the kernel IOTSB
  just like we do with the kernel TSB in order to allow OFW drivers
  to continue to work.
- Change some members, parameters and variables to unsigned where
  more appropriate.
2010-01-13 21:16:13 +00:00
Marius Strobl 2a53250fea MFC: r200922
Fix whitespace according to style(9).
2010-01-13 21:13:51 +00:00
Marius Strobl e406fe73da MFC: r200921
- Add quirk handling for ALi M5229, mainly setting the magic "force
  enable IDE I/O" bit which prevents data access traps with revision
  0xc8 in Fire-based machines when pci(4) enables PCIM_CMD_PORTEN.
- Like for sun4v also don't add the PCI side of host-PCIe bridges to
  the bus on sun4u as they don't have configuration space implement
  there either.
2010-01-13 21:12:31 +00:00
Marius Strobl 78af37ca22 MFC: r200920
- Sort the prototypes.
- Add macros to ease the access of device configuration space in
  ofw_pcibus_setup_device().
2010-01-13 21:08:57 +00:00
Marius Strobl 4a47575559 MFC: r200918
Add structures for OFW MSI/MSI-X support. These are identical for
both sun4u and sun4v.
2010-01-13 21:05:01 +00:00
Marius Strobl 3c9572afa0 MFC: r200917
Hook ebus(4) and isa(4) up to the sun4v LINT build in order to
ensure that their compilation doesn't break as they are expected
to work as-is now (but aren't actually run-time tested).
2010-01-13 21:03:06 +00:00
Marius Strobl 59af798929 MFC: r200916
Remove devices which are/were only relevant for sun4u.
2010-01-13 20:59:42 +00:00
Marius Strobl 5d1669036c MFC: r200915
Don't probe the bq4802 variant found in Ultra 25 and 45 for now as
this chip isn't MC146818 compatible and requires different handlers
(but which I can't test due to lack of such hardware).
2010-01-13 20:51:23 +00:00
Marius Strobl e289e8a1be MFC: r200914
Don't use an out register to hold the vector number across the call
of the interrupt handler in intr_fast() as the handler might clobber
it (no in-tree handler currently does but an upcoming one will).
While at it, tidy the register usage in the interrupt counting code.
2010-01-13 20:40:51 +00:00
Marius Strobl 2eccb434b3 MFC: r200880
- Correct an off-by-one error when calculating the end of a child
  range.
- Spell the PCI TLA in uppercase.
2010-01-13 20:35:37 +00:00
Marius Strobl dd1f7758a7 MFC: r200879
- Add support for the JBus to EBus bridges which hang off of nexus(4)
  and are found in sun4u and sun4v machines based on the Fire ASIC.
- Initialize the configuration space of the PCI to EBus variant the
  same way as OpenSolaris does.
2010-01-13 20:33:00 +00:00
Marius Strobl cfe045d4aa MFC: r200878
- Add macros for the states of the interrupt clear registers.
- Change INTMAP_VEC() to take an INO as its second argument rather
  than an INR. The former is what I actually intended with this
  macro and how it's currently used.
2010-01-13 20:07:46 +00:00
Marius Strobl 54bba53afc MFC: r200876
Make these constants unsigned which is more appropriate.
2010-01-13 20:05:35 +00:00
Marius Strobl d3953cd5b9 MFC: r200815, r200816
Provide and consume missing module dependency information.
2010-01-13 19:59:19 +00:00
Marius Strobl d6357a179f MFC: 197164
Factor out the duplicated macro for the device type used in the
OFW device tree for PCI bridges and add a new one for PCI Express.
While at it, take advantage of the former for the rman(9) work-
around in jbusppm(4).
2010-01-13 19:56:02 +00:00
John Baldwin a89714ee5e MFC 199607, 200797, 201270, 201669:
Use pthread_once() to initialize the thread-local storage for localtime()
and gmtime() and _once() to initialize gmt state rather than home-rolled
versions using pthread mutex locks.
2010-01-13 18:12:37 +00:00
Christian Brueffer 881f50ec5a MFC: r197276
Correct a sysctl name.
2010-01-12 22:28:59 +00:00
John Baldwin d977a612a0 MFC 201215:
Add support for configuring vlan(4) interfaces as child devices similar to
wlan(4) interfaces.  vlan(4) interfaces are listed via a new 'vlans_<IF>'
variable.  If a vlan interface is a number, then that number is treated as
the vlan tag for the interface and the interface will be named '<IF>.<tag>'.
Otherwise, the vlan tag must be provided via a vlan parameter in a
'create_args_<vlan>' variable.

While I'm here, fix a few nits in rc.conf(5) and mention create_args_<IF> in
the description of cloned_interfaces.

The changes for 7.x are a bit larger as they introduce childif_create() and
childif_destroy() and move ifn_start() and ifn_stop() from rc.d/netif to
network.subr.
2010-01-12 20:06:04 +00:00
John Baldwin 1b2040b2cd MFC 201202:
Use reallocf() to simplify some logic.
2010-01-12 18:47:52 +00:00
Brooks Davis b37c6a3b91 MFC r201443:
Add vlan(4) to all GENERIC kernels.
2010-01-12 06:04:32 +00:00
Andrew Gallatin fbbaa13f7e MFC: Merge older mxge(4) fixes/improvements from head:
r193250: Set an rx jumbo cluster to the correct size for bus_dmamap_load_mbuf_sg()
r194836: Initial mtu
r195818: Rename hw.mxge.rss_hash_type -> hw.mxge.rss_hashtype
r197391: Add support for TX throttling
2010-01-11 21:23:59 +00:00
John Baldwin 16b318c1b0 MFC 201522:
Expose the upper 256 ptys in the default devfs rules.  I should have updated
this when expanding the old pty(4) driver to use 512 ptys by default.  This
is more important for 7.x.
2010-01-11 18:44:41 +00:00
Christian Brueffer 6b917bc98a MFC: r201538, r201539
Catch up with the VFS_VPTOFH(9) -> VOP_VPTOFH(9) repocopy that happened
almost three years ago in r166794.

Add a missing word.
2010-01-11 05:26:18 +00:00
Fabien Thomas 592e45e047 MFC 201151:
Use VFS_{LOCK,UNLOCK}_GIANT() around the call to vrele().
2010-01-10 16:43:45 +00:00
Fabien Thomas d507f8264c MFC 201023:
* Support the L1D_CACHE_LD event on Core2 processors.
 * Correct a group of typos: for Core2 programmable events, check
   user supplied umask values against the correct event descriptor
   field.
2010-01-10 16:40:14 +00:00
Fabien Thomas 116f8df3d5 MFC 201021:
Log process mappings for existing processes at PMC start time.
2010-01-10 16:36:43 +00:00
Xin LI 3c3898ff6f MFC r201756:
Re-apply onnv-gate revisions 7994 and 8986 (corresponds to FreeBSD
revision 200726 and 200727).

Reviewed by:  mm@
2010-01-10 07:18:35 +00:00
Pyun YongHyeon a98db9ac29 MFC r200693:
Make sure to enable Next Page bit for IP1001. Otherwise the PHY
  fails to re-establishe 1000baseT link after downgrading to
  10/100Mbps link.
2010-01-09 01:20:01 +00:00
Pyun YongHyeon 34f1595660 MFC r200641,200676
r200641:
  Document newly added loader tunable and sysctl variables.
   o hw.vge.msi_disable
   o dev.vge.%d.int_holdoff
   o dev.vge.%d.rx_coal_pkt
   o dev.vge.%d.tx_coal_pkt

r200676:
  Document more VIA Velocity family controllers to vge(4). Previously
  it mentioned only VT6122. While I'm here remove the mention of
  VT3119 which seems to be VIA's internal model name and VT3119
  wouldn't be available to end users.

  Reviewed by:  brueffer
2010-01-09 00:39:32 +00:00
Pyun YongHyeon 09b95924d2 MFC r200696,200740,200756,200758-200759,200972
r200696:
  Add rudimentary WOL support. While I'm here remove enabling
  busmastering/memory address in resume path. Bus driver will handle
  that.

r200740:
  Swap VGE_TXQTIMER and VGE_RXQTIMER register definition. Pending
  timer for Tx queue is at 0x3E.

r200756:
  Correct fragment bit definition in comments.

r200758:
  VT6130 datasheet was wrong. If VT6130 receive a jumbo frame the
  controller will split the jumbo frame into multiple RX buffers.
  However it seems the hardware always dma the frame to 8 bytes
  boundary for the split frames. Only the first part of the fragment
  can have 4 byte alignment and subsequent buffers should be 8 bytes
  aligned. Change RX buffer the alignment requirement to 8 bytes from
  4 bytes.

r200759:
  Disable jumbo frame support for PCIe VT6130/VT6132 controllers.
  Quite contrary to VT6130 datasheet which says it supports up to 8K
  jumbo frame, VT6130 does not seem to send jumbo frame that is
  larger than 4K in length. Trying to send a frame that is larger
  than 4K cause TX MAC hang.
  Even though it's possible to allow 4K jumbo frame for VT6130, I
  think it's meaningless to allow 4K jumbo frame. I'm not sure VT6132
  also has the same limitation but I guess it uses the same MAC of
  VT6130.

r200972:
  Remove wrong assertion.
2010-01-09 00:29:04 +00:00
Christian Brueffer d5908b8e4e MFC: r201397
Add one more supported controller.
2010-01-09 00:28:05 +00:00
Pyun YongHyeon 34da75d79b MFC r200638:
Implement interrupt moderation scheme supported by VT61xx
  controllers. TX/RX interrupt mitigation is controlled by
  VGE_TXSUPPTHR and VGE_RXSUPPTHR register. These registers suppress
  generation of interrupts until the programmed frames counter equals
  to the registers. VT61xx also supports interrupt hold off timer
  register. If this interrupt hold off timer is active all interrupts
  would be disabled until the timer reaches to 0. The timer value is
  reloaded whenever VGE_ISR register written. The timer resolution is
  about 20us.

  Previously vge(4) used single shot timer to reduce Tx completion
  interrupts. This required VGE_CRS1 register access in Tx
  start/completion handler to rearm new timeout value and it did not
  show satisfactory result(more than 50k interrupts under load). Rx
  interrupts was not moderated at all such that vge(4) used to
  generate too many interrupts which in turn made polling(4) better
  approach under high network load.

  This change activates all interrupt moderation mechanism and
  initial values were tuned to generate interrupt less than 8k per
  second. That number of interrupts wouldn't add additional packet
  latencies compared to polling(4). These interrupt parameters could
  be changed with sysctl.
  dev.vge.%d.int_holdoff
  dev.vge.%d.rx_coal_pkt
  dev.vge.%d.tx_coal_pkt
  Interface has be brought down and up again before change take
  effect.

  With interrupt moderation there is no more need to loop in
  interrupt handler. This loop always added one more register access.
  While I'm here remove dead code which tried to implement subset of
  interrupt moderation.
2010-01-09 00:20:33 +00:00
Pyun YongHyeon 46b893a633 MFC r200616-200617,200635,200639,200644
r200616:
  Add new flag VGE_FLAG_SUSPENDED to mark suspended state and
  remove suspended member in softc.

r200617:
  Add "Velocity" to probe message which will make it clearer which
  ethernet controller was recognized. VIA consistently calls
  "Velocity" family for gigabit ethernet controllers. For fast
  ethernet controllers they uses "Rhine" family(vr(4) controllers))
  and vr(4) already shows "Rhine" in probe message.

r200635:
  Remove unused VGE_ETHER_ALIGN definition.

r200639:
  Actually clear interrupts. Writing 0 has no effect.

r200644:
  Remove unused member variable of softc.
2010-01-09 00:14:50 +00:00
Pyun YongHyeon 27785c7520 MFC 200615:
Add hardware MAC statistics support. This statistics could be
  extracted from dev.vge.%d.stats sysctl node.
2010-01-09 00:08:15 +00:00
Pyun YongHyeon 3a6096d639 MFC r200551-200552,200555,200558,200609,200613
r200551:
  Whenever link state change interrupt is raised, vge_tick() is
  called and vge(4) used to drive auto-negotiation timer(mii_tick) in
  vge_tick(). Therefore the mii_tick was not called for every hz such
  that auto-negotiation complete was never handled in vge(4).
  Use mii_pollstat to extract current negotiated speed/duplex instead
  of mii_tick. The latter is valid only for auto-negotiation case.
  While I'm here change the confusing function name vge_tick() to
  vge_link_statchg().

r200552:
  Report media change result to caller instead of returning success
  without regard to the result.

r200555:
  Don't report current link status if interface is not UP.
  If interface is not UP, the current link status wouldn't
  reflect the negotiated status.

r200558:
  Tell upper layer vge(4) supports long frames. This should be done
  after ether_ifattach(), as ether_ifattach() initializes it with
  ETHER_HDR_LEN.
  While I'm here remove setting if_mtu, it's already handled in
  ether_ifattach().

r200609:
  All vge(4) controllers support RX/TX checksum offloading for VLAN
  tagged frames so add checksum offloading capabilities. Also add
  missing VLAN hardware tagging control in ioctl handler and let
  upper stack know current VLAN capabilities.

r200613:
  Rewrite RX filter setup and simplify code.
  Now promiscuous mode and multicast handling is performed in single
  function, vge_rxfilter().
2010-01-09 00:05:02 +00:00
Pyun YongHyeon e885a05b01 MFC r200538,200540-200541,200543,200545,200548
r200538:
  Introduce vge_flags member in softc. The vge_flags member will
  record device specific bits. Remove vge_link and use vge_flags.
  While here, move clearing link state before mii_mediachg() as
  mii_mediachg() may affect link state.

r200540:
  Save PHY address by reading VGE_MIICFG register. For PCIe
  controllers(VT613x), we assume the PHY address is 1.
  Use the saved PHY address in MII register access routines and
  remove accessing VGE_MIICFG register.
  While I'm here save PCI express capability register which will be
  used in near future.

r200541:
  Add MSI support for VT613x controllers.

r200543:
  Increase output queue size from 64 to 255.

r200545:
  We don't have to reload EEPROM in vge_reset(). Because vge_reset()
  is called in vge_init_lock(), vge(4) always used to reload EEPROM.
  Also add more comment why vge(4) clears VGE_CHIPCFG0_PACPI bit.
  While I'm here add missing new line in vge_reset().

r200548:
  Sort function prototyes.
2010-01-08 22:28:54 +00:00
Pyun YongHyeon fd2b050968 MFC r200526-200527,200529,200531-200533,200536
r200526:
  Use PCIR_BAR instead of hard-coded value.

r200527:
  Fix typo in register definition.

r200529:
  Clear VGE_TXDESC_Q bit for transmitted frames. The VGE_TXDESC_Q bit
  seems to work like a tag that indicates 'not list end' of queued
  frames. Without having a VGE_TXDESC_Q bit indicates 'list end'. So
  the last frame of multiple queued frames has no VGE_TXDESC_Q bit.
  The hardware has peculiar behavior for VGE_TXDESC_Q bit handling.
  If the VGE_TXDESC_Q bit of descriptor was set the controller would
  fetch next descriptor. However if next descriptor's OWN bit was
  cleared but VGE_TXDESC_Q was set, it could confuse controller.
  Clearing VGE_TXDESC_Q bit for transmitted frames ensure correct
  behavior.

r200531:
  Use ANSI function definations.

r200532:
  Remove unnecessary return statement.

r200533:
  s/u_intXX_t/uintXX_t/g

r200536:
  style(9).
2010-01-08 22:18:15 +00:00
Brooks Davis 752f1215ca MFC r201352
If a filter has already been added, actually return EEXIST when trying
  at add it again.
2010-01-08 22:13:15 +00:00
Pyun YongHyeon 18b222323c MFC r200525:
Overhaul bus_dma(9) usage and fix various things.
   o Separate TX/RX buffer DMA tag from TX/RX descriptor ring DMA tag.
   o Separate RX buffer DMA tag from common buffer DMA tag. RX DMA
     tag has different restriction compared to TX DMA tag.
   o Add 40bit DMA address support.
   o Adjust TX/RX descriptor ring alignment to 64 bytes from 256
     bytes as documented in datasheet.
   o Added check to ensure TX/RX ring reside within a 4GB boundary.
     Since TX/RX ring shares the same high address register they
     should have the same high address.
   o TX/RX side bus_dmamap_load_mbuf_sg(9) support.
   o Add lock assertion to vge_setmulti().
   o Add RX spare DMA map to recover from DMA map load failure.
   o Add optimized RX buffer handler, vge_discard_rxbuf which is
     activated when vge(4) sees bad frames.
   o Don't blindly update VGE_RXDESC_RESIDUECNT register. Datasheet
     says the register should be updated only when number of
     available RX descriptors are multiple of 4.
   o Use __NO_STRICT_ALIGNMENT instead of defining VGE_FIXUP_RX which
     is only set for i386 architecture. Previously vge(4) also
     performed expensive copy operation to align IP header on amd64.
     This change should give RX performance boost on amd64
     architecture.
   o Don't reinitialize controller if driver is already running. This
     should reduce number of link state flipping.
   o Since vge(4) drops a driver lock before passing received frame
     to upper layer, make sure vge(4) is still running after
     re-acquiring driver lock.
   o Add second argument count to vge_rxeof(). The argument will
     limit number of packets could be processed in RX handler.
   o Rearrange vge_rxeof() not to allocate RX buffer if received
     frame was bad packet.
   o Removed if_printf that prints DMA map failure. This type of
     message shouldn't be used in fast path of driver.
   o Reduce number of allowed TX buffer fragments to 6 from 7. A TX
     descriptor allows 7 fragments of a frame. However the CMZ field
     of descriptor has just 3bits and the controller wants to see
     fragment + 1 in the field. So if we have 7 fragments the field
     value would be 0 which seems to cause unexpected results under
     certain conditions. This change should fix occasional TX hang
     observed on vge(4).
   o Simplify vge_stat_locked() and add number of available TX
     descriptor check.
   o vge(4) controllers lack padding short frames. Make sure to fill
     zero for the padded bytes. This closes unintended information
     disclosure.
   o Don't set VGE_TDCTL_JUMBO flag. Datasheet is not clear whether
     this bit should be set by driver or write-back status bit after
     transmission. At least vendor's driver does not set this bit so
     remove it. Without this bit vge(4) still can send jumbo frames.
   o Don't start driver when vge(4) know there are not enough RX
     buffers.
   o Remove volatile keyword in RX descriptor structure. This should
     be handled by bus_dma(9).
   o Collapse two 16bits member of TX/RX descriptor into single 32bits
     member.
   o Reduce number of RX descriptors to 252 from 256. The
     VGE_RXDESCNUM is 16bits register but only lower 8bits are valid.
     So the maximum number of RX descriptors would be 255. However
     the number of should be multiple of 4 as controller wants to
     update 4 RX descriptors at a time. This limits the maximum
     number of RX descriptor to be 252.

PR:	kern/141276, kern/141414
2010-01-08 21:55:44 +00:00
Pyun YongHyeon 7c21210997 MFC r200519-200522
r200519:
  Remove register keyword.

r200520:
  Prefer device_printf(9) to printf(9).

r200521:
  Fix spelling in comment.

r200522:
  Prefer bus_alloc_resource_any(9) to bus_alloc_resource(9).
2010-01-08 21:27:35 +00:00
Pyun YongHyeon 59a78f5c44 MFC r198987,199414,199543,200422
Partial merge r198987:
  Use device_printf() and if_printf() instead of printf() with an explicit
  unit number and remove 'unit' members from softc.

Partial merge r199414:
  Use the bus_*() routines rather than bus_space_*() for register operations.

r199543:
  Several fixes to this driver:
  - Overhaul the locking to avoid recursion and add missing locking in a few
    places.
  - Don't schedule a task to call vge_start() from contexts that are safe to
    call vge_start() directly.  Just invoke the routine directly instead
    (this is what all of the other NIC drivers I am familiar with do).  Note
    that vge(4) does not use an interrupt filter handler which is the primary
    reason some other drivers use tasks.
  - Add a new private timer to drive the watchdog timer instead of using
    if_watchdog and if_timer.
  - Fixup detach by calling ether_ifdetach() before stopping the interface.

r200422:
  Remove driver lock assertion in MII register access. This change
  was made in r199543 to remove MTX_RECURSE. These routines can be
  called in device attach phase(e.g. mii_phy_probe()) so checking
  assertion here is not right as caller does not hold a driver lock.
2010-01-08 21:19:41 +00:00
Jilles Tjoelker 1757a33c3c MFC r201354: sh(1): Correct two places where "$@" lacked necessary quotes. 2010-01-08 16:28:17 +00:00
Alexander Leidinger d6bd54ec01 MFC
r197514:
---snip---
    On lookup error VFS expects *vpp to be set to NULL, be sure to do that.
---snip---

r197816:
---snip---
    Prevent paging pressure from draining arc too much
    - always drain arc if above arc_c_max - never drain arc if arc is below
      arc_c_max
---snip---
2010-01-08 11:06:13 +00:00
Gavin Atkinson 8ebb1029bb MFC r200994:
Set the locally-assigned bit in the randomly generated Ethernet address
  if we end up having to generate one.

PR:		kern/133239
Discussed with:	yongari
Approved by:	ed (mentor, implicit)
2010-01-08 10:14:27 +00:00
Antoine Brodin 6efd136525 MFC r200129 to stable/7:
Remove trailing ";" in UMA_HASH_INSERT and UMA_HASH_REMOVE macros.
2010-01-07 19:40:11 +00:00
Alexander Leidinger 75bd17e96c Diff reduction to 8-stable:
- whitespace
 - fix harmless mismerges
   - comments or (harmless) code which was there twice
 - fix not so harmless mismerges (mem leak - double mtx_init)

MFC r197842: whitespace fix
2010-01-07 13:42:28 +00:00
Konstantin Belousov 0e7939af68 MFC r201504:
PG_NOSYNC is called VPO_NOSYNC for long time.
2010-01-07 11:54:36 +00:00
Alexander Motin c2b653be8a MFC r196837:
Remove artificial MAX_IO_SIZE constant, equal to DFLTPHYS * 2. Use MAXPHYS
instead. It is NULL change for GENERIC kernel, but allows 'fast' mode to
work on systems with increased MAXPHYS.
2010-01-07 09:45:17 +00:00
Alexander Leidinger ffad4ecfda MFC several ZFS related commits:
r197459:
---snip---
    Before calling vflush(FORCECLOSE) mark file system as unmounted so the
    following vnops will fail. This is very important, because without this change
    vnode could be reclaimed at any point, even if we increased usecount. The only
    way to ensure that vnode won't be reclaimed was to lock it, which would be very
    hard to do in ZFS without changing a lot of code. With this change simply
    increasing usecount is enough to be sure vnode won't be reclaimed from under
    us. To be precise it can still be reclaimed but we won't be able to see it,
    because every try to enter ZFS through VFS will result in EIO.

    The only function that cannot return EIO, because it is needed for vflush() is
    zfs_root(). Introduce ZFS_ENTER_NOERROR() macro that only locks
    z_teardown_lock and never returns EIO.
---snip---

r197512:
---snip---
    - Don't depend on value returned by gfs_*_inactive(), it doesn't work
      well with forced unmounts when GFS vnodes are referenced.
    - Make other preparations to GFS for forced unmounts.

    PR:			kern/139062
    Reported by:	trasz
---snip---

r197513:
---snip---
    Use traverse() function to find and return mount point's vnode instead of
cov    ered vnode when snapshot is already mounted.
---snip---

r197513:
---snip---
    Handle cases where virtual (GFS) vnodes are referenced when doing forced
    unmount. In that case we cannot depend on the proper order of invalidating
    vnodes, so we have to free resources when we have a chance.

    PR:			kern/139062
    Reported by:	trasz
---snip---

r197683:
---snip---
    Return EOPNOTSUPP instead of EINVAL when doing chflags(2) over an old
    format ZFS, as defined in the manual page.

    Submitted by:	pjd (response of my original patch but bugs are mine)
---snip---

r198703:
---snip---
    - zfs_zaccess() can handle VAPPEND too, so map V_APPEND to VAPPEND and call
      zfs_access() instead of vaccess() in this case as well.
    - If VADMIN is specified with another V* flag (unlikely) call both
      zfs_access() and vaccess() after spliting V* flags.

    This fixes "dirtying snapshot!" panic.

    PR:				kern/139806
    Reported by:		Carl Chave <[email protected]>
    In co-operation with:	jh
---snip---
While I'm here: fix two comments regarding the members of vop_access_args
to comply what is in RELENG_7.

r199156:
---snip---
    Avoid passing invalid mountpoint to getnewvnode().

    Reported by:	rwatson
    Tested by:	rwatson
---snip---

r200724:
---snip---
    Apply fix Solaris bug 6462803 zfs snapshot -r failed because
    filesystem was busy. (onnv-gate revision 8989)

    Submitted by:	mm
    Approved by:	pjd
---snip---

r200726:
---snip---
    Apply fix for Solaris bug 6801979: zfs recv can fail with E2BIG
    (onnv revision 8986)

    Requested by:	mm
    Submitted by:	pjd
    Obtained from:	OpenSolaris
---snip---

r200727 (following is the corrected commit log):
---snip---
    Apply fix for Solaris bug 6764159: restore_object() makes a call
    that can block while having a tx open but not yet committed
    (onnv revision 7994)

    Submitted by:	mm
    Obtained from:	OpenSolaris
---snip---
2010-01-07 09:37:59 +00:00
Alexander Motin 9a312a094b MFC r200668:
Remove duplicate devstat_start_transaction_bio() call. It is already called
from geom_disk. Dulicate call causes wrong queue depth and busy accounting.
2010-01-07 09:21:13 +00:00
Alexander Motin eb313124e9 MFC rev. 198487:
Round timeout up when converting CAM milliseconds to ATA seconds.
2010-01-07 09:07:51 +00:00
Alexander Motin f80db2077a MFC r200353:
Limit maximum I/O size, depending on command set supported by device.
It is required to suppot non-LBA48 devices with MAXPHYS above 128K.
2010-01-07 09:02:30 +00:00
Xin LI 5bf72481a3 MFC r176575:
In pass1(), cap inosused to fs_ipg rather than allowing arbitrary
number read from cylinder group.  Chances that we read a smarshed
cylinder group, and we can not 100% trust information it has
supplied.  fsck_ffs(8) will crash otherwise for some cases.

PR:		bin/138043
Reminded by:	mckusick
2010-01-07 01:55:34 +00:00
Pyun YongHyeon e287761a33 MFC r200088,200227-200228,200246,200264,201446
r200088:
  Add workaround to overcome hardware limitation which allows only a
  single outstanding DMA read operation. Most controllers targeted to
  client with PCIe bus interface(e.g. BCM5761) may have this
  limitation. All controllers for servers does not have this
  limitation.
  Collapsing mbuf chains to reduce number of memory reads before
  transmitting was most effective way to workaround this. I got about
  940Mbps from 850Mbps with mbuf collapsing on BCM5761. However it
  takes a lot of CPU cycles to collapse mbuf chains so add tunable to
  control the number of allowed TX buffers before collapsing. The
  default value is 0 which effectively disables the forced collapsing.
  For most cases 2 would yield best performance(about 930Mbps)
  without much sacrificing CPU cycles.
  Note the collapsing is only activated when the controller is on
  PCIe bus and the frame does not need TSO operation. TSO does not
  seem to suffer from the hardware limitation because the payload
  size is much bigger than normal IP datagram.
  Thanks to davidch@ who told me the limitation of client controllers
  and actually gave possible workarounds to mitigate the limitation.

r200227:
  Remove PHY isolate/power down code in bge_stop(). The isolation
  handler in brgphy(4) does not exist and brgphy(4) just resets the
  PHY and returns EINVAL as it has no isolation handler. I also agree
  on Marius's opinion that stop handler of every NIC driver seems to
  be the wrong place for implementing PHY isolate/power down.
  If we need PHY isolate/power down it should be implemented in
  brgphy(4) and users should administratively down the PHY.

r200228:
  Don't access jumbo frame related registers if controller lacks the
  feature. These registers are reserved on controllers that have no
  support for jumbo frame.
  Only BCM5700 has mini ring so do not poke mini ring related
  registers if controller is not BCM5700.

r200246:
  Partially revert r200228. For mini RCB case, bge(4) still have to
  disable mini ring withtout regard to mini ring support.

r200264:
  Create sysctl node(dev.bge.%d.focred_collapse) instead of
  hw.bge.forced_collapse. hw.bge.forced_collapse affects all bge(4)
  controllers on system which may not desirable behavior of the
  sysctl node. Also allow the sysctl node could be modified at any
  time.

r201446:
  Fix regression introduced in r198318. BCM5754/BCM5754M uses the
  same ASIC ID of BCM5758 such that r198318 incorecctly enabled TSO
  on BCM5754.BCM5754M controllers. BCM5754/BCM5754M needs a special
  firmware to enable TSO and bge(4) does not support firmware based
  TSO.
2010-01-07 00:57:40 +00:00
Pyun YongHyeon 2e3940c4f3 MFC r199670-199671,199674,199679,199761,199807-199808
r199670:
  Fix two long standing bugs on bge(4). Most pre BCM5755 controllers
  have a DMA bug when buffer address crosses a multiple of the 4GB
  boundary(e.g. 4GB, 8GB, 12GB etc). Limit DMA address to be within
  4GB address for these controllers. The second DMA bug limits DMA
  address to be within 40bit address space. This bug applies to
  BCM5714 and BCM5715 and 5708(bce(4) controller). This is not
  actually a MAC controller bug but an issue with the embedded PCIe
  to PCI-X bridge in the device. So for BCM5714/BCM5715 controllers
  also limit the DMA address to be within 40bit address space.
  Special thanks to davidch@ who gave me detailed errata information.
  I think this change will fix long standing bge(4) instability
  issues on systems with more than 4GB memory.

r199671:
  Implement TSO for BCM5755 or newer controllers. Some controllers
  seem to require a special firmware to use TSO. But the firmware is
  not available to FreeBSD and Linux claims that the TSO performed by
  the firmware is slower than hardware based TSO. Moreover the
  firmware based TSO has one known bug which can't handle TSO if
  ethernet header + IP/TCP header is greater than 80 bytes. The
  workaround for the TSO bug exist but it seems it's too expensive
  than not using TSO at all. Some hardwares also have the TSO bug so
  limit the TSO to the controllers that are not affected TSO issues
  (e.g. 5755 or higher).
  While I'm here set VLAN tag bit to all descriptors that belengs to
  a frame instead of the first descriptor of a frame. The datasheet
  is not clear how to handle VLAN tag bit but it worked either way in
  my testing. This makes it simplify TSO configuration a little bit.

  Big thanks to davidch@ who sent me detailed TSO information.
  Without this I was not able to implement it.

r199674:
  Add missing function prototype in r199671.

r199679:
  Reduce status block size DMAed by controller. bge(4) uses single
  Tx/Rx/Rx return ring such that large part of status block was not
  used at all. All bge(4) controllers except BCM5700 AX/BX has a
  feature to control the size of status block. So use minimum status
  block size allowed in controller. This reduces number of DMAed
  status block size to 32 bytes from 80 bytes.

r199761:
  BGE_FLAG_40BIT_BUG should be set before creating DMA tags.

r199807:
  Make sure one shot MSI is enabled.

r199808:
  Fix typo which inversed the logic which in turn disabled MSI.
2010-01-07 00:48:10 +00:00
Pyun YongHyeon 58a441542f MFC r199667-199668
r199667:
  Cache Rx producer/Tx consumer index as soon as we know status block
  update and then clear status block. Previously it used to access
  these index without synchronization which may cause problems when
  bounce buffers are used. Also add missing bus_dmamap_sync(9) in
  polling handler. Since we now update status block in driver, adjust
  bus_dmamap_sync(9) for status block.

r199668:
  For MSI case, interrupt is not shared and we don't need to force
  PCI flush to get correct status block update. Add an optimized
  interrupt handler that is activated for MSI case. Actual interrupt
  handling is done by taskqueue such that the handler does not
  require driver lock for Rx path. The MSI capable bge(4) controllers
  automatically disables further interrupt once it enters interrupt
  state so we don't need PIO access to disable interrupt in interrupt
  handler.
2010-01-07 00:04:29 +00:00
Pyun YongHyeon b84af6cf24 MFC r196370:
- Do not try to reevaluate current RX production index on each
    loop iteration as it can be updated by the card while we
    process the RX ring forcing us to process RX descriptors
    for which DMA synchronisation operation has not been
    performed.  This fixes the bug when bge(4) drops packets
    under high load.
2010-01-06 23:57:17 +00:00
Pyun YongHyeon 7f2795b61a MFC 199663-199666
r199663:
  Due to newly added PCIe capabilities fallback code for finding the
  PCIe capability did not work right on recent controllers. Remove
  FreeBSD 6.x support code.

r199664:
  Use capability pointer to access PCIe registers rather than
  directly access them at fixed address. While I'm here don't touch
  other bits of PCIe device control register except max payload size.

r199665:
  Controller does not write Rx descriptors, remove BUS_DMASYNC_PREREAD.

r199666:
  Rearrange bge_start_locked to see we can send more frames by
  checking IFF_DRV_RUNNING and IFF_DRV_OACTIVE flags. Also if we
  have less than 16 free send BDs set IFF_DRV_OACTIVE and try it
  later. Previously bge(4) used to reserve 16 free send BDs after
  loading dma maps but hardware just need one reserved send BD. If
  prouder index has the same value of consumer index it means the Tx
  queue is empty.
  While I'm here check IFQ_DRV_IS_EMPTY first to save one lock
  operation.
2010-01-06 23:37:13 +00:00
Pyun YongHyeon b0dff81439 MFC r199065,199115-199116,199153,199661-199662
r199065:
  Correct disabling checksum offloading for BCM5700 B0.

r199115:
  Add missing bus_dmamap_sync(9) before issuing kick command.

r199116:
  Zero out Tx/Rx descriptors before using them. Also add missing
  bus_dmamap_sync(9) after Tx descriptor initialization.

r199153:
  Controller does not update Tx descriptors(send BDs) after sending
  frames so remove unnecessary BUS_DMASYNC_PREREAD and
  BUS_DMASYNC_POSTREAD of bus_dmamap_sync(9).

r199661:
  Remove extra white space.

r199662:
  Fix typo introduced in r199011.
2010-01-06 23:28:39 +00:00
Pyun YongHyeon f51db9a41a MFC r198967,199009-199011,199014,199020,199035-199036,199054
r198967:
  Correct MSI mode register bits.

r199009:
  bge(4) already switched to use UMA backed page allocator and local
  memory allocator for jumbo frame was removed long time ago. Remove
  no more used macros.

r199010:
  Do bus_dmamap_sync call only if frame size is greater than
  standard buffer size. If controller is not capable of handling
  jumbo frame, interface MTU couldn't be larger than standard MTU
  which in turn the received should be fit in standard buffer. This
  fixes bus_dmamap_sync call for jumbo ring is called even if
  interface is configured to use standard MTU.
  Also if total frame size could be fit into standard buffer don't
  use jumbo buffers.

r199011:
  Reimplement Rx buffer allocation to handle dma map load failure.
  Introduce two spare dma maps for standard buffer and jumbo buffer
  respectively. If loading a dma map failed reuse previously loaded
  dma map. This should fix unloaded dma map is used in case of dma
  map load failure. Also don't blindly unload dma map and defer
  dma map sync and unloading operation until we know dma map for new
  buffer is successfully loaded. This change saves unnecessary dma
  load/unload operation. Previously bge(4) tried to reuse mbuf
  with unloaded dma map which is really bad thing in bus_dma(9)
  perspective.
  While I'm here update if_iqdrops if we can't allocate Rx buffers.

r199014:
  Fix I mssied in r199011. Rx ring index also should be updated.
  If we fill Rx ring full instead of half we can simplify this logic
  but this requires more experimentation.

r199020:
  Tell upper layer we support long frames. ether_ifattach()
  initializes it to ETHER_HDR_LEN so we have to override it after
  calling ether_ifattch().
  While I'm here remove setting if_mtu value, it's initialized in
  ether_ifattach().

r199035:
  Don't count input errors twice, we always read input errors from
  MAC in bge_tick. Previously it used to show more number of input
  errors. I noticed actual input errors were less than 8% even for
  64 bytes UDP frames generated by netperf.
  Since we always access BGE_RXLP_LOCSTAT_IFIN_DROPS register in
  bge_tick, remove useless code protected by #ifdef notyet.

r199036:
  Count number of inbound packets which were chosen to be discarded
  as input errors. Also count out of receive BDs as input errors.

r199054:
  Partially revert r199035.
  Revision 1.158 says only lower ten bits of
  BGE_RXLP_LOCSTAT_IFIN_DROPS register is valid. For BCM5761 case it
  seems the controller maintains 16bits value for the register.
  However 16bits are still too small to count all dropped packets
  happened in a second. To get a correct counter we have to read the
  register in bge_rxeof() which would be too expensive.
2010-01-06 23:15:07 +00:00
Pyun YongHyeon 353632879f MFC r198923-198924,198927-198928
r198923:
  Use correct dma tag for jumbo buffer.

r198924:
  Covert bge_newbuf_std to use bus_dmamap_load_mbuf_sg(9). Note,
  bge_newbuf_std still has a bug for handling dma map load failure
  under high network load. Just reusing mbuf is not enough as driver
  already unloaded the dma map of the mbuf. Graceful recovery needs
  more work.
  Ideally we can just update dma address part of a Rx descriptor
  because the controller never overwrite the Rx descriptor. This
  requires some Rx initialization code changes and it would be done
  later after fixing other incorrect bus_dma(9) usages.

r198927:
  Remove common DMA tag used for TX/RX mbufs and create Tx DMA tag
  and Rx DMA tag separately. Previously it used a common mbuf DMA tag
  for both Tx and Rx path but Rx buffer(standard ring case) should
  have a single DMA segment and maximum buffer size of the segment
  should be less than or equal to MCLBYTES. This change also make it
  possible to add TSO with minor changes.

r198928:
  Make bge_newbuf_std()/bge_newbuf_jumbo() returns actual error code
  for buffer allocation. If driver know we are out of Rx buffers let
  controller stop. This should fix panic when interface is run even
  if it had no configured Rx buffers.
2010-01-06 22:49:10 +00:00
Simon L. B. Nielsen 0173dfc741 Fix BIND named(8) cache poisoning with DNSSEC validation.
[SA-10:01]

Fix ntpd mode 7 denial of service. [SA-10:02]

Fix ZFS ZIL playback with insecure permissions. [SA-10:03]

Various FreeBSD 8.0-RELEASE improvements. [EN-10:01]

Security:	FreeBSD-SA-10:01.bind
Security:	FreeBSD-SA-10:02.ntpd
Security:	FreeBSD-SA-10:03.zfs
Errata:		FreeBSD-EN-10:01.freebsd
Approved by:	so (simon)
2010-01-06 21:45:30 +00:00
Jung-uk Kim faf457c84d MFC: r200251
- Try pre-allocating all FIBs upfront.  Previously we tried pre-allocating
128 FIBs first and allocated more later if necessary.  Remove now unused
definitions from the header file.
- Force sequential bus scanning.  It seems parallel scanning is in fact
slower and causes more harm than good.  Adjust a comment to reflect that.
2010-01-06 20:51:04 +00:00
Gavin Atkinson f93285f7d6 MFC r200820:
Support the tablet in (at least) the Toshiba Portege M200 Tablet PC.
  This device only appears on the ACPI bus, so isn't caught by the current
  entry for it in the uart(4) ISA attachment.

PR:		kern/140172
Reviewed by:	jhb, marcel
Approved by:	ed (mentor, implicit)
2010-01-06 20:41:12 +00:00
Bjoern A. Zeeb 55fcd44240 MFC r184721:
Adopt the comment for tcp_maxmtu(); we are returning a number
  not a pointer. While here update the rest of the comment to
  better match what we have these days.
2010-01-06 16:56:31 +00:00
Bjoern A. Zeeb d019828e45 MFC r184731:
Fix typo and while here another one.

  Reviewed by:	keramida
  Reported by:	keramida
2010-01-06 16:53:57 +00:00
Bjoern A. Zeeb 9124002a6a MFC r184722:
Fix a bug introduced with r182851 (r201653 in stable/7) splitting
  tcp_mss() into tcp_mss() and tcp_mss_update() so that tcp_mtudisc()
  could re-use the same code.

  Move the TSO logic back to tcp_mss() and out of tcp_mss_update().
  We tried to avoid that initially but if were are called from
  tcp_output() with EMSGSIZE, we cleared the TSO flag on the tcpcb
  there, called into tcp_mtudisc() and tcp_mss_update() which
  then would reenable TSO on the tcpcb based on TSO capabilities
  of the interface as learnt in tcp_maxmtu/6().
  So if TSO was enabled on the (possibly new) outgoing interface
  it was turned back on, which lead to an endless loop between
  tcp_output() and tcp_mtudisc() until we overflew the stack.

  Reported by:	kmacy
2010-01-06 16:51:57 +00:00
Bjoern A. Zeeb e932cea80a MFC r184720:
Fix a bug introduced with r182851 (r201653 in stable/7) splitting
  tcp_mss() into tcp_mss() and tcp_mss_update() so that tcp_mtudisc()
  could re-use the same code.

  In case we return early and got a metricptr to pass the hostcache
  info back to the caller we need to initialize the data to a defined
  state (zero it) as tcp_hc_get() would do if there was no hit.
  Without that the caller would check on random stack garbage which
  could lead to undefined results.

  This only affected tcp_mss() if there was no routing entry for the peer,
  tcp_mtudisc() was not affected.
2010-01-06 16:48:59 +00:00
Bjoern A. Zeeb 684a1497e2 MFC r182851:
Split tcp_mss() in tcp_mss() and tcp_mss_update() where the former
  calls the latter.

  Merge tcp_mss_update() with code from tcp_mtudisc() basically
  doing the same thing.

  This gives us one central place where we calcuate and check mss values
  to update t_maxopd (maximum mss + options length) instead of two slightly
  different but almost equal implementations to maintain.
2010-01-06 16:43:09 +00:00
Bjoern A. Zeeb 4d2f9b9097 MFC 182846:
Convert SYSCTL_INTs for tcp_mssdflt and tcp_v6mssdflt to
  SYSCTL_PROCs and check that the default mss for neither v4 nor
  v6 goes below the minimum MSS constant (216).

  This prevents people from shooting themselves in the foot.
2010-01-06 16:39:16 +00:00
Alexander Leidinger 8e7dae6131 MFC several ZFS related commits:
r196980:
---snip---
    When we automatically mount snapshot we want to return vnode of the mount point
    from the lookup and not covered vnode. This is one of the fixes for using .zfs/
    over NFS.
---snip---

r196982:
---snip---
    We don't export individual snapshots, so mnt_export field in snapshot's
    mount point is NULL. That's why when we try to access snapshots over NFS
    use mnt_export field from the parent file system.
---snip---

r197131:
---snip---
    Tighten up the check for race in zfs_zget() - ZTOV(zp) can not only contain
    NULL, but also can point to dead vnode, take that into account.

    PR:				kern/132068
    Reported by:		Edward Fisk" <[email protected]>, kris
    Fix based on patch from:	Jaakko Heinonen <[email protected]>
---snip---

r197133:
---snip---
    - Protect reclaim with z_teardown_inactive_lock.
    - Be prepared for dbuf to disappear in zfs_reclaim_complete() and check if
      z_dbuf field is NULL - this might happen in case of rollback or forced
      unmount between zfs_freebsd_reclaim() and zfs_reclaim_complete().
    - On forced unmount wait for all znodes to be destroyed - destruction can be
      done asynchronously via zfs_reclaim_complete().
---snip---

r197153:
---snip---
    When zfs.ko is compiled with debug, make sure that znode and vnode point at
    each other.
---snip---

r197167:
---snip---
    Work-around READDIRPLUS problem with .zfs/ and .zfs/snapshot/ directories
    by just returning EOPNOTSUPP. This will allow NFS server to fall back to
    regular READDIR.

    Note that converting inode number to snapshot's vnode is expensive operation.
    Snapshots are stored in AVL tree, but based on their names, not inode numbers,
    so to convert inode to snapshot vnode we have to interate over all snalshots.

    This is not a problem in OpenSolaris, because in their READDIRPLUS
    implementation they use VOP_LOOKUP() on d_name, instead of VFS_VGET() on
    d_fileno as we do.

    PR:			kern/125149
    Reported by:	Weldon Godfrey <[email protected]>
    Analysis by:	Jaakko Heinonen <[email protected]>
---snip---

r197177:
---snip---
    Support both case: when snapshot is already mounted and when it is not yet
    mounted.
---snip---

r197201:
---snip---
    - Mount ZFS snapshots with MNT_IGNORE flag, so they are not visible in regular
      df(1) and mount(8) output. This is a bit smilar to OpenSolaris and follows
      ZFS route of not listing snapshots by default with 'zfs list' command.
    - Add UPDATING entry to note that ZFS snapshots are no longer visible in
      mount(8) and df(1) output by default.

    Reviewed by:	kib
---snip---
Note: the MNT_IGNORE part is commented out in this commit and the UPDATING
entry is not merged, as this would be a POLA violation on a stable branch.
This revision is included here, as it also makes locking changes and makes
sure that a snapshot is mounted RO.

r197426:
---snip---
    Restore BSD behaviour - when creating new directory entry use parent directory
    gid to set group ownership and not process gid.

    This was overlooked during v6 -> v13 switch.

    PR:			kern/139076
    Reported by:	Sean Winn <[email protected]>
---snip---

r197458:
---snip---
    Close race in zfs_zget(). We have to increase usecount first and then
    check for VI_DOOMED flag. Before this change vnode could be reclaimed
    between checking for the flag and increasing usecount.
---snip---
2010-01-06 16:09:58 +00:00
Alexander Leidinger acd98b6927 - Remove doublet creation of the zio_cache which was introduced in the
zpool v13 commit.
- Diff reduction to 8-stable (add an empty line).
2010-01-06 14:14:59 +00:00
Alexander Leidinger a84e9c86db MFC several ZFS related commits:
r196662:
---snip---
    Add missing mountpoint vnode locking.

    This fixes panic on assertion with DEBUG_VFS_LOCKS and vfs.usermount=1 when
    regular user tries to mount dataset owned by him.
---snip---

r196703:
---snip---
    Backport the 'dirtying dbuf' panic fix from newer ZFS version.

    Reported by:	Thomas Backman <[email protected]>
---snip---

r196919:
---snip---
    bzero() on-stack argument, so mutex_init() won't misinterpret that the
    lock is already initialized if we have some garbage on the stack.

    PR:			kern/135480
    Reported by:	Emil Mikulic <[email protected]>
---snip---

r196927:
---snip---
    Changing provider size is not really supported by GEOM, but doing so when
    provider is closed should be ok.

    When administrator requests to change ZVOL size do it immediately if ZVOL
    is closed or do it on last ZVOL close.

    PR:			kern/136942
    Requested by:	Bernard Buri <[email protected]>
---snip---

r196943:
---snip---
    - Avoid holding mutex around M_WAITOK allocations.
    - Add locking for mnt_opt field.
---snip---

r196944:
---snip---
    Don't recheck ownership on update mount. This will eliminate LOR between
    vfs_busy() and mount mutex. We check ownership in vfs_domount() anyway.

    Noticed by:	kib
    Reviewed by:	kib
---snip---

r196954:
---snip---
    If we have to use avl_find(), optimize a bit and use avl_insert() instead of
    avl_add() (the latter is actually a wrapper around avl_find() + avl_insert()).

    Fix similar case in the code that is currently commented out.
---snip---
Note: This also seems to fix a previous merge hickup.

r196965:
---snip---
    Fix reference count leak for a case where snapshot's mount point is updated.
    Such situation is not supported.

    This problem was triggered by something like this:

	# zpool create tank da0
	# zfs snapshot tank@snap
	# cd /tank/.zfs/snapshot/snap  (this will mount the snapshot)
	# cd
	# mount -u nosuid /tank/.zfs/snapshot/snap  (refcount leak)
	# zpool export tank
	cannot export 'tank': pool is busy
---snip---

r196985:
---snip---
    Only log successful commands! Without this fix we log even unsuccessful
    commands executed by unprivileged users. Action is not really taken, but it is
    logged to pool history, which might be confusing.

    Reported by:	Denis Ahrens <[email protected]>
---snip---

r197151:
---snip---
    Be sure not to overflow struct fid.
---snip---

r197152:
---snip---
    Extend scope of the z_teardown_lock lock for consistency and "just in case".
---snip---

r200124:
---snip---
    Avoid using additional variable for storing an error if we are not going
    to do anything with it.
---snip---

r200158:
---snip---
   We have to eventually look for provider without checking guid as this is need
   for attaching when there is no metadata yet.

   Before r200125 the order of looking for providers was wrong. It was:
   1. Find provider by name.
   2. Find provider by guid.
   3. Find provider by name and guid.

   Where it should have been:
   1. Find provider by name and guid.
   2. Find provider by guid.
   3. Find provider by name.
---snip---
Note: This was already there, but it was not recorded as merged. This commit
fixes a mis-merge (reversed logic).
2010-01-06 13:56:49 +00:00
Alexander Leidinger 2f26a7d121 MFC several ZFS related commits:
r196456:
---snip---
    - Give minclsyspri and maxclsyspri real values (consulted with kmacy).
    - Honour 'pri' argument for thread_create().
---snip---

r196457:
---snip---
Set priority of vdev_geom threads and zvol threads to PRIBIO.
---snip---
2010-01-06 10:21:16 +00:00
Ruslan Ermilov 81d90f92a9 MFC r201290: Treat an empty argument as an error, instead of
fetching the contents of the root directory.
2010-01-06 08:26:43 +00:00
Alexander Leidinger e53ea61873 MFC several ZFS related commits:
- taskq changes
 - fixes for race conditions
 - locking fixes
 - bug fixes
 - ...

r185310:
---snip---
    Remove unused variable.

    Found with:	Coverity Prevent(tm)
    CID:	3669,3671
---snip---

r185319:
---snip---
    Fix locking (file descriptor table and Giant around VFS).

    Most submitted by:	kib
    Reviewed by:	kib
---snip---

r192689:
---snip---
    Fix comment.
---snip---

r193110:
---snip---
	work around snapshot shutdown race reported by Henri Hennebert
---snip---

r193440:
---snip---
    Support shared vnode locks for write operations when the offset is
    provided on filesystems that support it.  This really improves mysql
    + innodb performance on ZFS.

    Reviewed by:	jhb, kmacy, jeffr
---snip---
ATTENTION: this commit to releng7 does not allow shared vnode locks
(there are some VFS changes needed before it can be enabled), it only
provides the infrastructure and serves mostly as a diff reduction in
the ZFS code.
A comment has been added to the locking part to explain why no shared
locks are used.

r195627:
---snip---
    In nvpair_native_embedded_array(), meaningless pointers are zeroed.
    The programmer was aware that alignment was not guaranteed in the
    packed structure and used bzero() to NULL out the pointers.
    However, on ia64, the compiler is quite agressive in finding ILP
    and calls to bzero() are often replaced by simple assignments (i.e.
    stores). Especially when the width or size in question corresponds
    with a store instruction (i.e. st1, st2, st4 or st8).

    The problem here is not a compiler bug. The address of the memory
    to zero-out was given by '&packed->nvl_priv' and given the type of
    the 'packed' pointer the compiler could assume proper alignment for
    the replacement of bzero() with an 8-byte wide store to be valid.
    The problem is with the programmer. The programmer knew that the
    address did not have the alignment guarantees needed for a regular
    assignment, but failed to inform the compiler of that fact. In
    fact, the programmer told the compiler the opposite: alignment is
    guaranteed.

    The fix is to avoid using a pointer of type "nvlist_t *" and
    instead use a "char *" pointer as the basis for calculating the
    address. This tells the compiler that only 1-byte alignment can
    be assumed and the compiler will either keep the bzero() call
    or instead replace it with a sequence of byte-wise stores. Both
    are valid.
---snip---

r195822:
---snip---
    Fix extattr_list_file(2) on ZFS in case the attribute directory
    doesn't exist and user doesn't have write access to the file.
    Without this fix, it returns bogus value instead of 0.  For some
    reason this didn't manifest on my kernel compiled with -O0.

    PR:			kern/136601
    Submitted by:	Jaakko Heinonen <jh at saunalahti dot fi>
---snip---

r195909
---snip---
    We don't support ephemeral IDs in FreeBSD and without this fix ZFS can
    panic when in zfs_fuid_create_cred() when userid is negative. It is
    converted to unsigned value which makes IS_EPHEMERAL() macro to
    incorrectly report that this is ephemeral ID. The most reasonable
    solution for now is to always report that the given ID is not ephemeral.

    PR:			kern/132337
    Submitted by:	Matthew West <[email protected]>
    Tested by:		Thomas Backman <[email protected]>, Michael Reifenberger <[email protected]>
---snip---

r196291:
---snip---
    - Fix a race where /dev/zfs control device is created before ZFS is fully
      initialized. Also destroy /dev/zfs before doing other deinitializations.
    - Initialization through taskq is no longer needed and there is a race
      where one of the zpool/zfs command loads zfs.ko and tries to do some work
      immediately, but /dev/zfs is not there yet.

    Reported by:	pav
---snip---

r196269:
---snip---
    Fix misalignment in nvpair_native_embedded() caused by the compiler
    replacing the bzero(). See also revision 195627, which fixed the
    misalignment in nvpair_native_embedded_array().
---snip---

r196295:
---snip---
    Remove OpenSolaris taskq port (it performs very poorly in our kernel) and
    replace it with wrappers around our taskqueue(9).
    To make it possible implement taskqueue_member() function which returns 1
    if the given thread was created by the given taskqueue.
---snip---
The taskqueue_member() function is different due to kproc/kthread changes
in releng8 and head, the function was...
Revieved by:	jhb

r196297:
---snip---
    Fix panic in zfs recv code. The last vnode (mountpoint's vnode) can have
    0 usecount.

    Reported by:	Thomas Backman <[email protected]>
---snip---

r196299:
---snip---
    - We need to recycle vnode instead of freeing znode.

    Submitted by:	avg

    - Add missing vnode interlock unlock.
    - Remove redundant znode locking.
---snip---

r196301:
---snip---
    If z_buf is NULL, we should free znode immediately.

    Noticed by:	avg
---snip---

r196307:
---snip---
    Manage asynchronous vnode release just like Solaris.

    Discussed with:	kmacy
---snip---
2010-01-06 08:18:49 +00:00
John Baldwin e6f721cef9 MFC 201196:
Change vlan interfaces to cope more usefully with the parent interface being
renamed.  Previously the vlan interfaces would lose their configuration as if
the parent interface had been physically removed.  Now vlan interfaces ignore
rename events.
- Add a new ifnet flag (IFF_RENAMING) that is set while an ifnet is being
  renamed.  This flag can be checked in ifnet departure/arrival event
  handlers to treat rename events differently.
- Change the ifnet departure event handler in the if_vlan(4) driver to
  ignore departure events due to a trunk interface being renamed.
2010-01-05 18:26:41 +00:00
Ken Smith c7a2945d42 MFS8 r201529:
Add FreeBSD- to the beginning of the ISO image filenames.
2010-01-05 17:45:39 +00:00
John Baldwin 4f473fa046 MFC 200847:
- Rename the __tcpi_(snd|rcv)_mss fields of the tcp_info structure to remove
  the leading underscores since they are now implemented.
- Implement the tcpi_rto and tcpi_last_data_recv fields in the tcp_info
  structure.
2010-01-05 17:04:39 +00:00
Konstantin Belousov a6f9a3bb37 MFC r201400:
Remove reference to the bug in FreeBSD 2.0.
2010-01-05 12:38:35 +00:00
John Baldwin 5e06318517 MFC 201351:
Use stricter checking to match possible vlan clones by not allowing extra
garbage characters around or within the tag.
2010-01-04 22:45:20 +00:00
Warner Losh 488672ff50 Revert 201164. Truly optional items like this do not belong on DEFAULTS. 2010-01-04 21:45:37 +00:00
Alan Cox cdd4df7bec MFC r197163
Add the FBSD_1.2 namespace.

Discussed with: deischen
2010-01-04 17:28:59 +00:00
Andrew Gallatin f18e5ac54a MFC 200845:
Don't take the driver mutex in mxge_tick(), as it
  is run with the mutex held.
2010-01-04 14:45:31 +00:00
David E. O'Brien 61b12b8ea2 Spell the full word "February".
Submitted by:	[email protected]
2010-01-04 12:32:38 +00:00
Xin LI 934e945533 MFC r201137
Grammar fix.

Submitted by:	Kenyon Ralph <kenyon kenyonralph com>
2010-01-04 01:15:47 +00:00
Xin LI ec3606991b MFC r200794:
Plug a memory leak.

PR:		bin/141835
Submitted by:	Henning Petersen <henning.petersen t-online.de>
MFC after:	2 weeks
2010-01-04 01:14:21 +00:00
Xin LI 8384a5dab5 MFC r200793:
Plug a memory leak.

PR:		bin/141836
Submitted by:	Henning Petersen <henning.petersen at t-online.de>
MFC after:	2 weeks
2010-01-04 01:13:05 +00:00
Xin LI 4896ba1e57 MFC r193012:
Add new sysconfig bits, Fix the bogus numbering of the old bits.

Submitted by:	"Pedro f. Giffuni" <giffunip asme org>
Obtained from:	NetBSD
PR:		kern/91293
2010-01-03 03:23:17 +00:00
Warner Losh 3f9524f1dd Welcome to 2010. 2010-01-02 20:35:19 +00:00
Gavin Atkinson f1570d22c2 MFC r200993: Small spelling fix, "Ethetnet" -> "Ethernet"
Approved by:	ed (mentor)
2010-01-02 13:07:51 +00:00
Konstantin Belousov ee01a2e030 MFC r201201:
Document CLOCK_SECOND, add cross-reference from time(3) to clock_gettime(2).

MFC r201204:
Document _FAST and _PRECISE clocks.
2010-01-01 11:51:40 +00:00
David E. O'Brien e07787039a Happy New Year 2010! :-) 2009-12-31 10:00:55 +00:00
John Baldwin ed287ea7c4 Remove duplicate include of bsd.own.mk. 2009-12-30 22:40:30 +00:00
Doug Barton 7e3598953b MFC r200743:
The service command is an easy interface to the rc.d system.
Its primary purpose is to start and stop services provided by
the rc.d scripts, however it can also be used to list the scripts
using various criteria.

MFC r200809, r200980, r201035, r201069, 201070:

Updates/fixes suggested after the initial introduction
2009-12-30 19:38:57 +00:00
Doug Barton 13baa53797 MFC r201036:
Delete some trailing whitespace
2009-12-30 19:26:46 +00:00
John Baldwin b658c39847 MFC 174741,200919:
- Fix logical bug in the bzip2 reading code, which results in bogus EIO
  returned on a perfectly valid bzip2 stream whose decompressed size
  is multiple of read-ahead buffer size.
- Add a similar fix to the gzipfs code to be safe (along with a subsequent
  bugfix to un-break seeking of gzip streams).
- Add some ifdef'ed code to enable testing bzipfs.c from witin normal
  FreeBSD environment as opposed to the restricted loader one, so that
  one can use gdb and whatnot.
- Add lseek() support to bzip2fs.
2009-12-30 17:55:20 +00:00
John Baldwin 39f3ff2386 MFC 200872:
Don't build zfsboot, gptzfsboot, and zfsloader if WITHOUT_ZFS is enabled.
2009-12-30 17:45:35 +00:00
Bjoern A. Zeeb ef1d5e5006 MFC r199947, 199950:
Enable IPcomp by default.

PR:	kern/123587
2009-12-30 00:03:36 +00:00
Bjoern A. Zeeb 204aeaac5e MFC r199946:
Add more statistics variables for IPcomp.

  Try to version the struct in a backward compatible way.
  People asked for the versioning of the stats structs in general before.

Note: old netstat binaries, as only consumer, continue to work as they are
      still using kvm but will not display the new stats. [1]

Discussed with:		rwatson [1] (for stable/8)
2009-12-29 23:58:32 +00:00
Bjoern A. Zeeb ace21501bf MFC r199906:
In case the compression result is the same size as the orignal version,
  the compression was useless as well.  Make sure to not update the data
  and return, else we would waste resources when decompressing.

  This also avoids the copyback() changing data other consumers like
  xform_ipcomp.c would have ignored because of no win and sent out without
  noting that compression was used, resulting in invalid packets at the
  receiver.
2009-12-29 23:47:21 +00:00
Bjoern A. Zeeb 7e80c7ca02 MFC r199905:
Assimilate very similar input and output code paths
  (no real functional change).
2009-12-29 23:44:32 +00:00
Bjoern A. Zeeb 36ea013e3a MFC r199904:
Add SDT iter probes forgotten in r199885 (r201231 in stable/7).
2009-12-29 23:42:54 +00:00
Bjoern A. Zeeb 4f399ad00a MFC r199899:
Only add the IPcomp header if crypto reported success and we have a lower
  payload size.  Before we had always added the header, no matter if we
  actually send out compressed data or not.

  With this, after the opencrypto/deflate changes, IPcomp starts to work
  apart from edge cases.  Leave it disabled by default until those are
  fixed as well.

PR:		kern/123587
2009-12-29 23:40:57 +00:00
Bjoern A. Zeeb 530d267b6e MFC r199897:
Remove whitespace.
2009-12-29 23:35:05 +00:00
Bjoern A. Zeeb 56a6246f5a MFC r199896:
Directly send data uncompressed if the packet payload size is lower than
  the compression algorithm threshold.
2009-12-29 23:33:20 +00:00
Bjoern A. Zeeb aaf12c2cb9 MFC r199895:
Change memory managment from a fixed size array to a list.
  This is needed to avoid running into out of buffer situations
  where we cannot alloc a new buffer because we hit the array size
  limit (ZBUF).
  Use a combined allocation for the struct and the actual data buffer
  to not increase the number of malloc calls. [1]

  Defer initialization of zbuf until we actually need it.

  Make sure the output buffer will be large enough in all cases.

  Details discussed with:	kib [1]
  Reviewed by:		kib [1]
2009-12-29 23:30:16 +00:00
Bjoern A. Zeeb d7bd9ca94b MFC r199894:
Correct a typo.
2009-12-29 23:27:15 +00:00
Bjoern A. Zeeb 0a4fa0eda4 MFC r199887:
Z_PARTIAL_FLUSH is marked deprecated. Z_SYNC_FLUSH is the suggested
  replacement but only use it for inflate. For deflate use Z_FINISH
  as Z_SYNC_FLUSH adds a trailing marker in some cases that inflate(),
  despite the comment in zlib, does not seem to cope well with, resulting
  in errors when uncompressing exactly fills the output buffer without
  a Z_STREAM_END and a successive call returns an error.
2009-12-29 23:25:45 +00:00
Bjoern A. Zeeb 0eef205529 MFC r199885:
Add SDT probes for opencrypto:deflate:deflate_gobal:*.
  They are not nice but they were helpful.
2009-12-29 23:23:05 +00:00
Bjoern A. Zeeb ae0047b0e8 MFC r199884:
Define an SDT provider for "opencrypto".
2009-12-29 23:21:07 +00:00
Bjoern A. Zeeb c9b8bca7ff MFC r199883:
Add SDT_PROBE[1-5] in the same way we have SDT_PROBE_DEFINE[1-5] to
  avoid having to add all the unused trailing arguments as zeros.
2009-12-29 23:19:28 +00:00
Bjoern A. Zeeb e42ac4ff10 "Merge" a single file out of r184205 by des@ w/o placing mergeinfo
to be able to keep files in sync between branches and still allow a
possible of the entire commit:

  Retire the MALLOC and FREE macros.  They are an abomination unto style(9).
2009-12-29 23:15:55 +00:00
Alexander Motin 89c59b633d MFC r200821:
Make graid3 fallback to malloc() when component request size is bigger
then maximal prepared UMA zone size. This fixes crash with MAXPHYS > 128K.
2009-12-29 21:41:51 +00:00
John Baldwin dc81f78ad5 Partial MFC of 178527:
Add support for create_args_<IF> to interfaces created via
cloned_interfaces.
2009-12-29 21:19:52 +00:00
Robert Watson 6cd515d355 Merge r189314 from head to stable/7:
Adding missing ";"'s required by some SDT_PROBE_DEFINEx() macros.

Requested by:	bz
2009-12-29 17:38:50 +00:00
Robert Watson 1c62fa72c9 Merge r189311 from head to stable/7:
Reduce the verbosity of SDT trace points for DTrace by defining several
  wrapper macros that allow trace points and arguments to be declared
  using a single macro rather than several.  This means a lot less
  repetition and vertical space for each trace point.

  Use these macros when defining privilege and MAC Framework trace points.

  Reviewed by:	jb

Requested by:	bz
2009-12-29 17:35:56 +00:00
Robert Watson f9ee5c6888 Merge r187666 from head to stable/7:
Begin to add SDT tracing of the MAC Framework: add policy modevent,
  register, and unregister hooks that give access to the mac_policy_conf
  for the policy.

  Obtained from:	TrustedBSD Project

Requested by:	bz
2009-12-29 17:31:52 +00:00
Robert Watson e9a2da697a Merge r189063 from head to stable/7:
Add static tracing for privilege checking:

    priv:kernel:priv_check:priv_ok fires for granted privileges
    priv:kernel:priv_check:priv_err fires for denied privileges

  The first argument is the requested privilege number.  The naming
  convention is a little different from the OpenSolaris equivilent
  because we can't have '-' in probefunc names, and our privilege
  namespace is different.

Requested by:	bz
2009-12-29 13:55:15 +00:00
Edwin Groothuis 1a3bb9af3e MFC of tzdata2009u, 201189
Bangladesh will change its clock back to Standard Time on Dec 31, 2009.
2009-12-29 10:15:13 +00:00
Edwin Groothuis b94e5eb77f MFC of r200835, tzcode2009t
Comment only, no data changes.
2009-12-29 10:07:19 +00:00
Edwin Groothuis 8f5de60c3a MFC of r200832, tzdata2009t
zic:
- Fix URL / reference to Calendrical Calculations: Third Edition

libc/stdtime:
- Fix typo in tzfile.5 (no changes in our part)
2009-12-29 10:05:43 +00:00
Doug Barton a4f40e58c4 MFC r200448:
Since the change to rc.subr in r198162 it's not necessary to specify
command in the rc.d script if we have a corresponding ${name}_program
entry, which we do for named.

Rename named_precmd to named_prestart to make it more clear and match
convention.

Move the command_args definition related to -u up into _prestart().
It (and the associated $named_uid value) are only used there, and
unlike required_* and pidfile don't need to be used until this stage.

Fix a silly bug that would only have affected people who were using
the new named_wait or named_auto_forward features, AND had set up an
rndc.conf file instead of using the automatically generated rndc.key.

For named_conf:
	Add "-c $named_conf" to command_args if it's not set to the
	default. If it is set to the default and we're using the base
	BIND it's not necessary. If we're using BIND from the ports
	the user is likely to have included it in _flags (due to long
	necessity for doing so) so don't duplicate that if it's set.

	Add $named_conf to required_files

MFC r200563:

The named process needs to have a "working directory" that it can
write to. This is specified in "options { directory }" in named.conf.
So, create /etc/namedb/working with appropriate permissions, and
update the entry in named.conf to match.

In addition to specifying the working directory, file and path names
in named.conf can be specified relative to the directory listed.
However, since that directory is now different from /etc/namedb
(where the configuration, zone, rndc.*, and other files are located)
further update named.conf to specify all file names with fully
qualified paths. Also update the comment about file and path names
so users know this should be done for all file/path names in the file.

This change will eliminate the 'working directory is not writable'
messages at boot time without sacrificing security. It will also
allow for features in newer versions of BIND (9.7+) to work as
designed.
2009-12-29 07:13:17 +00:00
Doug Barton 200d04fedb MFC r200594:
Add INCLUDE_CONFIG_FILE, and a note in comments about how to also
include the comments with CONFIGARGS
2009-12-29 05:51:24 +00:00
Yoshihiro Takahashi 6b7ea511a9 MFC: revision 200776
Move cursor position after putting a character.
2009-12-29 04:29:38 +00:00
Bjoern A. Zeeb 9153f93442 MFC rr200995:
Remove an unused global.
2009-12-28 14:55:31 +00:00
Xin LI 9fcc27acc1 Explicitly say that this is an internal library which is intended to be
used within FreeBSD base system only, and discourage user applications
from using it.  User applications should use the expat version from the
ports/package collection.

Reviewed by:	simon (earlier version)
2009-12-27 07:04:25 +00:00
Jilles Tjoelker e9eea74a27 MFC r199458: Add pwait utility, which waits for any process to terminate.
This is similar to the Solaris utility of the same name.

Some use cases:
* rc.subr's wait_for_pids
* interactive use, e.g. to shut down the computer when some task is done
  even if the task is already running
2009-12-25 21:28:16 +00:00
Peter Pentchev 93a0caec0f MFC r199244:
Fix the grammar in the isgraph(3) description, almost as per the PR.

  PR:           140455
  Submitted by: Jeremy Huddleston <[email protected]>
2009-12-24 20:35:41 +00:00
Peter Pentchev d881cdfdfc MFC r199863:
Fix the cross-reference to sctp_opt_info in the text - section 3, not 2.

  PR:           140938
  Submitted by: Bruce Cran <[email protected]>
2009-12-24 20:31:26 +00:00
Yoshihiro Takahashi 5582c8e302 MFC: revision 200631
Fix debug messages of bd_io().
2009-12-24 12:26:13 +00:00
Alexander Motin 65dacac999 MFC r200375:
Add one more set of codec IDs.
2009-12-22 20:24:06 +00:00
Konstantin Belousov 81541244a1 MFC r189959:
Implement the dynamic string token substitution in the rpath and
soneeded pathes.

MFC r190505:
Do not dereference NULL pointer.

MFC r199828:
Flag controlling origin expansion in DT_FLAGS is DF_ORIGIN, not DF_1_ORIGIN.

Merge requested by:	bms
Tested by:	bms, Mykola Dzham <freebsd levsha org ua>
2009-12-22 20:20:51 +00:00
Konstantin Belousov 9ecd05784b MFC r189927:
Supply AT_EXECPATH auxinfo entry to the interpreter, both for native and
compat32 binaries.

Note that the merge was edited due to fexecve(2) support not present in
stable/7.

Tested by:	bms, Mykola Dzham <freebsd levsha org ua>
2009-12-22 20:05:09 +00:00
Alexander Motin f9f6c19d42 MFC r200414:
CFA support doesn't exclude FLUSH support.
2009-12-22 20:02:06 +00:00
Konstantin Belousov b699cbbb93 MFC r189926:
Add AT_EXECPATH ELF auxinfo entry type.
2009-12-22 19:59:01 +00:00
Konstantin Belousov a9ffa9359c MFC r189925:
Add some definitions for the DT_FLAGS_1 tag flags.
2009-12-22 19:54:11 +00:00
Konstantin Belousov e8364adf0d MFC r186212 (by imp):
AT_DEBUG and AT_BRK were OBE like 10 years ago, so retire them.

MFC r186225:
Remove two remnant uses of AT_DEBUG.
2009-12-22 19:51:49 +00:00
John Baldwin 3fe694a3a9 MFC 200514:
Remove comment claiming that building acpi into the kernel is deprecated.
2009-12-22 14:58:44 +00:00
Konstantin Belousov da2379f333 MFC r190883:
Update comment, fix spacing.

MFC r190885:
Change the way the mapping of the ELF objects is constructed, by first
mapping PROT_NONE anonymous memory over the whole range, and then
mapping the segments of the object over it.

MFC r195743:
Only perform .bss mapping and cleaning operations when segment file size
is not equal to its memory size.

Tested by:	Mykola Dzham <freebsd levsha org ua>
2009-12-22 14:13:13 +00:00
Jilles Tjoelker 136eb8e25e MFC r200589: cpuset(2): fix a typo and a markup error in the man page 2009-12-22 13:49:37 +00:00
Pyun YongHyeon 63d6d2e074 MFC r199563,199608-199613
r199563:
  Fix copy & paste error and remove extra space before colon.
r199608:
  Remove unnecessary structure packing.
r199609:
  Add initial endianness support. It seems the controller supports
  both big-endian and little-endian format in descriptors for Rx path
  but I couldn't find equivalent feature in Tx path. So just stick to
  little-endian for now.
r199610:
  Because we know received bytes including CRC there is no reason to
  call m_adj(9). The controller also seems to have a capability to
  strip CRC bytes but I failed to activate this feature except for
  loopback traffic.
r199611:
  Add IPv4/TCP/UDP Tx checksum offloading support. It seems the
  controller also has support for IP/TCP checksum offloading for Rx
  path. But I failed to find to way to enable Rx MAC to compute the
  checksum of received frames.
r199612:
  Add __FBSDID.
r199613:
  Only Tx checksum offloading is supported now. Remove experimental
  code sneaked in r199611.
2009-12-21 18:56:55 +00:00
Pyun YongHyeon d987863059 MFC r199558,199561
r199558:
  Use bus_{read,write}_4 rather than bus_space_{read,write}_4.
r199561:
  Use capability pointer to access PCIe registers rather than
  directly access them at fixed address. Frequently the register
  offset could be changed if additional PCI capabilities are added to
  controller.
  One odd thing is ET_PCIR_L0S_L1_LATENCY register. I think it's PCIe
  link capabilities register but the location of the register does
  not match with PCIe capability pointer + offset. I'm not sure it's
  shadow register of PCIe link capabilities register.
2009-12-21 18:36:15 +00:00
Pyun YongHyeon d64728df67 MFC r199553,199556
r199553:
  Remove extra spce at the EOL.
r199556:
  style(9)
2009-12-21 18:30:24 +00:00
Pyun YongHyeon 3ce1ab0f55 MFC r199550-199552:
r199550:
  Remove support code for FreeBSD 6.x versions.
r199551:
  Destroy driver mutex in device detach.
r199552:
  Add MSI support.
2009-12-21 18:18:10 +00:00
Pyun YongHyeon 042ee4b284 MFC r199548:
Remove complex macros that were used to compute bits values.
  Although these macros may have its own strength, its complex
  definition make hard to read the code.

  Approved by:  delphij
2009-12-21 18:09:41 +00:00
Andriy Gapon 0e67e37f5e MFC r190501,190521,192029: Add support for Phenom (Family 10h) to cpufreq.
This also has changes from r197070 (earlier partial MFC).
2009-12-21 14:03:40 +00:00
Ruslan Ermilov 1cecb0d291 MFC r200666: Fixed incorrect watchdog timeout setting.
PR:		kern/130512
2009-12-21 13:53:33 +00:00
Andriy Gapon c5bceb29c3 MFC r199969: amdsbwd: new driver for AMD SB600/SB7xx watchdog timer 2009-12-21 06:24:44 +00:00
Marius Strobl 267f3f7716 MFC: r200482
Properly support M5229 revision 0xc7 and 0xc8:
- These revisions no longer have cable detection capability.
- The UDMA support bit of register 0x4b has been dropped without an
  replacement.
- According to Linux it's crucial for working ATAPI DMA support to
  also set the reserved bit 1 of regsiter 0x53 with these revisions.
2009-12-20 01:46:23 +00:00
Marius Strobl a6a4022fb4 MFC: r200481
Specify the capability and media bits of the capabilities page in
native, i.e. big-endian, format and convert as appropriate like we
also do with the multibyte fields of the other pages. This fixes
the output of acd_describe() to match reality on big-endian machines
without breaking it on little-endian ones. While at it, also convert
the remaining multibyte fields of the pages read although they are
currently unused for consistency and in order to prevent possible
similar bugs in the future.
2009-12-20 01:38:21 +00:00
Andriy Gapon ee955276f7 MFC r197070: Consolidate CPUID to CPU family/model macros for amd64 and i386
This is to fix breakage caused by r200064.
I do this MFC instead of just fixing r200064 to reduce difference from
head and make things easier for future MFCs.
Original change is by jkim.

Pointy hat to:	avg
2009-12-20 01:00:41 +00:00
Andriy Gapon 470b62b156 MFC r200053: ichsmb: try attaching only to intel hardware in the default case 2009-12-19 11:10:33 +00:00
Andriy Gapon e6f1beb011 MFC r200602: ichsmb: add another pci id 2009-12-19 10:55:41 +00:00
Andriy Gapon 88e14757da MFC r200064: mca: small enhancements related to cpu quirks 2009-12-19 10:45:57 +00:00
Andriy Gapon 21bd2f2507 MFC r200033: mca: improve status checking, recording and reporting 2009-12-19 10:41:56 +00:00
Yoshihiro Takahashi 0e57ca09d9 MFC: r176645 and r200254
- Retire the support for using paging in BTX.
  - Use real mode instead of v86 mode.
2009-12-19 05:00:09 +00:00
Yoshihiro Takahashi d790967d92 MFC: r200253 and r200255
Reduce diffs against i386.
2009-12-19 04:33:10 +00:00
John Baldwin 25a383f479 MFC 200357:
Don't warn about an RSDP with a corrupt checksum.  The kernel does a better
job about warning about these things later and this message can be
confusing.
2009-12-18 22:23:57 +00:00
John Baldwin c9d70a32ca MFC 200310:
Fix a confusing typo in the EDD packet structure used in gptboot and
gptzfsboot.  I got the segment and offset fields reversed in the structure,
but I also succeeded in crossing the assignments so the actual EDD packet
ended up correct.
2009-12-18 22:12:47 +00:00
John Baldwin 8bc1b72a4e MFC 200309:
- Port bios_getmem() from libi386 to {gpt,}zfsboot() and use it to
  safely allocate a heap region above 1MB.  This enables {gpt,}zfsboot()
  to allocate much larger buffers than before.
- Use a larger buffer (1MB instead of 128K) for temporary ZFS buffers.  This
  allows more reliable reading of compressed files in a raidz/raidz2 pool.
2009-12-18 21:02:32 +00:00
John Baldwin faada68e88 MFC 200216,200219:
- Various small whitespace and style fixes.
- Improve the algorithm the loader uses to choose a memory range for its
  heap when using a range above 1MB.
2009-12-18 20:28:28 +00:00
Sean Farley d7bd99c6bd Merge from head to stable/7:
r200423:
Remove a dead store.
2009-12-18 20:08:29 +00:00
John Baldwin 52114fd6bd MFC 200084:
Properly return an error reply if an NFS remove or link operation fails.
Previously the failing operation would allocate an mbuf and construct an
error reply, but because the function did not return 0, the NFS server
assumed it had failed to generate a reply and would leak the reply mbuf as
well as not sending the reply to the NFS client.
2009-12-18 19:50:21 +00:00
Christian Brueffer d40fe5c3b7 MFC: r197900
Improved one-line description of this module (taken from NOTES).
2009-12-18 12:09:44 +00:00
John Baldwin fbd79778a6 Partial merge of 179210 and 192926 to ease compilation of 8.x code on 7:
Introduce REMOVE_AFTER() macro's for SLIST and STAILQ.

I forgot to merge the manpage update previously.

Pointed out by:	pluknet
2009-12-17 21:17:12 +00:00
John Baldwin f9b2d764fd MFC 199606, 199614:
Add an internal _once() method.  This works identical to pthread_once(3)
with the additional property that it is safe for routines in libc to use
in both single-threaded and multi-threaded processes.  Multi-threaded
processes use the pthread_once() implementation from the threading library
while single-threaded processes use a simplified "stub" version internal
to libc.
2009-12-17 20:41:40 +00:00
John Baldwin c57ae59abd Partial merge of 179210 and 192926 to ease compilation of 8.x code on 7:
Introduce REMOVE_AFTER() macro's for SLIST and STAILQ.
2009-12-17 19:56:09 +00:00
John Baldwin 12f8272eff Partial merge of 187961 to ease compilation of 8.x code on 7:
Add a function attribute called `__malloc_like'.
2009-12-17 19:54:32 +00:00
Marius Strobl cb62ba6002 MFC: r200272
Add additional checks of the kernel stack addresses in order to
ensure we don't overrun the beginning of the call chain.
2009-12-17 18:17:46 +00:00
Marius Strobl e21076e8e2 MFC: r195376
Cleanup ALIGNED_POINTER:
o add to platforms where it was missing (arm, i386, powerpc, sparc64, sun4v)
o define as "1" on amd64 and i386 where there is no restriction
o make the type returned consistent with ALIGN
o remove _ALIGNED_POINTER
o make associated comments consistent

Reviewed by:	bde, imp, marcel
Approved by:	sam (MFC to stable/7)
2009-12-17 07:36:40 +00:00
Hajimu UMEMOTO 31c837ef5f MFC r199995:
Don't try to bind to an anycast address.  The KAME IPv6 stack doesn't
allow bind to an anycast address.  It does away with an annoying
message.
2009-12-15 15:13:41 +00:00
Stanislav Sedov d4426310ea - MFC r198318:
- On entrance to the rx_eof sync RX rings maps with POSTWRITE flag
    instead of POSTREAD: the hardware do not touch this memory (CPU
    updates it).  It is already synchronized as PREWRITE after the
    processing is done.

  - Synchronize RX return ring memory in rx_eof.  This is needed
    as the deviced updates this memory when receives packets.

  - Decouple the synchronization of BGE status block in the interrupt
    service routine: perfrom PREREAD synchronization only all accesses
    to this block are finished.  This seems to be more natural.
2009-12-15 10:36:08 +00:00
Stanislav Sedov 96e4a5a01e - MFC r197832, r197834, r197837:
- Add support for new BGE chips (5761, 5784 and 57780).  These chips uses new
    BGE_PCI_PRODID_ASICREV register to store the chip identifier and its revision.
  - Add new grouping macro for 7575+ chips (BGE_IS_5755_PLUS).
  - Add IDs for Fujitsu-branded Broadcom adapters.
2009-12-15 10:34:05 +00:00
Luigi Rizzo 8f09e37554 MFC r200301
when calling ldd, use the cross libraries and not the host version
2009-12-15 07:04:20 +00:00
Doug Barton 597be8d64c Wrap some socket handling code in a !NULL bow
This patch or something similar will likely be included in a future
BIND release.

PR:		bin/138061
Submitted by:	Michael Baker <[email protected]>
Original patch submitted by:	Volker <[email protected]>
Patch reviewed and tweaked by:	ISC
2009-12-14 21:51:36 +00:00
Marcel Moolenaar d265845e30 MFC rev 200397:
Fix interrupt handling.

PR:		kern/140947
2009-12-14 17:45:16 +00:00
Xin LI 0ac8135d26 MFC r200392:
Apply two vendor fixes for CVE-2009-3720.

Security:	CVE-2009-3720
2009-12-14 01:04:59 +00:00
Doug Barton 6c9fdacf05 MFC r200377:
Update to the December 12, 2008 version of this file. The one
substantive change is to add the IPv6 address of L. The other
changes are all CAPS LOCK related.
2009-12-13 23:58:04 +00:00
Bjoern A. Zeeb d41fabe877 MFC r197518:
lindev(4) [1] is supposed to be a collection of linux-specific pseudo
  devices that we also support, just not by default (thus only LINT or
  module builds by default).

  While currently there is only "/dev/full" [2], we are planning to see more
  in the future.  We may decide to change the module/dependency logic in the
  future should the list grow too long.

  This is not part of linux.ko as also non-linux binaries like kFreeBSD
  userland or ports can make use of this as well.

  Suggested by:		rwatson [1] (name)
  Submitted by:		ed [2]
  Discussed with:	markm, ed, rwatson, kib (weeks ago)
  Reviewed by:		rwatson, brueffer (prev. version)
PR:			kern/68961
2009-12-13 16:53:06 +00:00
Robert Noland 48b0da6ef2 MFC r198694,r198697
Some general cleanup of scatter/gather memory allocation

     - We don't need to check malloc return values with M_WAITOK
     - remove variables that we don't really need
     - cleanup the error paths by just calling drm_sg_cleanup()
     - fix drm_sg_cleanup() to be safe to call at any time
2009-12-13 15:12:40 +00:00
Robert Noland aefacc96fd MFC 198332
Check pointer for NULL before dereferencing it, not after.

Originally committed by:	brueffer
2009-12-13 15:08:25 +00:00
Fabien Thomas a5489dac46 MFC 193809:
Fix parsing of Core2 event qualifiers.
2009-12-11 12:46:41 +00:00
Fabien Thomas 8bce3c4ef0 MFC 196739:
Add counters for the i7 architecture which were accidentally left
out of the original commit of i7 support.  These are all the counters
on pages A-32 and A-33 of the _Intel(R) 64 and IA32 Architectures
Software Developer's Manual Vol 3B_, June 2009.  Almost all
of these counters relate to operations on the L2 cache.
2009-12-11 12:38:15 +00:00
Doug Barton 379cc0ff15 Update to version 9.4.3-P4. The vulnerability this is designed to fix is
related to DNSSEC validation on a resolving name server that allows
access to untrusted users. If your system does not fall into all 3 of
these categories you do not need to update immediately.
2009-12-11 02:23:04 +00:00
Doug Barton 9edc0c13f7 The mergeinfo on these 3 files has already been committed to
contrib/bind9, so remove it from the individual files.
2009-12-11 02:00:18 +00:00
Alexander Motin 7c25ef4dca MFC r199247:
Remove part that HDMI is not implemented. It had different meaning and
confuse users.
Extend BUGS section.
Add some supported chipsets.
2009-12-11 01:26:09 +00:00
Alexander Motin b6dd7588d2 MFC r188512:
Fix spelling a bit.
2009-12-11 01:25:10 +00:00
Alexander Motin 3fc5335db3 MFC r199258, r199846:
Add more codec IDs.
Add two Cirrus Logic codec IDs.
Add GPIO setting quirk for Apple MacBookPro5,5.
2009-12-11 01:17:49 +00:00
Alexander Motin a5806a1a31 MFC r197611, r197640:
Add some bits of HDMI/DisplayPort support from later specification updates.
It may be not enough to make them work, but at least should give some
information about these beasts.
Add Realtek ALC887 codec ID.
2009-12-11 01:15:53 +00:00
Alexander Motin cde3f23e90 MFC r197017, r197018
Add Intel 82801JD (one more ICH10) HDA controller ID.
Add NVidia MCP89 HDA controller IDs.
2009-12-11 01:13:48 +00:00
Alexander Motin 64f370ecea MFC r196762:
Improve HDA controller capabilities logging.
2009-12-11 01:11:56 +00:00
Alexander Motin aeccd037ea MFC r200282, r200290:
Change gmirror default balance algorithm from "split" to improved "load".
"split" is very ineffective for devices with rotating media as HDDs.
To be effective, it needs that transfer time reduction due to block
splitting was bigger then access time increase due to non-sequential
access. For modern HDDs I was able to reproduce it only with read sizes
of 2MB and above, which is almost not applicable in real life.
"load" algorithm same time is more universal and effective now.
2009-12-11 00:00:18 +00:00
Marcel Moolenaar b7353f2481 MFC rev 200230:
Add support for the NetMos NM9865 family of Serial/Parallel ports.
2009-12-10 06:24:16 +00:00
Alexander Motin 0567ec5655 MFC r200121:
Do not ignore device interrupt if bus mastering is still active. It is
normal in case of media read error and some ATAPI cases, when transfer size
is unknown beforehand. PCI ATA BM specification tells that in case of such
underrun driver should just manually stop DMA engine. DMA engine should
same time guarantie that all bus mastering transfers completed at the moment
when driver reads interrupt flag asserted.
This change fixes interrupt storms and command timeouts in many cases.

PR:             kern/103602, sparc64/121539, kern/133122, kern/139654
2009-12-09 17:23:08 +00:00
Scott Long 47bb655282 MFC: fix alignment calculation for situations where alignment needs to be
exactly on page boundary or less.
2009-12-09 08:16:12 +00:00
Alexander Motin e9d5a89075 MFC r200086:
Change 'load' balancing mode algorithm:
- Instead of measuring last request execution time for each drive and
choosing one with smallest time, use averaged number of requests, running
on each drive. This information is more accurate and timely. It allows to
distribute load between drives in more even and predictable way.
- For each drive track offset of the last submitted request. If new request
offset matches previous one or close for some drive, prefer that drive.
It allows to significantly speedup simultaneous sequential reads.

PR:             kern/113885
2009-12-08 23:34:34 +00:00
Jilles Tjoelker 6e7026836a MFC r196483,r196634:
sh: Fix crash when undefining or redefining a currently executing function

Add a reference count to function definitions.
Memory may leak if a SIGINT arrives in interactive mode at exactly the wrong
time.

PR:		bin/137640
2009-12-08 22:37:07 +00:00
Xin LI 2b59dafc10 MFC r180120:
Avoid NULL deference.
2009-12-08 21:46:30 +00:00
Fabien Thomas f986e271f9 MFC 198464:
Inform hwpmc(4) of a thread's impending demise prior to invoking sched_throw().
2009-12-08 19:18:32 +00:00
Jilles Tjoelker ce95ef55fc MFC r198963: sh: Fix memory leak when using a variable in arithmetic
like $((x)).
2009-12-08 19:01:05 +00:00
Xin LI af6353c0d4 MFC revisions 196550 and 196552:
Add a new rc.d script, static_arp, which enables the administrator to
statically bind IPv4 <-> MAC address at boot time.

In order to use this, the administrator needs to configure the following
rc.conf(5) variable:

 - static_arp_pairs: A list of names for static bind pairs, and,
 - a series of static_arp_(name): the arguments that is being passed to
   ``arp -S'' operation.

Example:
  static_arp_pairs="gw"
  static_arp_gw="192.168.1.1 00:01:02:03:04:05"

See the rc.conf(5) manual page for more details.
2009-12-08 18:35:57 +00:00
Andriy Gapon f98c4c0189 MFC r199968: x86 cpu features: add MOVBE reporting and flag 2009-12-08 15:29:12 +00:00
Andriy Gapon c1e06a45eb MFC r199184: reflect that pg_ps_enabled is a tunable 2009-12-08 15:24:37 +00:00
Andriy Gapon a32ffdf2ec MFC r200052: ichsmb: add pci ids for some newer supported hardware 2009-12-08 15:16:48 +00:00
Fabien Thomas 5931593675 MFC 200060:
Use a better check for a valid kernel stack address when capturing
kernel call chains.
2009-12-07 20:51:19 +00:00
Fabien Thomas c32a7ee7c2 MFC 198433:
Not all Intel Core (TM) CPUs implement PMC_CLASS_IAF fixed-function
counters.  For such CPUs, use an alternate mapping of convenience
names to events supported by PMC_CLASS_IAP programmable counters.
2009-12-07 20:47:33 +00:00
Fabien Thomas 7dba516cb7 MFC 198432:
Only claim that the PMC_CLASS_IAF PMCs are supported by a CPU if
there are PMCs on the CPU that belong to the class.
2009-12-07 20:46:22 +00:00
John Baldwin facdbea0a9 MFC 200061:
The fd_mask type is an unsigned long, not an int, so treat the mask as a
long instead of an int when examining the results of select() to look for
RPC requests.  Previously this routine would ignore RPC requests to sockets
whose file descriptor mod 64 was greater than 31 on a 64-bit platform.
2009-12-07 19:07:58 +00:00
Robert Noland e1effa1501 MFC 199714
Create a seperate ZFS enabled loader.

This adds zfsloader which will be called by zfsboot/gptzfsboot code rather
than the tradional loader.  This eliminates the need to set the
LOADER_ZFS_SUPPORT variable in order to get a ZFS enabled loader.

Note however, that you must reinstall your bootcode (zfsboot/gptzfsboot)
in order for the boot process to use the new loader.

New installations will no longer be required to build a ZFS enabled
loader for a working ZFS boot system.  Installing zfsboot/gptzfsboot is
sufficient for acknowledging the use of CDDL code and therefore the ZFS
enabled loader.
2009-12-07 17:15:36 +00:00
Jaakko Heinonen a6347931af MFC r197525:
Ensure that tv_sec is between INT32_MIN and INT32_MAX, so ZFS won't object.
This completes the fix from r185586.

Approved by:	trasz (mentor)
2009-12-07 13:38:10 +00:00
Navdeep Parhar 7b4c604bbb MFC r199237, r199238
sc->rev and is_offload(sc) will always be 0 during probe.  Wait till
attach to get correct values.

Make sure *some* edc is setup even for an unknown transceiver (assume
it is optical).
2009-12-06 02:44:55 +00:00
Ed Maste e61aa52f4e MFC r200001:
Fix parenthesis typo -- copy full frame pointer for userland callchain,
  not just one byte.

Submitted by:        Ryan Stone      rysto32 at gmail dot com
2009-12-05 17:08:45 +00:00
Luigi Rizzo f7de8f4704 some MFC:
r200020
  change the type of the opcode from enum *:8  to u_int8_t
  so the size and alignment of the ipfw_insn is not compiler dependent.
  No changes in the code generated by gcc.

r200023
  Add new sockopt names for ipfw and dummynet.

  This commit is just grabbing entries for the new names
  that will be used in the future, so you don't need to
  rebuild anything now.

r200034
  Dispatch sockopt calls to ipfw and dummynet
  using the new option numbers, IP_FW3 and IP_DUMMYNET3.
  Right now the modules return an error if called with those arguments
  so there is no danger of unwanted behaviour.

The code for r200040 was already in RELENG_7 before the 8.x freeze
2009-12-05 13:53:41 +00:00
Christian Brueffer 66b80058a2 MFC: r199988
Add an .Nm for strncat.
2009-12-04 07:09:17 +00:00
Fabien Thomas 173be3b79a MFC 179886: Complete the merge after hwpmc backport.
Make preparations for increasing the size of the kernel virtual
address space on the amd64 architecture.  The amd64 architecture
requires kernel code and global variables to reside in the highest 2GB
of the 64-bit virtual address space.  Thus, KERNBASE cannot change.
However, KERNBASE is sometimes used as the start of the kernel virtual
address space.  Henceforth, VM_MIN_KERNEL_ADDRESS should be used
instead.  Since KERNBASE and VM_MIN_KERNEL_ADDRESS are still the same
address, there should be no visible effect from this change (yet).
2009-12-03 19:37:52 +00:00
Pyun YongHyeon 07d75cbe53 MFC r199565:
Move interface reinitialization down after disabling WOL in resume
  path.
2009-12-03 18:50:04 +00:00
Pyun YongHyeon a8d0e21dbb MFC r199564:
Minimize interface reinitialization by checking IFF_DRV_RUNNING
  flag. This fixes unnecessary interface UP/DOWNs during getting an
  IP address via DHCP.
2009-12-03 18:45:01 +00:00
Colin Percival ff76cd25e7 Disable SSL renegotiation in order to protect against a serious
protocol flaw. [09:15]

Correctly handle failures from unsetenv resulting from a corrupt
environment in rtld-elf. [09:16]

Fix permissions in freebsd-update in order to prevent leakage of
sensitive files. [09:17]

Approved by:	so (cperciva)
Security:	FreeBSD-SA-09:15.ssl
Security:	FreeBSD-SA-09:16.rtld
Security:	FreeBSD-SA-09:17.freebsd-udpate
2009-12-03 09:18:40 +00:00
Xin LI 425b484554 MFC r199066 + 199339:
Apply a NetBSD fix (revision 1.12) to handle multi-session bzip2 files
as created by pbzip2.
2009-12-02 21:58:34 +00:00
Tony Finch 9acd270ecd MFC 199815:
Fix performance bugs in factor(6).
2009-12-02 19:30:33 +00:00
Tony Finch 5ffb9c13af MFC 199813, 199817, 199842, 199867:
Update unifdef to latest upstream version.
2009-12-02 15:34:13 +00:00
John Baldwin f8d6190153 MFC 194429:
Add support for UMA_SLAB_KERNEL to page_free().  (While I'm here remove an
unnecessary newline character from the end of two panic messages.)
2009-12-02 15:24:57 +00:00
Garrett Wollman 266be50da0 MFC revs 199781,199782,199784,199786:
Eliminate dead stores.

  In __mbsconv(), if prec was zero, nconv could have been used
  uninitialized.  Initialize it to a safe value so that there's no
  chance of returning an error if stack garbage happens to be equal to
  (size_t)-1 or (size_t)-2.

  In clnt_raw_create(), avoid minor race condition initializing the
  file-scope variable clntraw_private.

Mark head rev 199785 as merged; 7-STABLE's version of svc_raw_reply()
doesn't have the same bug (or even look all that similar).

Found by:		Clang static analyzer
2009-12-02 03:08:29 +00:00
Fabien Thomas cad7e4df41 MFC 198339:
Fix the NO_PROXY handling.

PR: 139751
2009-12-01 23:24:42 +00:00
Fabien Thomas 59cf3d061e MFC 199763:
- fix a LOR between process lock and pmc thread mutex
 - fix a system deadlock on process exit when the sample buffer
 is full (pmclog_loop blocked in fo_write) and pmcstat exit.
2009-12-01 23:07:38 +00:00
Fabien Thomas 01518b8c6f MFC 198343:
Handle the case where there is only one PMC in the system.
2009-12-01 23:01:59 +00:00
John Baldwin 8c4a123477 MFC 199579:
Always use 64-bit LBAs for disk addresses in zfsboot and gptzfsboot to
fully support booting from large volumes.
2009-12-01 22:38:37 +00:00
Andriy Gapon 3d9dd42b71 MFC r199016: acpi: remove 'magic' ivar
Note that the ivar itself is kept in the stable branches, only its use is
dropped.
2009-12-01 06:15:19 +00:00
Colin Percival 4e6ee7c4ac MFC r199979: Fix local root vulnerability. 2009-12-01 03:00:16 +00:00
Christian Brueffer 96fa817ea0 MFC: r199739, r199825
- LSI MegaRAID 9260 works, sort the hardware list while here.
- Add IBM ServeRAID-MR10i to the hardware list.
2009-11-30 08:01:18 +00:00
Pyun YongHyeon 1e33d5153b MFC r191301:
For RTL8139C+ controllers, have controller handle padding short
  checksum offload frames. Software workaround used for broken
  controllers(RTL8169, RTL8168, RTL8168B) seem to cause watchdog
  timeouts on RTL8139C+.
  Introduce a new flag RL_FLAG_AUTOPAD to mark automatic padding
  feature of controller and set it for RTL8139C+ and controllers that
  use new descriptor format. This fixes watchdog timeouts seen on
  RTL8139C+.

  Reported by:	Dimitri Rodis < DimitriR <> integritasystems dot com >
  Tested by:	Dimitri Rodis < DimitriR <> integritasystems dot com >
2009-11-29 20:34:41 +00:00
Pyun YongHyeon f5b6497fc6 MFC r195675:
Adding hardware ID for RTL810x PCIe found on HP Pavilion DV2-1022AX.
2009-11-29 20:31:09 +00:00
Pyun YongHyeon 02e97a8536 MFC r199413:
It seems generation of link state change of e1000phy(4) is not
  reliable on some Marvell PHYs. If msk(4) know it still does not
  have established link check whether msk(4) missed the link state
  change by looking into polled link state.

  Reported by:	Mel Flynn < mel.flynn+fbsd.current <> mailing.thruhere dot net >,
		Gleb Kurtsou <gleb.kurtsou <> gmail dot com >
  Tested by:	Gleb Kurtsou <gleb.kurtsou <> gmail dot com >
2009-11-29 20:20:34 +00:00
Pyun YongHyeon ec916bb5d7 MFC r199013:
88E8057(Ultra 2) is now supported.
2009-11-29 20:12:07 +00:00
Pyun YongHyeon 0abe226f40 MFC r198475:
- Add support for Marvell Yukon 88E8042 device.
2009-11-29 20:10:35 +00:00
Pyun YongHyeon 507ea24308 MFC r198475:
- Add support for Marvell Yukon 88E8042 device.
2009-11-29 20:09:35 +00:00
Pyun YongHyeon 5c7f10c1ac MFC r199012:
Add preliminary Yukon Ultra 2 support(88E8057). The controller
  looks very similar to Yukon EC Ultra.

  Tested by:	kalin m ( kalin <> el dot net )
2009-11-29 19:59:40 +00:00
Pyun YongHyeon f817315a38 MFC 198996-198997.
r198996:
  Remove unnecessary header file.

r198997:
  It's normal to see Rx FIFO overruns under high network load and
  showing the message creates other side-effects. Remove the Rx
  FIFO overrun message in interrupt handler. msk(4) should recover
  from the FIFO overruns without any user intervention. Users can
  still check the Rx FIFO overrun counter from MAC MIB statistics
  maintained in driver(dev.msk.0.stats.rx.overflows).
2009-11-29 19:56:49 +00:00
Pyun YongHyeon 40af6b7014 MFC 198814.
Add a check to know whether driver is still running after
  reacquiring driver lock in Rx handler. re(4) drops a driver lock
  before passing received frame to upper stack and reacquire the
  lock. During the time window ioctl calls could be executed and if
  the ioctl was interface down request, driver will stop the
  controller and free allocated mbufs. After that when driver comes
  back to Rx handler again it does not know what was happend so it
  could access free mbufs which in turn cause panic.

  Reported by:	Norbert Papke < npapk <> acm dot org >
  Tested by:	Norbert Papke < npapk <> acm dot org >
2009-11-29 19:50:39 +00:00
Pyun YongHyeon 08a135326b MFC 198813.
Add BCM5761 PHY id.
2009-11-29 19:47:31 +00:00
Pyun YongHyeon 8a62e9d603 MFC 197627.
Fix multicast handling. All Atheros controllers use big-endian form
  in computing multicast hash.

  PR:	kern/139137
2009-11-29 19:30:54 +00:00
Pyun YongHyeon 7b1b18509f MFC 197600.
For AR8132 fast ethernet controller, do not report 1000baseT
  capability to mii(4). Even though AR8132 uses the same model/
  revision number of F1 gigabit PHY, the PHY has no ability to
  establish 1000baseT link. I have no idea why Atheros use the same
  device/model id for this PHY.
  With this change atphy(4) does not report 1000baseT media
  capability and manual 1000baseT configuration is also disabled
  which is more desirable behavior for 10/100Mbps PHY.
2009-11-29 19:26:31 +00:00
Pyun YongHyeon c8ffc7ad94 MFC 197593.
DGE-560SX is now supported.
2009-11-29 19:23:25 +00:00
Pyun YongHyeon a95aac4a6b MFC 197592.
Add DGE-560SX(Yukon XL) to the supported device list. Many thanks
  to "Eugene Perevyazko <john <> dnepro dot net>" who kindly gave
  remote access to system with DGE-560SX.
2009-11-29 19:19:23 +00:00
Pyun YongHyeon 323f86b2f4 MFC 197591.
Add workaround for Yukon XL which has hardware bug that can't flush
  FIFO.
2009-11-29 19:16:16 +00:00
Pyun YongHyeon 4843a77839 MFC 197590.
Add hack to pass controller specific information to phy driver.
  Unlike most other PHYs there is no easy way to know which media
  type the PHY supports on Marvell PHYs. MIIF_HAVEFIBER flags is now
  passed via bus-specific instance variable of a device. While I'm
  here add 88E1112 specific work around to set SIGDET polarity low.
  Many thanks "Eugene Perevyazko <john <> dnepro dot net>" who kindly
  gave remote access to system with DGE-560SX.
2009-11-29 19:12:41 +00:00
Pyun YongHyeon dc7acc536b MFC 197589.
Fix MIB statistics clear routine. This should fix alignment errors on sparc64.

  Reported by:	Garrett Damore < gdamore <> opensolaris dot org >
2009-11-29 19:07:38 +00:00
Pyun YongHyeon 30859c45d1 MFC 197588.
Some fiber PHY(88E1112) does not seem to set resolved speed so
  always assume we've got IFM_1000_SX.
2009-11-29 19:04:42 +00:00
Pyun YongHyeon fd5684e26a MFC 197587.
Don't encode model id twice.

  Reported by:	Kristof Provost <kristof <> sigsegv dot be>
2009-11-29 19:01:21 +00:00
Pyun YongHyeon dcba6ae0a4 MFC r197585.
Remove unnecessary device reinitialization.
2009-11-29 18:54:21 +00:00
Bjoern A. Zeeb c026dad5f4 MFC r179785, r180496:
Remove obselete PECOFF image activator support.

Discussed with:	secteam, kib
Approved by:	re (kensmith)
2009-11-29 17:27:58 +00:00
Alexander Motin 3c130b88fe MFC r199043:
Introduce hw.hptrr.attach_generic loader tunable to deny hptrr driver
attach chips with generic Marvell (non-HighPoint) PCI identification.
These chips are also supported by ata(4). Some vendors, like Supermicro,
are using same chips without providing HPT RAID BIOS.

PR:             kern/120842, kern/136750
2009-11-26 15:23:25 +00:00
Alexander Motin ccb5bcb456 MFC r199043:
Introduce hw.hptrr.attach_generic loader tunable to deny hptrr driver
attach chips with generic Marvell (non-HighPoint) PCI identification.
These chips are also supported by ata(4). Some vendors, like Supermicro,
are using same chips without providing HPT RAID BIOS.

PR:             kern/120842, kern/136750
2009-11-26 15:18:05 +00:00
Alexander Motin b23ff88311 MFC r199749:
Use only lower byte of sectors_intr IDENTIFY word as sector count.
This fixes SET_MULTI error during boot on devices supporting less then
16 sectors per interrupt.
2009-11-26 14:52:14 +00:00
Yoshihiro Takahashi 5b18bc7aac MFC: revision 178974
Replace the ee with the ed to resolve disk overflow.
2009-11-26 13:22:00 +00:00
Yoshihiro Takahashi 0a53d43d1a MFC: revision 178945
Add the ed and remove the vi.
  This fixes a disk-full error.
2009-11-26 13:18:38 +00:00
Marius Strobl 9d76a1d3e6 MFC: r198502
Sync with the other archs and wrap the prototype of in_cksum_skip(9)
in #ifdef _KERNEL.

Submitted by:	Ulrich Spoerlein
2009-11-25 18:31:58 +00:00
Peter Pentchev 98338d1c2e Merge rev. 199181 to 7.x-STABLE:
Correct the information about the doceng@ team members - Murray Stokely
  stepped down some time ago, about the same time as Giorgos Keramidas
  joined the team.

  PR:           140465
  Submitted by: Denny Lin <[email protected]>
2009-11-25 11:25:05 +00:00
Peter Pentchev 9cbcd65036 Merge rev. 199180 to 7.x-STABLE, the change to isblank(3):
Fix the grammar as in the PR, and then some.

PR:             140454
Submitted by:   Jeremy Huddleston <[email protected]>
2009-11-25 11:16:39 +00:00
Marius Strobl 9a62e9e0b1 MFC: r199442
Unroll copying of the registers in {g,s}et_mcontext() and limit it
to the set actually restored by tl0_ret() instead of using the whole
trapframe. Additionally skip %g7 as that register is used as the
userland TLS pointer.

PR:		140523
2009-11-24 22:13:06 +00:00
Christian Brueffer a0f52d32cf MFC: r199320
Fix grammar.
2009-11-23 09:45:11 +00:00
Christian Brueffer bd86a7c582 MFC: r199317
Fix a memory leak in acl_from_text() in case the conversion succeeded.
2009-11-23 09:15:16 +00:00
Attilio Rao 88d8303567 MFC r199024:
Use a safety belt for cases where corrupted narg can be passed to the
ktrsyscall().
2009-11-22 23:54:19 +00:00
Attilio Rao 469e1d9777 MFC r199209:
Fix a potential buffer boundaries overflow in devclass_add_device() by
using all available int lenghts digits for storing the information.
2009-11-22 23:51:51 +00:00
Attilio Rao d98816223e MFC r199007:
Fix a memory leak.
2009-11-22 23:46:44 +00:00
Robert Noland fe843d19af MFC 198420
Correct some issues with zfs boot.

   - Teach it to read gang blocks. (essentially untested)
     If you see "ZFS: gang block detected!", please let
     me know, so we can either remove the printf if it
     works, or fix it if it doesn't.

   - If multiple partitions exist on a disk, probe them all.
     We also need to reset dsk->start to 0 to read the right
     sector here.

   - With GPT, we can have 128 partitions.

   - If the bootfs property has ever been set on a pool
     it seems that it never goes away.  zpool won't allow
     you to add to the pool with the bootfs property set.
     However, if you clear the property back to default
     we end up getting 0 for the object number and read
     a bogus block pointer and fail to boot.

   - Fix some error printfs. The printf in the loader is
     only capable of c,s and u formats.

   - Teach printf how to display %llu
2009-11-21 15:04:01 +00:00
Robert Noland faee69195b MFC r199017,199228
Fix handling of GPT headers when size is > 92 bytes.

This should address reading GPT headers written by opensolaris.
2009-11-21 14:54:45 +00:00
Christian Brueffer 85c77ed61b MFC: r199349
Fix typo.
2009-11-20 07:19:46 +00:00
Christian Brueffer 282d84a485 MFC: r199255, r199257
Improved the manpage description.  The committed wording
was provided by jhb.

Remove a note about vfork(4) going to be eliminated, it's here to stay.
2009-11-20 07:00:40 +00:00
Michael Tuexen a1eaa7b568 MFC 199477
Fix a bug where the system panics when a SHUTDOWN is received with an
illegal TSN.
This bug was reported by Irene Ruengeler.

Approved by: rrs (mentor)
2009-11-19 22:59:35 +00:00
Edwin Groothuis 9e58252cc7 MFC of r199336
MFV of tzdata2009s, r199334

- Fix (harmless) typo in the definitions of Antarctica/David
- Fiji will go into DST from 29 November 2009 to 25 April 2010.
2009-11-19 20:40:52 +00:00
Navdeep Parhar e0c3f642ab Fix cxgb(4)'s LRO in stable/7
Submitted by:	matthew.fleming at isilon.com
Reviewed by:	gnn
2009-11-19 20:30:18 +00:00
Yoshihiro Takahashi 44b120cd22 MFC: revision 199219
Fix cpu model for PODP5V83.  It is P24T, not P54T.
  Also remove redundant 'Overdrive' word.
2009-11-19 12:08:16 +00:00
Bjoern A. Zeeb 539fece93d MFC r198049:
Immediately after clearing a pending callout that didn't make it due
  to the lock we hold, disable interrupts, and announce to the firmware
  that we are shutting down. Especially do this before disabling blocks.

  This makes some types of machines with asf enabled no longer hang upon
  boot, when we start configuring the interface.

PR:	i386/96382, kern/100410, kern/122252, kern/116328
2009-11-17 20:48:32 +00:00
John Baldwin af59f23c19 MFC 198986:
Fix a copy-paste bug when reading data from the last 3 (7 for PAE) bytes of
a page mapped by a large page in the kernel.
2009-11-17 16:51:38 +00:00
John Baldwin 2fe649e7a5 MFC 198990:
Several years ago a feature was added to TCP that casued soreceive() to
send an ACK right away if data was drained from a TCP socket that had
previously advertised a zero-sized window.  The current code requires the
receive window to be exactly zero for this to kick in.  If window scaling is
enabled and the window is smaller than the scale, then the effective window
that is advertised is zero.  However, in that case the zero-sized window
handling is not enabled because the window is not exactly zero.  The fix
changes the code to check the raw window value against zero.
2009-11-17 16:17:39 +00:00
John Baldwin cec7632e82 MFC 198043:
Move the USB wireless drivers down into their own section next to the USB
ethernet drivers.
2009-11-17 15:59:26 +00:00
John Baldwin ed4794c0aa MFC 198856: Fix a couple of comment typos. 2009-11-17 15:30:22 +00:00
John Baldwin 7870dd6db2 MFC 198820:
Ensure 'kvm' is always initialized.  If "-M" was not specified and the
garbage value on the stack was not zero, then 'ddb capture' would try to
use the garbage value as a kvm_t pointer.
2009-11-17 15:28:25 +00:00
Konstantin Belousov 062b137532 MFC r199137:
Detect the slashdot lookup for RENAME or REMOVE in lookup(), and return
EINVAL.
2009-11-17 12:11:12 +00:00
Konstantin Belousov 8dad049954 MFC r198853:
If socket buffer space appears to be lower then sum of count of
already prepared bytes and next portion of transfer, inner loop of
kern_sendfile() aborts, not preparing next mbuf for socket buffer, and
not modifying any outer loop invariants. The thread loops in the outer
loop forever.

Instead of breaking from inner loop, prepare only bytes that fit into
the socket buffer space.
2009-11-17 12:09:21 +00:00
Andriy Gapon 501c8e609a MFC r199015: ichwd: don't attach to isa pnp device(s) by accident 2009-11-17 09:37:43 +00:00
Bjoern A. Zeeb 514a12827f As we pass the 'offset' unvalidated to vn_rdwr() make sure
that it is unsigned rather than possibly set to something negative
by a malicious binary.

This is just the immediate fix to the problem mentioned in
PR kern/80742 and by http://milw0rm.com/exploits/9206 but does
not fix all possible problems imgact_pecoff has.

As this feature does not work and is not compiled in by default,
the security team considers this vulnerability to be of low risk
to the user population and will not be issuing an advisory.

Note that this is a direct commit to stable/7 as pecoff support has
been removed from head and stable/8 already.

PR:		kern/80742
Reported by:	Oliver Pinter (oliver.pntr gmail.com) via freebsd-security
Help reproducing and testing by: Damian Weber (dweber htw-saarland.de)
MFC After:	3 days
2009-11-16 20:34:53 +00:00
Christian Brueffer b03cad211b MFC: r199046
Fix a copy+paste error by checking the correct variable against MM_NULLACT.
2009-11-16 08:27:54 +00:00
Doug Barton d3888e47c9 MFC r199127:
Add a note about no hostname leading to "Amnesiac" on the console

The text is inspired by the PR, but more in line with the existing text

PR:		docs/140434
Submitted by:	Jason Helfman <[email protected]>

MFC r199152:
s/a default/the default/

Submitted by:	remko

MFC r199299:
In r199127/r199152 I forgot to bump .Dd
2009-11-15 23:51:59 +00:00
Stanislav Sedov d1997dadd9 - MFC r198320:
Introduce new option BCE_JUMBO_HDRSPLIT that allows user to enable header
  in bce(4) instead of (ab)using ZERO_COPY_SOCKETS that was not
  into if_bce.c anyway.  It is disabled by default.
2009-11-15 11:43:28 +00:00
Robert Noland d9fe61548c MFC r199241
This patch addresses an overflow in the the zfs boot code and allows
users to boot from zfs raidz volumes.  This has been tested by a number
of users and does not impact those which are not booting from zfs raidz
volumes.

Submitted by:	Matt Reimer <[email protected]>
2009-11-14 18:53:44 +00:00
Alexander Leidinger ba81193591 MFC r198945:
Fix typo in kernel message. The fix is based upon the patch in the PR.

  PR:		kern/140279
  Submitted by:	Alexander Best <[email protected]>
2009-11-12 14:27:09 +00:00
Edwin Groothuis 2c1d8d6288 MFC of r199107, tzdata2009r:
- Three Australian stations in Antarctica have changed their time zone:
  Casey moved from UTC+8 to UTC+11
  Davis moved from UTC+7 to UTC+5
  Mawson moved from UTC+6 to UTC+5
  The changes occurred on 2009-10-18 at 02:00 (local times).
2009-11-12 10:44:25 +00:00
Navdeep Parhar b7973b4cec MFC r195747 2009-11-11 19:00:12 +00:00
Alexander Motin ff502eb04c MFC r198488:
Report SATA speeds to CAM, to not confuse users with low numbers logged.
2009-11-10 23:03:51 +00:00
Alexander Motin d77ff790d1 MFC r188740, r198486, r199050:
Increase ATA command timeouts. Introduce define and kernel option
ATA_REQUEST_TIMEOUT to control it.

PR:		kern/111023
2009-11-10 22:56:05 +00:00
Xin LI 23238d0364 MFC revision 199069:
Initialize the whole message unit's DMA buffer to zero, this fixes a panic
during boot when ARC1200 is being used with certain motherboard models.

This commit brings the driver to the same state of vendor's 1.20.00.16
release.  Many thanks to Areca for their continued support to FreeBSD.
2009-11-10 01:12:00 +00:00
Edwin Groothuis 2ab31cc466 MFC of 198831, tzcode2009q
- Cleanup unnecessary local variables in zdump.
- Fix man-page
2009-11-09 11:32:34 +00:00
Doug Barton 943aa84491 MFC r198162:
Allow $name_program to override $command in a more robust way that
will not cause the value to be null if $command is not set.
2009-11-07 23:37:29 +00:00
Doug Barton b6f7094486 Forcibly remove the svn:mergeinfo on this file now that it's been
pulled up into etc/
2009-11-07 23:24:17 +00:00
Doug Barton e11f5aba5a Manually remove a duplicate fortune that I cannot find the commit log for 2009-11-07 22:47:12 +00:00
Doug Barton 119846c900 Mass MFC of older commits to bring these files up to date with HEAD:
r174581, r174597, r174897, r175017, r175129, r175213, r176638, r176639,
r176764, r177781, r177879, r178604, r178605, r178662, r179960, r179987,
r180286, r180341, r181207, r183691, r183707, r189448

MFC r197797:
s/Putluck Pogo/Potluck Pogo/

MFC r198921:
Grammar/formatting fix

MFC 199021:
Remove svn:executable from datfiles/gerrold.limerick

MFC r199023:
Move VCS fortune to fortunes-o

MFC 199025:
Sort fortune
2009-11-07 22:40:13 +00:00
John Baldwin 2e85a23f96 MFC 198620:
When fetching sum stats (vmstat -s) from a crash dump, fetch per-CPU counts
and sum them to form the total counts.
2009-11-06 20:33:53 +00:00
John Baldwin a6cb1105ec MFC 198367:
Set the devclass_t pointer specified in the DRIVER_MODULE() macro
sooner so it is always valid when a driver's identify routine is
called.
2009-11-06 20:23:42 +00:00
Attilio Rao 81eec5505b MFC r198868, r198950:
Opteron rev E family of processor expose a bug where acq memory barriers
can be broken, resulting in random breakages.
Printout a warning message if affected family and model are found.
2009-11-06 10:38:33 +00:00
Christian Brueffer 9ad011d342 MFC: r198684
Add support for Adaptec 39320LPE adapters.
2009-11-06 06:57:03 +00:00
Ed Maste 25b5a5e1dd MFC r198525:
Whitespace fixup: 8 spaces -> tab
2009-11-05 18:38:12 +00:00
Ed Maste cc6658f5c8 MFC r197437:
Use %zu for size_t, not %zd.
2009-11-05 02:29:45 +00:00
John Baldwin 4c11b4fd0b MFC 198554:
Fix some problems with effective mmap() offsets > 32 bits.  This was
partially fixed on amd64 earlier.  Rather than forcing linux_mmap_common()
to use a 32-bit offset, have it accept a 64-bit file offset.  This offset
is then passed to the real mmap() call.  Rather than inventing a structure
to hold the normal linux_mmap args that has a 64-bit offset, just pass
each of the arguments individually to linux_mmap_common() since that more
closes matches the existing style of various kern_foo() functions.
2009-11-04 20:53:35 +00:00
Pyun YongHyeon 697651baa6 MFC r197461:
Use __NO_STRICT_ALIGNMENT to determine whether de(4) have to apply
  alignment fixup code for received frames on strict alignment
  architectures.

MFC r197463:
 Consistently use bus_addr_t.

MFC r197464:
  Destroy dmamap in dma cleanup.

MFC r197465:
  Align Tx/Rx descriptors on 32 bytes boundary instead of PAGE_SIZE.
  Also align setup descriptor on 32 bytes boundary. Tx buffer have no
  alignment limitation so create dmamap without alignment
  restriction[1]. Rx buffer still seems to require 4 bytes alignment
  limitation but we can simply use MCLBYTES for size to map the
  buffer instead of TULIP_DATA_PER_DESC as the buffer is allocated
  with m_getcl(9).
  de(4) supports up to TULIP_MAX_TXSEG segments for Tx buffers,
  increase maximum dma segment size to TULIP_MAX_TXSEG * MCLBYTES.
  While I'm here remove TULIP_DATA_PER_DESC as it is not used anymore.

  This should fix de(4) breakage introduced after r176206.
  Submitted by:	jhb [1]
  Reported by:	WATANABE Kazuhiro < CQG00620 <> nifty dot ne dot jp >
  Tested by:	WATANABE Kazuhiro < CQG00620 <> nifty dot ne dot jp >,
		Takahashi Yoshihiro < nyan <> jp dot freebsd dot org >
2009-11-04 19:01:35 +00:00
Pyun YongHyeon 44e354768c MFC r197586:
It seems some 82559ER controllers do not support Rx checksum
  offloading. Datasheet said nothing about the limitation of 82559ER
  except WOL. Explicitly disable Rx checksum offloading for
  controllers that is known to lack the capability.

  PR:	kern/138135
  Tested by:	Gooderum, Mark < mgooderum <> websense dot com >
2009-11-04 18:34:14 +00:00
Pyun YongHyeon 8ce8529571 MFC r194574:
For ICH based fxp(4) controllers treat them as 82559 compatibles.
  To detect which controller is ICH based one, add a new member
  variable ich to struct fxp_ident and move the struct to
  if_fxpvar.h. Since I've faked controller revision, don't allow
  microcode loading for ICH based controllers.
  With this change all ICH based controllers will have WOL and Rx
  checksum offload capability.

  PR:		kern/135451
  Tested by:	Alexey Shuvaev ( shuvaev <> physik dot uni-wuerzburg dot de ),
		pluknet ( pluknet <> gmail dot com ),
		Gary Jennejohn ( gary.jennejohn <> freenet dot de )
2009-11-04 18:22:59 +00:00
Pyun YongHyeon d95b2f6f5b MFC r194573:
Overhaul fxp(4) multicast filter programming. fxp(4) hardwares do
  not allow multicast filter programming when controller is busy to
  send/receive frames. So it used to mark need_mcsetup bit and defer
  multicast filter programming until controller becomes idle state.
  To detect when the controller is idle fxp(4) relied on Tx
  completion interrupt with NOP command and fxp_start_body and
  fxp_intr_body had to see whether pending multicast filter
  programming was requested. This resulted in very complex logic and
  sometimes it did not work as expected.
  Since the controller should be in idle state before any multicast
  filter modifications I changed it to reinitialize the controller
  whenever multicast filter programming is required. This is the same
  way what OpenBSD and NetBSD does. Also I added IFF_DRV_RUNNING
  check in ioctl handler so controller would be reinitialized only if
  it is absolutely needed.
  With this change I guess we can remove fxp(4) DELAY hack in ifioctl
  for IPv6 case.
2009-11-04 18:20:31 +00:00
Pyun YongHyeon 4e5820a7eb MFC r194572:
Always check fxp(4) is running, see if it can accept frames from
  upper stack in fxp_start_body().
  fxp(4) drops driver lock in Rx path so check the fxp(4) is still
  running after reacquiring driver lock in Rx path. Also don't
  invoke fxp_intr_body if fxp(4) is not running. With this change
  there is no need to set suspend bit in device attach phase.
2009-11-04 18:18:09 +00:00
Pyun YongHyeon 9126ab386a MFC r194571:
Don't blindly enable Rx lock-up workaround. Newer chips do not need
  the Rx lock-up workaround.

  Obtained from:        NetBSD
2009-11-04 18:14:19 +00:00
Pyun YongHyeon ea68594674 MFC r194570:
Due to possible PCI bus lock-up issues fxp(4) didn't perform full
  hardware reset in attach phase. Selective reset does not clear
  configured parameters so I think full hardware reset is required.
  To prevent PCI bus lock-up, do selective reset first which will get
  off the controller from PCI bus and request software reset after
  selective reset. Software reset will unmask interrupts so disable
  it after the reset.
2009-11-04 18:08:53 +00:00
Pyun YongHyeon dbb6da1928 MFC r194569:
Introduce Rx mbuf dma tag and use it in Rx path. Previously it used
  common mbuf dma tag for both Tx and Rx path but Rx buffer should
  have single DMA segment and maximum buffer size of the segment
  should be less than MCLBYTES.
  fxp(4) also have to check Tx completion status which was updated by
  DMA so we need BUS_DMASYNC_PREREAD and BUS_DMASYNC_POSTWRITE
  synchronization in Tx path. Fix all misuse of bus_dmamap_sync(9) in
  fxp(4). I guess this change shall fix occasional driver breakage in
  PAE environments.

  While I'm here add error messages of dma tag/buffer creation and
  correct messages.
2009-11-04 18:07:09 +00:00
Pyun YongHyeon c39a20304a MFC r193875:
Controller will dma SCB command status for a given command and
  driver should read updated status back after issuing a SCB command.
  To send a command to controller and read updated status back,
  driver should synchronize both memory read and write operations
  with device. Fix bus_dmamap_sync operation specifier used in
  fxp_dma_wait() by adding both memory read and memory write
  operations.
2009-11-04 18:03:19 +00:00
John Baldwin 68e57603ac MFC 197772:
When the timeout backoff hits the maximum value, leave it capped at the
maximum value rather than setting it to the result of a boolean expression
that is always true.
2009-11-04 16:59:21 +00:00
John Baldwin ee2750d788 MFC 198586: Include the output of the ddb(4) capture buffer. 2009-11-04 16:05:18 +00:00
John Baldwin 09bf0069fc MFC 198585:
When extracting the capture buffer from a crashdump, only read the valid
portion of the capture buffer.
2009-11-04 16:03:58 +00:00
Christian Brueffer fb6672a6f6 MFC: r198542
Initialize f_rabuf in the raw device case. A subsequent close()
later on would try to free it, leading to a crash.
2009-11-04 13:40:50 +00:00
Christian Brueffer b79155a7a5 MFC: 198539
Close a stream file descriptor leak.
2009-11-04 13:32:25 +00:00
Christian Brueffer a469a3e488 MFC: r198537
Close a file descriptor leak in an error case.
2009-11-04 13:08:57 +00:00
Christian Brueffer 80f55f2660 MFC: r198546
Remove spurious `)`
2009-11-04 12:38:21 +00:00
Edwin Groothuis f9c4a94b40 MFC of r198825: tzdata2009q
- New region: Asia/Novokuznetsk
- Kemerovo oblast' (Kemerovo region) in Russia will change current
  time zone on 29 March 2010
- Add historical data for Hongkong 1941 - 1980
- Syria will go to winter time in the last weekend of October 2009.
2009-11-04 10:47:09 +00:00
Ed Maste b3a609043d MFC r197011:
Increase AAC_CMD_TIMEOUT from 30s to 120s to help avoid spurious
  "COMMAND 0x........ TIMEOUT AFTER .. SECONDS" messages.  Any commands
  that get truly stuck will still trigger the warning and the hardware
  health check, just a little bit later.
2009-11-02 16:55:33 +00:00
Ed Maste c4a286d0b2 MFC r197082:
If the pxe client is told to use / as the root path, honour that rather
  of trying to mount /pxeroot instead.

PR:		i386/106493
Submitted by:	Andrey Russev
2009-11-02 16:46:53 +00:00
Ed Maste bb33b7b532 MFC r198029:
Correct typo: thetime -> the time

PR:		docs/139447
Submitted by:	Guido Falsi  mad at madpilot dot net
2009-11-02 16:29:04 +00:00
Ed Maste 3d72d5ddc8 MFC r198541:
Do first controller time sync after 1 minute, as in Adaptec's vendor
  driver.
2009-11-02 16:25:00 +00:00
Robert Noland b00d29caa8 MFC 198696
Cleanup in r600_blit

     - Don't bother to assign vb until we know we have enough space
     - Add variables for sx2, sy2, dx2, dy2 so that these aren't
       calculated over and over, also reduce chance of errors.
     - Use switch to assign color/format
2009-11-02 16:02:36 +00:00
Robert Noland 4bd43f7325 MFC 198695
A bit of cleanup work on radeon_freelist_get()

 * Fix the main loop to search all buffers before sleeping.
 * Remove dead code
2009-11-02 16:00:01 +00:00
Robert Noland 728f8a4e6c MFC 198691
Fix blitter support for RS880 chips
2009-11-02 15:54:41 +00:00
Max Khon f4021b6c2a MFC: Allow KMOD with hypens and dots. 2009-11-02 09:47:41 +00:00
Andriy Gapon d76c786d0b MFC 197450: number of cleanups in i386 and amd64 pci md code 2009-11-01 18:40:03 +00:00
Andriy Gapon 899565855d MFC 198272, 198288: fix watchdogd(8) reference 2009-11-01 18:19:00 +00:00
Andriy Gapon 219690c237 MFC 198279: fix sorting of some amd* entries in some makefiles 2009-11-01 17:58:56 +00:00
Andriy Gapon a762ae550e MFC 198271: add amdtemp to i386 NOTES 2009-11-01 17:54:49 +00:00
Andriy Gapon f29e1eec2d MFC 197658: print machine in kernel boot version string
PR:		kern/126926
2009-11-01 17:42:59 +00:00
Andriy Gapon 203b8450fe MFC 197641: print_caddr_t: drop incorrect __unused from parameter 2009-11-01 17:37:03 +00:00
Andriy Gapon 74dc468928 MFC 196399: fstat: fix fsid comparison on systems with 64-bit long 2009-11-01 17:15:38 +00:00
Andriy Gapon 23cbb00cb2 MFC r197128,197325: add support for smbus controller found in AMD SB700 2009-11-01 11:41:20 +00:00
Christian Brueffer 03f57b52c1 MFC: r198609
Revert part of r198363, there is no "device cam", it is
included in "device scbus".
2009-11-01 10:57:07 +00:00
Alan Cox befbc48918 MFC r197317
When superpages are enabled, add the 2 or 4MB page size to the array of
  supported page sizes.
2009-11-01 08:48:30 +00:00
Alan Cox ed8a6399c5 MFC r197316
Add a new sysctl for reporting all of the supported page sizes.
2009-11-01 08:45:44 +00:00
Alan Cox 3c497f0868 MFC r198472
Eliminate an unnecessary check from vm_fault_prefault().
2009-10-31 18:46:55 +00:00
Alexander Motin 44d79388fe MFC rev. 196893:
Remove constraint, requiring request data to fulfill controller's alignment
requirements. It is busdma task, to manage proper alignment by loading
data to bounce buffers.

PR:		kern/120787, kern/127316
2009-10-31 17:28:08 +00:00
Christian Brueffer 3d27db0e38 MFC: 198356
Fix a memory leak in an error case.
2009-10-31 11:23:54 +00:00
Christian Brueffer 7f77539837 MFC: r198327
Add a missing free() call.
2009-10-31 11:21:45 +00:00
John Baldwin 9dc8c7f09f MFC 192106: Port mca(4) to pc98.
Pointy hat to:	jhb
2009-10-30 19:25:13 +00:00
Robert Noland 0b3aaa5623 MFC r197950 (record only)
Add pci id's for Intel G41 chipset
2009-10-30 16:49:38 +00:00
Robert Noland ebfc6e302e MFC r197951
Add support for Intel G41 chipset
2009-10-30 16:38:53 +00:00
Robert Noland 089d410cdc MFC r196470-196471,197154-197155,197603-197606
Sync radeon drm support

This adds kernel support for r6/7xx 3D.
2009-10-30 16:35:47 +00:00
Robert Noland 80148512a1 MFC r196466
Add a read only sysctl tracking the hw.drm.msi tunable.
2009-10-30 16:21:09 +00:00
Robert Noland 6be9a4953f MFC r196464
Clean up the locking in drm_alloc_resource()
2009-10-30 16:07:06 +00:00
Robert Noland bbf7944b64 MFC r198097
Set the active flag in the PMBR when we install bootcode on a GPT
partitioned disk.  Some BIOS require this to be set before they will
boot the device.
2009-10-30 15:45:40 +00:00
Alexander Motin 516437fdcd MFC rev. 197621:
Fix bug, when RADIUS client gave up after single sendto() error, do not
trying backup servers.

PR:             kern/103764, misc/139214
2009-10-30 13:03:08 +00:00
Alexander Motin 78e2f25c26 MFC rev. 197086:
Add simple embedded RADIUS server support to libradius, by extending existing
API, keeping backward compatibility.

First consumer for this functionality is going to become forthcoming MPD-5.4,
supporting CoA and DR of RFC 3576: Dynamic Authorization Extensions to RADIUS.
2009-10-30 12:59:22 +00:00
John Baldwin a70c0d78f8 MFC 197439:
Extract the code to find and map the MADT ACPI table during early kernel
startup and genericize it so it can be reused to map other tables as well:
- Add a routine to walk a list of ACPI subtables such as those used in the
  APIC and SRAT tables in the MI acpi(4) driver.
- Move the routines for mapping and unmapping an ACPI table as well as
  mapping the RSDT or XSDT and searching for a table with a given signature
  out into acpica_machdep.c for both amd64 and i386.
2009-10-29 17:15:22 +00:00
Christian Brueffer 4a616dc5d0 MFC: r198314
Add empty watchdogd_flags.
2009-10-29 16:39:27 +00:00
John Baldwin 3fe826a6a0 MFC 198085:
Add a manual page for BUS_BIND_INTR() and bus_bind_intr().
2009-10-29 15:39:30 +00:00
John Baldwin 0dff355794 MFC 197649:
Do not hold the ACPI A/C adapter lock when changing the power profile.
2009-10-29 15:28:30 +00:00
John Baldwin 83d294de1c MFC 197648:
Split the 'video' ACPI lock up into two locks to resolve a LOR with the
sysctl lock.  The 'video' lock now protects the 'bus' of video output
devices attached to a graphics adapter.  It is used when iterating over
the list of outputs, etc.  The 'video_output' lock is used to lock the
output-specific data similar to a driver lock for the individual video
outputs.
2009-10-29 15:25:22 +00:00
John Baldwin 6734177c67 MFC 196840:
Fill the reverse RSS map with 0xff's so that the subsequent loop to
calculate the values will work properly.
2009-10-29 15:18:24 +00:00
John Baldwin f5fa75a4b0 MFC 197460:
Remove unnecessary locking from attach().  This fixes a LOR between the
acpi_ibm lock and the sysctl lock.
2009-10-29 15:13:50 +00:00
John Baldwin a22b47a852 MFC 196615:
Extend the device pager to support different memory attributes on different
pages in an object.
- Add a new variant of d_mmap() currently called d_mmap2() which accepts
  an additional in/out parameter that is the memory attribute to use for
  the requested page.
- A driver either uses d_mmap() or d_mmap2() for all requests but not both.
  The current implementation uses a flag in the cdevsw (D_MMAP2) to indicate
  that the driver provides a d_mmap2() handler instead of d_mmap().  This
  is done to make the change ABI compatible with existing drivers and
  MFC'able to 7 and 8.
2009-10-29 15:10:38 +00:00
John Baldwin 66ff58ab30 MFC 196555:
- Use the headers from ACPI-CA to define various constants and structures
  for table layouts, etc. rather than homerolling our own structures and
  constants in acpidump.h.
- Verify the extended checksum on the RSDP.
- One side effect in this branch is that we lose support for parsing SRAT
  X2APIC entries since the ACPI-CA headers do not include those.  I have
  yet to see one of these in the wild, however.
2009-10-29 14:52:32 +00:00
John Baldwin 2d7f3466cb MFC 192050, 192343, 192440:
Implement simple machine check support for amd64 and i386.  It is disabled
by default but can be enabled via the 'hw.mca.enabled' tunable.
2009-10-29 14:34:02 +00:00
Ed Maste b79a61ca33 MFC r195614:
Get correct maxio from the controller and drop the tunable.
  The default (64K) is too pessimistic for "new comm" hardware.
  Also, this is bad because multiple controllers get limited by
  the global tunable.

At this point stable/7 and stable/8 are in sync, modulo KPI changes.
2009-10-29 13:41:05 +00:00
Edwin Groothuis d769d27c9c MFC of r197189
Improve the way failure of pthread_key_create() gets detected.

PR:           threads/138603
Submitted by: Mikulas Patocka
2009-10-29 11:00:39 +00:00
Edwin Groothuis 3739d8e0dc MFC of r198270, r198515.
MFC of tzdata2009o:
- Somoa has not moved to DST this year (comment only)
- Bangladesh stays on DST for now.
- Pakistan went back to standard time in 1 October 2009

MFC of tzdata2009p:
- Argentina does not go to DST this year.
2009-10-28 21:13:12 +00:00
Christian Brueffer 0c5db12182 MFC: r198363
List more dependencies for these drivers. While here, convert
atapicam(4) to use our standard section 4 SYNOPSIS layout.
2009-10-28 17:46:52 +00:00
Christian Brueffer 9c184f67ba MFC: r198313
Improve the description of the malofw kernel module installation.
2009-10-28 17:41:29 +00:00
Ed Maste bbe2e985d8 MFC r185376:
Remove duplicate 2610SA entry.
2009-10-28 15:09:21 +00:00
Ed Maste 6c852acc27 MFC r188896
Sync with the official Adaptec vendor driver:

  [1]	Add the support for the NARK controller which seems a variant of
	the i960Rx.
  [2]	Split up memory regions and other resources in 2 different parts
	as long as NARK uses them separately (it is not clear to me
	why though as long as there are no more informations available
	on this controller). Please note that in all the other cases,
	the regions overlaps leaving the default behaviour for all the
	other controllers.
  [3]	Implement a clock daemon responsible for maintain updated the
	wall clock time of the controller (run any 30 minutes).

(Replace callout_schedule with callout_reset for [3].)
2009-10-28 02:20:29 +00:00
Ed Maste 517fb9d8b6 MFC r188743,r188940
Use outbound message register 0 instead of mailbox 7 in
  aac_{rx,rkt}_get_fwstatus, as done in Adaptec's vendor driver as well as
  the Linux drivers.

  Submitted by:   jkim, from Adaptec's driver

==

  SVN rev 188743 modified aac_rx_get_fwstatus to use the AAC_RX_OMR0
  register instead of AAC_RX_FWSTATUS, as that is the way it's done in
  Adaptec's vendor driver and in the Linux drivers.  (The same applies
  to aac_rkt_get_fwstatus as well.)

  However, a concern has been raised about the compatibility of this
  change and old hardware / firmware versions.  In the absense of
  specific information, revert to the original behaviour if the firmware
  does not support the "New comm." interface.  Users of old cards or
  firmware haven't reported the problems that are potentially solved by
  switching to OMR0.
2009-10-27 21:09:52 +00:00
Andrew Gallatin 197912a8b4 MFC: recent mxge watchdog improvements:
194909: add a dying flag (as a dependency)
198250: Move mxge(4)'s NIC watchdog reset handler to a taskqueue
198303: Check config space to react more quickly to failures
2009-10-27 18:30:26 +00:00
John Baldwin c12c0e732c MFC 196212,196283:
Add mptutil, a basic utility for managing MPT SCSI/SATA/SAS controllers.
Drive and controller status can be reported, basic attributes changed,
and arrays and spares can be created and deleted.
2009-10-26 19:06:05 +00:00
John Baldwin a2510069c0 MFC 196200,196211,196280-196282:
Introduce mfiutil, a basic utility for managing LSI SAS-RAID & Dell PERC5/6
controllers.  Controller, array, and drive status can be checked, basic
attributes can be changed, and arrays and spares can be created and deleted.
Controller firmware can also be flashed.

This does not replace MegaCLI, found in ports, as that is officially sanctioned
and supported by LSI and includes vastly more functionality.  However, mfiutil
is open source and guaranteed to provide basic functionality, which can be
especially useful if you have a problem and can't get MegaCLI to work.
2009-10-26 18:57:57 +00:00
Andrew Gallatin c594de7f35 Fix firmware module build when it is not
built with the kernel (eg, make world when MODULES_WITH_WORLD
is defined)

Submitted by:	Andre Albsmeier at siemens dot com
Pointy hat to: gallatin
2009-10-24 18:38:13 +00:00
John Baldwin bf63f02306 MFC 198174:
Close a race with caching of -ve name lookups in the NFS client.
Specifically, clients only trust -ve cache entries while the directory
remains unchanged and discard any -ve cache entries for a directory when
they notice that the modification time of a directory entry changes.  The
race involves two concurrent lookups as follows:
- Thread A does a lookup for file 'foo' which sends a lookup RPC to the
  server.  The lookup fails and the server replies.
- The 'foo' file is created (either by the same client or a different
  client) updating the modification time on the parent directory of 'foo'.
- Thread B does a lookup for a different file 'bar' which updates the
  cached attributes of the parent directory of 'foo' to reflect the new
  modification time after 'foo' was created.
- Thread A finally resumes execution to parse the reply from the NFS
  server.  It adds a -ve cache entry and sets the cached value of the
  directory's modification time that is used for invalidating -ve cached
  lookups to the new modification time set by thread B.

At this point, future lookups of 'foo' will honor the -ve cached entry
until the cached entry is pushed out of the name cache's LRU or the
modification time of the parent directory is changed again by some other
change.  The fix is to read the directory's modification time before
sending the lookup RPC and use that cached modification time when setting
the directory's cached modification time.  Also, we do not add a -ve cache
entry if another thread has added -ve cache entry that set the directory's
cached modification time to a newer value than the value we read before
sending the lookup RPC.
2009-10-23 19:53:04 +00:00
Philip Paeps 69388694c0 MFC r198352
Make dhclient use bootpc (68) as the source port for unicast
  DHCPREQUEST packets instead of allowing the protocol stack to pick
  a random source port.

  This fixes the behaviour where dhclient would never transition
  from RENEWING to BOUND without going through REBINDING in networks
  which are paranoid about DHCP spoofing, such as most mainstream
  cable-broadband ISP networks.

Obtained from:	OpenBSD
Reviewed by:	brooks
2009-10-23 15:12:05 +00:00
Christian Brueffer f8dcf23acf MFC: r198232
Powercrypt and NetSec seem to be defunct (webpages point to link farms
and a google search yields no alternative).  Remove the links but
keep the entries around for reference.
2009-10-22 08:36:08 +00:00
Alexander Motin 7234eaa16f MFC rev. 178375:
Add HW level support for the Adaptec 1420SA controller.
2009-10-21 16:12:09 +00:00
Hajimu UMEMOTO ad7636638e MFC r198189: Check error of dlfunc(3). 2009-10-20 13:47:05 +00:00
John Baldwin 615899fe48 MFC 198126:
Fix a sign bug in the handling of nice priorities when computing the
interactive score for a thread.
2009-10-19 19:45:57 +00:00
Andrew Gallatin 7c6becb604 MFC of 178042 to allow safe firmware(9) loading from NIC watchdog handlers.
Also MFCed are the related changes 178016, 183614 and 184842.

178042: Do firmare image loading in a context known to have a root directory
183614: Dynamically allocate the task struct in firmware mountroot
184842: Avoid scheduling firmware taskqueues when cold
178016: Add a mountroot event handler.  Removal of SI_SUB_MOUNT_ROOT
        was not merged.

This fixes a panic in at least mxge(4) if the NIC has a hardware fault
when the firmware image is not resident.

Reviewed by:	jhb
2009-10-19 19:11:00 +00:00
John Baldwin 1c8b86da83 MFC 198079:
Use zfs_read() instead of xfsread() to read /boot.config.  xfsread() fails
short read requests, so the result was that a /boot.config smaller than 512
bytes was ignored.  boot2 uses fsread() instead of xfsread() to read
/boot.config already, so this makes zfsboot more like boot2.
2009-10-19 18:52:05 +00:00
Christian Brueffer 0221485a48 MFC: r198125
Use our standard section 4 SYNOPSIS.
2009-10-19 08:52:57 +00:00
Ermal Luçi d80676c403 Fix typo which has survived amazingly long!
Approved by:	mlaier(mentor)
2009-10-14 15:37:03 +00:00
Konstantin Belousov 7ac2c95ef8 MFC r197958:
In nanosleep(2), note that the calling thread is put to sleep, not the
whole process. Also explicitely name the parameter that specifies
sleep interval.
2009-10-14 14:29:29 +00:00
Doug Barton 60670b8977 MFC r196439: typo and caps fixes 2009-10-14 03:35:15 +00:00
Pyun YongHyeon 87da1c2492 MFC 191345:
To make it easy whether xl(4) missed Tx completion interrupt check
  number of queued packets in watchdog timeout handler. If there are
  no queued packets just print a informational message and return
  without resetting controller. Also fix to invoke correct Tx
  completion handler as 3C905B needs different handler.
2009-10-13 17:56:48 +00:00
Pyun YongHyeon 2c9f2a280d MFC 191344:
Clear IFF_DRV_OACTIVE flag if one of queued packets was transmitted.
  Previously it used to clear the flag only when the transmit queue
  is empty which may slow down Tx performance.
  While I'm here check whether driver is running and whether we can
  queue more packets in if_start handler. This fixes occasional
  watchdog timeouts.
2009-10-13 17:33:55 +00:00
Attilio Rao 386509143d MFC r197476:
In function do_rw_wrlock, when a writer got an error and before returning,
check if there are readers blocked by us via URWLOCK_WRITE_WAITERS flag,
and resume the readers. The error must be EAGAIN, otherwise there must
have memory problem, and nobody can rescue the buggy application.

Approved by:	davidxu
2009-10-13 13:47:30 +00:00
Dmitry Morozovsky e26ec765aa MFC r197172:
Add missing newline.

Approved by:	pjd
2009-10-13 10:14:38 +00:00
Attilio Rao e67e2bbf8b MFC r197803, r197824, r197910:
Per their definition, atomic instructions used in conjuction with
memory barriers should also ensure that the compiler doesn't reorder paths
where they are used.  GCC, however, does that aggressively, even in
presence of volatile operands.  The most reliable way GCC offers for avoid
instructions reordering is clobbering "memory".
Not all our memory barriers, right now, clobber memory for GCC-like
compilers.
Fix these cases.
2009-10-12 16:11:25 +00:00
Attilio Rao f1eba092fe MFC r1979643:
When releasing a read/shared lock we need to use a write memory barrier
in order to avoid, on architectures which doesn't have strong ordered
writes, CPU instructions reordering.
2009-10-12 15:56:27 +00:00
Christian Brueffer dcb9da0003 MFC: r197312
Fix setfib(1) section number.
2009-10-12 12:54:34 +00:00
Christian Brueffer 8856f45d65 MFC: r197274
Fix the example, -w is the right switch for write failure probability.
2009-10-12 12:21:37 +00:00
Simon L. B. Nielsen a53ee0a6dc MFC r197835:
- Document that 'Dell PowerEdge R710' has bce(4) supported NIC.
- Bump document date.
2009-10-11 16:39:16 +00:00
Stefan Farfeleder f1c195672c Merge r191009.
> Parse 'cmd1 && ! cmd2 | cmd3' correctly, the bang should apply to the entire
> pipeline cmd2 | cmd3 and not just cmd2.
2009-10-08 17:11:01 +00:00
Konstantin Belousov d495dad062 MFC r197662:
Do not dereference vp->v_mount without holding vnode lock and checking
that the vnode is not reclaimed.
2009-10-08 11:42:24 +00:00
Sean Nicholas Barkas a788dee277 MFC r193375, r194387, r195003:
Add vm_lowmem event handler for dirhash. This will cause dirhashes to be
deleted when the system is low on memory. This ought to allow an
increase to vfs.ufs.dirhash_maxmem on machines that have lots of memory,
without degrading performance by having too much memory reserved for
dirhash when other things need it. The default value for dirhash_maxmem
is being kept at 2MB for now, though.

Approved by:	dwmalone (mentor)
2009-10-08 09:03:04 +00:00
Doug Barton 6bfaa78a55 MFC r197725:
The 6bone was decommissioned on 6/6/06, so remove references to it.
2009-10-06 22:19:32 +00:00
Jilles Tjoelker c51faa9c46 MFC r197625: Fix using lp(1) without the new -t option after r195349. 2009-10-06 21:49:13 +00:00
Joe Marcus Clarke 383737d501 MFC: rev. 197681
Correct the pthread stub prototype for pthread_mutexattr_settype to allow for
the type argument.  This is known to fix some pthread_mutexattr_settype()
invocations, especially when it comes to pulseaudio.

Approved by:	kib
2009-10-04 21:48:17 +00:00
Jilles Tjoelker d082285ef7 MFC r197363: Update find(1) man page for -L/-delete interaction.
It is a bit unfortunate that the example to delete broken symlinks now uses
rm(1), but allowing this with -delete would require fixing fts(3) to not
imply FTS_NOCHDIR if FTS_LOGICAL is given (or hacks in the -delete option).

PR:		bin/90687
2009-10-04 17:22:51 +00:00
Jilles Tjoelker 18febd4734 MFC r197371: Mention that NUL characters are not allowed in sh(1) input.
I do not consider this a bug because POSIX permits it and argument strings
and environment variables cannot contain '\0' anyway.

PR:		bin/25542
2009-10-04 17:16:11 +00:00
Konstantin Belousov cf260edc3d MFC r197661:
Move the annotation for vm_map_startup() immediately before the function.
2009-10-04 13:03:07 +00:00
Konstantin Belousov 95558a5a17 MFC r197660:
Fix typo.
2009-10-04 13:00:27 +00:00
Simon L. B. Nielsen b858926620 MFC r197711 (partial) to 6.x and 7.x:
- Add no zero mapping feature, disabled by default. [EN-09:05]

MFC 178913,178914,179242,179243,180336,180340 to 6.x:

- Fix kqueue pipe race conditions. [SA-09:13]

MFC r192301 to 7.x; 6.x has slightly different fix:

- Fix devfs / VFS NULL pointer race condition. [SA-09:14]

Security:	FreeBSD-SA-09:13.pipe
Security:	FreeBSD-SA-09:14.devfs
Errata:		FreeBSD-EN-09:05.null
Submitted by:	kib [SA-09:13] [SA-09:14]
Submitted by:	bz [EN-09:05]
In collaboration with:	jhb, kib, alc [EN-09:05]
Approved by:	so (simon)
2009-10-02 18:09:56 +00:00
Andrew Gallatin 49e12fb67e MFC: more fixes for mxge watchdog reset handling (194761 197645)
194761: Fix bug where device would loose promisc setting when reset.
197645: Restore the PCI Express control register after reset
2009-10-01 15:40:08 +00:00
Zachary Loafman bc584e4bd9 sched_ule in stable/7 has a bug (introduced in r180607) where a thread
that is running often will appear to not be running much at all.

sched_ule has a much less accurate mechanism for determining how much
various threads are running.  Every tick, hardclock_cpu() calls
sched_tick(), and the currently running thread gets it's ts_ticks
incremented.  Whenever an event of interest happens to a thread, the
ts_ticks value may be decayed; it's supposed to be a rough running
average of the last 10 seconds.  So there's a ts_ltick which is the last
tick we looked at decaying ts_ticks.

The increment in sched_tick() was slightly buggy on SMP, because a
thread could get incremented on two different CPUs in the rare case
where it was swapped from one which had run sched_tick() this tick to
one which hadn't.  The fix that was used relied on ts_ltick and only
incremented ts_ticks if ts_ltick was not from the current tick.
This is buggy, because any time the thread began running on a CPU in the
current tick, we would have set ts_ltick to ticks, so if it was still
running at sched_tick() we wouldn't increment.

A system with a single process that hogs the CPU and is otherwise idle,
therefore, would look like all threads were at 0%. The threads not
running are really at 0%, and the hog is not getting its ts_ticks
incremented since it went through some other runq stats that set
ts_ltick.  On a 2-way SMP the thread used to get shuffled regularly
between CPUs (I think fallout from this bug), so it would appear a
little over 50% busy.

The fix is to use a separate variable to record when the last
sched_tick() increment happened.

Submitted by:       Matthew Fleming (matthew.fleming at isilon.com)
Reviewed by:        zml, dfr
Approved by:        dfr (mentor)
2009-09-30 19:40:51 +00:00
Alexander Motin 292234263e Partial MFC rev. 191568:
Do not hide second channel of ATI IXP700 ATA controller.
While this chip indeed has only one PATA channel, second channel of the
controller is used by two SATA channels working in legacy emulation mode.
2009-09-29 16:19:48 +00:00
Xin LI 6e769f4643 MFC 193023+193024:
Add an option to enforce strict RFC 1034 compliance.
Document how to enable strict RFC 1034 enforcements.

PR:		kern/129477
2009-09-28 22:29:28 +00:00
Edwin Groothuis 76a6248201 MFC of r197597
Update to tzdata2009n:

Pakistan will go back from DST at 1 October.
Headsup for changes in Argentina.
2009-09-28 22:03:01 +00:00
Andrew Gallatin b4d223d905 MFC 197395: Improve mxge watchdog routine's ability to reliably reset a failed NIC 2009-09-28 15:10:08 +00:00
Stanislav Sedov f73eb28200 - MFC r196410 by peter@:
Fix signed comparison bug when ticks goes negative after 24 days of
   uptime.  This causes the tcp time_wait state code to fail to expire
   sockets in timewait state.
2009-09-26 20:07:48 +00:00
Max Laier 4efb43f675 MFC r197334,r197433:
Extract svn and git version info from git-svn repos.
2009-09-26 11:31:25 +00:00
Marius Strobl 8372626378 MFC: r197401
- According to Linux, the ALi M5451 can do 31-bit DMA instead of just
  30-bit like the reset of the controllers supported by this driver.
  Actually ALi M5451 can be setup up to generate 32-bit addresses by
  setting the 31st bit via the accompanying ISA bridge, which allows
  it to work in sparc64 machines whose IOMMU require at least 32-bit
  DMA. Even though other architectures would also benefit from 32-bit
  DMA, enabling this bit is limited to sparc64 as bus_dma(9) doesn't
  generally guarantee that a low address of BUS_SPACE_MAXADDR_32BIT
  results in a buffer in the 32-bit range.
- According to Tatsuo YOKOGAWA's ali(4), the the DMA transfer size of
  ALi M5451 is fixed to 64k and in fact using the default size of 4k
  causes the chip to overrun the mapping, triggering uncorrectable
  DMA errors on sparc64.
- The 4DWAVE DX and NX require the recording buffer to be 8-byte
  aligned so adjust the bus_dma_tag_create(9) accordingly.
- Unlike the rest of the controllers supported by this driver, the
  ALi M5451 only has 32 hardware channels instead of 64 so limit the
  loop in tr_intr() accordingly. [1]

Submitted by:	yongari [1]
Reviewed by:	yongari (superset of what is committed)
2009-09-25 19:59:48 +00:00
Marius Strobl f7e888d2a3 MFC: 197402
- Add missing bus_dmamap_sync(9) calls for the work DMA map. Previously
  the work area was totally unsynchronized which means this driver only
  had a chance of working on x86 when no bounce buffers were involved,
  which isn't that likely given that support for 64-bit DMA is currently
  broken throughout ata(4).
- Add necessary little-endian conversion of accesses to the work area,
  making this driver work on big-endian hosts. While at it, use the
  alignment-agnostic byte order encoders in order to be on the safe side.
- Clear the reserved member of the SG list entries in order to be on the
  safe side. [1]

Submitted by:	yongari [1]
Reviewed by:	yongari
2009-09-25 17:07:43 +00:00
John Baldwin 578745293e MFC 197415:
The elements in the component arrays may be direct Package objects rather
than references to objects.  In that case, simply use the Package directly.
2009-09-25 15:14:33 +00:00
John Baldwin aff13091a2 MFC 197410:
- Split the logic to parse an SMAP entry out into a separate function on
  amd64 similar to i386.  This fixes a bug on amd64 where overlapping
  entries would not cause the SMAP parsing to stop.
- Change the SMAP parsing code to do a sorted insertion into physmap[]
  instead of an append to support systems with out-of-order SMAP entries.
2009-09-25 15:08:51 +00:00
John Baldwin 174cb45571 MFC 197406:
Don't reread the command register to see if enabling I/O or memory
decoding "took".  Other OS's that I checked do not do this and it breaks
some amdpm(4) devices.  Prior to 7.2 we did not honor the error returned
when this failed anyway, so this in effect restores previous behavior.
2009-09-25 14:58:30 +00:00
Dmitry Morozovsky afc62ddda4 MFC r197150:
There is a bug where mze_insert() can trigger an assert() of inserting
  the same entry twice. This bug is not fixed yet, but leads to situation
  where when try to access corrupted directory the kernel will panic.
  Until the bug is properly fixed, try to recover from it and log that it
  happened.

  OpenSolaris bug:	6709336

Approved by:	pjd
2009-09-25 07:57:28 +00:00
John Baldwin 88369bc9d4 Manually remove mergeinfo from this file. For some reason svn didn't elide
this automatically as it should have during the previous revision.
2009-09-24 14:30:17 +00:00
Attilio Rao 5eb65aa739 MFC r197223:
Fix a deadlock in sched_switch_migrate given by the runqueues being not
locked at once together when doing the switch.
2009-09-24 09:08:22 +00:00
Ed Maste 5802a08b4d MFC r180603:
Use %zd for size_t.  With this gcore(1) is WARNS=6 clean.
2009-09-23 00:31:08 +00:00
Ed Maste f194c2d92f MFC r195134, r195135, r195191
r195134, r195134:
  Add a complement to FIONREAD, called FIONWRITE, which returns the
  number of bytes not yet properly disposed of.  Implement it for
  all sockets.

r195191:
  Add FIONSPACE from NetBSD.  FIONSPACE is provided so that programs
  may easily determine how much space is left in the send queue;
  they do not need to know the send queue size.
2009-09-22 23:11:23 +00:00
Marius Strobl e0d203f4e0 MFC: r195808
Add a MD __PCI_BAR_ZERO_VALID which denotes that BARs containing 0
actually specify valid bases that should be treated just as normal.
The PCI specifications have no indication that 0 would be a magic value
indicating a disabled BAR as commonly used on at least amd64 and i386
but not sparc64. It's unclear what to do in pci_delete_resource()
instead of writing 0 to a BAR though as there's no (other) way do
disable individual BARs so its decoding is left enabled in case of
__PCI_BAR_ZERO_VALID for now.

Approved by:	jhb
2009-09-20 18:59:30 +00:00
Marius Strobl 66fdacb8c2 MFC: r195149 (partial)
- Work around the broken loader behavior of not demapping no longer
  used kernel TLB slots when unloading the kernel or modules, which
  results in havoc when loading a kernel and modules which take up
  less TLB slots afterwards as the unused but locked ones aren't
  accounted for in virtual_avail. Eventually this should be fixed
  in the loader which isn't straight forward though and the kernel
  should be robust against this anyway. [1]
- Remove the no longer used global msgbuf_phys.
- Remove the redundant ekva parameter of pmap_bootstrap_alloc().
- Correct some outdated function names in ktr(9) invocations.

Requested by:	jhb [1]
2009-09-20 18:53:40 +00:00
Marius Strobl 0fda16165b MFC: r194764
- Update regarding the support for SBus GEM added in r194763 (MFC'ed
  in r197349).
- Improve the description a bit and add a reference to vlan(4).
2009-09-20 14:26:17 +00:00
Marius Strobl be43643ea0 MFC: r194763, r194886
- Initialize the ifnet structure, especially if_dname, before probing
  the PHYs as some PHY drivers use it (but probably shouldn't). How
  gem(4) has worked with brgphy(4) on powerpc without this so far is
  unclear to me.
- Call ether_ifdetach(9) before stopping the controller and the
  callouts. The consensus is that the latter is now safe to do and
  should also solve the problem of active BPF listeners clearing
  promiscuous mode can result in the tick callout being restarted
  which in turn will trigger a panic once it's actually gone.
- Introduce a dying flag which is set during detach and checked in
  gem_ioctl() in order to prevent active BPF listeners to clear
  promiscuous mode which may lead to the tick callout being restarted
  which will trigger a panic once it's actually gone.
- In gem_stop() reset rather than just disable the transmitter and
  receiver in order to ensure we're not unloading DMA maps still in
  use by the hardware. [1]
- The blanking time is specified in PCI clocks so we should use twice
  the value when operating at 66MHz.
- Spell some 2 as ETHER_ALIGN and a 19 as GEM_STATUS_TX_COMPLETION_SHFT
  to make the actual intentions clear.
- As we don't unload the peak attempts counter ignore its overflow
  interrupts.
- Remove a stale setting of a variable to GEM_TD_INTERRUPT_ME which
  isn't used afterwards.
- For optimum performance increment the TX kick register in multiples
  of 4 if possible as suggested by the documentation.
- Partially revert r164931; drivers should only clear the watchdog
  timer if all outstanding TX descriptors are done.
- Fix some debugging strings.
- Add a missing BUS_DMASYNC_POSTWRITE in gem_rint().
- As the error paths in the interrupt handler are generally unlikely
  predict them as false.
- Add support for the SBus version of the GEM controller. [2]
- Add some lock assertions.
- Improve some comments.
- Fix some more or less cosmetic issues in the code of the PCI front-end.
- Change some softc members to be unsigned where more appropriate and
  remove unused ones.

Obtained from:	NetBSD (partially) [2], OpenBSD [1]
2009-09-20 12:56:50 +00:00
Marius Strobl 86944a2538 MFC: r194249
Add cas(4).
2009-09-20 12:24:55 +00:00
Marius Strobl 1fcac653af MFC: r194248
Add cas(4).
2009-09-20 12:19:21 +00:00
Marius Strobl 370428a122 MFC: r194247
Add a man page for cas(4) and reference it as appropriate.
2009-09-20 12:14:42 +00:00
Marius Strobl acb21b18a9 - Remove unused variables. [1]
- Remove redundant zeroing of tmf_req which Coverity Prevent(tm) complains
  about. [2]

Submitted by:	Christoph Mallon [1]
Found with:	Coverity Prevent(tm) [2]
CID:		2496 [2]
2009-09-20 12:12:36 +00:00
Marius Strobl cb540dde75 MFC: 194246, 194904, 194973
Add cas(4), a driver for Sun Cassini/Cassini+ and National Semiconductor
DP83065 Saturn Gigabit Ethernet controllers. These are the successors
of the Sun GEM controllers and still have a similar but extended transmit
logic. As such this driver is based on gem(4).
Thanks to marcel@ for providing a Sun Quad GigaSwift Ethernet UTP (QGE)
card which was vital for getting this driver to work on architectures
not using Open Firmware.
2009-09-20 12:08:29 +00:00
Marius Strobl 4cc0d2e538 MFC: r194134
- Also probe DP83865, which is an is an ultra low power version
  of the DP83861 and DP83891.
- Reset the PHY during attach so it's in a known state.
- Add a comment describing why we hardwire 10baseT support in
  the BMSR.
- Always explicitly set IFM_HDX for half-duplex. [1]

Obtained from:	OpenBSD [1]
2009-09-20 00:54:51 +00:00
Marius Strobl 68b700fcd5 MFC: r191981
Just like in cpu_halt(), use cpu_shutdown() rather than ofw_exit()
directly in cpu_reset() in order to idle the APs before exiting
the kernel and letting the BSP enter the firmware so that processes
like init(8) which still might be running on an AP at that point
don't cause a panic there when it crashes due to the fact it no
longer can be supported by the kernel.
2009-09-20 00:51:48 +00:00
Marius Strobl f426ac7632 MFC: r191980
- Fix style.
- Use __FBSDID.
2009-09-20 00:15:52 +00:00
Andriy Gapon 3481b4edf8 MFC r197099: pci(4): don't perform maximum register number check
Different sub-kinds of PCI buses may have different rules and
thus it is up for the bus backends to do proper input checks.
For example, PCIe allows configuration register numbers < 0x1000,
while for PCI proper the limit is 0x100.
And, in fact, the buses already do the checks.

Reviewed by:	jhb
2009-09-18 14:12:40 +00:00
Yoshihiro Takahashi 0343f44cd9 MFC: r197156
MFi386:

  Move the loader's entry point to 0x200000.  This change is also needed
  for pc98.
2009-09-17 14:23:51 +00:00
Andriy Gapon 9797d1e64a MFC r197077: pci: remove definitions of duplicate constants
Suggested by:	jhb
Reviewed by:	jhb
2009-09-17 12:44:58 +00:00
Ed Maste f7ad780a96 MFC r195685:
Fix leaks in probestart, probedone, and scsi_scan_bus.  Also free
page_list using the matching malloc type for the allocation.

(In HEAD these functions have moved to scsi_xpt.c)

Reviewed by:	scottl
2009-09-15 02:23:16 +00:00
John Baldwin 979d02a6e8 Bump __FreeBSD_version to 702106 for the recent PAT, d_mmap_single(), and
OBJT_SG changes.
2009-09-14 17:45:58 +00:00
John Baldwin 73ba9b1230 MFC 195840, 195844, and 196637:
Add a new type of VM object: OBJT_SG.  An OBJT_SG object is very similar to
a device pager (OBJT_DEVICE) object in that it uses fictitious pages to
provide aliases to other memory addresses.  The primary difference is that
it uses an sglist(9) to determine the physical addresses for a given offset
into the object instead of invoking the d_mmap() method in a device driver.
2009-09-14 17:34:49 +00:00
Hajimu UMEMOTO 2cb7e095c1 MFC r196652: Fix the problem that the entry broke into two lines
with multi-byte AM/PM date format.
2009-09-13 17:08:58 +00:00
Hajimu UMEMOTO da85d3ea42 MFC r196651: AM/PM date format for ja_JP.eucJP and ja_JP.SJIS were
localized by r193869.  However, ja_JP.UTF-8 wasn't.  So, reflect it
to ja_JP.UTF-8 as well.
2009-09-13 17:05:56 +00:00
Hajimu UMEMOTO ca4d7b2bd2 MFC r196475:
- Add AS lookup functionality to traceroute6(8) as well.
 - Support for IPv6 transport for AS lookup.
 - Introduce $RA_SERVER to set whois server.
 - Support for 4 byte ASN.
 - ANSIfy function declaration in as.c.
2009-09-13 11:52:17 +00:00
Hajimu UMEMOTO eac43efba6 MFC r196929: Suppress an options line when no bit is on. 2009-09-13 11:45:31 +00:00
John Baldwin 227f1fd4d4 MFC part of 180012:
Changes to exclude .svn directories when building tarballs during release
builds (not documented in the original commit to HEAD).
2009-09-11 21:09:59 +00:00
Pyun YongHyeon 529ef89fbe MFC r196721:
Make sure rx descriptor ring align on 16 bytes. I guess the
  alignment requirement could be multiple of 4 bytes but I think
  using descriptor size would make intention clearer.
  Previously the size of rx descriptor was not power of 2 so it
  caused panic in bus_dmamem_alloc(9).

  Reported by:	Jeff Blank (jb000003 <> mr-happy dot com)
2009-09-11 17:25:24 +00:00
Pyun YongHyeon 61f413de18 MFC r196517:
Don't try to power down PHY when alc(4) failed to map the device.
  This fixes system crash when mapping alc(4) device failed in device
  attach.

  Reported by:	Jim < stapleton.41 <> gmail DOT com >
2009-09-11 17:20:11 +00:00
Pyun YongHyeon f5f8459ee3 MFC r195989:
Free allocated Rx ring dma memory/tags.
2009-09-11 17:18:08 +00:00
Pyun YongHyeon fae72d014a MFC r196516:
Add RTL8168DP/RTL8111DP device id. While I'm here append "8111D" to
  the description of RTL8168D as RL_HWREV_8168D can be either
  RTL8168D or RTL8111D.

  PR:	kern/137672
2009-09-11 17:15:18 +00:00
Pyun YongHyeon d4c51b6f3f MFC r196366:
Backout r193289. r193289 restored page select bits to previous
  value instead of blindly resetting it to 0. However, it seems page
  select bits of some 88E1116 PHY is initialized to invalid one such
  that restoring page select bits after programming broke MII
  register access. The correct solution would be reset page select
  bits to 0 in PHY attach stage but it would require more testing.
  Since we're in BETA stage such a change would be dangerous so just
  back it out.
  This change should fix nfe(4) breakage on NVIDIA MCP55.

  Reported by:	Ryan Rogers < webmaster <> doghouserepair dot com >
		Sam Fourman Jr. < sfourman <> gmail dot com >
  Tested by:	Ryan Rogers < webmaster <> doghouserepair dot com >
		Sam Fourman Jr. < sfourman <> gmail dot com >
2009-09-11 17:12:43 +00:00
John Baldwin 96f21a2f4e MFC 196221:
Add the ability to build a release from an SVN checkout instead of a CVS
checkout.  If SVNROOT is specified, then the source tree will be checked
out from that SVN repository instead of using CVS.  ports and docs still
use CVS.  If SVNROOT is not specified, then the source tree will be checked
out using CVS.  An explicit SVN branch can be specified using SVNBRANCH
(e.g. SVNBRANCH=stable/8).  If SVNBRANCH is not set but RELEASETAG is set
to a CVS branch (such as RELENG_8) the appropriate SVN branch will be
inferred from the CVS branch using svnbranch.awk.
2009-09-10 14:16:05 +00:00
John Baldwin e6e87f5487 MFC 196337 and 196356:
Document SVN* and MAKE_DVD variables.
2009-09-10 14:08:28 +00:00
Konstantin Belousov d99ea0ff5f MFC r196920:
insmntque_stddtr() clears vp->v_data and resets vp->v_op to
dead_vnodeops before calling vgone(). Revert r189706 and corresponding
part of the r186560.
2009-09-10 13:01:23 +00:00
Attilio Rao 345aff8995 MFC r196916:
Fix a list overrun.

Sponsored by: Sandvine Incorporated
2009-09-10 11:44:51 +00:00
Edwin Groothuis 9854b1a09f MFC from 197000:
Update to tzdata2008m:

Samoa will go in DST on 4 October 2009 till 28 March 2010
Palestine will go back from DST on 4 September 2009
2009-09-09 00:15:43 +00:00
Bjoern A. Zeeb 7878753185 MFC r196653:
Make sure FreeBSD binaries without .note.ABI-tag section work
  correctly and do not match a colliding Debian GNU/kFreeBSD
  brandinfo statements.
  For this mark the Debian GNU/kFreeBSD brandinfo that it must have
  an .note.ABI-tag section and ignore the old EI_OSABI brandinfo
  when comparing a possibly colliding set of options.

  Due to SYSINIT we add the brandinfo in a non-deterministic order,
  so native FreeBSD is not always first. We may want to consider
  to force native FreeBSD to come first as well.

  The only way a problem could currently be noticed is when running an
  i386 binary without the .note.ABI-tag on amd64 and the Debian GNU/kFreeBSD
  brandinfo  was matched first,  as the fallback to ld-elf32.so.1 does
  not exist in that case.

Reported and tested by:	ticso
In collaboration with:	kib
2009-09-07 13:37:04 +00:00
Konstantin Belousov 786f9996c6 MFC r196206.
Take the number of allocated freeblks into consideration for
softdep_slowdown().
2009-09-07 12:39:54 +00:00
Hajimu UMEMOTO ae7114ad5b MFC r193664, r193796, r193815:
Fix and add a workaround on an issue of EtherIP packet with reversed
version field sent via gif(4)+if_bridge(4).  The EtherIP
implementation found on FreeBSD 6.1, 6.2, 6.3, 7.0, 7.1, and 7.2 had
an interoperability issue because it sent the incorrect EtherIP
packets and discarded the correct ones.

Approved by:	hrs
2009-09-07 10:15:50 +00:00
Attilio Rao ed6c6c586a MFC r189078:
* Implement ucomm with a dynamic size function in order to print out the
  threads name also in the case they are not the last one shown.
* On AMD64 pointers don't have enough space to be printed. Fix it.
* Check a return value for malloc which wasn't checked before

Sponsored by:	Sandvine Incorporated
2009-09-07 09:51:23 +00:00
Attilio Rao 6b07a17c61 MFC r195159 and r195005:
* Don't assume a fixed number of preloaded KLDs but calculate at runtime.
  This avoind ending up into an endless loop.
* Fix a LOR between pmc_sx and allproc/proctree locks

Sponsored by:	Sandvine Incorporated
2009-09-07 08:52:15 +00:00
Attilio Rao 1b5e7b152c MFC r195339:
Add a new option (-s) that, when specified, skips the question about
adjusting the clock to UTC.

Sponsored by:	Sandvine Incorporated
2009-09-07 08:46:26 +00:00
Attilio Rao d169e9cb3a MFC r195403:
Fix a bug in read lock acquisition for rwlocks by bumping rdlock_count
when a successfull rwlock_rdlock_common() take place.
2009-09-07 08:41:14 +00:00
Attilio Rao 9c6d7bb083 MFC r196334:
Add the macro ASSERT_ATOMIC_LOAD_PTR(), enabled through INVARIANTS,
which asserts for the correct alignment of datas which need to be read
atomically without locks.
Use that macro in locking primitives.
2009-09-07 08:37:25 +00:00
Konstantin Belousov 442dc28e54 Partial MFC of r194459 by thompsa, without merge recording,
to allow the vm_phys_paddr_to_vm_page(9) to return NULL instead
of panicking when supplied physical address does not correspond
to a vm page. This is needed for device pager (and not yet merged
sg pager) to skip memattr checks on specific addresses.

Reported by:	Thierry Herbelot <thierry.herbelot free fr>
2009-09-06 15:23:03 +00:00
Craig Rodrigues a2c00ea3f0 This set of MFC's brings savecore closer to the trunk version.
Now, crashinfo will only be run if the following conditions are true:
- savecore -C determines that a crash dump exists
- crashinfo_enable="YES"

MFC: 182460

   Add the ability to run /usr/sbin/crashinfo on a new core dump automatically
   during boot.

MFC: 180318

   Remove the $DUMPDIR variable. It's redundant and the rest of the
   script uses $dumpdir directly.

MFC: 180317
   Make checking for the availability of core dumps work in the case
   that $dumpdev is not set to "AUTO".
2009-09-05 18:44:36 +00:00
Konstantin Belousov b329fbe6bb MFC r196689:
Remove spurious pfs_unlock().

Approved by:	re (rwatson)
2009-09-05 13:31:16 +00:00
Alan Cox a44af854d0 MFC r194295
Move (read|write)_cyrix_reg() inlines from specialreg.h to cpufunc.h.
  specialreg.h now consists solely of register-related macros.
2009-09-05 05:57:44 +00:00
Alan Cox f82f3f6ad7 MFC r195089
Add stub vm.h for pc98.
2009-09-05 05:28:07 +00:00
John Baldwin ba781abec1 MFC 193396, 193521, 194331, 194337, 194376, 194454, 194562, 194642, 195033,
195385, 195649, 195660, 195749, and 195774:
Add support to the virtual memory system for configuring machine-
dependent memory attributes:
- Refactor contigmalloc() into two functions: a simple front-end that deals
  with the malloc tag and calls a new back-end, kmem_alloc_contig(), that
  allocates the pages and maps them.
- Use kmem_alloc_contig() to implement the UMA back-end allocator for
  jumbo frame zones.
- Use kmem_alloc_contig() to allocate the top-level page tables for PAE.
- Introduce vm_memattr_t to as a type to hold memory attributes.
- Introduce vm_object_set_memattr() for setting the default memory
  attributes that will be given to an object's pages.
- Introduce and use pmap_page_{get,set}_memattr() for getting and
  setting a page's machine-dependent memory attributes.  Add full
  support for these functions on amd64 and i386 and stubs for them on
  the other architectures.  The function pmap_page_set_memattr() is also
  responsible for any other machine-dependent aspects of changing a
  page's memory attributes, such as flushing the cache or updating the
  direct map.  The uses include kmem_alloc_contig(), vm_page_alloc(),
  and the device pager:

    kmem_alloc_contig() can now be used to allocate kernel memory with
    non-default memory attributes on amd64 and i386.

    vm_page_alloc() and the device pager will set the memory attributes
    for the real or fictitious page according to the object's default
    memory attributes.

- Update the various pmap functions on amd64 and i386 that map pages to
  incorporate each page's memory attributes in the mapping.

Reviewed by:	alc
2009-09-04 19:59:32 +00:00
Alan Cox 7cc47869a5 MFC r193729
Now that amd64's kernel map is 512GB (r192469), there is no reason
  to cap its buffer map at 400MB.
2009-09-04 05:06:15 +00:00
Alan Cox 71c30bc4ab MFC r190912
Previously, when vm_page_free_toq() was performed on a page belonging to
  a reservation, unless all of the reservation's pages were free, the
  reservation was moved to the head of the partially-populated reservations
  queue, where it would be the next reservation to be broken in case the
  free page queues were emptied.  Now, instead, I am moving it to the tail.
  Very likely this reservation is in the process of being freed in its
  entirety, so placing it at the tail of the queue makes it more likely that
  the underlying physical memory will be returned to the free page queues as
  one contiguous chunk.
2009-09-04 04:48:12 +00:00
Brian Somers 28d35b6d27 MFC r196530: Document that ppp handles pipe(2) descriptors specially in
-direct mode.
2009-09-03 18:16:03 +00:00
John Baldwin ba8b451710 MFC 193275 and 194989:
Add an extension to the character device interface that allows character
device drivers to use arbitrary VM objects to satisfy individual mmap()
requests.
- A new d_mmap_single(cdev, &foff, objsize, &object, prot) callback is
  added to cdevsw.  This function is called for each mmap() request.
  If it returns ENODEV, then the mmap() request will fall back to using
  the device's device pager object and d_mmap().  Otherwise, the method
  can return a VM object to satisfy this entire mmap() request via
  *object.  It can also modify the starting offset into this object via
  *foff.  This allows device drivers to use the file offset as a cookie
  to identify specific VM objects.
- vm_mmap_vnode() has been changed to call vm_mmap_cdev() directly when
  mapping V_CHR vnodes.  This avoids duplicating all the cdev mmap
  handling code and simplifies some of vm_mmap_vnode().
- D_VERSION has been bumped to D_VERSION_02.  Older device drivers
  using D_VERSION_01 are still supported.
2009-09-03 14:23:50 +00:00
John Baldwin 53279dcae1 MFC 180430, 180483, 180485, 180601, 180845, 180871-180873, 181043, 181077,
181151, 181284, 181356, 181456, 189454, 194209, 195416, 195836, 196318,
196705, and 196707:
Various fixes and enhancements to the amd64 and i386 pmaps to support PAT.
- Extend pmap_demote_pde() to include the ability to instantiate a new page
  table page where none existed before.
- Enhance pmap_change_attr() to fully support large (2/4MB) pages by
  breaking demoting them to 4KB page mappings when needed.
- Enhance pmap_change_attr() to avoid page demotions, cache mode changes,
  and cache and TLB invalidation when some or all of the specified range
  is already mapped with the specified cache mode.
- Enhance pmap_change_attr() to adjust the direct map automatically when
  changing the cache mode of a kernel virtual address range.
- Fix pmap_object_init_pt() to not assume that the pages of a OBJT_DEVICE
  object are always physically contiguous.
- Correct a critical accounting error in pmap_demote_pde().

Reviewed by:	alc
2009-09-03 13:56:18 +00:00
John Baldwin 284c2efeaf MFC 193260 and 196417:
Add a simple API to manage scatter/gather lists of phyiscal addresses.
Each list describes a logical memory object that is backed by one or more
physical address ranges.  To minimize locking, the sglist objects
themselves are immutable once they are shared.
2009-08-31 19:07:19 +00:00
John Baldwin 35b797b51a MFC a part of 191990:
Fix compile of UFS_EXTATTR without UFS_EXTATTR_AUTOSTART.

PR:		kern/138350
2009-08-31 11:54:13 +00:00
Konstantin Belousov 976d1e53f1 MFC r196560:
Honor the vfs.timestamp_precision sysctl settings for utimes(path, NULL)
and similar calls.
2009-08-31 09:20:37 +00:00
Edwin Groothuis 74dc524a78 MFC of r192625:
Throw alert about the newly generated format of zic(8) and the
necessarity to run tzsetup(8).
2009-08-31 02:45:47 +00:00
Edwin Groothuis 4743a581dc MFC of r192625, r192890, r194783, r196587:
r192625:
MFC of tzcode2009e:

Upgrade of the tzcode from 2004a to 2009e.

Changes are numerous, but include...

- New format of the output of zic, which supports both 32 and 64
  bit time_t formats.

- zdump on 64 bit platforms will actually produce some output instead
  of doing nothing for a looooooooong time.

- linux_base-fX, with X >= at least 8, will work without problems related
  to the local time again.

The original patch, based on the 2008e, has been running for a long
time on both my laptop and desktop machine and have been tested by
other people.

After the installation of this code and the running of zic(8), you
need to run tzsetup(8) again to install the new datafile.

r192890:

MFC of tzcode2009h

- Clarify the license for the tzcode: public domain

r194783:

Remove duplicate if-statement on gmt_is_set in gmtsub().

r196587:

MFC of tzcode2009k

zic.c:
    Do not end a binary file with a POSIX-style time zone string
    for locations that end up in permanent DST (thanks to Andreas
    Schwab).
2009-08-31 02:22:18 +00:00
Max Laier ce06fa0145 MFC r196372:
If we cannot immediately get the pf_consistency_lock in the purge thread,
  restart the scan after acquiring the lock the hard way.  Otherwise we
  might end up with a dead reference.
2009-08-31 00:54:14 +00:00
Max Laier 923e904b01 MFC r196551:
Fix argument ordering to memcpy as well as the size of the copy in the
  (theoretical) case that pfi_buffer_cnt should be greater than ~_max.

  Submitted by:	pjd
  Reviewed by:	{krw,sthen,markus}@openbsd.org
2009-08-31 00:52:10 +00:00
Doug Barton 3f149f62ff MFC 196478:
Prior to the dire warning about values of network_interfaces other than
AUTO the biggest mistake users made was leaving lo0 off the list. Since
lo0 is effectively mandatory, check for it and add it to the list if
it's not there.

MFC 196523:
Improve the case test to detect the presence of lo0 in the list of
network_interfaces.
Submitted by:	Christoph Mallon <[email protected]>
2009-08-29 19:47:39 +00:00
John Baldwin 9175def6c1 MFC 196224:
Adjust the handling of the local APIC PMC interrupt vector:
- Provide lapic_disable_pmc(), lapic_enable_pmc(), and lapic_reenable_pmc()
  routines in the local APIC code that the hwpmc(4) driver can use to
  manage the local APIC PMC interrupt vector.
- Do not enable the local APIC PMC interrupt vector by default when
  HWPMC_HOOKS is enabled.  Instead, the hwpmc(4) driver explicitly
  enables the interrupt when it is succesfully initialized and disables
  the interrupt when it is unloaded.  This avoids enabling the interrupt
  on unsupported CPUs which may result in spurious NMIs.
2009-08-28 14:22:01 +00:00
Bjoern A. Zeeb f613e82170 MFC r196512:
Fix handling of .note.ABI-tag section for GNU systems [1].
  Handle GNU/Linux according to LSB Core Specification 4.0,
  Chapter 11. Object Format, 11.8. ABI note tag.

  Also check the first word of desc, not only name, according to
  glibc abi-tags specification to distinguish between Linux and
  kFreeBSD.

  Add explicit handling for Debian GNU/kFreeBSD, which runs
  on our kernels as well [2].

  In {amd64,i386}/trap.c, when checking osrel of the current process,
  also check the ABI to not change the signal behaviour for Linux
  binary processes, now that we save an osrel version for all three
  from the lists above in struct proc [2] (slightly different to HEAD).

  These changes make it possible to run FreeBSD, Debian GNU/kFreeBSD
  and Linux binaries on the same machine again for at least i386 and
  amd64, and no longer break kFreeBSD which was detected as GNU(/Linux).

PR:		kern/135468
Submitted by:	dchagin [1] (initial patch)
Suggested by:	kib [2]
Tested by:	Petr Salinger (Petr.Salinger seznam.cz) for kFreeBSD
Reviewed by:	kib
2009-08-27 17:36:59 +00:00
John Baldwin 9d16faa36b MFC 196522:
Invoke the recently added mm-mtree.sh release script to store a pre-built
mergemaster mtree database in the 'base' dist.
2009-08-27 17:26:09 +00:00
John Baldwin 2e77daa55b Move mergeinfo for 180008 up to src/release. 2009-08-27 17:24:05 +00:00
John Baldwin a9420b43d8 MFC 196521:
Fix a few issues with the lib32 dist so that it includes ldd32.
- Use a better find invocation to purge empty directories from all the dist
  trees during a release build.  The previous version did not purge
  directories whose contents were all empty directories.
- Explicitly blacklist a few files from the lib32 dist instead of using a
  whitelist.  A better longterm solution is to fix the few offenders to not
  install data files during a lib32 install.
2009-08-27 17:16:42 +00:00
John Baldwin 1302c21a64 MFC 196382:
Explicitly line up the CPU state labels with the calculated starting column
that takes into account the width of the largest CPU ID.
2009-08-27 16:15:32 +00:00
John Baldwin 6a1d8ee9a5 MFC 181019, 183474, 191277, and 191626:
- Move the code for doing out-of-memory grass from vm_pageout_scan()
  into the separate function vm_pageout_oom(). Supply a parameter for
  vm_pageout_oom() describing a reason for the call.
- Call vm_pageout_oom() from the swp_pager_meta_build() when swap zone
  is exhausted.
- In both pageout oom handler and vm_daemon, acquire the reference to
  the vmspace of the examined process instead of directly accessing its
  vmspace, that may change. Also, as an optimization, check for P_INEXEC
  flag before examining the process.
2009-08-27 15:48:58 +00:00
Edwin Groothuis db9bdc622f MFC of r196582: Import of tzdata2009l
- Egypt will go to Wintertime on 21 August 2009
- Heads up for a possible DST in Samoa
2009-08-27 12:29:23 +00:00
Edwin Groothuis bb0ab3aa49 MFC of r196581: Import of tzdata2009k
- Changes in Mauritius and Bangladesh
- No leapsecond at the end of December 2009
2009-08-27 12:27:06 +00:00
Brian Somers a728ffb873 MFC: When ``ppp -direct'' is invoked by a program that uses pipe(2) to
create stdin and stdout, don't blindly try to use stdin as a bi-directional
     channel.  Instead, detect the pipe and set up a special exec handler
     that indirects write() calls through stdout.

     This fixes the problem where ``set device "!ssh -e none host ppp
     -direct label"'' no longer works with an openssh-5.2 server side as
     that version of openssh ignores the USE_PIPES config setting and
     *always* uses pipes (rather than socketpair) for stdin/stdout channels.
2009-08-27 07:11:47 +00:00
Brian Somers f148b1d343 MFC: When realloc()ing device memory for transfer to another ppp process,
don't continue to use the realloc()d pointer - it might have changed!

     Remove some stray diagnostics while I'm here.
2009-08-27 07:10:57 +00:00
Attilio Rao 3822f73b0d Fix a problem introduced when MFCing the rw_try_wlock() operation from
HEAD:
__rw_wunlock() relies on the cookie state to not be cleanly 'tid' when
some conditions needing of special care happens, and lock recursion is
among those.  Dirty the cookie by adding the RW_LOCK_RECURSE flag in the
case of a successfull try lock operation.

This is not a problem on -CURRENT and STABLE_8 where the unlocking
algorithm works differently.

Submitted by:	Andrew Brampton <brampton plus freebsd at gmail dot com>
2009-08-27 00:45:00 +00:00
Doug Barton ee04d53073 MFC r196435:
The svnversion string is only relevant when newvers.sh is called
during the kernel build process, the other places that call the
script do not make use of that information. So restrict execution
of the svnversion-related code to the kernel build context.
2009-08-26 22:50:14 +00:00
Doug Barton 91b8f47b44 MFC 196434:
Add a script to create the /var/db/mergemaster.mtree file for new
releases so that when users subsequently update their source trees
they can make use of mergemaster's -U option.
2009-08-26 21:05:17 +00:00
Peter Wemm 5f10bcbef9 MFC r194304: Fix ticks overflow in the handling of t_badtrxtwin. 2009-08-26 19:45:17 +00:00
Bjoern A. Zeeb 26c3f44bf2 MFC r187946:
Like with r185713 make sure to not leak a lock as rtalloc1(9) returns
  a locked route. Thus we have to use RTFREE_LOCKED(9) to get it unlocked
  and rtfree(9)d rather than just rtfree(9)d.

  PR:		kern/129793
  Submitted by:	Dheeraj Reddy <[email protected]>
  Originally committed from:       Bugathon #6
2009-08-25 19:04:22 +00:00
Bjoern A. Zeeb 076094c551 MFC r187936:
Use NULL rather than 0 when comparing pointers.
2009-08-25 17:00:24 +00:00
Bjoern A. Zeeb cc75176e82 MFC r187939:
Remove 4 entirely unsued ip6 variables.
2009-08-25 16:56:33 +00:00
Bjoern A. Zeeb ba783d04d9 MFC r191403:
Correct a comment: the function name given had never existed in any
  (relevant) version of this file orany of my patches.
2009-08-25 15:58:07 +00:00
Bjoern A. Zeeb 80e608be3f Backout r191596:
Document an issue of jail(8) in conjunction with cpuset(1).

MFC r191639:
  Prevent a superuser inside a jail from modifying the dedicated
  root cpuset of that jail.
  Processes inside the jail will still be able to change child sets.
  A superuser outside of a jail will still be able to change the jail cpuset
  and thus limit the number of cpus available to the jail.

  Problem reported by: [email protected] (Miroslav Lachman)
  PR:           kern/134050
  Reviewed by:  jeff
2009-08-25 15:54:52 +00:00
Bruce M Simpson fed17d81f9 MFC r182895:
Add support to rc.initdiskless for /conf/T/M/remount_subdir.
 This allows the location of the configuration data to be relocated
 within the filesystem containing it. A nullfs mount is used in order
 to achieve this.

Obtained from:	XORP, Inc.
2009-08-25 13:40:46 +00:00
Bruce M Simpson e96d6bf586 MFC r179014:
Add support for /conf/T/M/remount_optional.

 The rc.initdiskless functionality is used by NanoBSD to allow configuration
 files to live on a separate configuration slice, which acts as NVRAM, whilst
 the system image is mounted read-only.

 Normally, if the remount command fails during boot, this is regarded as
 a fatal error. If /conf/T/M/remount_optional is present, this error is
 non-fatal. If the file is not present, the default behaviour is unchanged.

 This is very useful for people building live CD images using FreeBSD,
 where the NVRAM lives somewhere completely differently from the system image,
 and may be present on removable media which is not present during the
 initial boot.
2009-08-25 13:39:14 +00:00
Bjoern A. Zeeb c3a4e9c323 MFC r191529:
Whitespace (use tabs like for all other lines).
2009-08-25 13:04:13 +00:00
Bjoern A. Zeeb 994e6a2686 MFC r191433:
Compare protosw pointer with NULL.
2009-08-25 13:01:51 +00:00
Bjoern A. Zeeb 10eb9e1c75 MFC r182842:
Catch a possible NULL pointer deref in case the offsets got mangled
  somehow.
  As a consequence we may now get an unexpected result(*).
  Catch that error cases with a well defined panic giving appropriate
  pointers to ease debugging.

  (*) While the concensus was that the case should never happen unless
      there was a bug, noone was definitively sure.
2009-08-25 12:32:16 +00:00
Bjoern A. Zeeb 27fe96ae76 MFC r182841:
Add a second KASSERT checking for len >= 0 in the tcp output path.

  This is different to the first one (as len gets updated between those
  two) and would have caught various edge cases (read bugs) at a well
  defined place I had been debugging the last months instead of
  triggering (random) panics further down the call graph.
2009-08-25 11:44:17 +00:00
Stanislav Sedov 6d01c976d7 - MFC r196246:
- Proprely intialize UART parameters at probe stage, so uart(4)
    will initialize the FIFO memory correctly on attach.  Before
    that this values was intialized in only in at91_usart_bus_attach
    which is called after the uart(4) memory allocation happens.
2009-08-22 09:17:49 +00:00
Stanislav Sedov 4228813dde - MFC r196244:
- Avoid overflowing the swap size counters in human-readable mode
    by introducing the new CONVERT_BLOCKS macro which operates on
    sizes already converted to number of blocks.  With this macro
    it is not longer needed to perform needless multiplication by
    blocksize just to divide on it later in CONVERT macro.
2009-08-22 09:09:44 +00:00
Simon L. B. Nielsen 1d93ce165c MFC r193629:
Make "human-readable" (-H/-h) output also "humanize" inode counts.
  Base 10 is always used for the inode counts as I could not think of any
  reason base 2 inode counts would be useful.

  Minor mdoc markup fix to df(1) while here anyway.
2009-08-19 21:33:09 +00:00
Jung-uk Kim 49626c44e5 MFC: (partial) r196150
Always embed pointer to BPF JIT function in BPF descriptor
to avoid inconsistency when opt_bpf.h is not included.

Note: bpf_buffer.c and bpf_zerocopy.c do not exist on stable/7.
2009-08-17 18:02:46 +00:00
John Baldwin 407c891a5a MFC 196147:
Fix references to the kernel distributions to use the correct names
(uppercase).
2009-08-17 17:31:42 +00:00
Stanislav Sedov b966e2259c - Merge r195189:
- Add support to atomically set/clear individual bits of a MSR register
    via cpuctl(4) driver.  Two new CPUCTL_MSRSBIT and CPUCTL_MSRCBIT ioctl(2)
    calls treat the data field of the argument struct passed as a mask
    and set/clear bits of the MSR register according to the mask value.
  - Allow user to perform atomic bitwise AND and OR operaions on MSR registers
    via cpucontrol(8) utility.  Two new operations ("&=" and "|=") have been
    added.  The first one applies bitwise AND operaion between the current
    contents of the MSR register and the mask, and the second performs bitwise
    OR.  The argument can be optionally prefixed with "~" inversion operator.
    This allows one to mimic the "clear bit" behavior by using the command
    like this:
        cpucontrol -m 0x10&=~0x02		# clear the second bit of TSC MSR

    Inversion operator support in all modes (assignment, OR, AND).
2009-08-15 16:15:50 +00:00
Stanislav Sedov 0c733d2a0b - MFC r195081:
- Don't zero data field in case of MSR write operation.  Before this change
    the value written to MSR register was always 0 regardless of value passed
    by user.
  - Use proper data pointer when performing AMD microcode update.  Previously,
    the pointer to user-space data has been provided instead, which is totally
    incorrect.
2009-08-15 15:52:20 +00:00
Stanislav Sedov 1830cd924b - MFC r191308, r191310:
Properly unlock mutex on failure in channel_trigger. Before this
    the function just returned with the mutex held.
2009-08-15 15:48:10 +00:00
Stanislav Sedov e9adb9bbc7 - MFC r194583:
Fix strncmp on arm. Return 0 as result without performing the
    main cycle only if the len passed is equal to 0. If end address
    overflows use last possible address as the end address.
2009-08-15 15:41:10 +00:00
Nick Hibma 4c43a87308 Revert r196169. 2009-08-14 21:07:41 +00:00
Remko Lodder ca20e31fa0 Remove bogus char cast.
PR:		118014
 Submitted by:	Gardner Bell <gbell72 at rogers dot com>
 Approved by:	re (rwatson), imp (mentor, implicit)
 MFC after:	immediate

Approved by:	imp (mentor, implicit)
2009-08-14 19:36:54 +00:00
John Baldwin 49f7180802 MFC: Fix some LORs between vnode locks and filedescriptor table locks.
- Don't grab the filedesc lock just to read fd_cmask.
- Drop vnode locks earlier when mounting the root filesystem and before
  sanitizing stdin/out/err file descriptors during execve().
2009-08-13 17:51:26 +00:00
Bjoern A. Zeeb b2eafc5041 MFC: r192649
Implement UDP control block support.

  Add udpcb support with own fields and flags for UDP instead
  of further sticking things into in_pcb and flags fields.
  Attach the udpcb to the inp_ppcb in the kernel.

  Note: the udp tunneling parts are not (yet) existing in 7
  and thus were not merged.

Reviewed by:	rwatson
2009-08-13 15:16:30 +00:00
John Baldwin c32d0b8f89 MFC: Parse the System Resource Affinity Table ('SRAT') used to describe
affinity relationships between CPUs and memory.
2009-08-13 15:06:08 +00:00
John Baldwin 5e2ab0f927 MFC: Move the check to ensure the locate database has the minimum required
size when using mmap() before invoking mmap().
2009-08-13 15:00:18 +00:00
Nick Hibma 978a11fae8 Revert he previous commit as requested by Sean Bruno. 2009-08-13 10:27:22 +00:00
Nick Hibma 132627fa07 Silence this module. 2009-08-13 08:31:15 +00:00
Nick Hibma 55c28995f6 Compact some output. Move some behind bootverbose. 2009-08-13 08:24:58 +00:00
Nick Hibma 70cf4efa6b Hide aperture size and stolen memory behind bootverbose. 2009-08-13 08:20:12 +00:00
Nick Hibma adf7e14772 Add these two modules to enable loading of 'the other' host controller
if only one was compiled into the kernel.

This happens on a laptop with an Intel chipset (UHCI) to which an Option
3G Cardbus card is added (which contains a NEC USB host controller
(OHCI)).
2009-08-13 08:18:29 +00:00
Nick Hibma 3838778984 Restart the controller if it has halted. Restarting it makes the USB
tree functional again (without reconnecting the devices, mind you).

On my laptop there is probably a short somewhere on the motherboard and
once in a while the host controller halts.
2009-08-13 07:21:24 +00:00
Nick Hibma 619a6f8012 Reset the debugging flag to 0. 2009-08-13 07:19:43 +00:00
Robert Noland 72506638ca Merge r196142
Add support for radeon RS880 IGP chips to drm.
2009-08-12 13:20:42 +00:00
Robert Noland 33de01bf99 Merge r196141
Add some additional radeon pci ids to drm.
2009-08-12 13:19:14 +00:00
Brian Somers e56e55a158 MFC: Don't get stuck in an infinite loop comparing (short++ <= maxshort)
PR:		136893
Submitted by:	Aragon Gouveia - aragon at phat dot za dot net (mostly)
2009-08-09 18:39:23 +00:00
Konstantin Belousov 005b6e87e2 MFC r195773:
When buffer write is failed, it is wrong for brelse() to invalidate
portion of the page that was written. Among other problems, this
page might be picked up by pagedaemon, with failed assertion in
vm_pageout_flush() about validity of the page.
2009-08-09 11:47:39 +00:00
Maxim Konovalov bd1ca1bb25 MFC r195036: kill grammar nits. 2009-08-06 08:55:54 +00:00
Doug Barton f4371db498 MFC r193197, substitute ypset for ypbind in REQUIRE lines. 2009-08-03 20:24:31 +00:00
Doug Barton 3b542cf072 MFC r193119, quotation marks around the value of name=
(i.e., diff reduction to HEAD)
2009-08-03 20:20:15 +00:00
Doug Barton 231fe2aefb MFC r192210, a whitespace only change in rc.d/named, and
MFC r192215:
named_wait feature, auto-forward feature, add named-checkconf to startup
2009-08-03 20:09:54 +00:00
Xin LI deef065bfd MFC r193021:
Add an EXIT STATUS section to the manual page. Currently, nc(1)
does not follow sysexits(3), and returns 1 for all error cases.

PR:	docs/126451
2009-08-03 18:43:26 +00:00
Brian Somers 988ec5679b MFC: Add the -d switch to the usage message. 2009-08-03 09:58:46 +00:00
Brian Somers 2bd53dc3d1 MFC: Fix some uninitialised variables.
PR:		136383
Submitted by:	Ulrich Spoerlein - uqs at spoerlein dot net
2009-08-03 09:55:03 +00:00
Brian Somers 800c304f8a MFC: Add a missing phrase.
Submitted by:	Jason McIntyre jmc at kerhand dot co dot uk
Obtained from:	OpenBSD
2009-08-03 09:43:06 +00:00
Xin LI 1e10d16834 MFC r195275:
Use MPT_MAX_LUNS as maximium number of LUNs, not 7, for SAS and FC cases.
This matches Linux driver behavior (except SPI case).
2009-08-02 10:48:25 +00:00
John Baldwin a8c3b2e6c1 Fix compile of oshmctl() with MAC.
Pointy hat to:	jhb
2009-08-01 11:40:46 +00:00
Julian Elischer 7def25d2e1 MFC #195922
Fix accept on sockets using multiple routing tables
2009-08-01 07:09:50 +00:00
John Baldwin 173aed1325 Regen. 2009-08-01 01:54:42 +00:00
John Baldwin 8da5465209 MFC: Change the ABI of some of the structures used by the SYSV IPC API:
- Various members of struct ipc_perm use appropriate types instead of
  unsigned short.
- The shm_segsz member of struct shmid_ds is now a size_t instead of an
  int which should allow for complete support of SYSV SHM regions >= 2GB.
- The shm_nattch member of struct shmid_ds is now an int instead of a
  short.
- The existing versions of the __semctl(), msgctl(), and shmctl() system
  calls have been renamed to freebsd7_*() and implement the old ABI. New
  versions of these system calls provide the new ABI.  The new system
  calls also use newer symbol versions in libc so old and new binaries
  will both work under new kernels.
- Specific to 7.x: the kern_msgctl(), kern_semctl(), and kern_shmctl()
  functions now use ABI shims that transparently "rename" the functions
  to kern_new_*() for all new modules.  Existing compat functions under
  the old names remain to provide compatibility for older kernel modules.
2009-07-31 20:32:55 +00:00
Alexander Motin 66c5b4f062 Fix build breakage introduced by rev. 195973 due to difference from HEAD,
Submitted by:	Oliver Pinter
2009-07-31 07:53:09 +00:00
Alexander Motin 4178c4ff77 MFC rev. 195724:
Limit IOCATAREQUEST ioctl data size to controller's maximum I/O size.
It fixes kernel panic when requested size is too large (0xffffffff).

PR:		kern/136726
2009-07-30 13:19:12 +00:00
Jamie Gritton 214c40eb09 Preset errno to zero before calling strtol(), so the check afterwards will
be valid.  This is required since the malloc call from r195859 leaves
errno in an unknown state.

For STABLE-7 only, as CURRENT doesn't make this strtol call.

Reported by:	Michael Butler
Approved by:	bz (mentor)
2009-07-30 05:36:31 +00:00
Doug Barton ae8b993a1e Update to version 9.4.3-P3 which addresses a remote DoS vulnerability:
Receipt of a specially-crafted dynamic update message may
	cause BIND 9 servers to exit. This vulnerability affects all
	servers -- it is not limited to those that are configured to
	allow dynamic updates. Access controls will not provide an
	effective workaround.

More details can be found here: https://www.isc.org/node/474

All BIND users are encouraged to update to a patched version ASAP.
2009-07-28 23:59:22 +00:00
Doug Barton 4d97b58c29 These files don't belong in contrib at all anymore, so remove them. 2009-07-28 23:42:39 +00:00
Robert Noland 731d03de33 MFC r195501
Add support for Radeon HD 4770 (RV740) chips.
2009-07-27 16:11:44 +00:00
Robert Noland 4406425421 MFC r194741,194745-194746,194748-194749,194759,194960,194963,194965-194966,194969,194986,194996
This pulls in numerous vblank related fixes from HEAD.
2009-07-27 16:05:51 +00:00
Xin LI 4696b40dc3 Implement %z for strptime.
PR:		kern/63064
Submitted by:	Stefan `Sec` Zehl <sec 42 org> (with some small changes)
2009-07-26 09:00:37 +00:00
Yoshihiro Takahashi 966f0ee080 MFC: r190126
Reduce diffs against i386.
2009-07-25 11:10:01 +00:00
Ed Maste 2a4ccc250e MFC r179825 by olli:
Implement a workaround for a long-standing problem in
  libi386's time(), caused by a qemu bug.  The bug might
  be present in other BIOSes, too.

  qemu either does not simulate the AT RTC correctly or
  has a broken BIOS 1A/02 implementation, and will return
  an incorrect value if the RTC is read while it is being
  updated.

  The effect is worsened by the fact that qemu's INT 15/86
  function ("wait" a.k.a. usleep) is non-implmeneted or
  broken and returns immediately, causing beastie.4th to
  spin in a tight loop calling the "read RTC" function
  millions of times, triggering the problem quickly.

  Therefore, we keep reading the BIOS value until we get
  the same result twice.  This change fixes beastie.4th's
  countdown under qemu.
2009-07-25 02:22:10 +00:00
Brooks Davis 7b1c70a041 MFC r194494 to improve support for 7.x worlds on >=8.0 kernels:
In preparation for raising NGROUPS and NGROUPS_MAX, change base
system callers of getgroups(), getgrouplist(), and setgroups() to
allocate buffers dynamically.  Specifically, allocate a buffer of size
sysconf(_SC_NGROUPS_MAX)+1 (+2 in a few cases to allow for overflow).

This (or similar gymnastics) is required for the code to actually follow
the POSIX.1-2008 specification where {NGROUPS_MAX} may differ at runtime
and where getgroups may return {NGROUPS_MAX}+1 results on systems like
FreeBSD which include the primary group.

In id(1), don't pointlessly add the primary group to the list of all
groups, it is always the first result from getgroups().  In principle
the old code was more portable, but this was only done in one of the two
places where getgroups() was called to the overall effect was pointless.

Document the actual POSIX requirements in the getgroups(2) and
setgroups(2) manpages.  We do not yet support a dynamic NGROUPS, but we
may in the future.
2009-07-24 21:42:10 +00:00
John Baldwin 8d3c9fa178 Regen. 2009-07-24 21:30:10 +00:00
Garance A Drosehn 4b0e84bb42 MFC: Fix end-of-line issues that can come up when `lpq' reads information
about a queue from a remote host.

PR:		bin/104731
2009-07-24 20:35:44 +00:00
John Baldwin 621a178746 MFC: Several cleanups to the syscall tables:
- Add explicit prototypes for lkmnosys() and lkmressys() in <sys/sysent.h>
  and remove hacks for those routines from makesyscalls.sh.
- Change the LKM syscall entries in the freebsd32 table to use lkmnosys
  rather than nosys.
- Use NOPROTO for __syscall() to remove more magic logic from
  makesyscalls.sh.
- Retire the unused nfsclnt() system call and mark it as UNIMPL rather than
  NOIMPL.
- Remove the NOIMPL system call type.
- Allow multiple flags in the type system call type field.  Use this to
  retire CPT_NOA.
- Update the comment descriptions for COMPAT[45] system calls in various
  generated files.
- Update comments in syscalls.master.
- Include defintions for audit identifiers for compat system calls in
  <sys/sysproto.h>.
2009-07-24 19:35:06 +00:00
Bruce M Simpson ddbfdaa9eb MFC r182138:
Greatly expand the devices listed as being supported. This list was
 taken from PR/121184 which was mechanically generated from similar
 lists in the Linux ipaq driver. I then took the numbers we had in
 usbdevs and filled in the right symbols and eliminated duplicates.

PR:		usb/121184
2009-07-23 01:35:13 +00:00
Andriy Gapon ea2f8bfa94 MFC 195710: dtrace_gethrtime: improve scaling of TSC ticks to
nanoseconds

PR:		kern/127441
2009-07-22 15:41:37 +00:00
Bruce M Simpson 494ac0bcbb Output DWARF debug information for global 'using' declarations, instead
of just blowing up. A very similar change to this exists which is
GPLv3 licensed, this is my own change.

This problem was triggered by running the Boost regression tests.

See also:	http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31899
Reviewed by:	luigi
2009-07-22 01:07:49 +00:00
John Baldwin 94758382d1 Revert to using the userland closefrom() stub instead of the system call
to give a longer grace time where newer ssh binaries work with older
kernels.

Requested by:	obrien
Approved by:	des
2009-07-21 13:45:40 +00:00
Xin LI 4c7f7bfdaa MFC all recent gzip(1) changes, up to r194916. 2009-07-21 04:04:35 +00:00
Doug Barton 7afb2c71ff MFC 195726: spaces before commas and one ). 2009-07-20 19:20:37 +00:00
Sean Nicholas Barkas f5c9225f73 MFC r195003:
Fix a bug reported by pho@ where one can induce a panic by decreasing
vfs.ufs.dirhash_maxmem below the current amount of memory used by dirhash. When
ufsdirhash_build() is called with the memory in use greater than dirhash_maxmem,
it attempts to free up memory by calling ufsdirhash_recycle(). If successful in
freeing enough memory, ufsdirhash_recycle() leaves the dirhash list locked. But
at this point in ufsdirhash_build(), the list is not explicitly unlocked after
the call(s) to ufsdirhash_recycle(). When we next attempt to lock the dirhash
list, we will get a "panic: _mtx_lock_sleep: recursed on non-recursive mutex
dirhash list".

Approved by:	dwmalone (mentor)
2009-07-20 16:19:42 +00:00
Bruce M Simpson 13670d877a When moving an SCTP association from one hash table to another,
make sure the association's link entry in the hash table is updated.
This fixes a panic on closing an association in the 7.x SCTP stack.

Observed on 7.2-STABLE/amd64.

Submitted by:   Michael Tuexen
Reviewed by:    rrs
2009-07-19 18:37:20 +00:00
Bruce M Simpson e8ab58d00c Fix two typos in sctp_send_initiate(); these corrupt the INIT chunk on
64-bit platforms, in the 7.x SCTP stack.

Observed on 7.2-STABLE/amd64.

Submitted by:   Michael Tuexen
Reviewed by:    rrs
2009-07-19 18:36:54 +00:00
Bruce M Simpson e8ded5e420 Revert previous change.
Requested by:	kib
2009-07-19 17:13:16 +00:00
Bruce M Simpson cb5ccf98ee Output debug information for global 'using' declarations, instead
of just blowing up. A very similar change to this exists which is
GPLv3 licensed, this is my own change.

See also:	http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31899
Reviewed by:	luigi
2009-07-19 16:50:48 +00:00
Ulf Lilleengen 4fda7a0ec2 MFC r194924:
- Apply the same naming rules of LVM names as done in the LVM code itself.

PR:		kern/135874
2009-07-19 12:57:10 +00:00
Brian Somers eafef79214 Fix some typos. The changes only apply to UPDATING in stable/7.
PR:		133110
Submitted by:	Glen Barber - glen.j.barber at gmail
2009-07-18 21:50:53 +00:00
Brian Somers 3ecb88fd67 MFC: Support shadow.byname and shadow.byuid maps, protecting them by
insisting on privileged port access.

       Include /var/yp/Makefile.local if it exists and suggest using
       it to override /var/yp/Makefile behaviour.
2009-07-18 20:19:25 +00:00
Dag-Erling Smørgrav b751dcf0ff merge r181967: delete duplicate ichwd(4) 2009-07-17 07:07:38 +00:00
Alexander Motin d6c2e22d3b MFC rev. 191760, 191763, 191764.
Avoid comparing negative signed to positive unsignad values. It was
leading to a bug, when C-state does not decrease on sleep shorter then
declared transition latency. Fixing this deprecates workaround for broken
C-states on some hardware.

By the way, change state selecting logic a bit. Instead of last sleep
time use short-time average of it. Global interrupts rate in system is a
quite random value, to corellate subsequent sleeps so directly.

Make dev.cpu.X.cx_usage sysctl also report current average of sleep time.
2009-07-16 08:27:12 +00:00
Alexander Motin ad2d20a237 MFC r188656, r189086, r189127, r190630, r193228, r193642, r194177, r194861,
r195690.

Sync snd_hda driver with HEAD, except latest "Sound Mega-commit" r193640.

Except some fixes, this commit also enables MSI interrupts usage by default,
when supported, except some reported to be broken chips.
2009-07-15 10:08:19 +00:00
Ed Schouten d38c72e4be MFC r195295:
Enable POSIX semaphores on all non-embedded architectures by default.

  More applications (including Firefox) seem to depend on this nowadays,
  so not having this enabled by default is a bad idea.

  Proposed by:  miwi
  Patch by:     Florian Smeets <flo kasimir com>
  Approved by:  re (kib)
2009-07-15 08:32:19 +00:00
John Baldwin 0732a27aec MFC: Use the closefrom(2) system call. 2009-07-14 20:46:19 +00:00
John Baldwin 087b3f332d Regenerate after addition of closefrom(). 2009-07-14 19:50:46 +00:00
John Baldwin bcfa76cba3 MFC: Add a new 'void closefrom(int lowfd)' system call. When called, it
closes any open file descriptors >= 'lowfd'.  Bump  __FreeBSD_version to
702104.
2009-07-14 19:48:31 +00:00
Jung-uk Kim 33be0295db MFC: r191788
Unlock the largest standard CPUID on Intel CPUs for both amd64 and i386.
On i386, we extend it to cover Core, Core 2, and Core i7 processors,
not just Pentium 4 family, and move it to better place.  On amd64, all
supported Intel CPUs should have this MSR.
2009-07-14 18:40:31 +00:00
Jung-uk Kim bf67832ae0 MFC: r187109, r187112
r187109 - Add basic amd64 support for VIA Nano processors.
r187112 - Connect padlock(4) to amd64 build for VIA Nano processors.
2009-07-14 17:37:59 +00:00
John Baldwin 72cb52a2a6 MFC: Raise the default size of the EFI partition on ia64 from 100MB to
400MB.
2009-07-14 15:30:59 +00:00
John Baldwin 3b4cb6abbf MFC: Return errors from intr_event_bind() to the caller of
intr_set_affinity().
2009-07-14 15:16:39 +00:00
John Baldwin 344aa7c183 MFC: Enable MSI in the MSI capability registers any time that the first
message in an MSI group is enabled, not just if the address/data pair are
not initialized.
2009-07-14 14:56:01 +00:00
Jung-uk Kim e01cfa55de MFC: Replace remaining cpu_vendor with cpu_vendor_id and
add basic VIA Nano processor support for amd64 and i386.

r186797 - Add Centaur/IDT/VIA vendor ID for Nano family.
r187101 - Allow VIA Nano processors to boot FreeBSD/amd64.
r187117 - Replace more cpu_vendor with cpu_vendor_id.
r187118 - Add basic i386 support for VIA Nano processors.
r187157 - Enable MSI support for VIA Nano processors on i386.
r187594 - Replace more cpu_vendor with cpu_vendor_id.
r187597 - Include a missing header file.
r187598 - VIA Nano processor has P-state invariant TSC.
r187633 - Add more VIA bridges to agp_via.c.
2009-07-13 22:13:13 +00:00
John Baldwin b1c3309411 Move the mergeinfo for 195617 up to sys/. 2009-07-13 17:46:17 +00:00
Rui Paulo 35446c6e76 MFC r195045:
On special systems where the MBR and the GPT are in sync (up to the 4th
 slicei, Apple EFI hardware), the bootloader will fail to recognize the GPT
 if it finds anything else but the EFI partition. Change the check to continue
 detecting the GPT by looking at the EFI partition on the MBR but
 stopping successfuly after finding it.

 PR:		kern/134590
 Submitted by:	Christoph Langguth <christoph at rosenkeller.org>
 Reviewed by:	jhb
2009-07-13 16:36:04 +00:00
Doug Barton 50a9b8b56c MFC r193131, Crank the debug level necessary to display the "Label foo is
removed" and "Label for provider ..." messages up from 0 to 1.
2009-07-11 08:27:48 +00:00
Doug Barton 3483c4cf8d MFC r193853, update -U message when there is no mtree db, dramatically
reduce the size of the saved mtree db, streamline find command for the
main loop, and remove a spurious comment.
2009-07-11 08:24:51 +00:00
Kip Macy 9a891e4fcf propagate MFC of 195148 to -STABLE:
- Turn the third (islocked) argument of the knote call into flags parameter.
   Introduce the new flag KNF_NOKQLOCK to allow event callers to be called
   without KQ_LOCK mtx held.
 - Modify VFS knote calls to always use KNF_NOKQLOCK flag.  This is required
   for ZFS as its getattr implementation may sleep.
2009-07-10 19:43:07 +00:00
Xin LI 43a0f166f9 MFC r193790:
Add line width calculations for 15/16 and 24/32 bit modes in case
the "Get Scan Line Length" function fails, as it does in Parallels
(in Version 2.2, Build 2112 at least).

PR:		i386/127367
Obtained from:	DragonFly
Submitted by:	Pedro Giffuni
2009-07-10 06:57:00 +00:00
Xin LI f22a7a3037 MFC r195080 (technically this is not really a MFC but an new
implementation of the original patch to apply against 7-STABLE).

Add quirks for Actions MP4 player.

Submitted by:	John Hixson <john ixsystems com>
Approved by:	re (kib)
2009-07-10 06:55:30 +00:00
Nick Hibma 890b4df2c4 Improve the debugging output:
Make it switchable through a sysctl for ucom and u3g.

Try to reset the device if it produces ucomwritecb and ucomreadcb
errors.
2009-07-09 15:29:26 +00:00
Nick Hibma 1de9090ab4 Errors we would like to see during debugging. 2009-07-09 15:27:07 +00:00
Andriy Gapon e272e91c87 dtrace/amd64: remove duplicate definition of dtrace_gethrtime function
Primary (and enhanced) definition of this function is in
sys/cddl/dev/dtrace/amd64/dtrace_subr.c.

This is a direct commit to the branch, because this instance of the
function was added to the branch in rev 182231, which claimed to be
dtrace MFH, but in fact the code in question never existed in head.
And does not exist now.

Another reason for this de-duplication is that there is only one instance
of this function for i386 arch.

Briefly discussed with:	jhb
Silence from:		jb
2009-07-09 14:53:05 +00:00
Andriy Gapon 236c804010 MFC 194850: dtrace/amd64: fix virtual address checks 2009-07-09 13:48:06 +00:00
Konstantin Belousov 3cd38dc32c MFC r194993:
In lf_iteratelocks_vnode, increment state->ls_threads around iterating
of the vnode advisory lock list. This prevents deallocation of state
while inside the loop.
2009-07-09 09:12:16 +00:00
Xin LI 8def363234 MFC r194932
Lock around access to nc_file and netconfig_info ("ni").  The RPC
part of libc is still not thread safe but this would at least
reduce the problems we have.

PR:		threads/118544
Submitted by:	Changming Sun <snnn119 gmail com>
2009-07-08 01:41:41 +00:00
Nick Hibma f53a6bf956 bugfix: Clear the out endpoint on a stall on the written endpoint, not
*in*.
2009-07-06 09:07:35 +00:00
Brooks Davis 37b00d3569 MFC r194493 and r194548
When checking if we can write to a file, use access() instead of a
manual permission check based on stat output.  Also, get rid of the
executability check since it is not used.
2009-07-06 01:32:29 +00:00
Pyun YongHyeon d6c26430f0 MFC r195153:
Disable Rx checksum offload until I find more clue why it breaks
  under certain environments. However give users chance to override
  it when he/she surely knows his/her hardware works with Rx checksum
  offload.

  Reported by:	Ulrich Spoerlein ( uqs <> spoerlein dot net )
2009-07-06 01:04:45 +00:00
Jilles Tjoelker fe28a79155 MFC ipcs(1) part of r189283 by kib
This fixes display of shared memory segment sizes greater than 2 GB in
ipcs -b.

PR:		kern/136226
Approved by:	ed (mentor)
2009-07-05 13:17:18 +00:00
Brian Somers 2a4638f9df MFC: Add -m and -t options.
PR:		129554
2009-07-05 06:32:10 +00:00
Brian Somers 709e7a7717 MFC: Remove HOME=
PR:		132135
2009-07-05 06:28:23 +00:00
Brian Somers 12c67257ca MFC: Don't set $PATH - if the caller doesn't have /bin and /usr/bin in their
PATH then they can expect things to break.

PR:		135417
2009-07-05 06:24:06 +00:00
Alexander Motin 263f23a907 MFC rev.195335:
Fix infinite loop in ng_iface, that happens when packet passes out via
two different ng interfaces sequentially due to tunnelling.

PR:		kern/134557
Submitted by:	Mikolaj Golub
2009-07-04 06:00:57 +00:00
Xin LI a1a22ef8ce MFC r195012:
Correct a typo (which you can use to in order -> which you can use in order
to).

PR:		bin/136040
Submitted by:	"Vikentii L. Karabin" <kvl tomsksoft com>
2009-07-02 00:39:25 +00:00
Xin LI 3bad4efbc0 MFC r180208 (peter):
Set magic fbsd:nokeywords property that allows files to bypass
keyword expansion. (file-specific replacement for CVSROOT/exclude)
2009-07-02 00:36:00 +00:00
Navdeep Parhar 7568830077 Fix cxgb's version checks in stable. This makes it select the
correct buffer size for freelist1.

Approved by:	gnn (mentor)
2009-07-01 17:50:59 +00:00
Andriy Gapon 26ae343046 MFC 185586 (kan): Change nfsserver slightly so that it does not trip
over the timestamp validation code on ZFS.

This should fix O_CREAT|O_EXCL open on NFS where a server is 64-bit
with v13 ZFS code.

PR:		kern/135412
Pointed out by:	Jaakko Heinonen <[email protected]>
Tested by:	Jaakko Heinonen, Danny Braniss <[email protected]>
2009-07-01 12:44:23 +00:00
Alexander Motin 97f529df19 MFC rev.194699:
Mark ng_ether node hooks as HI_STACK. It is usually the last point when
netgraph may unroll the call stack, and I have found that in some cases 2K
guarantied there for i386 may be not enough for NIC driver and BPF.
2009-07-01 08:43:05 +00:00
Andriy Gapon 94b8ead78c MFC 185561 (ganbold): Remove unused variable. 2009-06-30 17:27:53 +00:00
Andriy Gapon 539680382a MFC 185460 (mav): improve invariant TSC detection for Intel CPUs
Nod from:	mav
2009-06-30 17:19:11 +00:00
Andriy Gapon 335e19a196 MFC 185295, 185341, 185343: cpu identification improvements
Goal of this MFC is to minimize unnecessary code differences between
head and the branch, and to improve/fix invariant TSC detection for
a wide range of CPUs.

185295 by takawata: Honor AMDPM_TSC_INVARIANT for Intel CPUs (i386 only)
185341 by jkim: Introduce cpu_vendor_id...
185343 by jkim: Use newly introduced cpu_vendor_id...

These revision are bundled together because all intermediate revisions
have one or more of the following deficiencies:
o AMDPM_TSC_INVARIANT bit (CPUID.0x80000007.EDX[8]) is not honored for
  Intel CPUs;
o AMD-specific CPU model/revision checks are performed on Intel CPUs.

Nod from:	jkim
2009-06-30 17:10:08 +00:00
Andriy Gapon f685b8df51 MFC 179229 (alc), 195188: The VM system no longer uses setPQL2().
Remove it and its helpers.
Drop unused extern declarations in amd64 that seem to have been related.

Reviewed by:	alc
2009-06-30 14:11:43 +00:00
Nick Hibma c59f8a591d MFC all changes up to 194958:
194288:
Fix NanoBSD when the data partition size is defined as a negative
number.

194431:
Allow building world into a separate dir (for reuse in multiple images).

194437:
Reverse some stuff I accidentally committed in the previous commit.

194440:
Cleanups.

194958:
Make pprint print through fd 3 so pprint can be used in customise
functions.
Prefix each log line with the running time.
2009-06-30 09:20:43 +00:00
Alexander Kabaev 55f7250f38 MFC r194298:
FreeBSD returns main object handle from dlopen(NULL, ...) calls.
dlsym seaches using this handle are expected to look for symbol
definitions in all objects loaded at the program start time along
with all objects currently in RTLD_GLOBAL scope.
2009-06-30 03:05:50 +00:00
VANHULLEBUS Yvan cca8fe7f8f MFC: Only decrease refcnt once when flushing SPD entries, to
avoid flushing entries which are still used.

Obtained from:	NETASQ
2009-06-26 13:37:53 +00:00
Warner Losh 657a102c40 Merge r187828: restore necessary NUL termination. 2009-06-26 06:59:47 +00:00
Brian Somers c63c248838 MFC: r193488: Persist forever when tailing with -F and ignore ENOENT
failures.  Correct the filename in other error messages.
2009-06-26 01:08:35 +00:00
John Baldwin 7fe2ae3f4f MFC: Fix a deadlock in the getpeername() method for UNIX domain sockets. 2009-06-25 16:10:04 +00:00
Hajimu UMEMOTO 59980ed882 MFC 194366, 194447: Fix column width of weekday names for
multibyte locales.
2009-06-25 15:34:17 +00:00
Nick Hibma 459fac5997 Don't send multiple commands. Sending the ZTE switch command is
sufficient.
2009-06-25 12:34:44 +00:00
Luigi Rizzo fd765917a9 MFC: enable creation of ISO images 2009-06-25 09:28:44 +00:00
Andriy Gapon 8ba6b87791 MFC r194061: gdb: make 'thread apply all bt' always work on all threads 2009-06-25 09:17:50 +00:00
Andriy Gapon 52ec694862 MFC r194037: syslog.conf(5): correct example 2009-06-25 09:07:40 +00:00
Joerg Wunsch c93ebdec7b Remove the defunct FDOPT_NOERRLOG; floppy media errors are no longer
logged by the kernel anyway.

In fdcontrol, open the file descriptor read-only, so the format for
read-only media can be set.
2009-06-24 20:40:10 +00:00
Joerg Wunsch cc3f6806c7 Do not insist on the fd being read/write for the FD_SOPTS and FD_STYPE
ioctls, so they can be applied to read/only media.
2009-06-24 20:22:46 +00:00
John Baldwin 4edc68af07 Defer the wakeup of the swapper process to the callers of tdsigwakeup()
to avoid a deadlock since the thread lock isn't released until after
tdsigwakeup() has returned.  This is a direct commit instead of an MFC as
this issue was fixed in HEAD by a much larger set of changes that are not
suitable for MFC.
2009-06-24 13:38:08 +00:00
Konstantin Belousov 0a0696c5a3 MFC r193923:
s/a_fdidx/a_fp/ for VOP_OPEN comments that inline struct vop_open_args
definition.

MFC r193924:
Fix r193923 by noting that type of a_fp is struct file *, not int.
2009-06-24 09:54:05 +00:00
Konstantin Belousov 0f8f645da2 MFC r193922:
Remove unused VOP_IOCTL and VOP_KQFILTER implementations for fifofs.
2009-06-24 09:45:10 +00:00
Konstantin Belousov 3b06ea5bbb MFC r193919:
Lock the vnode in cd9660, devfs and pseudofs implementation of VOP_IOCTL
to prevent reclaim, since the vnode is passed unlocked to the VOP.

MFC r193930:
For cd9660_ioctl, check for recycled vnode after locking it.
2009-06-24 09:42:18 +00:00
Edwin Groothuis de14676172 Fix NanoBSD when the data partition size is defined as a negative
number.

      It is possible to ask nanobsd.sh to create a 'data' partition,
      separate from the system or configuration partitions, and
      furthermore, by specifying a negative value for its size
      to request that it use all space unused by those partitions
      for its own size.

      Because the two lines of code that calculate how much space
      is available for this data partition are written in perl-like
      syntax, the awk code that does the processing performs the
      calculation incorrectly.
      [note - this was already fixed by r174936]

      Furthermore, a comparison later down fails to newfs the
      partition when the size is negative.

PR:           misc/127759
Submitted by: Cyrus Rahman <[email protected]>
2009-06-23 22:22:20 +00:00
Edwin Groothuis 6466df5830 MFC of r194286 r194310 r194332
Support for 64 Mb Kodak flash device.

PR:		misc/115025
Submitted by:	Michael W Lucas <[email protected]>
2009-06-23 22:16:07 +00:00
Edwin Groothuis b5970de973 MFC of 194285
Add support for 256MB Hitachi CF card and 256MB Silicon Systems CF card

      This patch against RELENG_6 adds two more entries to
      src/tools/tools/nanobsd/FlashDevice.sub - one for a 256MB
      Hitachi CF card and one for a 256MB Silicon Systems CF card.

      Both entries have been verified to work with a Soekris net4801.

PR:           kern/101228
Submitted by: Henrik Brix Andersen <[email protected]>
2009-06-23 22:09:53 +00:00
Robert Noland 34be2d81e0 Merge 194540 from HEAD
The G45 docs indicate that all G4X chips use the new framecount register.

Intel agrees with my reading of the docs, make it so for all G4X chips.

The new register also has a 32 bit width as opposed to 24 bits.  Fix
things up so that the counters roll over properly.
2009-06-23 16:14:08 +00:00
Robert Noland 7d9f89631e Merge 194539 from HEAD
realloc() behaves identically to malloc when passed a NULL object pointer

If an error does occur we would have left max_context with an incorrect
value.
2009-06-23 16:12:40 +00:00
Robert Noland 2b2fca102c Merge 194537 from HEAD
Don't panic if drm_rmmap is called with a NULL map pointer.
2009-06-23 16:11:44 +00:00
Robert Noland 8cc8ff6b0a Merge 190833 from HEAD
check offsets for R300_ZB_ZPASS_ADDR
2009-06-23 16:09:05 +00:00
Robert Noland 568f3e3a6e Merge 190831 from HEAD
Add regs required for occlusion queries support
2009-06-23 16:07:56 +00:00
Robert Noland 8deb37c59a Merge 190675 from HEAD
Add support for RV790 (HD 4890) asics
2009-06-23 16:06:13 +00:00
Robert Noland 6605e81dd5 Merge 190674 from HEAD
A little more cleanup from AMD, if we don't have the right microcode
there is no reason to mess with the chip.
2009-06-23 16:04:54 +00:00
Robert Noland bee85b3101 Merge 190595 from HEAD
Simplify the radeon microcode loading.

Submitted by:   Christoph Mallon
2009-06-23 16:02:04 +00:00
Robert Noland f8c51d07b0 Merge 190433 from HEAD
Fix up waiting on vblank again... This reverts a last minute change that
I made on the last patch, it seems to upset suspend/resume and shutdown.
2009-06-23 16:00:14 +00:00
Robert Noland a43dbe47d7 Merge 190401 from HEAD
Rework the management of vblank interrupts a bit.

When a vt switch occurs the irq handler is uninstalled.  Interrupts
and the state tracking of what was enabled/disabled wasn't working
properly.  This should resolve the reports of "slow windows" after a
vt switch, among other things.  The radeon 2d driver seems to work a
bit more correctly than the Intel driver.  With the Intel driver,
vblank interrupts will be enabled at system startup and will only
be disabled after an additional modeset (vt switch, dpms, randr event).

With this patch, I am able to run glxgears synced to vblank and
vt switch while it is running without ill effects.

(Still didn't fix the slow window issues on Intel)
2009-06-23 15:59:10 +00:00
Robert Noland 3e0ff542ca Merge 190400 from HEAD
Intel handled the management of the breadcrumb counter inconsistently.
Make sure that we always handle it the same way.
2009-06-23 15:56:10 +00:00
Robert Noland 8077e67c4f Merge 190170 from HEAD
vm_offset_t is unsigned, so compare of >= 0 is not needed.

Found with:     Coverity Prevent(tm)
CID:            2259
2009-06-23 15:54:34 +00:00
Robert Noland 8240d55933 Merge 190166 from HEAD
Remove the DRM_ERROR to fix build.  It didn't make any sense anyway.
2009-06-23 15:53:17 +00:00
Robert Noland 32d07a6d72 Merge 190164 from HEAD
Fix what appears to be a typo, and restore the registers correctly.

Found with:     Coverity Prevent(tm)
CID:            2454
2009-06-23 15:52:08 +00:00
Robert Noland 4070550d7a Merge 190163 from HEAD
Don't deref dev->dev_private before checking that it exists.

Found with:     Coverity Prevent(tm)
CID:            2940
2009-06-23 15:50:48 +00:00
Robert Noland 0572647d70 Merge 190125 from HEAD
Only issue the wakeup and store the counter if vblank is enabled on
the pipe.
2009-06-23 15:49:02 +00:00
Robert Noland 634e5d342f Merge 190023 from HEAD
Add some debugging so I can see when syscalls are being restarted
consistantly.  After a lengthy irc discussion it seems like we
shouldn't need to worry about them, but it's nice to know about.
2009-06-23 15:46:22 +00:00
Robert Noland 0c1916f914 Merge 190022 from HEAD
Rework vblank handling to try to resolve some reports of "slow" windows
after vt switch or suspend.  I can't really test this on Intel right now
but I think I've heard reports of it on radeon as well.  I can't break
it on the radeon here.

(This doesn't actually fix the "slow" window problem.)
2009-06-23 15:44:23 +00:00
Robert Noland e25192309e Merge 190021 from HEAD
Sync up the rest of the code that we use with what Intel is shipping

        -Some irq/vblank related changes that hopefully will help.
        -A little more cleanup while I'm here.
2009-06-23 15:22:38 +00:00
Robert Noland 9a19570b3d Merge r190020 from HEAD
Pull in some suspend / resume changes from Intel's code
2009-06-23 15:10:49 +00:00
Konstantin Belousov 72debd9b5f MFC r194296:
Do not use casts (int *)0 and (struct thread *)0 for the arguments of
vn_rdwr, use NULL.
2009-06-23 10:59:59 +00:00
Konstantin Belousov 00fb0decce MFC r192685:
The advisory lock may be activated or activated and removed during the
sleep waiting for conditions when the lock may be granted.
To prevent lf_setlock() from accessing possibly freed memory, add reference
counting to the struct lockf_entry. Bump refcount around the sleep.

Make lf_free_lock() return non-zero when structure was freed, and use
this after the sleep to return EINTR to the caller. The error code might
need a clarification, but we cannot return success to usermode, since
the lock is not owned anymore.
2009-06-23 10:55:21 +00:00
Konstantin Belousov 4803a60c7e MFC r192684:
In lf_purgelocks(), assert that state->ls_pending is empty after we
weeded out threads, and clean ls_active instead of ls_pending.
2009-06-23 10:49:55 +00:00
Konstantin Belousov 4104c7be1b MFC r192683:
In lf_advlockasync(), recheck for doomed vnode after the state->ls_lock
is acquired. In the lf_purgelocks(), assert that vnode is doomed and set
*statep to NULL before clearing ls_pending list. Otherwise, we allow for
the thread executing lf_advlockasync() to put new pending entry after
state->ls_lock is dropped in lf_purgelocks().

MFC r193931:
Do not leak the state->ls_lock after VI_DOOMED check introduced
in the r192683.

MFC r194356:
Decrement state->ls_threads when vnode appeared to be doomed.
2009-06-23 10:47:42 +00:00
Konstantin Belousov 9529857699 MFC r192681:
Replace the while statement with the if for clarity. The loop body
cannot be executed more then once.
2009-06-23 10:41:38 +00:00
Konstantin Belousov 4e1e115a18 MFC r185358 (by ganbold):
Remove unused variable.
2009-06-23 10:37:28 +00:00
Brian Somers be89c15e7c MFC: r193302: Avoid using find -delete in favour of find -prune
PR:		122811
2009-06-23 09:51:38 +00:00
Hajimu UMEMOTO 2ea2b3360f MFC 181922: %b and %p may contain multibyte characters.
Noticed by:	nyan
2009-06-22 16:11:34 +00:00
Luigi Rizzo 77f0aa3ec8 MFC: another prototype missed in previous commit 2009-06-22 14:32:47 +00:00
Luigi Rizzo 4448c1405b MFC: various minor fixes including
- use a format string in a printf()
- move a variable declaration at the beginning of a block
- const-ify strings
- fix prototypes
2009-06-22 14:21:14 +00:00
John Baldwin 804c039c68 MFC: Update the KVM backend for malloc stats to catch up to the internal
structure BI change from the addition of DTrace malloc(9) probes.
2009-06-22 13:46:00 +00:00
Dag-Erling Smørgrav 5b6fe52101 merge r194086, r194087, r194089, r194091, r194093, r194094, r194095,
r194096, r194097, r194098: fix aliasing and other bugs revealed by WARNS,
major code cleanup
2009-06-21 19:50:06 +00:00
Dag-Erling Smørgrav facc0091c5 merge r193027, r193557, r192900, r193028: fix trailing-slash symlink bug
PR:		kern/21768
2009-06-21 19:39:34 +00:00
Jilles Tjoelker b2947f1fd4 MFC r193087: rm, find -delete: fix removing symlinks with uchg/uappnd set
Formerly, this tried to clear the flags on the symlink's target
instead of the symlink itself.

As before, this only happens for root or for the unlink(1) variant of rm.

PR:		bin/111226 (part of)
Submitted by:	Martin Kammerhofer
Approved by:	ed (mentor) (implicit)
2009-06-21 15:40:39 +00:00
Jilles Tjoelker b54e8cf161 MFC r193086: Preserve file flags on symlinks in cp -Rp.
This reported ENOSYS before.

PR:		bin/111226 (part of)
Submitted by:	Martin Kammerhofer
Approved by:	ed (mentor) (implicit)
2009-06-21 15:36:10 +00:00
Edwin Groothuis 871b115b18 Add missing passthrough printing entries for VT100 and workalikes
in /etc/termcap:

    VT100 spec indicates that passthrough printing can be enabled
    by sending ESC[5i and disabled by sending ESC[4i These entries
    should be listed as po and pf in /etc/termcap, but are absent.
    See http://www.vt100.net/docs/vt102-ug/chapter5.html#S5.5.2.23

PR:           conf/71549
Submitted by: Andrew Webster <[email protected]>
2009-06-21 02:49:21 +00:00
Edwin Groothuis 2c32c973ff MFC of 194172
Termcap updates for screen and linux console:

    screen entry: F11-F20 keys added
    linux entry: F10-F20 keys added, ACS line graphics added

PR:           kern/108899
Submitted by: Joseph Terner<[email protected]>
2009-06-21 02:48:16 +00:00
Edwin Groothuis 3bb6c97ce4 MFC of 194152
Add missing terminal definition for Wyse 120 in termcap

Although the PR contains also the definitions of the Wyse 60, they
are not copied into it since there are already definition for them
in the termcap file since 1997.

Also, the PR didn't use the :tc=xxx: feature, so I've imploded them.

PR:           conf/81882
Submitted by: Meister des Chaos <[email protected]>
2009-06-21 02:46:56 +00:00
Edwin Groothuis 1a17664a09 MFC of 194146
Add missing termcap entry for rxvt-unicode.

      The termcap database does not have an entry for rxvt-unicode.
      This means that programs that need an entry such as vi fail
      to work when connecting via ssh using this terminal emulator.

The added data is not the same as the PR submitted by Richard, it
uses the :tc=xxx: option to inherit everything from rxvt-mono.

PR:		conf/117323
Submitted by:	Richard Bradshaw <[email protected]>
2009-06-21 02:45:23 +00:00
Edwin Groothuis cb97e44d92 MFC of 194107
Sync termcap.small with main termcap; add xterm entry for libteken

PR:           conf/135530
Submitted by: Alex Kozlov <[email protected]>
2009-06-20 08:54:03 +00:00
John Baldwin 6200789762 MFC: Update the inline version of vn_vget_ino() for ".." lookups to match
the recentish changes to vn_vget_ino().
2009-06-19 18:18:09 +00:00
John Baldwin dff7947dc9 Remove mergeinfo from this file, it is a subset of the parent mergeinfo. 2009-06-19 17:54:55 +00:00
John Baldwin bdf6b345a5 MFC: mfi(4) supports the LSI MegaRAID SAS 1078 and Dell PERC6.
PR:		docs/135712
2009-06-19 17:07:15 +00:00
Stanislav Sedov 05590a12f9 - MFC r187395-187397,193377,193382,193390,193628.
Add support for inode sizes other than 128 bytes.
  Cleanup.
2009-06-19 16:27:41 +00:00
Bjoern A. Zeeb 4e16bd5fc2 MFC: r187413,187486,190514
Reduce the impact of svnversion.  Just scan the src/sys tree,
  not all of src.

  Initially done by peter in 183528, backed out in 183566 due to
  problems with newvers.sh also called from other places during
  world build.  Those two commits were not MFCed.

  A working solution was put back in in the MFCed r190514.

  Also strip the machine arch from SRCDIR in case it is a cross
  build so svnversion works, done by thompsa r187413,187486.
2009-06-19 15:31:40 +00:00
Edwin Groothuis 0653533197 MFV of tzdata2009i:
- Fix beginning of DST of Bangladesh
2009-06-19 11:28:57 +00:00
Edwin Groothuis 88c210b399 MFC of 194088
Fix typo in cons25l7 definition in etc/termcap.small and share/termcap

	There is a minor typo in the cons25l7 (':' instead of '|') entry
	in src/etc/termcap.small that causes syscons to complain about
	bogus characters in /etc/termcap.db.

PR:           conf/132777
Submitted by: Nikos Ntarmos <[email protected]>
2009-06-19 07:46:20 +00:00
Edwin Groothuis 40e7627ef9 MFC of 194085
Fix printing of some wide-characters by iswprint() on ja_JP.eucJP
  and ja_JP.SJIS locale

      The iswprint() function does not return non-zero if used for
      some wide-character that it code was 0x824f-0x8258 on ja_JP.SJIS
      and 0xa3b0-0xa3b9 on ja_JP.eucJP locale.  But those are right
      Japanese wide-character code.

PR:           conf/124511
Submitted by: Michihiro NAKAJIMA <[email protected]>
2009-06-19 07:42:49 +00:00
Edwin Groothuis e105763a52 MFC of 194084
Add various new keymaps:

  addition: danish syscons keymap with accents

      There are two danish keymap files shipping with FreeBSD:
      danish.iso.kbd and danish.cp865.kbd.  None of these support
      accents by use of dead keys, which isn't crucial to Danes but
      often used.  This is a new keymap, danish.iso.acc.kbd, that's
      based on danish.iso.kbd with the accent part taken from
      german.iso.acc.kbd.

  pl_PL.dvorak keymap for syscons.

      Polish dvorak keymap by Robert Sebastian Gerus (17:05 01-07-2006
      CEST) <[email protected]>. Based on pl_PL.ISO-8859-2 and
      us.dvorak keymaps.

  British English Dvorak keymap for syscons.

      Attached is a Dvorak keymap for British English, with a
      pound-sterling symbol on on Shift-3 and some other characters
      in different places to the US Dvorak keymap. I've based the
      layout on the X.org GB keymap, Dvorak variant.

PR:		conf/72978, kern/99692, conf/117257
Submitted by:	Kim Norgaard <[email protected]>, Robert Sebastian Gerus <[email protected]>, "Benjamin A'Lee" <[email protected]>
2009-06-19 07:37:37 +00:00
Edwin Groothuis b6b948e9ce MFC of 194055
French translations for keyboards keymaps descriptions

    French translations for keyboards keymaps descriptions with
    some corrections on existing translations in the
    /usr/share/syscons/keymaps/INDEX.keymaps

PR:		conf/71767
Submitted by:	Henri Michelon <[email protected]>
2009-06-19 07:34:30 +00:00
John Baldwin 276d486a87 MFC: Fix overflow edge cases with comparing ticks to t_rcvtime including
fixing the TCP keepalive timer to work properly when ticks overflows from
INT_MAX to INT_MIN.  Note that to preserve the ABI this change just
downcasts t_rcvtime to an int when it is subtracted from ticks rather than
changing the type of t_rcvtime.
2009-06-18 21:17:04 +00:00
Pyun YongHyeon 2e4df50ec0 MFC r193882
Add alc(4) man page and hook up alc(4) to the build.
2009-06-18 06:09:47 +00:00
Pyun YongHyeon 278a424272 MFC 193881,193883:
r193881:
  Add alc(4) to the list of supported network interface.

r193883:
  Fix typo.
2009-06-18 06:07:58 +00:00
Pyun YongHyeon 0316c789e8 MFC 193880,193887:
r193880:
  Add alc(4), a driver for Atheros AR8131/AR8132 PCIe ethernet
  controller. These controllers are also known as L1C(AR8131) and
  L2C(AR8132) respectively. These controllers resembles the first
  generation controller L1 but usage of different descriptor format
  and new register mappings over L1 register space requires a new
  driver. There are a couple of registers I still don't understand
  but the driver seems to have no critical issues for performance and
  stability. Currently alc(4) supports the following hardware
  features.
    o MSI
    o TCP Segmentation offload
    o Hardware VLAN tag insertion/stripping
    o Tx/Rx interrupt moderation
    o Hardware statistics counters(dev.alc.%d.stats)
    o Jumbo frame
    o WOL
  AR8131/AR8132 also supports Tx checksum offloading but I disabled
  it due to stability issues. I'm not sure this comes from broken
  sample boards or hardware bugs. If you know your controller works
  without problems you can still enable it. The controller has a
  silicon bug for Rx checksum offloading, so the feature was not
  implemented.
  I'd like to say big thanks to Atheros. Atheros kindly sent sample
  boards to me and answered several questions I had.

  HW donated by:	Atheros Communications, Inc.

r193887:
  fix directory name.
2009-06-18 06:03:58 +00:00
Pyun YongHyeon 7be97d1eda MFC r192741,192743,193300
r192741:
  msk(4) now supports Yukon FE+. Specifically 88E8040, 88E8040T,
  88E8048 and 88E8070 are supported.

r192743:
  Correct controller description for 88E8035, 88E8036, 88E8038 and
  88E8039. These are fast ethernet controllers.

r193300:
  Add 88E8071, 88E8072 to the supported hardware list. While I'm here
  correct description of 88E8070. It's Yukon Extreme and have gigabit
  PHY.
2009-06-18 05:56:12 +00:00
Pyun YongHyeon 4225f65f87 MFC r193298-193299:
r193298:
  Add Rx checksum offloading support for Yukon FE+ and Yukon Extreme.
  These controllers use newer descriptor format and the new descriptor
  format uses status LE to indicate the status of checksum. Rx
  checksummed value used in previous controllers were very cryptic
  and I failed to understand how to use them. In addition most
  controllers in previous generations had Rx checksum offloading bug.

  While I'm here introduce a MSK_FLAG_NORX_CSUM flag to bypass
  checking Rx checksum offloading as Yukon FE+ A0 has status LE bug.

r193299:
  Add Yukon Extreme device ids, 88E8071 and 88E8072.
  While I'm here correct description of 88E8070. 88E8070 is Yukon
  Extreme and have gigabit PHY.
2009-06-18 05:50:45 +00:00
Pyun YongHyeon b0bed47682 MFC r193293-193294:
r193293:
  Add preliminary Yukon Extreme support and register definitions.
  Yukon Extreme uses new descriptor format for TSO and has Tx frame
  parser which greatly reduces CPU cycles spent in computing TCP/UDP
  payload offset calculation in Tx checksum offloading path. The new
  descriptor format also removed TCP/UDP payload computation for TSO
  which in turn results in better TSO performance. It seems Yukon
  Extreme has a lot of new (unknown) features but only basic
  offloading is supported at this time. So far there are two known
  issues.
   o Sometimes Rx overrun errors happen when pulling data over
     gigabit link. Running over 100Mbps seem to ok.
   o Ethernet hardware address shows all-zeroed value on 88E8070.
     Assigning ethernet address with ifconfig is necessary to make it
     work.
  Support for Yukon Extreme is not perfect but it would be better
  than having a non-working device. Special thanks to jbh who fixed
  several bugs of initial patch.

  Tested by:	jhb, Warren Block ( wblock <> wonkity dot com )

r193294:
  Add frame parser capability of Yukon FE+ and Yukon Extreme. With
  this feature hardware automatically computes TCP/UDP payload
  offset. Introduce MSK_FLAG_AUTOTX_CSUM to mark the capability.
  Yukon Extreme B0 revision is known to have a silicon for the
  feature so disable it. Yukon Extreme B0 still can do Tx checksum
  offloading but CPU have to compute TCP/UDP payload offset. To
  enable traditional checksum offloading, disable automatic Tx
  checksum calculation capability.
  Yukon Extreme A0 revision could not use store-and-forward mode for
  jumbo frames(silicon bug) so disable Tx checksum offloading for
  jumbo frames.

  I believe controllers that have MSK_FLAG_AUTOTX_CSUM capability or
  new descriptor format do not have Tx checksum offload bug so
  disable checksum offloading workaround for for short frames.
  Tested by:	jhb, Warren Block ( wblock <> wonkity dot com )
2009-06-18 05:46:33 +00:00
Pyun YongHyeon 265bcc20ec MFC r192735-192740,192742:
Add workaround for Yukon FE+ A0. This controller is known to have
  severe silicon bugs that can't handle VLAN hardware tagging as well
  as status LE writeback bug. The status LE writeback bug is so
  critical we can't trust status word of received frame. To accept
  frames on Yukon FE+ A0 msk(4) just do minimal check for received
  frames and pass them to upper stack. This means msk(4) can pass
  corrupted frames to upper layer. You have been warned!
  Also I supposed RX_GMF_FL_THR to be 32bits register but Linux
  driver treated it as 16bit register so follow their leads. At least
  this does not seem to break msk(4) on Yukon FE+.

  Tested by:    bz, Tanguy Bouzeloc ( the.zauron <> gmail dot com )
                Bruce Cran ( bruce <> cran dot org dot uk )
                Michael Reifenberger ( mike <> reifenberger dot com )
                Stephen Montgomery-Smith ( stephen <> missouri dot edu )

r192736:
  Add device ids for Yukon FE+(88E8040, 88E8040T, 88E8048 and 88E8070).

r192737:
  If interface is not UP, don't return media status.

r192738:
  Don't reinitialize controller when interface is already running.

r192739:
  Be consistent with other capability checking.

r192740:
  Simplify SIOCSIFFLAGS handler.

r192742:
  Correct controller description for 88E8035, 88E8036, 88E8038 and
  88E8039. These are fast ethernet controllers.
2009-06-18 05:29:30 +00:00
Pyun YongHyeon deee1257d4 MFC r192734:
Add preliminary Yukon FE+ support and register definitions.
  Yukon FE+ is fast ethernet controller and uses new descriptor
  format. Since I don't have this controller, the support code was
  written from guess and various feedback from enthusiastic users.
  Thanks to all users who patiently tested my initial patches.
  Special thanks to Tanguy Bouzeloc who fixed critical bug of initial
  patch.

  Tested by:	bz, Tanguy Bouzeloc ( the.zauron <> gmail dot com )
		Bruce Cran ( bruce <> cran dot org dot uk )
		Michael Reifenberger ( mike <> reifenberger dot com )
		Stephen Montgomery-Smith ( stephen <> missouri dot edu )
2009-06-18 05:20:02 +00:00
Pyun YongHyeon 306594b758 MFC r192723-192728,192731
r192723:
  Rather than checking every chip revision, introduce more flags to
  mark controller's capability. Controllers that have jumbo frame
  support sets MSK_FLAG_JUMBO, and controllers that does not support
  checksum offloading for jumbo frames will set MSK_FLAG_JUMBO_NOCSUM.
  For Fast Ethernet controllers it will set MSK_FLAG_FASTETHER and it
  would be used in link state handling.

  While here, disable Tx checksum offloading if jumbo frame is used
  on controllers that does not have Tx checksum offloading capability
  for jumbo frame(e.g. Yukon EC Ultra).

r192724:
  Caller already hold a driver lock in mii callback, assert it.

r192725:
  Add missing ~ operator.

r192726:
  Add support for newer descriptor format. This format is used on
  Yukon FE+, Yukon Extreme and Yukon Supreme.

r192727:
  Explicitly check resolved speed/duplex. Just checking IFM_ACTIVE
  does not guarantee established link. Also 1000baseT link report for
  fast ethernet controller is not valid one so make sure gigabit link
  is allowed for this controller.
  Whenever we lost link, check whether Rx/Tx MACs were enabled. If both
  MAC are not active, do not try to disable it again.

r192728:
  Disable HW WOL for Yukon EC Ultra. While I'm here use switch
  statement over if-else statement. This change will make it easy to
  add newer Yukon controllers.

r192731:
  Explicitly reset GMAC Controls and initialize GM_GP_CTRL register.
  The GM_GP_CTRL register may have stale content from previous link
  information so clearing it will make hardware update the register
  correctly when it established a valid link.
  While I'm here remove stale comment.
2009-06-18 05:16:19 +00:00
Pyun YongHyeon 4804d234f6 MFC r192716,192718-192720
r192716:
  Remove link handling taskqueue and use mii callback directly. While
  I'm here also checks driver running state.

r192718:
  Use bit definition to represent link state, device suspend instead
  of using separate variables in softc.

r192719:
  Use bit definition to represent MSI and detach state instead of
  using separate variables in softc.

r192720:
  Correctly return the result of mii_mediachg(). Previously it always
  used to return success.
2009-06-18 05:06:25 +00:00
Pyun YongHyeon 47df8e448f MFC r193291:
Program LED registers for 88E1116/88E1149 PHYs. These PHYs are
  found on Marvell Yukon Ultra, Marvell Yukon Extreme controllers.
  While I'm here explicitly issue 'powerup' command for 88E1149 PHY.

  Tested by:	jhb, Warren Block ( wblock <> wonkity dot com )
2009-06-18 04:58:04 +00:00
Pyun YongHyeon c54f144812 MFC r193289:
Don't assume page register value is 0 and restore previous page
  register after issuing 'powerup'.
2009-06-18 04:55:04 +00:00
Pyun YongHyeon 61a6d85ce5 MFC r192713:
Add driver support for 88E3016 PHY which is found on Marvell Yukon
  FE+ controller. Due to the severe silicon bugs for Yukon FE+,
  88E3016 seems to require more workarounds. However I'm not sure
  whether the workaround is PHY specific or only applicable to Yukon
  FE+. The datasheet for the PHY is publicly available but it lacks
  several details for the workaround used in this change. The
  workaround information was obtained from Linux. Many thanks to
  Yukon FE+ users who helped me add 88E3016 support.

  Tested by:	bz, Tanguy Bouzeloc ( the.zauron <> gmail dot com )
		Bruce Cran ( bruce <> cran dot org dot uk )
		Michael Reifenberger ( mike <> reifenberger dot com )
		Stephen Montgomery-Smith ( stephen <> missouri dot edu )
2009-06-18 04:51:07 +00:00
Pyun YongHyeon 1847b0f2e3 MFC r192708-192711:
r192708:
  Use mii_phy_add_media() and remove usage of local macro ADD. Also
  checks extended status register to see whether the PHY is fast
  ethernet or not. This removes a lot of checks for specific PHY
  models and it makes easy to add more PHYs to e1000phy(4).

  While I'm here remove setting mii_anegticks as it is set with
  mii_phy_add_media().

r192709:
  Report current link state while auto-negotiation is in progress.

r192710:
  Don't read unnecessary PHY registers. Speed/duplex resolution bit
  is valid only for auto-negotiation case so check the bit if we know
  auto-negotiation is active. While I'm here explicitly checks
  current speed with speed mask and set IFM_NONE if resolved speed
  is unknown.

r192711:
  Do not ignore NEXT Page capability of auto-negotiation
  advertisement register. Some PHYs such as 88E3016 requires NEXT
  Page capability to establish valid link. Also set protocol selector
  field which is read only but it makes the intention clearer.
2009-06-18 04:47:40 +00:00
Brian Somers b59b19a49a MFC: r192970: Handle different rulesets.
PR:		35018
2009-06-18 01:11:10 +00:00
Dmitry Chagin 5faea3a7e7 MFC r192284:
Implement MSG_CMSG_CLOEXEC flag for linux_recvmsg().

Approved by:	kib (mentor)
2009-06-17 21:52:39 +00:00
Dmitry Chagin d57c7139f3 MFC r185442:
Make linux_sendmsg() and linux_recvmsg() work on linux32/amd64.
Change types used in the linux' struct msghdr and struct cmsghdr
definitions to the properly-sized architecture-specific types.
Move ancillary data handler from linux_sendit() to linux_sendmsg().

Approved by:	kib (mentor)
2009-06-17 21:49:41 +00:00
Dmitry Chagin c9990ad580 Regenerate after r194400.
Approved by:	kib (mentor)
2009-06-17 21:14:07 +00:00
Dmitry Chagin 64ea8acc7c MFC r185438:
Fix iovec32 for linux32/amd64.

Add a custom version of copyiniov() to deal with the 32-bit iovec
pointers from userland (to be used later).

Adjust prototypes for linux_readv() and linux_writev() to use new
l_iovec32 definition and to match actual linux code. In particular,
use ulong for fd (why ?).

Approved by:	kib (mentor)
2009-06-17 21:12:32 +00:00
Dmitry Chagin 1182664b29 MFC r194203:
Unlock process lock when return error from getrobustlist call.

Approved by:	kib (mentor)
2009-06-17 16:56:21 +00:00
Dag-Erling Smørgrav e34e0c8923 merge r193556: drop Giant from pseudofs. 2009-06-17 14:50:41 +00:00
Dag-Erling Smørgrav 8b5ec07227 merge r192852, r192855: opt_apic.h is only used on i386. 2009-06-17 14:45:58 +00:00
John Baldwin 986662b63b MFC: Preallocate the four BARs in ALI SATA controllers during the chipinit
routine.
2009-06-17 14:00:56 +00:00
Konstantin Belousov 96ae6ef946 Regenerate 2009-06-17 13:13:23 +00:00
Konstantin Belousov 5b8ba7ab5d MFC r193916:
Add several syscall compat32 entries for extattr manipulation syscalls.
2009-06-17 13:12:43 +00:00
Dag-Erling Smørgrav 3fb8534aa7 merge r192066: redundant assignment. 2009-06-17 11:40:45 +00:00
Andriy Gapon 5352a1af4d MFC r193944: rc.d/fsck: allow additional options via fsck_y_flags 2009-06-17 09:42:30 +00:00
Andriy Gapon 6fae22c5d4 MFC r193943: fsck_msdosfs: accept no-op -C option 2009-06-17 09:29:18 +00:00
Dag-Erling Smørgrav 3ba8fff486 merge r188766: fix a type-punning bug. 2009-06-17 07:05:36 +00:00
Edwin Groothuis f1629d0f56 MFC of 193962
Add euro symbol to pt_PT locale using other encodings

PR:		conf/98815
Submitted by:	Rui Lopes <[email protected]>
2009-06-17 03:15:23 +00:00
Edwin Groothuis c829ff79a0 Croatian locale support for hr_HR.ISO8859-2
Without this patch /usr/share/locale/hr_HR.ISO8859-2/LC_COLLATE
	is a link to the ../la_LN.ISO8859-2/LC_COLLATE. It means
	that there is no support for Croatian locale.

PR:		conf/120113
Submitted by:	Simun Mikecin <[email protected]>
2009-06-17 03:14:18 +00:00
Edwin Groothuis 39d097fb53 Invalid (long) date format in pl_PL.ISO8859-2.src
Date format is %a %e %b %X %Y %Z (e.g "sob 19 sty 15:46:50 2008 CET")
	but should be "%a %e %b %Y %X %Z" (e.g. "sob 19 sty 2008 15:46:50 CET").

PR:		conf/119804
Submitted by:	Bodek <[email protected]>
2009-06-17 03:08:55 +00:00
Edwin Groothuis 09431dcff8 MFC of 193908:
add ca_AD, ca_FR and ca_IT locales

      Catalan language is not only spoken in Spain (ca_ES), but
      also in Andorra, France and Italy. In Andorra it is the
      official language.

      (see http://en.wikipedia.org/wiki/Catalan_language#Geographic_distribution)

PR:		conf/92541
Submitted by:	<[email protected]>
2009-06-17 03:04:30 +00:00
Brian Somers cbcfa3bbb8 MFC: r192798: Fix a race that can stall the timer
PR:		102747
Submitted by:	Sergey Zaharchenko - doublef-ctm at yandex dot ru
2009-06-17 02:20:26 +00:00
John Baldwin 6c728300ef MFC: Rework the _BBN handling for Host-PCI bridges to always trust the
first bus that claims to be bus 0.
2009-06-16 15:09:17 +00:00
John Baldwin e7903471b8 MFC: Note that these routines return NULL on failure and that the
structures they return arrays of are defined in <sys/user.h>.
2009-06-16 13:39:09 +00:00
Dmitry Chagin 83211503bd MFC r192206:
Somewhere between 2.6.23 and 2.6.27, Linux added SOCK_CLOEXEC and
SOCK_NONBLOCK flags, that allow to save fcntl() calls.

Implement a variation of the socket() syscall which takes a flags
in addition to the type argument.

Approved by:	kib (mentor)
2009-06-16 05:10:21 +00:00
Dmitry Chagin a6d69399a0 MFC r192205:
Return EINVAL in case when the incorrect or unsupported
type argument is specified.

Do not map type argument value as its Linux values are
identical to FreeBSD values.

Approved by:	kib (mentor)
2009-06-16 05:08:48 +00:00
Dmitry Chagin ee5c771452 MFC r192204:
Use the protocol family constants for the domain argument validation.
Return immediately when the socket() failed.

Approved by:	kib (mentor)
2009-06-16 05:07:34 +00:00
Dmitry Chagin 873d6f0212 MFC r192203:
Emulate SO_PEERCRED socket option.
Temporarily use 0 for pid member as the FreeBSD does not cache remote
UNIX domain socket peer pid.

PR:		kern/102956
Approved by:	kib (mentor)
2009-06-16 05:05:46 +00:00
Edwin Groothuis 9ef94a53f0 MFC of 193869
ja_JP: AM/PM date format should be localized.

    ja_JP.eucJP and ja_JP.SJIS fixes.

PR:           conf/63527
Submitted by: Yukihiro Nakai <[email protected]>
2009-06-16 02:36:49 +00:00
Edwin Groothuis 2805ebe345 MFC of r193867:
Fix LC_NUMERIC and LC_MONETARY for de_CH locale

  With the de_CH (swiss german) locale, numbers should look like this:

      numbers: 1'234.45
      monetary values: Fr. 1'234.45

  Previously, the thousands separator was missing for numbers, and
  "." for monetary values, and "," was incorrectly used as decimal
  point.

PR:           conf/75502
Submitted by: Benjamin Lutz <[email protected]>
2009-06-16 02:35:21 +00:00
George V. Neville-Neil 6750edc8e3 MFC of 179973
Make it simpler to build netgraph modules outside of the kernel source
tree.  This change follows similar ones in the device tree.
2009-06-15 22:07:21 +00:00
Stanislav Sedov e4d78dcdce MFC r193043:
- Prevent buffer overflow in IPFilter's load_http function used to load
    ipfilter tables via http by the user-level ippool utility. Previously
    the 1024-byte buffer used to store a http request coudld easily overflow
    if the length of the hostname part of the url passes exceeded 496 bytes.
  - Use snprintf to prevent possieble buffer overflows in future.
  - Do not try to close the descriptor twice on failure.
2009-06-15 21:03:25 +00:00
Nick Hibma ca9cd94ccc Add opt_hwpmc_hooks.h to fix building individual modules from
/sys/modules.
2009-06-15 20:12:27 +00:00
Nick Hibma 5f46aa1509 Rearrange the init code in the stub driver, using a task to initialise
the card. This allows better error handling and re-issuing of commands
if one fails.

Implement another initialisation sequence used buy the ZTE_STOR
variants.

Fix a bug where the driver would panic during initialisation reported by
many (Mike Tancsa amongst others).

Testing done and hardware supplied by belkin (a person, not the company).
2009-06-15 19:26:34 +00:00
John Baldwin 313227273d MFC: Pack PnP structures instead of individual fields. 2009-06-15 19:16:24 +00:00
Nick Hibma 1b4bd7644b Hide 'Unsupported ATAPI command - trying anyway' under bootverbose. This
caused more noise than was actually useful.
2009-06-15 19:15:28 +00:00
VANHULLEBUS Yvan fec19918cf MFC: Changed to M_NOWAIT when reallocing psc_buf in padlock_sha_update(),
as we already hold the non sleepable crypto_driver_mutex.

Obtained from:	NETASQ
2009-06-15 13:48:31 +00:00
VANHULLEBUS Yvan eb3a0b58ac MFC: Lock SPTREE before parsing it in key_spddump()
Obtained from:	NETASQ
2009-06-15 13:17:05 +00:00
Brian Somers df50dc3c24 MFC: r193765:
Fix an off by one error when we limit append/prepend text sizes based on our
  internal buffer sizes.

  When we 'append', assume we're appending to text.  Some MS dhcp servers will
  give us a string with the length including the trailing NUL.  when we 'append
  domain-name', we get something like "search x.y\000 z" in resolv.conf :(
2009-06-15 07:24:16 +00:00
Brian Somers a3e5385102 MFC: r192745: Enhance the 'p' command so that it understands size
qualifiers (K/M/G) and so that it understands '*' as 'DTRT'.

PR:		68312
2009-06-15 07:17:55 +00:00
Dag-Erling Smørgrav 97b6e0007a merge r192561: fix hyphens. 2009-06-14 23:11:09 +00:00
Kip Macy b38624c348 further clarify ZFS upgrade requirements 2009-06-14 21:11:39 +00:00
Paul Saab 7c7e3d681e Merge r192679
Increase the number of available file descriptors to 64. This fixes the
reported zfsboot problems for systems where more than seven drives are part
of ZFS pools.
2009-06-14 20:12:12 +00:00
Konstantin Belousov 6a35f207cb MFC r193176:
Unlock the pseudofs vnode before calling fill method for pfs_readlink().
2009-06-14 18:04:22 +00:00
Jilles Tjoelker 4f4d6296de MFC r192688: fix nonsense in ps etime field for swapped out processes
PR:		bin/123069
Submitted by:	Vladimir Kozbin
Approved by:	ed (mentor)
2009-06-14 17:05:54 +00:00
Jilles Tjoelker c31a92be33 MFC r192687: fix chflags -h
PR:		bin/131999
Submitted by:	bde
Approved by:	ed (mentor)
2009-06-14 17:03:59 +00:00
Kip Macy 3318691b23 comment out zfs support until I have time for a proper fix 2009-06-13 22:02:55 +00:00
Edwin Groothuis d5228d6d89 MFC of r175407 r187024 r193586 r193609
r175407
Correct that LSI 0060 is a mfi device and not mpt.

r187024
Correct description for the Marvell 88SE6101.

r193586
Regen:

* Hart:         rev 671 of pcidevs.txt; 22-01-2008 (D-M-Y).
* Boemler:      vendors.txt (2008-06-06)

r193609
Remove cruft at 0E11-0002. Informed upstream.
2009-06-13 13:09:19 +00:00
Jung-uk Kim 9039f88baa MFC: r175904, r175905, r186009
Sync amd64 and i386 CPUID feature flags with -CURRENT.

- amd64 only:	DTES64, SSE4.1, SSE4.2, x2APIC, POPCNT
- both:		ABM, SSE4A, MAS, OSVW, IBS, SSE5, SKINIT, WDT

PR:		kern/135202
2009-06-12 20:41:44 +00:00
John Baldwin 8323fbd2f9 MFC: Add manpages for kinfo_getfile() and kinfo_getvmmap(). 2009-06-12 15:53:56 +00:00
Edwin Groothuis d87cf693c1 MFC of r174887
Add Turkish collate

PR:		conf/118976
Submitted by:	Ismail YENIGUL <[email protected]>
2009-06-12 07:48:35 +00:00
Edwin Groothuis f05aed9f00 MFC of r193498
[patch] Portuguese timedef

In Portuguese, the names of the days of the week are not capitalized.
Also there is always a dash before "feira" in the names of the days.
For example: "segunda-feira" and not "segunda feira" (which has a
completely different meaning).

x_fmt is not correct either. The date separator should not be a dot
but a slash. Example: 31/12/2005 if far more used in Portugal than
31.12.2005.

References:
- a Portuguese online dictionary http://priberam.pt/dlpo/dlpo.aspx
- http://answers.com/days_of_the_week (there are translations to
	various languages, including Portuguese, at the bottom of the
	page)
- http://en.wikipedia.org/wiki/Week-day_names (there are translations
	to various languages, including Portuguese, at the bottom of the
	page)
- a Portuguese style guide
	http://www.publico.clix.pt/nos/livro_estilo/16d-palavras.html
	("datas" section)

PR:           conf/58595
Submitted by: Chris Stenton <[email protected]>
2009-06-12 07:34:34 +00:00
George V. Neville-Neil a8bdc43555 MFC of 194039 and part of 190330
Re-add the send queue tunable for people who do not use buffering.
2009-06-11 22:00:54 +00:00
John Baldwin ae66536ebd If the running kernel has support for shm_open() and shm_unlink() as
system calls (i.e. 8.0+), then invoke the system calls instead of using
open/fcntl/unlink.  This is a direct commit instead of an MFC since libc
in 8.0 always uses the system calls directly.

MFC after:	1 week
2009-06-11 21:37:23 +00:00
John Baldwin 6b324b023e Trim duplicate copies of headers. 2009-06-11 19:07:15 +00:00
Andriy Gapon a22f3d4779 MFC r192899: linux_ioctl_cdrom: reduce stack usage
Approved by:	jhb (mentor)
2009-06-11 18:39:31 +00:00
Andriy Gapon 9c2b47872a MFC r192381: find: do not silently disable -L when -delete is used
Approved by:	jhb (mentor)
2009-06-11 18:32:53 +00:00
Andriy Gapon d13e55c839 MFC r192379: sysctl_rman: report shared resources to devinfo
Approved by:	jhb (mentor)
2009-06-11 18:29:11 +00:00
Andriy Gapon b8fb27f2a3 MFC r189882: intpm: minor enhancements
Approved by:	jhb (mentor)
2009-06-11 18:19:48 +00:00
Andriy Gapon f3e34cd462 MFC r189112: newfs_msdos: work with media that doesn't have any CHS params
Approved by:	jhb (mentor)
2009-06-11 18:15:03 +00:00
Andriy Gapon 123e30525b MFC r189305: ichwd: correct range check for timeout value
Approved by:	jhb (mentor)
2009-06-11 18:10:17 +00:00
Marius Strobl 49876b046a MFC: r190283, r192026
Correct the documentation of BUS_DMA_NOCACHE for amd64 and i386,
it's a flag to bus_dmamem_alloc(9) rather than bus_dmamap_load(9)
there.
2009-06-11 15:49:45 +00:00
John Baldwin 2c7ca4b93e MFC: Don't attempt to free the GPT partition list for a disk with an empty
GPT.
2009-06-11 15:15:40 +00:00
George V. Neville-Neil 8fbf1e92b7 MFC of 193925
Add a missing error statistic, the number of FCS errors on receive.

Reviewed by:	jhb
2009-06-11 14:18:33 +00:00
Dag-Erling Smørgrav 5f9232db65 merge r193984: lower WARNS due to alignment issues on sparc64. 2009-06-11 10:32:13 +00:00
Dag-Erling Smørgrav e2a566c2f7 merge r173716, r175206, r193976: silence warning, WARNS=6, prettify macro. 2009-06-11 07:52:35 +00:00
Edwin Groothuis 61f79571aa MFC of tzdata2009i:
Bangladesh will go into DST on 20 June.
2009-06-11 07:40:21 +00:00
Xin LI 9d50ac4d27 MFC r192943: Correct off-by-one issue in truss(1) which happens when system
call number is nsyscalls.  (mips bits intentionally left off since it's not
in 7-stable yet)
2009-06-11 00:42:53 +00:00
John Baldwin 38f31e1935 MFC: Add a feature_present(3) function which checks to see if a named kernel
feature is present by checking the kern.features sysctl MIB.
2009-06-10 19:57:54 +00:00
Warner Losh b7171f4de6 MFC:
r188216 | wkoszek | 2009-02-05 17:55:19 -0700 (Thu, 05 Feb 2009) | 5 lines
r185545 | imp | 2008-12-01 21:54:31 -0700 (Mon, 01 Dec 2008) | 2 lines
r185140 | imp | 2008-11-20 20:03:57 -0700 (Thu, 20 Nov 2008) | 4 lines
r185015 | imp | 2008-11-16 18:32:29 -0700 (Sun, 16 Nov 2008) | 8 lines
r184981 | imp | 2008-11-14 22:22:06 -0700 (Fri, 14 Nov 2008) | 5 lines

These commits move all the parsing of the CIS to where the card is
detected, rather than when the open call for the device happens.  This
means that we can now reliably get this info from cards.  Atheros
network cards in conjunction with the HAL were a primary motivator for
this fix, although other applications benefit.
2009-06-10 19:21:23 +00:00
Dag-Erling Smørgrav b79585abd2 merge r173723, r173726: fix an execl() call. 2009-06-10 17:30:12 +00:00
Dag-Erling Smørgrav 67f6f2110c Lower WARNS due to aliasing violations in contrib code. 2009-06-10 17:29:13 +00:00
Dag-Erling Smørgrav bd9e1206cd merge r173719: constify expand_number(3). 2009-06-10 14:52:34 +00:00
Dag-Erling Smørgrav 66ff5cdce1 merge r173716: lower WARNS to avoid spurious "variable might be clobbered
by longjmp" warnings.
2009-06-10 14:38:39 +00:00
Ulf Lilleengen e655ff4c7f MFC r193213:
- Add missing data argument to printf.
2009-06-10 14:01:23 +00:00
Ulf Lilleengen 309aedc959 MFC r193059:
- Use sig_atomic_t for signal handler variables.

MFC r193325:
- Use volatile for signal variables.

MFC r193372:
Correct comment.
2009-06-10 13:59:05 +00:00
Dag-Erling Smørgrav b05ffc0242 merge r173722: lower WARNS; we can't easily fix the (contrib) code. 2009-06-10 13:41:40 +00:00
Dag-Erling Smørgrav 79ffb6ff88 merge r173764: fix aliasing violations. 2009-06-10 13:04:07 +00:00
Dag-Erling Smørgrav d9644cef2d merge r176060, r176071: add pthread_mutex_isowned_np() (already in libthr) 2009-06-10 12:54:36 +00:00
Dag-Erling Smørgrav 6e0f95e01f merge r176055, r176056: use libc's version definition file. 2009-06-10 12:51:58 +00:00
Konstantin Belousov 6e332b18bf MFC r185647;
Several threads in a process may do vfork() simultaneously. Then, all
parent threads sleep on the parent' struct proc until corresponding
child releases the vmspace. Each sleep is interlocked with proc mutex of
the child, that triggers assertion in the sleepq_add(). The assertion
requires that at any time, all simultaneous sleepers for the channel use
the same interlock.

Silent the assertion by using conditional variable allocated in the
child. Broadcast the variable event on exec() and exit().

MFC r188750:
Adapt linux emulation to use cv for vfork wait.
2009-06-10 12:07:52 +00:00
Colin Percival 3ff24c8743 Prevent integer overflow in direct pipe write code from circumventing
virtual-to-physical page lookups. [09:09]

Add missing permissions check for SIOCSIFINFO_IN6 ioctl. [09:10]

Fix buffer overflow in "autokey" negotiation in ntpd(8). [09:11]

Approved by:	so (cperciva)
Approved by:	re (not really, but SVN wants this...)
Security:	FreeBSD-SA-09:09.pipe
Security:	FreeBSD-SA-09:10.ipv6
Security:	FreeBSD-SA-09:11.ntpd
2009-06-10 10:31:11 +00:00
Kip Macy bee2fb9aa9 fix loader for default settings case 2009-06-10 09:06:42 +00:00
Brian Somers 8040edbfee MFC: r192432: Fail pwd_mkdb -C if the user name is MAXLOGNAME or longer. 2009-06-10 05:26:21 +00:00
Kip Macy 2c290592f2 Should be ${MK_ZFS} != "no" 2009-06-10 01:20:46 +00:00
Kip Macy 77c26fe35d - enable building of loader by default
- fix MK_ZFS == "no" and MK_CDDL == "no" handling
2009-06-10 01:18:07 +00:00
Kip Macy 26202fef32 MFC fstat support bits for ZFS
Submitted by:	Alexander Nedotsukov
2009-06-09 21:17:57 +00:00
George V. Neville-Neil c6ce0f4d1d Re-add accidentally removed code from the previous MFCs. 2009-06-09 15:10:00 +00:00
Dag-Erling Smørgrav c17cb6c6e6 merge r174111, r174112, r174335: style and warning fixes. The functional
parts of these commits have already been merged.
2009-06-09 15:09:10 +00:00
Dag-Erling Smørgrav 102aeea4dc merge r173718: reduce WARNS due to too many "variable might be clobbered
by longjmp" false positives.
2009-06-09 14:07:29 +00:00
Dag-Erling Smørgrav 9ff899e70c merge r181651, r193826: avoid writing an int to a char *. 2009-06-09 12:39:17 +00:00
Dag-Erling Smørgrav 68e0921b95 merge r180815,184081-184088,184091-184094,184634,184676-184677, 185277,
93589,193591: style and warning cleanups, libutil is now WARNS=6 clean.
Also merged setclasscpumask(), which would have been a b***h to isolate
from the rest of the changes.  AFAICT, nobody uses it anyway.
2009-06-09 01:43:58 +00:00
Dag-Erling Smørgrav fdcd82a6f5 merge r180982,r181044,r181059,r181065,r181341,r183021: WARNS cleanup,
add thr_pread_{int,long,ptr} and thr_pwrite_{int,long,ptr}, and change
definition of psaddr_t (no impact on ABI).  Discussed with marcel@, but
any screwups are my own.
2009-06-09 00:47:54 +00:00
Dag-Erling Smørgrav 7e7c512c54 merge r176058: more missing namespace wrappers for libthr 2009-06-09 00:27:23 +00:00
Sam Leffler fda82d35af MFC r193524: do not force the mtu to 2290 2009-06-08 23:47:47 +00:00
Jilles Tjoelker 256103c1de MFC r193273: Fix segfault when giving invalid long option to pkg_info.
PR:		bin/133473
Submitted by:	Rafal Grodzinski
Approved by:	ed (mentor)
2009-06-08 22:05:47 +00:00
George V. Neville-Neil 46d87780a8 MFC of 190206 190330 192537 192 540 192584 192593 192933
Bring the 7.x version of the cxgb driver up to date with respect to
HEAD as of 8 June 2009

192933

Rework interrupt bringup and teardown.

Calculate the exact number of vectors we'll use before calling
pci_alloc_msix.  Don't grab nine all the time.

Call cxgb_setup_interrupts once per T3, not once per port.  Ditto
for cxgb_teardown_interrupts.

Don't leak resources when interrupt setup fails in the middle.

192593

Partial reversion of previous commit.  The CXGB_SHUTDOWN flag does NOT
need to be inverted when doing an ifconfig down of an interface.

192584

Fix a possible panic cxgb_controller_attach() routine that would occur
only if prepping the adapter failed.

Slight adjustment to comments.

Fix a bug whereby downing the interface didn't preven it from
processing packets.

192540

Integrate three changes from Chelsio.

1) Add a sysctl that will say what type of PHYs exist on the card.
2) Fix a bug that occurs when an AEL 2005 PHY resets without a transciever
in the card.
3) Unify the PHY link detection code.

192537

Modified the attach and detach routines to handle bringing ports up
and down more cleanly.  This addresses a problem where if we have the
link flap during boot the driver would lock up the system.

190330

Minor updates to the Chelsio driver, including removing an LOR.

190206

Fix a bug in the recent update to the Chelsio driver.
The tick routine was not being restarted in the init_locked routine
which could resulted in loss of carrier when updating the MTU.
2009-06-08 21:01:14 +00:00
Dag-Erling Smørgrav 44dc31f363 merge r173793: silence aliasing warning. 2009-06-08 20:08:20 +00:00
Dag-Erling Smørgrav 9ac12a8d84 merge r177605,177607,177855: add missing namespace wrappers for libthr 2009-06-08 20:04:36 +00:00
Dag-Erling Smørgrav d6865efdd9 merge r173763: fix aliasing bug 2009-06-08 19:59:26 +00:00
Dag-Erling Smørgrav 5d13f1ee0d merge r174221: remove unnecessary casts 2009-06-08 19:52:12 +00:00
Dag-Erling Smørgrav f3d14969ae Remove bogus mergeinfo 2009-06-08 19:40:48 +00:00
Dag-Erling Smørgrav 7138086755 merge r173762: use a forward declaration to avoid an aliasing warning 2009-06-08 19:24:37 +00:00
Dag-Erling Smørgrav ca1007a9ef merge r173761: generate code that respects C99's strict aliasing rules. 2009-06-08 19:22:12 +00:00
John Baldwin 83e6653b70 MFC: Add a missing parameter when displaying GPT partitions with an unknown
UUID.
2009-06-08 14:52:17 +00:00
Konstantin Belousov e96c8d7e0d MFC r193535:
Put intrcnt, eintrcnt, intrnames and eintrnames into the .data section.
2009-06-08 13:31:27 +00:00
Hiroki Sato fc1632bdb0 Document possible bge(4) panic on shutdown time. 2009-06-08 05:11:35 +00:00
Fabien Thomas 3d202f4896 Unbreak LINT. 2009-06-07 19:12:40 +00:00
Fabien Thomas decbbf92c0 Repair pc98 LINT build broken by PmcTools merge.
Reviewed by: jkoshy (mentor)
2009-06-07 18:53:25 +00:00
Fabien Thomas 798dbad908 Bump sys/param.h for the merge of PmcTools.
Add a note to rebuild world in UPDATING.

Reviewed by: jkoshy (mentor)
2009-06-07 18:45:04 +00:00
Fabien Thomas 0daa13da2c MFC hwpmc framework:
- capture with callchain
- Intel Core 2 support
- Intel Core i7 support
- source code annotate (pmcannotate)
- bug fixes

Reviewed by: jkoshy (mentor)
Approved by: re (gnn)
2009-06-07 10:00:35 +00:00
Brian Somers ae96b43bc1 MFC: r192242: Don't kill ancestors unless -a is given. 2009-06-07 08:21:06 +00:00
Brian Somers 5c74d4b8c6 MFC: r192239: Add a -d switch. 2009-06-07 08:11:25 +00:00
Pyun YongHyeon 7565c7db2a MFC r192515:
Add nge(4) to the list of drivers supporting ALTQ.
2009-06-07 06:28:55 +00:00
Pyun YongHyeon 0536f3f662 MFC r192512-192514:
r192512:
  Document sysctl variable dev.nge.%d.int_holdoff.

r192513:
  DP83821 also supports jumbo frames.

r192514:
  nge(4) supports altq(4). Xr altq
2009-06-07 06:27:33 +00:00
Pyun YongHyeon 008bc13795 MFC r187662:
Update the supported device list a little bit.

  PR:		84538
  Submitted by:	asmodai
2009-06-07 06:23:24 +00:00
Pyun YongHyeon 6918257de7 MFC r176267:
Document the hw.skc.jumbo_disable tunable.  While here, correct some things
  in the SYSCTLS section.

  Submitted by:	yongari
2009-06-07 06:21:59 +00:00
Pyun YongHyeon eaab2171a7 MFC r192508:
Add nge(4), nge(4) should work on all architectures.
2009-06-07 05:49:37 +00:00
Pyun YongHyeon 7574501460 MFC r192506:
bus_dma(9) conversion and make nge(4) work on all architectures.
  o Header file cleanup.
  o bus_dma(9) conversion.
    - Removed all consumers of vtophys(9) and converted to use
      bus_dma(9).
    - 64bit DMA support was disabled because DP83821 is not capable
      of handling the DMA request. 64bit DMA request on DP83820
      requires different descriptor structures and it's hard to
      dynamically change descriptor format at run time so I disabled
      it. Note, this is the same behavior as previous one but
      previously nge(4) didn't explicitly disable 64bit mode on
      DP83820.
    - Added Tx/Rx descriptor ring alignment requirements(8 bytes
      alignment).
    - Limit maximum number of Tx DMA segments to 16. In fact,
      controller does not seem to have limitations on number of Tx
      DMA segments but 16 should be enough for most cases and
      m_collapse(9) will handle highly fragmented frames without
      consuming a lot of CPU cycles.
    - Added Rx buffer alignment requirements(8 bytes alignment). This
      means driver should fixup received frames to align on 16bits
      boundary on strict-alignment architectures.
    - Nuked driver private data structure in descriptor ring.
    - Added endianness support code in Tx/Rx descriptor access.
  o Prefer faster memory mapped register access to I/O mapped access.
     Added fall-back mechanism to use alternative register access.
     The hardware supports both memory and I/O mapped access.
  o Added suspend/resume methods but it wasn't tested as controller I
    have does not support PCI PME.
  o Removed swap argument in nge_read_eeprom() since endianness
    should be handled after reading EEPROM.
  o Implemented experimental 802.3x full-duplex flow-control. ATM
    it was commented out but will be activated after we have generic
    flow-control framework in mii(4) layer.
  o Rearranged promiscuous mode settings and simplified logic.
  o Always disable Rx filter prior to changing Rx filter functions as
    indicated in DP83820/DP83821 datasheet.
  o Added an explicit DELAY in timeout loop of nge_reset().
  o Added a sysctl variable dev.nge.%d.int_holdoff to control
    interrupt moderation. Valid ranges are 1 to 255(default 1) in
    units of 100us. The actual delivery of interrupt would be delayed
    based on the sysctl value. The interface has to be brought down
    and up again before a change takes effect. With proper tuning
    value, users do not need to resort to polling(4) anymore.
  o Added ALTQ(4) support.
  o Added missing IFCAP_VLAN_HWCSUM as nge(4) can offload Tx/Rx
    checksum calculation on VLAN tagged frames as well as VLAN tag
    insertion/stripping. Also add IFCAP_VLAN_MTU capability as nge(4)
    can handle VLAN tagged oversized frames.
  o Fixed media header length for VLAN.
  o Rearranged nge_detach routine such that it's now used for general
    clean-up routine.
  o Enabled MWI.
  o Accessing EEPROM takes very long time so read 6 bytes ethernet
    address with one call instead of 3 separate accesses.
  o Don't set if_mtu in device attach, it's already set in
    ether_ifattach().
  o Don't do any special things for TBI interface. Remove TBI
    specific media handling in the driver and have gentbi(4) handle
    it. Add glue code to read/write TBI PHY registers in miibus
    method. This change removes a lot of PHY handling code in driver
    and now its functionality is handled by mii(4).
  o Alignment fixup code is now applied only for strict-alignment
    architectures. Previously the code was applied for all
    architectures except i386. With this change amd64 will get
    instant Rx performance boost.
  o When driver fails to allocate a new mbuf, update if_qdrops so
    users can see what was wrong in Rx path.
  o Added a workaround for a hardware bug which resulted in short
    VLAN tagged frames(e.g. ARP) was rejected as if runt frame was
    received. With this workaround nge(4) now accepts the short VLAN
    tagged frame and nge(4) can take full advantage of hardware VLAN
    tag stripping. I have no idea how this bug wasn't known so far,
    without the workaround nge(4) may never work on VLAN
    environments.
  o Fixed Rx checksum offload logic such that it now honors active
    interface capability configured with ifconfig(8).
  o In nge_start()/nge_txencap(), always leave at least one free
    descriptor as indicated in datasheet. Without this the hardware
    would be confused with ring descriptor structure(e.g. no clue
    for the end of descriptor ring).
  o Removed dead-code that checks interrupts on PHY hardware. The
    code was designed to detect link state changes but it was
    disabled as driving nge_tick clock would break auto-negotiation
    timer. This code is no longer needed as nge(4) now uses mii(4)
    and link state change handling is done with mii callback.
  o Rearranged ethernet address programming logic such that it works
     on strict-alignment architectures.
  o Added IFCAP_VLAN_HWTAGGING/IFCAP_VLAN_HWCSUM handler in
     nge_ioctl() such that the functionality is configurable with
     ifconfig(8). DP83820/DP83821 can do checksum offload for VLAN
     tagged frames so enable Tx/Rx checksum offload for VLAN
     interfaces.
  o Simplified IFCAP_POLLING selection logic in nge_ioctl().
  o Fixed module unload panic when bpf listeners are active.
  o Tx/Rx descriptor ring address uses 64bit DMA address for
     readability. High address part of DMA would be 0 as nge(4)
     disabled 64bit DMA transfers so it's ok for DP83821.
  o Removed volatile keyword in softc as bus_dmamap_sync(9) should
     take care of this.
  o Removed extra driver private structures in descriptor ring. These
     extra elements are not part of descriptor structure. Embedding
     private driver structure into descriptor ring is not good idea
     as its size may be different on 32bit/64bit architectures.
  o Added miibus_linkchg method handler to catch link state changes.
  o Removed unneeded nge_ifmedia in softc. All TBI access is handled
    in gentbi(4). There is no difference between TBI and non-TBI case
    now.
  o Removed "gigabit link up" message handling in nge_tick. Link
    state change notification is already performed by mii(4) and
    checking link state by accessing PHY registers in periodic timer
    handler of driver is wrong. All link state and speed/duplex
    monitoring should be handled in PHY driver.
  o Use our own timer for watchdog instead of if_watchdog/if_timer
    interface.
  o Added hardware MAC statistics counter, users canget current MAC
    statistics from dev.nge.%d.stats sysctl node(%d is unit number of
    a device).
  o Removed unused macros, NGE_LASTDESC, NGE_MODE, NGE_OWNDESC,
    NGE_RXBYTES.
  o Increased number of Tx/Rx descriptors from 128 to 256. From my
    experience on gigabit ethernet controllers, number of descriptors
    should be 256 or higher to get an optimal performance on gigabit
    link.
  o Increased jumbo frame length to 9022 bytes to cope with other
    gigabit ethernet drivers. Experimentation shows no problems with
    9022 bytes.
  o Removed unused member variables in softc.
  o Switched from bus_space_{read|write}_4 to bus_{read|write}_4.
  o Added support for WOL.
2009-06-07 05:46:12 +00:00
Pyun YongHyeon 1541b8318c MFC r192288-192292,192294,192297-192299:
r192288:
  Use ANSI C declarations for all functions.

r192289:
  Remove register keyword.

r192290:
  Remove trailling whitespaces.

r192291:
  Remove return statement at the end of functions that return void.

r192292:
  style(9) - space after keyword.

r192294:
  s/u_int8_t/uint8_t/g
  s/u_int16_t/uint16_t/g
  s/u_int32_t/uint32_t/g

r192297:
  style(9)

r192298:
  Consistently use tab characters instead of spaces.

r192299:
  Remove extra parenthesis used in macros. These macros are not used
  in driver, though.
2009-06-07 05:41:13 +00:00
Pyun YongHyeon 960ecd2e74 MFC r190314:
Togging ALLMULTI does not require controller reset so have Rx
  filtering handle this. Introduce a new function msk_rxfilter that
  handles Rx filter configuration and multicast setup as well as
  promiscuous mode. This simplifies code a lot.
  Promiscuous mode always have preference to any other Rx
  filtering so don't disable the mode when ALLMULTI is set.
2009-06-07 05:22:22 +00:00
Pyun YongHyeon 284e8cd1f0 MFC r192706:
NVIDIA MCP controllers have no Rx buffer alignment restrictions.
  Remove PAGE_SIZE alignment used in Rx buffer DMA tag creation. The
  alignment restriction was used in old local jumbo allocator and
  nfe(4) switched to UMA backed page allocator for jumbo frame.

  This change should fix jumbo buffer allocation failure.

  Reported by:	Pascal Braun ( pascal.braun <> continum dot net )
2009-06-07 05:12:50 +00:00
Pyun YongHyeon d01b05203c MFC r192418:
pci(4) handles PCIM_CMD_INTxDIS so there is no need to poke this
  bit in driver.
2009-06-07 05:08:20 +00:00
Edwin Groothuis 8861c2ce4e MFC of r193486
Misc fixed to fortunes

PR:		conf/112024
Submitted by:	Niclas Zeising <[email protected]>
2009-06-07 04:49:23 +00:00
Dmitry Chagin a14d2dcf83 MFC r191887:
Add KTR(9) tracing for futex emulation.

Approved by:	kib (mentor)
2009-06-06 10:59:36 +00:00
Dmitry Chagin 882b23954d MFC r191876:
To avoid excessive code duplication move MI definitions to the MI
header file. As it is defined in Linux.

Approved by:	kib (mentor)
2009-06-06 10:55:11 +00:00
Edwin Groothuis 42800ac520 MFC of r193464, r193467
[patch] fortune(6): George Bernard Shaw quote fix
[patch] fortune(6): file not Y2.01K compliant

PR:		conf/129860, conf/131469
Submitted by:	Alan Amesbury <[email protected]>, John Hein <[email protected]>
2009-06-06 02:26:23 +00:00
Edwin Groothuis e53c102268 MFC of r193462:
[patch] calendar.music: Chuck Berry was born in St. Louis, Missouri, not Califor
nia

    The /usr/bin/calendar program reports that Chuck Berry was born
    in San Jose California but he was not born in California.

    Chuck Berry was born in St. Louis, Missouri in 1926 on October 18.

    http://www.chuckberry.com/about/bio.htm
    http://www.khaldea.com/charts/chuckberry.shtml
    http://en.wikipedia.org/wiki/Chuck_Berry

PR:             conf/128215
Submitted by:   comet--berkeley (aka Pablo Picasso) <[email protected]>
2009-06-06 02:17:33 +00:00
George V. Neville-Neil ab2c65ee6f MFC of 189643
Update the Chelsio driver to the latest bits from Chelsio

Firmware upgraded to 7.1.0 (from 5.0.0).
T3C EEPROM and SRAM added; Code to update eeprom/sram fixed.
fl_empty and rx_fifo_ovfl counters can be observed via sysctl.
Two new cxgbtool commands to get uP logic analyzer info and uP IOQs
Synced up with Chelsio's "common code" (as of 03/03/09)
2009-06-05 22:23:33 +00:00
George V. Neville-Neil 874ad012bf MFC of 185506 and 185508
Proper fix for tracking ifnet statistics

Update internal mac stats every time the tick task is called
if we don't do this "netstat -w 1" will frequently see negative
differences in packets sent
2009-06-05 15:57:07 +00:00
Kip Macy 852057b401 reverse previous commit ... 2009-06-05 12:14:43 +00:00
Kip Macy 95ab4da810 roll zfs loader support under MK_ZFS to enable / disable consistently 2009-06-05 12:00:55 +00:00
Edwin Groothuis 5cc7444d2e MFC of r179459 and r187110:
Remove a quote about the instant-workstation, this port
has been removed ages ago.

netcat is "now" in base, so point people at nc(1) instead of the port.

PR:		docs/124166
2009-06-05 11:55:32 +00:00
Christian Brueffer a144d2f3dc MFC: r192097
Compare the correct variable against NULL.

Reviewed by:	scottl
Found with:	Coverity Prevent(tm)
CID:		821
2009-06-04 17:55:42 +00:00
Konstantin Belousov 7a2db8368f MFC r192094:
Do not advance req->oldidx when sysctl_old_user returning an
error due to copyout failure or short buffer.

MFC r192144:
Revert r192094. The revision caused problems for sysctl(3) consumers
that expect that oldlen is filled with required buffer length even when
supplied buffer is too short and returned error is ENOMEM.

Redo the fix for kern.proc.filedesc, by reverting the req->oldidx when
remaining buffer space is too short for the current kinfo_file structure.
Also, only ignore ENOMEM. We have to convert ENOMEM to no error condition
to keep existing interface for the sysctl, though.
2009-06-04 15:10:29 +00:00
George V. Neville-Neil 696b776193 MFC of 186282
Check in the actual module recognition code for the Chelsio
driver.

Obtained from:	Chelsio Inc.
2009-06-03 23:01:13 +00:00
Edwin Groothuis d4cdeb374c MFC of tzdata2009h:
- Fix coordinates of Africa/Gaborone, Pacific/Noumea, Pacific/Tongatapu,
  Europe/Vatican

- Fix URLs (=3D -> = etc)

- Jordan doesn't go at last Friday of March 00:00 but no last
  Thursday of March 24:00

- Specifically state license for the data: public domain
2009-06-03 08:05:53 +00:00
David Christensen 8a3b5b9bc3 - MFC BCM5709 PHY code to fix fix ukphy attachment and PHY write timeout
errors.
2009-06-02 23:30:02 +00:00
Brian Somers fd261127d4 MFC: Mention the danger of running programs using ``!''.
PR:		112481
2009-06-02 09:25:56 +00:00
Dmitry Chagin 4721ea3c89 MFC r191875:
Return EAFNOSUPPORT instead of EINVAL in case when the incorrect or
unsupported domain argument to linux_socket() is specified.

Approved by:	kib (mentor)
2009-06-02 04:47:28 +00:00
Dmitry Chagin e887bb8338 MFC r191742,r191871:
Linux socketpair() call expects explicit specified protocol for
AF_LOCAL domain unlike FreeBSD which expects 0 in this case.

Return EAFNOSUPPORT in case when the incorrect domain argument
is specified.

Return EPROTONOSUPPORT instead of passing values that are not 0
to the BSD layer.

Approved by:	kib (mentor)
2009-06-02 04:44:38 +00:00
Attilio Rao 08ae8d0595 Remove double-inserted END() macros.
Reported by:	sobomax
2009-06-01 23:53:15 +00:00
Kip Macy f6b5e9bf8e memmove is defined in support.S on arm - don't compile in 2009-06-01 22:09:42 +00:00
Xin LI f1b1aa9b31 DMA synchronization fixes:
- In bce_rx_intr(), use BUS_DMASYNC_POSTREAD instead of
   BUS_DMASYNC_POSTWRITE, as we want to "read" from the
   rx page chain pages.
 - Document why we need to do PREWRITE after we have updated
   the rx page chain pages.
 - In bce_intr(), use BUS_DMASYNC_POSTREAD and
   BUS_DMASYNC_PREREAD when before and after CPU "reading"
   the status block.
 - Adjust some nearby style mismatches/etc.

Pointed out by:	yongari
Approved by:	davidch (no objection) but bugs are mine :)
2009-06-01 10:49:08 +00:00
Maxim Konovalov aefcbf4089 MFC r192747: fix typo in the example. 2009-06-01 05:48:30 +00:00
Dmitry Chagin bff285de4a MFC r191741:
Move extern variable definitions to the header file.

Approved by:	kib (mentor)
2009-06-01 04:44:43 +00:00
Ed Schouten 2be86a9a5f Correct the previous commit.
Also merge the operator file in share/misc, that is also part of r190855.
2009-05-31 18:14:24 +00:00
Ed Schouten f02b15ccbe MFC r190855:
Add C++ operators to operator(7) manual page.

  Submitted by:	Christoph Mallon <[email protected]>
2009-05-31 18:06:12 +00:00
Dmitry Chagin 55697af273 MFC r191719:
Reimplement futexes.
Old implemention used Giant to protect the kernel data structures,
but at the same time called malloc(M_WAITOK), that could cause the
calling thread to sleep and lost Giant protection. User-visible
result was the missed wakeup.

New implementation uses one sx lock per futex. The sx protects
the futex structures and allows to sleep while copyin or copyout
are performed.

Unlike linux, we return EINVAL when FUTEX_CMP_REQUEUE operation
is requested and either caller specified futexes are equial or
second futex already exists. This is acceptable since the situation
can only occur from the application error, and glibc falls back to
old FUTEX_WAKE operation when FUTEX_CMP_REQUEUE returns an error.

Approved by:	kib (mentor)
2009-05-31 06:58:35 +00:00
Attilio Rao b60e52e369 MFC r192760:
Use the END() macro appropriately in order to improve debugging for
tools (Valgrind mainly).
2009-05-30 23:27:48 +00:00
Edwin Groothuis 6d82dc28ad MFC of 192627 and 192626
Updated against http://www.loc.gov/standards/iso639-2/langhome.html
Snapshot was taken on 16 September 2008.

Update share/misc/iso639
Snapshot was taken on 23 May 2009.
2009-05-30 05:19:10 +00:00
Maksim Yevmenkin 9ba1a0b7da MFC r192113
Avoid floating point arithmetic while calculating iquiry length.

Submitted by:	Iain Hibbert < plunky -at- rya-online -dot- net >
2009-05-29 20:25:03 +00:00
Maksim Yevmenkin 2ed1a37bf4 MFC r192308
Teach btpand(8) to recognized Bluetooth device node names.

Tested by:	Daniel O'Connor <doconnor -at- gsoft -dot- com -dot- au>
2009-05-29 20:22:56 +00:00
Ulf Lilleengen 50eae11560 MFC r179097:
- Assert that we don't send new provider event for a provider which has
  G_PF_WITHER flag set.
- Fix typo in assertion condition (sorry, but I forgot who report that).

MFC r179151:
Force commit to note, that the typo in KASSERT() was:

PR:             kern/116896
Reported by:    VANHULLEBUS Yvan <[email protected]>
2009-05-29 19:37:17 +00:00
Andriy Gapon a4fedff5cd use new btxld when building world in older environment
This is a direct commit to the branch.
This is for the benefit of those who define LOADER_ZFS_SUPPORT but
should't hurt anybody else.
Build of zfsboot requires new feature of btxld that it obtained
(via MFC) in r192697: "merge 177933. Allow for a zero length 'loader'"
(btxld is a build tool and a cross-build tool)
Please note that __FreeBSD_version was bumped some time after r192697
for an unrelated change.

Reviewed by:	des
Approved by:	jhb (mentor)
2009-05-29 14:42:02 +00:00
Xin LI 1e55a0cced Bump __FreeBSDversion for fdopendir(3) MFC. 2009-05-29 06:57:45 +00:00
Xin LI ac619db30e MFC r178253 and r178256:
Implement fdopendir(3) by splitting __opendir2() into two parts, the upper
part deals with the usual __opendir2() calls, and the rest part with an
interface translator to expose fdopendir(3) functionality.  Manual page was
obtained from kib@'s work for *at(2) system calls.
2009-05-29 06:55:15 +00:00
Kip Macy ff685ae6ce MFC 192617
add zfs and zpool to /rescue
2009-05-28 23:05:17 +00:00
Xin LI 5bc4843143 Merge r192129+r190661:
Properly handle malloc() failures.

PR:	bin/83338
2009-05-28 21:52:00 +00:00
Xin LI 877b77c5fb Merge r190646:
Bail out when memory allocation is failed, rather than referencing
a NULL pointer.

PR: kern/94480
Submitted by: Michiel Pelt <m.pelt xs4all nl>
2009-05-28 21:17:27 +00:00
Dmitry Chagin a47bd4c2b1 Merge r191883,191966,191973 from HEAD to stable/7:
Linux exports HZ value to user space via AT_CLKTCK auxiliary vector
entry since 2.4.0.
Being exported, AT_CLKTCK is returned by sysconf(_SC_CLK_TCK),
glibc falls back to the hard-coded CLK_TCK value when aux entry
is not present.

Glibc versions prior to 2.2.1 always use hard-coded CLK_TCK value.

For older applications/libc's which depends on hard-coded CLK_TCK
value user should set compat.linux.osrelease less than 2.4.0.

linux_times() shall use the value that is exported to user space.

PR:		kern/134251
Approved by:	kib (mentor)
2009-05-28 18:26:18 +00:00
Dag-Erling Smørgrav f845a14e38 Expand keywords. 2009-05-28 17:36:44 +00:00
Konstantin Belousov 625eb4b248 MFC r191895:
Eliminate the loop and the call to pause(9) in vfs_vget_ino().

Tested by:	Mykola Dzham <i levsha org ua>
2009-05-28 16:08:33 +00:00
Dmitry Chagin da43a0af36 Direct commit. Fix error introduced in my r192950 merge.
Osrel variable should be initialized before use.

Pointyhat to:	me

Approved by:	kib (mentor)
2009-05-28 16:05:22 +00:00
John Baldwin b948153b61 MFC: Largely revert the earlier change to use a single CCB for the RAID
recovery thread.
2009-05-28 14:48:10 +00:00
Kip Macy cdfabc5287 MFC 185095
r185095 | dfr | 2008-11-19 08:04:07 -0800 (Wed, 19 Nov 2008) | 3 lines

If we free the GPT partition list in bd_open_gpt() because of an error, don't
try to free it again in bd_closedisk(). While I'm here, fix a DEBUG print.
2009-05-28 07:37:49 +00:00
Dmitry Chagin 677f5ed0a2 Merge r192373 from HEAD to stable/7:
Validate user-supplied arguments values.
Args argument is a pointer to the structure located in user space in
which the socketcall arguments are packed. The structure must be
copied to the kernel instead of direct dereferencing.

Approved by:	kib (mentor)
2009-05-28 04:08:07 +00:00
Dmitry Chagin 8a39576dd1 Merge r191972 from HEAD to stable/7:
Introduce linux_kernver() interface which is intended for an exact
designation of the emulated kernel version.

linux_kernver() returns integer value formatted as 'VVVMMMIII' where
VVV - version, MMM - major revision, III - minor revision.

Approved by:	kib (mentor)
2009-05-28 04:00:03 +00:00
Edwin Groothuis 01e5f29112 MFC of r192482:
Add regression tests for the date(1) + argument for user-defined
format strings.

PR:		bin/127514
2009-05-27 12:33:57 +00:00
Christian Brueffer 79f985ab50 MFC: r192036
Fix memory leak in an error case.
2009-05-27 11:03:14 +00:00
Bruce A. Mah 475bf5bb0d New release note: ZFS version 13. 2009-05-27 03:51:04 +00:00
Dag-Erling Smørgrav 9e4737950a MFC r175936: add shebang. 2009-05-26 21:40:15 +00:00
John Baldwin d688efcf51 MFC: Reduce the number of bounce zones (and thus the number of bounce
pages) used in some cases.
2009-05-26 16:01:50 +00:00
John Baldwin 958322439a MFC: Add a read-only sysctl hw.pci.mcfg to mirror the tunable by the same
name.
2009-05-26 15:33:34 +00:00
John Baldwin f7b6946acb MFC: Only use the ABI compat shim for vfs.bufspace if the old buffer is
smaller than a long.
2009-05-26 15:30:32 +00:00
John Baldwin 19652849a4 MFC: Adjust the way we number CPUs on x86 so that we attempt to "group" all
logical CPUs in a package.
2009-05-26 14:13:12 +00:00
Dmitry Chagin 3252c37a81 Merge r191877 from HEAD to stable/7:
Add preliminary KTR(9) support to the linux emulation layer.

Approved by:	kib (mentor)
2009-05-26 13:37:05 +00:00
Dmitry Chagin 76ff5e9f8f Merge r191880 from HEAD to stable/7:
Change linux struct tms definition to match actual linux one.

Approved by:	kib (mentor)
2009-05-25 20:35:41 +00:00
Dmitry Chagin 02d26c0f39 Merge r191989 from HEAD to stable/7:
Translate l_timeval arg to native struct timeval in
linux_setsockopt()/linux_getsockopt() for SO_RCVTIMEO,
SO_SNDTIMEO opts as l_timeval has MD members.

Remove bogus __packed attribute from l_timeval struct on __amd64__.

PR:		kern/134276
Submitted by:	Thomas Mueller <tmueller sysgo com>
Approved by:	kib (mentor)
2009-05-25 20:24:36 +00:00
Dmitry Chagin 8c3850f085 Merge r191988 from HEAD to stable/7:
Add forgotten linux to bsd flags argument mapping into the linux_recv().

PR:		kern/134276
Submitted by:	Thomas Mueller <tmueller sysgo com>
Approved by:	kib (mentor)
2009-05-25 19:55:00 +00:00
Dmitry Chagin ec54525f08 Merge r191269 from HEAD to stable/7:
Remove support for FUTEX_REQUEUE operation.
Glibc does not use this operation since 2.3.3 version (Jun 2004),
as it is racy and replaced by FUTEX_CMP_REQUEUE operation.
Glibc versions prior to 2.3.3 fall back to FUTEX_WAKE when
FUTEX_REQUEUE returned EINVAL.

Any application directly using FUTEX_REQUEUE without return
value checking are definitely broken.

Limit quantity of messages per process about unsupported
operation.

Approved by:	kib(mentor)
2009-05-25 14:36:21 +00:00
Maxim Konovalov 6aaf83cdf9 MFC r191681,191698,191834: NetBSD 5.0, OpenBSD 4.5, FreeBSD 7.2 added. 2009-05-25 10:22:39 +00:00
Maxim Konovalov 16086bd7e0 MFC r192198: add missed semicolon in action script. 2009-05-25 10:12:27 +00:00
Maxim Konovalov 6a3d9670dd MFC r191682: correct ng_hole(4) control messages names. 2009-05-25 10:10:46 +00:00
Maxim Konovalov e7a9755fbf MFC r191454: correct geli(8) command line. 2009-05-25 10:09:05 +00:00
Doug Barton ac9beb47ea MFC 192219:
Add -L to the mtree invocation to chase symbolic links that are present
in "Service jails."

MFC 192230:
Enhance the safety and efficiency of the -U option,
fix indentation on one line.
2009-05-25 04:11:30 +00:00
Kip Macy 62bcef4fba don't try building zfsboot and gptzfsboot if zfs loader is not enabled 2009-05-25 03:06:26 +00:00
Kip Macy 104e1ea9e1 import gptzfsboot 2009-05-25 02:59:54 +00:00
Kip Macy a18db98967 merge 177933
Allow for a zero length 'loader'.
2009-05-24 20:49:22 +00:00
Kip Macy 5f59ef92b8 Import ZFS loader support missed in the initial MFC
set LOADER_ZFS_SUPPORT=Y in make.conf to enable
2009-05-23 19:54:18 +00:00
Antoine Brodin dcfe81a9be MFC r189872 to stable/7:
Chase the k8temp->amdtemp rename in NOTES and loader.conf.
2009-05-23 17:17:54 +00:00
Christian Brueffer ed558524af MFC: r192410
Since audit(4) isn't based on posix1e, remove the commented out audit.h header,
xref libbsm(3).
2009-05-23 10:35:27 +00:00
Dag-Erling Smørgrav c5990780ac Expand $FreeBSD$ 2009-05-22 23:29:05 +00:00
Dag-Erling Smørgrav 8789021c7a Expand $FreeBSD$ 2009-05-22 22:57:05 +00:00
Colin Percival 87dfd11d2a MFC r192130:
Allow a comma-separated list of network interfaces to be specified via the
  netDev option in install.cfg.
2009-05-22 21:26:34 +00:00
Kip Macy d7f0b92c76 some ports erroneously use the existence of AT_FDCWD to check for
the availability of the *at system calls so s/AT_FDCWD/AT_FDCWD_notyet/g

Reported by: Dimitry Andric
2009-05-22 17:54:02 +00:00
Antoine Brodin c671218265 MFC r191318 to stable/7:
vlan(4) no longer depends on miibus(4).

  Reviewed by:	jhb@
  MFC after:	1 month
2009-05-22 16:11:00 +00:00
Rui Paulo 3d84c05ee1 Mention k8temp -> amdtemp rename. 2009-05-21 17:12:13 +00:00
Rui Paulo 67bb7ab286 MFC 189748, 189768, 189769, 189774:
Rename k8temp to amdtemp and add support for the 10h and 11h families.
2009-05-21 17:09:23 +00:00
John Baldwin 4510d2475a MFC: Use a separate sx lock to try to limit wiring too much user memory for
userland sysctl requests.  "Small" userland requests can now run
concurrently.
2009-05-21 14:51:31 +00:00
Ed Schouten 5864a8b740 Add missing colon. 2009-05-21 10:03:50 +00:00
Kip Macy 495bf67d92 remove duplicated file contents
Reported by: [email protected]
2009-05-21 05:58:29 +00:00
Kip Macy 98a0f520bb remove duplicate patching 2009-05-21 05:38:50 +00:00
Ruslan Ermilov 057b0576e3 Fixed multi-byte character support to actually work. 2009-05-21 04:49:02 +00:00
Brad Davis 7a5a11f84a Add some missing blank lines.
Approved by:	kmacy@
2009-05-21 02:18:10 +00:00
Kip Macy 5c76315188 MFC ZFS version 13. This includes the changes by pjd (see original message
below) as well as the following:

- the recurring deadlock was fixed by deferring vinactive to a dedicated thread

- zfs boot for all pool types now works
      Submitted by: dfr

- kmem now goes up to 512GB so arc is now limited by physmem

- the arc now experiences backpressure from the vm (which can be too
much - but this allows ZFS to work without any tunables on amd64)

- frequently recurring LOR in the ARC fixed

- zfs send coredump fix

- fixes for various PRs

Supported by: Barrett Lyon, BitGravity

Revision 185029 - (view) (annotate) - [select for diffs]
Modified Mon Nov 17 20:49:29 2008 UTC (6 months ago) by pjd
File length: 38244 byte(s)
Diff to previous 177698

Update ZFS from version 6 to 13 and bring some FreeBSD-specific changes.

This bring huge amount of changes, I'll enumerate only user-visible changes:

- Delegated Administration

       Allows regular users to perform ZFS operations, like file system
       creation, snapshot creation, etc.

- L2ARC

       Level 2 cache for ZFS - allows to use additional disks for cache.
       Huge performance improvements mostly for random read of mostly
       static content.

- slog

       Allow to use additional disks for ZFS Intent Log to speed up
       operations like fsync(2).

- vfs.zfs.super_owner

       Allows regular users to perform privileged operations on files stored
       on ZFS file systems owned by him. Very careful with this one.

- chflags(2)

       Not all the flags are supported. This still needs work.

- ZFSBoot

       Support to boot off of ZFS pool. Not finished, AFAIK.

       Submitted by:   dfr

- Snapshot properties

- New failure modes

       Before if write requested failed, system paniced. Now one
       can select from one of three failure modes:

       Before if write requested failed, system paniced. Now one
       can select from one of three failure modes:
       - panic - panic on write error
       - wait - wait for disk to reappear
       - continue - serve read requests if possible, block write requests

- Refquota, refreservation properties

       Just quota and reservation properties, but don't count space consumed
       by children file systems, clones and snapshots.

 - Sparse volumes

       ZVOLs that don't reserve space in the pool.

 - External attributes

       Compatible with extattr(2).

 - NFSv4-ACLs

       Not sure about the status, might not be complete yet.

       Submitted by:   trasz

 - Creation-time properties

 - Regression tests for zpool(8) command.

 Obtained from:        OpenSolaris
2009-05-20 23:34:59 +00:00
Kip Macy 4474790264 MFC minimal zfs lock ordering for WITNESS
(dnode -> dirty record -> dbuf)
2009-05-20 22:32:25 +00:00
Kip Macy 73cfa16b2d td_osd is at the end of struct thread to avoid breaking the ABI
as a side effect it is outside of the td_startzero-td_endzero range,
requiring it to be separately zeroed
2009-05-20 22:30:57 +00:00
Kip Macy ad6e4abab2 MFC quad tunables and sysctls for setting ZFS arc cache size 2009-05-20 22:28:39 +00:00
Kip Macy fa12f7681f add vdestroy declaration now that it is no longer static
- needed by ZFS
2009-05-20 22:27:18 +00:00
Kip Macy 844d93dbdd make vdestroy globally visible for ZFS 2009-05-20 22:26:03 +00:00
Kip Macy f859492e86 make vfsopt globally visible for ZFS 2009-05-20 22:24:31 +00:00
Kip Macy 1795ff2927 add UID_NOBODY 2009-05-20 22:19:48 +00:00
Kip Macy 54037b845c MFC memmove support
ZFS MFC dependency
2009-05-20 22:13:21 +00:00
Kip Macy 0c692d4705 MFC accmode_t
ZFS MFC dependency
2009-05-20 22:10:34 +00:00
Kip Macy 98e51e760e - make vfsoptlist globally visible
- ZFS MFC dependency
2009-05-20 22:09:49 +00:00
Xin LI be0e8666e4 MFC r192127:
Try to workaround a race where bge_stop() may sneak in when bge_rxeof()
drops and re-grabs the softc mutex in the middle, resulting in kernel
trap 12.  This may happen when a lot of traffic is being hammered on
one bge(4) interface while the system is shutting down.

Reported by:	Alexander Sack <pisymbol gmail com>
PR:		kern/134548
2009-05-20 21:17:10 +00:00
Xin LI ca25976ac9 MFC r191923 (davidch):
- Fixed incorrect packet length problem caused be earlier change to
    support ZERO_COPY_SOCKETS.
  - Created #define for context initialization retry count.
2009-05-20 21:13:49 +00:00
Kip Macy d1958d4305 - MFC "object specific data" support with rmlocks replaced with rwlocks
- ZFS MFC dependency
2009-05-20 21:04:41 +00:00
Kip Macy 9913161052 include fcntl.h to define AT_FDCWD 2009-05-20 20:57:40 +00:00
Kip Macy ff4abdbdd1 MFC NDINIT macros without changing the size of nameidata 2009-05-20 20:08:51 +00:00
Kip Macy 12b37bc141 increase kmem map to 512GB
discussed with: alc
2009-05-20 20:02:40 +00:00
Christian Brueffer c53feaee45 MFC: r192265
Document sbuf_new_auto().

While here, add a missing `-' in phk's name.
2009-05-20 10:07:20 +00:00
Christian Brueffer 0f55559ab0 MFC: r192228
Drop clause 3 of the license as per rev. 1.35 from OpenBSD.

Obtained from:	OpenBSD
2009-05-20 10:05:44 +00:00
Christian Brueffer cf1697486d MFC: r192220
Sync up to rev. 1.25 from OpenBSD:

1.19: nop
1.20: nop
1.21: nop
1.22: typo fixed
1.23: license clauses 3 and 4 nuked
1.24: nop
1.25: Sun Crypto Accelerator 1000 has a 5821 chip on it

Obtained from:	OpenBSD
2009-05-20 10:04:17 +00:00
Pyun YongHyeon 2d74f0b482 MFC r189379:
Now pci(4) handles PCIM_CMD_INTxDIS so there is no need to poke
  this bit in driver.
2009-05-20 03:28:35 +00:00
Alexander Motin 5fefc7f437 MFC rev. 192032
Fix copy-paste bug in NGM_NETFLOW_SETCONFIG argument size verification.

PR:		kern/134220
Submitted by:	Eugene Mychlo
2009-05-20 02:48:53 +00:00
Pyun YongHyeon 09febf02c4 MFC r191716:
Separate multicast filtering of SysKonnect GENESIS and Marvell
  Yukon from common multicast handling code. Yukon uses hash-based
  multicast filtering(big endian form) but GENESIS uses perfect
  multicast filtering as well as hash-based one(little endian form).
  Due to the differences of multicast filtering there is no much
  sense to have a common code.
   o Remove sk_setmulti() and introduce sk_rxfilter_yukon(),
     sk_rxfilter_yukon() that handles multicast filtering setup.
   o Have sk_rxfilter_{yukon, genesis} handle promiscuous mode and
     nuke sk_setpromisc(). This simplifies ioctl handler as well as
     giving a chance to check validity of Rx control register of
     Yukon.
   o Don't reinitialize controller when IFF_ALLMULTI flags is changed.
   o Nuke sk_gmchash(), it's not needed anymore.
   o Always reconfigure Rx control register whenever a new multicast
     filtering condition is changed. This fixes multicast filtering
     setup on Yukon.

  PR:	kern/134051
2009-05-20 02:24:09 +00:00
Pyun YongHyeon 1e7b46b7f7 MFC r190499:
o Don't access VPD even if hardware advertised the capability.
    It seems that some revision of controller hang while accessing
    the VPD. Because VPD access routine are unused, nuke it.
  o Let TWSI reload EEPROM if VPD capability is detected. Reloading
    EEPROM will also set ethernet address so age(4) now reads AGE_PAR0
    and AGE_PAR1 register to get ethernet address. This removes a lot
    of hack and enhance readability a lot.
  o Double PHY reset timeout as it takes more time to take PHY out of
    power-saving state.
  o Explicitly check power-saving state by checking undocumented PHY
    registers. If link is not up, poke undocumented registers to take
    PHY out of power-saving state. This is the same way what Linux
    does. On resume, make sure to wake up PHY.
  o Don't rely on auto-clearing feature of master reset bit, just wait
    1ms and check idle status of MAC.
  o Add PCI device revision information in bootverbose mode.
  This should fix occasional controller hang in device attach phase.

  Reported by:	barbara < barbara.xxx1975 at libero DOT it >
  Tested by:	barbara < barbara.xxx1975 at libero DOT it >
2009-05-20 02:18:26 +00:00
Pyun YongHyeon 7ec5702155 MFC r190303:
Fix inversed logic. pci_find_extcap() returns 0 when it finds
  specified capability.
2009-05-20 02:13:01 +00:00
Hiroki Sato c25d95bb24 Document fxp(4) TSO issue on 7.2R.
Submitted by:	delphij
2009-05-20 00:55:26 +00:00
John Baldwin df0122f664 MFC:
- Add the interrupt vector number to intr_event_create so MI code can
  lookup hard interrupt events by number.
- Add support to cpuset for binding hardware interrupts.
2009-05-19 22:07:54 +00:00
John Baldwin 7764434677 MFC: Add a MI intr_event_handle() routine for the non-INTR_FILTER case.
This allows all the INTR_FILTER #ifdef's to be removed from the MD
interrupt code.
2009-05-19 19:45:36 +00:00
Scott Long c355440325 Merge PCI ID additions from vendor 2009-05-19 18:14:04 +00:00
John Baldwin e57713fcd7 MFC:
- Add a void pointer to the ata-pci controller softc to allow
  chipset-specific code to attach chipset-specific data.
- Use chipset-specific data in the acard and promise chipsets rather than
  changing the ivars of ATA PCI devices.
2009-05-19 15:47:42 +00:00
John Baldwin 00bfbbe878 MFC: Add SATA and PCI Advanced Features capabilities reporting. 2009-05-19 15:33:41 +00:00
John Baldwin e821af69e4 MFC: Add more PCI-express capability registers and display additional
details about PCI-express devices.
2009-05-19 14:01:57 +00:00
Marcel Moolenaar a10378d1c1 MFC r190834:
Fix hangs caused by hardware that signals receive errors
(framing, parity, etc), but does not indicate characters
being received. Since no chracters have been received,
ignore the line errors.

PR:		131006
2009-05-18 22:45:09 +00:00
John Baldwin f8f445ad5f MFC: Remove dependency of vlan.ko on miibus.ko. 2009-05-18 21:44:33 +00:00
John Baldwin 277068bff1 MFC: Convert IPFW_DEFAULT_TO_ACCEPT into a loader tunable. 2009-05-18 20:23:16 +00:00
John Baldwin ea58be2ff4 MFC: Use __null for NULL for GNU C++ 4.x and use the same value for NULL
in the kernel as in userland.
2009-05-18 17:39:12 +00:00
John Baldwin c520157ddf MFC: Simplify the interrupt code a bit by always including the ie_disable
and ie_eoi methods and collapsing down to a single intr_event_create()
routine.
2009-05-18 17:14:23 +00:00
Konstantin Belousov 7e51d45334 MFC r192151:
Initialize f_vnode before calling d_fdopen() cdevsw method.
2009-05-18 08:41:59 +00:00
Alan Cox c3be6d6c1a MFC r180308
Enable the creation of a kmem map larger than 4GB.
2009-05-18 07:24:06 +00:00
Bruce M Simpson c48c09e406 MFC rev 191654:
Fix an obvious bug in getsourcefilter()'s use of struct __msfilterreq;
the kernel will return in msfr_nsrcs the number of source filters
in-mode for a given multicast group.
However, the filters themselves were never copied out, as the libc
function clobbers this field with zero, causing the kernel to assume
the provided vector of struct sockaddr_storage has zero length.
This bug would only affect users of SSM multicast, which is shimmed
in 7.x.
Picked up during mtest(8) refactoring.
2009-05-17 15:42:41 +00:00
Fabien Thomas 747782762c MFC 190395: Allow compile from c++ for libpmc
Reviewed by: jkoshy (mentor)
2009-05-17 11:45:37 +00:00
Konstantin Belousov e6e4bcf69c MFC r191315:
In ufs_checkpath(), recheck that '..' still points to the inode with
the same inode number after VFS_VGET() and relock of the vp. If '..'
changed, redo the lookup.

Supply the source inode number as an argument to ufs_checkpath() instead
of the source inode itself.
2009-05-16 17:22:03 +00:00
Konstantin Belousov 5fdefd4ab6 MFC r191137:
Verify that '..' still exists with the same inode number after
VFS_VGET() has returned in ufs_lookup().

MFC r191260:
When verifying '..' after VFS_VGET() in ufs_lookup(), do not return
error if '..' is still there but changed between lookup and check.
Start relookup instead.
2009-05-16 17:15:26 +00:00
John Baldwin f3c702f83e MFC: Add a new type of KTRACE record for sysctl(3) invocations. 2009-05-15 20:58:52 +00:00
John Baldwin a43e11c99c MFC: Add caching of -ve lookups to the NFS client. To prevent clients from
not noticing new files created by another client for a "long" time, reduce
the default timeout for caching attributes of directories from 30 seconds
to 3 seconds.
2009-05-15 20:36:54 +00:00
John Baldwin 23b4046188 MFC: Update comment above _fget() now that FWRITE failures return EBADF. 2009-05-15 20:13:15 +00:00
John Baldwin b86a31ac05 MFC: Adjust some variables (mostly related to the buffer cache) that hold
address space sizes to be longs instead of ints.  This includes an ABI
compat shim for the kern.bufspace sysctl for old binaries.
2009-05-15 19:54:19 +00:00
John Baldwin 20bc526933 MFC: Expand the CPU column to two chars and print in decimal rather than
hex.
2009-05-15 19:19:27 +00:00
John Baldwin ad55bb9458 MFC: Change ichsmb(4) to follow the format of all the other smbus
controllers for slave addressing by using left-adjusted slave addresses
(i.e. xxxxxxx0b).
2009-05-15 18:50:30 +00:00
Doug Rabson d33da86cbc Back port a change to the locking model used to manage active transports from
FreeBSD-current to avoid a deadlock.

PR:		130628
2009-05-15 13:58:45 +00:00
Konstantin Belousov b47cd13406 MFC r192012:
Return controlled EINVAL when the fdescfs lookup routine is given string
representing too large integer, instead of overflowing and possibly
returning a random but valid vnode.
2009-05-15 10:45:52 +00:00
Ed Schouten 698866be32 Make the layout of pstat -t less awful.
Right now we have a device named "consolectl", but pstat only reserves 7
columns for the device name. Increase it to 10 to make it fit.

This patch only applies to pre-MPSAFE TTY.
2009-05-14 22:01:00 +00:00
Konstantin Belousov 73faeaac64 MFC r192001:
Prevent overflow of uio_resid.
2009-05-14 11:03:05 +00:00
VANHULLEBUS Yvan 2b46e336ad MFC: Fixed deletion of sav entries in key_delsah()
Approved by:	gnn(mentor)
Obtained from:	NETASQ
2009-05-14 07:32:33 +00:00
Dag-Erling Smørgrav 8e7085c943 MFC r188677: always call pfs_attr if defined
MFC r190806: fix incorrect KASSERT, add more
MFC r188677: remove incorrect locking
2009-05-14 02:42:29 +00:00
Dag-Erling Smørgrav bc549979f6 MFC r190030: rename a couple of functions, add comments 2009-05-14 02:27:38 +00:00
Dag-Erling Smørgrav 7d2ab6e443 MFC r190774: fix ISO8859-15 links for nb_NO / no_NO. 2009-05-14 02:20:37 +00:00
Dag-Erling Smørgrav 1861b7c338 MFC r190032: add hostid 2009-05-14 02:14:46 +00:00
Dag-Erling Smørgrav 5d0ab90f4a MFC r187915: make sure columns don't run into each other.
PR:		bin/129318
2009-05-14 02:10:31 +00:00
Dag-Erling Smørgrav 674affe441 MFC r186224: exeunt <sysexits.h> 2009-05-14 02:09:09 +00:00
Dag-Erling Smørgrav b420ca45d0 MFC 185912: Apply the same defaults to HTTPS as to HTTP.
MFC 187361: Fix FTP / HTTP timeouts
2009-05-14 02:07:41 +00:00
Dag-Erling Smørgrav e68fed3178 MFC r184691: convert to UTF-8. 2009-05-14 02:00:50 +00:00
Dag-Erling Smørgrav 2e07621850 MFC r184690: missing email address 2009-05-14 01:41:54 +00:00
Dag-Erling Smørgrav 5e48d51595 MFC r184638: style and WARNS cleanup 2009-05-14 01:40:36 +00:00
Dag-Erling Smørgrav ed666d2f7b MFC r184633, r184635, r184683: WARNS cleanup 2009-05-14 01:38:06 +00:00
Dag-Erling Smørgrav ccd27c92bb MFC r183696, r183698: enable UTF-8 for man pages. 2009-05-14 01:35:43 +00:00
Marius Strobl 0d02dad3bf MFC: r191979
Change uses of the struct ccb_hdr timeout_ch missed when isp(4) was
adapted to MPSAFE cam(4) to a isp(4) specific callout structure.
Thanks to Florian Smeets for providing access to a machine exhibiting
this problem for debugging.

Approved by:	mjacob
2009-05-13 19:26:04 +00:00
Alexander Motin bc529ceefd Make vendor-specific drivers prefered over the generic AHCI one.
This fixes some controllers, like JMicron ones, which provide also PATA via
PCI function that declared as AHCI controller.

This is not an MFC, but the same was already done in 8-CURRENT in other way.

PR:		kern/132082
2009-05-13 02:55:21 +00:00
Xin LI 6d97b0001a MFC r190324:
Support for a new environment variable, LD_ELF_HINTS_PATH for overriding
the rtld hints file.  This environment variable would be unset if the
process is considered as tainted with setuid/setgid.  This feature gives
a convenient way of using a custom set of shared library that is not
located in the default location and switch back.

Feature requested by:	iXsystems
Original patch by:	John Hixson
MFC after:		2 weeks
2009-05-12 02:17:25 +00:00
John Baldwin 5f29ef1acd MFC: Always compute the root of the kernel source tree and explicitly pass
it to module builds.
2009-05-11 16:37:31 +00:00
Marius Strobl ca86c9afcf MFC: r191638
- Change some softc members to be unsigned where more appropriate.
- Add some missing const.
- Move the size of the window spun by the registers to the softc
  as neither using va_mem_size for this nor va_mem_base for the
  start of the bus addresses is appropriate.
2009-05-10 19:50:24 +00:00
Marius Strobl 7ad5f79aad MFC: r191077
Fix whitespace.
2009-05-10 19:40:59 +00:00
Marius Strobl e91c965e3d MFC: r191071
Fix masking of TTE bits; the TD_*_MASK macros need shifting via the
corresponding TD_*_SHIFT.
2009-05-10 19:29:06 +00:00
Marius Strobl 29cad4d3a5 MFC: r191012
Fix whitespace.
2009-05-10 19:27:05 +00:00
Xin LI ea2df36e4f MFC r176093 (glebius):
If the vhid already present, return EEXIST instead of
non-informative EINVAL.
2009-05-09 00:35:38 +00:00
Philip Paeps 70f081d1dc MFC r191894: Add PCI IDs for the Broadcom 5825 incarnation. 2009-05-08 14:01:40 +00:00
Konstantin Belousov 4d0c153830 MFC r191439:
Do not call vm_page_lookup() from the ddb routine, namely from "show
vmopag" implementation. Iterate over memq to calculate the runs. Make
the code slightly more style-compliant.
2009-05-07 10:37:22 +00:00
Pyun YongHyeon b4a2232235 MFC r190982:
Don't blindly set IP packet length from interface MTU in TSO case.
  Remote host can advertise smaller MSS than that of sender so upper
  stack might have adjusted the MSS which in turn generates IP
  packets that are less size than that of interface MTU.

  Reported by:	Bjoern Koenig ( bkoenig <> alpha-tierchen dot de )
2009-05-07 01:14:59 +00:00
Xin LI 3e2ab5b730 MFC r191005:
Don't exit until all truss children were exit.
2009-05-06 22:26:49 +00:00
Xin LI 2d3b0124c1 MFC r191004:
Correct a bug where pr_data should have been assigned.
2009-05-06 22:26:04 +00:00
Andriy Gapon d7287400a9 MFC r174848 by julian: give thread0 the tid 100000
... and bumpt the others to start at 100001.
This is convenient for ACPI code that needs a thread id that is
never zero.

Reviewed by:	jkim
Approved by:	jhb (mentor)
2009-05-05 18:02:07 +00:00
Remko Lodder 239f705a21 MFC r182896
Add support for the CyberPower CP1500AVRLCD.

  PR: 126845
  Submitted by: gavin
  Approved by: imp (mentor, implicit)
  MFC after: 1 week

Approved by:	imp (mentor, implicit)
2009-05-05 16:37:33 +00:00
Dmitry Chagin 91effcb175 Merge from HEAD to stable/7:
r189861:
Include linux_futex.h before linux_emul.h

r189862:
Ignore FUTEX_FD op, as it is done by linux.

r189867:
Sort include files in the alphabetical order.

Approved by:	kib (mentor)
2009-05-05 15:19:45 +00:00
Dmitry Chagin 9c6b686b59 Regenerate syscall table after 191820.
Approved by:	kib (mentor)
2009-05-05 14:55:23 +00:00
Dmitry Chagin 7a57d7ffe8 Merge from HEAD to stable/7:
r178976 (rdivacky):
Implement robust futexes. Most of the code is modelled after
what Linux does. This is because robust futexes are mostly
userspace thing which we cannot alter. Two syscalls maintain
pointer to userspace list and when process exits a routine
walks this list waking up processes sleeping on futexes
from that list.

r183871:
Make robust futexes work on linux32/amd64. Use PTRIN to read
user-mode pointers. Change types used in the structures definitions to
properly-sized architecture-specific types.

r185002:
In the robust futexes list head, futex_offset shall be signed,
and glibc actually supplies negative offsets. Change l_ulong to l_long.

Approved by:	kib (mentor)
2009-05-05 14:53:58 +00:00
John Baldwin 75f65e59dc MFC: Sync with HEAD
- Proxy PCI MSI/MSI-X requests and bus interrupt requests for child devices
  instead of passing them through directly.  This allows child devices to use
  MSI/MSI-X interrupts.
- Proxy PCI VPD requests.
- Proxy bus resource allocation requests to allow multiple child devices to
  share access to a BAR.
2009-05-05 14:46:18 +00:00
Konstantin Belousov 2699528af6 MFC r191136:
In flushbufqueues(), do not allocate sentinel buffer on the stack,
struct buf is large. Use sleeping malloc(9) call, and zero the allocated
buf as a debugging feature.
2009-05-05 10:46:49 +00:00
Konstantin Belousov 00e577aacb MFC r191135:
Export the number of times bufdaemon got help from the normal threads.
2009-05-05 10:43:14 +00:00
Konstantin Belousov a899912cb6 MFC r189878:
Fix two issues with bufdaemon, often causing the processes to hang in
the "nbufkv" sleep.

Do not retry request for the new block from ffs_bufwrite() when write is done
from bufdaemon and there is a buffer shortage.

In getnewbuf(), help bufdaemon to flush dirty buffers owned by the vnode
locked by curthread.

For MFC, default value for sysctl vfs.flushbufqtarget is set to -1,
disabling the helpers. The TDP_BUFNEED flag value from HEAD conflicts
with TDP_UPCALLING KSE bit, so it is moved to the end of allocated bits.
2009-05-05 10:34:43 +00:00
Konstantin Belousov 6e50eda62a MFC r191313:
On the exit of the child process which parent either set SA_NOCLDWAIT
or ignored SIGCHLD, unconditionally wake up the parent instead of doing
this only when the child is a last child.

MFC r191319:
Fix typo.
2009-05-05 09:24:20 +00:00
Konstantin Belousov dea711cfff MFC r190690:
When removing or renaming snaphost, do not delve into request_cleanup().
The later may need blocks from the underlying device that belongs
to normal files, that should not be locked while snap lock is held.
2009-05-05 09:20:07 +00:00
Konstantin Belousov da9843b9b5 MFC r190886:
When vm_map_wire(9) is allowed to skip holes in the wired region, skip
the mappings without any of read and execution rights, in particular,
the PROT_NONE entries. This makes mlockall(2) work for the process
address space that has such mappings.

Since protection mode of the entry may change between setting
MAP_ENTRY_IN_TRANSITION and final pass over the region that records
the wire status of the entries, allocate new map entry flag
MAP_ENTRY_WIRE_SKIPPED to mark the skipped PROT_NONE entries.
2009-05-05 09:16:57 +00:00
Konstantin Belousov 53d645c2e4 MFC r191011:
The bus_dmamap_load_uio(9) shall use pmap of the thread recorded in the
uio_td to extract pages from, instead of unconditionally use kernel
pmap.
2009-05-05 09:08:37 +00:00
Edwin Groothuis d51ceffba7 MFC of tzdata2009g:
Egypt will have DST till the end of September the coming years.
2009-05-05 07:05:13 +00:00
Dmitry Chagin 9acde6f0e0 Regenerate syscall table after r191804.
Approved by:	kib (mentor)
2009-05-05 03:51:41 +00:00
Dmitry Chagin 8f3a24af77 Merge r178257 (jkim) from HEAD to stable/7:
Add stubs for syscalls introduced in Linux 2.6.17 kernel.
Some GNU libc version started using them before 2.6.17
was officially out.

Approved by:	kib (mentor)
2009-05-05 03:49:30 +00:00
John Baldwin cdc332da61 MFC: When a file lookup fails due to encountering a doomed vnode from a
forced unmount, consistently return ENOENT rather than EBADF.
2009-05-04 21:58:32 +00:00
Maksim Yevmenkin 37ee796c38 MFC r190869
Introduce KB_POLLED flag to struct keyboard's kb_flags field.

Reviewed by:	freebsd-current@, freebsd-hackers@
2009-05-04 21:13:06 +00:00
John Baldwin 5cd9269c49 MFC: Expand the support for PCI-e memory mapped configuration space access.
Note that unlike in HEAD, this defaults to off and must be explicitly
enabled by setting the loader tunable hw.pci.mcfg=1.
- Add support for the Intel 915GM chipsets by reading the BAR.
- Add parsing of the ACPI MCFG table to discover memory mapped configuration
  access on modern machines.
- Port the memory mapped config acess to amd64.  On amd64 it uses the direct
  map.
- For config requests to busses not listed in ACPI's min/max valid buses,
  fall back to using type #1 configuration access instead.
- Add a workaround for some K8 chipsets that do not expose all devices on
  bus 0 via MCFG and fall back to type #1 for those devices instead.
2009-05-04 21:04:29 +00:00
Maksim Yevmenkin ebf07f2d46 MFC r190868
Remove obsolete/bogus layering.

Reviewed by:	freebsd-current@, freebsd-hackers@
2009-05-04 21:00:43 +00:00
Maksim Yevmenkin e6a2b1a797 MFC r191388
Implement low-level Bluetooth HCI API.
This should make it easier to make Linux BlueZ libhci port.

Reviewed by:	Iain Hibbert < plunky -at- rya-online -dot- net > of NetBSD
Inspired by:	Linux BlueZ
Inspired by:	NetBSD
2009-05-04 20:53:19 +00:00
Maksim Yevmenkin af8f815990 MFC r191366
Fix sbappendrecord_locked().

The main problem is that sbappendrecord_locked() relies on sbcompress()
to set sb_mbtail. This will not happen if sbappendrecord_locked() is
called with mbuf chain made of exactly one mbuf (i.e. m0->m_next == NULL).
In this case sbcompress() will be called with m == NULL and will do
nothing. I'm not entirely sure if m == NULL is a valid argument for
sbcompress(), and, it rather pointless to call it like that, but keep
calling it so it can do SBLASTMBUFCHK().

PR:			kern/126742
Investigated by:	pluknet < pluknet -at- gmail -dot- com >
No response from:	freebsd-current@, freebsd-bluetooth@
2009-05-04 20:48:07 +00:00
John Baldwin 30531c7fbd MFC: Various fixes to the PCI resource allocation code:
- Disabling decoding of BARs via the PCI command register before writing
  to the BARs to size them.
- Don't free resources decoded by a BAR when the device driver releases a
  BAR.  Instead, the PCI bus now owns unclaimed BARs and gives them to
  drivers on demand.  When a driver releases a BAR, the PCI bus reclaims
  it and leaves the resource range allocated.  This also prevents drivers
  from allocating the same resource multiple times.
- Move the activation of BARs by enabling decoding in the PCI command
  register into bus_activate_resource() so that it always happens after the
  BAR is fully programmed.
- Always read/write the full 64-bit value of 64-bit BARs.
- Consolidate duplicated code for reading and sizing BARs and writing base
  address to BARs.
2009-05-04 20:35:59 +00:00
John Baldwin b157b92f84 MFC: More refinements to the x86 FPU support:
- Rename (fpu|npx)_cleanstate to (fpu|npx)_initialstate to better reflect
  their purpose.
- Fix a few nits in the earlier changes to prevent local information leakage
  in AMD FPUs.
2009-05-04 19:19:13 +00:00
Hiroki Sato bd06bb7adc Update 7.2R Errata:
Document bce(4) + lagg(4) issue, and
	A patch for lock order reversal committed.
2009-05-04 19:00:25 +00:00
Ulf Lilleengen c96f2db980 MFC r179094:
Play nice with DDB pager.
2009-05-04 18:35:52 +00:00
John Baldwin 51c9bb2a32 MFC: Fix an off-by-one buffer overflow in ngets(). 2009-05-04 17:25:53 +00:00
Ken Smith 3aa426180b 7.2-RELEASE is done, shift over to -STABLE.
Approved by:	re (implicit)
2009-05-04 00:19:00 +00:00
Hiroki Sato 476e2fac78 Add an entry for a lock order reversal that can cause a deadlock.
Reviewed by:	kib
Approved by:	re (implicit)
2009-05-03 21:21:17 +00:00
Konstantin Belousov b7cb62977c MFC r185514 (by jasone):
Fix a lock order reversal bug that could cause deadlock during fork(2).

Reported and tested by:	makc
Approved by:	re (kensmith)
2009-05-03 17:51:38 +00:00
Hiroki Sato 979043f8b6 - Update Errata for 7.2R: disc1 booting problem on some motherboards.
- Update &release.*;
- Fix a typo.

Approved by:	re (implicit)
2009-05-02 16:23:44 +00:00
Ken Smith bcd89e285e Predict announcement day for 7.2-RELEASE.
Approved by:	re (implicit)
2009-05-01 02:16:05 +00:00
Christian Brueffer 80217744cc Document an issue of jail(8) in conjunction with cpuset(1).
Problem reported by:	Miroslav Lachman <[email protected]>
Reviewed by:	bz
Approved by:	re (kib)
2009-04-27 20:18:01 +00:00
Xin LI 3fb4a6fd13 Add -C back.
Approved by:	re (kensmith)
2009-04-27 19:15:14 +00:00
Marc Fonvieille 1622a43824 MFC:
r191509:
Unbreak the build of relnotes.

r191511:
Bump copyright year;
Add missing colon and fix broken entity.

Approved by:	re (implicit)
2009-04-26 07:58:00 +00:00
Marius Strobl 07de19d3d7 MFC: r191491, r191492
Sync the sparc64 hardware notes with reality, mainly regarding support
of sun4u-machines based on USIII and beyond in 7.2-RELEASE.

Approved by:	re (blackend)
2009-04-25 23:08:11 +00:00
Robert Watson 0b11f8116a In sysctl_ifdata(), query the ifnet pointer using the index only
once, rather than querying it, validating it, and then re-querying
it without validating it.  This may avoid a NULL pointer
dereference and resulting kernel page fault if an interface is
being deleted while bsnmp or other tools are querying data on the
interface.

The full fix, to properly refcount the interface for the duration
of the sysctl, is in 8.x, but is considered too high-risk for
7.2, so instead will appear in 7.3 (if all goes well).

Reproted by:	mdtancsa
Approved by:	re (kensmith)
2009-04-23 17:47:15 +00:00
Christian Brueffer 04b8a75e2a MFC r191414
Correct the information about when the respective functionality first
appeared in FreeBSD.

Approved by:	re (kensmith)
2009-04-23 16:56:26 +00:00
Ken Smith 7bc5e9e58a Adjust for the 7.2-RELEASE package set.
Approved by:	re (kib)
2009-04-23 12:04:33 +00:00
Christian Brueffer 288e50a058 MFC r190822
Move an "end list" macro to the right place.

Approved by:	re (kensmith)
2009-04-23 07:56:10 +00:00
Robert Noland ccc832256d Merge 191274.
Don't try to setup interrupts for drivers that don't support them.

This causes sis and probably a couple of other driver to panic and fail.

Tested by:	cpghost <[email protected]>
Approved by:	re (kib)
2009-04-22 20:58:23 +00:00
Colin Percival 52521a3ba5 Don't leak information via uninitialized space in db(3) records. [09:07]
Sanity-check string lengths in order to stop OpenSSL crashing
when printing corrupt BMPString or UniversalString objects. [09:08]

Security:	FreeBSD-SA-09:07.libc
Security:	FreeBSD-SA-09:08.openssl
Security:	CVE-2009-0590
Approved by:	re (kensmith)
Approved by:	so (cperciva)
2009-04-22 14:07:14 +00:00
Ollivier Robert 02ef77f6cc MFH of changeset r191200:
Add an entry for the French macbook keyboard layout.

Approved by:	re (kensmith)
2009-04-22 13:17:47 +00:00
Bjoern A. Zeeb 150f37cc59 MFC r191305:
Back out r186308 (r191014 in stable/7):

 In case of AF_LINK, which the kernel still returns for an RTAX_GATEWAY
 as an empty sockaddr_dl in the classic tun<n> case:
 copying the address into the message payload, but not the RTA_GATEWAY
 flag results in rt_xaddrs() in the kernel tripping over that and parsing
 the next attribute set with a flag, i.e. RTA_NETMASK, with the gateway
 address, resulting in bogus route entry.

Approved by:	re (kensmith)
2009-04-22 08:22:16 +00:00
Colin Percival 7f9a43eaa2 MFH r191302: Fix a buffer overflow.
For reasons of stack alignment, it does not appear that this is exploitable
on any systems FreeBSD runs on, so this will not be getting a security
advisory.

Approved by:	re (kib)
2009-04-21 10:49:40 +00:00
Marc Fonvieille e1c0cafb9b MFC: r191265
Add docs category.

Approved by:  re (kensmith)
2009-04-21 09:53:11 +00:00
Maksim Yevmenkin c89a797826 MFC r191232
Fix bug in event timeout handling

Submitted by:	mav
Approved by:	re (kib)
2009-04-20 16:57:43 +00:00
Maksim Yevmenkin 0415bc675a MFC r191164
Prevent atkbd(4) interrupt handler from calling keyboard callback function
when polled mode is enabled. This should help with duplicated/missing
characters problem at mountroot, geli, etc. prompts on multi CPU systems
while kbdmux(4) is enabled.

Tested by:	Tobias Grosser <grosser -at- fim -dot- uni-passau -dot- de>
Tested by:	Fabian Keil <freebsd-listen -at- fabiankeil -dot- de>
Approved by:	re (kib)
2009-04-20 16:55:48 +00:00
Edwin Groothuis 551e465320 MFC of tzdata2009f
Correct DST information for Pakistan for 2009.

Approved by:	re (kip)
2009-04-18 11:50:11 +00:00
Marius Strobl efe46268b8 MFC: r191076
- Remove the second license as I'm also fine with the first one.
- Remove redundant softc members for RIDs.
- Change some softc members to be unsigned where more appropriate.
- Add some missing const.
- Remove support for mmap(2)'ing VGA I/O as it was broken [1] and
  not required by X.Org anyway.
- Fix some confusion between bus, physical and virtual addresses
  which mostly consisted in using members of struct video_adapter
  inappropriately but wasn't fatal except for the regular framebuffer
  mmap(2)'ing.
- Remove redundant bzero(9)'ing of the softc.
- Don't map the framebuffer twice in case the firmware has already
  mapped it as besides wasting resources this isn't possible with
  all MMUs. This is a bit tricky as a) just because the firmware
  provides a property with a virtual address doesn't mean it's
  actually mapped (but typically is when the framebuffer is the
  console) and b) the firmware doesn't necessarily map it with
  the same byteorder as we do. This makes machfb(4) work on machines
  with cheetah-class MMUs (including X.Org).

Reported by:	Michael Plass [1]
Approved by:	re (kib)
2009-04-17 23:22:01 +00:00
Marius Strobl 252183e86a MFC: r191072
Fix whitespace.

Approved by:	re (kib)
2009-04-17 22:04:19 +00:00
Alexander Kabaev 099cfe7ae9 MFC r191218 and related backout r191220.
More fallout from negative dotdot caching. Negative entries should
be removed from and reinserted to proper ncneg list.

Reported by:	pho
Submitted by:	kib
Approved by:	re (kib)
2009-04-17 21:10:53 +00:00
John Baldwin 5bf4607e6a MFC: Use a disk address instead of an int to hold the starting offset of an
open partition.

Approved by:	re (kib)
2009-04-17 17:07:12 +00:00
Dmitry Chagin a11dabf7c3 Merge r190708 from HEAD to stable/7:
Fix KBI breakage by r190520 which affects older linux.ko binaries:

1) Move the new field (brand_note) to the end of the Brandinfo structure.
2) Add a new flag BI_BRAND_NOTE that indicates that the brand_note pointer
   is valid.
3) Use the brand_note field if the flag BI_BRAND_NOTE is set and as old
   modules won't have the flag set, so the new field brand_note would be
   ignored.

Suggested by:   jhb
Reviewed by:	jhb
Approved by:	re (Ken Smith), kib (mentor)
2009-04-17 16:42:57 +00:00
Alan Cox 5c7b8f8691 MFC r175055
Defer setting either PG_CACHED or PG_FREE until after the free page
  queues lock is acquired.  Otherwise, the state of a reservation's
  pages' flags and its population count can be inconsistent.  That could
  result in a page being freed twice.

(This change should have been included in the MFC of the superpages
support.)

Thanks to:	pho for an illuminating crash

Approved by:	re (kib)
2009-04-17 15:35:16 +00:00
Alexander Kabaev dc34b7e1da MFC r191081-191082:
Properly handle negative cache enries found through dotdot lookups.

Submitted by:	tor
Approved by:	re(kib)
2009-04-15 16:05:25 +00:00
Ken Smith c24d41b25c Oops, missed one of the 2's that needed to be changed when copying the
line from above...

Submitted by:	lstewart
Approved by:	re (implicit)
2009-04-15 04:18:05 +00:00
Ken Smith 06a54dc291 Add package directory for 7.2-REL (and 6.4-REL while here).
Approved by:	re (implicit)
2009-04-15 03:48:34 +00:00
Ken Smith ffe715176b Bump __FreeBSD_version now that the svn cp for release/7.2 is done.
Approved by:	re (implicit)
2009-04-15 03:45:32 +00:00
Ken Smith 1c208245e1 Bump version number 7.1 to 7.2.
Approved by:	re (implicit)
2009-04-15 03:42:59 +00:00
Ken Smith 54645d6f77 Make 7.2 the default OS version for manual pages.
Approved by:	re (implicit)
2009-04-15 03:41:16 +00:00
2712 changed files with 287090 additions and 184922 deletions

No files matched your search

+1 -1
View File
@@ -4,7 +4,7 @@
The compilation of software known as FreeBSD is distributed under the
following terms:
Copyright (c) 1992-2009 The FreeBSD Project. All rights reserved.
Copyright (c) 1992-2010 The FreeBSD Project. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
+2 -2
View File
@@ -88,7 +88,7 @@ CLEANDIR= cleandir
.endif
CVS?= cvs
CVSFLAGS?= -r RELENG_7 -P -d -I!
CVSFLAGS?= -r RELENG_7_3 -P -d -I!
SUP?= /usr/bin/csup
SUPFLAGS?= -g -L 2
.if defined(SUPHOST)
@@ -985,7 +985,7 @@ build-tools:
#
# cross-tools: Build cross-building tools
#
.if ${TARGET_ARCH} != ${MACHINE_ARCH}
.if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${BOOTSTRAPPING} < 702102
.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386"
_btxld= usr.sbin/btxld
.endif
+4
View File
@@ -14,6 +14,10 @@
# The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last.
#
# 20091129: pecoff image activator removed
.if ${TARGET_ARCH} == "i386"
OLD_FILES+=usr/include/machine/pecoff_machdep.h
.endif
# 20090203: adding_user.8 moved to adding_user.7
OLD_FILES+=usr/share/man/man8/adding_user.8.gz
# 20080407: pkg_sign has been removed
+90 -4
View File
@@ -8,6 +8,92 @@ Items affecting the ports and packages system can be found in
/usr/ports/UPDATING. Please read that file before running
portupgrade.
20120104: p10 FreeBSD-EN-12:01.freebsd-update
Extend the character set accepted by freebsd-update(8) in file
names in order to allow upgrades to FreeBSD 9.0-RELEASE.
20111223: p9 FreeBSD-SA-11:06.bind, FreeBSD-SA-11:07.chroot
FreeBSD-SA-11:08.telnetd, FreeBSD-SA-11:09.pam_ssh
FreeBSD-SA-11:10.pam
Fix a problem whereby a corrupt DNS record can cause named to crash.
[11:06]
Add an API for alerting internal libc routines to the presence of
"unsafe" paths post-chroot, and use it in ftpd. [11:07]
Fix a buffer overflow in telnetd. [11:08]
Make pam_ssh ignore unpassphrased keys unless the "nullok" option is
specified. [11:09]
Add sanity checking of service names in pam_start. [11:10]
20111004: p8 FreeBSD-SA-11:05.unix (revised)
Fix a bug in UNIX socket handling in the linux emulator which was
exposed by the security fix in FreeBSD-SA-11:05.unix.
20110928: p7 FreeBSD-SA-11:04.compress, FreeBSD-SA-11:05.unix
Fix handling of corrupt compress(1)ed data. [11:04]
Add missing length checks on unix socket addresses. [11:05]
20110528: p6 FreeBSD-SA-11:02.bind
Fix BIND remote DoS with large RRSIG RRsets and negative
caching.
20110420: p5 FreeBSD-SA-11:01.mountd
Fix CIDR parsing bug in mountd ACLs.
20101129: p4 FreeBSD-SA-10:10.openssl
Fix OpenSSL multiple vulnerabilities.
20100920: p3 FreeBSD-SA-10:08.bzip2
Fix an integer overflow in RLE length parsing when decompressing
corrupt bzip2 data.
20100713: p2 FreeBSD-SA-10:07.mbuf
Correctly copy the M_RDONLY flag when duplicating a reference
to an mbuf external buffer.
20100526: p1 FreeBSD-SA-10:05.opie, FreeBSD-SA-10:06.nfsclient
Fix a one-NUL-byte buffer overflow in libopie. [10:05]
Correctly sanity-check a buffer length in nfs mount. [10:06]
20100323:
FreeBSD 7.3-RELEASE
20091129:
PECOFF image activator support removed.
20090831:
The newly imported zic(8) produces a new format in the
output. Please run tzsetup(8) to install the newly created
data to /etc/localtime.
20090731:
The ABI of various structures related to the SYSV IPC API have
been changed. Bump __FreeBSD_version to 702105.
20090606:
The components of PmcTools have been upgraded. Please
update world and the kernel.
20090521:
The k8temp(4) driver has been renamed to amdtemp(4) since
support for K10 and K11 CPU families was added.
20090520:
Update ZFS to version 13. ZFS users will need to re-build
and install both kernel and world simultaneously in order
for the ZFS tools to work. Existing pools will continue to work
without upgrade. If a pool is upgraded it will no longer be
usable by older kernel revs. ZFS send / recv between
pool version 6 and pool version 13 is not supported.
20090504:
FreeBSD 7.2-RELEASE
20090326:
Following bug-fixes to TCP connection state flags, netstat, systat,
and sockstat will need to be rebuilt in order to properly print
@@ -124,13 +210,13 @@ portupgrade.
The important thing to note is that the 82575 adapters
were supported in the em driver in 7.0, but now needed
to be moved into igb, so if you have the effected cards
to be moved into igb, so if you have the affected cards
be sure and make any script changes to follow the name
change.
There are only 3 PCI ID's effected in this change:
There are only 3 PCI ID's affected in this change:
0x10A7, 0x10A9, and 0x10D6
So you can know ahead of time if they will be effected,
So you can know ahead of time if they will be affected,
these will now be supported in the igb driver. That
driver will also support the new 82576 followon.
@@ -142,7 +228,7 @@ portupgrade.
20080724:
I have MFC'd in code to support multiple routing tables.
see the man pages setfib(1) and setfib(2).
See the man pages setfib(1) and setfib(2).
This is a backwards compatible version,
but to make use of it you need to compile your kernel
with options ROUTETABLES=2 (or more up to 16).
+1
View File
@@ -26,6 +26,7 @@ SUBDIR= cat \
mv \
pax \
ps \
pwait \
pwd \
${_rcp} \
realpath \
+1 -1
View File
@@ -115,7 +115,7 @@ main(int argc, char *argv[])
fts_options |= FTS_LOGICAL;
}
} else
fts_options = FTS_LOGICAL;
fts_options = hflag ? FTS_PHYSICAL : FTS_LOGICAL;
/* XXX: Why don't chflags and lchflags have compatible prototypes? */
if (hflag)
+1 -1
View File
@@ -339,7 +339,7 @@ setfile(struct stat *fs, int fd)
if (!gotstat || fs->st_flags != ts.st_flags)
if (fdval ?
fchflags(fd, fs->st_flags) :
(islink ? (errno = ENOSYS) :
(islink ? lchflags(to.p_path, fs->st_flags) :
chflags(to.p_path, fs->st_flags))) {
warn("chflags: %s", to.p_path);
rval = 1;
+11
View File
@@ -61,9 +61,20 @@ dl_iconv_open(const char *tocode, const char *fromcode)
if (iconvlib == NULL)
return (iconv_t)-1;
iconv_open = (iconv_open_t *)dlfunc(iconvlib, ICONV_OPEN);
if (iconv_open == NULL)
goto dlfunc_err;
dl_iconv = (dl_iconv_t *)dlfunc(iconvlib, ICONV_ENGINE);
if (dl_iconv == NULL)
goto dlfunc_err;
dl_iconv_close = (dl_iconv_close_t *)dlfunc(iconvlib,
ICONV_CLOSE);
if (dl_iconv_close == NULL)
goto dlfunc_err;
}
return iconv_open(tocode, fromcode);
dlfunc_err:
dlclose(iconvlib);
iconvlib = NULL;
return (iconv_t)-1;
}
+7 -2
View File
@@ -78,15 +78,20 @@ this overrides the
.Ev BLOCKSIZE
specification from the environment.
.It Fl H
"Human-readable" output.
.Dq Human-readable
output.
Use unit suffixes: Byte, Kilobyte, Megabyte,
Gigabyte, Terabyte and Petabyte in order to reduce the number of
digits to four or fewer using base 10 for sizes.
.It Fl h
"Human-readable" output.
.Dq Human-readable
output.
Use unit suffixes: Byte, Kilobyte, Megabyte,
Gigabyte, Terabyte and Petabyte in order to reduce the number of
digits to four or fewer using base 2 for sizes.
Inodes statistics, if enabled with
.Fl i ,
are always printed in base 10.
.It Fl i
Include statistics on the number of free inodes.
.It Fl k
+30 -4
View File
@@ -364,6 +364,23 @@ prthumanval(int64_t bytes)
(void)printf(" %6s", buf);
}
/*
* Print an inode count in "human-readable" format.
*/
static void
prthumanvalinode(int64_t bytes)
{
char buf[6];
int flags;
flags = HN_NOSPACE | HN_DECIMAL | HN_DIVISOR_1000;
humanize_number(buf, sizeof(buf) - (bytes < 0 ? 0 : 1),
bytes, "", HN_AUTOSCALE, flags);
(void)printf(" %5s", buf);
}
/*
* Convert statfs returned file system size into BLOCKSIZE units.
* Attempts to avoid overflow for large file systems.
@@ -406,8 +423,10 @@ prtstat(struct statfs *sfsp, struct maxwidths *mwp)
mwp->mntfrom, "Filesystem", mwp->total, header,
mwp->used, "Used", mwp->avail, "Avail");
if (iflag) {
mwp->iused = imax(mwp->iused, (int)strlen(" iused"));
mwp->ifree = imax(mwp->ifree, (int)strlen("ifree"));
mwp->iused = imax(hflag ? 0 : mwp->iused,
(int)strlen(" iused"));
mwp->ifree = imax(hflag ? 0 : mwp->ifree,
(int)strlen("ifree"));
(void)printf(" %*s %*s %%iused",
mwp->iused - 2, "iused", mwp->ifree, "ifree");
}
@@ -431,8 +450,15 @@ prtstat(struct statfs *sfsp, struct maxwidths *mwp)
if (iflag) {
inodes = sfsp->f_files;
used = inodes - sfsp->f_ffree;
(void)printf(" %*jd %*jd %4.0f%% ", mwp->iused, (intmax_t)used,
mwp->ifree, (intmax_t)sfsp->f_ffree, inodes == 0 ? 100.0 :
if (hflag) {
(void)printf(" ");
prthumanvalinode(used);
prthumanvalinode(sfsp->f_ffree);
} else {
(void)printf(" %*jd %*jd", mwp->iused, (intmax_t)used,
mwp->ifree, (intmax_t)sfsp->f_ffree);
}
(void)printf(" %4.0f%% ", inodes == 0 ? 100.0 :
(double)used / (double)inodes * 100.0);
} else
(void)printf(" ");
+1
View File
@@ -396,6 +396,7 @@ trng_add(char *str)
default:
paxwarn(1, "Bad option %c with time range %s",
*flgpt, str);
free(pt);
goto out;
}
++flgpt;
+2 -1
View File
@@ -39,7 +39,7 @@ extern fixpt_t ccpu;
extern int cflag, eval, fscale, nlistread, rawcpu;
extern unsigned long mempages;
extern time_t now;
extern int sumrusage, termwidth, totwidth;
extern int showthreads, sumrusage, termwidth, totwidth;
extern STAILQ_HEAD(velisthead, varent) varlist;
__BEGIN_DECLS
@@ -71,6 +71,7 @@ void priorityr(KINFO *, VARENT *);
void rgroupname(KINFO *, VARENT *);
void runame(KINFO *, VARENT *);
void rvar(KINFO *, VARENT *);
int s_comm(KINFO *);
int s_label(KINFO *);
int s_rgroupname(KINFO *);
int s_runame(KINFO *);
+12 -9
View File
@@ -79,8 +79,8 @@ static VAR var[] = {
CHAR, NULL, 0},
{"blocked", "", "sigmask", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
{"caught", "", "sigcatch", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
{"comm", "COMMAND", NULL, LJUST, ucomm, NULL, MAXCOMLEN, 0, CHAR,
NULL, 0},
{"comm", "COMMAND", NULL, LJUST|DSIZ, ucomm, s_comm,
COMMLEN + OCOMMLEN + 1, 0, CHAR, NULL, 0},
{"command", "COMMAND", NULL, COMM|LJUST|USER, command, NULL, 16, 0,
CHAR, NULL, 0},
{"cpu", "CPU", NULL, 0, kvar, NULL, 3, KOFF(ki_estcpu), UINT, "d",
@@ -135,12 +135,13 @@ static VAR var[] = {
LONG, "ld", 0},
{"nvcsw", "NVCSW", NULL, USER, rvar, NULL, 5, ROFF(ru_nvcsw),
LONG, "ld", 0},
{"nwchan", "NWCHAN", NULL, LJUST, nwchan, NULL, 8, 0, CHAR, NULL, 0},
{"nwchan", "NWCHAN", NULL, LJUST, nwchan, NULL, sizeof(void *) * 2, 0,
CHAR, NULL, 0},
{"oublk", "OUBLK", NULL, USER, rvar, NULL, 4, ROFF(ru_oublock),
LONG, "ld", 0},
{"oublock", "", "oublk", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
{"paddr", "PADDR", NULL, 0, kvar, NULL, 8, KOFF(ki_paddr), KPTR,
"lx", 0},
{"paddr", "PADDR", NULL, 0, kvar, NULL, sizeof(void *) * 2,
KOFF(ki_paddr), KPTR, "lx", 0},
{"pagein", "PAGEIN", NULL, USER, pagein, NULL, 6, 0, CHAR, NULL, 0},
{"pcpu", "", "%cpu", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
{"pending", "", "sig", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
@@ -194,13 +195,13 @@ static VAR var[] = {
{"tsiz", "TSIZ", NULL, 0, kvar, NULL, 4, KOFF(ki_tsize), PGTOK, "ld", 0},
{"tt", "TT ", NULL, 0, tname, NULL, 4, 0, CHAR, NULL, 0},
{"tty", "TTY", NULL, LJUST, longtname, NULL, 8, 0, CHAR, NULL, 0},
{"ucomm", "UCOMM", NULL, LJUST, ucomm, NULL, MAXCOMLEN, 0, CHAR, NULL,
0},
{"ucomm", "UCOMM", NULL, LJUST|DSIZ, ucomm, s_comm,
COMMLEN + OCOMMLEN + 1, 0, CHAR, NULL, 0},
{"uid", "UID", NULL, 0, kvar, NULL, UIDLEN, KOFF(ki_uid), UINT,
UIDFMT, 0},
{"upr", "UPR", NULL, 0, upr, NULL, 3, 0, CHAR, NULL, 0},
{"uprocp", "UPROCP", NULL, 0, kvar, NULL, 8, KOFF(ki_paddr), KPTR,
"lx", 0},
{"uprocp", "UPROCP", NULL, 0, kvar, NULL, sizeof(void *) * 2,
KOFF(ki_paddr), KPTR, "lx", 0},
{"user", "USER", NULL, LJUST|DSIZ, uname, s_uname, USERLEN, 0, CHAR,
NULL, 0},
{"usrpri", "", "upr", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
@@ -324,6 +325,8 @@ findvar(char *p, int user, char **header)
*/
rflen = strlen(v->alias) + strlen(hp) + 2;
realfmt = malloc(rflen);
if (realfmt == NULL)
errx(1, "malloc failed");
snprintf(realfmt, rflen, "%s=%s", v->alias, hp);
parsefmt(realfmt, user);
}
+53 -14
View File
@@ -129,25 +129,33 @@ command(KINFO *k, VARENT *ve)
v = ve->var;
if (cflag) {
/* If it is the last field, then don't pad */
if (STAILQ_NEXT(ve, next_ve) == NULL)
if (STAILQ_NEXT(ve, next_ve) == NULL) {
if (k->ki_d.prefix)
(void)printf("%s", k->ki_d.prefix);
(void)printf("%s", k->ki_p->ki_comm);
else
} else
(void)printf("%-*s", v->width, k->ki_p->ki_comm);
return;
}
if ((vis_args = malloc(strlen(k->ki_args) * 4 + 1)) == NULL)
errx(1, "malloc failed");
strvis(vis_args, k->ki_args, VIS_TAB | VIS_NL | VIS_NOSLASH);
if (k->ki_env) {
if ((vis_env = malloc(strlen(k->ki_env) * 4 + 1)) == NULL)
errx(1, "malloc failed");
strvis(vis_env, k->ki_env, VIS_TAB | VIS_NL | VIS_NOSLASH);
} else
vis_env = NULL;
if (STAILQ_NEXT(ve, next_ve) == NULL) {
/* last field */
if (k->ki_env) {
if ((vis_env = malloc(strlen(k->ki_env) * 4 + 1))
== NULL)
errx(1, "malloc failed");
strvis(vis_env, k->ki_env,
VIS_TAB | VIS_NL | VIS_NOSLASH);
} else
vis_env = NULL;
if (termwidth == UNLIMITED) {
if (k->ki_d.prefix)
(void)printf("%s", k->ki_d.prefix);
if (vis_env)
(void)printf("%s ", vis_env);
(void)printf("%s", vis_args);
@@ -155,6 +163,9 @@ command(KINFO *k, VARENT *ve)
left = termwidth - (totwidth - v->width);
if (left < 1) /* already wrapped, just use std width */
left = v->width;
if ((cp = k->ki_d.prefix) != NULL)
while (--left >= 0 && *cp)
(void)putchar(*cp++);
if ((cp = vis_env) != NULL) {
while (--left >= 0 && *cp)
(void)putchar(*cp++);
@@ -164,24 +175,34 @@ command(KINFO *k, VARENT *ve)
for (cp = vis_args; --left >= 0 && *cp != '\0';)
(void)putchar(*cp++);
}
if (vis_env != NULL)
free(vis_env);
} else
/* XXX env? */
/* ki_d.prefix & ki_env aren't shown for interim fields */
(void)printf("%-*.*s", v->width, v->width, vis_args);
free(vis_args);
if (vis_env != NULL)
free(vis_env);
}
void
ucomm(KINFO *k, VARENT *ve)
{
char tmpbuff[COMMLEN + OCOMMLEN + 2];
VAR *v;
v = ve->var;
if (STAILQ_NEXT(ve, next_ve) == NULL) /* last field, don't pad */
if (STAILQ_NEXT(ve, next_ve) == NULL) { /* last field, don't pad */
if (k->ki_d.prefix)
(void)printf("%s", k->ki_d.prefix);
(void)printf("%s", k->ki_p->ki_comm);
else
(void)printf("%-*s", v->width, k->ki_p->ki_comm);
} else {
bzero(tmpbuff, sizeof(tmpbuff));
if (showthreads && k->ki_p->ki_numthreads > 1)
sprintf(tmpbuff, "%s/%s", k->ki_p->ki_comm,
k->ki_p->ki_ocomm);
else
sprintf(tmpbuff, "%s", k->ki_p->ki_comm);
(void)printf("%-*s", v->width, tmpbuff);
}
}
void
@@ -559,6 +580,10 @@ elapsed(KINFO *k, VARENT *ve)
char obuff[128];
v = ve->var;
if (!k->ki_valid) {
(void)printf("%-*s", v->width, "-");
return;
}
val = now - k->ki_p->ki_start.tv_sec;
days = val / (24 * 60 * 60);
val %= 24 * 60 * 60;
@@ -804,6 +829,20 @@ out:
return;
}
int
s_comm(KINFO *k)
{
char tmpbuff[COMMLEN + OCOMMLEN + 2];
bzero(tmpbuff, sizeof(tmpbuff));
if (showthreads && k->ki_p->ki_numthreads > 1)
sprintf(tmpbuff, "%s/%s", k->ki_p->ki_comm,
k->ki_p->ki_ocomm);
else
sprintf(tmpbuff, "%s", k->ki_p->ki_comm);
return (strlen(tmpbuff));
}
int
s_label(KINFO *k)
{
+11 -2
View File
@@ -29,7 +29,7 @@
.\" @(#)ps.1 8.3 (Berkeley) 4/18/94
.\" $FreeBSD$
.\"
.Dd August 21, 2006
.Dd May 16, 2009
.Dt PS 1
.Os
.Sh NAME
@@ -37,7 +37,7 @@
.Nd process status
.Sh SYNOPSIS
.Nm
.Op Fl aCcefHhjlmrSTuvwXxZ
.Op Fl aCcdefHhjlmrSTuvwXxZ
.Op Fl O Ar fmt | Fl o Ar fmt
.Op Fl G Ar gid Ns Op , Ns Ar gid Ns Ar ...
.Op Fl M Ar core
@@ -122,6 +122,15 @@ CPU calculation that ignores
.Dq resident
time (this normally has
no effect).
.It Fl d
Arrange processes into descendancy order and prefix each command with
indentation text showing sibling and parent/child relationships.
If either of the
.Fl m
and
.Fl r
options are also used, they control how sibling processes are sorted
relative to eachother.
.It Fl e
Display the environment as well.
.It Fl f
+132 -5
View File
@@ -100,6 +100,7 @@ int rawcpu; /* -C */
int sumrusage; /* -S */
int termwidth; /* Width of the screen (0 == infinity). */
int totwidth; /* Calculated-width of requested variables. */
int showthreads; /* will threads be shown? */
struct velisthead varlist = STAILQ_HEAD_INITIALIZER(varlist);
@@ -137,6 +138,7 @@ static int addelem_pid(struct listinfo *, const char *);
static int addelem_tty(struct listinfo *, const char *);
static int addelem_uid(struct listinfo *, const char *);
static void add_list(struct listinfo *, const char *);
static void descendant_sort(KINFO *, int);
static void dynsizevars(KINFO *);
static void *expand_list(struct listinfo *);
static const char *
@@ -162,7 +164,7 @@ static char vfmt[] = "pid,state,time,sl,re,pagein,vsz,rss,lim,tsiz,"
"%cpu,%mem,command";
static char Zfmt[] = "label";
#define PS_ARGS "AaCce" OPT_LAZY_f "G:gHhjLlM:mN:O:o:p:rSTt:U:uvwXxZ"
#define PS_ARGS "AaCcde" OPT_LAZY_f "G:gHhjLlM:mN:O:o:p:rSTt:U:uvwXxZ"
int
main(int argc, char *argv[])
@@ -176,8 +178,8 @@ main(int argc, char *argv[])
const char *nlistf, *memf;
char *cols;
int all, ch, elem, flag, _fmt, i, lineno;
int nentries, nkept, nselectors;
int prtheader, showthreads, wflag, what, xkeep, xkeep_implied;
int descendancy, nentries, nkept, nselectors;
int prtheader, wflag, what, xkeep, xkeep_implied;
char errbuf[_POSIX2_LINE_MAX];
(void) setlocale(LC_ALL, "");
@@ -200,7 +202,7 @@ main(int argc, char *argv[])
if (argc > 1)
argv[1] = kludge_oldps_options(PS_ARGS, argv[1], argv[2]);
all = _fmt = nselectors = optfatal = 0;
all = descendancy = _fmt = nselectors = optfatal = 0;
prtheader = showthreads = wflag = xkeep_implied = 0;
xkeep = -1; /* Neither -x nor -X. */
init_list(&gidlist, addelem_gid, sizeof(gid_t), "group");
@@ -232,6 +234,9 @@ main(int argc, char *argv[])
case 'c':
cflag = 1;
break;
case 'd':
descendancy = 1;
break;
case 'e': /* XXX set ufmt */
needenv = 1;
break;
@@ -574,6 +579,8 @@ main(int argc, char *argv[])
keepit:
next_KINFO = &kinfo[nkept];
next_KINFO->ki_p = kp;
next_KINFO->ki_d.level = 0;
next_KINFO->ki_d.prefix = NULL;
next_KINFO->ki_pcpu = getpcpu(next_KINFO);
if (sortby == SORTMEM)
next_KINFO->ki_memsize = kp->ki_tsize +
@@ -598,6 +605,13 @@ main(int argc, char *argv[])
* sort proc list
*/
qsort(kinfo, nkept, sizeof(KINFO), pscomp);
/*
* We want things in descendant order
*/
if (descendancy)
descendant_sort(kinfo, nkept);
/*
* For each process, call each variable output function.
*/
@@ -621,6 +635,9 @@ main(int argc, char *argv[])
free_list(&sesslist);
free_list(&ttylist);
free_list(&uidlist);
for (i = 0; i < nkept; i++)
free(kinfo[i].ki_d.prefix);
free(kinfo);
exit(eval);
}
@@ -889,6 +906,116 @@ add_list(struct listinfo *inf, const char *argp)
}
}
static void
descendant_sort(KINFO *ki, int items)
{
int dst, lvl, maxlvl, n, ndst, nsrc, siblings, src;
unsigned char *path;
KINFO kn;
/*
* First, sort the entries by descendancy, tracking the descendancy
* depth in the ki_d.level field.
*/
src = 0;
maxlvl = 0;
while (src < items) {
if (ki[src].ki_d.level) {
src++;
continue;
}
for (nsrc = 1; src + nsrc < items; nsrc++)
if (!ki[src + nsrc].ki_d.level)
break;
for (dst = 0; dst < items; dst++) {
if (ki[dst].ki_p->ki_pid == ki[src].ki_p->ki_pid)
continue;
if (ki[dst].ki_p->ki_pid == ki[src].ki_p->ki_ppid)
break;
}
if (dst == items) {
src += nsrc;
continue;
}
for (ndst = 1; dst + ndst < items; ndst++)
if (ki[dst + ndst].ki_d.level <= ki[dst].ki_d.level)
break;
for (n = src; n < src + nsrc; n++) {
ki[n].ki_d.level += ki[dst].ki_d.level + 1;
if (maxlvl < ki[n].ki_d.level)
maxlvl = ki[n].ki_d.level;
}
while (nsrc) {
if (src < dst) {
kn = ki[src];
memmove(ki + src, ki + src + 1,
(dst - src + ndst - 1) * sizeof *ki);
ki[dst + ndst - 1] = kn;
nsrc--;
dst--;
ndst++;
} else if (src != dst + ndst) {
kn = ki[src];
memmove(ki + dst + ndst + 1, ki + dst + ndst,
(src - dst - ndst) * sizeof *ki);
ki[dst + ndst] = kn;
ndst++;
nsrc--;
src++;
} else {
ndst += nsrc;
src += nsrc;
nsrc = 0;
}
}
}
/*
* Now populate ki_d.prefix (instead of ki_d.level) with the command
* prefix used to show descendancies.
*/
path = malloc((maxlvl + 7) / 8);
memset(path, '\0', (maxlvl + 7) / 8);
for (src = 0; src < items; src++) {
if ((lvl = ki[src].ki_d.level) == 0) {
ki[src].ki_d.prefix = NULL;
continue;
}
if ((ki[src].ki_d.prefix = malloc(lvl * 2 + 1)) == NULL)
errx(1, "malloc failed");
for (n = 0; n < lvl - 2; n++) {
ki[src].ki_d.prefix[n * 2] =
path[n / 8] & 1 << (n % 8) ? '|' : ' ';
ki[src].ki_d.prefix[n * 2 + 1] = ' ';
}
if (n == lvl - 2) {
/* Have I any more siblings? */
for (siblings = 0, dst = src + 1; dst < items; dst++) {
if (ki[dst].ki_d.level > lvl)
continue;
if (ki[dst].ki_d.level == lvl)
siblings = 1;
break;
}
if (siblings)
path[n / 8] |= 1 << (n % 8);
else
path[n / 8] &= ~(1 << (n % 8));
ki[src].ki_d.prefix[n * 2] = siblings ? '|' : '`';
ki[src].ki_d.prefix[n * 2 + 1] = '-';
n++;
}
strcpy(ki[src].ki_d.prefix + n * 2, "- ");
}
free(path);
}
static void *
expand_list(struct listinfo *inf)
{
@@ -1205,7 +1332,7 @@ check_procfs(void)
static void
usage(void)
{
#define SINGLE_OPTS "[-aCce" OPT_LAZY_f "HhjlmrSTuvwXxZ]"
#define SINGLE_OPTS "[-aCcde" OPT_LAZY_f "HhjlmrSTuvwXxZ]"
(void)fprintf(stderr, "%s\n%s\n%s\n%s\n",
"usage: ps " SINGLE_OPTS " [-O fmt | -o fmt] [-G gid[,gid...]]",
+4
View File
@@ -42,6 +42,10 @@ typedef struct kinfo {
int ki_valid; /* 1 => uarea stuff valid */
double ki_pcpu; /* calculated in main() */
segsz_t ki_memsize; /* calculated in main() */
union {
int level; /* used in decendant_sort() */
char *prefix; /* calculated in decendant_sort() */
} ki_d;
} KINFO;
/* Variables. */
+5
View File
@@ -0,0 +1,5 @@
# $FreeBSD$
PROG= pwait
.include <bsd.prog.mk>
+78
View File
@@ -0,0 +1,78 @@
.\"
.\" Copyright (c) 2004-2009, Jilles Tjoelker
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with
.\" or without modification, are permitted provided that the
.\" following conditions are met:
.\"
.\" 1. Redistributions of source code must retain the above
.\" copyright notice, this list of conditions and the
.\" following disclaimer.
.\" 2. Redistributions in binary form must reproduce the
.\" above copyright notice, this list of conditions and
.\" the following disclaimer in the documentation and/or
.\" other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
.\" CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
.\" WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
.\" PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
.\" COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
.\" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
.\" USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
.\" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
.\" USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
.\" OF SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd November 1, 2009
.Os
.Dt PWAIT 1
.Sh NAME
.Nm pwait
.Nd wait for processes to terminate
.Sh SYNOPSIS
.Nm
.Op Fl v
.Ar pid
\&...
.Sh DESCRIPTION
The
.Nm
utility will wait until each of the given processes has terminated.
.Pp
The following option is available:
.Bl -tag -width indent
.It Fl v
Print the exit status when each process terminates.
.El
.Sh DIAGNOSTICS
.Pp
The
.Nm
utility returns 0 on success, and >0 if an error occurs.
.Pp
Invalid pids elicit a warning message but are otherwise ignored.
.Sh SEE ALSO
.Xr kill 1 ,
.Xr pkill 1 ,
.Xr ps 1 ,
.Xr wait 1 ,
.Xr kqueue 2
.Sh NOTES
.Nm
is not a substitute for the
.Xr wait 1
builtin
as it will not clean up any zombies or state in the parent process.
.Sh HISTORY
A
.Nm
command first appeared in SunOS 5.8.
+145
View File
@@ -0,0 +1,145 @@
/*-
* Copyright (c) 2004-2009, Jilles Tjoelker
* All rights reserved.
*
* Redistribution and use in source and binary forms, with
* or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above
* copyright notice, this list of conditions and the
* following disclaimer.
* 2. Redistributions in binary form must reproduce the
* above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <sys/event.h>
#include <sys/time.h>
#include <sys/wait.h>
#include <err.h>
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sysexits.h>
#include <unistd.h>
static void
usage(void)
{
fprintf(stderr, "usage: pwait [-v] pid ...\n");
exit(EX_USAGE);
}
/*
* pwait - wait for processes to terminate
*/
int
main(int argc, char *argv[])
{
int kq;
struct kevent *e;
int verbose = 0;
int opt, nleft, n, i, duplicate, status;
long pid;
char *s, *end;
while ((opt = getopt(argc, argv, "v")) != -1) {
switch (opt) {
case 'v':
verbose = 1;
break;
default:
usage();
/* NOTREACHED */
}
}
argc -= optind;
argv += optind;
if (argc == 0)
usage();
kq = kqueue();
if (kq == -1)
err(1, "kqueue");
e = malloc(argc * sizeof(struct kevent));
if (e == NULL)
err(1, "malloc");
nleft = 0;
for (n = 0; n < argc; n++) {
s = argv[n];
if (!strncmp(s, "/proc/", 6)) /* Undocumented Solaris compat */
s += 6;
errno = 0;
pid = strtol(s, &end, 10);
if (pid < 0 || *end != '\0' || errno != 0) {
warnx("%s: bad process id", s);
continue;
}
duplicate = 0;
for (i = 0; i < nleft; i++)
if (e[i].ident == (uintptr_t)pid)
duplicate = 1;
if (!duplicate) {
EV_SET(e + nleft, pid, EVFILT_PROC, EV_ADD, NOTE_EXIT,
0, NULL);
if (kevent(kq, e + nleft, 1, NULL, 0, NULL) == -1)
warn("%ld", pid);
else
nleft++;
}
}
while (nleft > 0) {
n = kevent(kq, NULL, 0, e, nleft, NULL);
if (n == -1)
err(1, "kevent");
if (verbose)
for (i = 0; i < n; i++) {
status = e[i].data;
if (WIFEXITED(status))
printf("%ld: exited with status %d.\n",
(long)e[i].ident,
WEXITSTATUS(status));
else if (WIFSIGNALED(status))
printf("%ld: killed by signal %d.\n",
(long)e[i].ident,
WTERMSIG(status));
else
printf("%ld: terminated.\n",
(long)e[i].ident);
}
nleft -= n;
}
return 0;
}
+3 -3
View File
@@ -231,7 +231,7 @@ rm_tree(char **argv)
else if (!uid &&
(p->fts_statp->st_flags & (UF_APPEND|UF_IMMUTABLE)) &&
!(p->fts_statp->st_flags & (SF_APPEND|SF_IMMUTABLE)) &&
chflags(p->fts_accpath,
lchflags(p->fts_accpath,
p->fts_statp->st_flags &= ~(UF_APPEND|UF_IMMUTABLE)) < 0)
goto err;
continue;
@@ -250,7 +250,7 @@ rm_tree(char **argv)
if (!uid &&
(p->fts_statp->st_flags & (UF_APPEND|UF_IMMUTABLE)) &&
!(p->fts_statp->st_flags & (SF_APPEND|SF_IMMUTABLE)))
rval = chflags(p->fts_accpath,
rval = lchflags(p->fts_accpath,
p->fts_statp->st_flags &= ~(UF_APPEND|UF_IMMUTABLE));
if (rval == 0) {
/*
@@ -350,7 +350,7 @@ rm_file(char **argv)
if (!uid && !S_ISWHT(sb.st_mode) &&
(sb.st_flags & (UF_APPEND|UF_IMMUTABLE)) &&
!(sb.st_flags & (SF_APPEND|SF_IMMUTABLE)))
rval = chflags(f, sb.st_flags & ~(UF_APPEND|UF_IMMUTABLE));
rval = lchflags(f, sb.st_flags & ~(UF_APPEND|UF_IMMUTABLE));
if (rval == 0) {
if (S_ISWHT(sb.st_mode))
rval = undelete(f);
+1 -1
View File
@@ -22,7 +22,7 @@ LFLAGS= -8 # 8-bit lex scanner for arithmetic
CFLAGS+=-DSHELL -I. -I${.CURDIR}
# for debug:
# CFLAGS+= -g -DDEBUG=2
WARNS?= 3
WARNS?= 2
WFORMAT=0
.PATH: ${.CURDIR}/bltin \
+23 -3
View File
@@ -51,6 +51,13 @@ __FBSDID("$FreeBSD$");
int yylex(void);
struct varname
{
struct varname *next;
char name[1];
};
static struct varname *varnames;
#undef YY_INPUT
#define YY_INPUT(buf,result,max) \
result = (*buf = *arith_buf++) ? 1 : YY_NULL;
@@ -80,11 +87,14 @@ int yylex(void);
* If variable doesn't exist, we should initialize
* it to zero.
*/
char *temp;
struct varname *temp;
if (lookupvar(yytext) == NULL)
setvarsafe(yytext, "0", 0);
temp = (char *)ckmalloc(strlen(yytext) + 1);
yylval.s_value = strcpy(temp, yytext);
temp = ckmalloc(sizeof(struct varname) +
strlen(yytext));
temp->next = varnames;
varnames = temp;
yylval.s_value = strcpy(temp->name, yytext);
return ARITH_VAR;
}
@@ -130,5 +140,15 @@ int yylex(void);
void
arith_lex_reset(void)
{
struct varname *name, *next;
YY_NEW_FILE;
name = varnames;
while (name != NULL) {
next = name->next;
ckfree(name);
name = next;
}
varnames = NULL;
}
+5 -2
View File
@@ -773,6 +773,7 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd)
INTOFF;
savelocalvars = localvars;
localvars = NULL;
reffunc(cmdentry.u.func);
INTON;
if (setjmp(jmploc.loc)) {
if (exception == EXSHELLPROC)
@@ -781,6 +782,7 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd)
freeparam(&shellparam);
shellparam = saveparam;
}
unreffunc(cmdentry.u.func);
poplocalvars();
localvars = savelocalvars;
handler = savehandler;
@@ -792,11 +794,12 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd)
mklocal(sp->text);
funcnest++;
if (flags & EV_TESTED)
evaltree(cmdentry.u.func, EV_TESTED);
evaltree(getfuncnode(cmdentry.u.func), EV_TESTED);
else
evaltree(cmdentry.u.func, 0);
evaltree(getfuncnode(cmdentry.u.func), 0);
funcnest--;
INTOFF;
unreffunc(cmdentry.u.func);
poplocalvars();
localvars = savelocalvars;
freeparam(&shellparam);
+4 -4
View File
@@ -285,7 +285,7 @@ printentry(struct tblentry *cmdp, int verbose)
out1fmt("function %s", cmdp->cmdname);
if (verbose) {
INTOFF;
name = commandtext(cmdp->param.func);
name = commandtext(getfuncnode(cmdp->param.func));
out1c(' ');
out1str(name);
ckfree(name);
@@ -582,7 +582,7 @@ deletefuncs(void)
while ((cmdp = *pp) != NULL) {
if (cmdp->cmdtype == CMDFUNCTION) {
*pp = cmdp->next;
freefunc(cmdp->param.func);
unreffunc(cmdp->param.func);
ckfree(cmdp);
} else {
pp = &cmdp->next;
@@ -669,7 +669,7 @@ addcmdentry(char *name, struct cmdentry *entry)
INTOFF;
cmdp = cmdlookup(name, 1);
if (cmdp->cmdtype == CMDFUNCTION) {
freefunc(cmdp->param.func);
unreffunc(cmdp->param.func);
}
cmdp->cmdtype = entry->cmdtype;
cmdp->param = entry->u;
@@ -704,7 +704,7 @@ unsetfunc(char *name)
struct tblentry *cmdp;
if ((cmdp = cmdlookup(name, 0)) != NULL && cmdp->cmdtype == CMDFUNCTION) {
freefunc(cmdp->param.func);
unreffunc(cmdp->param.func);
delete_cmd_entry();
return (0);
}
+2 -1
View File
@@ -46,11 +46,12 @@ enum {
TYPECMD_TYPE /* type */
};
union node;
struct cmdentry {
int cmdtype;
union param {
int index;
union node *func;
struct funcdef *func;
} u;
int special;
};
+5 -2
View File
@@ -248,8 +248,11 @@ output(char *file)
fputs("\tstruct nodelist *next;\n", hfile);
fputs("\tunion node *n;\n", hfile);
fputs("};\n\n\n", hfile);
fputs("union node *copyfunc(union node *);\n", hfile);
fputs("void freefunc(union node *);\n", hfile);
fputs("struct funcdef;\n", hfile);
fputs("struct funcdef *copyfunc(union node *);\n", hfile);
fputs("union node *getfuncnode(struct funcdef *);\n", hfile);
fputs("void reffunc(struct funcdef *);\n", hfile);
fputs("void unreffunc(struct funcdef *);\n", hfile);
fputs(writer, cfile);
while (fgets(line, sizeof line, patfile) != NULL) {
+37 -9
View File
@@ -35,6 +35,7 @@
#include <sys/param.h>
#include <stdlib.h>
#include <stddef.h>
/*
* Routine for dealing with parsed shell commands.
*/
@@ -60,25 +61,40 @@ STATIC struct nodelist *copynodelist(struct nodelist *);
STATIC char *nodesavestr(char *);
struct funcdef {
unsigned int refcount;
union node n;
};
/*
* Make a copy of a parse tree.
*/
union node *
struct funcdef *
copyfunc(union node *n)
{
struct funcdef *fn;
if (n == NULL)
return NULL;
funcblocksize = 0;
funcblocksize = offsetof(struct funcdef, n);
funcstringsize = 0;
calcsize(n);
funcblock = ckmalloc(funcblocksize + funcstringsize);
funcstring = (char *)funcblock + funcblocksize;
return copynode(n);
fn = ckmalloc(funcblocksize + funcstringsize);
fn->refcount = 1;
funcblock = (char *)fn + offsetof(struct funcdef, n);
funcstring = (char *)fn + funcblocksize;
copynode(n);
return fn;
}
union node *
getfuncnode(struct funcdef *fn)
{
return fn == NULL ? NULL : &fn->n;
}
STATIC void
calcsize(union node *n)
@@ -144,14 +160,26 @@ nodesavestr(char *s)
}
void
reffunc(struct funcdef *fn)
{
if (fn)
fn->refcount++;
}
/*
* Free a parse tree.
* Decrement the reference count of a function definition, freeing it
* if it falls to 0.
*/
void
freefunc(union node *n)
unreffunc(struct funcdef *fn)
{
if (n)
ckfree(n);
if (fn) {
fn->refcount--;
if (fn->refcount > 0)
return;
ckfree(fn);
}
}
+1
View File
@@ -250,6 +250,7 @@ pipeline(void)
int negate;
negate = 0;
checkkwd = 2;
TRACE(("pipeline: entered\n"));
while (readtoken() == TNOT)
negate = !negate;
+6 -2
View File
@@ -375,6 +375,10 @@ introduces a comment if used at the beginning of a word.
The word starting with
.Ql #
and the rest of the line are ignored.
.Pp
.Tn ASCII
.Dv NUL
characters (character code 0) are not allowed in shell input.
.Ss Quoting
Quoting is used to remove the special meaning of certain characters
or words to the shell, such as operators, whitespace, keywords,
@@ -852,7 +856,7 @@ command is:
If
.Ic in
and the following words are omitted,
.Ic in Li $@
.Ic in Li \&"$@\&"
is used instead.
The words are expanded, and then the list is executed
repeatedly with the variable set to each word in turn.
@@ -1067,7 +1071,7 @@ and
is
.Dq Li "def ghi" ,
then
.Dq Li $@
.Li \&"$@\&"
expands to
the two arguments:
.Bd -literal -offset indent
+2
View File
@@ -6,3 +6,5 @@ OPENSOLARIS_SYS_DISTDIR= ${.CURDIR}/../../../sys/cddl/contrib/opensolaris
IGNORE_PRAGMA= YES
CFLAGS+= -DNEED_SOLARIS_BOOLEAN
CSTD?= gnu89
@@ -0,0 +1,36 @@
/*-
* Copyright (c) 2007 Pawel Jakub Dawidek <pjd@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _OPENSOLARIS_LIBSHARE_H_
#define _OPENSOLARIS_LIBSHARE_H_
#define SA_OK 0
#define SA_INIT_CONTROL_API 0
#endif /* !_OPENSOLARIS_LIBSHARE_H_ */
+2
View File
@@ -9,6 +9,8 @@
#define MNTTAB _PATH_DEVNULL
#define MNT_LINE_MAX 1024
#define umount2(p, f) unmount(p, f)
struct mnttab {
char *mnt_special;
char *mnt_mountp;
+1 -5
View File
@@ -94,11 +94,7 @@ int
devid_get(int fd, ddi_devid_t *retdevid)
{
if (ioctl(fd, DIOCGIDENT, retdevid->devid) == -1)
return (errno);
if (retdevid->devid[0] == '\0')
return (ENOENT);
return (0);
return (ENOENT);
}
int
+2
View File
@@ -37,6 +37,8 @@ __FBSDID("$FreeBSD$");
#include <sys/mntent.h>
#include <sys/mnttab.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static char *
mntopt(char **p)
+3 -2
View File
@@ -35,9 +35,10 @@ __FBSDID("$FreeBSD$");
#include <sys/mount.h>
#include <sys/uio.h>
#include <sys/mntent.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
static void
build_iovec(struct iovec **iov, int *iovlen, const char *name, void *val,
@@ -86,7 +87,7 @@ zmount(const char *spec, const char *dir, int mflag, char *fstype,
assert(optlen > 0);
optstr = strdup(optptr);
assert(optptr != NULL);
assert(optstr != NULL);
iov = NULL;
iovlen = 0;
+2 -2
View File
@@ -32,7 +32,7 @@
#include <sys/sysctl.h>
#include <sys/zone.h>
int
zoneid_t
getzoneid(void)
{
size_t size;
@@ -42,5 +42,5 @@ getzoneid(void)
size = sizeof(jailid);
if (sysctlbyname("security.jail.jailed", &jailid, &size, NULL, 0) == -1)
assert(!"No security.jail.jailed sysctl!");
return (jailid);
return ((zoneid_t)jailid);
}
+9
View File
@@ -28,13 +28,18 @@ zdb \- ZFS debugger
.fi
.SH DESCRIPTION
.sp
.LP
The \fBzdb\fR command is used by support engineers to diagnose failures and gather statistics. Since the \fBZFS\fR file system is always consistent on disk and is self-repairing, \fBzdb\fR should only be run under the direction by a support engineer.
.sp
.LP
If no arguments are specified, \fBzdb\fR, performs basic consistency checks on the pool and associated datasets, and report any problems detected.
.sp
.LP
Any options supported by this command are internal to Sun and subject to change at any time.
.SH EXIT STATUS
.sp
.LP
The following exit values are returned:
.sp
@@ -71,6 +76,9 @@ Invalid command line options were specified.
.RE
.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp
@@ -89,5 +97,6 @@ Interface StabilityUnstable
.TE
.SH SEE ALSO
.sp
.LP
\fBzfs\fR(1M), \fBzpool\fR(1M), \fBattributes\fR(5)
File diff suppressed because it is too large. Load diff
+24 -15
View File
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -233,19 +233,26 @@ typedef struct zil_rec_info {
} zil_rec_info_t;
static zil_rec_info_t zil_rec_info[TX_MAX_TYPE] = {
{ NULL, "Total " },
{ zil_prt_rec_create, "TX_CREATE " },
{ zil_prt_rec_create, "TX_MKDIR " },
{ zil_prt_rec_create, "TX_MKXATTR " },
{ zil_prt_rec_create, "TX_SYMLINK " },
{ zil_prt_rec_remove, "TX_REMOVE " },
{ zil_prt_rec_remove, "TX_RMDIR " },
{ zil_prt_rec_link, "TX_LINK " },
{ zil_prt_rec_rename, "TX_RENAME " },
{ zil_prt_rec_write, "TX_WRITE " },
{ zil_prt_rec_truncate, "TX_TRUNCATE" },
{ zil_prt_rec_setattr, "TX_SETATTR " },
{ zil_prt_rec_acl, "TX_ACL " },
{ NULL, "Total " },
{ zil_prt_rec_create, "TX_CREATE " },
{ zil_prt_rec_create, "TX_MKDIR " },
{ zil_prt_rec_create, "TX_MKXATTR " },
{ zil_prt_rec_create, "TX_SYMLINK " },
{ zil_prt_rec_remove, "TX_REMOVE " },
{ zil_prt_rec_remove, "TX_RMDIR " },
{ zil_prt_rec_link, "TX_LINK " },
{ zil_prt_rec_rename, "TX_RENAME " },
{ zil_prt_rec_write, "TX_WRITE " },
{ zil_prt_rec_truncate, "TX_TRUNCATE " },
{ zil_prt_rec_setattr, "TX_SETATTR " },
{ zil_prt_rec_acl, "TX_ACL_V0 " },
{ zil_prt_rec_acl, "TX_ACL_ACL " },
{ zil_prt_rec_create, "TX_CREATE_ACL " },
{ zil_prt_rec_create, "TX_CREATE_ATTR " },
{ zil_prt_rec_create, "TX_CREATE_ACL_ATTR " },
{ zil_prt_rec_create, "TX_MKDIR_ACL " },
{ zil_prt_rec_create, "TX_MKDIR_ATTR " },
{ zil_prt_rec_create, "TX_MKDIR_ACL_ATTR " },
};
/* ARGSUSED */
@@ -255,12 +262,14 @@ print_log_record(zilog_t *zilog, lr_t *lr, void *arg, uint64_t claim_txg)
int txtype;
int verbose = MAX(dump_opt['d'], dump_opt['i']);
/* reduce size of txtype to strip off TX_CI bit */
txtype = lr->lrc_txtype;
ASSERT(txtype != 0 && (uint_t)txtype < TX_MAX_TYPE);
ASSERT(lr->lrc_txg);
(void) printf("\t\t%s len %6llu, txg %llu, seq %llu\n",
(void) printf("\t\t%s%s len %6llu, txg %llu, seq %llu\n",
(lr->lrc_txtype & TX_CI) ? "CI-" : "",
zil_rec_info[txtype].zri_name,
(u_longlong_t)lr->lrc_reclen,
(u_longlong_t)lr->lrc_txg,
File diff suppressed because it is too large. Load diff
+43 -28
View File
@@ -19,12 +19,10 @@
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <libintl.h>
#include <libuutil.h>
#include <stddef.h>
@@ -56,28 +54,43 @@ typedef struct zfs_node {
typedef struct callback_data {
uu_avl_t *cb_avl;
int cb_recurse;
int cb_flags;
zfs_type_t cb_types;
zfs_sort_column_t *cb_sortcol;
zfs_proplist_t **cb_proplist;
zprop_list_t **cb_proplist;
} callback_data_t;
uu_avl_pool_t *avl_pool;
/*
* Called for each dataset. If the object the object is of an appropriate type,
* Include snaps if they were requested or if this a zfs list where types
* were not specified and the "listsnapshots" property is set on this pool.
*/
static int
zfs_include_snapshots(zfs_handle_t *zhp, callback_data_t *cb)
{
zpool_handle_t *zph;
if ((cb->cb_flags & ZFS_ITER_PROP_LISTSNAPS) == 0)
return (cb->cb_types & ZFS_TYPE_SNAPSHOT);
zph = zfs_get_pool_handle(zhp);
return (zpool_get_prop_int(zph, ZPOOL_PROP_LISTSNAPS, NULL));
}
/*
* Called for each dataset. If the object is of an appropriate type,
* add it to the avl tree and recurse over any children as necessary.
*/
int
static int
zfs_callback(zfs_handle_t *zhp, void *data)
{
callback_data_t *cb = data;
int dontclose = 0;
int include_snaps = zfs_include_snapshots(zhp, cb);
/*
* If this object is of the appropriate type, add it to the AVL tree.
*/
if (zfs_get_type(zhp) & cb->cb_types) {
if ((zfs_get_type(zhp) & cb->cb_types) ||
((zfs_get_type(zhp) == ZFS_TYPE_SNAPSHOT) && include_snaps)) {
uu_avl_index_t idx;
zfs_node_t *node = safe_malloc(sizeof (zfs_node_t));
@@ -100,10 +113,12 @@ zfs_callback(zfs_handle_t *zhp, void *data)
/*
* Recurse if necessary.
*/
if (cb->cb_recurse && (zfs_get_type(zhp) == ZFS_TYPE_FILESYSTEM ||
(zfs_get_type(zhp) == ZFS_TYPE_VOLUME && (cb->cb_types &
ZFS_TYPE_SNAPSHOT))))
(void) zfs_iter_children(zhp, zfs_callback, data);
if (cb->cb_flags & ZFS_ITER_RECURSE) {
if (zfs_get_type(zhp) == ZFS_TYPE_FILESYSTEM)
(void) zfs_iter_filesystems(zhp, zfs_callback, data);
if ((zfs_get_type(zhp) != ZFS_TYPE_SNAPSHOT) && include_snaps)
(void) zfs_iter_snapshots(zhp, zfs_callback, data);
}
if (!dontclose)
zfs_close(zhp);
@@ -118,7 +133,7 @@ zfs_add_sort_column(zfs_sort_column_t **sc, const char *name,
zfs_sort_column_t *col;
zfs_prop_t prop;
if ((prop = zfs_name_to_prop(name)) == ZFS_PROP_INVAL &&
if ((prop = zfs_name_to_prop(name)) == ZPROP_INVAL &&
!zfs_prop_user(name))
return (-1);
@@ -126,7 +141,7 @@ zfs_add_sort_column(zfs_sort_column_t **sc, const char *name,
col->sc_prop = prop;
col->sc_reverse = reverse;
if (prop == ZFS_PROP_INVAL) {
if (prop == ZPROP_INVAL) {
col->sc_user_prop = safe_malloc(strlen(name) + 1);
(void) strcpy(col->sc_user_prop, name);
}
@@ -243,7 +258,7 @@ zfs_sort(const void *larg, const void *rarg, void *data)
* Otherwise, we compare 'lnum' and 'rnum'.
*/
lstr = rstr = NULL;
if (psc->sc_prop == ZFS_PROP_INVAL) {
if (psc->sc_prop == ZPROP_INVAL) {
nvlist_t *luser, *ruser;
nvlist_t *lval, *rval;
@@ -257,10 +272,10 @@ zfs_sort(const void *larg, const void *rarg, void *data)
if (lvalid)
verify(nvlist_lookup_string(lval,
ZFS_PROP_VALUE, &lstr) == 0);
ZPROP_VALUE, &lstr) == 0);
if (rvalid)
verify(nvlist_lookup_string(rval,
ZFS_PROP_VALUE, &rstr) == 0);
ZPROP_VALUE, &rstr) == 0);
} else if (zfs_prop_is_string(psc->sc_prop)) {
lvalid = (zfs_prop_get(l, psc->sc_prop, lbuf,
@@ -293,7 +308,7 @@ zfs_sort(const void *larg, const void *rarg, void *data)
if (lstr)
ret = strcmp(lstr, rstr);
if (lnum < rnum)
else if (lnum < rnum)
ret = -1;
else if (lnum > rnum)
ret = 1;
@@ -309,9 +324,9 @@ zfs_sort(const void *larg, const void *rarg, void *data)
}
int
zfs_for_each(int argc, char **argv, boolean_t recurse, zfs_type_t types,
zfs_sort_column_t *sortcol, zfs_proplist_t **proplist, zfs_iter_f callback,
void *data, boolean_t args_can_be_paths)
zfs_for_each(int argc, char **argv, int flags, zfs_type_t types,
zfs_sort_column_t *sortcol, zprop_list_t **proplist,
zfs_iter_f callback, void *data)
{
callback_data_t cb;
int ret = 0;
@@ -328,7 +343,7 @@ zfs_for_each(int argc, char **argv, boolean_t recurse, zfs_type_t types,
}
cb.cb_sortcol = sortcol;
cb.cb_recurse = recurse;
cb.cb_flags = flags;
cb.cb_proplist = proplist;
cb.cb_types = types;
if ((cb.cb_avl = uu_avl_create(avl_pool, NULL, UU_DEFAULT)) == NULL) {
@@ -341,7 +356,7 @@ zfs_for_each(int argc, char **argv, boolean_t recurse, zfs_type_t types,
/*
* If given no arguments, iterate over all datasets.
*/
cb.cb_recurse = 1;
cb.cb_flags |= ZFS_ITER_RECURSE;
ret = zfs_iter_root(g_zfs, zfs_callback, &cb);
} else {
int i;
@@ -354,14 +369,14 @@ zfs_for_each(int argc, char **argv, boolean_t recurse, zfs_type_t types,
* can take volumes as well.
*/
argtype = types;
if (recurse) {
if (flags & ZFS_ITER_RECURSE) {
argtype |= ZFS_TYPE_FILESYSTEM;
if (types & ZFS_TYPE_SNAPSHOT)
argtype |= ZFS_TYPE_VOLUME;
}
for (i = 0; i < argc; i++) {
if (args_can_be_paths) {
if (flags & ZFS_ITER_ARGS_CAN_BE_PATHS) {
zhp = zfs_path_to_zhandle(g_zfs, argv[i],
argtype);
} else {
+7 -5
View File
@@ -19,15 +19,13 @@
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef ZFS_ITER_H
#define ZFS_ITER_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
@@ -40,8 +38,12 @@ typedef struct zfs_sort_column {
boolean_t sc_reverse;
} zfs_sort_column_t;
int zfs_for_each(int, char **, boolean_t, zfs_type_t, zfs_sort_column_t *,
zfs_proplist_t **, zfs_iter_f, void *, boolean_t);
#define ZFS_ITER_RECURSE (1 << 0)
#define ZFS_ITER_ARGS_CAN_BE_PATHS (1 << 1)
#define ZFS_ITER_PROP_LISTSNAPS (1 << 2)
int zfs_for_each(int, char **, int options, zfs_type_t,
zfs_sort_column_t *, zprop_list_t **, zfs_iter_f, void *);
int zfs_add_sort_column(zfs_sort_column_t **, const char *, boolean_t);
void zfs_free_sort_columns(zfs_sort_column_t *);
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,460 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <libzfs.h>
#undef verify /* both libzfs.h and zfs_context.h want to define this */
#include <sys/zfs_context.h>
#include <errno.h>
#include <fcntl.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <sys/file.h>
#include <sys/mntent.h>
#include <sys/mnttab.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <sys/dmu.h>
#include <sys/dmu_objset.h>
#include <sys/dnode.h>
#include <sys/vdev_impl.h>
#include "zinject.h"
#include <assert.h>
#define verify assert
extern void kernel_init(int);
extern void kernel_fini(void);
static int debug;
static void
ziprintf(const char *fmt, ...)
{
va_list ap;
if (!debug)
return;
va_start(ap, fmt);
(void) vprintf(fmt, ap);
va_end(ap);
}
/*
* Given a full path to a file, translate into a dataset name and a relative
* path within the dataset. 'dataset' must be at least MAXNAMELEN characters,
* and 'relpath' must be at least MAXPATHLEN characters. We also pass a stat64
* buffer, which we need later to get the object ID.
*/
static int
parse_pathname(const char *fullpath, char *dataset, char *relpath,
struct stat64 *statbuf)
{
struct statfs sfs;
const char *rel;
if (fullpath[0] != '/') {
(void) fprintf(stderr, "invalid object '%s': must be full "
"path\n", fullpath);
usage();
return (-1);
}
if (strlen(fullpath) >= MAXPATHLEN) {
(void) fprintf(stderr, "invalid object; pathname too long\n");
return (-1);
}
if (stat64(fullpath, statbuf) != 0) {
(void) fprintf(stderr, "cannot open '%s': %s\n",
fullpath, strerror(errno));
return (-1);
}
if (statfs(fullpath, &sfs) == -1) {
(void) fprintf(stderr, "cannot find mountpoint for '%s': %s\n",
fullpath, strerror(errno));
return (-1);
}
if (strcmp(sfs.f_fstypename, MNTTYPE_ZFS) != 0) {
(void) fprintf(stderr, "invalid path '%s': not a ZFS "
"filesystem\n", fullpath);
return (-1);
}
if (strncmp(fullpath, sfs.f_mntonname, strlen(sfs.f_mntonname)) != 0) {
(void) fprintf(stderr, "invalid path '%s': mountpoint "
"doesn't match path\n", fullpath);
return (-1);
}
(void) strcpy(dataset, sfs.f_mntfromname);
rel = fullpath + strlen(sfs.f_mntonname);
if (rel[0] == '/')
rel++;
(void) strcpy(relpath, rel);
return (0);
}
/*
* Convert from a (dataset, path) pair into a (objset, object) pair. Note that
* we grab the object number from the inode number, since looking this up via
* libzpool is a real pain.
*/
/* ARGSUSED */
static int
object_from_path(const char *dataset, const char *path, struct stat64 *statbuf,
zinject_record_t *record)
{
objset_t *os;
int err;
/*
* Before doing any libzpool operations, call sync() to ensure that the
* on-disk state is consistent with the in-core state.
*/
sync();
if ((err = dmu_objset_open(dataset, DMU_OST_ZFS,
DS_MODE_USER | DS_MODE_READONLY, &os)) != 0) {
(void) fprintf(stderr, "cannot open dataset '%s': %s\n",
dataset, strerror(err));
return (-1);
}
record->zi_objset = dmu_objset_id(os);
record->zi_object = statbuf->st_ino;
dmu_objset_close(os);
return (0);
}
/*
* Calculate the real range based on the type, level, and range given.
*/
static int
calculate_range(const char *dataset, err_type_t type, int level, char *range,
zinject_record_t *record)
{
objset_t *os = NULL;
dnode_t *dn = NULL;
int err;
int ret = -1;
/*
* Determine the numeric range from the string.
*/
if (range == NULL) {
/*
* If range is unspecified, set the range to [0,-1], which
* indicates that the whole object should be treated as an
* error.
*/
record->zi_start = 0;
record->zi_end = -1ULL;
} else {
char *end;
/* XXX add support for suffixes */
record->zi_start = strtoull(range, &end, 10);
if (*end == '\0')
record->zi_end = record->zi_start + 1;
else if (*end == ',')
record->zi_end = strtoull(end + 1, &end, 10);
if (*end != '\0') {
(void) fprintf(stderr, "invalid range '%s': must be "
"a numeric range of the form 'start[,end]'\n",
range);
goto out;
}
}
switch (type) {
case TYPE_DATA:
break;
case TYPE_DNODE:
/*
* If this is a request to inject faults into the dnode, then we
* must translate the current (objset,object) pair into an
* offset within the metadnode for the objset. Specifying any
* kind of range with type 'dnode' is illegal.
*/
if (range != NULL) {
(void) fprintf(stderr, "range cannot be specified when "
"type is 'dnode'\n");
goto out;
}
record->zi_start = record->zi_object * sizeof (dnode_phys_t);
record->zi_end = record->zi_start + sizeof (dnode_phys_t);
record->zi_object = 0;
break;
}
/*
* Get the dnode associated with object, so we can calculate the block
* size.
*/
if ((err = dmu_objset_open(dataset, DMU_OST_ANY,
DS_MODE_USER | DS_MODE_READONLY, &os)) != 0) {
(void) fprintf(stderr, "cannot open dataset '%s': %s\n",
dataset, strerror(err));
goto out;
}
if (record->zi_object == 0) {
dn = os->os->os_meta_dnode;
} else {
err = dnode_hold(os->os, record->zi_object, FTAG, &dn);
if (err != 0) {
(void) fprintf(stderr, "failed to hold dnode "
"for object %llu\n",
(u_longlong_t)record->zi_object);
goto out;
}
}
ziprintf("data shift: %d\n", (int)dn->dn_datablkshift);
ziprintf(" ind shift: %d\n", (int)dn->dn_indblkshift);
/*
* Translate range into block IDs.
*/
if (record->zi_start != 0 || record->zi_end != -1ULL) {
record->zi_start >>= dn->dn_datablkshift;
record->zi_end >>= dn->dn_datablkshift;
}
/*
* Check level, and then translate level 0 blkids into ranges
* appropriate for level of indirection.
*/
record->zi_level = level;
if (level > 0) {
ziprintf("level 0 blkid range: [%llu, %llu]\n",
record->zi_start, record->zi_end);
if (level >= dn->dn_nlevels) {
(void) fprintf(stderr, "level %d exceeds max level "
"of object (%d)\n", level, dn->dn_nlevels - 1);
goto out;
}
if (record->zi_start != 0 || record->zi_end != 0) {
int shift = dn->dn_indblkshift - SPA_BLKPTRSHIFT;
for (; level > 0; level--) {
record->zi_start >>= shift;
record->zi_end >>= shift;
}
}
}
ret = 0;
out:
if (dn) {
if (dn != os->os->os_meta_dnode)
dnode_rele(dn, FTAG);
}
if (os)
dmu_objset_close(os);
return (ret);
}
int
translate_record(err_type_t type, const char *object, const char *range,
int level, zinject_record_t *record, char *poolname, char *dataset)
{
char path[MAXPATHLEN];
char *slash;
struct stat64 statbuf;
int ret = -1;
kernel_init(FREAD);
debug = (getenv("ZINJECT_DEBUG") != NULL);
ziprintf("translating: %s\n", object);
if (MOS_TYPE(type)) {
/*
* MOS objects are treated specially.
*/
switch (type) {
case TYPE_MOS:
record->zi_type = 0;
break;
case TYPE_MOSDIR:
record->zi_type = DMU_OT_OBJECT_DIRECTORY;
break;
case TYPE_METASLAB:
record->zi_type = DMU_OT_OBJECT_ARRAY;
break;
case TYPE_CONFIG:
record->zi_type = DMU_OT_PACKED_NVLIST;
break;
case TYPE_BPLIST:
record->zi_type = DMU_OT_BPLIST;
break;
case TYPE_SPACEMAP:
record->zi_type = DMU_OT_SPACE_MAP;
break;
case TYPE_ERRLOG:
record->zi_type = DMU_OT_ERROR_LOG;
break;
}
dataset[0] = '\0';
(void) strcpy(poolname, object);
return (0);
}
/*
* Convert a full path into a (dataset, file) pair.
*/
if (parse_pathname(object, dataset, path, &statbuf) != 0)
goto err;
ziprintf(" dataset: %s\n", dataset);
ziprintf(" path: %s\n", path);
/*
* Convert (dataset, file) into (objset, object)
*/
if (object_from_path(dataset, path, &statbuf, record) != 0)
goto err;
ziprintf("raw objset: %llu\n", record->zi_objset);
ziprintf("raw object: %llu\n", record->zi_object);
/*
* For the given object, calculate the real (type, level, range)
*/
if (calculate_range(dataset, type, level, (char *)range, record) != 0)
goto err;
ziprintf(" objset: %llu\n", record->zi_objset);
ziprintf(" object: %llu\n", record->zi_object);
if (record->zi_start == 0 &&
record->zi_end == -1ULL)
ziprintf(" range: all\n");
else
ziprintf(" range: [%llu, %llu]\n", record->zi_start,
record->zi_end);
/*
* Copy the pool name
*/
(void) strcpy(poolname, dataset);
if ((slash = strchr(poolname, '/')) != NULL)
*slash = '\0';
ret = 0;
err:
kernel_fini();
return (ret);
}
int
translate_raw(const char *str, zinject_record_t *record)
{
/*
* A raw bookmark of the form objset:object:level:blkid, where each
* number is a hexidecimal value.
*/
if (sscanf(str, "%llx:%llx:%x:%llx", (u_longlong_t *)&record->zi_objset,
(u_longlong_t *)&record->zi_object, &record->zi_level,
(u_longlong_t *)&record->zi_start) != 4) {
(void) fprintf(stderr, "bad raw spec '%s': must be of the form "
"'objset:object:level:blkid'\n", str);
return (-1);
}
record->zi_end = record->zi_start;
return (0);
}
int
translate_device(const char *pool, const char *device, err_type_t label_type,
zinject_record_t *record)
{
char *end;
zpool_handle_t *zhp;
nvlist_t *tgt;
boolean_t isspare, iscache;
/*
* Given a device name or GUID, create an appropriate injection record
* with zi_guid set.
*/
if ((zhp = zpool_open(g_zfs, pool)) == NULL)
return (-1);
record->zi_guid = strtoull(device, &end, 16);
if (record->zi_guid == 0 || *end != '\0') {
tgt = zpool_find_vdev(zhp, device, &isspare, &iscache, NULL);
if (tgt == NULL) {
(void) fprintf(stderr, "cannot find device '%s' in "
"pool '%s'\n", device, pool);
return (-1);
}
verify(nvlist_lookup_uint64(tgt, ZPOOL_CONFIG_GUID,
&record->zi_guid) == 0);
}
switch (label_type) {
case TYPE_LABEL_UBERBLOCK:
record->zi_start = offsetof(vdev_label_t, vl_uberblock[0]);
record->zi_end = record->zi_start + VDEV_UBERBLOCK_RING - 1;
break;
case TYPE_LABEL_NVLIST:
record->zi_start = offsetof(vdev_label_t, vl_vdev_phys);
record->zi_end = record->zi_start + VDEV_PHYS_SIZE - 1;
break;
}
return (0);
}
@@ -0,0 +1,771 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ZFS Fault Injector
*
* This userland component takes a set of options and uses libzpool to translate
* from a user-visible object type and name to an internal representation.
* There are two basic types of faults: device faults and data faults.
*
*
* DEVICE FAULTS
*
* Errors can be injected into a particular vdev using the '-d' option. This
* option takes a path or vdev GUID to uniquely identify the device within a
* pool. There are two types of errors that can be injected, EIO and ENXIO,
* that can be controlled through the '-e' option. The default is ENXIO. For
* EIO failures, any attempt to read data from the device will return EIO, but
* subsequent attempt to reopen the device will succeed. For ENXIO failures,
* any attempt to read from the device will return EIO, but any attempt to
* reopen the device will also return ENXIO.
* For label faults, the -L option must be specified. This allows faults
* to be injected into either the nvlist or uberblock region of all the labels
* for the specified device.
*
* This form of the command looks like:
*
* zinject -d device [-e errno] [-L <uber | nvlist>] pool
*
*
* DATA FAULTS
*
* We begin with a tuple of the form:
*
* <type,level,range,object>
*
* type A string describing the type of data to target. Each type
* implicitly describes how to interpret 'object'. Currently,
* the following values are supported:
*
* data User data for a file
* dnode Dnode for a file or directory
*
* The following MOS objects are special. Instead of injecting
* errors on a particular object or blkid, we inject errors across
* all objects of the given type.
*
* mos Any data in the MOS
* mosdir object directory
* config pool configuration
* bplist blkptr list
* spacemap spacemap
* metaslab metaslab
* errlog persistent error log
*
* level Object level. Defaults to '0', not applicable to all types. If
* a range is given, this corresponds to the indirect block
* corresponding to the specific range.
*
* range A numerical range [start,end) within the object. Defaults to
* the full size of the file.
*
* object A string describing the logical location of the object. For
* files and directories (currently the only supported types),
* this is the path of the object on disk.
*
* This is translated, via libzpool, into the following internal representation:
*
* <type,objset,object,level,range>
*
* These types should be self-explanatory. This tuple is then passed to the
* kernel via a special ioctl() to initiate fault injection for the given
* object. Note that 'type' is not strictly necessary for fault injection, but
* is used when translating existing faults into a human-readable string.
*
*
* The command itself takes one of the forms:
*
* zinject
* zinject <-a | -u pool>
* zinject -c <id|all>
* zinject [-q] <-t type> [-f freq] [-u] [-a] [-m] [-e errno] [-l level]
* [-r range] <object>
* zinject [-f freq] [-a] [-m] [-u] -b objset:object:level:start:end pool
*
* With no arguments, the command prints all currently registered injection
* handlers, with their numeric identifiers.
*
* The '-c' option will clear the given handler, or all handlers if 'all' is
* specified.
*
* The '-e' option takes a string describing the errno to simulate. This must
* be either 'io' or 'checksum'. In most cases this will result in the same
* behavior, but RAID-Z will produce a different set of ereports for this
* situation.
*
* The '-a', '-u', and '-m' flags toggle internal flush behavior. If '-a' is
* specified, then the ARC cache is flushed appropriately. If '-u' is
* specified, then the underlying SPA is unloaded. Either of these flags can be
* specified independently of any other handlers. The '-m' flag automatically
* does an unmount and remount of the underlying dataset to aid in flushing the
* cache.
*
* The '-f' flag controls the frequency of errors injected, expressed as a
* integer percentage between 1 and 100. The default is 100.
*
* The this form is responsible for actually injecting the handler into the
* framework. It takes the arguments described above, translates them to the
* internal tuple using libzpool, and then issues an ioctl() to register the
* handler.
*
* The final form can target a specific bookmark, regardless of whether a
* human-readable interface has been designed. It allows developers to specify
* a particular block by number.
*/
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <unistd.h>
#include <sys/fs/zfs.h>
#include <sys/param.h>
#include <sys/mount.h>
#include <libzfs.h>
#undef verify /* both libzfs.h and zfs_context.h want to define this */
#include "zinject.h"
libzfs_handle_t *g_zfs;
int zfs_fd;
#ifndef ECKSUM
#define ECKSUM EBADE
#endif
static const char *errtable[TYPE_INVAL] = {
"data",
"dnode",
"mos",
"mosdir",
"metaslab",
"config",
"bplist",
"spacemap",
"errlog",
"uber",
"nvlist"
};
static err_type_t
name_to_type(const char *arg)
{
int i;
for (i = 0; i < TYPE_INVAL; i++)
if (strcmp(errtable[i], arg) == 0)
return (i);
return (TYPE_INVAL);
}
static const char *
type_to_name(uint64_t type)
{
switch (type) {
case DMU_OT_OBJECT_DIRECTORY:
return ("mosdir");
case DMU_OT_OBJECT_ARRAY:
return ("metaslab");
case DMU_OT_PACKED_NVLIST:
return ("config");
case DMU_OT_BPLIST:
return ("bplist");
case DMU_OT_SPACE_MAP:
return ("spacemap");
case DMU_OT_ERROR_LOG:
return ("errlog");
default:
return ("-");
}
}
/*
* Print usage message.
*/
void
usage(void)
{
(void) printf(
"usage:\n"
"\n"
"\tzinject\n"
"\n"
"\t\tList all active injection records.\n"
"\n"
"\tzinject -c <id|all>\n"
"\n"
"\t\tClear the particular record (if given a numeric ID), or\n"
"\t\tall records if 'all' is specificed.\n"
"\n"
"\tzinject -d device [-e errno] [-L <nvlist|uber>] pool\n"
"\t\tInject a fault into a particular device or the device's\n"
"\t\tlabel. Label injection can either be 'nvlist' or 'uber'.\n"
"\t\t'errno' can either be 'nxio' (the default) or 'io'.\n"
"\n"
"\tzinject -b objset:object:level:blkid pool\n"
"\n"
"\t\tInject an error into pool 'pool' with the numeric bookmark\n"
"\t\tspecified by the remaining tuple. Each number is in\n"
"\t\thexidecimal, and only one block can be specified.\n"
"\n"
"\tzinject [-q] <-t type> [-e errno] [-l level] [-r range]\n"
"\t [-a] [-m] [-u] [-f freq] <object>\n"
"\n"
"\t\tInject an error into the object specified by the '-t' option\n"
"\t\tand the object descriptor. The 'object' parameter is\n"
"\t\tinterperted depending on the '-t' option.\n"
"\n"
"\t\t-q\tQuiet mode. Only print out the handler number added.\n"
"\t\t-e\tInject a specific error. Must be either 'io' or\n"
"\t\t\t'checksum'. Default is 'io'.\n"
"\t\t-l\tInject error at a particular block level. Default is "
"0.\n"
"\t\t-m\tAutomatically remount underlying filesystem.\n"
"\t\t-r\tInject error over a particular logical range of an\n"
"\t\t\tobject. Will be translated to the appropriate blkid\n"
"\t\t\trange according to the object's properties.\n"
"\t\t-a\tFlush the ARC cache. Can be specified without any\n"
"\t\t\tassociated object.\n"
"\t\t-u\tUnload the associated pool. Can be specified with only\n"
"\t\t\ta pool object.\n"
"\t\t-f\tOnly inject errors a fraction of the time. Expressed as\n"
"\t\t\ta percentage between 1 and 100.\n"
"\n"
"\t-t data\t\tInject an error into the plain file contents of a\n"
"\t\t\tfile. The object must be specified as a complete path\n"
"\t\t\tto a file on a ZFS filesystem.\n"
"\n"
"\t-t dnode\tInject an error into the metadnode in the block\n"
"\t\t\tcorresponding to the dnode for a file or directory. The\n"
"\t\t\t'-r' option is incompatible with this mode. The object\n"
"\t\t\tis specified as a complete path to a file or directory\n"
"\t\t\ton a ZFS filesystem.\n"
"\n"
"\t-t <mos>\tInject errors into the MOS for objects of the given\n"
"\t\t\ttype. Valid types are: mos, mosdir, config, bplist,\n"
"\t\t\tspacemap, metaslab, errlog. The only valid <object> is\n"
"\t\t\tthe poolname.\n");
}
static int
iter_handlers(int (*func)(int, const char *, zinject_record_t *, void *),
void *data)
{
zfs_cmd_t zc;
int ret;
zc.zc_guid = 0;
while (ioctl(zfs_fd, ZFS_IOC_INJECT_LIST_NEXT, &zc) == 0)
if ((ret = func((int)zc.zc_guid, zc.zc_name,
&zc.zc_inject_record, data)) != 0)
return (ret);
return (0);
}
static int
print_data_handler(int id, const char *pool, zinject_record_t *record,
void *data)
{
int *count = data;
if (record->zi_guid != 0)
return (0);
if (*count == 0) {
(void) printf("%3s %-15s %-6s %-6s %-8s %3s %-15s\n",
"ID", "POOL", "OBJSET", "OBJECT", "TYPE", "LVL", "RANGE");
(void) printf("--- --------------- ------ "
"------ -------- --- ---------------\n");
}
*count += 1;
(void) printf("%3d %-15s %-6llu %-6llu %-8s %3d ", id, pool,
(u_longlong_t)record->zi_objset, (u_longlong_t)record->zi_object,
type_to_name(record->zi_type), record->zi_level);
if (record->zi_start == 0 &&
record->zi_end == -1ULL)
(void) printf("all\n");
else
(void) printf("[%llu, %llu]\n", (u_longlong_t)record->zi_start,
(u_longlong_t)record->zi_end);
return (0);
}
static int
print_device_handler(int id, const char *pool, zinject_record_t *record,
void *data)
{
int *count = data;
if (record->zi_guid == 0)
return (0);
if (*count == 0) {
(void) printf("%3s %-15s %s\n", "ID", "POOL", "GUID");
(void) printf("--- --------------- ----------------\n");
}
*count += 1;
(void) printf("%3d %-15s %llx\n", id, pool,
(u_longlong_t)record->zi_guid);
return (0);
}
/*
* Print all registered error handlers. Returns the number of handlers
* registered.
*/
static int
print_all_handlers(void)
{
int count = 0;
(void) iter_handlers(print_device_handler, &count);
(void) printf("\n");
count = 0;
(void) iter_handlers(print_data_handler, &count);
return (count);
}
/* ARGSUSED */
static int
cancel_one_handler(int id, const char *pool, zinject_record_t *record,
void *data)
{
zfs_cmd_t zc;
zc.zc_guid = (uint64_t)id;
if (ioctl(zfs_fd, ZFS_IOC_CLEAR_FAULT, &zc) != 0) {
(void) fprintf(stderr, "failed to remove handler %d: %s\n",
id, strerror(errno));
return (1);
}
return (0);
}
/*
* Remove all fault injection handlers.
*/
static int
cancel_all_handlers(void)
{
int ret = iter_handlers(cancel_one_handler, NULL);
(void) printf("removed all registered handlers\n");
return (ret);
}
/*
* Remove a specific fault injection handler.
*/
static int
cancel_handler(int id)
{
zfs_cmd_t zc;
zc.zc_guid = (uint64_t)id;
if (ioctl(zfs_fd, ZFS_IOC_CLEAR_FAULT, &zc) != 0) {
(void) fprintf(stderr, "failed to remove handler %d: %s\n",
id, strerror(errno));
return (1);
}
(void) printf("removed handler %d\n", id);
return (0);
}
/*
* Register a new fault injection handler.
*/
static int
register_handler(const char *pool, int flags, zinject_record_t *record,
int quiet)
{
zfs_cmd_t zc;
(void) strcpy(zc.zc_name, pool);
zc.zc_inject_record = *record;
zc.zc_guid = flags;
if (ioctl(zfs_fd, ZFS_IOC_INJECT_FAULT, &zc) != 0) {
(void) fprintf(stderr, "failed to add handler: %s\n",
strerror(errno));
return (1);
}
if (flags & ZINJECT_NULL)
return (0);
if (quiet) {
(void) printf("%llu\n", (u_longlong_t)zc.zc_guid);
} else {
(void) printf("Added handler %llu with the following "
"properties:\n", (u_longlong_t)zc.zc_guid);
(void) printf(" pool: %s\n", pool);
if (record->zi_guid) {
(void) printf(" vdev: %llx\n",
(u_longlong_t)record->zi_guid);
} else {
(void) printf("objset: %llu\n",
(u_longlong_t)record->zi_objset);
(void) printf("object: %llu\n",
(u_longlong_t)record->zi_object);
(void) printf(" type: %llu\n",
(u_longlong_t)record->zi_type);
(void) printf(" level: %d\n", record->zi_level);
if (record->zi_start == 0 &&
record->zi_end == -1ULL)
(void) printf(" range: all\n");
else
(void) printf(" range: [%llu, %llu)\n",
(u_longlong_t)record->zi_start,
(u_longlong_t)record->zi_end);
}
}
return (0);
}
int
main(int argc, char **argv)
{
int c;
char *range = NULL;
char *cancel = NULL;
char *end;
char *raw = NULL;
char *device = NULL;
int level = 0;
int quiet = 0;
int error = 0;
int domount = 0;
err_type_t type = TYPE_INVAL;
err_type_t label = TYPE_INVAL;
zinject_record_t record = { 0 };
char pool[MAXNAMELEN];
char dataset[MAXNAMELEN];
zfs_handle_t *zhp;
int ret;
int flags = 0;
if ((g_zfs = libzfs_init()) == NULL) {
(void) fprintf(stderr, "internal error: failed to "
"initialize ZFS library\n");
return (1);
}
libzfs_print_on_error(g_zfs, B_TRUE);
if ((zfs_fd = open(ZFS_DEV, O_RDWR)) < 0) {
(void) fprintf(stderr, "failed to open ZFS device\n");
return (1);
}
if (argc == 1) {
/*
* No arguments. Print the available handlers. If there are no
* available handlers, direct the user to '-h' for help
* information.
*/
if (print_all_handlers() == 0) {
(void) printf("No handlers registered.\n");
(void) printf("Run 'zinject -h' for usage "
"information.\n");
}
return (0);
}
while ((c = getopt(argc, argv, ":ab:d:f:qhc:t:l:mr:e:uL:")) != -1) {
switch (c) {
case 'a':
flags |= ZINJECT_FLUSH_ARC;
break;
case 'b':
raw = optarg;
break;
case 'c':
cancel = optarg;
break;
case 'd':
device = optarg;
break;
case 'e':
if (strcasecmp(optarg, "io") == 0) {
error = EIO;
} else if (strcasecmp(optarg, "checksum") == 0) {
error = ECKSUM;
} else if (strcasecmp(optarg, "nxio") == 0) {
error = ENXIO;
} else {
(void) fprintf(stderr, "invalid error type "
"'%s': must be 'io', 'checksum' or "
"'nxio'\n", optarg);
usage();
return (1);
}
break;
case 'f':
record.zi_freq = atoi(optarg);
if (record.zi_freq < 1 || record.zi_freq > 100) {
(void) fprintf(stderr, "frequency range must "
"be in the range (0, 100]\n");
return (1);
}
break;
case 'h':
usage();
return (0);
case 'l':
level = (int)strtol(optarg, &end, 10);
if (*end != '\0') {
(void) fprintf(stderr, "invalid level '%s': "
"must be an integer\n", optarg);
usage();
return (1);
}
break;
case 'm':
domount = 1;
break;
case 'q':
quiet = 1;
break;
case 'r':
range = optarg;
break;
case 't':
if ((type = name_to_type(optarg)) == TYPE_INVAL &&
!MOS_TYPE(type)) {
(void) fprintf(stderr, "invalid type '%s'\n",
optarg);
usage();
return (1);
}
break;
case 'u':
flags |= ZINJECT_UNLOAD_SPA;
break;
case 'L':
if ((label = name_to_type(optarg)) == TYPE_INVAL &&
!LABEL_TYPE(type)) {
(void) fprintf(stderr, "invalid label type "
"'%s'\n", optarg);
usage();
return (1);
}
break;
case ':':
(void) fprintf(stderr, "option -%c requires an "
"operand\n", optopt);
usage();
return (1);
case '?':
(void) fprintf(stderr, "invalid option '%c'\n",
optopt);
usage();
return (2);
}
}
argc -= optind;
argv += optind;
if (cancel != NULL) {
/*
* '-c' is invalid with any other options.
*/
if (raw != NULL || range != NULL || type != TYPE_INVAL ||
level != 0) {
(void) fprintf(stderr, "cancel (-c) incompatible with "
"any other options\n");
usage();
return (2);
}
if (argc != 0) {
(void) fprintf(stderr, "extraneous argument to '-c'\n");
usage();
return (2);
}
if (strcmp(cancel, "all") == 0) {
return (cancel_all_handlers());
} else {
int id = (int)strtol(cancel, &end, 10);
if (*end != '\0') {
(void) fprintf(stderr, "invalid handle id '%s':"
" must be an integer or 'all'\n", cancel);
usage();
return (1);
}
return (cancel_handler(id));
}
}
if (device != NULL) {
/*
* Device (-d) injection uses a completely different mechanism
* for doing injection, so handle it separately here.
*/
if (raw != NULL || range != NULL || type != TYPE_INVAL ||
level != 0) {
(void) fprintf(stderr, "device (-d) incompatible with "
"data error injection\n");
usage();
return (2);
}
if (argc != 1) {
(void) fprintf(stderr, "device (-d) injection requires "
"a single pool name\n");
usage();
return (2);
}
(void) strcpy(pool, argv[0]);
dataset[0] = '\0';
if (error == ECKSUM) {
(void) fprintf(stderr, "device error type must be "
"'io' or 'nxio'\n");
return (1);
}
if (translate_device(pool, device, label, &record) != 0)
return (1);
if (!error)
error = ENXIO;
} else if (raw != NULL) {
if (range != NULL || type != TYPE_INVAL || level != 0) {
(void) fprintf(stderr, "raw (-b) format with "
"any other options\n");
usage();
return (2);
}
if (argc != 1) {
(void) fprintf(stderr, "raw (-b) format expects a "
"single pool name\n");
usage();
return (2);
}
(void) strcpy(pool, argv[0]);
dataset[0] = '\0';
if (error == ENXIO) {
(void) fprintf(stderr, "data error type must be "
"'checksum' or 'io'\n");
return (1);
}
if (translate_raw(raw, &record) != 0)
return (1);
if (!error)
error = EIO;
} else if (type == TYPE_INVAL) {
if (flags == 0) {
(void) fprintf(stderr, "at least one of '-b', '-d', "
"'-t', '-a', or '-u' must be specified\n");
usage();
return (2);
}
if (argc == 1 && (flags & ZINJECT_UNLOAD_SPA)) {
(void) strcpy(pool, argv[0]);
dataset[0] = '\0';
} else if (argc != 0) {
(void) fprintf(stderr, "extraneous argument for "
"'-f'\n");
usage();
return (2);
}
flags |= ZINJECT_NULL;
} else {
if (argc != 1) {
(void) fprintf(stderr, "missing object\n");
usage();
return (2);
}
if (error == ENXIO) {
(void) fprintf(stderr, "data error type must be "
"'checksum' or 'io'\n");
return (1);
}
if (translate_record(type, argv[0], range, level, &record, pool,
dataset) != 0)
return (1);
if (!error)
error = EIO;
}
/*
* If this is pool-wide metadata, unmount everything. The ioctl() will
* unload the pool, so that we trigger spa-wide reopen of metadata next
* time we access the pool.
*/
if (dataset[0] != '\0' && domount) {
if ((zhp = zfs_open(g_zfs, dataset, ZFS_TYPE_DATASET)) == NULL)
return (1);
if (zfs_unmount(zhp, NULL, 0) != 0)
return (1);
}
record.zi_error = error;
ret = register_handler(pool, flags, &record, quiet);
if (dataset[0] != '\0' && domount)
ret = (zfs_mount(zhp, NULL, 0) != 0);
libzfs_fini(g_zfs);
return (ret);
}
@@ -0,0 +1,71 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _ZINJECT_H
#define _ZINJECT_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/zfs_ioctl.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
TYPE_DATA, /* plain file contents */
TYPE_DNODE, /* metadnode contents */
TYPE_MOS, /* all MOS data */
TYPE_MOSDIR, /* MOS object directory */
TYPE_METASLAB, /* metaslab objects */
TYPE_CONFIG, /* MOS config */
TYPE_BPLIST, /* block pointer list */
TYPE_SPACEMAP, /* space map objects */
TYPE_ERRLOG, /* persistent error log */
TYPE_LABEL_UBERBLOCK, /* label specific uberblock */
TYPE_LABEL_NVLIST, /* label specific nvlist */
TYPE_INVAL
} err_type_t;
#define MOS_TYPE(t) \
((t) >= TYPE_MOS && (t) < TYPE_LABEL_UBERBLOCK)
#define LABEL_TYPE(t) \
((t) >= TYPE_LABEL_UBERBLOCK && (t) < TYPE_INVAL)
int translate_record(err_type_t type, const char *object, const char *range,
int level, zinject_record_t *record, char *poolname, char *dataset);
int translate_raw(const char *raw, zinject_record_t *record);
int translate_device(const char *pool, const char *device,
err_type_t label_type, zinject_record_t *record);
void usage(void);
extern libzfs_handle_t *g_zfs;
#ifdef __cplusplus
}
#endif
#endif /* _ZINJECT_H */
File diff suppressed because it is too large. Load diff
@@ -53,6 +53,7 @@ struct zpool_list {
boolean_t zl_findall;
uu_avl_t *zl_avl;
uu_avl_pool_t *zl_pool;
zprop_list_t **zl_proplist;
};
/* ARGSUSED */
@@ -81,6 +82,12 @@ add_pool(zpool_handle_t *zhp, void *data)
node->zn_handle = zhp;
uu_avl_node_init(node, &node->zn_avlnode, zlp->zl_pool);
if (uu_avl_find(zlp->zl_avl, node, NULL, &idx) == NULL) {
if (zlp->zl_proplist &&
zpool_expand_proplist(zhp, zlp->zl_proplist) != 0) {
zpool_close(zhp);
free(node);
return (-1);
}
uu_avl_insert(zlp->zl_avl, node, idx);
} else {
zpool_close(zhp);
@@ -98,7 +105,7 @@ add_pool(zpool_handle_t *zhp, void *data)
* line.
*/
zpool_list_t *
pool_list_get(int argc, char **argv, zpool_proplist_t **proplist, int *err)
pool_list_get(int argc, char **argv, zprop_list_t **proplist, int *err)
{
zpool_list_t *zlp;
@@ -114,6 +121,8 @@ pool_list_get(int argc, char **argv, zpool_proplist_t **proplist, int *err)
UU_DEFAULT)) == NULL)
zpool_no_memory();
zlp->zl_proplist = proplist;
if (argc == 0) {
(void) zpool_iter(g_zfs, add_pool, zlp);
zlp->zl_findall = B_TRUE;
@@ -123,13 +132,12 @@ pool_list_get(int argc, char **argv, zpool_proplist_t **proplist, int *err)
for (i = 0; i < argc; i++) {
zpool_handle_t *zhp;
if ((zhp = zpool_open_canfail(g_zfs,
argv[i])) != NULL && add_pool(zhp, zlp) == 0) {
if (proplist &&
zpool_expand_proplist(zhp, proplist) != 0)
if (zhp = zpool_open_canfail(g_zfs, argv[i])) {
if (add_pool(zhp, zlp) != 0)
*err = B_TRUE;
} else
} else {
*err = B_TRUE;
}
}
}
@@ -228,7 +236,7 @@ pool_list_count(zpool_list_t *zlp)
*/
int
for_each_pool(int argc, char **argv, boolean_t unavail,
zpool_proplist_t **proplist, zpool_iter_f func, void *data)
zprop_list_t **proplist, zpool_iter_f func, void *data)
{
zpool_list_t *list;
int ret = 0;
File diff suppressed because it is too large. Load diff
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -77,3 +77,28 @@ zpool_no_memory(void)
gettext("internal error: out of memory\n"));
exit(1);
}
/*
* Return the number of logs in supplied nvlist
*/
uint_t
num_logs(nvlist_t *nv)
{
uint_t nlogs = 0;
uint_t c, children;
nvlist_t **child;
if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN,
&child, &children) != 0)
return (0);
for (c = 0; c < children; c++) {
uint64_t is_log = B_FALSE;
(void) nvlist_lookup_uint64(child[c], ZPOOL_CONFIG_IS_LOG,
&is_log);
if (is_log)
nlogs++;
}
return (nlogs);
}
@@ -19,15 +19,13 @@
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef ZPOOL_UTIL_H
#define ZPOOL_UTIL_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <libnvpair.h>
#include <libzfs.h>
@@ -41,22 +39,24 @@ extern "C" {
void *safe_malloc(size_t);
char *safe_strdup(const char *);
void zpool_no_memory(void);
uint_t num_logs(nvlist_t *nv);
/*
* Virtual device functions
*/
nvlist_t *make_root_vdev(nvlist_t *poolconfig, int force, int check_rep,
boolean_t isreplace, int argc, char **argv);
nvlist_t *make_root_vdev(zpool_handle_t *zhp, int force, int check_rep,
boolean_t isreplace, boolean_t dryrun, int argc, char **argv);
/*
* Pool list functions
*/
int for_each_pool(int, char **, boolean_t unavail, zpool_proplist_t **,
int for_each_pool(int, char **, boolean_t unavail, zprop_list_t **,
zpool_iter_f, void *);
typedef struct zpool_list zpool_list_t;
zpool_list_t *pool_list_get(int, char **, zpool_proplist_t **, int *);
zpool_list_t *pool_list_get(int, char **, zprop_list_t **, int *);
void pool_list_update(zpool_list_t *);
int pool_list_iter(zpool_list_t *, int unavail, zpool_iter_f, void *);
void pool_list_free(zpool_list_t *);
+325 -81
View File
@@ -20,12 +20,10 @@
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Functions to convert between a list of vdevs and an nvlist representing the
* configuration. Each entry in the list can be one of:
@@ -48,8 +46,8 @@
* Hot spares are a special case, and passed down as an array of disk vdevs, at
* the same level as the root of the vdev tree.
*
* The only function exported by this file is 'get_vdev_spec'. The function
* performs several passes:
* The only function exported by this file is 'make_root_vdev'. The
* function performs several passes:
*
* 1. Construct the vdev specification. Performs syntax validation and
* makes sure each device is valid.
@@ -59,6 +57,7 @@
* 3. Check for replication errors if the 'force' flag is not specified.
* validates that the replication level is consistent across the
* entire pool.
* 4. Call libzfs to label any whole disks with an EFI label.
*/
#include <assert.h>
@@ -76,8 +75,6 @@
#include <sys/mntent.h>
#include <libgeom.h>
#include <libzfs.h>
#include "zpool_util.h"
/*
@@ -111,53 +108,105 @@ vdev_error(const char *fmt, ...)
}
/*
* Validate a GEOM provider.
* Check that a file is valid. All we can do in this case is check that it's
* not in use by another pool, and not in use by swap.
*/
static int
check_file(const char *file, boolean_t force, boolean_t isspare)
{
char *name;
int fd;
int ret = 0;
int err;
pool_state_t state;
boolean_t inuse;
#if 0
if (dm_inuse_swap(file, &err)) {
if (err)
libdiskmgt_error(err);
else
vdev_error(gettext("%s is currently used by swap. "
"Please see swap(1M).\n"), file);
return (-1);
}
#endif
if ((fd = open(file, O_RDONLY)) < 0)
return (0);
if (zpool_in_use(g_zfs, fd, &state, &name, &inuse) == 0 && inuse) {
const char *desc;
switch (state) {
case POOL_STATE_ACTIVE:
desc = gettext("active");
break;
case POOL_STATE_EXPORTED:
desc = gettext("exported");
break;
case POOL_STATE_POTENTIALLY_ACTIVE:
desc = gettext("potentially active");
break;
default:
desc = gettext("unknown");
break;
}
/*
* Allow hot spares to be shared between pools.
*/
if (state == POOL_STATE_SPARE && isspare)
return (0);
if (state == POOL_STATE_ACTIVE ||
state == POOL_STATE_SPARE || !force) {
switch (state) {
case POOL_STATE_SPARE:
vdev_error(gettext("%s is reserved as a hot "
"spare for pool %s\n"), file, name);
break;
default:
vdev_error(gettext("%s is part of %s pool "
"'%s'\n"), file, desc, name);
break;
}
ret = -1;
}
free(name);
}
(void) close(fd);
return (ret);
}
static int
check_provider(const char *name, boolean_t force, boolean_t isspare)
{
struct gmesh mesh;
struct gclass *mp;
struct ggeom *gp;
struct gprovider *pp;
int rv;
char path[MAXPATHLEN];
/* XXX: What to do with isspare? */
if (strncmp(name, _PATH_DEV, sizeof(_PATH_DEV) - 1) != 0)
snprintf(path, sizeof(path), "%s%s", _PATH_DEV, name);
else
strlcpy(path, name, sizeof(path));
if (strncmp(name, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0)
name += sizeof(_PATH_DEV) - 1;
rv = geom_gettree(&mesh);
assert(rv == 0);
pp = NULL;
LIST_FOREACH(mp, &mesh.lg_class, lg_class) {
LIST_FOREACH(gp, &mp->lg_geom, lg_geom) {
LIST_FOREACH(pp, &gp->lg_provider, lg_provider) {
if (strcmp(pp->lg_name, name) == 0)
goto out;
}
}
}
out:
rv = -1;
if (pp == NULL)
vdev_error("no such provider %s\n", name);
else {
int acr, acw, ace;
VERIFY(sscanf(pp->lg_mode, "r%dw%de%d", &acr, &acw, &ace) == 3);
if (acw == 0 && ace == 0)
rv = 0;
else
vdev_error("%s is in use (%s)\n", name, pp->lg_mode);
}
geom_deletetree(&mesh);
return (rv);
return (check_file(path, force, isspare));
}
/*
* By "whole disk" we mean an entire physical disk (something we can
* label, toggle the write cache on, etc.) as opposed to the full
* capacity of a pseudo-device such as lofi or did. We act as if we
* are labeling the disk, which should be a pretty good test of whether
* it's a viable device or not. Returns B_TRUE if it is and B_FALSE if
* it isn't.
*/
static boolean_t
is_provider(const char *name)
is_whole_disk(const char *name)
{
int fd;
@@ -167,8 +216,8 @@ is_provider(const char *name)
return (B_TRUE);
}
return (B_FALSE);
}
/*
* Create a leaf vdev. Determine if this is a GEOM provider.
* Valid forms for a leaf vdev are:
@@ -176,8 +225,8 @@ is_provider(const char *name)
* /dev/xxx Complete path to a GEOM provider
* xxx Shorthand for /dev/xxx
*/
nvlist_t *
make_leaf_vdev(const char *arg)
static nvlist_t *
make_leaf_vdev(const char *arg, uint64_t is_log)
{
char ident[DISK_IDENT_SIZE], path[MAXPATHLEN];
struct stat64 statbuf;
@@ -185,16 +234,72 @@ make_leaf_vdev(const char *arg)
char *type = NULL;
boolean_t wholedisk = B_FALSE;
if (strncmp(arg, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0)
strlcpy(path, arg, sizeof (path));
else
snprintf(path, sizeof (path), "%s%s", _PATH_DEV, arg);
/*
* Determine what type of vdev this is, and put the full path into
* 'path'. We detect whether this is a device of file afterwards by
* checking the st_mode of the file.
*/
if (arg[0] == '/') {
/*
* Complete device or file path. Exact type is determined by
* examining the file descriptor afterwards.
*/
wholedisk = is_whole_disk(arg);
if (!wholedisk && (stat64(arg, &statbuf) != 0)) {
(void) fprintf(stderr,
gettext("cannot open '%s': %s\n"),
arg, strerror(errno));
return (NULL);
}
if (is_provider(path))
(void) strlcpy(path, arg, sizeof (path));
} else {
/*
* This may be a short path for a device, or it could be total
* gibberish. Check to see if it's a known device in
* /dev/dsk/. As part of this check, see if we've been given a
* an entire disk (minus the slice number).
*/
if (strncmp(arg, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0)
strlcpy(path, arg, sizeof (path));
else
snprintf(path, sizeof (path), "%s%s", _PATH_DEV, arg);
wholedisk = is_whole_disk(path);
if (!wholedisk && (stat64(path, &statbuf) != 0)) {
/*
* If we got ENOENT, then the user gave us
* gibberish, so try to direct them with a
* reasonable error message. Otherwise,
* regurgitate strerror() since it's the best we
* can do.
*/
if (errno == ENOENT) {
(void) fprintf(stderr,
gettext("cannot open '%s': no such "
"GEOM provider\n"), arg);
(void) fprintf(stderr,
gettext("must be a full path or "
"shorthand device name\n"));
return (NULL);
} else {
(void) fprintf(stderr,
gettext("cannot open '%s': %s\n"),
path, strerror(errno));
return (NULL);
}
}
}
/*
* Determine whether this is a device or a file.
*/
if (wholedisk) {
type = VDEV_TYPE_DISK;
else {
} else if (S_ISREG(statbuf.st_mode)) {
type = VDEV_TYPE_FILE;
} else {
(void) fprintf(stderr, gettext("cannot use '%s': must be a "
"GEOM provider\n"), path);
"GEOM provider or regular file\n"), path);
return (NULL);
}
@@ -206,6 +311,7 @@ make_leaf_vdev(const char *arg)
verify(nvlist_alloc(&vdev, NV_UNIQUE_NAME, 0) == 0);
verify(nvlist_add_string(vdev, ZPOOL_CONFIG_PATH, path) == 0);
verify(nvlist_add_string(vdev, ZPOOL_CONFIG_TYPE, type) == 0);
verify(nvlist_add_uint64(vdev, ZPOOL_CONFIG_IS_LOG, is_log) == 0);
if (strcmp(type, VDEV_TYPE_DISK) == 0)
verify(nvlist_add_uint64(vdev, ZPOOL_CONFIG_WHOLE_DISK,
(uint64_t)B_FALSE) == 0);
@@ -267,12 +373,14 @@ typedef struct replication_level {
uint64_t zprl_parity;
} replication_level_t;
#define ZPOOL_FUZZ (16 * 1024 * 1024)
/*
* Given a list of toplevel vdevs, return the current replication level. If
* the config is inconsistent, then NULL is returned. If 'fatal' is set, then
* an error message will be displayed for each self-inconsistent vdev.
*/
replication_level_t *
static replication_level_t *
get_replication(nvlist_t *nvroot, boolean_t fatal)
{
nvlist_t **top;
@@ -291,10 +399,20 @@ get_replication(nvlist_t *nvroot, boolean_t fatal)
lastrep.zprl_type = NULL;
for (t = 0; t < toplevels; t++) {
uint64_t is_log = B_FALSE;
nv = top[t];
verify(nvlist_lookup_string(nv, ZPOOL_CONFIG_TYPE, &type) == 0);
/*
* For separate logs we ignore the top level vdev replication
* constraints.
*/
(void) nvlist_lookup_uint64(nv, ZPOOL_CONFIG_IS_LOG, &is_log);
if (is_log)
continue;
verify(nvlist_lookup_string(nv, ZPOOL_CONFIG_TYPE,
&type) == 0);
if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN,
&child, &children) != 0) {
/*
@@ -328,7 +446,7 @@ get_replication(nvlist_t *nvroot, boolean_t fatal)
}
/*
* The 'dontreport' variable indicatest that we've
* The 'dontreport' variable indicates that we've
* already reported an error for this spec, so don't
* bother doing it again.
*/
@@ -349,7 +467,7 @@ get_replication(nvlist_t *nvroot, boolean_t fatal)
ZPOOL_CONFIG_TYPE, &childtype) == 0);
/*
* If this is a a replacing or spare vdev, then
* If this is a replacing or spare vdev, then
* get the real first child of the vdev.
*/
if (strcmp(childtype,
@@ -409,22 +527,30 @@ get_replication(nvlist_t *nvroot, boolean_t fatal)
*/
if ((fd = open(path, O_RDONLY)) >= 0) {
err = fstat64(fd, &statbuf);
if (err == 0 &&
S_ISCHR(statbuf.st_mode)) {
err = ioctl(fd, DIOCGMEDIASIZE,
&statbuf.st_size);
}
(void) close(fd);
} else {
err = stat64(path, &statbuf);
}
if (err != 0 || statbuf.st_size == 0)
continue;
size = statbuf.st_size;
/*
* Also check the size of each device. If they
* differ, then report an error.
* Also make sure that devices and
* slices have a consistent size. If
* they differ by a significant amount
* (~16MB) then report an error.
*/
if (!dontreport && vdev_size != -1ULL &&
size != vdev_size) {
if (!dontreport &&
(vdev_size != -1ULL &&
(labs(size - vdev_size) >
ZPOOL_FUZZ))) {
if (ret != NULL)
free(ret);
ret = NULL;
@@ -506,9 +632,11 @@ get_replication(nvlist_t *nvroot, boolean_t fatal)
* has a consistent replication level, then we ignore any errors. Otherwise,
* report any difference between the two.
*/
int
static int
check_replication(nvlist_t *config, nvlist_t *newroot)
{
nvlist_t **child;
uint_t children;
replication_level_t *current = NULL, *new;
int ret;
@@ -524,6 +652,23 @@ check_replication(nvlist_t *config, nvlist_t *newroot)
if ((current = get_replication(nvroot, B_FALSE)) == NULL)
return (0);
}
/*
* for spares there may be no children, and therefore no
* replication level to check
*/
if ((nvlist_lookup_nvlist_array(newroot, ZPOOL_CONFIG_CHILDREN,
&child, &children) != 0) || (children == 0)) {
free(current);
return (0);
}
/*
* If all we have is logs then there's no replication level to check.
*/
if (num_logs(newroot) == children) {
free(current);
return (0);
}
/*
* Get the replication level of the new vdev spec, reporting any
@@ -621,7 +766,7 @@ is_spare(nvlist_t *config, const char *path)
* Go through and find any devices that are in use. We rely on libdiskmgt for
* the majority of this task.
*/
int
static int
check_in_use(nvlist_t *config, nvlist_t *nv, int force, int isreplacing,
int isspare)
{
@@ -653,6 +798,9 @@ check_in_use(nvlist_t *config, nvlist_t *nv, int force, int isreplacing,
if (strcmp(type, VDEV_TYPE_DISK) == 0)
ret = check_provider(path, force, isspare);
if (strcmp(type, VDEV_TYPE_FILE) == 0)
ret = check_file(path, force, isspare);
return (ret);
}
@@ -668,10 +816,17 @@ check_in_use(nvlist_t *config, nvlist_t *nv, int force, int isreplacing,
isreplacing, B_TRUE)) != 0)
return (ret);
if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_L2CACHE,
&child, &children) == 0)
for (c = 0; c < children; c++)
if ((ret = check_in_use(config, child[c], force,
isreplacing, B_FALSE)) != 0)
return (ret);
return (0);
}
const char *
static const char *
is_grouping(const char *type, int *mindev)
{
if (strcmp(type, "raidz") == 0 || strcmp(type, "raidz1") == 0) {
@@ -698,6 +853,18 @@ is_grouping(const char *type, int *mindev)
return (VDEV_TYPE_SPARE);
}
if (strcmp(type, "log") == 0) {
if (mindev != NULL)
*mindev = 1;
return (VDEV_TYPE_LOG);
}
if (strcmp(type, "cache") == 0) {
if (mindev != NULL)
*mindev = 1;
return (VDEV_TYPE_L2CACHE);
}
return (NULL);
}
@@ -710,14 +877,21 @@ is_grouping(const char *type, int *mindev)
nvlist_t *
construct_spec(int argc, char **argv)
{
nvlist_t *nvroot, *nv, **top, **spares;
int t, toplevels, mindev, nspares;
nvlist_t *nvroot, *nv, **top, **spares, **l2cache;
int t, toplevels, mindev, nspares, nlogs, nl2cache;
const char *type;
uint64_t is_log;
boolean_t seen_logs;
top = NULL;
toplevels = 0;
spares = NULL;
l2cache = NULL;
nspares = 0;
nlogs = 0;
nl2cache = 0;
is_log = B_FALSE;
seen_logs = B_FALSE;
while (argc > 0) {
nv = NULL;
@@ -730,12 +904,56 @@ construct_spec(int argc, char **argv)
nvlist_t **child = NULL;
int c, children = 0;
if (strcmp(type, VDEV_TYPE_SPARE) == 0 &&
spares != NULL) {
(void) fprintf(stderr, gettext("invalid vdev "
"specification: 'spare' can be "
"specified only once\n"));
return (NULL);
if (strcmp(type, VDEV_TYPE_SPARE) == 0) {
if (spares != NULL) {
(void) fprintf(stderr,
gettext("invalid vdev "
"specification: 'spare' can be "
"specified only once\n"));
return (NULL);
}
is_log = B_FALSE;
}
if (strcmp(type, VDEV_TYPE_LOG) == 0) {
if (seen_logs) {
(void) fprintf(stderr,
gettext("invalid vdev "
"specification: 'log' can be "
"specified only once\n"));
return (NULL);
}
seen_logs = B_TRUE;
is_log = B_TRUE;
argc--;
argv++;
/*
* A log is not a real grouping device.
* We just set is_log and continue.
*/
continue;
}
if (strcmp(type, VDEV_TYPE_L2CACHE) == 0) {
if (l2cache != NULL) {
(void) fprintf(stderr,
gettext("invalid vdev "
"specification: 'cache' can be "
"specified only once\n"));
return (NULL);
}
is_log = B_FALSE;
}
if (is_log) {
if (strcmp(type, VDEV_TYPE_MIRROR) != 0) {
(void) fprintf(stderr,
gettext("invalid vdev "
"specification: unsupported 'log' "
"device: %s\n"), type);
return (NULL);
}
nlogs++;
}
for (c = 1; c < argc; c++) {
@@ -746,7 +964,8 @@ construct_spec(int argc, char **argv)
children * sizeof (nvlist_t *));
if (child == NULL)
zpool_no_memory();
if ((nv = make_leaf_vdev(argv[c])) == NULL)
if ((nv = make_leaf_vdev(argv[c], B_FALSE))
== NULL)
return (NULL);
child[children - 1] = nv;
}
@@ -765,11 +984,17 @@ construct_spec(int argc, char **argv)
spares = child;
nspares = children;
continue;
} else if (strcmp(type, VDEV_TYPE_L2CACHE) == 0) {
l2cache = child;
nl2cache = children;
continue;
} else {
verify(nvlist_alloc(&nv, NV_UNIQUE_NAME,
0) == 0);
verify(nvlist_add_string(nv, ZPOOL_CONFIG_TYPE,
type) == 0);
verify(nvlist_add_uint64(nv,
ZPOOL_CONFIG_IS_LOG, is_log) == 0);
if (strcmp(type, VDEV_TYPE_RAIDZ) == 0) {
verify(nvlist_add_uint64(nv,
ZPOOL_CONFIG_NPARITY,
@@ -788,8 +1013,10 @@ construct_spec(int argc, char **argv)
* We have a device. Pass off to make_leaf_vdev() to
* construct the appropriate nvlist describing the vdev.
*/
if ((nv = make_leaf_vdev(argv[0])) == NULL)
if ((nv = make_leaf_vdev(argv[0], is_log)) == NULL)
return (NULL);
if (is_log)
nlogs++;
argc--;
argv++;
}
@@ -801,13 +1028,19 @@ construct_spec(int argc, char **argv)
top[toplevels - 1] = nv;
}
if (toplevels == 0 && nspares == 0) {
if (toplevels == 0 && nspares == 0 && nl2cache == 0) {
(void) fprintf(stderr, gettext("invalid vdev "
"specification: at least one toplevel vdev must be "
"specified\n"));
return (NULL);
}
if (seen_logs && nlogs == 0) {
(void) fprintf(stderr, gettext("invalid vdev specification: "
"log requires at least 1 device\n"));
return (NULL);
}
/*
* Finally, create nvroot and add all top-level vdevs to it.
*/
@@ -819,18 +1052,26 @@ construct_spec(int argc, char **argv)
if (nspares != 0)
verify(nvlist_add_nvlist_array(nvroot, ZPOOL_CONFIG_SPARES,
spares, nspares) == 0);
if (nl2cache != 0)
verify(nvlist_add_nvlist_array(nvroot, ZPOOL_CONFIG_L2CACHE,
l2cache, nl2cache) == 0);
for (t = 0; t < toplevels; t++)
nvlist_free(top[t]);
for (t = 0; t < nspares; t++)
nvlist_free(spares[t]);
for (t = 0; t < nl2cache; t++)
nvlist_free(l2cache[t]);
if (spares)
free(spares);
if (l2cache)
free(l2cache);
free(top);
return (nvroot);
}
/*
* Get and validate the contents of the given vdev specification. This ensures
* that the nvlist returned is well-formed, that all the devices exist, and that
@@ -842,11 +1083,11 @@ construct_spec(int argc, char **argv)
* added, even if they appear in use.
*/
nvlist_t *
make_root_vdev(nvlist_t *poolconfig, int force, int check_rep,
boolean_t isreplacing, int argc, char **argv)
make_root_vdev(zpool_handle_t *zhp, int force, int check_rep,
boolean_t isreplacing, boolean_t dryrun, int argc, char **argv)
{
nvlist_t *newroot;
nvlist_t *poolconfig = NULL;
is_force = force;
/*
@@ -857,6 +1098,9 @@ make_root_vdev(nvlist_t *poolconfig, int force, int check_rep,
if ((newroot = construct_spec(argc, argv)) == NULL)
return (NULL);
if (zhp && ((poolconfig = zpool_get_config(zhp, NULL)) == NULL))
return (NULL);
/*
* Validate each device to make sure that its not shared with another
* subsystem. We do this even if 'force' is set, because there are some
File diff suppressed because it is too large. Load diff
+2 -3
View File
@@ -39,7 +39,7 @@ extern "C" {
#if defined(__STDC__)
#if __STDC_VERSION__ - 0 >= 199901L
extern void __assert_c99(const char *, const char *, int, const char *);
extern void __assert(const char *, const char *, int);
#else
extern void __assert(const char *, const char *, int);
#endif /* __STDC_VERSION__ - 0 >= 199901L */
@@ -70,8 +70,7 @@ extern void _assert();
#if defined(__STDC__)
#if __STDC_VERSION__ - 0 >= 199901L
#define assert(EX) (void)((EX) || \
(__assert_c99(#EX, __FILE__, __LINE__, __func__), 0))
#define assert(EX) (void)((EX) || (__assert(#EX, __FILE__, __LINE__), 0))
#else
#define assert(EX) (void)((EX) || (__assert(#EX, __FILE__, __LINE__), 0))
#endif /* __STDC_VERSION__ - 0 >= 199901L */
+6 -5
View File
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -20,11 +19,10 @@
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Libintl is a library of advanced internationalization functions. */
#ifndef _LIBINTL_H
#define _LIBINTL_H
@@ -63,6 +61,9 @@ typedef long wchar_t;
#define TEXTDOMAINMAX 256
#define __GNU_GETTEXT_SUPPORTED_REVISION(m) \
((((m) == 0) || ((m) == 1)) ? 1 : -1)
#ifdef __STDC__
extern char *dcgettext(const char *, const char *, const int);
extern char *dgettext(const char *, const char *);
+10 -8
View File
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -19,8 +18,9 @@
*
* CDDL HEADER END
*/
/*
* Copyright 2003 Sun Microsystems, Inc. All rights reserved.
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -81,12 +81,12 @@ typedef lwp_cond_t cond_t;
* Because we have to deal with C++, we cannot redefine this one as that one.
*/
typedef struct _rwlock {
int32_t readers; /* -1 == writer else # of readers */
int32_t readers; /* rwstate word */
uint16_t type;
uint16_t magic;
mutex_t mutex; /* used to indicate ownership */
cond_t readercv; /* unused */
cond_t writercv; /* unused */
mutex_t mutex; /* used with process-shared rwlocks */
cond_t readercv; /* used only to indicate ownership */
cond_t writercv; /* used only to indicate ownership */
} rwlock_t;
#ifdef __STDC__
@@ -111,6 +111,7 @@ int cond_signal(cond_t *);
int cond_broadcast(cond_t *);
int mutex_init(mutex_t *, int, void *);
int mutex_destroy(mutex_t *);
int mutex_consistent(mutex_t *);
int mutex_lock(mutex_t *);
int mutex_trylock(mutex_t *);
int mutex_unlock(mutex_t *);
@@ -152,6 +153,7 @@ int cond_signal();
int cond_broadcast();
int mutex_init();
int mutex_destroy();
int mutex_consistent();
int mutex_lock();
int mutex_trylock();
int mutex_unlock();
+2
View File
@@ -30,6 +30,7 @@
#pragma ident "%Z%%M% %I% %E% SMI"
#include <pthread.h>
#include <pthread_np.h>
#include <assert.h>
/*
@@ -52,6 +53,7 @@ typedef pthread_rwlock_t rwlock_t;
#define mutex_lock(l) pthread_mutex_lock(l)
#define mutex_trylock(l) pthread_mutex_trylock(l)
#define mutex_unlock(l) pthread_mutex_unlock(l)
#define mutex_owned(l) pthread_mutex_isowned_np(l)
#define rwlock_init(l,f,a) pthread_rwlock_init(l,NULL)
#define rwlock_destroy(l) pthread_rwlock_destroy(l)
#define rw_rdlock(l) pthread_rwlock_rdlock(l)
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -20,12 +19,13 @@
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <inttypes.h>
#include <unistd.h>
#include <strings.h>
#include "libnvpair.h"
@@ -137,6 +137,12 @@ nvlist_print_with_indent(FILE *fp, nvlist_t *nvl, int depth)
(void) fprintf(fp, " 0x%llx", (u_longlong_t)val);
break;
}
case DATA_TYPE_DOUBLE: {
double val;
(void) nvpair_value_double(nvp, &val);
(void) fprintf(fp, " 0x%llf", val);
break;
}
case DATA_TYPE_STRING: {
char *val;
(void) nvpair_value_string(nvp, &val);
@@ -264,3 +270,348 @@ nvlist_print(FILE *fp, nvlist_t *nvl)
{
nvlist_print_with_indent(fp, nvl, 0);
}
/*
* Determine if string 'value' matches 'nvp' value. The 'value' string is
* converted, depending on the type of 'nvp', prior to match. For numeric
* types, a radix independent sscanf conversion of 'value' is used. If 'nvp'
* is an array type, 'ai' is the index into the array against which we are
* checking for match. If nvp is of DATA_TYPE_STRING*, the caller can pass
* in a regex_t compilation of value in 'value_regex' to trigger regular
* expression string match instead of simple strcmp().
*
* Return 1 on match, 0 on no-match, and -1 on error. If the error is
* related to value syntax error and 'ep' is non-NULL, *ep will point into
* the 'value' string at the location where the error exists.
*
* NOTE: It may be possible to move the non-regex_t version of this into
* common code used by library/kernel/boot.
*/
int
nvpair_value_match_regex(nvpair_t *nvp, int ai,
char *value, regex_t *value_regex, char **ep)
{
char *evalue;
uint_t a_len;
int sr;
if (ep)
*ep = NULL;
if ((nvp == NULL) || (value == NULL))
return (-1); /* error fail match - invalid args */
/* make sure array and index combination make sense */
if ((nvpair_type_is_array(nvp) && (ai < 0)) ||
(!nvpair_type_is_array(nvp) && (ai >= 0)))
return (-1); /* error fail match - bad index */
/* non-string values should be single 'chunk' */
if ((nvpair_type(nvp) != DATA_TYPE_STRING) &&
(nvpair_type(nvp) != DATA_TYPE_STRING_ARRAY)) {
value += strspn(value, " \t");
evalue = value + strcspn(value, " \t");
if (*evalue) {
if (ep)
*ep = evalue;
return (-1); /* error fail match - syntax */
}
}
sr = EOF;
switch (nvpair_type(nvp)) {
case DATA_TYPE_STRING: {
char *val;
/* check string value for match */
if (nvpair_value_string(nvp, &val) == 0) {
if (value_regex) {
if (regexec(value_regex, val,
(size_t)0, NULL, 0) == 0)
return (1); /* match */
} else {
if (strcmp(value, val) == 0)
return (1); /* match */
}
}
break;
}
case DATA_TYPE_STRING_ARRAY: {
char **val_array;
/* check indexed string value of array for match */
if ((nvpair_value_string_array(nvp, &val_array, &a_len) == 0) &&
(ai < a_len)) {
if (value_regex) {
if (regexec(value_regex, val_array[ai],
(size_t)0, NULL, 0) == 0)
return (1);
} else {
if (strcmp(value, val_array[ai]) == 0)
return (1);
}
}
break;
}
case DATA_TYPE_BYTE: {
uchar_t val, val_arg;
/* scanf uchar_t from value and check for match */
sr = sscanf(value, "%c", &val_arg);
if ((sr == 1) && (nvpair_value_byte(nvp, &val) == 0) &&
(val == val_arg))
return (1);
break;
}
case DATA_TYPE_BYTE_ARRAY: {
uchar_t *val_array, val_arg;
/* check indexed value of array for match */
sr = sscanf(value, "%c", &val_arg);
if ((sr == 1) &&
(nvpair_value_byte_array(nvp, &val_array, &a_len) == 0) &&
(ai < a_len) &&
(val_array[ai] == val_arg))
return (1);
break;
}
case DATA_TYPE_INT8: {
int8_t val, val_arg;
/* scanf int8_t from value and check for match */
sr = sscanf(value, "%"SCNi8, &val_arg);
if ((sr == 1) &&
(nvpair_value_int8(nvp, &val) == 0) &&
(val == val_arg))
return (1);
break;
}
case DATA_TYPE_INT8_ARRAY: {
int8_t *val_array, val_arg;
/* check indexed value of array for match */
sr = sscanf(value, "%"SCNi8, &val_arg);
if ((sr == 1) &&
(nvpair_value_int8_array(nvp, &val_array, &a_len) == 0) &&
(ai < a_len) &&
(val_array[ai] == val_arg))
return (1);
break;
}
case DATA_TYPE_UINT8: {
uint8_t val, val_arg;
/* scanf uint8_t from value and check for match */
sr = sscanf(value, "%"SCNi8, (int8_t *)&val_arg);
if ((sr == 1) &&
(nvpair_value_uint8(nvp, &val) == 0) &&
(val == val_arg))
return (1);
break;
}
case DATA_TYPE_UINT8_ARRAY: {
uint8_t *val_array, val_arg;
/* check indexed value of array for match */
sr = sscanf(value, "%"SCNi8, (int8_t *)&val_arg);
if ((sr == 1) &&
(nvpair_value_uint8_array(nvp, &val_array, &a_len) == 0) &&
(ai < a_len) &&
(val_array[ai] == val_arg))
return (1);
break;
}
case DATA_TYPE_INT16: {
int16_t val, val_arg;
/* scanf int16_t from value and check for match */
sr = sscanf(value, "%"SCNi16, &val_arg);
if ((sr == 1) &&
(nvpair_value_int16(nvp, &val) == 0) &&
(val == val_arg))
return (1);
break;
}
case DATA_TYPE_INT16_ARRAY: {
int16_t *val_array, val_arg;
/* check indexed value of array for match */
sr = sscanf(value, "%"SCNi16, &val_arg);
if ((sr == 1) &&
(nvpair_value_int16_array(nvp, &val_array, &a_len) == 0) &&
(ai < a_len) &&
(val_array[ai] == val_arg))
return (1);
break;
}
case DATA_TYPE_UINT16: {
uint16_t val, val_arg;
/* scanf uint16_t from value and check for match */
sr = sscanf(value, "%"SCNi16, (int16_t *)&val_arg);
if ((sr == 1) &&
(nvpair_value_uint16(nvp, &val) == 0) &&
(val == val_arg))
return (1);
break;
}
case DATA_TYPE_UINT16_ARRAY: {
uint16_t *val_array, val_arg;
/* check indexed value of array for match */
sr = sscanf(value, "%"SCNi16, (int16_t *)&val_arg);
if ((sr == 1) &&
(nvpair_value_uint16_array(nvp, &val_array, &a_len) == 0) &&
(ai < a_len) &&
(val_array[ai] == val_arg))
return (1);
break;
}
case DATA_TYPE_INT32: {
int32_t val, val_arg;
/* scanf int32_t from value and check for match */
sr = sscanf(value, "%"SCNi32, &val_arg);
if ((sr == 1) &&
(nvpair_value_int32(nvp, &val) == 0) &&
(val == val_arg))
return (1);
break;
}
case DATA_TYPE_INT32_ARRAY: {
int32_t *val_array, val_arg;
/* check indexed value of array for match */
sr = sscanf(value, "%"SCNi32, &val_arg);
if ((sr == 1) &&
(nvpair_value_int32_array(nvp, &val_array, &a_len) == 0) &&
(ai < a_len) &&
(val_array[ai] == val_arg))
return (1);
break;
}
case DATA_TYPE_UINT32: {
uint32_t val, val_arg;
/* scanf uint32_t from value and check for match */
sr = sscanf(value, "%"SCNi32, (int32_t *)&val_arg);
if ((sr == 1) &&
(nvpair_value_uint32(nvp, &val) == 0) &&
(val == val_arg))
return (1);
break;
}
case DATA_TYPE_UINT32_ARRAY: {
uint32_t *val_array, val_arg;
/* check indexed value of array for match */
sr = sscanf(value, "%"SCNi32, (int32_t *)&val_arg);
if ((sr == 1) &&
(nvpair_value_uint32_array(nvp, &val_array, &a_len) == 0) &&
(ai < a_len) &&
(val_array[ai] == val_arg))
return (1);
break;
}
case DATA_TYPE_INT64: {
int64_t val, val_arg;
/* scanf int64_t from value and check for match */
sr = sscanf(value, "%"SCNi64, &val_arg);
if ((sr == 1) &&
(nvpair_value_int64(nvp, &val) == 0) &&
(val == val_arg))
return (1);
break;
}
case DATA_TYPE_INT64_ARRAY: {
int64_t *val_array, val_arg;
/* check indexed value of array for match */
sr = sscanf(value, "%"SCNi64, &val_arg);
if ((sr == 1) &&
(nvpair_value_int64_array(nvp, &val_array, &a_len) == 0) &&
(ai < a_len) &&
(val_array[ai] == val_arg))
return (1);
break;
}
case DATA_TYPE_UINT64: {
uint64_t val_arg, val;
/* scanf uint64_t from value and check for match */
sr = sscanf(value, "%"SCNi64, (int64_t *)&val_arg);
if ((sr == 1) &&
(nvpair_value_uint64(nvp, &val) == 0) &&
(val == val_arg))
return (1);
break;
}
case DATA_TYPE_UINT64_ARRAY: {
uint64_t *val_array, val_arg;
/* check indexed value of array for match */
sr = sscanf(value, "%"SCNi64, (int64_t *)&val_arg);
if ((sr == 1) &&
(nvpair_value_uint64_array(nvp, &val_array, &a_len) == 0) &&
(ai < a_len) &&
(val_array[ai] == val_arg))
return (1);
break;
}
case DATA_TYPE_BOOLEAN_VALUE: {
boolean_t val, val_arg;
/* scanf boolean_t from value and check for match */
sr = sscanf(value, "%"SCNi32, &val_arg);
if ((sr == 1) &&
(nvpair_value_boolean_value(nvp, &val) == 0) &&
(val == val_arg))
return (1);
break;
}
case DATA_TYPE_BOOLEAN_ARRAY: {
boolean_t *val_array, val_arg;
/* check indexed value of array for match */
sr = sscanf(value, "%"SCNi32, &val_arg);
if ((sr == 1) &&
(nvpair_value_boolean_array(nvp,
&val_array, &a_len) == 0) &&
(ai < a_len) &&
(val_array[ai] == val_arg))
return (1);
break;
}
case DATA_TYPE_HRTIME:
case DATA_TYPE_NVLIST:
case DATA_TYPE_NVLIST_ARRAY:
case DATA_TYPE_BOOLEAN:
case DATA_TYPE_DOUBLE:
case DATA_TYPE_UNKNOWN:
default:
/*
* unknown/unsupported data type
*/
return (-1); /* error fail match */
}
/*
* check to see if sscanf failed conversion, return approximate
* pointer to problem
*/
if (sr != 1) {
if (ep)
*ep = value;
return (-1); /* error fail match - syntax */
}
return (0); /* fail match */
}
int
nvpair_value_match(nvpair_t *nvp, int ai, char *value, char **ep)
{
return (nvpair_value_match_regex(nvp, ai, value, NULL, ep));
}
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -32,12 +31,15 @@
#include <sys/nvpair.h>
#include <stdlib.h>
#include <stdio.h>
#include <regex.h>
#ifdef __cplusplus
extern "C" {
#endif
void nvlist_print(FILE *, nvlist_t *);
int nvpair_value_match(nvpair_t *, int, char *, char **);
int nvpair_value_match_regex(nvpair_t *, int, char *, regex_t *, char **);
#ifdef __cplusplus
}
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -20,15 +19,13 @@
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _LIBUUTIL_H
#define _LIBUUTIL_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <solaris.h>
#include <sys/types.h>
#include <stdarg.h>
@@ -149,6 +146,7 @@ extern int uu_open_tmp(const char *dir, uint_t uflags);
/*PRINTFLIKE1*/
extern char *uu_msprintf(const char *format, ...);
extern void *uu_zalloc(size_t);
extern char *uu_strdup(const char *);
extern void uu_free(void *);
/*
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -21,7 +20,7 @@
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -30,16 +29,6 @@
#pragma ident "%Z%%M% %I% %E% SMI"
#include <solaris.h>
/*
* We don't bind to the internal libc interfaces if this is a
* native build.
*/
#ifndef NATIVE_BUILD
#include "c_synonyms.h"
#endif
#include <libuutil.h>
#include <libuutil_impl.h>
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -20,12 +19,10 @@
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include "libuutil_common.h"
#include <stdarg.h>
@@ -54,6 +51,22 @@ uu_free(void *p)
free(p);
}
char *
uu_strdup(const char *str)
{
char *buf = NULL;
if (str != NULL) {
size_t sz;
sz = strlen(str) + 1;
buf = uu_zalloc(sz);
if (buf != NULL)
(void) memcpy(buf, str, sz);
}
return (buf);
}
char *
uu_msprintf(const char *format, ...)
{
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -120,7 +120,8 @@ uu_avl_pool_destroy(uu_avl_pool_t *pp)
UU_PTR_ENCODE(&pp->uap_null_avl)) {
uu_panic("uu_avl_pool_destroy: Pool \"%.*s\" (%p) has "
"outstanding avls, or is corrupt.\n",
sizeof (pp->uap_name), pp->uap_name, pp);
(int)sizeof (pp->uap_name), pp->uap_name,
(void *)pp);
}
}
(void) pthread_mutex_lock(&uu_apool_list_lock);
@@ -142,14 +143,14 @@ uu_avl_node_init(void *base, uu_avl_node_t *np, uu_avl_pool_t *pp)
if (offset + sizeof (*np) > pp->uap_objsize) {
uu_panic("uu_avl_node_init(%p, %p, %p (\"%s\")): "
"offset %ld doesn't fit in object (size %ld)\n",
base, np, pp, pp->uap_name, offset,
pp->uap_objsize);
base, (void *)np, (void *)pp, pp->uap_name,
(long)offset, (long)pp->uap_objsize);
}
if (offset != pp->uap_nodeoffset) {
uu_panic("uu_avl_node_init(%p, %p, %p (\"%s\")): "
"offset %ld doesn't match pool's offset (%ld)\n",
base, np, pp, pp->uap_name, offset,
pp->uap_objsize);
base, (void *)np, (void *)pp, pp->uap_name,
(long)offset, (long)pp->uap_objsize);
}
}
@@ -166,12 +167,12 @@ uu_avl_node_fini(void *base, uu_avl_node_t *np, uu_avl_pool_t *pp)
if (na[0] == DEAD_MARKER && na[1] == DEAD_MARKER) {
uu_panic("uu_avl_node_fini(%p, %p, %p (\"%s\")): "
"node already finied\n",
base, np, pp, pp->uap_name);
base, (void *)np, (void *)pp, pp->uap_name);
}
if (na[0] != POOL_TO_MARKER(pp) || na[1] != 0) {
uu_panic("uu_avl_node_fini(%p, %p, %p (\"%s\")): "
"node corrupt, in tree, or in different pool\n",
base, np, pp, pp->uap_name);
base, (void *)np, (void *)pp, pp->uap_name);
}
}
@@ -251,12 +252,13 @@ uu_avl_destroy(uu_avl_t *ap)
if (ap->ua_debug) {
if (avl_numnodes(&ap->ua_tree) != 0) {
uu_panic("uu_avl_destroy(%p): tree not empty\n", ap);
uu_panic("uu_avl_destroy(%p): tree not empty\n",
(void *)ap);
}
if (ap->ua_null_walk.uaw_next != &ap->ua_null_walk ||
ap->ua_null_walk.uaw_prev != &ap->ua_null_walk) {
uu_panic("uu_avl_destroy(%p): outstanding walkers\n",
ap);
(void *)ap);
}
}
(void) pthread_mutex_lock(&pp->uap_lock);
@@ -441,7 +443,7 @@ uu_avl_remove(uu_avl_t *ap, void *elem)
(void) _avl_walk_advance(wp, ap);
} else if (wp->uaw_next_result != NULL) {
uu_panic("uu_avl_remove(%p, %p): active non-robust "
"walker\n", ap, elem);
"walker\n", (void *)ap, elem);
}
}
@@ -497,19 +499,19 @@ uu_avl_insert(uu_avl_t *ap, void *elem, uu_avl_index_t idx)
if (na[1] != 0)
uu_panic("uu_avl_insert(%p, %p, %p): node already "
"in tree, or corrupt\n",
ap, elem, idx);
(void *)ap, elem, (void *)idx);
if (na[0] == 0)
uu_panic("uu_avl_insert(%p, %p, %p): node not "
"initialized\n",
ap, elem, idx);
(void *)ap, elem, (void *)idx);
if (na[0] != POOL_TO_MARKER(pp))
uu_panic("uu_avl_insert(%p, %p, %p): node from "
"other pool, or corrupt\n",
ap, elem, idx);
(void *)ap, elem, (void *)idx);
if (!INDEX_VALID(ap, idx))
uu_panic("uu_avl_insert(%p, %p, %p): %s\n",
ap, elem, idx,
(void *)ap, elem, (void *)idx,
INDEX_CHECK(idx)? "outdated index" :
"invalid index");
@@ -526,8 +528,8 @@ uu_avl_nearest_next(uu_avl_t *ap, uu_avl_index_t idx)
{
if (ap->ua_debug && !INDEX_VALID(ap, idx))
uu_panic("uu_avl_nearest_next(%p, %p): %s\n",
ap, idx, INDEX_CHECK(idx)? "outdated index" :
"invalid index");
(void *)ap, (void *)idx, INDEX_CHECK(idx)?
"outdated index" : "invalid index");
return (avl_nearest(&ap->ua_tree, INDEX_DECODE(idx), AVL_AFTER));
}
@@ -536,8 +538,8 @@ uu_avl_nearest_prev(uu_avl_t *ap, uu_avl_index_t idx)
{
if (ap->ua_debug && !INDEX_VALID(ap, idx))
uu_panic("uu_avl_nearest_prev(%p, %p): %s\n",
ap, idx, INDEX_CHECK(idx)? "outdated index" :
"invalid index");
(void *)ap, (void *)idx, INDEX_CHECK(idx)?
"outdated index" : "invalid index");
return (avl_nearest(&ap->ua_tree, INDEX_DECODE(idx), AVL_BEFORE));
}
@@ -33,7 +33,7 @@
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <string.h>
#define FACILITY_FMT "%s (%s): "
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -117,7 +116,8 @@ uu_list_pool_destroy(uu_list_pool_t *pp)
UU_PTR_ENCODE(&pp->ulp_null_list)) {
uu_panic("uu_list_pool_destroy: Pool \"%.*s\" (%p) has "
"outstanding lists, or is corrupt.\n",
sizeof (pp->ulp_name), pp->ulp_name, pp);
(int)sizeof (pp->ulp_name), pp->ulp_name,
(void *)pp);
}
}
(void) pthread_mutex_lock(&uu_lpool_list_lock);
@@ -139,14 +139,14 @@ uu_list_node_init(void *base, uu_list_node_t *np_arg, uu_list_pool_t *pp)
if (offset + sizeof (*np) > pp->ulp_objsize) {
uu_panic("uu_list_node_init(%p, %p, %p (\"%s\")): "
"offset %ld doesn't fit in object (size %ld)\n",
base, np, pp, pp->ulp_name, offset,
pp->ulp_objsize);
base, (void *)np, (void *)pp, pp->ulp_name,
(long)offset, (long)pp->ulp_objsize);
}
if (offset != pp->ulp_nodeoffset) {
uu_panic("uu_list_node_init(%p, %p, %p (\"%s\")): "
"offset %ld doesn't match pool's offset (%ld)\n",
base, np, pp, pp->ulp_name, offset,
pp->ulp_objsize);
base, (void *)np, (void *)pp, pp->ulp_name,
(long)offset, (long)pp->ulp_objsize);
}
}
np->uln_next = POOL_TO_MARKER(pp);
@@ -163,13 +163,13 @@ uu_list_node_fini(void *base, uu_list_node_t *np_arg, uu_list_pool_t *pp)
np->uln_prev == NULL) {
uu_panic("uu_list_node_fini(%p, %p, %p (\"%s\")): "
"node already finied\n",
base, np_arg, pp, pp->ulp_name);
base, (void *)np_arg, (void *)pp, pp->ulp_name);
}
if (np->uln_next != POOL_TO_MARKER(pp) ||
np->uln_prev != NULL) {
uu_panic("uu_list_node_fini(%p, %p, %p (\"%s\")): "
"node corrupt or on list\n",
base, np_arg, pp, pp->ulp_name);
base, (void *)np_arg, (void *)pp, pp->ulp_name);
}
}
np->uln_next = NULL;
@@ -190,7 +190,7 @@ uu_list_create(uu_list_pool_t *pp, void *parent, uint32_t flags)
if (pp->ulp_debug)
uu_panic("uu_list_create(%p, ...): requested "
"UU_LIST_SORTED, but pool has no comparison func\n",
pp);
(void *)pp);
uu_set_error(UU_ERROR_NOT_SUPPORTED);
return (NULL);
}
@@ -236,16 +236,16 @@ uu_list_destroy(uu_list_t *lp)
if (lp->ul_null_node.uln_next != &lp->ul_null_node ||
lp->ul_null_node.uln_prev != &lp->ul_null_node) {
uu_panic("uu_list_destroy(%p): list not empty\n",
lp);
(void *)lp);
}
if (lp->ul_numnodes != 0) {
uu_panic("uu_list_destroy(%p): numnodes is nonzero, "
"but list is empty\n", lp);
"but list is empty\n", (void *)lp);
}
if (lp->ul_null_walk.ulw_next != &lp->ul_null_walk ||
lp->ul_null_walk.ulw_prev != &lp->ul_null_walk) {
uu_panic("uu_list_destroy(%p): outstanding walkers\n",
lp);
(void *)lp);
}
}
@@ -266,13 +266,14 @@ list_insert(uu_list_t *lp, uu_list_node_impl_t *np, uu_list_node_impl_t *prev,
if (lp->ul_debug) {
if (next->uln_prev != prev || prev->uln_next != next)
uu_panic("insert(%p): internal error: %p and %p not "
"neighbors\n", lp, next, prev);
"neighbors\n", (void *)lp, (void *)next,
(void *)prev);
if (np->uln_next != POOL_TO_MARKER(lp->ul_pool) ||
np->uln_prev != NULL) {
uu_panic("insert(%p): elem %p node %p corrupt, "
"not initialized, or already in a list.\n",
lp, NODE_TO_ELEM(lp, np), np);
(void *)lp, NODE_TO_ELEM(lp, np), (void *)np);
}
/*
* invalidate outstanding uu_list_index_ts.
@@ -299,12 +300,12 @@ uu_list_insert(uu_list_t *lp, void *elem, uu_list_index_t idx)
if (lp->ul_debug) {
if (!INDEX_VALID(lp, idx))
uu_panic("uu_list_insert(%p, %p, %p): %s\n",
lp, elem, idx,
(void *)lp, elem, (void *)idx,
INDEX_CHECK(idx)? "outdated index" :
"invalid index");
if (np->uln_prev == NULL)
uu_panic("uu_list_insert(%p, %p, %p): out-of-date "
"index\n", lp, elem, idx);
"index\n", (void *)lp, elem, (void *)idx);
}
list_insert(lp, ELEM_TO_NODE(lp, elem), np->uln_prev, np);
@@ -354,11 +355,12 @@ uu_list_nearest_next(uu_list_t *lp, uu_list_index_t idx)
if (lp->ul_debug) {
if (!INDEX_VALID(lp, idx))
uu_panic("uu_list_nearest_next(%p, %p): %s\n",
lp, idx, INDEX_CHECK(idx)? "outdated index" :
(void *)lp, (void *)idx,
INDEX_CHECK(idx)? "outdated index" :
"invalid index");
if (np->uln_prev == NULL)
uu_panic("uu_list_nearest_next(%p, %p): out-of-date "
"index\n", lp, idx);
"index\n", (void *)lp, (void *)idx);
}
if (np == &lp->ul_null_node)
@@ -378,11 +380,11 @@ uu_list_nearest_prev(uu_list_t *lp, uu_list_index_t idx)
if (lp->ul_debug) {
if (!INDEX_VALID(lp, idx))
uu_panic("uu_list_nearest_prev(%p, %p): %s\n",
lp, idx, INDEX_CHECK(idx)? "outdated index" :
"invalid index");
(void *)lp, (void *)idx, INDEX_CHECK(idx)?
"outdated index" : "invalid index");
if (np->uln_prev == NULL)
uu_panic("uu_list_nearest_prev(%p, %p): out-of-date "
"index\n", lp, idx);
"index\n", (void *)lp, (void *)idx);
}
if ((np = np->uln_prev) == &lp->ul_null_node)
@@ -409,6 +411,11 @@ list_walk_init(uu_list_walk_t *wp, uu_list_t *lp, uint32_t flags)
wp->ulw_next_result = lp->ul_null_node.uln_prev;
if (lp->ul_debug || robust) {
/*
* Add this walker to the list's list of walkers so
* uu_list_remove() can advance us if somebody tries to
* remove ulw_next_result.
*/
wp->ulw_next = next = &lp->ul_null_walk;
wp->ulw_prev = prev = next->ulw_prev;
next->ulw_prev = wp;
@@ -538,7 +545,7 @@ uu_list_remove(uu_list_t *lp, void *elem)
if (lp->ul_debug) {
if (np->uln_prev == NULL)
uu_panic("uu_list_remove(%p, %p): elem not on list\n",
lp, elem);
(void *)lp, elem);
/*
* invalidate outstanding uu_list_index_ts.
*/
@@ -556,7 +563,7 @@ uu_list_remove(uu_list_t *lp, void *elem)
(void) list_walk_advance(wp, lp);
} else if (wp->ulw_next_result != NULL) {
uu_panic("uu_list_remove(%p, %p): active non-robust "
"walker\n", lp, elem);
"walker\n", (void *)lp, elem);
}
}
@@ -578,8 +585,8 @@ uu_list_teardown(uu_list_t *lp, void **cookie)
* XXX: disable list modification until list is empty
*/
if (lp->ul_debug && *cookie != NULL)
uu_panic("uu_list_teardown(%p, %p): unexpected cookie\n", lp,
cookie);
uu_panic("uu_list_teardown(%p, %p): unexpected cookie\n",
(void *)lp, (void *)cookie);
ep = uu_list_first(lp);
if (ep)
@@ -599,12 +606,12 @@ uu_list_insert_before(uu_list_t *lp, void *target, void *elem)
if (np->uln_prev == NULL)
uu_panic("uu_list_insert_before(%p, %p, %p): %p is "
"not currently on a list\n",
lp, target, elem, target);
(void *)lp, target, elem, target);
}
if (lp->ul_sorted) {
if (lp->ul_debug)
uu_panic("uu_list_insert_before(%p, ...): list is "
"UU_LIST_SORTED\n", lp);
"UU_LIST_SORTED\n", (void *)lp);
uu_set_error(UU_ERROR_NOT_SUPPORTED);
return (-1);
}
@@ -625,12 +632,12 @@ uu_list_insert_after(uu_list_t *lp, void *target, void *elem)
if (np->uln_prev == NULL)
uu_panic("uu_list_insert_after(%p, %p, %p): %p is "
"not currently on a list\n",
lp, target, elem, target);
(void *)lp, target, elem, target);
}
if (lp->ul_sorted) {
if (lp->ul_debug)
uu_panic("uu_list_insert_after(%p, ...): list is "
"UU_LIST_SORTED\n", lp);
"UU_LIST_SORTED\n", (void *)lp);
uu_set_error(UU_ERROR_NOT_SUPPORTED);
return (-1);
}
@@ -20,21 +20,20 @@
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _LIBZFS_H
#define _LIBZFS_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <assert.h>
#include <libnvpair.h>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/varargs.h>
#include <sys/fs/zfs.h>
#include <sys/avl.h>
#include <sys/zfs_ioctl.h>
#ifdef __cplusplus
@@ -47,6 +46,7 @@ extern "C" {
#define ZFS_MAXNAMELEN MAXNAMELEN
#define ZPOOL_MAXNAMELEN MAXNAMELEN
#define ZFS_MAXPROPLEN MAXPATHLEN
#define ZPOOL_MAXPROPLEN MAXPATHLEN
/*
* libzfs errors
@@ -99,9 +99,61 @@ enum {
EZFS_POOL_NOTSUP, /* ops not supported for this type of pool */
EZFS_POOL_INVALARG, /* invalid argument for this pool operation */
EZFS_NAMETOOLONG, /* dataset name is too long */
EZFS_OPENFAILED, /* open of device failed */
EZFS_NOCAP, /* couldn't get capacity */
EZFS_LABELFAILED, /* write of label failed */
EZFS_ISCSISVCUNAVAIL, /* iscsi service unavailable */
EZFS_BADWHO, /* invalid permission who */
EZFS_BADPERM, /* invalid permission */
EZFS_BADPERMSET, /* invalid permission set name */
EZFS_NODELEGATION, /* delegated administration is disabled */
EZFS_PERMRDONLY, /* pemissions are readonly */
EZFS_UNSHARESMBFAILED, /* failed to unshare over smb */
EZFS_SHARESMBFAILED, /* failed to share over smb */
EZFS_BADCACHE, /* bad cache file */
EZFS_ISL2CACHE, /* device is for the level 2 ARC */
EZFS_VDEVNOTSUP, /* unsupported vdev type */
EZFS_NOTSUP, /* ops not supported on this dataset */
EZFS_ACTIVE_SPARE, /* pool has active shared spare devices */
EZFS_UNKNOWN
};
/*
* The following data structures are all part
* of the zfs_allow_t data structure which is
* used for printing 'allow' permissions.
* It is a linked list of zfs_allow_t's which
* then contain avl tree's for user/group/sets/...
* and each one of the entries in those trees have
* avl tree's for the permissions they belong to and
* whether they are local,descendent or local+descendent
* permissions. The AVL trees are used primarily for
* sorting purposes, but also so that we can quickly find
* a given user and or permission.
*/
typedef struct zfs_perm_node {
avl_node_t z_node;
char z_pname[MAXPATHLEN];
} zfs_perm_node_t;
typedef struct zfs_allow_node {
avl_node_t z_node;
char z_key[MAXPATHLEN]; /* name, such as joe */
avl_tree_t z_localdescend; /* local+descendent perms */
avl_tree_t z_local; /* local permissions */
avl_tree_t z_descend; /* descendent permissions */
} zfs_allow_node_t;
typedef struct zfs_allow {
struct zfs_allow *z_next;
char z_setpoint[MAXPATHLEN];
avl_tree_t z_sets;
avl_tree_t z_crperms;
avl_tree_t z_user;
avl_tree_t z_group;
avl_tree_t z_everyone;
} zfs_allow_t;
/*
* Basic handle types
*/
@@ -131,12 +183,9 @@ extern zpool_handle_t *zpool_open(libzfs_handle_t *, const char *);
extern zpool_handle_t *zpool_open_canfail(libzfs_handle_t *, const char *);
extern void zpool_close(zpool_handle_t *);
extern const char *zpool_get_name(zpool_handle_t *);
extern uint64_t zpool_get_guid(zpool_handle_t *);
extern uint64_t zpool_get_space_used(zpool_handle_t *);
extern uint64_t zpool_get_space_total(zpool_handle_t *);
extern int zpool_get_root(zpool_handle_t *, char *, size_t);
extern int zpool_get_state(zpool_handle_t *);
extern uint64_t zpool_get_version(zpool_handle_t *);
extern char *zpool_state_to_name(vdev_state_t, vdev_aux_t);
extern void zpool_free_handles(libzfs_handle_t *);
/*
* Iterate over all active pools in the system.
@@ -148,7 +197,7 @@ extern int zpool_iter(libzfs_handle_t *, zpool_iter_f, void *);
* Functions to create and destroy pools
*/
extern int zpool_create(libzfs_handle_t *, const char *, nvlist_t *,
const char *);
nvlist_t *, nvlist_t *);
extern int zpool_destroy(zpool_handle_t *);
extern int zpool_add(zpool_handle_t *, nvlist_t *);
@@ -156,22 +205,33 @@ extern int zpool_add(zpool_handle_t *, nvlist_t *);
* Functions to manipulate pool and vdev state
*/
extern int zpool_scrub(zpool_handle_t *, pool_scrub_type_t);
extern int zpool_clear(zpool_handle_t *, const char *);
extern int zpool_vdev_online(zpool_handle_t *, const char *);
extern int zpool_vdev_offline(zpool_handle_t *, const char *, int);
extern int zpool_vdev_attach(zpool_handle_t *, const char *, const char *,
nvlist_t *, int);
extern int zpool_vdev_online(zpool_handle_t *, const char *, int,
vdev_state_t *);
extern int zpool_vdev_offline(zpool_handle_t *, const char *, boolean_t);
extern int zpool_vdev_attach(zpool_handle_t *, const char *,
const char *, nvlist_t *, int);
extern int zpool_vdev_detach(zpool_handle_t *, const char *);
extern int zpool_vdev_remove(zpool_handle_t *, const char *);
extern int zpool_clear(zpool_handle_t *, const char *);
extern nvlist_t *zpool_find_vdev(zpool_handle_t *, const char *, boolean_t *);
extern int zpool_vdev_fault(zpool_handle_t *, uint64_t);
extern int zpool_vdev_degrade(zpool_handle_t *, uint64_t);
extern int zpool_vdev_clear(zpool_handle_t *, uint64_t);
extern nvlist_t *zpool_find_vdev(zpool_handle_t *, const char *, boolean_t *,
boolean_t *, boolean_t *);
extern int zpool_label_disk(libzfs_handle_t *, zpool_handle_t *, char *);
/*
* Functions to manage pool properties
*/
extern int zpool_set_prop(zpool_handle_t *, const char *, const char *);
extern int zpool_get_prop(zpool_handle_t *, zfs_prop_t, char *,
size_t proplen, zfs_source_t *);
extern int zpool_get_prop(zpool_handle_t *, zpool_prop_t, char *,
size_t proplen, zprop_source_t *);
extern uint64_t zpool_get_prop_int(zpool_handle_t *, zpool_prop_t,
zprop_source_t *);
extern const char *zpool_prop_to_name(zpool_prop_t);
extern const char *zpool_prop_values(zpool_prop_t);
@@ -194,6 +254,11 @@ typedef enum {
ZPOOL_STATUS_FAILING_DEV, /* device experiencing errors */
ZPOOL_STATUS_VERSION_NEWER, /* newer on-disk version */
ZPOOL_STATUS_HOSTID_MISMATCH, /* last accessed by another system */
ZPOOL_STATUS_IO_FAILURE_WAIT, /* failed I/O, failmode 'wait' */
ZPOOL_STATUS_IO_FAILURE_CONTINUE, /* failed I/O, failmode 'continue' */
ZPOOL_STATUS_FAULTED_DEV_R, /* faulted device with replicas */
ZPOOL_STATUS_FAULTED_DEV_NR, /* faulted device with no replicas */
ZPOOL_STATUS_BAD_LOG, /* cannot read log chain(s) */
/*
* The following are not faults per se, but still an error possibly
@@ -223,26 +288,39 @@ extern int zpool_get_errlog(zpool_handle_t *, nvlist_t **);
/*
* Import and export functions
*/
extern int zpool_export(zpool_handle_t *);
extern int zpool_export(zpool_handle_t *, boolean_t);
extern int zpool_import(libzfs_handle_t *, nvlist_t *, const char *,
const char *);
char *altroot);
extern int zpool_import_props(libzfs_handle_t *, nvlist_t *, const char *,
nvlist_t *, boolean_t);
/*
* Search for pools to import
*/
extern nvlist_t *zpool_find_import(libzfs_handle_t *, int, char **);
extern nvlist_t *zpool_find_import_cached(libzfs_handle_t *, const char *,
char *, uint64_t);
extern nvlist_t *zpool_find_import_byname(libzfs_handle_t *, int, char **,
char *);
extern nvlist_t *zpool_find_import_byguid(libzfs_handle_t *, int, char **,
uint64_t);
extern nvlist_t *zpool_find_import_activeok(libzfs_handle_t *, int, char **);
/*
* Miscellaneous pool functions
*/
struct zfs_cmd;
extern char *zpool_vdev_name(libzfs_handle_t *, zpool_handle_t *, nvlist_t *);
extern int zpool_upgrade(zpool_handle_t *);
extern int zpool_upgrade(zpool_handle_t *, uint64_t);
extern int zpool_get_history(zpool_handle_t *, nvlist_t **);
extern void zpool_log_history(libzfs_handle_t *, int, char **, const char *,
boolean_t, boolean_t);
extern void zpool_set_history_str(const char *subcommand, int argc,
char **argv, char *history_str);
extern int zpool_stage_history(libzfs_handle_t *, const char *);
extern void zpool_obj_to_path(zpool_handle_t *, uint64_t, uint64_t, char *,
size_t len);
extern int zfs_ioctl(libzfs_handle_t *, unsigned long, struct zfs_cmd *);
extern int zpool_get_physpath(zpool_handle_t *, char *);
/*
* Basic handle manipulations. These functions do not create or destroy the
* underlying datasets, only the references to them.
@@ -251,65 +329,84 @@ extern zfs_handle_t *zfs_open(libzfs_handle_t *, const char *, int);
extern void zfs_close(zfs_handle_t *);
extern zfs_type_t zfs_get_type(const zfs_handle_t *);
extern const char *zfs_get_name(const zfs_handle_t *);
extern zpool_handle_t *zfs_get_pool_handle(const zfs_handle_t *);
/*
* Property management functions. Some functions are shared with the kernel,
* and are found in sys/fs/zfs.h.
*/
/*
* zfs dataset property management
*/
extern const char *zfs_prop_default_string(zfs_prop_t);
extern uint64_t zfs_prop_default_numeric(zfs_prop_t);
extern const char *zfs_prop_column_name(zfs_prop_t);
extern boolean_t zfs_prop_align_right(zfs_prop_t);
extern nvlist_t *zfs_valid_proplist(libzfs_handle_t *, zfs_type_t,
nvlist_t *, uint64_t, zfs_handle_t *, const char *);
extern const char *zfs_prop_to_name(zfs_prop_t);
extern int zfs_prop_set(zfs_handle_t *, const char *, const char *);
extern int zfs_prop_get(zfs_handle_t *, zfs_prop_t, char *, size_t,
zfs_source_t *, char *, size_t, boolean_t);
zprop_source_t *, char *, size_t, boolean_t);
extern int zfs_prop_get_numeric(zfs_handle_t *, zfs_prop_t, uint64_t *,
zfs_source_t *, char *, size_t);
zprop_source_t *, char *, size_t);
extern uint64_t zfs_prop_get_int(zfs_handle_t *, zfs_prop_t);
extern const char *zfs_prop_get_string(zfs_handle_t *, zfs_prop_t);
extern int zfs_prop_inherit(zfs_handle_t *, const char *);
extern const char *zfs_prop_values(zfs_prop_t);
extern int zfs_prop_valid_for_type(zfs_prop_t, int);
extern const char *zfs_prop_default_string(zfs_prop_t prop);
extern uint64_t zfs_prop_default_numeric(zfs_prop_t);
extern int zfs_prop_is_string(zfs_prop_t prop);
extern const char *zfs_prop_column_name(zfs_prop_t);
extern boolean_t zfs_prop_align_right(zfs_prop_t);
extern void nicebool(int value, char *buf, size_t buflen);
extern nvlist_t *zfs_get_user_props(zfs_handle_t *);
typedef struct zfs_proplist {
zfs_prop_t pl_prop;
typedef struct zprop_list {
int pl_prop;
char *pl_user_prop;
struct zfs_proplist *pl_next;
struct zprop_list *pl_next;
boolean_t pl_all;
size_t pl_width;
boolean_t pl_fixed;
} zfs_proplist_t;
} zprop_list_t;
typedef zfs_proplist_t zpool_proplist_t;
extern int zfs_get_proplist(libzfs_handle_t *, char *, zfs_proplist_t **);
extern int zpool_get_proplist(libzfs_handle_t *, char *, zpool_proplist_t **);
extern int zfs_expand_proplist(zfs_handle_t *, zfs_proplist_t **);
extern int zpool_expand_proplist(zpool_handle_t *, zpool_proplist_t **);
extern void zfs_free_proplist(zfs_proplist_t *);
extern nvlist_t *zfs_get_user_props(zfs_handle_t *);
extern int zfs_expand_proplist(zfs_handle_t *, zprop_list_t **);
#define ZFS_MOUNTPOINT_NONE "none"
#define ZFS_MOUNTPOINT_LEGACY "legacy"
/*
* Functions for printing properties from zfs/zpool
* zpool property management
*/
typedef struct libzfs_get_cbdata {
extern int zpool_expand_proplist(zpool_handle_t *, zprop_list_t **);
extern const char *zpool_prop_default_string(zpool_prop_t);
extern uint64_t zpool_prop_default_numeric(zpool_prop_t);
extern const char *zpool_prop_column_name(zpool_prop_t);
extern boolean_t zpool_prop_align_right(zpool_prop_t);
/*
* Functions shared by zfs and zpool property management.
*/
extern int zprop_iter(zprop_func func, void *cb, boolean_t show_all,
boolean_t ordered, zfs_type_t type);
extern int zprop_get_list(libzfs_handle_t *, char *, zprop_list_t **,
zfs_type_t);
extern void zprop_free_list(zprop_list_t *);
/*
* Functions for printing zfs or zpool properties
*/
typedef struct zprop_get_cbdata {
int cb_sources;
int cb_columns[4];
int cb_colwidths[5];
boolean_t cb_scripted;
boolean_t cb_literal;
boolean_t cb_first;
zfs_proplist_t *cb_proplist;
} libzfs_get_cbdata_t;
zprop_list_t *cb_proplist;
zfs_type_t cb_type;
} zprop_get_cbdata_t;
void libzfs_print_one_property(const char *, libzfs_get_cbdata_t *,
const char *, const char *, zfs_source_t, const char *);
void zprop_print_one_property(const char *, zprop_get_cbdata_t *,
const char *, const char *, zprop_source_t, const char *);
#define GET_COL_NAME 1
#define GET_COL_PROPERTY 2
@@ -331,26 +428,61 @@ extern int zfs_iter_snapshots(zfs_handle_t *, zfs_iter_f, void *);
*/
extern int zfs_create(libzfs_handle_t *, const char *, zfs_type_t,
nvlist_t *);
extern int zfs_create_ancestors(libzfs_handle_t *, const char *);
extern int zfs_destroy(zfs_handle_t *);
extern int zfs_destroy_snaps(zfs_handle_t *, char *);
extern int zfs_clone(zfs_handle_t *, const char *, nvlist_t *);
extern int zfs_snapshot(libzfs_handle_t *, const char *, boolean_t);
extern int zfs_rollback(zfs_handle_t *, zfs_handle_t *, int);
extern int zfs_rename(zfs_handle_t *, const char *, int);
extern int zfs_send(zfs_handle_t *, const char *, int);
extern int zfs_receive(libzfs_handle_t *, const char *, int, int, int,
boolean_t, int);
extern int zfs_snapshot(libzfs_handle_t *, const char *, boolean_t, nvlist_t *);
extern int zfs_rollback(zfs_handle_t *, zfs_handle_t *, boolean_t);
extern int zfs_rename(zfs_handle_t *, const char *, boolean_t);
extern int zfs_send(zfs_handle_t *, const char *, const char *,
boolean_t, boolean_t, boolean_t, boolean_t, int);
extern int zfs_promote(zfs_handle_t *);
typedef struct recvflags {
/* print informational messages (ie, -v was specified) */
int verbose : 1;
/* the destination is a prefix, not the exact fs (ie, -d) */
int isprefix : 1;
/* do not actually do the recv, just check if it would work (ie, -n) */
int dryrun : 1;
/* rollback/destroy filesystems as necessary (eg, -F) */
int force : 1;
/* set "canmount=off" on all modified filesystems */
int canmountoff : 1;
/* byteswap flag is used internally; callers need not specify */
int byteswap : 1;
} recvflags_t;
extern int zfs_receive(libzfs_handle_t *, const char *, recvflags_t,
int, avl_tree_t *);
/*
* Miscellaneous functions.
*/
extern const char *zfs_type_to_name(zfs_type_t);
extern void zfs_refresh_properties(zfs_handle_t *);
extern int zfs_name_valid(const char *, zfs_type_t);
extern int zfs_disable(zfs_handle_t *);
extern int zfs_enable(zfs_handle_t *);
extern zfs_handle_t *zfs_path_to_zhandle(libzfs_handle_t *, char *, zfs_type_t);
extern boolean_t zfs_dataset_exists(libzfs_handle_t *, const char *,
zfs_type_t);
extern int zfs_spa_version(zfs_handle_t *, int *);
/*
* dataset permission functions.
*/
extern int zfs_perm_set(zfs_handle_t *, nvlist_t *);
extern int zfs_perm_remove(zfs_handle_t *, nvlist_t *);
extern int zfs_build_perms(zfs_handle_t *, char *, char *,
zfs_deleg_who_type_t, zfs_deleg_inherit_t, nvlist_t **nvlist_t);
extern int zfs_perm_get(zfs_handle_t *, zfs_allow_t **);
extern void zfs_free_allows(zfs_allow_t *);
extern void zfs_deleg_permissions(void);
/*
* Mount support functions.
@@ -369,15 +501,27 @@ extern int zfs_share(zfs_handle_t *);
extern int zfs_unshare(zfs_handle_t *);
/*
* Protocol-specifc share support functions.
* Protocol-specific share support functions.
*/
extern boolean_t zfs_is_shared_nfs(zfs_handle_t *, char **);
extern boolean_t zfs_is_shared_smb(zfs_handle_t *, char **);
extern int zfs_share_nfs(zfs_handle_t *);
extern int zfs_share_smb(zfs_handle_t *);
extern int zfs_shareall(zfs_handle_t *);
extern int zfs_unshare_nfs(zfs_handle_t *, const char *);
extern int zfs_unshare_smb(zfs_handle_t *, const char *);
extern int zfs_unshareall_nfs(zfs_handle_t *);
extern int zfs_unshareall_smb(zfs_handle_t *);
extern int zfs_unshareall_bypath(zfs_handle_t *, const char *);
extern int zfs_unshareall(zfs_handle_t *);
extern boolean_t zfs_is_shared_iscsi(zfs_handle_t *);
extern int zfs_share_iscsi(zfs_handle_t *);
extern int zfs_unshare_iscsi(zfs_handle_t *);
#ifdef TODO
extern int zfs_iscsi_perm_check(libzfs_handle_t *, char *, ucred_t *);
#endif
extern int zfs_deleg_share_nfs(libzfs_handle_t *, char *, char *,
void *, void *, int, zfs_share_op_t);
/*
* FreeBSD-specific jail support function.
@@ -401,12 +545,6 @@ extern int zfs_jail(zfs_handle_t *, int, int);
extern void zfs_nicenum(uint64_t, char *, size_t);
extern int zfs_nicestrtonum(libzfs_handle_t *, const char *, uint64_t *);
/*
* Pool destroy special. Remove the device information without destroying
* the underlying dataset.
*/
extern int zfs_remove_link(zfs_handle_t *);
/*
* Given a device or file, determine if it is part of a pool.
*/
@@ -424,6 +562,9 @@ extern int zpool_read_label(int, nvlist_t **);
extern int zpool_create_zvol_links(zpool_handle_t *);
extern int zpool_remove_zvol_links(zpool_handle_t *);
/* is this zvol valid for use as a dump device? */
extern int zvol_check_dump_config(char *);
/*
* Enable and disable datasets within a pool by mounting/unmounting and
* sharing/unsharing them.
@@ -20,12 +20,12 @@
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
* Portions Copyright 2007 Ramprakash Jelari
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <libintl.h>
#include <libuutil.h>
#include <stddef.h>
@@ -65,18 +65,21 @@ typedef struct prop_changenode {
int cn_shared;
int cn_mounted;
int cn_zoned;
boolean_t cn_needpost; /* is postfix() needed? */
uu_list_node_t cn_listnode;
} prop_changenode_t;
struct prop_changelist {
zfs_prop_t cl_prop;
zfs_prop_t cl_realprop;
zfs_prop_t cl_shareprop; /* used with sharenfs/sharesmb */
uu_list_pool_t *cl_pool;
uu_list_t *cl_list;
boolean_t cl_waslegacy;
boolean_t cl_allchildren;
boolean_t cl_alldependents;
int cl_flags;
int cl_mflags; /* Mount flags */
int cl_gflags; /* Gather request flags */
boolean_t cl_haszonedchild;
boolean_t cl_sorted;
};
@@ -84,7 +87,8 @@ struct prop_changelist {
/*
* If the property is 'mountpoint', go through and unmount filesystems as
* necessary. We don't do the same for 'sharenfs', because we can just re-share
* with different options without interrupting service.
* with different options without interrupting service. We do handle 'sharesmb'
* since there may be old resource names that need to be removed.
*/
int
changelist_prefix(prop_changelist_t *clp)
@@ -92,11 +96,19 @@ changelist_prefix(prop_changelist_t *clp)
prop_changenode_t *cn;
int ret = 0;
if (clp->cl_prop != ZFS_PROP_MOUNTPOINT)
if (clp->cl_prop != ZFS_PROP_MOUNTPOINT &&
clp->cl_prop != ZFS_PROP_SHARESMB)
return (0);
for (cn = uu_list_first(clp->cl_list); cn != NULL;
cn = uu_list_next(clp->cl_list, cn)) {
/* if a previous loop failed, set the remaining to false */
if (ret == -1) {
cn->cn_needpost = B_FALSE;
continue;
}
/*
* If we are in the global zone, but this dataset is exported
* to a local zone, do nothing.
@@ -114,8 +126,11 @@ changelist_prefix(prop_changelist_t *clp)
(void) zfs_unshare_iscsi(cn->cn_handle);
if (zvol_remove_link(cn->cn_handle->zfs_hdl,
cn->cn_handle->zfs_name) != 0)
cn->cn_handle->zfs_name) != 0) {
ret = -1;
cn->cn_needpost = B_FALSE;
(void) zfs_share_iscsi(cn->cn_handle);
}
break;
case ZFS_PROP_VOLSIZE:
@@ -126,10 +141,28 @@ changelist_prefix(prop_changelist_t *clp)
(void) zfs_unshare_iscsi(cn->cn_handle);
break;
}
} else if (zfs_unmount(cn->cn_handle, NULL, clp->cl_flags) != 0)
ret = -1;
} else {
/*
* Do the property specific processing.
*/
switch (clp->cl_prop) {
case ZFS_PROP_MOUNTPOINT:
if (zfs_unmount(cn->cn_handle, NULL,
clp->cl_mflags) != 0) {
ret = -1;
cn->cn_needpost = B_FALSE;
}
break;
case ZFS_PROP_SHARESMB:
(void) zfs_unshare_smb(cn->cn_handle, NULL);
break;
}
}
}
if (ret == -1)
(void) changelist_postfix(clp);
return (ret);
}
@@ -147,7 +180,8 @@ changelist_postfix(prop_changelist_t *clp)
{
prop_changenode_t *cn;
char shareopts[ZFS_MAXPROPLEN];
int ret = 0;
int errors = 0;
libzfs_handle_t *hdl;
/*
* If we're changing the mountpoint, attempt to destroy the underlying
@@ -162,12 +196,29 @@ changelist_postfix(prop_changelist_t *clp)
if (clp->cl_prop == ZFS_PROP_MOUNTPOINT)
remove_mountpoint(cn->cn_handle);
/*
* It is possible that the changelist_prefix() used libshare
* to unshare some entries. Since libshare caches data, an
* attempt to reshare during postfix can fail unless libshare
* is uninitialized here so that it will reinitialize later.
*/
if (cn->cn_handle != NULL) {
hdl = cn->cn_handle->zfs_hdl;
assert(hdl != NULL);
zfs_uninit_libshare(hdl);
}
/*
* We walk the datasets in reverse, because we want to mount any parent
* datasets before mounting the children.
* datasets before mounting the children. We walk all datasets even if
* there are errors.
*/
for (cn = uu_list_last(clp->cl_list); cn != NULL;
cn = uu_list_prev(clp->cl_list, cn)) {
boolean_t sharenfs;
boolean_t sharesmb;
/*
* If we are in the global zone, but this dataset is exported
* to a local zone, do nothing.
@@ -175,6 +226,11 @@ changelist_postfix(prop_changelist_t *clp)
if (getzoneid() == GLOBAL_ZONEID && cn->cn_zoned)
continue;
/* Only do post-processing if it's required */
if (!cn->cn_needpost)
continue;
cn->cn_needpost = B_FALSE;
zfs_refresh_properties(cn->cn_handle);
if (ZFS_IS_VOLUME(cn->cn_handle)) {
@@ -185,7 +241,7 @@ changelist_postfix(prop_changelist_t *clp)
if (clp->cl_realprop == ZFS_PROP_NAME &&
zvol_create_link(cn->cn_handle->zfs_hdl,
cn->cn_handle->zfs_name) != 0) {
ret = -1;
errors++;
} else if (cn->cn_shared ||
clp->cl_prop == ZFS_PROP_SHAREISCSI) {
if (zfs_prop_get(cn->cn_handle,
@@ -193,43 +249,55 @@ changelist_postfix(prop_changelist_t *clp)
sizeof (shareopts), NULL, NULL, 0,
B_FALSE) == 0 &&
strcmp(shareopts, "off") == 0) {
ret = zfs_unshare_iscsi(cn->cn_handle);
errors +=
zfs_unshare_iscsi(cn->cn_handle);
} else {
ret = zfs_share_iscsi(cn->cn_handle);
errors +=
zfs_share_iscsi(cn->cn_handle);
}
}
continue;
}
if ((clp->cl_waslegacy || cn->cn_mounted) &&
!zfs_is_mounted(cn->cn_handle, NULL) &&
/*
* Remount if previously mounted or mountpoint was legacy,
* or sharenfs or sharesmb property is set.
*/
sharenfs = ((zfs_prop_get(cn->cn_handle, ZFS_PROP_SHARENFS,
shareopts, sizeof (shareopts), NULL, NULL, 0,
B_FALSE) == 0) && (strcmp(shareopts, "off") != 0));
sharesmb = ((zfs_prop_get(cn->cn_handle, ZFS_PROP_SHARESMB,
shareopts, sizeof (shareopts), NULL, NULL, 0,
B_FALSE) == 0) && (strcmp(shareopts, "off") != 0));
if ((cn->cn_mounted || clp->cl_waslegacy || sharenfs ||
sharesmb) && !zfs_is_mounted(cn->cn_handle, NULL) &&
zfs_mount(cn->cn_handle, NULL, 0) != 0)
ret = -1;
errors++;
/*
* We always re-share even if the filesystem is currently
* shared, so that we can adopt any new options.
*/
if (cn->cn_shared ||
(clp->cl_prop == ZFS_PROP_SHARENFS && clp->cl_waslegacy)) {
if (zfs_prop_get(cn->cn_handle, ZFS_PROP_SHARENFS,
shareopts, sizeof (shareopts), NULL, NULL, 0,
B_FALSE) == 0 && strcmp(shareopts, "off") == 0) {
ret = zfs_unshare_nfs(cn->cn_handle, NULL);
} else {
ret = zfs_share_nfs(cn->cn_handle);
}
}
if (sharenfs)
errors += zfs_share_nfs(cn->cn_handle);
else if (cn->cn_shared || clp->cl_waslegacy)
errors += zfs_unshare_nfs(cn->cn_handle, NULL);
if (sharesmb)
errors += zfs_share_smb(cn->cn_handle);
else if (cn->cn_shared || clp->cl_waslegacy)
errors += zfs_unshare_smb(cn->cn_handle, NULL);
}
return (ret);
return (errors ? -1 : 0);
}
/*
* Is this "dataset" a child of "parent"?
*/
static boolean_t
boolean_t
isa_child_of(const char *dataset, const char *parent)
{
int len;
@@ -280,21 +348,22 @@ changelist_rename(prop_changelist_t *clp, const char *src, const char *dst)
}
/*
* Given a gathered changelist for the 'sharenfs' property, unshare all the
* datasets in the list.
* Given a gathered changelist for the 'sharenfs' or 'sharesmb' property,
* unshare all the datasets in the list.
*/
int
changelist_unshare(prop_changelist_t *clp)
changelist_unshare(prop_changelist_t *clp, zfs_share_proto_t *proto)
{
prop_changenode_t *cn;
int ret = 0;
if (clp->cl_prop != ZFS_PROP_SHARENFS)
if (clp->cl_prop != ZFS_PROP_SHARENFS &&
clp->cl_prop != ZFS_PROP_SHARESMB)
return (0);
for (cn = uu_list_first(clp->cl_list); cn != NULL;
cn = uu_list_next(clp->cl_list, cn)) {
if (zfs_unshare_nfs(cn->cn_handle, NULL) != 0)
if (zfs_unshare_proto(cn->cn_handle, NULL, proto) != 0)
ret = -1;
}
@@ -316,14 +385,14 @@ changelist_haszonedchild(prop_changelist_t *clp)
* Remove a node from a gathered list.
*/
void
changelist_remove(zfs_handle_t *zhp, prop_changelist_t *clp)
changelist_remove(prop_changelist_t *clp, const char *name)
{
prop_changenode_t *cn;
for (cn = uu_list_first(clp->cl_list); cn != NULL;
cn = uu_list_next(clp->cl_list, cn)) {
if (strcmp(cn->cn_handle->zfs_name, zhp->zfs_name) == 0) {
if (strcmp(cn->cn_handle->zfs_name, name) == 0) {
uu_list_remove(clp->cl_list, cn);
zfs_close(cn->cn_handle);
free(cn);
@@ -363,7 +432,8 @@ change_one(zfs_handle_t *zhp, void *data)
char property[ZFS_MAXPROPLEN];
char where[64];
prop_changenode_t *cn;
zfs_source_t sourcetype;
zprop_source_t sourcetype;
zprop_source_t share_sourcetype;
/*
* We only want to unmount/unshare those filesystems that may inherit
@@ -383,8 +453,25 @@ change_one(zfs_handle_t *zhp, void *data)
return (0);
}
/*
* If we are "watching" sharenfs or sharesmb
* then check out the companion property which is tracked
* in cl_shareprop
*/
if (clp->cl_shareprop != ZPROP_INVAL &&
zfs_prop_get(zhp, clp->cl_shareprop, property,
sizeof (property), &share_sourcetype, where, sizeof (where),
B_FALSE) != 0) {
zfs_close(zhp);
return (0);
}
if (clp->cl_alldependents || clp->cl_allchildren ||
sourcetype == ZFS_SRC_DEFAULT || sourcetype == ZFS_SRC_INHERITED) {
sourcetype == ZPROP_SRC_DEFAULT ||
sourcetype == ZPROP_SRC_INHERITED ||
(clp->cl_shareprop != ZPROP_INVAL &&
(share_sourcetype == ZPROP_SRC_DEFAULT ||
share_sourcetype == ZPROP_SRC_INHERITED))) {
if ((cn = zfs_alloc(zfs_get_handle(zhp),
sizeof (prop_changenode_t))) == NULL) {
zfs_close(zhp);
@@ -392,9 +479,11 @@ change_one(zfs_handle_t *zhp, void *data)
}
cn->cn_handle = zhp;
cn->cn_mounted = zfs_is_mounted(zhp, NULL);
cn->cn_mounted = (clp->cl_gflags & CL_GATHER_MOUNT_ALWAYS) ||
zfs_is_mounted(zhp, NULL);
cn->cn_shared = zfs_is_shared(zhp);
cn->cn_zoned = zfs_prop_get_int(zhp, ZFS_PROP_ZONED);
cn->cn_needpost = B_TRUE;
/* Indicate if any child is exported to a local zone. */
if (getzoneid() == GLOBAL_ZONEID && cn->cn_zoned)
@@ -467,7 +556,8 @@ compare_mountpoints(const void *a, const void *b, void *unused)
* mark whether it was shared beforehand.
*/
prop_changelist_t *
changelist_gather(zfs_handle_t *zhp, zfs_prop_t prop, int flags)
changelist_gather(zfs_handle_t *zhp, zfs_prop_t prop, int gather_flags,
int mnt_flags)
{
prop_changelist_t *clp;
prop_changenode_t *cn;
@@ -484,7 +574,8 @@ changelist_gather(zfs_handle_t *zhp, zfs_prop_t prop, int flags)
* order, regardless of their position in the hierarchy.
*/
if (prop == ZFS_PROP_NAME || prop == ZFS_PROP_ZONED ||
prop == ZFS_PROP_MOUNTPOINT || prop == ZFS_PROP_SHARENFS) {
prop == ZFS_PROP_MOUNTPOINT || prop == ZFS_PROP_SHARENFS ||
prop == ZFS_PROP_SHARESMB) {
compare = compare_mountpoints;
clp->cl_sorted = B_TRUE;
}
@@ -502,7 +593,8 @@ changelist_gather(zfs_handle_t *zhp, zfs_prop_t prop, int flags)
clp->cl_list = uu_list_create(clp->cl_pool, NULL,
clp->cl_sorted ? UU_LIST_SORTED : 0);
clp->cl_flags = flags;
clp->cl_gflags = gather_flags;
clp->cl_mflags = mnt_flags;
if (clp->cl_list == NULL) {
assert(uu_error() == UU_ERROR_NO_MEMORY);
@@ -529,6 +621,8 @@ changelist_gather(zfs_handle_t *zhp, zfs_prop_t prop, int flags)
clp->cl_prop = ZFS_PROP_MOUNTPOINT;
} else if (prop == ZFS_PROP_VOLSIZE) {
clp->cl_prop = ZFS_PROP_MOUNTPOINT;
} else if (prop == ZFS_PROP_VERSION) {
clp->cl_prop = ZFS_PROP_MOUNTPOINT;
} else {
clp->cl_prop = prop;
}
@@ -536,9 +630,19 @@ changelist_gather(zfs_handle_t *zhp, zfs_prop_t prop, int flags)
if (clp->cl_prop != ZFS_PROP_MOUNTPOINT &&
clp->cl_prop != ZFS_PROP_SHARENFS &&
clp->cl_prop != ZFS_PROP_SHARESMB &&
clp->cl_prop != ZFS_PROP_SHAREISCSI)
return (clp);
/*
* If watching SHARENFS or SHARESMB then
* also watch its companion property.
*/
if (clp->cl_prop == ZFS_PROP_SHARENFS)
clp->cl_shareprop = ZFS_PROP_SHARESMB;
else if (clp->cl_prop == ZFS_PROP_SHARESMB)
clp->cl_shareprop = ZFS_PROP_SHARENFS;
if (clp->cl_alldependents) {
if (zfs_iter_dependents(zhp, B_TRUE, change_one, clp) != 0) {
changelist_free(clp);
@@ -554,7 +658,7 @@ changelist_gather(zfs_handle_t *zhp, zfs_prop_t prop, int flags)
* and can't tell the difference.
*/
if ((temp = zfs_open(zhp->zfs_hdl, zfs_get_name(zhp),
ZFS_TYPE_ANY)) == NULL) {
ZFS_TYPE_DATASET)) == NULL) {
changelist_free(clp);
return (NULL);
}
@@ -571,9 +675,11 @@ changelist_gather(zfs_handle_t *zhp, zfs_prop_t prop, int flags)
}
cn->cn_handle = temp;
cn->cn_mounted = zfs_is_mounted(temp, NULL);
cn->cn_mounted = (clp->cl_gflags & CL_GATHER_MOUNT_ALWAYS) ||
zfs_is_mounted(temp, NULL);
cn->cn_shared = zfs_is_shared(temp);
cn->cn_zoned = zfs_prop_get_int(zhp, ZFS_PROP_ZONED);
cn->cn_needpost = B_TRUE;
uu_list_node_init(cn, &cn->cn_listnode, clp->cl_pool);
if (clp->cl_sorted) {
@@ -586,14 +692,22 @@ changelist_gather(zfs_handle_t *zhp, zfs_prop_t prop, int flags)
}
/*
* If the property was previously 'legacy' or 'none', record this fact,
* as the behavior of changelist_postfix() will be different.
* If the mountpoint property was previously 'legacy', or 'none',
* record it as the behavior of changelist_postfix() will be different.
*/
if (zfs_prop_get(zhp, prop, property, sizeof (property),
if ((clp->cl_prop == ZFS_PROP_MOUNTPOINT) &&
(zfs_prop_get(zhp, prop, property, sizeof (property),
NULL, NULL, 0, B_FALSE) == 0 &&
(strcmp(property, "legacy") == 0 || strcmp(property, "none") == 0 ||
strcmp(property, "off") == 0))
clp->cl_waslegacy = B_TRUE;
(strcmp(property, "legacy") == 0 ||
strcmp(property, "none") == 0))) {
/*
* do not automatically mount ex-legacy datasets if
* we specifically set canmount to noauto
*/
if (zfs_prop_get_int(zhp, ZFS_PROP_CANMOUNT) !=
ZFS_CANMOUNT_NOAUTO)
clp->cl_waslegacy = B_TRUE;
}
return (clp);
}
File diff suppressed because it is too large. Load diff
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -126,6 +126,8 @@ typedef struct zfs_graph {
zfs_vertex_t **zg_hash;
size_t zg_size;
size_t zg_nvertex;
const char *zg_root;
int zg_clone_count;
} zfs_graph_t;
/*
@@ -255,7 +257,7 @@ zfs_vertex_sort_edges(zfs_vertex_t *zvp)
* datasets in the pool.
*/
static zfs_graph_t *
zfs_graph_create(libzfs_handle_t *hdl, size_t size)
zfs_graph_create(libzfs_handle_t *hdl, const char *dataset, size_t size)
{
zfs_graph_t *zgp = zfs_alloc(hdl, sizeof (zfs_graph_t));
@@ -269,6 +271,9 @@ zfs_graph_create(libzfs_handle_t *hdl, size_t size)
return (NULL);
}
zgp->zg_root = dataset;
zgp->zg_clone_count = 0;
return (zgp);
}
@@ -367,17 +372,16 @@ zfs_graph_add(libzfs_handle_t *hdl, zfs_graph_t *zgp, const char *source,
}
/*
* Iterate over all children of the given dataset, adding any vertices as
* necessary. Returns 0 if no cloned snapshots were seen, -1 if there was an
* error, or 1 otherwise. This is a simple recursive algorithm - the ZFS
* namespace typically is very flat. We manually invoke the necessary ioctl()
* calls to avoid the overhead and additional semantics of zfs_open().
* Iterate over all children of the given dataset, adding any vertices
* as necessary. Returns -1 if there was an error, or 0 otherwise.
* This is a simple recursive algorithm - the ZFS namespace typically
* is very flat. We manually invoke the necessary ioctl() calls to
* avoid the overhead and additional semantics of zfs_open().
*/
static int
iterate_children(libzfs_handle_t *hdl, zfs_graph_t *zgp, const char *dataset)
{
zfs_cmd_t zc = { 0 };
int ret = 0, err;
zfs_vertex_t *zvp;
/*
@@ -390,18 +394,8 @@ iterate_children(libzfs_handle_t *hdl, zfs_graph_t *zgp, const char *dataset)
return (0);
/*
* We check the clone parent here instead of within the loop, so that if
* the root dataset has been promoted from a clone, we find its parent
* appropriately.
* Iterate over all children
*/
(void) strlcpy(zc.zc_name, dataset, sizeof (zc.zc_name));
if (ioctl(hdl->libzfs_fd, ZFS_IOC_OBJSET_STATS, &zc) == 0 &&
zc.zc_objset_stats.dds_clone_of[0] != '\0') {
if (zfs_graph_add(hdl, zgp, zc.zc_objset_stats.dds_clone_of,
zc.zc_name, zc.zc_objset_stats.dds_creation_txg) != 0)
return (-1);
}
for ((void) strlcpy(zc.zc_name, dataset, sizeof (zc.zc_name));
ioctl(hdl->libzfs_fd, ZFS_IOC_DATASET_LIST_NEXT, &zc) == 0;
(void) strlcpy(zc.zc_name, dataset, sizeof (zc.zc_name))) {
@@ -417,9 +411,23 @@ iterate_children(libzfs_handle_t *hdl, zfs_graph_t *zgp, const char *dataset)
* dataset and clone statistics. If this fails, the dataset has
* since been removed, and we're pretty much screwed anyway.
*/
zc.zc_objset_stats.dds_origin[0] = '\0';
if (ioctl(hdl->libzfs_fd, ZFS_IOC_OBJSET_STATS, &zc) != 0)
continue;
if (zc.zc_objset_stats.dds_origin[0] != '\0') {
if (zfs_graph_add(hdl, zgp,
zc.zc_objset_stats.dds_origin, zc.zc_name,
zc.zc_objset_stats.dds_creation_txg) != 0)
return (-1);
/*
* Count origins only if they are contained in the graph
*/
if (isa_child_of(zc.zc_objset_stats.dds_origin,
zgp->zg_root))
zgp->zg_clone_count--;
}
/*
* Add an edge between the parent and the child.
*/
@@ -428,19 +436,10 @@ iterate_children(libzfs_handle_t *hdl, zfs_graph_t *zgp, const char *dataset)
return (-1);
/*
* Iterate over all children
* Recursively visit child
*/
err = iterate_children(hdl, zgp, zc.zc_name);
if (err == -1)
if (iterate_children(hdl, zgp, zc.zc_name))
return (-1);
else if (err == 1)
ret = 1;
/*
* Indicate if we found a dataset with a non-zero clone count.
*/
if (zc.zc_objset_stats.dds_num_clones != 0)
ret = 1;
}
/*
@@ -467,67 +466,84 @@ iterate_children(libzfs_handle_t *hdl, zfs_graph_t *zgp, const char *dataset)
zc.zc_objset_stats.dds_creation_txg) != 0)
return (-1);
/*
* Indicate if we found a dataset with a non-zero clone count.
*/
if (zc.zc_objset_stats.dds_num_clones != 0)
ret = 1;
zgp->zg_clone_count += zc.zc_objset_stats.dds_num_clones;
}
zvp->zv_visited = VISIT_SEEN;
return (ret);
return (0);
}
/*
* Construct a complete graph of all necessary vertices. First, we iterate over
* only our object's children. If we don't find any cloned snapshots, then we
* simple return that. Otherwise, we have to start at the pool root and iterate
* over all datasets.
* Returns false if there are no snapshots with dependent clones in this
* subtree or if all of those clones are also in this subtree. Returns
* true if there is an error or there are external dependents.
*/
static boolean_t
external_dependents(libzfs_handle_t *hdl, zfs_graph_t *zgp, const char *dataset)
{
zfs_cmd_t zc = { 0 };
/*
* Check whether this dataset is a clone or has clones since
* iterate_children() only checks the children.
*/
(void) strlcpy(zc.zc_name, dataset, sizeof (zc.zc_name));
if (ioctl(hdl->libzfs_fd, ZFS_IOC_OBJSET_STATS, &zc) != 0)
return (B_TRUE);
if (zc.zc_objset_stats.dds_origin[0] != '\0') {
if (zfs_graph_add(hdl, zgp,
zc.zc_objset_stats.dds_origin, zc.zc_name,
zc.zc_objset_stats.dds_creation_txg) != 0)
return (B_TRUE);
if (isa_child_of(zc.zc_objset_stats.dds_origin, dataset))
zgp->zg_clone_count--;
}
if ((zc.zc_objset_stats.dds_num_clones) ||
iterate_children(hdl, zgp, dataset))
return (B_TRUE);
return (zgp->zg_clone_count != 0);
}
/*
* Construct a complete graph of all necessary vertices. First, iterate over
* only our object's children. If no cloned snapshots are found, or all of
* the cloned snapshots are in this subtree then return a graph of the subtree.
* Otherwise, start at the root of the pool and iterate over all datasets.
*/
static zfs_graph_t *
construct_graph(libzfs_handle_t *hdl, const char *dataset)
{
zfs_graph_t *zgp = zfs_graph_create(hdl, ZFS_GRAPH_SIZE);
zfs_cmd_t zc = { 0 };
zfs_graph_t *zgp = zfs_graph_create(hdl, dataset, ZFS_GRAPH_SIZE);
int ret = 0;
if (zgp == NULL)
return (zgp);
/*
* We need to explicitly check whether this dataset has clones or not,
* since iterate_children() only checks the children.
*/
(void) strlcpy(zc.zc_name, dataset, sizeof (zc.zc_name));
(void) ioctl(hdl->libzfs_fd, ZFS_IOC_OBJSET_STATS, &zc);
if (zc.zc_objset_stats.dds_num_clones != 0 ||
(ret = iterate_children(hdl, zgp, dataset)) != 0) {
if ((strchr(dataset, '/') == NULL) ||
(external_dependents(hdl, zgp, dataset))) {
/*
* Determine pool name and try again.
*/
char *pool, *slash;
int len = strcspn(dataset, "/@") + 1;
char *pool = zfs_alloc(hdl, len);
if ((slash = strchr(dataset, '/')) != NULL ||
(slash = strchr(dataset, '@')) != NULL) {
pool = zfs_alloc(hdl, slash - dataset + 1);
if (pool == NULL) {
zfs_graph_destroy(zgp);
return (NULL);
}
(void) strncpy(pool, dataset, slash - dataset);
pool[slash - dataset] = '\0';
if (iterate_children(hdl, zgp, pool) == -1 ||
zfs_graph_add(hdl, zgp, pool, NULL, 0) != 0) {
free(pool);
zfs_graph_destroy(zgp);
return (NULL);
}
free(pool);
if (pool == NULL) {
zfs_graph_destroy(zgp);
return (NULL);
}
(void) strlcpy(pool, dataset, len);
if (iterate_children(hdl, zgp, pool) == -1 ||
zfs_graph_add(hdl, zgp, pool, NULL, 0) != 0) {
free(pool);
zfs_graph_destroy(zgp);
return (NULL);
}
free(pool);
}
if (ret == -1 || zfs_graph_add(hdl, zgp, dataset, NULL, 0) != 0) {
@@ -1,5 +1,5 @@
/*
* CDDL HEADER START
* CDDL HEADER SART
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
@@ -20,21 +20,21 @@
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _LIBFS_IMPL_H
#define _LIBFS_IMPL_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/dmu.h>
#include <sys/fs/zfs.h>
#include <sys/zfs_ioctl.h>
#include <sys/zfs_acl.h>
#include <sys/spa.h>
#include <sys/nvpair.h>
#include <libshare.h>
#include <libuutil.h>
#include <libzfs.h>
@@ -42,22 +42,33 @@
extern "C" {
#endif
#ifdef VERIFY
#undef VERIFY
#endif
#define VERIFY verify
struct libzfs_handle {
int libzfs_error;
int libzfs_fd;
FILE *libzfs_mnttab;
FILE *libzfs_sharetab;
zpool_handle_t *libzfs_pool_handles;
uu_avl_pool_t *libzfs_ns_avlpool;
uu_avl_t *libzfs_ns_avl;
uint64_t libzfs_ns_gen;
int libzfs_desc_active;
char libzfs_action[1024];
char libzfs_desc[1024];
char *libzfs_log_str;
int libzfs_printerr;
void *libzfs_sharehdl; /* libshare handle */
uint_t libzfs_shareflags;
};
#define ZFSSHARE_MISS 0x01 /* Didn't find entry in cache */
struct zfs_handle {
libzfs_handle_t *zfs_hdl;
zpool_handle_t *zpool_hdl;
char zfs_name[ZFS_MAXNAMELEN];
zfs_type_t zfs_type; /* type including snapshot */
zfs_type_t zfs_head_type; /* type excluding snapshot */
@@ -66,7 +77,6 @@ struct zfs_handle {
nvlist_t *zfs_user_props;
boolean_t zfs_mntcheck;
char *zfs_mntopts;
char zfs_root[MAXPATHLEN];
};
/*
@@ -77,14 +87,33 @@ struct zfs_handle {
struct zpool_handle {
libzfs_handle_t *zpool_hdl;
zpool_handle_t *zpool_next;
char zpool_name[ZPOOL_MAXNAMELEN];
int zpool_state;
size_t zpool_config_size;
nvlist_t *zpool_config;
nvlist_t *zpool_old_config;
nvlist_t *zpool_props;
diskaddr_t zpool_start_block;
};
typedef enum {
PROTO_NFS = 0,
PROTO_SMB = 1,
PROTO_END = 2
} zfs_share_proto_t;
/*
* The following can be used as a bitmask and any new values
* added must preserve that capability.
*/
typedef enum {
SHARED_NOT_SHARED = 0x0,
SHARED_ISCSI = 0x1,
SHARED_NFS = 0x2,
SHARED_SMB = 0x4
} zfs_share_type_t;
int zfs_error(libzfs_handle_t *, int, const char *);
int zfs_error_fmt(libzfs_handle_t *, int, const char *, ...);
void zfs_error_aux(libzfs_handle_t *, const char *, ...);
@@ -101,20 +130,24 @@ int zpool_standard_error_fmt(libzfs_handle_t *, int, const char *, ...);
int get_dependents(libzfs_handle_t *, boolean_t, const char *, char ***,
size_t *);
int zfs_expand_proplist_common(libzfs_handle_t *, zfs_proplist_t **,
zfs_type_t);
int zfs_get_proplist_common(libzfs_handle_t *, char *, zfs_proplist_t **,
zfs_type_t);
zfs_prop_t zfs_prop_iter_common(zfs_prop_f, void *, zfs_type_t, boolean_t);
zfs_prop_t zfs_name_to_prop_common(const char *, zfs_type_t);
nvlist_t *zfs_validate_properties(libzfs_handle_t *, zfs_type_t, char *,
nvlist_t *, uint64_t, zfs_handle_t *zhp, const char *errbuf);
int zprop_parse_value(libzfs_handle_t *, nvpair_t *, int, zfs_type_t,
nvlist_t *, char **, uint64_t *, const char *);
int zprop_expand_list(libzfs_handle_t *hdl, zprop_list_t **plp,
zfs_type_t type);
/*
* Use this changelist_gather() flag to force attempting mounts
* on each change node regardless of whether or not it is currently
* mounted.
*/
#define CL_GATHER_MOUNT_ALWAYS 1
typedef struct prop_changelist prop_changelist_t;
int zcmd_alloc_dst_nvlist(libzfs_handle_t *, zfs_cmd_t *, size_t);
int zcmd_write_src_nvlist(libzfs_handle_t *, zfs_cmd_t *, nvlist_t *, size_t *);
int zcmd_write_src_nvlist(libzfs_handle_t *, zfs_cmd_t *, nvlist_t *);
int zcmd_write_conf_nvlist(libzfs_handle_t *, zfs_cmd_t *, nvlist_t *);
int zcmd_expand_dst_nvlist(libzfs_handle_t *, zfs_cmd_t *);
int zcmd_read_dst_nvlist(libzfs_handle_t *, zfs_cmd_t *, nvlist_t **);
void zcmd_free_nvlists(zfs_cmd_t *);
@@ -122,13 +155,15 @@ void zcmd_free_nvlists(zfs_cmd_t *);
int changelist_prefix(prop_changelist_t *);
int changelist_postfix(prop_changelist_t *);
void changelist_rename(prop_changelist_t *, const char *, const char *);
void changelist_remove(zfs_handle_t *, prop_changelist_t *);
void changelist_remove(prop_changelist_t *, const char *);
void changelist_free(prop_changelist_t *);
prop_changelist_t *changelist_gather(zfs_handle_t *, zfs_prop_t, int);
int changelist_unshare(prop_changelist_t *);
prop_changelist_t *changelist_gather(zfs_handle_t *, zfs_prop_t, int, int);
int changelist_unshare(prop_changelist_t *, zfs_share_proto_t *);
int changelist_haszonedchild(prop_changelist_t *);
void remove_mountpoint(zfs_handle_t *);
int create_parents(libzfs_handle_t *, char *, int);
boolean_t isa_child_of(const char *dataset, const char *parent);
zfs_handle_t *make_dataset_handle(libzfs_handle_t *, const char *);
@@ -137,10 +172,23 @@ int zpool_open_silent(libzfs_handle_t *, const char *, zpool_handle_t **);
int zvol_create_link(libzfs_handle_t *, const char *);
int zvol_remove_link(libzfs_handle_t *, const char *);
int zpool_iter_zvol(zpool_handle_t *, int (*)(const char *, void *), void *);
boolean_t zpool_name_valid(libzfs_handle_t *, boolean_t, const char *);
void namespace_clear(libzfs_handle_t *);
/*
* libshare (sharemgr) interfaces used internally.
*/
extern int zfs_init_libshare(libzfs_handle_t *, int);
extern void zfs_uninit_libshare(libzfs_handle_t *);
extern int zfs_parse_options(char *, zfs_share_proto_t);
extern int zfs_unshare_proto(zfs_handle_t *zhp,
const char *, zfs_share_proto_t *);
#ifdef __FreeBSD__
/*
* This is FreeBSD version of ioctl, because Solaris' ioctl() updates
* zc_nvlist_dst_size even if an error is returned, on FreeBSD if an
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -213,11 +213,13 @@ add_config(libzfs_handle_t *hdl, pool_list_t *pl, const char *path,
name_entry_t *ne;
/*
* If this is a hot spare not currently in use, add it to the list of
* names to translate, but don't do anything else.
* If this is a hot spare not currently in use or level 2 cache
* device, add it to the list of names to translate, but don't do
* anything else.
*/
if (nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_STATE,
&state) == 0 && state == POOL_STATE_SPARE &&
&state) == 0 &&
(state == POOL_STATE_SPARE || state == POOL_STATE_L2CACHE) &&
nvlist_lookup_uint64(config, ZPOOL_CONFIG_GUID, &vdev_guid) == 0) {
if ((ne = zfs_alloc(hdl, sizeof (name_entry_t))) == NULL)
return (-1);
@@ -361,6 +363,46 @@ pool_active(libzfs_handle_t *hdl, const char *name, uint64_t guid,
return (0);
}
static nvlist_t *
refresh_config(libzfs_handle_t *hdl, nvlist_t *config)
{
nvlist_t *nvl;
zfs_cmd_t zc = { 0 };
int err;
if (zcmd_write_conf_nvlist(hdl, &zc, config) != 0)
return (NULL);
if (zcmd_alloc_dst_nvlist(hdl, &zc,
zc.zc_nvlist_conf_size * 2) != 0) {
zcmd_free_nvlists(&zc);
return (NULL);
}
while ((err = ioctl(hdl->libzfs_fd, ZFS_IOC_POOL_TRYIMPORT,
&zc)) != 0 && errno == ENOMEM) {
if (zcmd_expand_dst_nvlist(hdl, &zc) != 0) {
zcmd_free_nvlists(&zc);
return (NULL);
}
}
if (err) {
(void) zpool_standard_error(hdl, errno,
dgettext(TEXT_DOMAIN, "cannot discover pools"));
zcmd_free_nvlists(&zc);
return (NULL);
}
if (zcmd_read_dst_nvlist(hdl, &zc, &nvl) != 0) {
zcmd_free_nvlists(&zc);
return (NULL);
}
zcmd_free_nvlists(&zc);
return (nvl);
}
/*
* Convert our list of pools into the definitive set of configurations. We
* start by picking the best config for each toplevel vdev. Once that's done,
@@ -369,26 +411,25 @@ pool_active(libzfs_handle_t *hdl, const char *name, uint64_t guid,
* return to the user.
*/
static nvlist_t *
get_configs(libzfs_handle_t *hdl, pool_list_t *pl)
get_configs(libzfs_handle_t *hdl, pool_list_t *pl, boolean_t active_ok)
{
pool_entry_t *pe;
vdev_entry_t *ve;
config_entry_t *ce;
nvlist_t *ret = NULL, *config = NULL, *tmp, *nvtop, *nvroot;
nvlist_t **spares;
uint_t i, nspares;
nvlist_t **spares, **l2cache;
uint_t i, nspares, nl2cache;
boolean_t config_seen;
uint64_t best_txg;
char *name, *hostname;
zfs_cmd_t zc = { 0 };
uint64_t version, guid;
size_t len;
int err;
uint_t children = 0;
nvlist_t **child = NULL;
uint_t c;
boolean_t isactive;
uint64_t hostid;
nvlist_t *nvl;
boolean_t found_one = B_FALSE;
if (nvlist_alloc(&ret, 0, 0) != 0)
goto nomem;
@@ -570,6 +611,13 @@ get_configs(libzfs_handle_t *hdl, pool_list_t *pl)
}
nvlist_free(nvroot);
/*
* zdb uses this path to report on active pools that were
* imported or created using -R.
*/
if (active_ok)
goto add_pool;
/*
* Determine if this pool is currently active, in which case we
* can't actually import it.
@@ -588,41 +636,11 @@ get_configs(libzfs_handle_t *hdl, pool_list_t *pl)
continue;
}
/*
* Try to do the import in order to get vdev state.
*/
if (zcmd_write_src_nvlist(hdl, &zc, config, &len) != 0)
if ((nvl = refresh_config(hdl, config)) == NULL)
goto error;
nvlist_free(config);
config = NULL;
if (zcmd_alloc_dst_nvlist(hdl, &zc, len * 2) != 0) {
zcmd_free_nvlists(&zc);
goto error;
}
while ((err = ioctl(hdl->libzfs_fd, ZFS_IOC_POOL_TRYIMPORT,
&zc)) != 0 && errno == ENOMEM) {
if (zcmd_expand_dst_nvlist(hdl, &zc) != 0) {
zcmd_free_nvlists(&zc);
goto error;
}
}
if (err) {
(void) zpool_standard_error(hdl, errno,
dgettext(TEXT_DOMAIN, "cannot discover pools"));
zcmd_free_nvlists(&zc);
goto error;
}
if (zcmd_read_dst_nvlist(hdl, &zc, &config) != 0) {
zcmd_free_nvlists(&zc);
goto error;
}
zcmd_free_nvlists(&zc);
config = nvl;
/*
* Go through and update the paths for spares, now that we have
@@ -638,6 +656,17 @@ get_configs(libzfs_handle_t *hdl, pool_list_t *pl)
}
}
/*
* Update the paths for l2cache devices.
*/
if (nvlist_lookup_nvlist_array(nvroot, ZPOOL_CONFIG_L2CACHE,
&l2cache, &nl2cache) == 0) {
for (i = 0; i < nl2cache; i++) {
if (fix_paths(l2cache[i], pl->names) != 0)
goto nomem;
}
}
/*
* Restore the original information read from the actual label.
*/
@@ -652,6 +681,7 @@ get_configs(libzfs_handle_t *hdl, pool_list_t *pl)
hostname) == 0);
}
add_pool:
/*
* Add this pool to the list of configs.
*/
@@ -660,10 +690,16 @@ get_configs(libzfs_handle_t *hdl, pool_list_t *pl)
if (nvlist_add_nvlist(ret, name, config) != 0)
goto nomem;
found_one = B_TRUE;
nvlist_free(config);
config = NULL;
}
if (!found_one) {
nvlist_free(ret);
ret = NULL;
}
return (ret);
nomem:
@@ -682,8 +718,9 @@ error:
* Return the offset of the given label.
*/
static uint64_t
label_offset(size_t size, int l)
label_offset(uint64_t size, int l)
{
ASSERT(P2PHASE_TYPED(size, sizeof (vdev_label_t), uint64_t) == 0);
return (l * sizeof (vdev_label_t) + (l < VDEV_LABELS / 2 ?
0 : size - VDEV_LABELS * sizeof (vdev_label_t)));
}
@@ -698,19 +735,20 @@ zpool_read_label(int fd, nvlist_t **config)
struct stat64 statbuf;
int l;
vdev_label_t *label;
uint64_t state, txg;
uint64_t state, txg, size;
*config = NULL;
if (fstat64(fd, &statbuf) == -1)
return (0);
size = P2ALIGN_TYPED(statbuf.st_size, sizeof (vdev_label_t), uint64_t);
if ((label = malloc(sizeof (vdev_label_t))) == NULL)
return (-1);
for (l = 0; l < VDEV_LABELS; l++) {
if (pread(fd, label, sizeof (vdev_label_t),
label_offset(statbuf.st_size, l)) != sizeof (vdev_label_t))
if (pread64(fd, label, sizeof (vdev_label_t),
label_offset(size, l)) != sizeof (vdev_label_t))
continue;
if (nvlist_unpack(label->vl_vdev_phys.vp_nvlist,
@@ -718,12 +756,12 @@ zpool_read_label(int fd, nvlist_t **config)
continue;
if (nvlist_lookup_uint64(*config, ZPOOL_CONFIG_POOL_STATE,
&state) != 0 || state > POOL_STATE_SPARE) {
&state) != 0 || state > POOL_STATE_L2CACHE) {
nvlist_free(*config);
continue;
}
if (state != POOL_STATE_SPARE &&
if (state != POOL_STATE_SPARE && state != POOL_STATE_L2CACHE &&
(nvlist_lookup_uint64(*config, ZPOOL_CONFIG_POOL_TXG,
&txg) != 0 || txg == 0)) {
nvlist_free(*config);
@@ -739,31 +777,20 @@ zpool_read_label(int fd, nvlist_t **config)
return (0);
}
/*
* Given a list of directories to search, find all pools stored on disk. This
* includes partial pools which are not available to import. If no args are
* given (argc is 0), then the default directory (/dev) is searched.
*/
nvlist_t *
zpool_find_import(libzfs_handle_t *hdl, int argc, char **argv)
static int
geom_find_import(libzfs_handle_t *hdl, pool_list_t *pools)
{
int i;
char path[MAXPATHLEN];
nvlist_t *ret = NULL, *config;
int fd;
pool_list_t pools = { 0 };
pool_entry_t *pe, *penext;
vdev_entry_t *ve, *venext;
config_entry_t *ce, *cenext;
name_entry_t *ne, *nenext;
struct gmesh mesh;
struct gclass *mp;
struct ggeom *gp;
struct gprovider *pp;
nvlist_t *config;
int fd, ret = 0;
/*
* Go through and read the label configuration information from every
* possible device, organizing the information according to pool GUID
* GEOM provider, organizing the information according to pool GUID
* and toplevel GUID.
*/
@@ -773,32 +800,183 @@ zpool_find_import(libzfs_handle_t *hdl, int argc, char **argv)
LIST_FOREACH(mp, &mesh.lg_class, lg_class) {
LIST_FOREACH(gp, &mp->lg_geom, lg_geom) {
LIST_FOREACH(pp, &gp->lg_provider, lg_provider) {
if ((fd = g_open(pp->lg_name, 0)) < 0)
continue;
(void) snprintf(path, sizeof (path), "%s%s",
_PATH_DEV, pp->lg_name);
if ((fd = open64(path, O_RDONLY)) < 0)
continue;
if ((zpool_read_label(fd, &config)) != 0) {
(void) g_close(fd);
(void) no_memory(hdl);
goto error;
}
(void) close(fd);
(void) g_close(fd);
if (config == NULL)
continue;
if (add_config(hdl, pools, path, config) != 0) {
ret = -1;
goto error;
}
}
}
}
error:
geom_deletetree(&mesh);
return (ret);
}
/*
* Given a list of directories to search, find all pools stored on disk. This
* includes partial pools which are not available to import. If no args are
* given (argc is 0), then the default directory (/dev/dsk) is searched.
* poolname or guid (but not both) are provided by the caller when trying
* to import a specific pool.
*/
static nvlist_t *
zpool_find_import_impl(libzfs_handle_t *hdl, int argc, char **argv,
boolean_t active_ok, char *poolname, uint64_t guid)
{
int i;
DIR *dirp = NULL;
struct dirent64 *dp;
char path[MAXPATHLEN];
char *end;
size_t pathleft;
struct stat64 statbuf;
nvlist_t *ret = NULL, *config;
static char *default_dir = "/dev/dsk";
int fd;
pool_list_t pools = { 0 };
pool_entry_t *pe, *penext;
vdev_entry_t *ve, *venext;
config_entry_t *ce, *cenext;
name_entry_t *ne, *nenext;
verify(poolname == NULL || guid == 0);
if (argc == 0) {
argc = 1;
argv = &default_dir;
}
/*
* Go through and read the label configuration information from every
* possible device, organizing the information according to pool GUID
* and toplevel GUID.
*/
for (i = 0; i < argc; i++) {
char *rdsk;
int dfd;
/* use realpath to normalize the path */
if (realpath(argv[i], path) == 0) {
(void) zfs_error_fmt(hdl, EZFS_BADPATH,
dgettext(TEXT_DOMAIN, "cannot open '%s'"),
argv[i]);
goto error;
}
end = &path[strlen(path)];
*end++ = '/';
*end = 0;
pathleft = &path[sizeof (path)] - end;
if (strcmp(argv[i], default_dir) == 0) {
geom_find_import(hdl, &pools);
continue;
}
/*
* Using raw devices instead of block devices when we're
* reading the labels skips a bunch of slow operations during
* close(2) processing, so we replace /dev/dsk with /dev/rdsk.
*/
if (strcmp(path, "/dev/dsk/") == 0)
rdsk = "/dev/rdsk/";
else
rdsk = path;
if ((dirp = opendir(rdsk)) == NULL) {
zfs_error_aux(hdl, strerror(errno));
(void) zfs_error_fmt(hdl, EZFS_BADPATH,
dgettext(TEXT_DOMAIN, "cannot open '%s'"),
rdsk);
goto error;
}
/*
* This is not MT-safe, but we have no MT consumers of libzfs
*/
while ((dp = readdir64(dirp)) != NULL) {
const char *name = dp->d_name;
if (name[0] == '.' &&
(name[1] == 0 || (name[1] == '.' && name[2] == 0)))
continue;
(void) snprintf(path, sizeof (path), "%s/%s", rdsk,
dp->d_name);
if ((fd = open64(path, O_RDONLY)) < 0)
continue;
/*
* Ignore failed stats. We only want regular
* files, character devs and block devs.
*/
if (fstat64(fd, &statbuf) != 0 ||
(!S_ISREG(statbuf.st_mode) &&
!S_ISCHR(statbuf.st_mode) &&
!S_ISBLK(statbuf.st_mode))) {
(void) close(fd);
continue;
}
if ((zpool_read_label(fd, &config)) != 0) {
(void) close(fd);
(void) no_memory(hdl);
goto error;
}
(void) close(fd);
if (config != NULL) {
boolean_t matched = B_TRUE;
if (poolname != NULL) {
char *pname;
matched = nvlist_lookup_string(config,
ZPOOL_CONFIG_POOL_NAME,
&pname) == 0 &&
strcmp(poolname, pname) == 0;
} else if (guid != 0) {
uint64_t this_guid;
matched = nvlist_lookup_uint64(config,
ZPOOL_CONFIG_POOL_GUID,
&this_guid) == 0 &&
guid == this_guid;
}
if (!matched) {
nvlist_free(config);
config = NULL;
continue;
}
/* use the non-raw path for the config */
(void) strlcpy(end, name, pathleft);
if (add_config(hdl, &pools, path, config) != 0)
goto error;
}
}
(void) closedir(dirp);
dirp = NULL;
}
geom_deletetree(&mesh);
ret = get_configs(hdl, &pools);
ret = get_configs(hdl, &pools, active_ok);
error:
for (pe = pools.pools; pe != NULL; pe = penext) {
@@ -823,9 +1001,158 @@ error:
free(ne);
}
if (dirp)
(void) closedir(dirp);
return (ret);
}
nvlist_t *
zpool_find_import(libzfs_handle_t *hdl, int argc, char **argv)
{
return (zpool_find_import_impl(hdl, argc, argv, B_FALSE, NULL, 0));
}
nvlist_t *
zpool_find_import_byname(libzfs_handle_t *hdl, int argc, char **argv,
char *pool)
{
return (zpool_find_import_impl(hdl, argc, argv, B_FALSE, pool, 0));
}
nvlist_t *
zpool_find_import_byguid(libzfs_handle_t *hdl, int argc, char **argv,
uint64_t guid)
{
return (zpool_find_import_impl(hdl, argc, argv, B_FALSE, NULL, guid));
}
nvlist_t *
zpool_find_import_activeok(libzfs_handle_t *hdl, int argc, char **argv)
{
return (zpool_find_import_impl(hdl, argc, argv, B_TRUE, NULL, 0));
}
/*
* Given a cache file, return the contents as a list of importable pools.
* poolname or guid (but not both) are provided by the caller when trying
* to import a specific pool.
*/
nvlist_t *
zpool_find_import_cached(libzfs_handle_t *hdl, const char *cachefile,
char *poolname, uint64_t guid)
{
char *buf;
int fd;
struct stat64 statbuf;
nvlist_t *raw, *src, *dst;
nvlist_t *pools;
nvpair_t *elem;
char *name;
uint64_t this_guid;
boolean_t active;
verify(poolname == NULL || guid == 0);
if ((fd = open(cachefile, O_RDONLY)) < 0) {
zfs_error_aux(hdl, "%s", strerror(errno));
(void) zfs_error(hdl, EZFS_BADCACHE,
dgettext(TEXT_DOMAIN, "failed to open cache file"));
return (NULL);
}
if (fstat64(fd, &statbuf) != 0) {
zfs_error_aux(hdl, "%s", strerror(errno));
(void) close(fd);
(void) zfs_error(hdl, EZFS_BADCACHE,
dgettext(TEXT_DOMAIN, "failed to get size of cache file"));
return (NULL);
}
if ((buf = zfs_alloc(hdl, statbuf.st_size)) == NULL) {
(void) close(fd);
return (NULL);
}
if (read(fd, buf, statbuf.st_size) != statbuf.st_size) {
(void) close(fd);
free(buf);
(void) zfs_error(hdl, EZFS_BADCACHE,
dgettext(TEXT_DOMAIN,
"failed to read cache file contents"));
return (NULL);
}
(void) close(fd);
if (nvlist_unpack(buf, statbuf.st_size, &raw, 0) != 0) {
free(buf);
(void) zfs_error(hdl, EZFS_BADCACHE,
dgettext(TEXT_DOMAIN,
"invalid or corrupt cache file contents"));
return (NULL);
}
free(buf);
/*
* Go through and get the current state of the pools and refresh their
* state.
*/
if (nvlist_alloc(&pools, 0, 0) != 0) {
(void) no_memory(hdl);
nvlist_free(raw);
return (NULL);
}
elem = NULL;
while ((elem = nvlist_next_nvpair(raw, elem)) != NULL) {
verify(nvpair_value_nvlist(elem, &src) == 0);
verify(nvlist_lookup_string(src, ZPOOL_CONFIG_POOL_NAME,
&name) == 0);
if (poolname != NULL && strcmp(poolname, name) != 0)
continue;
verify(nvlist_lookup_uint64(src, ZPOOL_CONFIG_POOL_GUID,
&this_guid) == 0);
if (guid != 0) {
verify(nvlist_lookup_uint64(src, ZPOOL_CONFIG_POOL_GUID,
&this_guid) == 0);
if (guid != this_guid)
continue;
}
if (pool_active(hdl, name, this_guid, &active) != 0) {
nvlist_free(raw);
nvlist_free(pools);
return (NULL);
}
if (active)
continue;
if ((dst = refresh_config(hdl, src)) == NULL) {
nvlist_free(raw);
nvlist_free(pools);
return (NULL);
}
if (nvlist_add_nvlist(pools, nvpair_name(elem), dst) != 0) {
(void) no_memory(hdl);
nvlist_free(dst);
nvlist_free(raw);
nvlist_free(pools);
return (NULL);
}
nvlist_free(dst);
}
nvlist_free(raw);
return (pools);
}
boolean_t
find_guid(nvlist_t *nv, uint64_t guid)
{
@@ -847,27 +1174,28 @@ find_guid(nvlist_t *nv, uint64_t guid)
return (B_FALSE);
}
typedef struct spare_cbdata {
typedef struct aux_cbdata {
const char *cb_type;
uint64_t cb_guid;
zpool_handle_t *cb_zhp;
} spare_cbdata_t;
} aux_cbdata_t;
static int
find_spare(zpool_handle_t *zhp, void *data)
find_aux(zpool_handle_t *zhp, void *data)
{
spare_cbdata_t *cbp = data;
nvlist_t **spares;
uint_t i, nspares;
aux_cbdata_t *cbp = data;
nvlist_t **list;
uint_t i, count;
uint64_t guid;
nvlist_t *nvroot;
verify(nvlist_lookup_nvlist(zhp->zpool_config, ZPOOL_CONFIG_VDEV_TREE,
&nvroot) == 0);
if (nvlist_lookup_nvlist_array(nvroot, ZPOOL_CONFIG_SPARES,
&spares, &nspares) == 0) {
for (i = 0; i < nspares; i++) {
verify(nvlist_lookup_uint64(spares[i],
if (nvlist_lookup_nvlist_array(nvroot, cbp->cb_type,
&list, &count) == 0) {
for (i = 0; i < count; i++) {
verify(nvlist_lookup_uint64(list[i],
ZPOOL_CONFIG_GUID, &guid) == 0);
if (guid == cbp->cb_guid) {
cbp->cb_zhp = zhp;
@@ -896,7 +1224,7 @@ zpool_in_use(libzfs_handle_t *hdl, int fd, pool_state_t *state, char **namestr,
zpool_handle_t *zhp;
nvlist_t *pool_config;
uint64_t stateval, isspare;
spare_cbdata_t cb = { 0 };
aux_cbdata_t cb = { 0 };
boolean_t isactive;
*inuse = B_FALSE;
@@ -914,7 +1242,7 @@ zpool_in_use(libzfs_handle_t *hdl, int fd, pool_state_t *state, char **namestr,
verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_GUID,
&vdev_guid) == 0);
if (stateval != POOL_STATE_SPARE) {
if (stateval != POOL_STATE_SPARE && stateval != POOL_STATE_L2CACHE) {
verify(nvlist_lookup_string(config, ZPOOL_CONFIG_POOL_NAME,
&name) == 0);
verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_GUID,
@@ -993,7 +1321,24 @@ zpool_in_use(libzfs_handle_t *hdl, int fd, pool_state_t *state, char **namestr,
*/
cb.cb_zhp = NULL;
cb.cb_guid = vdev_guid;
if (zpool_iter(hdl, find_spare, &cb) == 1) {
cb.cb_type = ZPOOL_CONFIG_SPARES;
if (zpool_iter(hdl, find_aux, &cb) == 1) {
name = (char *)zpool_get_name(cb.cb_zhp);
ret = TRUE;
} else {
ret = FALSE;
}
break;
case POOL_STATE_L2CACHE:
/*
* Check if any pool is currently using this l2cache device.
*/
cb.cb_zhp = NULL;
cb.cb_guid = vdev_guid;
cb.cb_type = ZPOOL_CONFIG_L2CACHE;
if (zpool_iter(hdl, find_aux, &cb) == 1) {
name = (char *)zpool_get_name(cb.cb_zhp);
ret = TRUE;
} else {
@@ -1008,6 +1353,8 @@ zpool_in_use(libzfs_handle_t *hdl, int fd, pool_state_t *state, char **namestr,
if (ret) {
if ((*namestr = zfs_strdup(hdl, name)) == NULL) {
if (cb.cb_zhp)
zpool_close(cb.cb_zhp);
nvlist_free(config);
return (-1);
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -19,18 +19,16 @@
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* This file contains the functions which analyze the status of a pool. This
* include both the status of an active pool, as well as the status exported
* pools. Returns one of the ZPOOL_STATUS_* defines describing the status of
* the pool. This status is independent (to a certain degree) from the state of
* the pool. A pool's state descsribes only whether or not it is capable of
* the pool. A pool's state describes only whether or not it is capable of
* providing the necessary fault tolerance for data. The status describes the
* overall status of devices. A pool that is online can still have a device
* that is experiencing errors.
@@ -47,7 +45,7 @@
#include "libzfs_impl.h"
/*
* Message ID table. This must be kep in sync with the ZPOOL_STATUS_* defines
* Message ID table. This must be kept in sync with the ZPOOL_STATUS_* defines
* in libzfs.h. Note that there are some status results which go past the end
* of this table, and hence have no associated message ID.
*/
@@ -62,26 +60,10 @@ static char *zfs_msgid_table[] = {
"ZFS-8000-8A",
"ZFS-8000-9P",
"ZFS-8000-A5",
"ZFS-8000-EY"
};
/*
* If the pool is active, a certain class of static errors is overridden by the
* faults as analayzed by FMA. These faults have separate knowledge articles,
* and the article referred to by 'zpool status' must match that indicated by
* the syslog error message. We override missing data as well as corrupt pool.
*/
static char *zfs_msgid_table_active[] = {
"ZFS-8000-14",
"ZFS-8000-D3", /* overridden */
"ZFS-8000-D3", /* overridden */
"ZFS-8000-4J",
"ZFS-8000-5E",
"ZFS-8000-6X",
"ZFS-8000-CS", /* overridden */
"ZFS-8000-8A",
"ZFS-8000-9P",
"ZFS-8000-CS", /* overridden */
"ZFS-8000-EY",
"ZFS-8000-HC",
"ZFS-8000-JQ",
"ZFS-8000-K4",
};
#define NMSGID (sizeof (zfs_msgid_table) / sizeof (zfs_msgid_table[0]))
@@ -94,11 +76,18 @@ vdev_missing(uint64_t state, uint64_t aux, uint64_t errs)
aux == VDEV_AUX_OPEN_FAILED);
}
/* ARGSUSED */
static int
vdev_faulted(uint64_t state, uint64_t aux, uint64_t errs)
{
return (state == VDEV_STATE_FAULTED);
}
/* ARGSUSED */
static int
vdev_errors(uint64_t state, uint64_t aux, uint64_t errs)
{
return (errs != 0);
return (state == VDEV_STATE_DEGRADED || errs != 0);
}
/* ARGSUSED */
@@ -163,9 +152,9 @@ find_vdev_problem(nvlist_t *vdev, int (*func)(uint64_t, uint64_t, uint64_t))
* following:
*
* - Check for a complete and valid configuration
* - Look for any missing devices in a non-replicated config
* - Look for any faulted or missing devices in a non-replicated config
* - Check for any data errors
* - Check for any missing devices in a replicated config
* - Check for any faulted or missing devices in a replicated config
* - Look for any devices showing errors
* - Check for any resilvering devices
*
@@ -181,6 +170,7 @@ check_status(nvlist_t *config, boolean_t isimport)
uint64_t nerr;
uint64_t version;
uint64_t stateval;
uint64_t suspended;
uint64_t hostid = 0;
verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_VERSION,
@@ -215,8 +205,30 @@ check_status(nvlist_t *config, boolean_t isimport)
return (ZPOOL_STATUS_BAD_GUID_SUM);
/*
* Missing devices in non-replicated config.
* Check whether the pool has suspended due to failed I/O.
*/
if (nvlist_lookup_uint64(config, ZPOOL_CONFIG_SUSPENDED,
&suspended) == 0) {
if (suspended == ZIO_FAILURE_MODE_CONTINUE)
return (ZPOOL_STATUS_IO_FAILURE_CONTINUE);
return (ZPOOL_STATUS_IO_FAILURE_WAIT);
}
/*
* Could not read a log.
*/
if (vs->vs_state == VDEV_STATE_CANT_OPEN &&
vs->vs_aux == VDEV_AUX_BAD_LOG) {
return (ZPOOL_STATUS_BAD_LOG);
}
/*
* Bad devices in non-replicated config.
*/
if (vs->vs_state == VDEV_STATE_CANT_OPEN &&
find_vdev_problem(nvroot, vdev_faulted))
return (ZPOOL_STATUS_FAULTED_DEV_NR);
if (vs->vs_state == VDEV_STATE_CANT_OPEN &&
find_vdev_problem(nvroot, vdev_missing))
return (ZPOOL_STATUS_MISSING_DEV_NR);
@@ -244,6 +256,8 @@ check_status(nvlist_t *config, boolean_t isimport)
/*
* Missing devices in a replicated config.
*/
if (find_vdev_problem(nvroot, vdev_faulted))
return (ZPOOL_STATUS_FAULTED_DEV_R);
if (find_vdev_problem(nvroot, vdev_missing))
return (ZPOOL_STATUS_MISSING_DEV_R);
if (find_vdev_problem(nvroot, vdev_broken))
@@ -270,7 +284,7 @@ check_status(nvlist_t *config, boolean_t isimport)
/*
* Outdated, but usable, version
*/
if (version < ZFS_VERSION)
if (version < SPA_VERSION)
return (ZPOOL_STATUS_VERSION_OLDER);
return (ZPOOL_STATUS_OK);
@@ -284,7 +298,7 @@ zpool_get_status(zpool_handle_t *zhp, char **msgid)
if (ret >= NMSGID)
*msgid = NULL;
else
*msgid = zfs_msgid_table_active[ret];
*msgid = zfs_msgid_table[ret];
return (ret);
}
@@ -19,12 +19,10 @@
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Internal utility routines for the ZFS library.
*/
@@ -37,6 +35,8 @@
#include <stdlib.h>
#include <strings.h>
#include <unistd.h>
#include <ctype.h>
#include <math.h>
#include <sys/mnttab.h>
#include <sys/mntent.h>
#include <sys/types.h>
@@ -44,6 +44,7 @@
#include <libzfs.h>
#include "libzfs_impl.h"
#include "zfs_prop.h"
int
libzfs_errno(libzfs_handle_t *hdl)
@@ -133,6 +134,14 @@ libzfs_error_description(libzfs_handle_t *hdl)
return (dgettext(TEXT_DOMAIN, "unshare(1M) failed"));
case EZFS_SHARENFSFAILED:
return (dgettext(TEXT_DOMAIN, "share(1M) failed"));
case EZFS_UNSHARESMBFAILED:
return (dgettext(TEXT_DOMAIN, "smb remove share failed"));
case EZFS_SHARESMBFAILED:
return (dgettext(TEXT_DOMAIN, "smb add share failed"));
case EZFS_ISCSISVCUNAVAIL:
return (dgettext(TEXT_DOMAIN,
"iscsitgt service need to be enabled by "
"a privileged user"));
case EZFS_DEVLINKS:
return (dgettext(TEXT_DOMAIN, "failed to create /dev links"));
case EZFS_PERM:
@@ -169,6 +178,38 @@ libzfs_error_description(libzfs_handle_t *hdl)
"this pool operation"));
case EZFS_NAMETOOLONG:
return (dgettext(TEXT_DOMAIN, "dataset name is too long"));
case EZFS_OPENFAILED:
return (dgettext(TEXT_DOMAIN, "open failed"));
case EZFS_NOCAP:
return (dgettext(TEXT_DOMAIN,
"disk capacity information could not be retrieved"));
case EZFS_LABELFAILED:
return (dgettext(TEXT_DOMAIN, "write of label failed"));
case EZFS_BADWHO:
return (dgettext(TEXT_DOMAIN, "invalid user/group"));
case EZFS_BADPERM:
return (dgettext(TEXT_DOMAIN, "invalid permission"));
case EZFS_BADPERMSET:
return (dgettext(TEXT_DOMAIN, "invalid permission set name"));
case EZFS_NODELEGATION:
return (dgettext(TEXT_DOMAIN, "delegated administration is "
"disabled on pool"));
case EZFS_PERMRDONLY:
return (dgettext(TEXT_DOMAIN, "snapshot permissions cannot be"
" modified"));
case EZFS_BADCACHE:
return (dgettext(TEXT_DOMAIN, "invalid or missing cache file"));
case EZFS_ISL2CACHE:
return (dgettext(TEXT_DOMAIN, "device is in use as a cache"));
case EZFS_VDEVNOTSUP:
return (dgettext(TEXT_DOMAIN, "vdev specification is not "
"supported"));
case EZFS_NOTSUP:
return (dgettext(TEXT_DOMAIN, "operation not supported "
"on this dataset"));
case EZFS_ACTIVE_SPARE:
return (dgettext(TEXT_DOMAIN, "pool has active shared spare "
"device"));
case EZFS_UNKNOWN:
return (dgettext(TEXT_DOMAIN, "unknown error"));
default:
@@ -249,6 +290,10 @@ zfs_common_error(libzfs_handle_t *hdl, int error, const char *fmt,
zfs_verror(hdl, EZFS_PERM, fmt, ap);
return (-1);
case ECANCELED:
zfs_verror(hdl, EZFS_NODELEGATION, fmt, ap);
return (-1);
case EIO:
zfs_verror(hdl, EZFS_IO, fmt, ap);
return (-1);
@@ -280,9 +325,9 @@ zfs_standard_error_fmt(libzfs_handle_t *hdl, int error, const char *fmt, ...)
return (-1);
}
switch (error) {
case ENXIO:
case ENODEV:
zfs_verror(hdl, EZFS_IO, fmt, ap);
break;
@@ -308,11 +353,17 @@ zfs_standard_error_fmt(libzfs_handle_t *hdl, int error, const char *fmt, ...)
"dataset is busy"));
zfs_verror(hdl, EZFS_BUSY, fmt, ap);
break;
case EROFS:
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"snapshot permissions cannot be modified"));
zfs_verror(hdl, EZFS_PERMRDONLY, fmt, ap);
break;
case ENAMETOOLONG:
zfs_verror(hdl, EZFS_NAMETOOLONG, fmt, ap);
break;
case ENOTSUP:
zfs_verror(hdl, EZFS_BADVERSION, fmt, ap);
break;
default:
zfs_error_aux(hdl, strerror(errno));
zfs_verror(hdl, EZFS_UNKNOWN, fmt, ap);
@@ -361,7 +412,7 @@ zpool_standard_error_fmt(libzfs_handle_t *hdl, int error, const char *fmt, ...)
case EBUSY:
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "pool is busy"));
zfs_verror(hdl, EZFS_EXISTS, fmt, ap);
zfs_verror(hdl, EZFS_BUSY, fmt, ap);
break;
case ENXIO:
@@ -382,6 +433,11 @@ zpool_standard_error_fmt(libzfs_handle_t *hdl, int error, const char *fmt, ...)
zfs_verror(hdl, EZFS_POOL_INVALARG, fmt, ap);
break;
case ENOSPC:
case EDQUOT:
zfs_verror(hdl, EZFS_NOSPC, fmt, ap);
return (-1);
default:
zfs_error_aux(hdl, strerror(error));
zfs_verror(hdl, EZFS_UNKNOWN, fmt, ap);
@@ -483,9 +539,8 @@ zfs_nicenum(uint64_t num, char *buf, size_t buflen)
*/
int i;
for (i = 2; i >= 0; i--) {
(void) snprintf(buf, buflen, "%.*f%c", i,
(double)num / (1ULL << 10 * index), u);
if (strlen(buf) <= 5)
if (snprintf(buf, buflen, "%.*f%c", i,
(double)num / (1ULL << 10 * index), u) <= 5)
break;
}
}
@@ -538,6 +593,9 @@ libzfs_init(void)
hdl->libzfs_sharetab = fopen(ZFS_EXPORTS_PATH, "r");
zfs_prop_init();
zpool_prop_init();
return (hdl);
}
@@ -549,6 +607,10 @@ libzfs_fini(libzfs_handle_t *hdl)
(void) fclose(hdl->libzfs_mnttab);
if (hdl->libzfs_sharetab)
(void) fclose(hdl->libzfs_sharetab);
zfs_uninit_libshare(hdl);
if (hdl->libzfs_log_str)
(void) free(hdl->libzfs_log_str);
zpool_free_handles(hdl);
namespace_clear(hdl);
free(hdl);
}
@@ -565,6 +627,12 @@ zfs_get_handle(zfs_handle_t *zhp)
return (zhp->zfs_hdl);
}
zpool_handle_t *
zfs_get_pool_handle(const zfs_handle_t *zhp)
{
return (zhp->zpool_hdl);
}
/*
* Given a name, determine whether or not it's a valid path
* (starts with '/' or "./"). If so, walk the mnttab trying
@@ -637,13 +705,14 @@ zcmd_expand_dst_nvlist(libzfs_handle_t *hdl, zfs_cmd_t *zc)
void
zcmd_free_nvlists(zfs_cmd_t *zc)
{
free((void *)(uintptr_t)zc->zc_nvlist_conf);
free((void *)(uintptr_t)zc->zc_nvlist_src);
free((void *)(uintptr_t)zc->zc_nvlist_dst);
}
int
zcmd_write_src_nvlist(libzfs_handle_t *hdl, zfs_cmd_t *zc, nvlist_t *nvl,
size_t *size)
static int
zcmd_write_nvlist_com(libzfs_handle_t *hdl, uint64_t *outnv, uint64_t *outlen,
nvlist_t *nvl)
{
char *packed;
size_t len;
@@ -655,14 +724,26 @@ zcmd_write_src_nvlist(libzfs_handle_t *hdl, zfs_cmd_t *zc, nvlist_t *nvl,
verify(nvlist_pack(nvl, &packed, &len, NV_ENCODE_NATIVE, 0) == 0);
zc->zc_nvlist_src = (uint64_t)(uintptr_t)packed;
zc->zc_nvlist_src_size = len;
*outnv = (uint64_t)(uintptr_t)packed;
*outlen = len;
if (size)
*size = len;
return (0);
}
int
zcmd_write_conf_nvlist(libzfs_handle_t *hdl, zfs_cmd_t *zc, nvlist_t *nvl)
{
return (zcmd_write_nvlist_com(hdl, &zc->zc_nvlist_conf,
&zc->zc_nvlist_conf_size, nvl));
}
int
zcmd_write_src_nvlist(libzfs_handle_t *hdl, zfs_cmd_t *zc, nvlist_t *nvl)
{
return (zcmd_write_nvlist_com(hdl, &zc->zc_nvlist_src,
&zc->zc_nvlist_src_size, nvl));
}
/*
* Unpacks an nvlist from the ZFS ioctl command structure.
*/
@@ -676,10 +757,32 @@ zcmd_read_dst_nvlist(libzfs_handle_t *hdl, zfs_cmd_t *zc, nvlist_t **nvlp)
return (0);
}
static void
zfs_print_prop_headers(libzfs_get_cbdata_t *cbp)
int
zfs_ioctl(libzfs_handle_t *hdl, unsigned long request, zfs_cmd_t *zc)
{
zfs_proplist_t *pl = cbp->cb_proplist;
int error;
zc->zc_history = (uint64_t)(uintptr_t)hdl->libzfs_log_str;
error = ioctl(hdl->libzfs_fd, request, zc);
if (hdl->libzfs_log_str) {
free(hdl->libzfs_log_str);
hdl->libzfs_log_str = NULL;
}
zc->zc_history = 0;
return (error);
}
/*
* ================================================================
* API shared by zfs and zpool property management
* ================================================================
*/
static void
zprop_print_headers(zprop_get_cbdata_t *cbp, zfs_type_t type)
{
zprop_list_t *pl = cbp->cb_proplist;
int i;
char *title;
size_t len;
@@ -711,8 +814,12 @@ zfs_print_prop_headers(libzfs_get_cbdata_t *cbp)
/*
* 'PROPERTY' column
*/
if (pl->pl_prop != ZFS_PROP_INVAL) {
len = strlen(zfs_prop_to_name(pl->pl_prop));
if (pl->pl_prop != ZPROP_INVAL) {
const char *propname = (type == ZFS_TYPE_POOL) ?
zpool_prop_to_name(pl->pl_prop) :
zfs_prop_to_name(pl->pl_prop);
len = strlen(propname);
if (len > cbp->cb_colwidths[GET_COL_PROPERTY])
cbp->cb_colwidths[GET_COL_PROPERTY] = len;
} else {
@@ -731,7 +838,8 @@ zfs_print_prop_headers(libzfs_get_cbdata_t *cbp)
/*
* 'NAME' and 'SOURCE' columns
*/
if (pl->pl_prop == ZFS_PROP_NAME &&
if (pl->pl_prop == (type == ZFS_TYPE_POOL ? ZPOOL_PROP_NAME :
ZFS_PROP_NAME) &&
pl->pl_width > cbp->cb_colwidths[GET_COL_NAME]) {
cbp->cb_colwidths[GET_COL_NAME] = pl->pl_width;
cbp->cb_colwidths[GET_COL_SOURCE] = pl->pl_width +
@@ -777,8 +885,8 @@ zfs_print_prop_headers(libzfs_get_cbdata_t *cbp)
* structure.
*/
void
libzfs_print_one_property(const char *name, libzfs_get_cbdata_t *cbp,
const char *propname, const char *value, zfs_source_t sourcetype,
zprop_print_one_property(const char *name, zprop_get_cbdata_t *cbp,
const char *propname, const char *value, zprop_source_t sourcetype,
const char *source)
{
int i;
@@ -792,7 +900,7 @@ libzfs_print_one_property(const char *name, libzfs_get_cbdata_t *cbp,
return;
if (cbp->cb_first)
zfs_print_prop_headers(cbp);
zprop_print_headers(cbp, cbp->cb_type);
for (i = 0; i < 4; i++) {
switch (cbp->cb_columns[i]) {
@@ -810,23 +918,23 @@ libzfs_print_one_property(const char *name, libzfs_get_cbdata_t *cbp,
case GET_COL_SOURCE:
switch (sourcetype) {
case ZFS_SRC_NONE:
case ZPROP_SRC_NONE:
str = "-";
break;
case ZFS_SRC_DEFAULT:
case ZPROP_SRC_DEFAULT:
str = "default";
break;
case ZFS_SRC_LOCAL:
case ZPROP_SRC_LOCAL:
str = "local";
break;
case ZFS_SRC_TEMPORARY:
case ZPROP_SRC_TEMPORARY:
str = "temporary";
break;
case ZFS_SRC_INHERITED:
case ZPROP_SRC_INHERITED:
(void) snprintf(buf, sizeof (buf),
"inherited from %s", source);
str = buf;
@@ -851,3 +959,451 @@ libzfs_print_one_property(const char *name, libzfs_get_cbdata_t *cbp,
(void) printf("\n");
}
/*
* Given a numeric suffix, convert the value into a number of bits that the
* resulting value must be shifted.
*/
static int
str2shift(libzfs_handle_t *hdl, const char *buf)
{
const char *ends = "BKMGTPEZ";
int i;
if (buf[0] == '\0')
return (0);
for (i = 0; i < strlen(ends); i++) {
if (toupper(buf[0]) == ends[i])
break;
}
if (i == strlen(ends)) {
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"invalid numeric suffix '%s'"), buf);
return (-1);
}
/*
* We want to allow trailing 'b' characters for 'GB' or 'Mb'. But don't
* allow 'BB' - that's just weird.
*/
if (buf[1] == '\0' || (toupper(buf[1]) == 'B' && buf[2] == '\0' &&
toupper(buf[0]) != 'B'))
return (10*i);
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"invalid numeric suffix '%s'"), buf);
return (-1);
}
/*
* Convert a string of the form '100G' into a real number. Used when setting
* properties or creating a volume. 'buf' is used to place an extended error
* message for the caller to use.
*/
int
zfs_nicestrtonum(libzfs_handle_t *hdl, const char *value, uint64_t *num)
{
char *end;
int shift;
*num = 0;
/* Check to see if this looks like a number. */
if ((value[0] < '0' || value[0] > '9') && value[0] != '.') {
if (hdl)
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"bad numeric value '%s'"), value);
return (-1);
}
/* Rely on stroll() to process the numeric portion. */
errno = 0;
*num = strtoll(value, &end, 10);
/*
* Check for ERANGE, which indicates that the value is too large to fit
* in a 64-bit value.
*/
if (errno == ERANGE) {
if (hdl)
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"numeric value is too large"));
return (-1);
}
/*
* If we have a decimal value, then do the computation with floating
* point arithmetic. Otherwise, use standard arithmetic.
*/
if (*end == '.') {
double fval = strtod(value, &end);
if ((shift = str2shift(hdl, end)) == -1)
return (-1);
fval *= pow(2, shift);
if (fval > UINT64_MAX) {
if (hdl)
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"numeric value is too large"));
return (-1);
}
*num = (uint64_t)fval;
} else {
if ((shift = str2shift(hdl, end)) == -1)
return (-1);
/* Check for overflow */
if (shift >= 64 || (*num << shift) >> shift != *num) {
if (hdl)
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"numeric value is too large"));
return (-1);
}
*num <<= shift;
}
return (0);
}
/*
* Given a propname=value nvpair to set, parse any numeric properties
* (index, boolean, etc) if they are specified as strings and add the
* resulting nvpair to the returned nvlist.
*
* At the DSL layer, all properties are either 64-bit numbers or strings.
* We want the user to be able to ignore this fact and specify properties
* as native values (numbers, for example) or as strings (to simplify
* command line utilities). This also handles converting index types
* (compression, checksum, etc) from strings to their on-disk index.
*/
int
zprop_parse_value(libzfs_handle_t *hdl, nvpair_t *elem, int prop,
zfs_type_t type, nvlist_t *ret, char **svalp, uint64_t *ivalp,
const char *errbuf)
{
data_type_t datatype = nvpair_type(elem);
zprop_type_t proptype;
const char *propname;
char *value;
boolean_t isnone = B_FALSE;
if (type == ZFS_TYPE_POOL) {
proptype = zpool_prop_get_type(prop);
propname = zpool_prop_to_name(prop);
} else {
proptype = zfs_prop_get_type(prop);
propname = zfs_prop_to_name(prop);
}
/*
* Convert any properties to the internal DSL value types.
*/
*svalp = NULL;
*ivalp = 0;
switch (proptype) {
case PROP_TYPE_STRING:
if (datatype != DATA_TYPE_STRING) {
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"'%s' must be a string"), nvpair_name(elem));
goto error;
}
(void) nvpair_value_string(elem, svalp);
if (strlen(*svalp) >= ZFS_MAXPROPLEN) {
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"'%s' is too long"), nvpair_name(elem));
goto error;
}
break;
case PROP_TYPE_NUMBER:
if (datatype == DATA_TYPE_STRING) {
(void) nvpair_value_string(elem, &value);
if (strcmp(value, "none") == 0) {
isnone = B_TRUE;
} else if (zfs_nicestrtonum(hdl, value, ivalp)
!= 0) {
goto error;
}
} else if (datatype == DATA_TYPE_UINT64) {
(void) nvpair_value_uint64(elem, ivalp);
} else {
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"'%s' must be a number"), nvpair_name(elem));
goto error;
}
/*
* Quota special: force 'none' and don't allow 0.
*/
if ((type & ZFS_TYPE_DATASET) && *ivalp == 0 && !isnone &&
(prop == ZFS_PROP_QUOTA || prop == ZFS_PROP_REFQUOTA)) {
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"use 'none' to disable quota/refquota"));
goto error;
}
break;
case PROP_TYPE_INDEX:
if (datatype != DATA_TYPE_STRING) {
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"'%s' must be a string"), nvpair_name(elem));
goto error;
}
(void) nvpair_value_string(elem, &value);
if (zprop_string_to_index(prop, value, ivalp, type) != 0) {
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"'%s' must be one of '%s'"), propname,
zprop_values(prop, type));
goto error;
}
break;
default:
abort();
}
/*
* Add the result to our return set of properties.
*/
if (*svalp != NULL) {
if (nvlist_add_string(ret, propname, *svalp) != 0) {
(void) no_memory(hdl);
return (-1);
}
} else {
if (nvlist_add_uint64(ret, propname, *ivalp) != 0) {
(void) no_memory(hdl);
return (-1);
}
}
return (0);
error:
(void) zfs_error(hdl, EZFS_BADPROP, errbuf);
return (-1);
}
static int
addlist(libzfs_handle_t *hdl, char *propname, zprop_list_t **listp,
zfs_type_t type)
{
int prop;
zprop_list_t *entry;
prop = zprop_name_to_prop(propname, type);
if (prop != ZPROP_INVAL && !zprop_valid_for_type(prop, type))
prop = ZPROP_INVAL;
/*
* When no property table entry can be found, return failure if
* this is a pool property or if this isn't a user-defined
* dataset property,
*/
if (prop == ZPROP_INVAL && (type == ZFS_TYPE_POOL ||
!zfs_prop_user(propname))) {
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"invalid property '%s'"), propname);
return (zfs_error(hdl, EZFS_BADPROP,
dgettext(TEXT_DOMAIN, "bad property list")));
}
if ((entry = zfs_alloc(hdl, sizeof (zprop_list_t))) == NULL)
return (-1);
entry->pl_prop = prop;
if (prop == ZPROP_INVAL) {
if ((entry->pl_user_prop = zfs_strdup(hdl, propname)) == NULL) {
free(entry);
return (-1);
}
entry->pl_width = strlen(propname);
} else {
entry->pl_width = zprop_width(prop, &entry->pl_fixed,
type);
}
*listp = entry;
return (0);
}
/*
* Given a comma-separated list of properties, construct a property list
* containing both user-defined and native properties. This function will
* return a NULL list if 'all' is specified, which can later be expanded
* by zprop_expand_list().
*/
int
zprop_get_list(libzfs_handle_t *hdl, char *props, zprop_list_t **listp,
zfs_type_t type)
{
*listp = NULL;
/*
* If 'all' is specified, return a NULL list.
*/
if (strcmp(props, "all") == 0)
return (0);
/*
* If no props were specified, return an error.
*/
if (props[0] == '\0') {
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"no properties specified"));
return (zfs_error(hdl, EZFS_BADPROP, dgettext(TEXT_DOMAIN,
"bad property list")));
}
/*
* It would be nice to use getsubopt() here, but the inclusion of column
* aliases makes this more effort than it's worth.
*/
while (*props != '\0') {
size_t len;
char *p;
char c;
if ((p = strchr(props, ',')) == NULL) {
len = strlen(props);
p = props + len;
} else {
len = p - props;
}
/*
* Check for empty options.
*/
if (len == 0) {
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"empty property name"));
return (zfs_error(hdl, EZFS_BADPROP,
dgettext(TEXT_DOMAIN, "bad property list")));
}
/*
* Check all regular property names.
*/
c = props[len];
props[len] = '\0';
if (strcmp(props, "space") == 0) {
static char *spaceprops[] = {
"name", "avail", "used", "usedbysnapshots",
"usedbydataset", "usedbyrefreservation",
"usedbychildren", NULL
};
int i;
for (i = 0; spaceprops[i]; i++) {
if (addlist(hdl, spaceprops[i], listp, type))
return (-1);
listp = &(*listp)->pl_next;
}
} else {
if (addlist(hdl, props, listp, type))
return (-1);
listp = &(*listp)->pl_next;
}
props = p;
if (c == ',')
props++;
}
return (0);
}
void
zprop_free_list(zprop_list_t *pl)
{
zprop_list_t *next;
while (pl != NULL) {
next = pl->pl_next;
free(pl->pl_user_prop);
free(pl);
pl = next;
}
}
typedef struct expand_data {
zprop_list_t **last;
libzfs_handle_t *hdl;
zfs_type_t type;
} expand_data_t;
int
zprop_expand_list_cb(int prop, void *cb)
{
zprop_list_t *entry;
expand_data_t *edp = cb;
if ((entry = zfs_alloc(edp->hdl, sizeof (zprop_list_t))) == NULL)
return (ZPROP_INVAL);
entry->pl_prop = prop;
entry->pl_width = zprop_width(prop, &entry->pl_fixed, edp->type);
entry->pl_all = B_TRUE;
*(edp->last) = entry;
edp->last = &entry->pl_next;
return (ZPROP_CONT);
}
int
zprop_expand_list(libzfs_handle_t *hdl, zprop_list_t **plp, zfs_type_t type)
{
zprop_list_t *entry;
zprop_list_t **last;
expand_data_t exp;
if (*plp == NULL) {
/*
* If this is the very first time we've been called for an 'all'
* specification, expand the list to include all native
* properties.
*/
last = plp;
exp.last = last;
exp.hdl = hdl;
exp.type = type;
if (zprop_iter_common(zprop_expand_list_cb, &exp, B_FALSE,
B_FALSE, type) == ZPROP_INVAL)
return (-1);
/*
* Add 'name' to the beginning of the list, which is handled
* specially.
*/
if ((entry = zfs_alloc(hdl, sizeof (zprop_list_t))) == NULL)
return (-1);
entry->pl_prop = (type == ZFS_TYPE_POOL) ? ZPOOL_PROP_NAME :
ZFS_PROP_NAME;
entry->pl_width = zprop_width(entry->pl_prop,
&entry->pl_fixed, type);
entry->pl_all = B_TRUE;
entry->pl_next = *plp;
*plp = entry;
}
return (0);
}
int
zprop_iter(zprop_func func, void *cb, boolean_t show_all, boolean_t ordered,
zfs_type_t type)
{
return (zprop_iter_common(func, cb, show_all, ordered, type));
}
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -101,20 +101,24 @@ void
zmutex_init(kmutex_t *mp)
{
mp->m_owner = NULL;
mp->initialized = B_TRUE;
(void) _mutex_init(&mp->m_lock, USYNC_THREAD, NULL);
}
void
zmutex_destroy(kmutex_t *mp)
{
ASSERT(mp->initialized == B_TRUE);
ASSERT(mp->m_owner == NULL);
(void) _mutex_destroy(&(mp)->m_lock);
mp->m_owner = (void *)-1UL;
mp->initialized = B_FALSE;
}
void
mutex_enter(kmutex_t *mp)
{
ASSERT(mp->initialized == B_TRUE);
ASSERT(mp->m_owner != (void *)-1UL);
ASSERT(mp->m_owner != curthread);
VERIFY(mutex_lock(&mp->m_lock) == 0);
@@ -125,6 +129,7 @@ mutex_enter(kmutex_t *mp)
int
mutex_tryenter(kmutex_t *mp)
{
ASSERT(mp->initialized == B_TRUE);
ASSERT(mp->m_owner != (void *)-1UL);
if (mutex_trylock(&mp->m_lock) == 0) {
ASSERT(mp->m_owner == NULL);
@@ -138,6 +143,7 @@ mutex_tryenter(kmutex_t *mp)
void
mutex_exit(kmutex_t *mp)
{
ASSERT(mp->initialized == B_TRUE);
ASSERT(mp->m_owner == curthread);
mp->m_owner = NULL;
VERIFY(mutex_unlock(&mp->m_lock) == 0);
@@ -146,6 +152,7 @@ mutex_exit(kmutex_t *mp)
void *
mutex_owner(kmutex_t *mp)
{
ASSERT(mp->initialized == B_TRUE);
return (mp->m_owner);
}
@@ -160,7 +167,7 @@ rw_init(krwlock_t *rwlp, char *name, int type, void *arg)
{
rwlock_init(&rwlp->rw_lock, USYNC_THREAD, NULL);
rwlp->rw_owner = NULL;
rwlp->rw_count = 0;
rwlp->initialized = B_TRUE;
}
void
@@ -168,22 +175,23 @@ rw_destroy(krwlock_t *rwlp)
{
rwlock_destroy(&rwlp->rw_lock);
rwlp->rw_owner = (void *)-1UL;
rwlp->rw_count = -2;
rwlp->initialized = B_FALSE;
}
void
rw_enter(krwlock_t *rwlp, krw_t rw)
{
//ASSERT(!RW_LOCK_HELD(rwlp));
ASSERT(rwlp->initialized == B_TRUE);
ASSERT(rwlp->rw_owner != (void *)-1UL);
ASSERT(rwlp->rw_owner != curthread);
if (rw == RW_READER) {
(void) rw_rdlock(&rwlp->rw_lock);
VERIFY(rw_rdlock(&rwlp->rw_lock) == 0);
ASSERT(rwlp->rw_count >= 0);
atomic_add_int(&rwlp->rw_count, 1);
} else {
(void) rw_wrlock(&rwlp->rw_lock);
VERIFY(rw_wrlock(&rwlp->rw_lock) == 0);
ASSERT(rwlp->rw_count == 0);
rwlp->rw_count = -1;
rwlp->rw_owner = curthread;
@@ -193,6 +201,7 @@ rw_enter(krwlock_t *rwlp, krw_t rw)
void
rw_exit(krwlock_t *rwlp)
{
ASSERT(rwlp->initialized == B_TRUE);
ASSERT(rwlp->rw_owner != (void *)-1UL);
if (rwlp->rw_owner == curthread) {
@@ -205,7 +214,7 @@ rw_exit(krwlock_t *rwlp)
ASSERT(rwlp->rw_count > 0);
atomic_add_int(&rwlp->rw_count, -1);
}
(void) rw_unlock(&rwlp->rw_lock);
VERIFY(rw_unlock(&rwlp->rw_lock) == 0);
}
int
@@ -213,6 +222,7 @@ rw_tryenter(krwlock_t *rwlp, krw_t rw)
{
int rv;
ASSERT(rwlp->initialized == B_TRUE);
ASSERT(rwlp->rw_owner != (void *)-1UL);
ASSERT(rwlp->rw_owner != curthread);
@@ -241,6 +251,7 @@ rw_tryenter(krwlock_t *rwlp, krw_t rw)
int
rw_tryupgrade(krwlock_t *rwlp)
{
ASSERT(rwlp->initialized == B_TRUE);
ASSERT(rwlp->rw_owner != (void *)-1UL);
return (0);
@@ -422,9 +433,10 @@ vn_open(char *path, int x1, int flags, int mode, vnode_t **vpp, int x2, int x3)
return (0);
}
/*ARGSUSED*/
int
vn_openat(char *path, int x1, int flags, int mode, vnode_t **vpp, int x2,
int x3, vnode_t *startvp)
int x3, vnode_t *startvp, int fd)
{
char *realpath = umem_alloc(strlen(path) + 2, UMEM_NOFAIL);
int ret;
@@ -432,6 +444,7 @@ vn_openat(char *path, int x1, int flags, int mode, vnode_t **vpp, int x2,
ASSERT(startvp == rootdir);
(void) sprintf(realpath, "/%s", path);
/* fd ignored for now, need if want to simulate nbmand support */
ret = vn_open(realpath, x1, flags, mode, vpp, x2, x3);
umem_free(realpath, strlen(path) + 2);
@@ -469,7 +482,7 @@ vn_rdwr(int uio, vnode_t *vp, void *addr, ssize_t len, offset_t offset,
}
void
vn_close(vnode_t *vp)
vn_close(vnode_t *vp, int openflag, cred_t *cr, kthread_t *td)
{
close(vp->v_fd);
spa_strfree(vp->v_path);
@@ -657,7 +670,8 @@ kobj_open_file(char *name)
vnode_t *vp;
/* set vp as the _fd field of the file */
if (vn_openat(name, UIO_SYSSPACE, FREAD, 0, &vp, 0, 0, rootdir) != 0)
if (vn_openat(name, UIO_SYSSPACE, FREAD, 0, &vp, 0, 0, rootdir,
-1) != 0)
return ((void *)-1UL);
file = umem_zalloc(sizeof (struct _buf), UMEM_NOFAIL);
@@ -679,7 +693,7 @@ kobj_read_file(struct _buf *file, char *buf, unsigned size, unsigned off)
void
kobj_close_file(struct _buf *file)
{
vn_close((vnode_t *)file->_fd);
vn_close((vnode_t *)file->_fd, 0, NULL, NULL);
umem_free(file, sizeof (struct _buf));
}
@@ -690,7 +704,7 @@ kobj_get_filesize(struct _buf *file, uint64_t *size)
vnode_t *vp = (vnode_t *)file->_fd;
if (fstat64(vp->v_fd, &st) == -1) {
vn_close(vp);
vn_close(vp, 0, NULL, NULL);
return (errno);
}
*size = st.st_size;
@@ -746,10 +760,11 @@ highbit(ulong_t i)
}
#endif
static int random_fd = -1, urandom_fd = -1;
static int
random_get_bytes_common(uint8_t *ptr, size_t len, char *devname)
random_get_bytes_common(uint8_t *ptr, size_t len, int fd)
{
int fd = open(devname, O_RDONLY);
size_t resid = len;
ssize_t bytes;
@@ -757,26 +772,24 @@ random_get_bytes_common(uint8_t *ptr, size_t len, char *devname)
while (resid != 0) {
bytes = read(fd, ptr, resid);
ASSERT(bytes >= 0);
ASSERT3S(bytes, >=, 0);
ptr += bytes;
resid -= bytes;
}
close(fd);
return (0);
}
int
random_get_bytes(uint8_t *ptr, size_t len)
{
return (random_get_bytes_common(ptr, len, "/dev/random"));
return (random_get_bytes_common(ptr, len, random_fd));
}
int
random_get_pseudo_bytes(uint8_t *ptr, size_t len)
{
return (random_get_bytes_common(ptr, len, "/dev/urandom"));
return (random_get_bytes_common(ptr, len, urandom_fd));
}
int
@@ -815,7 +828,11 @@ kernel_init(int mode)
dprintf("physmem = %llu pages (%.2f GB)\n", physmem,
(double)physmem * sysconf(_SC_PAGE_SIZE) / (1ULL << 30));
snprintf(hw_serial, sizeof (hw_serial), "%ld", gethostid());
snprintf(hw_serial, sizeof (hw_serial), "%lu",
(unsigned long)gethostid());
VERIFY((random_fd = open("/dev/random", O_RDONLY)) != -1);
VERIFY((urandom_fd = open("/dev/urandom", O_RDONLY)) != -1);
spa_init(mode);
}
@@ -824,6 +841,12 @@ void
kernel_fini(void)
{
spa_fini();
close(random_fd);
close(urandom_fd);
random_fd = -1;
urandom_fd = -1;
}
int
@@ -850,3 +873,62 @@ z_compress_level(void *dst, size_t *dstlen, const void *src, size_t srclen,
return (ret);
}
uid_t
crgetuid(cred_t *cr)
{
return (0);
}
gid_t
crgetgid(cred_t *cr)
{
return (0);
}
int
crgetngroups(cred_t *cr)
{
return (0);
}
gid_t *
crgetgroups(cred_t *cr)
{
return (NULL);
}
int
zfs_secpolicy_snapshot_perms(const char *name, cred_t *cr)
{
return (0);
}
int
zfs_secpolicy_rename_perms(const char *from, const char *to, cred_t *cr)
{
return (0);
}
int
zfs_secpolicy_destroy_perms(const char *name, cred_t *cr)
{
return (0);
}
ksiddomain_t *
ksid_lookupdomain(const char *dom)
{
ksiddomain_t *kd;
kd = umem_zalloc(sizeof (ksiddomain_t), UMEM_NOFAIL);
kd->kd_name = spa_strdup(dom);
return (kd);
}
void
ksiddomain_rele(ksiddomain_t *ksid)
{
spa_strfree(ksid->kd_name);
umem_free(ksid, sizeof (ksiddomain_t));
}
@@ -19,15 +19,13 @@
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_ZFS_CONTEXT_H
#define _SYS_ZFS_CONTEXT_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
@@ -64,6 +62,7 @@ extern "C" {
#include <fsshare.h>
#include <sys/note.h>
#include <sys/types.h>
#include <sys/cred.h>
#include <sys/atomic.h>
#include <sys/sysmacros.h>
#include <sys/bitmap.h>
@@ -78,8 +77,10 @@ extern "C" {
#include <sys/debug.h>
#include <sys/sdt.h>
#include <sys/kstat.h>
#include <sys/u8_textprep.h>
#include <sys/kernel.h>
#include <sys/disk.h>
#include <sys/sysevent/eventdefs.h>
#include <machine/atomic.h>
#define ZFS_EXPORTS_PATH "/etc/zfs/exports"
@@ -116,11 +117,12 @@ extern void vcmn_err(int, const char *, __va_list);
extern void panic(const char *, ...);
extern void vpanic(const char *, __va_list);
#define fm_panic panic
/* This definition is copied from assert.h. */
#if defined(__STDC__)
#if __STDC_VERSION__ - 0 >= 199901L
#define verify(EX) (void)((EX) || \
(__assert_c99(#EX, __FILE__, __LINE__, __func__), 0))
#define verify(EX) (void)((EX) || (__assert(#EX, __FILE__, __LINE__), 0))
#else
#define verify(EX) (void)((EX) || (__assert(#EX, __FILE__, __LINE__), 0))
#endif /* __STDC_VERSION__ - 0 >= 199901L */
@@ -167,11 +169,16 @@ _NOTE(CONSTCOND) } while (0)
#endif
/*
* Dtrace SDT probes have different signatures in userland than they do in
* DTrace SDT probes have different signatures in userland than they do in
* kernel. If they're being used in kernel code, re-define them out of
* existence for their counterparts in libzpool.
*/
#ifdef DTRACE_PROBE
#undef DTRACE_PROBE
#define DTRACE_PROBE(a) ((void)0)
#endif /* DTRACE_PROBE */
#ifdef DTRACE_PROBE1
#undef DTRACE_PROBE1
#define DTRACE_PROBE1(a, b, c) ((void)0)
@@ -212,8 +219,9 @@ extern kthread_t *zk_thread_create(void (*func)(), void *arg);
* Mutexes
*/
typedef struct kmutex {
void *m_owner;
mutex_t m_lock;
void *m_owner;
boolean_t initialized;
mutex_t m_lock;
} kmutex_t;
#define MUTEX_DEFAULT USYNC_THREAD
@@ -243,6 +251,7 @@ extern void *mutex_owner(kmutex_t *mp);
typedef struct krwlock {
int rw_count;
void *rw_owner;
boolean_t initialized;
rwlock_t rw_lock;
} krwlock_t;
@@ -253,6 +262,7 @@ typedef int krw_t;
#define RW_DEFAULT USYNC_THREAD
#undef RW_READ_HELD
#define RW_READ_HELD(x) ((x)->rw_owner == NULL && (x)->rw_count > 0)
#undef RW_WRITE_HELD
#define RW_WRITE_HELD(x) ((x)->rw_owner == curthread)
@@ -267,6 +277,11 @@ extern void rw_exit(krwlock_t *rwlp);
extern int rw_lock_held(krwlock_t *rwlp);
#define rw_downgrade(rwlp) do { } while (0)
extern uid_t crgetuid(cred_t *cr);
extern gid_t crgetgid(cred_t *cr);
extern int crgetngroups(cred_t *cr);
extern gid_t *crgetgroups(cred_t *cr);
/*
* Condition variables
*/
@@ -285,6 +300,8 @@ extern void cv_broadcast(kcondvar_t *cv);
* Kernel memory
*/
#define KM_SLEEP UMEM_NOFAIL
#define KM_PUSHPAGE KM_SLEEP
#define KM_ZERO 0
#define KM_NOSLEEP UMEM_DEFAULT
#define KMC_NODEBUG UMC_NODEBUG
#define kmem_alloc(_s, _f) umem_alloc(_s, _f)
@@ -322,6 +339,9 @@ extern void taskq_destroy(taskq_t *);
extern void taskq_wait(taskq_t *);
extern int taskq_member(taskq_t *, void *);
#define XVA_MAPSIZE 3
#define XVA_MAGIC 0x78766174
/*
* vnodes
*/
@@ -331,44 +351,94 @@ typedef struct vnode {
char *v_path;
} vnode_t;
typedef struct xoptattr {
timestruc_t xoa_createtime; /* Create time of file */
uint8_t xoa_archive;
uint8_t xoa_system;
uint8_t xoa_readonly;
uint8_t xoa_hidden;
uint8_t xoa_nounlink;
uint8_t xoa_immutable;
uint8_t xoa_appendonly;
uint8_t xoa_nodump;
uint8_t xoa_settable;
uint8_t xoa_opaque;
uint8_t xoa_av_quarantined;
uint8_t xoa_av_modified;
} xoptattr_t;
typedef struct vattr {
uint_t va_mask; /* bit-mask of attributes */
u_offset_t va_size; /* file size in bytes */
} vattr_t;
#define AT_TYPE 0x0001
#define AT_MODE 0x0002
#define AT_UID 0x0004
#define AT_GID 0x0008
#define AT_FSID 0x0010
#define AT_NODEID 0x0020
#define AT_NLINK 0x0040
#define AT_SIZE 0x0080
#define AT_ATIME 0x0100
#define AT_MTIME 0x0200
#define AT_CTIME 0x0400
#define AT_RDEV 0x0800
#define AT_BLKSIZE 0x1000
#define AT_NBLOCKS 0x2000
#define AT_SEQ 0x8000
typedef struct xvattr {
vattr_t xva_vattr; /* Embedded vattr structure */
uint32_t xva_magic; /* Magic Number */
uint32_t xva_mapsize; /* Size of attr bitmap (32-bit words) */
uint32_t *xva_rtnattrmapp; /* Ptr to xva_rtnattrmap[] */
uint32_t xva_reqattrmap[XVA_MAPSIZE]; /* Requested attrs */
uint32_t xva_rtnattrmap[XVA_MAPSIZE]; /* Returned attrs */
xoptattr_t xva_xoptattrs; /* Optional attributes */
} xvattr_t;
typedef struct vsecattr {
uint_t vsa_mask; /* See below */
int vsa_aclcnt; /* ACL entry count */
void *vsa_aclentp; /* pointer to ACL entries */
int vsa_dfaclcnt; /* default ACL entry count */
void *vsa_dfaclentp; /* pointer to default ACL entries */
size_t vsa_aclentsz; /* ACE size in bytes of vsa_aclentp */
} vsecattr_t;
#define AT_TYPE 0x00001
#define AT_MODE 0x00002
#define AT_UID 0x00004
#define AT_GID 0x00008
#define AT_FSID 0x00010
#define AT_NODEID 0x00020
#define AT_NLINK 0x00040
#define AT_SIZE 0x00080
#define AT_ATIME 0x00100
#define AT_MTIME 0x00200
#define AT_CTIME 0x00400
#define AT_RDEV 0x00800
#define AT_BLKSIZE 0x01000
#define AT_NBLOCKS 0x02000
#define AT_SEQ 0x08000
#define AT_XVATTR 0x10000
#define CRCREAT 0
#define VOP_CLOSE(vp, f, c, o, cr) 0
#define VOP_PUTPAGE(vp, of, sz, fl, cr) 0
#define VOP_GETATTR(vp, vap, fl, cr) ((vap)->va_size = (vp)->v_size, 0)
#define VOP_CLOSE(vp, f, c, o, cr, ct) 0
#define VOP_PUTPAGE(vp, of, sz, fl, cr, ct) 0
#define VOP_GETATTR(vp, vap, cr, td) ((vap)->va_size = (vp)->v_size, 0)
#define VOP_FSYNC(vp, f, cr) fsync((vp)->v_fd)
#define VOP_FSYNC(vp, f, cr, ct) fsync((vp)->v_fd)
#define VN_RELE(vp) vn_close(vp)
#define VN_RELE(vp) vn_close(vp, 0, NULL, NULL)
#define VN_RELE_ASYNC(vp, taskq) vn_close(vp, 0, NULL, NULL)
#define vn_lock(vp, type, td)
#define VOP_UNLOCK(vp, type, td)
#ifdef VFS_LOCK_GIANT
#undef VFS_LOCK_GIANT
#endif
#define VFS_LOCK_GIANT(mp) 0
#ifdef VFS_UNLOCK_GIANT
#undef VFS_UNLOCK_GIANT
#endif
#define VFS_UNLOCK_GIANT(vfslocked)
extern int vn_open(char *path, int x1, int oflags, int mode, vnode_t **vpp,
int x2, int x3);
extern int vn_openat(char *path, int x1, int oflags, int mode, vnode_t **vpp,
int x2, int x3, vnode_t *vp);
int x2, int x3, vnode_t *vp, int fd);
extern int vn_rdwr(int uio, vnode_t *vp, void *addr, ssize_t len,
offset_t offset, int x1, int x2, rlim64_t x3, void *x4, ssize_t *residp);
extern void vn_close(vnode_t *vp);
extern void vn_close(vnode_t *vp, int openflag, cred_t *cr, kthread_t *td);
#define vn_remove(path, x1, x2) remove(path)
#define vn_rename(from, to, seg) rename((from), (to))
@@ -397,8 +467,9 @@ extern void delay(clock_t ticks);
#define CPU_SEQID (thr_self() & (max_ncpus - 1))
#define kcred NULL
#define CRED() NULL
#ifndef ptob
#define ptob(x) ((x) * PAGESIZE)
#endif
extern uint64_t physmem;
@@ -455,11 +526,31 @@ struct bootstat {
uint64_t st_size;
};
typedef struct ace_object {
uid_t a_who;
uint32_t a_access_mask;
uint16_t a_flags;
uint16_t a_type;
uint8_t a_obj_type[16];
uint8_t a_inherit_obj_type[16];
} ace_object_t;
#define ACE_ACCESS_ALLOWED_OBJECT_ACE_TYPE 0x05
#define ACE_ACCESS_DENIED_OBJECT_ACE_TYPE 0x06
#define ACE_SYSTEM_AUDIT_OBJECT_ACE_TYPE 0x07
#define ACE_SYSTEM_ALARM_OBJECT_ACE_TYPE 0x08
extern struct _buf *kobj_open_file(char *name);
extern int kobj_read_file(struct _buf *file, char *buf, unsigned size,
unsigned off);
extern void kobj_close_file(struct _buf *file);
extern int kobj_get_filesize(struct _buf *file, uint64_t *size);
extern int zfs_secpolicy_snapshot_perms(const char *name, cred_t *cr);
extern int zfs_secpolicy_rename_perms(const char *from, const char *to,
cred_t *cr);
extern int zfs_secpolicy_destroy_perms(const char *name, cred_t *cr);
extern zoneid_t getzoneid(void);
/* Random compatibility stuff. */
#define lbolt (gethrtime() >> 23)
#define lbolt64 (gethrtime() >> 23)
@@ -482,18 +573,32 @@ struct file {
#define FCREAT O_CREAT
#define FOFFMAX 0x0
/* SID stuff */
typedef struct ksiddomain {
uint_t kd_ref;
uint_t kd_len;
char *kd_name;
} ksiddomain_t;
ksiddomain_t *ksid_lookupdomain(const char *);
void ksiddomain_rele(ksiddomain_t *);
#define SX_SYSINIT(name, lock, desc)
#define SYSCTL_DECL(...)
#define SYSCTL_NODE(...)
#define SYSCTL_INT(...)
#define SYSCTL_UINT(...)
#define SYSCTL_ULONG(...)
#define SYSCTL_QUAD(...)
#ifdef TUNABLE_INT
#undef TUNABLE_INT
#undef TUNABLE_ULONG
#undef TUNABLE_QUAD
#endif
#define TUNABLE_INT(...)
#define TUNABLE_ULONG(...)
#define TUNABLE_QUAD(...)
/* Errors */
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -177,6 +176,9 @@ taskq_create(const char *name, int nthreads, pri_t pri,
int t;
rw_init(&tq->tq_threadlock, NULL, RW_DEFAULT, NULL);
mutex_init(&tq->tq_lock, NULL, MUTEX_DEFAULT, NULL);
cv_init(&tq->tq_dispatch_cv, NULL, CV_DEFAULT, NULL);
cv_init(&tq->tq_wait_cv, NULL, CV_DEFAULT, NULL);
tq->tq_flags = flags | TASKQ_ACTIVE;
tq->tq_active = nthreads;
tq->tq_nthreads = nthreads;
@@ -230,6 +232,9 @@ taskq_destroy(taskq_t *tq)
kmem_free(tq->tq_threadlist, nthreads * sizeof (thread_t));
rw_destroy(&tq->tq_threadlock);
mutex_destroy(&tq->tq_lock);
cv_destroy(&tq->tq_dispatch_cv);
cv_destroy(&tq->tq_wait_cv);
kmem_free(tq, sizeof (taskq_t));
}
@@ -19,12 +19,10 @@
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <assert.h>
#include <sys/zfs_context.h>
#include <sys/avl.h>
@@ -67,46 +65,58 @@ nicenum(uint64_t num, char *buf)
}
static void
show_vdev_stats(const char *desc, nvlist_t *nv, int indent)
show_vdev_stats(const char *desc, const char *ctype, nvlist_t *nv, int indent)
{
vdev_stat_t *vs;
vdev_stat_t v0 = { 0 };
uint64_t sec;
uint64_t is_log = 0;
nvlist_t **child;
uint_t c, children;
vdev_stat_t *vs;
uint64_t sec;
char used[6], avail[6];
char rops[6], wops[6], rbytes[6], wbytes[6], rerr[6], werr[6], cerr[6];
char *prefix = "";
if (indent == 0) {
(void) printf(" "
if (indent == 0 && desc != NULL) {
(void) printf(" "
" capacity operations bandwidth ---- errors ----\n");
(void) printf("description "
(void) printf("description "
"used avail read write read write read write cksum\n");
}
VERIFY(nvlist_lookup_uint64_array(nv, ZPOOL_CONFIG_STATS,
(uint64_t **)&vs, &c) == 0);
if (desc != NULL) {
(void) nvlist_lookup_uint64(nv, ZPOOL_CONFIG_IS_LOG, &is_log);
sec = MAX(1, vs->vs_timestamp / NANOSEC);
if (is_log)
prefix = "log ";
nicenum(vs->vs_alloc, used);
nicenum(vs->vs_space - vs->vs_alloc, avail);
nicenum(vs->vs_ops[ZIO_TYPE_READ] / sec, rops);
nicenum(vs->vs_ops[ZIO_TYPE_WRITE] / sec, wops);
nicenum(vs->vs_bytes[ZIO_TYPE_READ] / sec, rbytes);
nicenum(vs->vs_bytes[ZIO_TYPE_WRITE] / sec, wbytes);
nicenum(vs->vs_read_errors, rerr);
nicenum(vs->vs_write_errors, werr);
nicenum(vs->vs_checksum_errors, cerr);
if (nvlist_lookup_uint64_array(nv, ZPOOL_CONFIG_STATS,
(uint64_t **)&vs, &c) != 0)
vs = &v0;
(void) printf("%*s%*s%*s%*s %5s %5s %5s %5s %5s %5s %5s\n",
indent, "",
indent - 19 - (vs->vs_space ? 0 : 12), desc,
vs->vs_space ? 6 : 0, vs->vs_space ? used : "",
vs->vs_space ? 6 : 0, vs->vs_space ? avail : "",
rops, wops, rbytes, wbytes, rerr, werr, cerr);
sec = MAX(1, vs->vs_timestamp / NANOSEC);
if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN,
&child, &children) != 0)
nicenum(vs->vs_alloc, used);
nicenum(vs->vs_space - vs->vs_alloc, avail);
nicenum(vs->vs_ops[ZIO_TYPE_READ] / sec, rops);
nicenum(vs->vs_ops[ZIO_TYPE_WRITE] / sec, wops);
nicenum(vs->vs_bytes[ZIO_TYPE_READ] / sec, rbytes);
nicenum(vs->vs_bytes[ZIO_TYPE_WRITE] / sec, wbytes);
nicenum(vs->vs_read_errors, rerr);
nicenum(vs->vs_write_errors, werr);
nicenum(vs->vs_checksum_errors, cerr);
(void) printf("%*s%s%*s%*s%*s %5s %5s %5s %5s %5s %5s %5s\n",
indent, "",
prefix,
indent + strlen(prefix) - 25 - (vs->vs_space ? 0 : 12),
desc,
vs->vs_space ? 6 : 0, vs->vs_space ? used : "",
vs->vs_space ? 6 : 0, vs->vs_space ? avail : "",
rops, wops, rbytes, wbytes, rerr, werr, cerr);
}
if (nvlist_lookup_nvlist_array(nv, ctype, &child, &children) != 0)
return;
for (c = 0; c < children; c++) {
@@ -120,7 +130,7 @@ show_vdev_stats(const char *desc, nvlist_t *nv, int indent)
(void) strcpy(tname, cname);
if (nvlist_lookup_uint64(cnv, ZPOOL_CONFIG_NPARITY, &np) == 0)
tname[strlen(tname)] = '0' + np;
show_vdev_stats(tname, cnv, indent + 2);
show_vdev_stats(tname, ctype, cnv, indent + 2);
free(tname);
}
}
@@ -131,14 +141,16 @@ show_pool_stats(spa_t *spa)
nvlist_t *config, *nvroot;
char *name;
spa_config_enter(spa, RW_READER, FTAG);
config = spa_config_generate(spa, NULL, -1ULL, B_TRUE);
spa_config_exit(spa, FTAG);
VERIFY(spa_get_stats(spa_name(spa), &config, NULL, 0) == 0);
VERIFY(nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE,
&nvroot) == 0);
VERIFY(nvlist_lookup_string(config, ZPOOL_CONFIG_POOL_NAME,
&name) == 0);
show_vdev_stats(name, nvroot, 0);
show_vdev_stats(name, ZPOOL_CONFIG_CHILDREN, nvroot, 0);
show_vdev_stats(NULL, ZPOOL_CONFIG_L2CACHE, nvroot, 0);
show_vdev_stats(NULL, ZPOOL_CONFIG_SPARES, nvroot, 0);
nvlist_free(config);
}
+1 -1
View File
@@ -14,7 +14,7 @@ SUBDIR= drti \
.if ${MK_ZFS} != "no"
_libzfs= libzfs
.if ${MK_LIBTHR} != "no" || ${MK_LIBKSE} != "no"
.if ${MK_LIBTHR} != "no"
_libzpool= libzpool
.endif
.endif
+1 -1
View File
@@ -10,8 +10,8 @@ SRCS= libnvpair.c \
nvpair_alloc_fixed.c \
nvpair.c
CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris/include
CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris
CFLAGS+= -I${.CURDIR}/../../../include # XXX
CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common
.include <bsd.lib.mk>
+8 -4
View File
@@ -10,14 +10,17 @@ DPADD= ${LIBUTIL}
LDADD= -lutil
SRCS= deviceid.c \
mnttab.c \
mkdirp.c \
zmount.c \
fsshare.c \
mkdirp.c \
mnttab.c \
zmount.c \
zone.c
SRCS+= zfs_namecheck.c \
SRCS+= zfs_deleg.c \
zfs_namecheck.c \
zfs_prop.c \
zpool_prop.c \
zprop_common.c \
libzfs_dataset.c \
libzfs_util.c \
libzfs_graph.c \
@@ -26,6 +29,7 @@ SRCS+= zfs_namecheck.c \
libzfs_changelist.c \
libzfs_config.c \
libzfs_import.c \
libzfs_sendrecv.c \
libzfs_status.c
CFLAGS+= -DZFS_NO_ACL
+15 -2
View File
@@ -13,11 +13,13 @@
# ATOMIC_SRCS
.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "ia64"
.PATH: ${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/atomic/${MACHINE_ARCH}
ATOMIC_SRCS= atomic.S
ATOMIC_SRCS= opensolaris_atomic.S
.else
.PATH: ${.CURDIR}/../../../sys/cddl/compat/opensolaris/kern
ATOMIC_SRCS= opensolaris_atomic.c
.endif
# UNICODE_SRCS
.PATH: ${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/unicode
LIB= zpool
@@ -25,9 +27,11 @@ ZFS_COMMON_SRCS= ${ZFS_COMMON_OBJS:C/.o$/.c/} vdev_file.c
ZFS_SHARED_SRCS= ${ZFS_SHARED_OBJS:C/.o$/.c/}
KERNEL_SRCS= kernel.c taskq.c util.c
LIST_SRCS= list.c
UNICODE_SRCS= u8_textprep.c
SRCS= ${ZFS_COMMON_SRCS} ${ZFS_SHARED_SRCS} \
${KERNEL_SRCS} ${LIST_SRCS} ${ATOMIC_SRCS}
${KERNEL_SRCS} ${LIST_SRCS} ${ATOMIC_SRCS} \
${UNICODE_SRCS}
CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris
CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris/include
@@ -40,6 +44,13 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common
CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/head
CFLAGS+= -I${.CURDIR}/../../../cddl/lib/libumem
CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libnvpair
# XXX: pthread doesn't have mutex_owned() equivalent, so we need to look
# into libthr private structures. That's sooo evil, but it's only for
# ZFS debugging tools needs.
CFLAGS+= -DWANTS_MUTEX_OWNED
CFLAGS+= -I${.CURDIR}/../../../lib/libpthread/thread
CFLAGS+= -I${.CURDIR}/../../../lib/libpthread/sys
CFLAGS+= -I${.CURDIR}/../../../lib/libthr/arch/${MACHINE_ARCH}/include
DPADD= ${LIBPTHREAD} ${LIBZ}
LDADD= -lpthread -lz
@@ -47,4 +58,6 @@ LDADD= -lpthread -lz
# atomic.S doesn't like profiling.
NO_PROFILE=
CSTD= c99
.include <bsd.lib.mk>
+4 -2
View File
@@ -1,10 +1,11 @@
# $FreeBSD$
.PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/cmd/zpool
.PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/cmd/zpool \
${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/zfs
PROG= zpool
MAN= zpool.8
SRCS= zpool_main.c zpool_vdev.c zpool_iter.c zpool_util.c
SRCS= zpool_main.c zpool_vdev.c zpool_iter.c zpool_util.c zfs_comutil.c
CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzpool/common
CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris/include
@@ -15,6 +16,7 @@ CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libuutil/common
CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libumem/common
CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzfs/common
CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libnvpair
CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/zfs
CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common
CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/fs/zfs
CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/sys
+3 -1
View File
@@ -7,10 +7,12 @@ SUBDIR= \
ctfdump \
ctfmerge \
sgsmsg \
${_zinject} \
${_ztest}
.if ${MK_ZFS} != "no"
.if ${MK_LIBTHR} != "no" || ${MK_LIBKSE} != "no"
_zinject= zinject
.if ${MK_LIBTHR} != "no"
_ztest= ztest
.endif
.endif
+25
View File
@@ -0,0 +1,25 @@
# $FreeBSD$
.PATH: ${.CURDIR}/../../contrib/opensolaris/cmd/zinject
PROG= zinject
SRCS= zinject.c translate.c
NO_MAN=
CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris
CFLAGS+= -I${.CURDIR}/../../compat/opensolaris/include
CFLAGS+= -I${.CURDIR}/../../compat/opensolaris/lib/libumem
CFLAGS+= -I${.CURDIR}/../../contrib/opensolaris/lib/libzfs/common
CFLAGS+= -I${.CURDIR}/../../contrib/opensolaris/lib/libzpool/common
CFLAGS+= -I${.CURDIR}/../../contrib/opensolaris/lib/libnvpair
CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/fs/zfs
CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/sys
CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common
CFLAGS+= -I${.CURDIR}/../../contrib/opensolaris/head
CFLAGS+= -I${.CURDIR}/../../lib/libumem
DPADD= ${LIBAVL} ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBUMEM} ${LIBUUTIL} \
${LIBZFS} ${LIBZPOOL} ${LIBUUTIL}
LDADD= -lavl -lgeom -lm -lnvpair -lumem -luutil -lzfs -lzpool
.include <bsd.prog.mk>
+7 -5
View File
@@ -1,22 +1,24 @@
# $FreeBSD$
.PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/cmd/ztest
.PATH: ${.CURDIR}/../..//contrib/opensolaris/cmd/ztest
PROG= ztest
NO_MAN=
CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris
CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris/include
CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris/lib/libumem
CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzpool/common
CFLAGS+= -I${.CURDIR}/../../compat/opensolaris/include
CFLAGS+= -I${.CURDIR}/../../compat/opensolaris/lib/libumem
CFLAGS+= -I${.CURDIR}/../../contrib/opensolaris/lib/libzpool/common
CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/fs/zfs
CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/sys
CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common
CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/head
CFLAGS+= -I${.CURDIR}/../../contrib/opensolaris/head
CFLAGS+= -I${.CURDIR}/../../lib/libumem
DPADD= ${LIBM} ${LIBNVPAIR} ${LIBUMEM} ${LIBZPOOL} \
${LIBPTHREAD} ${LIBZ} ${LIBAVL}
LDADD= -lm -lnvpair -lumem -lzpool -lpthread -lz -lavl
CSTD= c99
.include <bsd.prog.mk>
+1 -1
View File
@@ -6,7 +6,7 @@ SUBDIR= dtrace \
${_zdb}
.if ${MK_ZFS} != "no"
.if ${MK_LIBTHR} != "no" || ${MK_LIBKSE} != "no"
.if ${MK_LIBTHR} != "no"
_zdb= zdb
.endif
.endif
+8 -3
View File
@@ -9,6 +9,9 @@ SRCS= zdb.c zdb_il.c
CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris
CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris/include
CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris/lib/libumem
CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libnvpair
CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libuutil/common
CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzfs/common
CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzpool/common
CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/fs/zfs
CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common
@@ -16,8 +19,10 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/sys
CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/head
CFLAGS+= -I${.CURDIR}/../../lib/libumem
DPADD= ${LIBM} ${LIBNVPAIR} ${LIBUMEM} ${LIBZPOOL} \
${LIBPTHREAD} ${LIBZ} ${LIBAVL}
LDADD= -lm -lnvpair -lumem -lzpool -lpthread -lz -lavl
DPADD= ${LIBAVL} ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBPTHREAD} ${LIBUMEM} \
${LIBUUTIL} ${LIBZ} ${LIBZFS} ${LIBZPOOL}
LDADD= -lavl -lgeom -lm -lnvpair -lpthread -lumem -luutil -lz -lzfs -lzpool
CSTD= c99
.include <bsd.prog.mk>
+289 -6
View File
@@ -1,17 +1,295 @@
--- 9.4.3-P2 released ---
--- 9.4-ESV released ---
2831. [security] Do not attempt to validate or cache
out-of-bailiwick data returned with a secure
answer; it must be re-fetched from its original
source and validated in that context. [RT #20819]
2828. [security] Cached CNAME or DNAME RR could be returned to clients
without DNSSEC validation. [RT #20737]
2827. [security] Bogus NXDOMAIN could be cached as if valid. [RT #20712]
2797. [bug] Don't decrement the dispatch manager's maxbuffers.
[RT #20613]
2790. [bug] Handle DS queries to stub zones. [RT #20440]
2772. [security] When validating, track whether pending data was from
the additional section or not and only return it if
validates as secure. [RT #20438]
--- 9.4-ESVb1 released ---
2698. [cleanup] configure --enable-libbind is deprecated. [RT #20090]
2697. [port] win32: ensure that S_IFMT, S_IFDIR, S_IFCHR and
S_IFREG are defined after including <isc/stat.h>.
[RT #20309]
2690. [bug] win32: fix isc_thread_key_getspecific() prototype.
[RT #20315]
2689. [bug] Correctly handle snprintf result. [RT #20306]
2688. [bug] Use INTERFACE_F_POINTTOPOINT, not IFF_POINTOPOINT,
to decide to fetch the destination address. [RT #20305]
2681. [bug] IPSECKEY RR of gateway type 3 was not correctly
decoded. [RT #20269]
2672. [bug] Don't enable searching in 'host' when doing reverse
lookups. [RT #20218]
2525. [experimental] New logging category "query-errors" to provide detailed
internal information about query failures, especially
about server failures. (backported as a special
exception to the general policy) [RT #19027]
2670. [bug] Unexpected connect failures failed to log enough
information to be useful. [RT #20205]
2649. [bug] Set the domain for forward only zones. [RT #19944]
2648. [port] win32: isc_time_seconds() was broken. [RT #19900]
2646. [bug] Incorrect cleanup on error in socket.c. [RT #19987]
2642. [bug] nsupdate could dump core on solaris when reading
improperly formatted key files. [RT #20015]
2640. [security] A specially crafted update packet will cause named
to exit. [RT #20000]
2637. [func] Rationalize dnssec-signzone's signwithkey() calling.
[RT #19959]
2635. [bug] isc_inet_ntop() incorrectly handled 0.0/16 addresses.
[RT #19716]
2633. [bug] Handle 15 bit rand() functions. [RT #19783]
2632. [func] util/kit.sh: warn if documentation appears to be out of
date. [RT #19922]
2623. [bug] Named started seaches for DS non-optimally. [RT #19915]
2621. [doc] Made copyright boilterplate consistent. [RT #19833]
2920. [bug] Delay thawing the zone until the reload of it has
completed successfully. [RT #19750]
2618. [bug] The sdb and sdlz db_interator_seek() methods could
loop infinitely. [RT #19847]
2617. [bug] ifconfig.sh failed to emit an error message when
run from the wrong location. [RT #19375]
2616. [bug] 'host' used the nameservers from resolv.conf even
when a explicit nameserver was specified. [RT #19852]
2615. [bug] "__attribute__((unused))" was in the wrong place
for ia64 gcc builds. [RT #19854]
2614. [port] win32: 'named -v' should automatically be executed
in the foreground. [RT #19844]
2610. [port] sunos: Change #2363 was not complete. [RT #19796]
2606. [bug] "delegation-only" was not being accepted in
delegation-only type zones. [RT #19717]
2605. [bug] Accept DS responses from delegation only zones.
[RT # 19296]
2603. [port] win32: handle .exe extension of named-checkzone and
named-comilezone argv[0] names under windows.
[RT #19767]
2602. [port] win32: fix debugging command line build of libisccfg.
[RT #19767]
2599. [bug] Address rapid memory growth when validation fails.
[RT #19654]
2595. [bug] Fix unknown extended rcodes in dig. [RT #19625]
2592. [bug] Treat "any" as a type in nsupdate. [RT #19455]
2591. [bug] named could die when processing a update in
removed_orphaned_ds(). [RT #19507]
2589. [bug] dns_db_unregister() failed to clear '*dbimp'.
[RT #19626]
2586. [bug] Missing cleanup of SIG rdataset in searching a DLZ DB
or SDB. [RT #19577]
2584. [bug] alpha: gcc optimization could break atomic operations.
[RT #19227]
2583. [port] netbsd: provide a control to not add the compile
date to the version string, -DNO_VERSION_DATE.
2582. [bug] Don't emit warning log message when we attempt to
remove non-existant journal. [RT #19516]
2581. [contrib] dlz/mysql set MYSQL_OPT_RECONNECT option on connection.
Requires MySQL 5.0.19 or later. [RT #19084]
2579. [bug] DNSSEC lookaside validation failed to handle unknown
algorithms. [RT #19479]
--- 9.4.3-P1 released ---
2573. [bug] Replacing a non-CNAME record with a CNAME record in a
single transaction in a signed zone failed. [RT #19397]
2568. [bug] Report when the write to indicate a otherwise
successful start fails. [RT #19360]
2567. [bug] dst__privstruct_writefile() could miss write errors.
write_public_key() could miss write errors.
[RT #19360]
2564. [bug] Only take EDNS fallback steps when processing timeouts.
[RT #19405]
2563. [bug] Dig could leak a socket causing it to wait forever
to exit. [RT #19359]
2562. [doc] ARM: miscellaneous improvements, reorganization,
and some new content.
2561. [doc] Add isc-config.sh(1) man page. [RT #16378]
2557. [cleanup] PCI compliance:
* new libisc log module file
* isc_dir_chroot() now also changes the working
directory to "/".
* additional INSISTs
* additional logging when files can't be removed.
2553. [bug] Reference leak on DNSSEC validation errors. [RT #19291]
2552. [bug] zero-no-soa-ttl-cache was not being honoured.
[RT #19340]
2551. [bug] Potential Reference leak on return. [RT #19341]
2550. [bug] Check --with-openssl=<path> finds <openssl/opensslv.h>.
[RT #19343]
2549. [port] linux: define NR_OPEN if not currently defined.
[RT #19344]
2547. [bug] openssl_link.c:mem_realloc() could reference an
out-of-range area of the source buffer. New public
function isc_mem_reallocate() was introduced to address
this bug. [RT #19313]
2545. [doc] ARM: Legal hostname checking (check-names) is
for SRV RDATA too. [RT #19304]
2544. [cleanup] Removed unused structure members in adb.c. [RT #19225]
2542. [doc] Update the description of dig +adflag. [RT #19290]
2539. [security] Update the interaction between recursion, allow-query,
allow-query-cache and allow-recursion. [RT #19198]
2536. [cleanup] Silence some warnings when -Werror=format-security is
specified. [RT #19083]
2535. [bug] dig +showsearch and +trace interacted badly. [RT #19091]
2532. [bug] dig: check the question section of the response to
see if it matches the asked question. [RT #18495]
2531. [bug] Change #2207 was incomplete. [RT #19098]
2529. [cleanup] Upgrade libtool to silence complaints from recent
version of autoconf. [RT #18657]
2528. [cleanup] Silence spurious configure warning about
--datarootdir [RT #19096]
2527. [bug] named could reuse cache on reload with
enabling/disabling validation. [RT #19119]
2523. [bug] Random type rdata freed by dns_nsec_typepresent().
[RT #19112]
2522. [security] Handle -1 from DSA_do_verify().
2521. [bug] Improve epoll cross compilation support. [RT #19047]
2519. [bug] dig/host with -4 or -6 didn't work if more than two
nameserver addresses of the excluded address family
preceded in resolv.conf. [RT #19081]
2517. [bug] dig +trace with -4 or -6 failed when it chose a
nameserver address of the excluded address type.
[RT #18843]
2516. [bug] glue sort for responses was performed even when not
needed. [RT #19039]
2514. [bug] dig/host failed with -4 or -6 when resolv.conf contains
a nameserver of the excluded address family.
[RT #18848]
2511. [cleanup] dns_rdata_tofmttext() add const to linebreak.
[RT #18885]
2510. [bug] "dig +sigchase" could trigger REQUIRE failures.
[RT #19033]
2509. [bug] Specifying a fixed query source port was broken.
[RT #19051]
2506. [port] solaris: Check at configure time if
hack_shutup_pthreadonceinit is needed. [RT #19037]
2505. [port] Treat amd64 similarly to x86_64 when determining
atomic operation support. [RT #19031]
2504. [bug] Address race condition in the socket code. [RT #18899]
2503. [port] linux: improve compatibility with Linux Standard
Base. [RT #18793]
2500. [contrib] contrib/sdb/pgsql/zonetodb.c called non-existent
function. [RT #18582]
2499. [port] solaris: lib/lwres/getaddrinfo.c namespace clash.
[RT #18837]
2498. [bug] Removed a bogus function argument used with
ISC_SOCKET_USE_POLLWATCH: it could cause compiler
warning or crash named with the debug 1 level
of logging. [RT #18917]
2495. [bug] Tighten RRSIG checks. [RT #18795]
2494. [bug] dns/sdlz.h and dns/dlz.h were not being installed.
[RT #18826]
2487. [bug] Give TCP connections longer to complete. [RT #18675]
2485. [bug] Change update's the handling of obscured RRSIG
records. Not all orphand DS records were being
removed. [RT #18828]
2479. [bug] xfrout:covers was not properly initalized. [RT #18801]
2478. [bug] 'addresses' could be used uninitalized in
configure_forward(). [RT #18800]
2476. [doc] ARM: improve documentation for max-journal-size and
ixfr-from-differences. [RT #15909] [RT #18541]
2400. [bug] Log if kqueue()/epoll_create()/open(/dev/poll) fails.
[RT #18297]
--- 9.4.3 released ---
2490. [port] aix: work around a kernel bug where IPV6_RECVPKTINFO
@@ -27,7 +305,7 @@
2473. [port] linux: raise the limit on open files to the possible
maximum value before spawning threads; 'files'
specified in named.conf doesn't seem to work with
specified in named.conf doesn't seem to work with
threads as expected. [RT #18784]
2472. [port] linux: check the number of available cpu's before
@@ -50,10 +328,11 @@
2465. [bug] Adb's handling of lame addresses was different
for IPv4 and IPv6. [RT #18738]
2463. [port] linux: POSIX doesn't include the IPv6 Advanced Socket
2463. [port] linux: POSIX doesn't include the IPv6 Advanced Socket
API and glibc hides parts of the IPv6 Advanced Socket
API as a result. This is stupid as it breaks how the
two halves (Basic and Advanced) of the IPv6 Socket API were designed to be used but we have to live with it.
two halves (Basic and Advanced) of the IPv6 Socket API
were designed to be used but we have to live with it.
Define _GNU_SOURCE to pull in the IPv6 Advanced Socket
API. [RT #18388]
@@ -159,6 +438,10 @@
for select(). To enable this, set ISC_SOCKET_MAXSOCKETS
at compilation time. [RT #18433]
Note: with changes #2469 and #2421 above, there is no
need to tweak ISC_SOCKET_MAXSOCKETS at compilation time
any more.
2410. [bug] Correctly delete m_versionInfo. [RT #18432]
2408. [bug] A duplicate TCP dispatch event could be sent, which
@@ -230,7 +513,7 @@
2380. [bug] dns_view_find() was not returning NXDOMAIN/NXRRSET
proofs which, in turn, caused validation failures
for insecure zones immediately below a secure zone
the server was authoritative for. [RT #18112]
the server was authoritative for. [RT #18112]
2379. [contrib] queryperf/gen-data-queryperf.py: removed redundant
TLDs and supported RRs with TTLs [RT #17972]
+2 -2
View File
@@ -1,4 +1,4 @@
Copyright (C) 2004-2008 Internet Systems Consortium, Inc. ("ISC")
Copyright (C) 2004-2010 Internet Systems Consortium, Inc. ("ISC")
Copyright (C) 1996-2003 Internet Software Consortium.
Permission to use, copy, modify, and/or distribute this software for any
@@ -13,7 +13,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
$Id: COPYRIGHT,v 1.9.18.5 2008/01/02 23:46:02 tbox Exp $
$Id: COPYRIGHT,v 1.9.18.7 2010/01/07 23:46:07 tbox Exp $
Portions Copyright (C) 1996-2001 Nominum, Inc.
+17 -13
View File
@@ -1,6 +1,6 @@
Frequently Asked Questions about BIND 9
Copyright © 2004-2008 Internet Systems Consortium, Inc. ("ISC")
Copyright © 2004-2009 Internet Systems Consortium, Inc. ("ISC")
Copyright © 2000-2003 Internet Software Consortium.
@@ -153,24 +153,29 @@ A: BIND 9.3 and later: Use TSIG to select the appropriate view.
Master 10.0.1.1:
key "external" {
algorithm hmac-md5;
secret "xxxxxxxx";
algorithm hmac-sha256;
secret "xxxxxxxxxxxxxxxxxxxxxxxx";
};
view "internal" {
match-clients { !key external; 10.0.1/24; };
match-clients { !key external; // reject message ment for the
// external view.
10.0.1/24; }; // accept from these addresses.
...
};
view "external" {
match-clients { key external; any; };
server 10.0.1.2 { keys external; };
server 10.0.1.2 { keys external; }; // tag messages from the
// external view to the
// other servers for the
// view.
recursion no;
...
};
Slave 10.0.1.2:
key "external" {
algorithm hmac-md5;
secret "xxxxxxxx";
algorithm hmac-sha256;
secret "xxxxxxxxxxxxxxxxxxxxxxxx";
};
view "internal" {
match-clients { !key external; 10.0.1/24; };
@@ -220,13 +225,13 @@ A: You choose one view to be master and the second a slave and transfer
Master 10.0.1.1:
key "external" {
algorithm hmac-md5;
secret "xxxxxxxx";
algorithm hmac-sha256;
secret "xxxxxxxxxxxxxxxxxxxxxxxx";
};
key "mykey" {
algorithm hmac-md5;
secret "yyyyyyyy";
algorithm hmac-sha256;
secret "yyyyyyyyyyyyyyyyyyyyyyyy";
};
view "internal" {
@@ -600,7 +605,7 @@ Q: Why do queries for NSEC3 records fail to return the NSEC3 record?
A: NSEC3 records are strictly meta data and can only be returned in the
authority section. This is done so that signing the zone using NSEC3
records does not bring names into existance that do not exist in the
records does not bring names into existence that do not exist in the
unsigned version of the zone.
5. Operating-System Specific Questions
@@ -825,7 +830,6 @@ A: /dev/random is not configured. Use rndcontrol(8) to tell the kernel to
use certain interrupts as a source of random events. You can make this
permanent by setting rand_irqs in /etc/rc.conf.
/etc/rc.conf
rand_irqs="3 14 15"
See also <http://people.freebsd.org/~dougb/randomness.html>.
+19 -14
View File
@@ -1,7 +1,7 @@
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" []>
<!--
- Copyright (C) 2004-2008 Internet Systems Consortium, Inc. ("ISC")
- Copyright (C) 2004-2009 Internet Systems Consortium, Inc. ("ISC")
- Copyright (C) 2000-2003 Internet Software Consortium.
-
- Permission to use, copy, modify, and/or distribute this software for any
@@ -17,7 +17,7 @@
- PERFORMANCE OF THIS SOFTWARE.
-->
<!-- $Id: FAQ.xml,v 1.4.4.24 2008/09/10 01:32:25 tbox Exp $ -->
<!-- $Id: FAQ.xml,v 1.4.4.29 2009/10/06 01:33:54 tbox Exp $ -->
<article class="faq">
<title>Frequently Asked Questions about BIND 9</title>
@@ -28,6 +28,7 @@
<year>2006</year>
<year>2007</year>
<year>2008</year>
<year>2009</year>
<holder>Internet Systems Consortium, Inc. ("ISC")</holder>
</copyright>
<copyright>
@@ -318,24 +319,29 @@ Slave: 10.0.1.3 (internal), 10.0.1.4 (external, IP alias)
<programlisting>
Master 10.0.1.1:
key "external" {
algorithm hmac-md5;
secret "xxxxxxxx";
algorithm hmac-sha256;
secret "xxxxxxxxxxxxxxxxxxxxxxxx";
};
view "internal" {
match-clients { !key external; 10.0.1/24; };
match-clients { !key external; // reject message ment for the
// external view.
10.0.1/24; }; // accept from these addresses.
...
};
view "external" {
match-clients { key external; any; };
server 10.0.1.2 { keys external; };
server 10.0.1.2 { keys external; }; // tag messages from the
// external view to the
// other servers for the
// view.
recursion no;
...
};
Slave 10.0.1.2:
key "external" {
algorithm hmac-md5;
secret "xxxxxxxx";
algorithm hmac-sha256;
secret "xxxxxxxxxxxxxxxxxxxxxxxx";
};
view "internal" {
match-clients { !key external; 10.0.1/24; };
@@ -423,13 +429,13 @@ named-checkzone example.com tmp</programlisting>
<programlisting>
Master 10.0.1.1:
key "external" {
algorithm hmac-md5;
secret "xxxxxxxx";
algorithm hmac-sha256;
secret "xxxxxxxxxxxxxxxxxxxxxxxx";
};
key "mykey" {
algorithm hmac-md5;
secret "yyyyyyyy";
algorithm hmac-sha256;
secret "yyyyyyyyyyyyyyyyyyyyyyyy";
};
view "internal" {
@@ -1067,7 +1073,7 @@ empty:
NSEC3 records are strictly meta data and can only be
returned in the authority section. This is done so that
signing the zone using NSEC3 records does not bring names
into existance that do not exist in the unsigned version
into existence that do not exist in the unsigned version
of the zone.
</para>
</answer>
@@ -1470,7 +1476,6 @@ options {
</para>
<informalexample>
<programlisting>
/etc/rc.conf
rand_irqs="3 14 15"</programlisting>
</informalexample>
<para>
-120
View File
@@ -1,120 +0,0 @@
FreeBSD maintainer's guide to updating BIND 9
=============================================
1) Obtain the latest source distribution from the ISC's FTP server
(ftp://ftp.isc.org/isc/bind9/)
2) Unpack the tarball in a suitable directory, and cd into the new
source directory.
3) Remove unwanted files and directories:
$ while read pattern ; do rm -rf $pattern ; done \
</usr/src/contrib/bind9/FREEBSD-Xlist
Make sure that took care of everything, and if it didn't, make sure
to update FREEBSD-Xlist so you won't miss it the next time. A good
way to do this is to run a test import and see if any new files
show up:
$ cvs -q -n import src/contrib/bind9 ISC x | grep \^N
4) Import the sources:
$ cvs import -m "Vendor import of BIND 9.X.Y" \
src/contrib/bind9 ISC BIND_9_X_Y
5) Resolve conflicts.
As of 2 June 2007, we have no local patches against BIND 9; thus
there are no conflicts to merge. This may change at a later date.
5a) Remove any files that are no longer in the tarball from the vendor branch.
6) Remove any references to the {bin,lib}/tests and docutil
directories from the configure and Makefile templates:
$ sed -i.orig -e '/\/tests/d; /docutil/d; /\/xsl/d;' \
configure.in Makefile.in */Makefile.in
Please do not commit this change, as it would unnecessarily take
files off the vendor branch. You only need this to generate
config.h.
7) Generate and run configure:
$ aclocal
$ autoheader
$ autoconf
$ ./configure --prefix=/usr \
--infodir=/usr/share/info --mandir=/usr/share/man \
--enable-threads --enable-libbind --disable-ipv6 \
--enable-getifaddrs --disable-linux-caps \
--with-openssl=/usr --with-randomdev=/dev/random
Note that we intentionally disable IPv6 support on the configure
command line; src/lib/bind/config.mk will re-enable it at compile
time if WITHOUT_INET6 is not defined.
8) Copy the following generated files to src/lib/bind and commit them:
Path in src/contrib/bind9 Path in src/lib/bind
------------------------------------------------------------
s=/usr/src/lib/bind
cp config.h ${s}/config.h
cp lib/bind/config.h ${s}/bind/config.h
cp lib/bind/port_after.h ${s}/bind/port_after.h
cp lib/bind/port_before.h ${s}/bind/port_before.h
cp lib/isc/include/isc/platform.h ${s}/isc/isc/platform.h
cp lib/lwres/include/lwres/netdb.h ${s}/lwres/lwres/netdb.h
cp lib/lwres/include/lwres/platform.h ${s}/lwres/lwres/platform.h
Do not commit any other file that was modified or created in
steps 6) or 7).
9) cd src/lib/bind/dns && make -DMAINTAINER_MODE generate && rm gen
Commit the new versions of the files generated.
The following directories contain Makefiles for bits and pieces of
BIND 9:
FreeBSD directory ISC directory
========================================================
src/lib/bind bind9/lib
src/lib/bind/bind bind9/lib/bind
src/lib/bind/bind9 bind9/lib/bind9
src/lib/bind/dns bind9/lib/dns
src/lib/bind/isc bind9/lib/isc
src/lib/bind/isccc bind9/lib/isccc
src/lib/bind/isccfg bind9/lib/isccfg
src/lib/bind/lwres bind9/lib/lwres
src/share/doc/bind9 bind9/doc/{arm,misc}
src/usr.bin/dig bind9/bin/dig
src/usr.bin/host bind9/bin/dig
src/usr.bin/nslookup bind9/bin/dig
src/usr.bin/nsupdate bind9/bin/nsupdate
src/usr.sbin/dnssec-keygen bind9/bin/dnssec
src/usr.sbin/dnssec-signzone bind9/bin/dnssec
src/usr.sbin/named bind9/bin/named
src/usr.sbin/named-checkconf bind9/bin/check
src/usr.sbin/named-checkzone bind9/bin/check
src/usr.sbin/rndc bind9/bin/rndc
src/usr.sbin/rndc-confgen bind9/bin/rndc
Make sure that the lists of sources, headers and man pages in each
FreeBSD Makefile accurately reflects those in the corresponding ISC
Makefile. Please strive to keep those lists in the same order and
with line breaks in the same places to ease future comparisons.
A) Build and test.
B) Lather, rinse, repeat.
C) Commit when everything builds cleanly and works properly.
-- [email protected]
-- [email protected]
$FreeBSD$
-67
View File
@@ -1,67 +0,0 @@
# $FreeBSD$
# Misc. stuff
.cvsignore
aclocal.m4
config.h.in
configure
contrib
docutil
# Tests
bin/tests
lib/tests
# Doc stuff
doc/arm/latex-fixup.pl
doc/xsl
# Windows directories
bin/check/win32
bin/dig/win32
bin/dnssec/win32
bin/named/win32
bin/nsupdate/win32
bin/rndc/win32
bin/win32
config.h.win32
lib/bind9/win32
lib/dns/gen-win32.h
lib/dns/win32
lib/isc/win32
lib/isccc/win32
lib/isccfg/win32
lib/lwres/win32
lib/win32
win32utils
# Various ports to other OSs
lib/bind/port/aix*
lib/bind/port/aux3
lib/bind/port/bsdos
lib/bind/port/bsdos2
lib/bind/port/cygwin
lib/bind/port/darwin
lib/bind/port/decunix
lib/bind/port/hpux
lib/bind/port/hpux10
lib/bind/port/hpux9
lib/bind/port/irix
lib/bind/port/linux
lib/bind/port/lynxos
lib/bind/port/mpe
lib/bind/port/netbsd
lib/bind/port/next
lib/bind/port/openbsd
lib/bind/port/prand_conf
lib/bind/port/qnx
lib/bind/port/rhapsody
lib/bind/port/sco42
lib/bind/port/sco50
lib/bind/port/solaris
lib/bind/port/sunos
lib/bind/port/ultrix
lib/bind/port/unixware20
lib/bind/port/unixware212
lib/bind/port/unixware7
lib/bind/port/unknown
+15 -2
View File
@@ -1,4 +1,4 @@
# Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC")
# Copyright (C) 2004-2007, 2009 Internet Systems Consortium, Inc. ("ISC")
# Copyright (C) 1998-2002 Internet Software Consortium.
#
# Permission to use, copy, modify, and/or distribute this software for any
@@ -13,7 +13,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# $Id: Makefile.in,v 1.43.18.6 2007/09/03 23:46:21 tbox Exp $
# $Id: Makefile.in,v 1.43.18.8 2009/02/20 23:46:01 tbox Exp $
srcdir = @srcdir@
VPATH = @srcdir@
@@ -24,6 +24,12 @@ top_srcdir = @top_srcdir@
SUBDIRS = make lib bin doc @LIBBIND@
TARGETS =
MANPAGES = isc-config.sh.1
HTMLPAGES = isc-config.sh.html
MANOBJS = ${MANPAGES} ${HTMLPAGES}
@BIND9_MAKE_RULES@
distclean::
@@ -43,12 +49,19 @@ distclean::
maintainer-clean::
rm -f configure
docclean manclean maintainer-clean::
rm -f ${MANOBJS}
doc man:: ${MANOBJS}
installdirs:
$(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${bindir} \
${DESTDIR}${localstatedir}/run ${DESTDIR}${sysconfdir}
$(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man1
install:: isc-config.sh installdirs
${INSTALL_SCRIPT} isc-config.sh ${DESTDIR}${bindir}
${INSTALL_DATA} ${srcdir}/isc-config.sh.1 ${DESTDIR}${mandir}/man1
tags:
rm -f TAGS
+23 -12
View File
@@ -27,8 +27,8 @@ BIND 9
- Improved Portability Architecture
BIND version 9 development has been underwritten by the following
organizations:
BIND version 9 development has been under written by the following
organisations:
Sun Microsystems, Inc.
Hewlett Packard
@@ -42,6 +42,16 @@ BIND 9
Stichting NLnet - NLnet Foundation
Nominum, Inc.
BIND 9.4-ESV (Extended Support Version)
BIND 9.4-ESV is the Extended Support Version of BIND 9.4
and incorporates the final maintenance release fixing bugs
in BIND 9.4.3.
BIND 9.4-ESV will be supported until December 31, 2010, at
which time you will need to upgrade to the current release
of BIND.
BIND 9.4.3
BIND 9.4.3 is a maintenance release, fixing bugs in 9.4.2.
@@ -67,7 +77,7 @@ BIND 9.4.0
Implemented "additional section caching" (or "acache"), an
internal cache framework for additional section content to
improve response performance. Several configuration options
were provided to control the behavior.
were provided to control the behaviour.
New notify type 'master-only'. Enable notify for master
zones only.
@@ -76,13 +86,14 @@ BIND 9.4.0
rndc now allows addresses to be set in the server clauses.
New option "allow-query-cache". This lets allow-query be
used to specify the default zone access level rather than
having to have every zone override the global value.
allow-query-cache can be set at both the options and view
levels. If allow-query-cache is not set then allow-recursion
is used if set, otherwise allow-query is used if set, otherwise
the default (localhost; localnets;) is used.
New option "allow-query-cache". This lets "allow-query"
be used to specify the default zone access level rather
than having to have every zone override the global value.
"allow-query-cache" can be set at both the options and view
levels. If "allow-query-cache" is not set then "allow-recursion"
is used if set, otherwise "allow-query" is used if set
unless "recursion no;" is set in which case "none;" is used,
otherwise the default (localhost; localnets;) is used.
rndc: the source address can now be specified.
@@ -150,12 +161,12 @@ BIND 9.4.0
options for dnssec-signzone specify the input and output
formats.
dnssec-signzone can now randomize signature end times
dnssec-signzone can now randomise signature end times
(dnssec-signzone -j jitter).
Add support for CH A record.
Add additional zone data consistancy checks. named-checkzone
Add additional zone data consistency checks. named-checkzone
has extended checking of NS, MX and SRV record and the hosts
they reference. named has extended post zone load checks.
New zone options: check-mx and integrity-check.
+4 -4
View File
@@ -55,7 +55,7 @@ at least specify `--with-idn' option to enable IDN support.
`--with-libiconv' assumes that your C compiler has `-R'
option, and that the option adds the specified run-time path
to an exacutable binary. If `-R' option of your compiler has
to an executable binary. If `-R' option of your compiler has
different meaning, or your compiler lacks the option, you
should use `--with-iconv' option instead. Binary command
without run-time path information might be unexecutable.
@@ -68,7 +68,7 @@ at least specify `--with-idn' option to enable IDN support.
specified, `--with-iconv' is prior to `--with-libiconv'.
--with-iconv=ICONV_LIBSPEC
If your libc doens't provide iconv(), you need to specify the
If your libc doesn't provide iconv(), you need to specify the
library containing iconv() with this option. `ICONV_LIBSPEC'
is the argument(s) to `cc' or `ld' to link the library, for
example, `--with-iconv="-L/usr/local/lib -liconv"'.
@@ -82,7 +82,7 @@ at least specify `--with-idn' option to enable IDN support.
this option is not specified, `-L${PREFIX}/lib -lidnkit' is
assumed, where ${PREFIX} is the installation prefix specified
with `--with-idn' option above. You may need to use this
option to specify extra argments, for example,
option to specify extra arguments, for example,
`--with-idnlib="-L/usr/local/lib -R/usr/local/lib -lidnkit"'.
Please consult `README' for other configuration options.
@@ -109,4 +109,4 @@ about idnkit and this patch.
Bug reports and comments on this kit should be sent to
[email protected] and [email protected], respectively.
; $Id: README.idnkit,v 1.2.2.2 2005/09/12 02:12:08 marka Exp $
; $Id: README.idnkit,v 1.2.2.3 2009/01/19 00:36:25 marka Exp $
Loaded 100 of 2712 files, more files were not shown because too many files have changed in this diff. Show more