Commit Graph

1281 Commits

Author SHA1 Message Date
cegger ecc4ad527f buildfix: re-adapt to major()/minor() returning a 32bit value. 2009-01-21 17:16:12 +00:00
yamt 70de973662 g/c BUFQ_FOO() macros and use bufq_foo() directly. 2009-01-13 13:33:58 +00:00
cegger 8c2b3a39bc make this compile 2009-01-11 10:58:26 +00:00
cegger 378bd0b618 make this compile 2009-01-11 10:47:37 +00:00
cegger e6e72079ad make this compile 2009-01-11 10:25:29 +00:00
cegger 08ebead94e make this compile 2009-01-11 09:51:38 +00:00
reinoud 339f5c5772 Add ISO partition detection enabling auto-detection of iso9660 and UDF
partitions on optical media like CD/DVD/BD but also on all other media if
there is no NetBSD disklabel or MBR label.

Also fix cd's readdisklabel arguments so the ioctl's arrive at the right
device (!) and update its default label to make more sense.
2008-12-30 19:38:36 +00:00
bouyer 5a45b84ca9 If we return an error make sure we don't return a b_resid of 0; or this
will trigger a KASSERT in physio_done(). Fix issue reported by Todd Kover
on tech-kern@
2008-11-17 21:19:03 +00:00
bouyer 99f68f2ca2 cpu_intr_p() doesn't account for software interrupts (e.g. callouts) so
we can't use it here. Rssurect ATACH_TH_RUN, backing out
src/sys/dev/ata/ata.c 1.101
src/sys/dev/ata/ata_wdc.c 1.90
src/sys/dev/ata/atavar.h 1.77
src/sys/dev/ic/wdc.c 1.255
src/sys/dev/scsipi/atapi_wdc.c 1.108
Should fix kern/39927 and kern/39725.
2008-11-16 19:31:21 +00:00
dyoung de87fe677d *** Summary ***
When a link-layer address changes (e.g., ifconfig ex0 link
02🇩🇪ad:be:ef:02 active), send a gratuitous ARP and/or a Neighbor
Advertisement to update the network-/link-layer address bindings
on our LAN peers.

Refuse a change of ethernet address to the address 00:00:00:00:00:00
or to any multicast/broadcast address.  (Thanks matt@.)

Reorder ifnet ioctl operations so that driver ioctls may inherit
the functions of their "class"---ether_ioctl(), fddi_ioctl(), et
cetera---and the class ioctls may inherit from the generic ioctl,
ifioctl_common(), but both driver- and class-ioctls may override
the generic behavior.  Make network drivers share more code.

Distinguish a "factory" link-layer address from others for the
purposes of both protecting that address from deletion and computing
EUI64.

Return consistent, appropriate error codes from network drivers.

Improve readability.  KNF.

*** Details ***

In if_attach(), always initialize the interface ioctl routine,
ifnet->if_ioctl, if the driver has not already initialized it.
Delete if_ioctl == NULL tests everywhere else, because it cannot
happen.

In the ioctl routines of network interfaces, inherit common ioctl
behaviors by calling either ifioctl_common() or whichever ioctl
routine is appropriate for the class of interface---e.g., ether_ioctl()
for ethernets.

Stop (ab)using SIOCSIFADDR and start to use SIOCINITIFADDR.  In
the user->kernel interface, SIOCSIFADDR's argument was an ifreq,
but on the protocol->ifnet interface, SIOCSIFADDR's argument was
an ifaddr.  That was confusing, and it would work against me as I
make it possible for a network interface to overload most ioctls.
On the protocol->ifnet interface, replace SIOCSIFADDR with
SIOCINITIFADDR.  In ifioctl(), return EPERM if userland tries to
invoke SIOCINITIFADDR.

In ifioctl(), give the interface the first shot at handling most
interface ioctls, and give the protocol the second shot, instead
of the other way around. Finally, let compatibility code (COMPAT_OSOCK)
take a shot.

Pull device initialization out of switch statements under
SIOCINITIFADDR.  For example, pull ..._init() out of any switch
statement that looks like this:

        switch (...->sa_family) {
        case ...:
                ..._init();
                ...
                break;
        ...
        default:
                ..._init();
                ...
                break;
        }

Rewrite many if-else clauses that handle all permutations of IFF_UP
and IFF_RUNNING to use a switch statement,

        switch (x & (IFF_UP|IFF_RUNNING)) {
        case 0:
                ...
                break;
        case IFF_RUNNING:
                ...
                break;
        case IFF_UP:
                ...
                break;
        case IFF_UP|IFF_RUNNING:
                ...
                break;
        }

unifdef lots of code containing #ifdef FreeBSD, #ifdef NetBSD, and
#ifdef SIOCSIFMTU, especially in fwip(4) and in ndis(4).

In ipw(4), remove an if_set_sadl() call that is out of place.

