Commit Graph

6390 Commits

Author SHA1 Message Date
Pawel Jakub Dawidek
6868734cbe For compatibility with Linux and Solaris add poweroff(8).
It is implemented as a hard link to shutdown(8) and it is equivalent of:

	# shutdown -p now

While I'm here put one line of usage into one line of C code so it is easier to
grep(1) and separate unrelated code with empty line.

MFC after:	2 weeks
2010-12-30 18:06:31 +00:00
Konstantin Belousov
a738d4cf20 Add support for FS_TRIM to user-mode UFS utilities.
Reviewed by:	mckusick, pjd, pho
Tested by:	pho
MFC after:	1 month
2010-12-29 12:31:18 +00:00
Simon L. B. Nielsen
d97326d09b Fix deprecated warning about -L which said -i was deprecated.
MFC after:	3 days
2010-12-26 22:29:44 +00:00
Pawel Jakub Dawidek
a7130d73a6 Detect when resource is configured more than once.
MFC after:	3 days
2010-12-26 19:08:41 +00:00
Pawel Jakub Dawidek
66db33a13b When node-specific configuration is missing in resource section, provide
more useful information. Instead of:

	hastd: remote address not configured for resource foo

Print the following:

	No resource foo configuration for this node (acceptable node names: freefall, freefall.freebsd.org, 44333332-4c44-4e31-4a30-313920202020).

MFC after:	3 days
2010-12-26 19:07:58 +00:00
Andrey V. Elsukov
5c98f5b0da Check number of arguments before trying to read arg0. This prevents access
to arg0 and dumping core when `gpart bootcode` called without arguments.
2010-12-21 17:24:32 +00:00
Philippe Charnier
fe71384015 Add __unused. Ansi prototypes. 2010-12-19 13:40:38 +00:00
Pawel Jakub Dawidek
fba1bf5a2c The 'ret' variable is of type ssize_t and we use proper format for it (%zd), so
no (bogus) cast is needed.

MFC after:	3 days
2010-12-16 19:48:03 +00:00
David E. O'Brien
d8ca56cb98 Revert r216473.
WARNS=6 causes "warning: cast increases required alignment of target type"
on arm, ia64, mips, and sparc64.
2010-12-16 17:54:56 +00:00
Pawel Jakub Dawidek
cd7b7ee577 Improve problems logging.
MFC after:	3 days
2010-12-16 07:30:47 +00:00
Pawel Jakub Dawidek
7208920499 Don't ignore errors from remote requests.
MFC after:	3 days
2010-12-16 07:29:58 +00:00
Pawel Jakub Dawidek
347bde360a Log the fact of launching and include protocol version number.
MFC after:	3 days
2010-12-16 07:28:40 +00:00
David E. O'Brien
eed51a7443 Bump WARNS to 6. 2010-12-16 00:36:10 +00:00
David E. O'Brien
7ae53fe908 GEOM virstor .so does not need libmd. 2010-12-16 00:00:28 +00:00
David E. O'Brien
8494b7389a Rename the generic "CLASS" to the more specific "GEOM_CLASS".
While I'm here remove redundancy and inconsistencies.

Obtained from: Juniper Networks
2010-12-15 23:45:12 +00:00
David E. O'Brien
7838c4d1c1 Rename the generic "CLASS" to the more specific "GEOM_CLASS".
While I'm here remove redundancy and inconsistencies.

Obtained from: Juniper Networks
2010-12-15 23:24:34 +00:00
Konstantin Belousov
03ee10d8e4 Add the missed 'p' flag to getopt() optstring argument.
MFC after:	1 week
2010-12-15 12:45:28 +00:00
Joel Dahl
f041f6a7b7 Remove the advertising clause from UCB copyrighted files in sbin. This
is in accordance with the information at
ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change
2010-12-12 21:26:12 +00:00
Kenneth D. Merry
7c103dde1e Fix a few issues related to the XPT_GDEV_ADVINFO CCB.
camcontrol.c:	In buildbusdevlist(), don't attempt to get call
		getdevid() for an unconfigured device, even when the
		verbose flag is set.  The cam_open_btl() call will almost
		certainly fail.

		Probe for the buffer size when issuing the XPT_GDEV_ADVINFO
		CCB.  Probing for the buffer size first helps us avoid
		allocating the maximum buffer size when it really may not
		be necessary.  This also helps avoid errors from
		cam_periph_mapmem() if we attempt to map more than MAXPHYS.