In nfe(4), reuse the jumbo MTU logic in ether_ioctl().

Let ethernets register a callback for setting h/w state such as
promiscuous mode and the multicast filter in accord with a change
in the if_flags: ether_set_ifflags_cb() registers a callback that
returns ENETRESET if the caller should reset the ethernet by calling
if_init(), 0 on success, != 0 on failure.  Pull common code from
ex(4), gem(4), nfe(4), sip(4), tlp(4), vge(4) into ether_ioctl(),
and register if_flags callbacks for those drivers.

Return ENOTTY instead of EINVAL for inappropriate ioctls.  In
zyd(4), use ENXIO instead of ENOTTY to indicate that the device is
not any longer attached.

Add to if_set_sadl() a boolean 'factory' argument that indicates
whether a link-layer address was assigned by the factory or some
other source.  In a comment, recommend using the factory address
for generating an EUI64, and update in6_get_hw_ifid() to prefer a
factory address to any other link-layer address.

Add a routing message, RTM_LLINFO_UPD, that tells protocols to
update the binding of network-layer addresses to link-layer addresses.
Implement this message in IPv4 and IPv6 by sending a gratuitous
ARP or a neighbor advertisement, respectively.  Generate RTM_LLINFO_UPD
messages on a change of an interface's link-layer address.

In ether_ioctl(), do not let SIOCALIFADDR set a link-layer address
that is broadcast/multicast or equal to 00:00:00:00:00:00.

Make ether_ioctl() call ifioctl_common() to handle ioctls that it
does not understand.

In gif(4), initialize if_softc and use it, instead of assuming that
the gif_softc and ifp overlap.

Let ifioctl_common() handle SIOCGIFADDR.

Sprinkle rtcache_invariants(), which checks on DIAGNOSTIC kernels
that certain invariants on a struct route are satisfied.

In agr(4), rewrite agr_ioctl_filter() to be a bit more explicit
about the ioctls that we do not allow on an agr(4) member interface.

bzero -> memset.  Delete unnecessary casts to void *.  Use
sockaddr_in_init() and sockaddr_in6_init().  Compare pointers with
NULL instead of "testing truth".  Replace some instances of (type
*)0 with NULL.  Change some K&R prototypes to ANSI C, and join
lines.
2008-11-07 00:20:01 +00:00
bouyer 2887906e27 Kill ATACH_TH_RUN and use cpu_intr_p() instead. 2008-10-02 21:05:17 +00:00
gmcgarry 0de5da9678 Replace most gcc-specific __attribute__ uses with BSD-style sys/cdef.h
preprocessor macros.
2008-09-08 23:36:53 +00:00
gmcgarry 629a542107 Remove unreachable code introduced by rev 1.224. Fixes PR#38973. 2008-09-05 22:25:39 +00:00
dholland a3648fe76e Reword some misleading code.
ok bouyer@
2008-09-02 08:58:07 +00:00
dholland 4b5720fd9e fix typo in comment 2008-09-01 22:00:30 +00:00
drochner 983ec2783f split device/softc for sd (tested with a USB stick) 2008-07-16 18:54:09 +00:00
drochner a3df0dfc03 split device/softc for scsibus 2008-07-16 18:50:58 +00:00
drochner cc7bfbe664 set the buffer's "resid" if a raw SCSI command fails, otherwise a
diagnostic check in kern_physio is set up
2008-07-14 12:36:44 +00:00
hannken 773658bf7e The Intel SCA backplane "ESG-SHV" does not support logical units. 2008-07-03 13:22:31 +00:00
cegger 708f88d69f use device_lookup_private to get softc 2008-06-12 23:06:14 +00:00
tsutsui 887a89aa5c Use device_lookup_private() rather than using cd_devs[] directly to get softc.
XXX maybe we should change a type of cd_devs[] in struct cfdriver
    from (void *) to device_t.
2008-06-08 18:18:33 +00:00
jnemeth c93b478e9f add support for drvctl properties 2008-05-12 21:39:56 +00:00
tron 4f712549a9 Fix SSP kernel builds. 2008-05-12 09:41:02 +00:00
mlelstv 42e9b7252f Reintroduce the NODOORLOCK quirk. Helps with PR kern/23875. 2008-05-11 05:17:23 +00:00
reinoud ffc24fca06 Implement write support for the MMC framework. This consists of a setting
up of write parameters call and a call to perform a series of operations on
these devices.

Note that the MMC framework interface is still not exposed to userland
unless the expose_mmc flag is set. This is to prevent applications to build
on a possibly still moving target. This flag will eventually be removed.
2008-05-08 12:57:19 +00:00
yamt c331e3e5e9 getiobuf(false, NULL) -> getiobuf(NULL, false) 2008-05-06 11:08:19 +00:00
reinoud 62c4a64698 Extend the MMC framework to also create sensible reports on audio discs. 2008-05-02 16:06:38 +00:00
reinoud f83002a905 Add definitions for the close track/session, reserve track and repair
track SCSI commands.
2008-05-02 15:56:25 +00:00
reinoud 87bf4ab915 Fixup CD and DVD drives that appear to be on crack when reporting features.
They state f.e. that a recordable CD-R is rewritable or completely forget
that the fixed packet size formatted CD-RW is strict overwrite rewritable
and not randomly rewritable.
2008-05-02 15:53:10 +00:00
reinoud 8d14ab3bcb Make the SCSI sense code "Logical Unit Not Ready, Operation In Progress"
(Sense code 0x04, 0x07) not a fatal error anymore but retry command later.
This sense code can be returned on a CD-MRW write that encounters a bad
block resulting in the drive being busy relocating it. During that time it
can return this sense code to indicate its busy for a while.

Also reduce waiting time for the other "Logical Unix Not Ready, Long Write
In Progress" to half a second.
2008-05-02 15:34:16 +00:00
martin ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
cegger 13783bfd7e use aprint_*_dev and device_xname 2008-04-05 15:47:00 +00:00
cube 58f7b5e1f3 Split device_t for cd(4). 2008-03-24 18:27:06 +00:00
cube b1be269fbd Split device_t and softc for atapibus(4). 2008-03-24 14:44:26 +00:00
cube 7aa6248cdf Split device_t and softc for ATA devices, as well as wd(4). Other
cosmetic changes where appropriate.
2008-03-18 20:46:35 +00:00
yamt ed28705cce fix a double-free bug introduced by the following change. PR/38179.
revision 1.75
    date: 2008/01/29 17:26:57;  author: dyoung;  state: Exp;  lines: +34 -15
    Use device_t.  Add a handler for child detachment.  Now I can detach
    cd0 at atapibus0 without getting a panic when atapibus0 detaches,
    later.
2008-03-08 10:31:52 +00:00
rmind c6186face4 Welcome to 4.99.55:
- Add a lot of missing selinit() and seldestroy() calls.

- Merge selwakeup() and selnotify() calls into a single selnotify().

- Add an additional 'events' argument to selnotify() call.  It will
  indicate which event (POLL_IN, POLL_OUT, etc) happen.  If unknown,
  zero may be used.

Note: please pass appropriate value of 'events' where possible.
Proposed on: <tech-kern>
2008-03-01 14:16:49 +00:00
dyoung f612df5fb6 Use PMF_FN_ARGS, PMF_FN_PROTO. 2008-02-29 06:38:28 +00:00
drochner e4b37a874e put back the old shutdown handlers to flush the disk cache,
the pmf API can't deal with all the different suspend/resume/reboot
cases well yet, so better keep suspend/resume and reboot/halt/poweroff
clearly seperated
2008-02-21 21:52:06 +00:00
dyoung 534869a24d Use device_t. Add a handler for child detachment. Now I can detach
cd0 at atapibus0 without getting a panic when atapibus0 detaches,
later.
2008-01-29 17:26:57 +00:00
ad 0664a0459b Start detangling lock.h from intr.h. This is likely to cause short term
breakage, but the mess of dependencies has been regularly breaking the
build recently anyhow.
2008-01-04 21:17:40 +00:00
ad 4a780c9ae2 Merge vmlocking2 to head. 2008-01-02 11:48:20 +00:00
perry b6a2ef7569 Convert many of the uses of __attribute__ to equivalent
__packed, __unused and __dead macros from cdefs.h
2007-12-25 18:33:32 +00:00
dyoung 6f3852fab4 Constify struct ifnet->if_sadl and every use throughout the tree.
Add if_set_sadl() that both sets the link-layer address length and
replaces the current link-layer address with a new one, and use it
throughout the tree.
2007-12-20 21:08:17 +00:00
jmcneill 4c1d81b2b5 Merge jmcneill-pm branch. 2007-12-09 20:27:42 +00:00
pooka 4e38160d4d Do not "return 1" from kqfilter for errors. That value is passed
directly to the userland caller and results in a mysterious EPERM.
Instead, return EINVAL or something else sensible depending on the
case.
2007-12-05 17:19:46 +00:00
jmcneill b276edd821 aprintify 2007-12-01 14:46:04 +00:00
reinoud 9c2e200bb1 Pullup fixes from UDF write development project. This patch fixes a
conceptional bug in mmc_discinfo, improves DVD+R feature detection and
prevents corruption of mmc_trackinfo readout on some devices that return
short trackinfo structures.
2007-11-27 18:06:37 +00:00
ad a2a3828545 machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h 2007-10-19 11:59:34 +00:00
christos b96c4fd9a6 PR/37108: Pauly Goyette: Compute the timeout value, before immediate is
changed for atapi tape drives.
2007-10-11 16:42:52 +00:00