cam_periph.c:	In cam_periph_mapmem(), if the XPT_GDEV_ADVINFO CCB
		shows a bufsiz of 0, we don't have anything to map,
		so just return.

		Also, set the maximum mapping size to MAXPHYS
		instead of DFLTPHYS for XPT_GDEV_ADVINFO CCBs,
		since they don't actually go down to the hardware.

scsi_pass.c:	Don't bother mapping the buffer in XPT_GDEV_ADVINFO
		CCBs if bufsiz is 0.
2010-12-10 21:38:51 +00:00
Gleb Smirnoff
8d5fa60980 - Fix array bounds checking. [1]
- Add message length checking.

PR:		151664 [1]
Submitted by:	Alexey Illarionov <littlesavage rambler.ru> [1]
Reviewed by:	yar
2010-12-08 15:12:37 +00:00
Gleb Smirnoff
82641e1d1a Add RTM_IEEE80211 to array of route message descriptions.
PR:		151664
Submitted by:	Alexey Illarionov <littlesavage rambler.ru>
2010-12-08 15:10:27 +00:00
Weongyo Jeong
6e3cb00068 Introduces IFF_CANTCONFIG interface flag to point that the interface
isn't configurable in a meaningful way.  This is for ifconfig(8) or
other tools not to change code whenever IFT_USB-like interfaces are
registered at the interface list.

Reviewed by:	brooks
No objections:	gavin, jkim
2010-12-07 20:23:47 +00:00
Ulrich Spörlein
cded07a878 Move most of the remaining USD/PSD/SMM papers into share/doc 2010-12-04 10:11:20 +00:00
Xin LI
62ad217a9b * Recommend a overwrite of whole geli provider before use.
* Correct a typo while I'm there.

Reviewed by:	pjd
MFC after:	2 weeks
2010-12-03 10:06:19 +00:00
Kevin Lo
a2299ad8e5 Closing file descriptors when it's done 2010-12-01 08:07:32 +00:00
Weongyo Jeong
6d2f981e9b Don't print usbus[0-9] interfaces that it's not the interesting
interface type for ifconfig(8).
2010-12-01 03:24:38 +00:00
Kenneth D. Merry
06e794928b Add Serial Management Protocol (SMP) passthrough support to CAM.
This includes support in the kernel, camcontrol(8), libcam and the mps(4)
driver for SMP passthrough.

The CAM SCSI probe code has been modified to fetch Inquiry VPD page 0x00
to determine supported pages, and will now fetch page 0x83 in addition to
page 0x80 if supported.

Add two new CAM CCBs, XPT_SMP_IO, and XPT_GDEV_ADVINFO.  The SMP CCB is
intended for SMP requests and responses.  The ADVINFO is currently used to
fetch cached VPD page 0x83 data from the transport layer, but is intended
to be extensible to fetch other types of device-specific data.

SMP-only devices are not currently represented in the CAM topology, and so
the current semantics are that the SIM will route SMP CCBs to either the
addressed device, if it contains an SMP target, or its parent, if it
contains an SMP target.  (This is noted in cam_ccb.h, since it will change
later once we have the ability to have SMP-only devices in CAM's topology.)

smp_all.c,
smp_all.h:		New helper routines for SMP.  This includes
			SMP request building routines, response parsing
			routines, error decoding routines, and structure
			definitions for a number of SMP commands.

libcam/Makefile:	Add smp_all.c to libcam, so that SMP functionality
			is available to userland applications.

camcontrol.8,
camcontrol.c:		Add smp passthrough support to camcontrol.  Several
			new subcommands are now available:

			'smpcmd' functions much like 'cmd', except that it
			allows the user to send generic SMP commands.

			'smprg' sends the SMP report general command, and
			displays the decoded output.  It will automatically
			fetch extended output if it is available.

			'smppc' sends the SMP phy control command, with any
			number of potential options.  Among other things,
			this allows the user to reset a phy on a SAS
			expander, or disable a phy on an expander.

			'smpmaninfo' sends the SMP report manufacturer
			information and displays the decoded output.

			'smpphylist' displays a list of phys on an
			expander, and the CAM devices attached to those
			phys, if any.

cam.h,
cam.c:			Add a status value for SMP errors
			(CAM_SMP_STATUS_ERROR).

			Add a missing description for CAM_SCSI_IT_NEXUS_LOST.

			Add support for SMP commands to cam_error_string().

cam_ccb.h:		Rename the CAM_DIR_RESV flag to CAM_DIR_BOTH.  SMP
			commands are by nature bi-directional, and we may
			need to support bi-directional SCSI commands later.

			Add the XPT_SMP_IO CCB.  Since SMP commands are
			bi-directional, there are pointers for both the
			request and response.

			Add a fill routine for SMP CCBs.

			Add the XPT_GDEV_ADVINFO CCB.  This is currently
			used to fetch cached page 0x83 data from the
			transport later, but is extensible to fetch many
			other types of data.

cam_periph.c:		Add support in cam_periph_mapmem() for XPT_SMP_IO
			and XPT_GDEV_ADVINFO CCBs.

cam_xpt.c:		Add support for executing XPT_SMP_IO CCBs.

cam_xpt_internal.h:	Add fields for VPD pages 0x00 and 0x83 in struct
			cam_ed.

scsi_all.c:		Add scsi_get_sas_addr(), a function that parses
			VPD page 0x83 data and pulls out a SAS address.

scsi_all.h:		Add VPD page 0x00 and 0x83 structures, and a
			prototype for scsi_get_sas_addr().

scsi_pass.c:		Add support for mapping buffers in XPT_SMP_IO and
			XPT_GDEV_ADVINFO CCBs.

scsi_xpt.c:		In the SCSI probe code, first ask the device for
			VPD page 0x00.  If any VPD pages are supported,
			that page is required to be implemented.  Based on
			the response, we may probe for the serial number
			(page 0x80) or device id (page 0x83).

			Add support for the XPT_GDEV_ADVINFO CCB.

sys/conf/files:		Add smp_all.c.

mps.c:			Add support for passing in a uio in mps_map_command(),
			so we can map a S/G list at once.

			Add support for SMP passthrough commands in
			mps_data_cb().  SMP is a special case, because the
			first buffer in the S/G list is outbound and the
			second buffer is inbound.

			Add support for warning the user if the busdma code
			comes back with more buffers than will work for the
			command.  This will, for example, help the user
			determine why an SMP command failed if busdma comes
			back with three buffers.

mps_pci.c:		Add sys/uio.h.

mps_sas.c:		Add the SAS address and the parent handle to the
			list of fields we pull from device page 0 and cache
			in struct mpssas_target.  These are needed for SMP
			passthrough.

			Add support for the XPT_SMP_IO CCB.  For now, this
			CCB is routed to the addressed device if it supports
			SMP, or to its parent if it does not and the parent
			does.  This is necessary because CAM does not
			currently support SMP-only nodes in the topology.

			Make SMP passthrough support conditional on
			__FreeBSD_version >= 900026.  This will make it
			easier to MFC this change to the driver without
			MFCing the CAM changes as well.

mps_user.c:		Un-staticize mpi_init_sge() so we can use it for
			the SMP passthrough code.

mpsvar.h:		Add a uio and iovecs into struct mps_command for
			SMP passthrough commands.

			Add a cm_max_segs field to struct mps_command so
			that we can warn the user if busdma comes back with
			too many segments.

			Clear the cm_reply when a command gets freed.  If
			it is not cleared, reply frames will eventually get
			freed into the pool multiple times and corrupt the
			pool.  (This fix is from scottl.)

			Add a prototype for mpi_init_sge().

sys/param.h:		Bump __FreeBSD_version to 900026 for the for the
			inclusion of the XPT_GDEV_ADVINFO and XPT_SMP_IO
			CAM CCBs.
2010-11-30 22:39:46 +00:00
Rebecca Cran
1161d4202c Fix some more warnings found by clang. 2010-11-22 20:10:48 +00:00
Rebecca Cran
59b956cba0 Fix use of AND operator: should be bitwise instead of logical. 2010-11-22 19:40:27 +00:00
Rebecca Cran
e267ef95d5 Don't generate input() since it's not used. 2010-11-22 14:16:22 +00:00
Rebecca Cran
09c7c81c16 Don't generate input() since it's not used. 2010-11-22 12:33:48 +00:00
Andrey V. Elsukov
68f7502341 Add SIGINT handler to gpart restore action.
MFC after:	1 week
2010-11-22 11:24:11 +00:00
Andrey V. Elsukov
80085938d4 Always dump partition labels with gpart backup, but gpart restore
does restore them only when -l option is specified [1]. Make number of
entries field in backup format optional. Document -l and -r options of
`gpart show` action.

Suggested by:	pjd [1]
MFC after:	1 week
2010-11-22 10:08:33 +00:00
Kevin Lo
59d8bf609f Plug an fd leak 2010-11-22 07:00:47 +00:00
Kevin Lo
5983e89162 Fix missing closedir()
Reviewed by:	imp
2010-11-21 04:02:37 +00:00
Kirk McKusick
18709a09ed Delete /sys/ufs/ffs/README.snapshot as it is no longer relevant.
Drop reference to it in mount(8).

MFC:	3 days
2010-11-20 18:40:50 +00:00
Andrey V. Elsukov
9fe175f914 Add to gpart(8) an ability to backup partition table and
restore it from given backup.

Discussed with:	geom@
Approved by:	kib (mentor)
MFC after:	1 week
2010-11-20 16:03:53 +00:00
Ryan Stone
698ec346a1 When doing a camcontrol rescan all or a camcontrol reset all, use the wildcard
path id for enumerating the available busses.  Previously camcontrol was
implicitly passing 0 as the first path id, which meant that if bus 0 was not
present camcontrol would fail with EINVAL instead of rescanning/resetting any
busses that were present.

Approved by:	emaste (mentor)
MFC after:	1 week
2010-11-19 03:47:10 +00:00
John Baldwin
8da821ff03 Remove unused autofs userland bits.
Approved by:	core
2010-11-17 15:42:47 +00:00
Pawel Jakub Dawidek
d448536ceb Move timeout.tv_sec initialization outside the loop - sigtimedwait(2) won't
modify it.

Submitted by:	Mikolaj Golub <to.my.trociny@gmail.com>
MFC after:	3 days
2010-11-15 03:07:42 +00:00
Pawel Jakub Dawidek
1dd5a4bfa2 1. Exit when we cannot create incoming connection.
2. Improve logging to inform which connection can't be created.

Submitted by:	[1] Mikolaj Golub <to.my.trociny@gmail.com>
MFC after:	3 days
2010-11-15 03:05:33 +00:00
Marius Strobl
8d88402858 When setting a media with no sub-type specified also reset the type
specific options along with the global ones so these options don't
stick when f.e. switching to IFM_AUTO.

MFC after:	2 weeks
2010-11-13 22:40:37 +00:00
Marius Strobl
a84e1b3b24 When printing media with more than one media option set aggregate these
in a comma delimited list instead of repeating "mediaopt" for each one.
This matches how the options of the active media are printed with
print_media_word() and brings us in line what NetBSD does.

MFC after:	2 weeks
2010-11-13 21:03:19 +00:00
Konstantin Belousov
35e3987f15 In printfile(), exit the process instead of only printing the warning.
This fixes verbose mode when either -i specified non-existent kldfile
id, or the file was unloaded between two kldnext(2) calls.

While there, fix printfile() definition to be style(9)-compliant.

Submitted by:	arundel
MFC after:	1 week
2010-11-13 16:49:07 +00:00
Joel Dahl
db28020476 Use "cylinder" instead of "cyl" for consistency.
Reviewed by:	phk
2010-11-13 15:28:44 +00:00
Luigi Rizzo
ae99fd0e07 The first customer of the SO_USER_COOKIE option:
the "sockarg" ipfw option matches packets associated to
a local socket and with a non-zero so_user_cookie value.
The value is made available as tablearg, so it can be used
as a skipto target or pipe number in ipfw/dummynet rules.

Code by Paul Joe, manpage by me.

Submitted by:	Paul Joe
MFC after:	1 week
2010-11-12 13:05:17 +00:00
Rui Paulo
785901d6fa Append to CFLAGS, don't clobber it.
Submitted by:	loos
2010-11-05 11:31:39 +00:00
Rebecca Cran
f974f3ffa1 r214781 caused the timer value to be rounded down, so that if the user asked
for 59 minutes 30 was sent to the drive. The timer value is now always
rounded up.

Reported by: mav
2010-11-04 20:31:12 +00:00
Rebecca Cran
9e5c40b385 Fix standby timer calculation: the timer was being set 30 minutes later
than the user requested.
Also, 21 minutes is encoded as 252 and 22-29 minutes cannot be encoded
so must be rounded up to 30.

PR:	bin/151871
2010-11-04 15:24:32 +00:00
Pawel Jakub Dawidek
448efa9421 Send packets to remote node only via the send thread to avoid possible
races - in this case a keepalive packet was send from wrong thread which
lead to connection dropping, because of corrupted packet.

Fix it by sending keepalive packets directly from the send thread.
As a bonus we now send keepalive packets only when connection is idle.

Submitted by:	Mikolaj Golub <to.my.trociny@gmail.com>
MFC after:	3 days
2010-11-02 22:13:08 +00:00