From efda3bd00c039d6845508b47bb18d1687c72154e Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Tue, 5 Sep 2006 00:55:51 +0000 Subject: [PATCH] Rename malloc->kmalloc, free->kfree, and realloc->krealloc. Pass 1 --- sys/bus/cam/cam_extend.c | 8 +- sys/bus/cam/cam_periph.c | 8 +- sys/bus/cam/cam_queue.c | 22 +-- sys/bus/cam/cam_sim.c | 6 +- sys/bus/cam/cam_xpt.c | 74 ++++---- sys/bus/cam/scsi/scsi_cd.c | 158 +++++++++--------- sys/bus/cam/scsi/scsi_ch.c | 28 ++-- sys/bus/cam/scsi/scsi_da.c | 14 +- sys/bus/cam/scsi/scsi_low.c | 10 +- sys/bus/cam/scsi/scsi_pass.c | 6 +- sys/bus/cam/scsi/scsi_pt.c | 6 +- sys/bus/cam/scsi/scsi_sa.c | 28 ++-- sys/bus/cam/scsi/scsi_ses.c | 12 +- sys/bus/cam/scsi/scsi_targ_bh.c | 28 ++-- sys/bus/eisa/eisaconf.c | 10 +- sys/bus/firewire/firewire.c | 58 +++---- sys/bus/firewire/fwdev.c | 22 +-- sys/bus/firewire/fwdma.c | 6 +- sys/bus/firewire/fwmem.c | 4 +- sys/bus/firewire/fwohci.c | 10 +- sys/bus/isa/i386/isa_compat.c | 4 +- sys/bus/isa/i386/isa_dma.c | 6 +- sys/bus/isa/isa_common.c | 10 +- sys/bus/isa/pnp.c | 12 +- sys/bus/isa/pnpparse.c | 6 +- sys/bus/isa/vga_isa.c | 10 +- sys/bus/pccard/pccard.c | 8 +- sys/bus/pccard/pccard_cis.c | 8 +- sys/bus/pccard/pccard_cis_quirks.c | 12 +- sys/bus/pci/i386/pci_cfgreg.c | 6 +- sys/bus/pci/i386/pcibus.c | 4 +- sys/bus/pci/pci.c | 18 +- sys/bus/pci/pci_compat.c | 4 +- sys/bus/pci/pcisupport.c | 4 +- sys/bus/ppbus/ppbconf.c | 4 +- sys/bus/usb/ehci.c | 4 +- sys/bus/usb/hid.c | 12 +- sys/bus/usb/ohci.c | 4 +- sys/bus/usb/uhci.c | 14 +- sys/bus/usb/uhub.c | 16 +- sys/bus/usb/usb.c | 12 +- sys/bus/usb/usb_mem.c | 6 +- sys/bus/usb/usb_subr.c | 44 ++--- sys/bus/usb/usbdi.c | 6 +- sys/bus/usb/usbdi_util.c | 6 +- sys/contrib/dev/ath/dragonfly/ah_osdep.c | 4 +- sys/contrib/dev/fla/fla.c | 6 +- sys/contrib/dev/oltr/if_oltr.c | 34 ++-- sys/dev/acpica5/Osd/OsdMemory.c | 12 +- sys/dev/acpica5/Osd/OsdSchedule.c | 6 +- sys/dev/acpica5/Osd/OsdSynch.c | 10 +- sys/dev/acpica5/acpi.c | 16 +- sys/dev/acpica5/acpi_battery.c | 6 +- sys/dev/acpica5/acpi_cmbat.c | 4 +- sys/dev/acpica5/acpi_ec.c | 12 +- sys/dev/acpica5/acpi_pci.c | 6 +- sys/dev/acpica5/acpi_powerres.c | 14 +- sys/dev/agp/agp.c | 16 +- sys/dev/agp/agp_amd.c | 12 +- sys/dev/agp/agp_i810.c | 16 +- sys/dev/crypto/hifn/hifn7751.c | 12 +- sys/dev/crypto/rndtest/rndtest.c | 6 +- sys/dev/crypto/ubsec/ubsec.c | 26 +-- sys/dev/disk/advansys/advansys.c | 6 +- sys/dev/disk/advansys/adwcam.c | 16 +- sys/dev/disk/aha/aha.c | 12 +- sys/dev/disk/ahb/ahb.c | 6 +- sys/dev/disk/aic7xxx/ahc_eisa.c | 4 +- sys/dev/disk/aic7xxx/ahc_pci.c | 4 +- sys/dev/disk/aic7xxx/ahd_pci.c | 4 +- sys/dev/disk/aic7xxx/aic7770.c | 4 +- sys/dev/disk/aic7xxx/aic79xx.c | 60 +++---- sys/dev/disk/aic7xxx/aic79xx_osm.c | 6 +- sys/dev/disk/aic7xxx/aic79xx_pci.c | 4 +- sys/dev/disk/aic7xxx/aic7xxx.c | 40 ++--- sys/dev/disk/aic7xxx/aic7xxx_osm.c | 6 +- sys/dev/disk/aic7xxx/aic7xxx_pci.c | 4 +- sys/dev/disk/ata/ata-all.c | 30 ++-- sys/dev/disk/ata/ata-disk.c | 6 +- sys/dev/disk/ata/ata-pci.c | 10 +- sys/dev/disk/ata/ata-raid.c | 64 +++---- sys/dev/disk/ata/atapi-all.c | 16 +- sys/dev/disk/ata/atapi-cam.c | 18 +- sys/dev/disk/ata/atapi-cd.c | 70 ++++---- sys/dev/disk/ata/atapi-fd.c | 8 +- sys/dev/disk/ata/atapi-tape.c | 8 +- sys/dev/disk/buslogic/bt.c | 8 +- sys/dev/disk/ccd/ccd.c | 44 ++--- sys/dev/disk/fd/fd.c | 4 +- sys/dev/disk/isp/isp_freebsd.c | 8 +- sys/dev/disk/isp/isp_pci.c | 30 ++-- sys/dev/disk/ispfw/ispfw.c | 6 +- sys/dev/disk/mpt/mpt_pci.c | 8 +- sys/dev/disk/ncr/ncr.c | 10 +- sys/dev/disk/sbp/sbp.c | 14 +- sys/dev/disk/simos/simos.c | 4 +- sys/dev/disk/sym/sym_hipd.c | 6 +- sys/dev/disk/vn/vn.c | 10 +- sys/dev/disk/vpo/immio.c | 4 +- sys/dev/disk/vpo/vpo.c | 6 +- sys/dev/disk/wt/wt.c | 6 +- sys/dev/misc/atkbdc_layer/atkbdc_isa.c | 4 +- sys/dev/misc/gpib/gpib.c | 6 +- sys/dev/misc/kbd/atkbd.c | 12 +- sys/dev/misc/kbd/atkbdc.c | 4 +- sys/dev/misc/kbd/kbd.c | 14 +- sys/dev/misc/labpc/labpc.c | 6 +- sys/dev/misc/lpt/lpt.c | 10 +- sys/dev/misc/nmdm/nmdm.c | 4 +- sys/dev/misc/puc/puc.c | 16 +- sys/dev/misc/snp/snp.c | 28 ++-- sys/dev/misc/syscons/daemon/daemon_saver.c | 6 +- sys/dev/misc/syscons/fred/fred_saver.c | 6 +- sys/dev/misc/syscons/schistory.c | 8 +- sys/dev/misc/syscons/scmouse.c | 6 +- sys/dev/misc/syscons/scvtb.c | 4 +- sys/dev/misc/syscons/snake/snake_saver.c | 10 +- sys/dev/misc/syscons/syscons.c | 30 ++-- sys/dev/misc/xrpu/xrpu.c | 4 +- sys/dev/netif/acx/if_acx.c | 18 +- sys/dev/netif/an/if_an.c | 8 +- sys/dev/netif/ath/ath/if_ath.c | 22 +-- sys/dev/netif/ath/rate_amrr/amrr.c | 6 +- sys/dev/netif/ath/rate_onoe/onoe.c | 6 +- sys/dev/netif/ath/rate_sample/sample.c | 6 +- sys/dev/netif/aue/if_aue.c | 12 +- sys/dev/netif/awi/awi.c | 8 +- sys/dev/netif/awi/awi_wep.c | 6 +- sys/dev/netif/axe/if_axe.c | 8 +- sys/dev/netif/bge/if_bge.c | 18 +- sys/dev/netif/cs/if_cs.c | 10 +- sys/dev/netif/cue/if_cue.c | 8 +- sys/dev/netif/cx/if_cx.c | 12 +- sys/dev/netif/dc/if_dc.c | 18 +- sys/dev/netif/de/if_de.c | 6 +- sys/dev/netif/em/if_em.c | 10 +- sys/dev/netif/en_pci/if_en_pci.c | 6 +- sys/dev/netif/fpa/if_fpa.c | 8 +- sys/dev/netif/fwe/if_fwe.c | 4 +- sys/dev/netif/fxp/if_fxp.c | 12 +- sys/dev/netif/ic/if_ic.c | 12 +- sys/dev/netif/ie/if_ie.c | 4 +- sys/dev/netif/ipw/if_ipw.c | 14 +- sys/dev/netif/iwi/if_iwi.c | 30 ++-- sys/dev/netif/kue/if_kue.c | 10 +- sys/dev/netif/le/if_le.c | 4 +- sys/dev/netif/mii_layer/mii.c | 6 +- sys/dev/netif/mii_layer/mlphy.c | 6 +- sys/dev/netif/mii_layer/tlphy.c | 4 +- sys/dev/netif/mn/if_mn.c | 6 +- sys/dev/netif/ndis/if_ndis.c | 46 ++--- sys/dev/netif/plip/if_plip.c | 12 +- sys/dev/netif/ral/rt2560.c | 12 +- sys/dev/netif/ral/rt2661.c | 12 +- sys/dev/netif/re/if_re.c | 8 +- sys/dev/netif/rtw/rtw.c | 12 +- sys/dev/netif/rtw/rtwphy.c | 14 +- sys/dev/netif/rue/if_rue.c | 12 +- sys/dev/netif/sbni/if_sbni_pci.c | 8 +- sys/dev/netif/sis/if_sis.c | 6 +- sys/dev/netif/sk/if_sk.c | 16 +- sys/dev/netif/sr/if_sr.c | 4 +- sys/dev/netif/ti/if_ti.c | 6 +- sys/dev/netif/tx/if_tx.c | 8 +- sys/dev/netif/txp/if_txp.c | 12 +- sys/dev/pccard/cardbus/cardbus.c | 12 +- sys/dev/pccard/cardbus/cardbus_cis.c | 20 +-- sys/dev/pccard/pccbb/pccbb.c | 18 +- sys/dev/raid/amr/amr.c | 28 ++-- sys/dev/raid/amr/amr_cam.c | 14 +- sys/dev/raid/asr/asr.c | 118 ++++++------- sys/dev/raid/ciss/ciss.c | 38 ++--- sys/dev/raid/dpt/dpt_control.c | 4 +- sys/dev/raid/dpt/dpt_scsi.c | 20 +-- sys/dev/raid/ida/ida.c | 4 +- sys/dev/raid/iir/iir.c | 6 +- sys/dev/raid/ips/ips.c | 4 +- sys/dev/raid/ips/ips_ioctl.c | 12 +- sys/dev/raid/mlx/mlx.c | 32 ++-- sys/dev/raid/mly/mly.c | 24 +-- sys/dev/raid/mly/mly_pci.c | 6 +- sys/dev/raid/pst/pst-iop.c | 6 +- sys/dev/raid/pst/pst-raid.c | 10 +- sys/dev/raid/twa/twa.c | 46 ++--- sys/dev/raid/twa/twa_cam.c | 10 +- sys/dev/raid/twa/twa_freebsd.c | 12 +- sys/dev/raid/twe/twe.c | 48 +++--- sys/dev/raid/twe/twe_freebsd.c | 10 +- sys/dev/raid/vinum/vinum.c | 4 +- sys/dev/raid/vinum/vinummemory.c | 6 +- sys/dev/serial/cy/cy.c | 10 +- sys/dev/serial/digi/digi.c | 20 +-- sys/dev/serial/rp/rp.c | 6 +- sys/dev/serial/rp/rp_isa.c | 8 +- sys/dev/serial/rp/rp_pci.c | 6 +- sys/dev/serial/si/si.c | 4 +- sys/dev/serial/sio/sio.c | 10 +- sys/dev/serial/sio/sio_pccard.c | 4 +- sys/dev/serial/stl/stallion.c | 14 +- sys/dev/serial/stli/istallion.c | 6 +- sys/dev/sound/isa/ad1816.c | 8 +- sys/dev/sound/isa/ess.c | 8 +- sys/dev/sound/isa/gusc.c | 14 +- sys/dev/sound/isa/mss.c | 14 +- sys/dev/sound/isa/sb16.c | 8 +- sys/dev/sound/isa/sb8.c | 8 +- sys/dev/sound/isa/sbc.c | 10 +- sys/dev/sound/pci/als4000.c | 10 +- sys/dev/sound/pci/aureal.c | 10 +- sys/dev/sound/pci/cmi.c | 10 +- sys/dev/sound/pci/cs4281.c | 10 +- sys/dev/sound/pci/csa.c | 16 +- sys/dev/sound/pci/csapcm.c | 8 +- sys/dev/sound/pci/ds1.c | 10 +- sys/dev/sound/pci/emu10k1.c | 16 +- sys/dev/sound/pci/es137x.c | 10 +- sys/dev/sound/pci/fm801.c | 10 +- sys/dev/sound/pci/ich.c | 10 +- sys/dev/sound/pci/maestro.c | 10 +- sys/dev/sound/pci/maestro3.c | 14 +- sys/dev/sound/pci/neomagic.c | 16 +- sys/dev/sound/pci/solo.c | 8 +- sys/dev/sound/pci/t4dwave.c | 10 +- sys/dev/sound/pci/via8233.c | 10 +- sys/dev/sound/pci/via82c686.c | 10 +- sys/dev/sound/pci/vibes.c | 8 +- sys/dev/sound/pcm/ac97.c | 10 +- sys/dev/sound/pcm/buffer.c | 22 +-- sys/dev/sound/pcm/fake.c | 8 +- sys/dev/sound/pcm/feeder.c | 10 +- sys/dev/sound/pcm/feeder_fmt.c | 16 +- sys/dev/sound/pcm/feeder_rate.c | 8 +- sys/dev/sound/pcm/sndstat.c | 10 +- sys/dev/sound/pcm/sound.c | 20 +-- sys/dev/sound/pcm/vchan.c | 14 +- sys/dev/sound/usb/uaudio.c | 12 +- sys/dev/sound/usb/uaudio_pcm.c | 8 +- sys/dev/usbmisc/ubsa/ubsa.c | 14 +- sys/dev/usbmisc/udbp/udbp.c | 10 +- sys/dev/usbmisc/uftdi/uftdi.c | 8 +- sys/dev/usbmisc/ugen/ugen.c | 36 ++-- sys/dev/usbmisc/ugen/ugenbuf.c | 10 +- sys/dev/usbmisc/uhid/uhid.c | 18 +- sys/dev/usbmisc/ukbd/ukbd.c | 32 ++-- sys/dev/usbmisc/umass/umass.c | 8 +- sys/dev/usbmisc/umct/umct.c | 16 +- sys/dev/usbmisc/umodem/umodem.c | 8 +- sys/dev/usbmisc/ums/ums.c | 12 +- sys/dev/usbmisc/uplcom/uplcom.c | 14 +- sys/dev/usbmisc/urio/urio.c | 6 +- sys/dev/usbmisc/uscanner/uscanner.c | 10 +- sys/dev/usbmisc/uvisor/uvisor.c | 4 +- sys/dev/usbmisc/uvscom/uvscom.c | 14 +- sys/dev/video/bktr/msp34xx.c | 18 +- sys/dev/video/ctx/ctx.c | 6 +- sys/dev/video/fb/fb.c | 14 +- sys/dev/video/fb/splash.c | 4 +- sys/dev/video/fb/vga.c | 12 +- sys/dev/video/i386/vesa/vesa.c | 16 +- sys/emulation/43bsd/43bsd_file.c | 12 +- sys/emulation/43bsd/43bsd_hostinfo.c | 12 +- .../dragonfly12/dfbsd12_getdirentries.c | 12 +- .../linux/i386/linprocfs/linprocfs_vnops.c | 6 +- sys/emulation/linux/i386/linux_sysvec.c | 4 +- sys/emulation/linux/linux_file.c | 10 +- sys/emulation/linux/linux_getcwd.c | 6 +- sys/emulation/linux/linux_sysctl.c | 10 +- sys/emulation/linux/linux_util.c | 8 +- sys/emulation/ndis/kern_ndis.c | 42 ++--- sys/emulation/ndis/subr_ndis.c | 76 ++++----- sys/emulation/ndis/subr_ntoskrnl.c | 26 +-- sys/i386/i386/autoconf.c | 6 +- sys/i386/i386/bios.c | 6 +- sys/i386/i386/busdma_machdep.c | 26 +-- sys/i386/i386/mem.c | 16 +- sys/i386/i386/nexus.c | 4 +- sys/i386/i386/pnpbios.c | 4 +- sys/i386/i386/userconfig.c | 32 ++-- sys/i386/i386/vm86.c | 4 +- sys/i386/i386/vm_machdep.c | 6 +- sys/i386/isa/ccbque.h | 4 +- sys/kern/imgact_elf.c | 26 +-- sys/kern/imgact_resident.c | 8 +- sys/kern/inflate.c | 14 +- sys/kern/init_main.c | 8 +- sys/kern/kern_checkpoint.c | 50 +++--- sys/kern/kern_descrip.c | 32 ++-- sys/kern/kern_device.c | 8 +- sys/kern/kern_event.c | 6 +- sys/kern/kern_exec.c | 10 +- sys/kern/kern_exit.c | 6 +- sys/kern/kern_firmware.c | 16 +- sys/kern/kern_fork.c | 6 +- sys/kern/kern_intr.c | 10 +- sys/kern/kern_jail.c | 14 +- sys/kern/kern_linker.c | 40 ++--- sys/kern/kern_lockf.c | 6 +- sys/kern/kern_memio.c | 16 +- sys/kern/kern_module.c | 4 +- sys/kern/kern_mpipe.c | 16 +- sys/kern/kern_msfbuf.c | 4 +- sys/kern/kern_objcache.c | 18 +- sys/kern/kern_plimit.c | 8 +- sys/kern/kern_proc.c | 6 +- sys/kern/kern_sfbuf.c | 4 +- sys/kern/kern_shutdown.c | 6 +- sys/kern/kern_sig.c | 12 +- sys/kern/kern_slaballoc.c | 18 +- sys/kern/kern_subr.c | 6 +- sys/kern/kern_sysctl.c | 30 ++-- sys/kern/kern_syslink.c | 12 +- sys/kern/kern_upcall.c | 8 +- sys/kern/kern_varsym.c | 18 +- sys/kern/link_aout.c | 30 ++-- sys/kern/link_elf.c | 52 +++--- sys/kern/lwkt_caps.c | 8 +- sys/kern/subr_blist.c | 14 +- sys/kern/subr_bus.c | 60 +++---- sys/kern/subr_diskmbr.c | 4 +- sys/kern/subr_diskslice.c | 26 +-- sys/kern/subr_eventhandler.c | 6 +- sys/kern/subr_kobj.c | 12 +- sys/kern/subr_rman.c | 26 +-- sys/kern/subr_sbuf.c | 6 +- sys/kern/subr_taskqueue.c | 6 +- sys/kern/sys_generic.c | 20 +-- sys/kern/sys_pipe.c | 6 +- sys/kern/sysv_msg.c | 10 +- sys/kern/sysv_sem.c | 8 +- sys/kern/sysv_shm.c | 18 +- sys/kern/tty.c | 6 +- sys/kern/tty_pty.c | 4 +- sys/kern/tty_subr.c | 8 +- sys/kern/uipc_mbuf.c | 8 +- sys/kern/uipc_mbuf2.c | 6 +- sys/kern/uipc_socket2.c | 4 +- sys/kern/uipc_syscalls.c | 6 +- sys/kern/uipc_usrreq.c | 12 +- sys/kern/vfs_bio.c | 8 +- sys/kern/vfs_cache.c | 34 ++-- sys/kern/vfs_cluster.c | 6 +- sys/kern/vfs_conf.c | 12 +- sys/kern/vfs_init.c | 6 +- sys/kern/vfs_jops.c | 26 +-- sys/kern/vfs_journal.c | 12 +- sys/kern/vfs_lock.c | 4 +- sys/kern/vfs_mount.c | 4 +- sys/kern/vfs_subr.c | 14 +- sys/kern/vfs_syscalls.c | 24 +-- sys/libiconv/iconv.c | 10 +- sys/net/altq/altq_cbq.c | 6 +- sys/net/altq/altq_hfsc.c | 44 ++--- sys/net/altq/altq_priq.c | 14 +- sys/net/altq/altq_red.c | 10 +- sys/net/altq/altq_rio.c | 6 +- sys/net/altq/altq_rmclass.c | 10 +- sys/net/altq/altq_subr.c | 8 +- sys/net/bpf.c | 30 ++-- sys/net/bridge/if_bridge.c | 24 +-- sys/net/bsd_comp.c | 6 +- sys/net/dummynet/ip_dummynet.c | 48 +++--- sys/net/ef/if_ef.c | 8 +- sys/net/faith/if_faith.c | 6 +- sys/net/gif/if_gif.c | 22 +-- sys/net/gre/if_gre.c | 6 +- sys/net/hostcache.c | 4 +- sys/net/i4b/driver/i4b_ipr.c | 4 +- sys/net/i4b/layer4/i4b_i4bdrv.c | 18 +- sys/net/if.c | 22 +-- sys/net/if_media.c | 8 +- sys/net/if_var.h | 4 +- sys/net/ip6fw/ip6_fw.c | 22 +-- sys/net/ip_mroute/ip_mroute.c | 36 ++-- sys/net/ipfw/ip_fw.c | 16 +- sys/net/ipfw/ip_fw2.c | 16 +- sys/net/netisr.c | 6 +- sys/net/pf/if_pflog.c | 4 +- sys/net/pf/if_pfsync.c | 4 +- sys/net/pf/pf.c | 4 +- sys/net/pf/pf_if.c | 28 ++-- sys/net/pf/pf_ioctl.c | 8 +- sys/net/pf/pf_subr.c | 8 +- sys/net/pf/pf_table.c | 6 +- sys/net/pfil.c | 6 +- sys/net/ppp/if_ppp.c | 14 +- sys/net/ppp_layer/ppp_deflate.c | 12 +- sys/net/raw_cb.c | 4 +- sys/net/rtsock.c | 22 +-- sys/net/sl/if_sl.c | 10 +- sys/net/sppp/if_spppsubr.c | 50 +++--- sys/net/stf/if_stf.c | 6 +- sys/net/tap/if_tap.c | 4 +- sys/net/vlan/if_vlan.c | 12 +- sys/netgraph/ng_device.c | 18 +- sys/netinet/in.c | 8 +- sys/netinet/in_pcb.c | 16 +- sys/netinet/ip_encap.c | 8 +- sys/netinet/ip_flow.c | 6 +- sys/netinet/ip_input.c | 4 +- sys/netinet/ip_output.c | 8 +- sys/netinet/tcp_input.c | 12 +- sys/netinet/tcp_subr.c | 6 +- sys/netinet/tcp_usrreq.c | 6 +- sys/netinet6/ah_core.c | 22 +-- sys/netinet6/ah_input.c | 18 +- sys/netinet6/esp_core.c | 6 +- sys/netinet6/frag6.c | 24 +-- sys/netinet6/in6.c | 16 +- sys/netinet6/in6_pcb.c | 8 +- sys/netinet6/in6_prefix.c | 18 +- sys/netinet6/ip6_mroute.c | 38 ++--- sys/netinet6/ip6_output.c | 60 +++---- sys/netinet6/ipcomp_core.c | 6 +- sys/netinet6/ipsec.c | 8 +- sys/netinet6/nd6.c | 6 +- sys/netinet6/nd6_nbr.c | 12 +- sys/netinet6/nd6_rtr.c | 18 +- sys/netinet6/scope6.c | 6 +- .../802_11/wlan/ieee80211_dragonfly.c | 8 +- sys/netproto/802_11/wlan/ieee80211_ioctl.c | 12 +- sys/netproto/802_11/wlan/ieee80211_node.c | 20 +-- sys/netproto/802_11/wlan_acl/ieee80211_acl.c | 14 +- .../802_11/wlan_ccmp/ieee80211_crypto_ccmp.c | 6 +- .../amrr/ieee80211_ratectl_amrr.c | 8 +- .../onoe/ieee80211_ratectl_onoe.c | 8 +- .../802_11/wlan_tkip/ieee80211_crypto_tkip.c | 6 +- .../802_11/wlan_wep/ieee80211_crypto_wep.c | 4 +- sys/netproto/atalk/at_control.c | 4 +- sys/netproto/ipsec/ipsec.c | 6 +- sys/netproto/ipsec/key.c | 14 +- sys/netproto/ipsec/keysock.c | 6 +- sys/netproto/ipsec/xform_ah.c | 18 +- sys/netproto/ipsec/xform_esp.c | 12 +- sys/netproto/ipsec/xform_ipcomp.c | 12 +- sys/netproto/ipx/ipx.c | 4 +- sys/netproto/ipx/spx_usrreq.c | 8 +- sys/netproto/key/key.c | 10 +- sys/netproto/key/keydb.c | 28 ++-- sys/netproto/key/keysock.c | 6 +- sys/netproto/ncp/ncp_conn.c | 6 +- sys/netproto/ncp/ncp_login.c | 6 +- sys/netproto/ncp/ncp_mod.c | 8 +- sys/netproto/ncp/ncp_subr.c | 4 +- sys/netproto/ns/ns.c | 4 +- sys/netproto/ns/ns_pcb.c | 6 +- sys/netproto/ns/spp_usrreq.c | 16 +- sys/netproto/smb/smb_conn.c | 10 +- sys/netproto/smb/smb_crypt.c | 18 +- sys/netproto/smb/smb_dev.c | 6 +- sys/netproto/smb/smb_iod.c | 10 +- sys/netproto/smb/smb_rq.c | 6 +- sys/netproto/smb/smb_smb.c | 24 +-- sys/netproto/smb/smb_subr.c | 18 +- sys/netproto/smb/smb_trantcp.c | 10 +- sys/opencrypto/crypto.c | 8 +- sys/opencrypto/cryptodev.c | 10 +- sys/opencrypto/cryptosoft.c | 24 +-- sys/opencrypto/deflate.c | 6 +- sys/platform/pc32/i386/autoconf.c | 6 +- sys/platform/pc32/i386/bios.c | 6 +- sys/platform/pc32/i386/busdma_machdep.c | 26 +-- sys/platform/pc32/i386/mem.c | 16 +- sys/platform/pc32/i386/nexus.c | 4 +- sys/platform/pc32/i386/pnpbios.c | 4 +- sys/platform/pc32/i386/userconfig.c | 32 ++-- sys/platform/pc32/i386/vm86.c | 4 +- sys/platform/pc32/i386/vm_machdep.c | 6 +- sys/sys/ccbque.h | 4 +- sys/sys/malloc.h | 6 +- sys/vfs/fdesc/fdesc_vfsops.c | 4 +- sys/vfs/fdesc/fdesc_vnops.c | 4 +- sys/vfs/fifofs/fifo_vnops.c | 8 +- sys/vfs/gnu/ext2fs/ext2_ihash.c | 6 +- sys/vfs/gnu/ext2fs/ext2_inode.c | 4 +- sys/vfs/gnu/ext2fs/ext2_quota.c | 4 +- sys/vfs/hpfs/hpfs_hash.c | 4 +- sys/vfs/hpfs/hpfs_vfsops.c | 4 +- sys/vfs/isofs/cd9660/cd9660_node.c | 6 +- sys/vfs/isofs/cd9660/cd9660_rrip.c | 6 +- sys/vfs/isofs/cd9660/cd9660_vfsops.c | 10 +- sys/vfs/isofs/cd9660/cd9660_vnops.c | 4 +- sys/vfs/msdosfs/msdosfs_denode.c | 10 +- sys/vfs/msdosfs/msdosfs_vfsops.c | 12 +- sys/vfs/msdosfs/msdosfs_vnops.c | 8 +- sys/vfs/nfs/bootp_subr.c | 10 +- sys/vfs/nfs/krpc_subr.c | 4 +- sys/vfs/nfs/nfs_kerb.c | 4 +- sys/vfs/nfs/nfs_serv.c | 18 +- sys/vfs/nfs/nfs_socket.c | 22 +-- sys/vfs/nfs/nfs_srvcache.c | 6 +- sys/vfs/nfs/nfs_syscalls.c | 38 ++--- sys/vfs/nfs/nfs_vfsops.c | 6 +- sys/vfs/nfs/nfs_vnops.c | 12 +- sys/vfs/ntfs/ntfs_ihash.c | 4 +- sys/vfs/ntfs/ntfs_vfsops.c | 6 +- sys/vfs/nullfs/null_vfsops.c | 4 +- sys/vfs/nwfs/nwfs_node.c | 8 +- sys/vfs/nwfs/nwfs_vfsops.c | 10 +- sys/vfs/portal/portal_vfsops.c | 4 +- sys/vfs/portal/portal_vnops.c | 6 +- sys/vfs/procfs/procfs_subr.c | 6 +- sys/vfs/procfs/procfs_vnops.c | 6 +- sys/vfs/smbfs/smbfs_node.c | 10 +- sys/vfs/smbfs/smbfs_smb.c | 16 +- sys/vfs/smbfs/smbfs_vfsops.c | 10 +- sys/vfs/udf/udf_vfsops.c | 24 +-- sys/vfs/udf/udf_vnops.c | 34 ++-- sys/vfs/ufs/ffs_softdep.c | 8 +- sys/vfs/ufs/ffs_vfsops.c | 26 +-- sys/vfs/ufs/ufs_ihash.c | 6 +- sys/vfs/ufs/ufs_inode.c | 4 +- sys/vfs/ufs/ufs_quota.c | 4 +- sys/vfs/ufs/ufs_vnops.c | 6 +- sys/vfs/union/union_subr.c | 16 +- sys/vfs/union/union_vfsops.c | 6 +- sys/vfs/union/union_vnops.c | 4 +- sys/vm/swap_pager.c | 4 +- sys/vm/vm_zone.c | 6 +- 518 files changed, 3388 insertions(+), 3388 deletions(-) diff --git a/sys/bus/cam/cam_extend.c b/sys/bus/cam/cam_extend.c index 5520b917dd..f262d81f2f 100644 --- a/sys/bus/cam/cam_extend.c +++ b/sys/bus/cam/cam_extend.c @@ -13,7 +13,7 @@ * functioning of this software in any circumstances. * * $FreeBSD: src/sys/cam/cam_extend.c,v 1.3 1999/08/28 00:40:39 peter Exp $ - * $DragonFly: src/sys/bus/cam/cam_extend.c,v 1.5 2005/05/28 01:16:30 swildner Exp $ + * $DragonFly: src/sys/bus/cam/cam_extend.c,v 1.6 2006/09/05 00:55:31 dillon Exp $ */ /* * XXX XXX XXX XXX We should get DEVFS working so that we @@ -47,7 +47,7 @@ struct extend_array struct extend_array * cam_extend_new(void) { - return(malloc(sizeof(struct extend_array), M_DEVBUF, + return(kmalloc(sizeof(struct extend_array), M_DEVBUF, M_INTWAIT | M_ZERO)); } @@ -56,13 +56,13 @@ cam_extend_set(struct extend_array *ea, int index, void *value) { if (index >= ea->nelem) { void **space; - space = malloc(sizeof(void *) * (index + EXTEND_CHUNK), + space = kmalloc(sizeof(void *) * (index + EXTEND_CHUNK), M_DEVBUF, M_INTWAIT | M_ZERO); /* Make sure we have something to copy before we copy it */ if (ea->nelem) { bcopy(ea->ps, space, sizeof(void *) * ea->nelem); - free(ea->ps, M_DEVBUF); + kfree(ea->ps, M_DEVBUF); } ea->ps = space; diff --git a/sys/bus/cam/cam_periph.c b/sys/bus/cam/cam_periph.c index 3a4d93731f..0dccf3c752 100644 --- a/sys/bus/cam/cam_periph.c +++ b/sys/bus/cam/cam_periph.c @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/cam/cam_periph.c,v 1.24.2.3 2003/01/25 19:04:40 dillon Exp $ - * $DragonFly: src/sys/bus/cam/cam_periph.c,v 1.15 2006/04/30 20:23:19 dillon Exp $ + * $DragonFly: src/sys/bus/cam/cam_periph.c,v 1.16 2006/09/05 00:55:31 dillon Exp $ */ #include @@ -106,7 +106,7 @@ cam_periph_alloc(periph_ctor_t *periph_ctor, return (CAM_REQ_INVALID); } - periph = malloc(sizeof(*periph), M_DEVBUF, M_INTWAIT | M_ZERO); + periph = kmalloc(sizeof(*periph), M_DEVBUF, M_INTWAIT | M_ZERO); init_level++; @@ -175,7 +175,7 @@ failure: case 2: xpt_free_path(periph->path); case 1: - free(periph, M_DEVBUF); + kfree(periph, M_DEVBUF); case 0: /* No cleanup to perform. */ break; @@ -431,7 +431,7 @@ camperiphfree(struct cam_periph *periph) periph->path, arg); } xpt_free_path(periph->path); - free(periph, M_DEVBUF); + kfree(periph, M_DEVBUF); } /* diff --git a/sys/bus/cam/cam_queue.c b/sys/bus/cam/cam_queue.c index 4af518dfc8..9c3ee2026d 100644 --- a/sys/bus/cam/cam_queue.c +++ b/sys/bus/cam/cam_queue.c @@ -26,7 +26,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/cam/cam_queue.c,v 1.5 1999/08/28 00:40:41 peter Exp $ - * $DragonFly: src/sys/bus/cam/cam_queue.c,v 1.6 2004/03/15 05:43:52 dillon Exp $ + * $DragonFly: src/sys/bus/cam/cam_queue.c,v 1.7 2006/09/05 00:55:31 dillon Exp $ */ #include #include @@ -51,7 +51,7 @@ camq_alloc(int size) { struct camq *camq; - camq = malloc(sizeof(*camq), M_DEVBUF, M_INTWAIT); + camq = kmalloc(sizeof(*camq), M_DEVBUF, M_INTWAIT); camq_init(camq, size); return (camq); } @@ -62,7 +62,7 @@ camq_init(struct camq *camq, int size) bzero(camq, sizeof(*camq)); camq->array_size = size; if (camq->array_size != 0) { - camq->queue_array = malloc(size * sizeof(cam_pinfo *), + camq->queue_array = kmalloc(size * sizeof(cam_pinfo *), M_DEVBUF, M_INTWAIT); /* * Heap algorithms like everything numbered from 1, so @@ -86,7 +86,7 @@ camq_free(struct camq *queue) { if (queue != NULL) { camq_fini(queue); - free(queue, M_DEVBUF); + kfree(queue, M_DEVBUF); } } @@ -99,7 +99,7 @@ camq_fini(struct camq *queue) * our pointer into the heap array is offset by one element. */ queue->queue_array++; - free(queue->queue_array, M_DEVBUF); + kfree(queue->queue_array, M_DEVBUF); } } @@ -113,7 +113,7 @@ camq_resize(struct camq *queue, int new_size) panic("camq_resize: New queue size can't accomodate " "queued entries."); #endif - new_array = malloc(new_size * sizeof(cam_pinfo *), M_DEVBUF, M_INTWAIT); + new_array = kmalloc(new_size * sizeof(cam_pinfo *), M_DEVBUF, M_INTWAIT); /* * Heap algorithms like everything numbered from 1, so @@ -124,7 +124,7 @@ camq_resize(struct camq *queue, int new_size) queue->queue_array++; bcopy(queue->queue_array, new_array, queue->entries * sizeof(cam_pinfo *)); - free(queue->queue_array, M_DEVBUF); + kfree(queue->queue_array, M_DEVBUF); } queue->queue_array = new_array-1; queue->array_size = new_size; @@ -198,7 +198,7 @@ cam_devq_alloc(int devices, int openings) { struct cam_devq *devq; - devq = malloc(sizeof(*devq), M_DEVBUF, M_INTWAIT); + devq = kmalloc(sizeof(*devq), M_DEVBUF, M_INTWAIT); cam_devq_init(devq, devices, openings); return (devq); } @@ -231,7 +231,7 @@ cam_devq_release(struct cam_devq *devq) printf("cam_devq_release: WARNING active allocations %d active send %d!\n", devq->alloc_active, devq->send_active); camq_fini(&devq->alloc_queue); camq_fini(&devq->send_queue); - free(devq, M_DEVBUF); + kfree(devq, M_DEVBUF); } } @@ -253,7 +253,7 @@ cam_ccbq_alloc(int openings) { struct cam_ccbq *ccbq; - ccbq = malloc(sizeof(*ccbq), M_DEVBUF, M_INTWAIT); + ccbq = kmalloc(sizeof(*ccbq), M_DEVBUF, M_INTWAIT); cam_ccbq_init(ccbq, openings); return (ccbq); } @@ -263,7 +263,7 @@ cam_ccbq_free(struct cam_ccbq *ccbq) { if (ccbq) { camq_fini(&ccbq->queue); - free(ccbq, M_DEVBUF); + kfree(ccbq, M_DEVBUF); } } diff --git a/sys/bus/cam/cam_sim.c b/sys/bus/cam/cam_sim.c index ab6da57420..0fa922eeff 100644 --- a/sys/bus/cam/cam_sim.c +++ b/sys/bus/cam/cam_sim.c @@ -26,7 +26,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/cam/cam_sim.c,v 1.3 1999/08/28 00:40:42 peter Exp $ - * $DragonFly: src/sys/bus/cam/cam_sim.c,v 1.7 2004/09/17 02:20:53 joerg Exp $ + * $DragonFly: src/sys/bus/cam/cam_sim.c,v 1.8 2006/09/05 00:55:31 dillon Exp $ */ #include @@ -83,7 +83,7 @@ cam_sim_alloc(sim_action_func sim_action, sim_poll_func sim_poll, else cam_devq_reference(queue); - sim = malloc(sizeof(struct cam_sim), M_DEVBUF, M_INTWAIT | M_ZERO); + sim = kmalloc(sizeof(struct cam_sim), M_DEVBUF, M_INTWAIT | M_ZERO); sim->sim_action = sim_action; sim->sim_poll = sim_poll; sim->sim_name = sim_name; @@ -118,7 +118,7 @@ cam_sim_release(struct cam_sim *sim, int flags) } if (sim->refcount == 1) { sim->refcount = 0; - free(sim, M_DEVBUF); + kfree(sim, M_DEVBUF); } else { --sim->refcount; } diff --git a/sys/bus/cam/cam_xpt.c b/sys/bus/cam/cam_xpt.c index e92c3b75a9..6e2ce9138f 100644 --- a/sys/bus/cam/cam_xpt.c +++ b/sys/bus/cam/cam_xpt.c @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/cam/cam_xpt.c,v 1.80.2.18 2002/12/09 17:31:55 gibbs Exp $ - * $DragonFly: src/sys/bus/cam/cam_xpt.c,v 1.29 2006/07/28 02:17:31 dillon Exp $ + * $DragonFly: src/sys/bus/cam/cam_xpt.c,v 1.30 2006/09/05 00:55:31 dillon Exp $ */ #include #include @@ -1348,12 +1348,12 @@ xpt_init(void *dummy) /* * Register a callback for when interrupts are enabled. */ - xpt_config_hook = malloc(sizeof(struct intr_config_hook), + xpt_config_hook = kmalloc(sizeof(struct intr_config_hook), M_TEMP, M_INTWAIT | M_ZERO); xpt_config_hook->ich_func = xpt_config; xpt_config_hook->ich_desc = "xpt"; if (config_intrhook_establish(xpt_config_hook) != 0) { - free (xpt_config_hook, M_TEMP); + kfree (xpt_config_hook, M_TEMP); printf("xpt_init: config_intrhook_establish failed " "- failing attach\n"); } @@ -3123,12 +3123,12 @@ xpt_action(union ccb *start_ccb) SLIST_REMOVE(async_head, cur_entry, async_node, links); csa->ccb_h.path->device->refcount--; - free(cur_entry, M_DEVBUF); + kfree(cur_entry, M_DEVBUF); } else { cur_entry->event_enable = csa->event_enable; } } else { - cur_entry = malloc(sizeof(*cur_entry), + cur_entry = kmalloc(sizeof(*cur_entry), M_DEVBUF, M_INTWAIT); cur_entry->event_enable = csa->event_enable; cur_entry->callback_arg = csa->callback_arg; @@ -3696,10 +3696,10 @@ xpt_create_path(struct cam_path **new_path_ptr, struct cam_periph *perph, struct cam_path *path; cam_status status; - path = malloc(sizeof(*path), M_DEVBUF, M_INTWAIT); + path = kmalloc(sizeof(*path), M_DEVBUF, M_INTWAIT); status = xpt_compile_path(path, perph, path_id, target_id, lun_id); if (status != CAM_REQ_CMP) { - free(path, M_DEVBUF); + kfree(path, M_DEVBUF); path = NULL; } *new_path_ptr = path; @@ -3802,7 +3802,7 @@ xpt_free_path(struct cam_path *path) { CAM_DEBUG(path, CAM_DEBUG_TRACE, ("xpt_free_path\n")); xpt_release_path(path); - free(path, M_DEVBUF); + kfree(path, M_DEVBUF); } @@ -3969,7 +3969,7 @@ xpt_bus_register(struct cam_sim *sim, u_int32_t bus) struct ccb_pathinq cpi; sim->bus_id = bus; - new_bus = malloc(sizeof(*new_bus), M_DEVBUF, M_INTWAIT); + new_bus = kmalloc(sizeof(*new_bus), M_DEVBUF, M_INTWAIT); if (strcmp(sim->sim_name, "xpt") != 0) { sim->path_id = @@ -4482,14 +4482,14 @@ xpt_alloc_ccb(void) { union ccb *new_ccb; - new_ccb = malloc(sizeof(*new_ccb), M_DEVBUF, M_INTWAIT); + new_ccb = kmalloc(sizeof(*new_ccb), M_DEVBUF, M_INTWAIT); return (new_ccb); } void xpt_free_ccb(union ccb *free_ccb) { - free(free_ccb, M_DEVBUF); + kfree(free_ccb, M_DEVBUF); } @@ -4510,7 +4510,7 @@ xpt_get_ccb(struct cam_ed *device) crit_enter(); if ((new_ccb = (union ccb *)ccb_freeq.slh_first) == NULL) { - new_ccb = malloc(sizeof(*new_ccb), M_DEVBUF, M_INTWAIT); + new_ccb = kmalloc(sizeof(*new_ccb), M_DEVBUF, M_INTWAIT); SLIST_INSERT_HEAD(&ccb_freeq, &new_ccb->ccb_h, xpt_links.sle); xpt_ccb_count++; @@ -4535,7 +4535,7 @@ xpt_release_bus(struct cam_eb *bus) } bus_generation++; KKASSERT(bus->refcount == 1); - free(bus, M_DEVBUF); + kfree(bus, M_DEVBUF); } else { --bus->refcount; } @@ -4548,7 +4548,7 @@ xpt_alloc_target(struct cam_eb *bus, target_id_t target_id) struct cam_et *target; struct cam_et *cur_target; - target = malloc(sizeof(*target), M_DEVBUF, M_INTWAIT); + target = kmalloc(sizeof(*target), M_DEVBUF, M_INTWAIT); TAILQ_INIT(&target->ed_entries); target->bus = bus; @@ -4586,7 +4586,7 @@ xpt_release_target(struct cam_eb *bus, struct cam_et *target) bus->generation++; xpt_release_bus(bus); KKASSERT(target->refcount == 1); - free(target, M_DEVBUF); + kfree(target, M_DEVBUF); } else { --target->refcount; } @@ -4609,7 +4609,7 @@ xpt_alloc_device(struct cam_eb *bus, struct cam_et *target, lun_id_t lun_id) if (status != CAM_REQ_CMP) { device = NULL; } else { - device = malloc(sizeof(*device), M_DEVBUF, M_INTWAIT); + device = kmalloc(sizeof(*device), M_DEVBUF, M_INTWAIT); } if (device != NULL) { @@ -4623,13 +4623,13 @@ xpt_alloc_device(struct cam_eb *bus, struct cam_et *target, lun_id_t lun_id) device->lun_id = lun_id; /* Initialize our queues */ if (camq_init(&device->drvq, 0) != 0) { - free(device, M_DEVBUF); + kfree(device, M_DEVBUF); return (NULL); } if (cam_ccbq_init(&device->ccbq, bus->sim->max_dev_openings) != 0) { camq_fini(&device->drvq); - free(device, M_DEVBUF); + kfree(device, M_DEVBUF); return (NULL); } SLIST_INIT(&device->asyncs); @@ -4710,7 +4710,7 @@ xpt_release_device(struct cam_eb *bus, struct cam_et *target, cam_devq_resize(devq, devq->alloc_queue.array_size - 1); xpt_release_target(bus, target); KKASSERT(device->refcount == 1); - free(device, M_DEVBUF); + kfree(device, M_DEVBUF); } else { --device->refcount; } @@ -4839,7 +4839,7 @@ xpt_scan_bus(struct cam_periph *periph, union ccb *request_ccb) /* Save some state for use while we probe for devices */ scan_info = (xpt_scan_bus_info *) - malloc(sizeof(xpt_scan_bus_info), M_TEMP, M_INTWAIT); + kmalloc(sizeof(xpt_scan_bus_info), M_TEMP, M_INTWAIT); scan_info->request_ccb = request_ccb; scan_info->cpi = &work_ccb->cpi; @@ -4964,7 +4964,7 @@ xpt_scan_bus(struct cam_periph *periph, union ccb *request_ccb) if (scan_info->pending_count == 0) { xpt_free_ccb((union ccb *)scan_info->cpi); request_ccb = scan_info->request_ccb; - free(scan_info, M_TEMP); + kfree(scan_info, M_TEMP); request_ccb->ccb_h.status = CAM_REQ_CMP; xpt_done(request_ccb); } @@ -4986,7 +4986,7 @@ xpt_scan_bus(struct cam_periph *periph, union ccb *request_ccb) xpt_free_ccb( (union ccb *)scan_info->cpi); request_ccb = scan_info->request_ccb; - free(scan_info, M_TEMP); + kfree(scan_info, M_TEMP); request_ccb->ccb_h.status = CAM_REQ_CMP; xpt_done(request_ccb); break; @@ -5073,8 +5073,8 @@ xpt_scan_lun(struct cam_periph *periph, struct cam_path *path, } if (request_ccb == NULL) { - request_ccb = malloc(sizeof(union ccb), M_TEMP, M_INTWAIT); - new_path = malloc(sizeof(*new_path), M_TEMP, M_INTWAIT); + request_ccb = kmalloc(sizeof(union ccb), M_TEMP, M_INTWAIT); + new_path = kmalloc(sizeof(*new_path), M_TEMP, M_INTWAIT); status = xpt_compile_path(new_path, xpt_periph, path->bus->path_id, path->target->target_id, @@ -5084,8 +5084,8 @@ xpt_scan_lun(struct cam_periph *periph, struct cam_path *path, xpt_print_path(path); printf("xpt_scan_lun: can't compile path, can't " "continue\n"); - free(request_ccb, M_TEMP); - free(new_path, M_TEMP); + kfree(request_ccb, M_TEMP); + kfree(new_path, M_TEMP); return; } xpt_setup_ccb(&request_ccb->ccb_h, new_path, /*priority*/ 1); @@ -5123,8 +5123,8 @@ static void xptscandone(struct cam_periph *periph, union ccb *done_ccb) { xpt_release_path(done_ccb->ccb_h.path); - free(done_ccb->ccb_h.path, M_TEMP); - free(done_ccb, M_TEMP); + kfree(done_ccb->ccb_h.path, M_TEMP); + kfree(done_ccb, M_TEMP); } static cam_status @@ -5145,7 +5145,7 @@ proberegister(struct cam_periph *periph, void *arg) return(CAM_REQ_CMP_ERR); } - softc = malloc(sizeof(*softc), M_TEMP, M_INTWAIT | M_ZERO); + softc = kmalloc(sizeof(*softc), M_TEMP, M_INTWAIT | M_ZERO); TAILQ_INIT(&softc->request_ccbs); TAILQ_INSERT_TAIL(&softc->request_ccbs, &request_ccb->ccb_h, periph_links.tqe); @@ -5293,7 +5293,7 @@ probestart(struct cam_periph *periph, union ccb *start_ccb) mode_buf_len = sizeof(struct scsi_mode_header_6) + sizeof(struct scsi_mode_blk_desc) + sizeof(struct scsi_control_page); - mode_buf = malloc(mode_buf_len, M_TEMP, M_INTWAIT); + mode_buf = kmalloc(mode_buf_len, M_TEMP, M_INTWAIT); scsi_mode_sense(csio, /*retries*/4, probedone, @@ -5318,7 +5318,7 @@ probestart(struct cam_periph *periph, union ccb *start_ccb) device->serial_num_len = 0; if ((device->quirk->quirks & CAM_QUIRK_NOSERIAL) == 0) { - serial_buf = malloc(sizeof(*serial_buf), M_TEMP, + serial_buf = kmalloc(sizeof(*serial_buf), M_TEMP, M_INTWAIT | M_ZERO); scsi_inquiry(csio, /*retries*/4, @@ -5498,7 +5498,7 @@ probedone(struct cam_periph *periph, union ccb *done_ccb) /*count*/1, /*run_queue*/TRUE); } xpt_release_ccb(done_ccb); - free(mode_hdr, M_TEMP); + kfree(mode_hdr, M_TEMP); softc->action = PROBE_SERIAL_NUM; xpt_schedule(periph, priority); return; @@ -5520,7 +5520,7 @@ probedone(struct cam_periph *periph, union ccb *done_ccb) /* Clean up from previous instance of this device */ if (path->device->serial_num != NULL) { - free(path->device->serial_num, M_DEVBUF); + kfree(path->device->serial_num, M_DEVBUF); path->device->serial_num = NULL; path->device->serial_num_len = 0; } @@ -5534,7 +5534,7 @@ probedone(struct cam_periph *periph, union ccb *done_ccb) have_serialnum = 1; path->device->serial_num = - malloc((serial_buf->length + 1), + kmalloc((serial_buf->length + 1), M_DEVBUF, M_INTWAIT); bcopy(serial_buf->serial_num, path->device->serial_num, @@ -5581,7 +5581,7 @@ probedone(struct cam_periph *periph, union ccb *done_ccb) xpt_async(AC_LOST_DEVICE, path, NULL); } if (serial_buf != NULL) - free(serial_buf, M_TEMP); + kfree(serial_buf, M_TEMP); if (changed != 0) { /* @@ -5643,7 +5643,7 @@ probedone(struct cam_periph *periph, union ccb *done_ccb) static void probecleanup(struct cam_periph *periph) { - free(periph->softc, M_TEMP); + kfree(periph->softc, M_TEMP); } static void @@ -6102,7 +6102,7 @@ xpt_finishconfig(struct cam_periph *periph, union ccb *done_ccb) /* Release our hook so that the boot can continue. */ config_intrhook_disestablish(xpt_config_hook); - free(xpt_config_hook, M_TEMP); + kfree(xpt_config_hook, M_TEMP); xpt_config_hook = NULL; } if (done_ccb != NULL) diff --git a/sys/bus/cam/scsi/scsi_cd.c b/sys/bus/cam/scsi/scsi_cd.c index 87c519a2af..0cee6bc00e 100644 --- a/sys/bus/cam/scsi/scsi_cd.c +++ b/sys/bus/cam/scsi/scsi_cd.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/cam/scsi/scsi_cd.c,v 1.31.2.16 2003/10/21 22:26:11 thomas Exp $ - * $DragonFly: src/sys/bus/cam/scsi/scsi_cd.c,v 1.23 2006/07/28 02:17:32 dillon Exp $ + * $DragonFly: src/sys/bus/cam/scsi/scsi_cd.c,v 1.24 2006/09/05 00:55:32 dillon Exp $ */ /* * Portions of this driver taken from the original FreeBSD cd driver. @@ -529,7 +529,7 @@ cdcleanup(struct cam_periph *periph) changer_links); xpt_print_path(periph->path); printf("removing changer entry\n"); - free(softc->changer, M_DEVBUF); + kfree(softc->changer, M_DEVBUF); num_changers--; } devstat_remove_entry(&softc->device_stats); @@ -537,7 +537,7 @@ cdcleanup(struct cam_periph *periph) if (softc->disk.d_rawdev) { disk_destroy(&softc->disk); } - free(softc, M_DEVBUF); + kfree(softc, M_DEVBUF); crit_exit(); } @@ -694,7 +694,7 @@ cdregister(struct cam_periph *periph, void *arg) return(CAM_REQ_CMP_ERR); } - softc = malloc(sizeof(*softc), M_DEVBUF, M_INTWAIT | M_ZERO); + softc = kmalloc(sizeof(*softc), M_DEVBUF, M_INTWAIT | M_ZERO); LIST_INIT(&softc->pending_ccbs); STAILQ_INIT(&softc->mode_queue); softc->state = CD_STATE_PROBE; @@ -899,7 +899,7 @@ cdregister(struct cam_periph *periph, void *arg) * been marked as part of the changer.) */ else { - nchanger = malloc(sizeof(struct cdchanger), + nchanger = kmalloc(sizeof(struct cdchanger), M_DEVBUF, M_INTWAIT | M_ZERO); callout_init(&nchanger->short_handle); callout_init(&nchanger->long_handle); @@ -1589,7 +1589,7 @@ cdstart(struct cam_periph *periph, union ccb *start_ccb) case CD_STATE_PROBE: { - rcap = malloc(sizeof(*rcap), M_TEMP, M_INTWAIT); + rcap = kmalloc(sizeof(*rcap), M_TEMP, M_INTWAIT); csio = &start_ccb->csio; scsi_read_capacity(csio, /*retries*/1, @@ -1854,7 +1854,7 @@ cddone(struct cam_periph *periph, union ccb *done_ccb) } } } - free(rdcap, M_TEMP); + kfree(rdcap, M_TEMP); if (announce_buf[0] != '\0') { xpt_announce_periph(periph, announce_buf); if (softc->flags & CD_FLAG_CHANGER) @@ -1973,7 +1973,7 @@ cdioctl(struct dev_ioctl_args *ap) union cd_pages *page; params.alloc_len = sizeof(union cd_mode_data_6_10); - params.mode_buf = malloc(params.alloc_len, M_TEMP, + params.mode_buf = kmalloc(params.alloc_len, M_TEMP, M_WAITOK | M_ZERO); CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, @@ -1981,7 +1981,7 @@ cdioctl(struct dev_ioctl_args *ap) error = cdgetmode(periph, ¶ms, AUDIO_PAGE); if (error) { - free(params.mode_buf, M_TEMP); + kfree(params.mode_buf, M_TEMP); break; } page = cdgetpage(¶ms); @@ -1989,7 +1989,7 @@ cdioctl(struct dev_ioctl_args *ap) page->audio.flags &= ~CD_PA_SOTC; page->audio.flags |= CD_PA_IMMED; error = cdsetmode(periph, ¶ms); - free(params.mode_buf, M_TEMP); + kfree(params.mode_buf, M_TEMP); if (error) break; @@ -2063,7 +2063,7 @@ cdioctl(struct dev_ioctl_args *ap) union cd_pages *page; params.alloc_len = sizeof(union cd_mode_data_6_10); - params.mode_buf = malloc(params.alloc_len, M_TEMP, + params.mode_buf = kmalloc(params.alloc_len, M_TEMP, M_WAITOK | M_ZERO); CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, @@ -2071,7 +2071,7 @@ cdioctl(struct dev_ioctl_args *ap) error = cdgetmode(periph, ¶ms, AUDIO_PAGE); if (error) { - free(params.mode_buf, M_TEMP); + kfree(params.mode_buf, M_TEMP); break; } page = cdgetpage(¶ms); @@ -2079,7 +2079,7 @@ cdioctl(struct dev_ioctl_args *ap) page->audio.flags &= ~CD_PA_SOTC; page->audio.flags |= CD_PA_IMMED; error = cdsetmode(periph, ¶ms); - free(params.mode_buf, M_TEMP); + kfree(params.mode_buf, M_TEMP); if (error) break; error = cdplaymsf(periph, @@ -2102,12 +2102,12 @@ cdioctl(struct dev_ioctl_args *ap) ("trying to do CDIOCPLAYBLOCKS\n")); params.alloc_len = sizeof(union cd_mode_data_6_10); - params.mode_buf = malloc(params.alloc_len, M_TEMP, + params.mode_buf = kmalloc(params.alloc_len, M_TEMP, M_WAITOK | M_ZERO); error = cdgetmode(periph, ¶ms, AUDIO_PAGE); if (error) { - free(params.mode_buf, M_TEMP); + kfree(params.mode_buf, M_TEMP); break; } page = cdgetpage(¶ms); @@ -2115,7 +2115,7 @@ cdioctl(struct dev_ioctl_args *ap) page->audio.flags &= ~CD_PA_SOTC; page->audio.flags |= CD_PA_IMMED; error = cdsetmode(periph, ¶ms); - free(params.mode_buf, M_TEMP); + kfree(params.mode_buf, M_TEMP); if (error) break; error = cdplay(periph, args->blk, args->len); @@ -2131,7 +2131,7 @@ cdioctl(struct dev_ioctl_args *ap) CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOCREADSUBCHANNEL\n")); - data = malloc(sizeof(struct cd_sub_channel_info), + data = kmalloc(sizeof(struct cd_sub_channel_info), M_TEMP, M_WAITOK); if ((len > sizeof(struct cd_sub_channel_info)) || @@ -2141,7 +2141,7 @@ cdioctl(struct dev_ioctl_args *ap) "cdioreadsubchannel: error, len=%d\n", len); error = EINVAL; - free(data, M_TEMP); + kfree(data, M_TEMP); break; } @@ -2152,7 +2152,7 @@ cdioctl(struct dev_ioctl_args *ap) args->data_format, args->track, data, len); if (error) { - free(data, M_TEMP); + kfree(data, M_TEMP); break; } if (softc->quirks & CD_Q_BCD_TRACKS) @@ -2164,7 +2164,7 @@ cdioctl(struct dev_ioctl_args *ap) if (copyout(data, args->data, len) != 0) { error = EFAULT; } - free(data, M_TEMP); + kfree(data, M_TEMP); } break; @@ -2175,12 +2175,12 @@ cdioctl(struct dev_ioctl_args *ap) CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOREADTOCHEADER\n")); - th = malloc(sizeof(struct ioc_toc_header), M_TEMP, + th = kmalloc(sizeof(struct ioc_toc_header), M_TEMP, M_WAITOK); error = cdreadtoc(periph, 0, 0, (u_int8_t *)th, sizeof (*th), /*sense_flags*/0); if (error) { - free(th, M_TEMP); + kfree(th, M_TEMP); break; } if (softc->quirks & CD_Q_BCD_TRACKS) { @@ -2193,7 +2193,7 @@ cdioctl(struct dev_ioctl_args *ap) } th->len = ntohs(th->len); bcopy(th, addr, sizeof(*th)); - free(th, M_TEMP); + kfree(th, M_TEMP); } break; case CDIOREADTOCENTRYS: @@ -2209,8 +2209,8 @@ cdioctl(struct dev_ioctl_args *ap) CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOREADTOCENTRYS\n")); - data = malloc(sizeof(*data), M_TEMP, M_WAITOK); - lead = malloc(sizeof(*lead), M_TEMP, M_WAITOK); + data = kmalloc(sizeof(*data), M_TEMP, M_WAITOK); + lead = kmalloc(sizeof(*lead), M_TEMP, M_WAITOK); if (te->data_len < sizeof(struct cd_toc_entry) || (te->data_len % sizeof(struct cd_toc_entry)) != 0 @@ -2219,8 +2219,8 @@ cdioctl(struct dev_ioctl_args *ap) error = EINVAL; printf("scsi_cd: error in readtocentries, " "returning EINVAL\n"); - free(data, M_TEMP); - free(lead, M_TEMP); + kfree(data, M_TEMP); + kfree(lead, M_TEMP); break; } @@ -2228,8 +2228,8 @@ cdioctl(struct dev_ioctl_args *ap) error = cdreadtoc(periph, 0, 0, (u_int8_t *)th, sizeof (*th), /*sense_flags*/0); if (error) { - free(data, M_TEMP); - free(lead, M_TEMP); + kfree(data, M_TEMP); + kfree(lead, M_TEMP); break; } @@ -2250,8 +2250,8 @@ cdioctl(struct dev_ioctl_args *ap) starting_track > th->ending_track + 1) { printf("scsi_cd: error in readtocentries, " "returning EINVAL\n"); - free(data, M_TEMP); - free(lead, M_TEMP); + kfree(data, M_TEMP); + kfree(lead, M_TEMP); error = EINVAL; break; } @@ -2271,8 +2271,8 @@ cdioctl(struct dev_ioctl_args *ap) printf("scsi_cd: error in readtocentries, " "returning EINVAL\n"); error = EINVAL; - free(data, M_TEMP); - free(lead, M_TEMP); + kfree(data, M_TEMP); + kfree(lead, M_TEMP); break; } num = len / sizeof(struct cd_toc_entry); @@ -2284,8 +2284,8 @@ cdioctl(struct dev_ioctl_args *ap) readlen + sizeof (*th), /*sense_flags*/0); if (error) { - free(data, M_TEMP); - free(lead, M_TEMP); + kfree(data, M_TEMP); + kfree(lead, M_TEMP); break; } } @@ -2300,8 +2300,8 @@ cdioctl(struct dev_ioctl_args *ap) sizeof(*lead), /*sense_flags*/0); if (error) { - free(data, M_TEMP); - free(lead, M_TEMP); + kfree(data, M_TEMP); + kfree(lead, M_TEMP); break; } data->entries[idx - starting_track] = @@ -2315,8 +2315,8 @@ cdioctl(struct dev_ioctl_args *ap) } error = copyout(data->entries, te->data, len); - free(data, M_TEMP); - free(lead, M_TEMP); + kfree(data, M_TEMP); + kfree(lead, M_TEMP); } break; case CDIOREADTOCENTRY: @@ -2330,13 +2330,13 @@ cdioctl(struct dev_ioctl_args *ap) CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOREADTOCENTRY\n")); - data = malloc(sizeof(*data), M_TEMP, M_WAITOK); + data = kmalloc(sizeof(*data), M_TEMP, M_WAITOK); if (te->address_format != CD_MSF_FORMAT && te->address_format != CD_LBA_FORMAT) { printf("error in readtocentry, " " returning EINVAL\n"); - free(data, M_TEMP); + kfree(data, M_TEMP); error = EINVAL; break; } @@ -2345,7 +2345,7 @@ cdioctl(struct dev_ioctl_args *ap) error = cdreadtoc(periph, 0, 0, (u_int8_t *)th, sizeof (*th), /*sense_flags*/0); if (error) { - free(data, M_TEMP); + kfree(data, M_TEMP); break; } @@ -2366,7 +2366,7 @@ cdioctl(struct dev_ioctl_args *ap) track > th->ending_track + 1) { printf("error in readtocentry, " " returning EINVAL\n"); - free(data, M_TEMP); + kfree(data, M_TEMP); error = EINVAL; break; } @@ -2375,7 +2375,7 @@ cdioctl(struct dev_ioctl_args *ap) (u_int8_t *)data, sizeof(*data), /*sense_flags*/0); if (error) { - free(data, M_TEMP); + kfree(data, M_TEMP); break; } @@ -2383,7 +2383,7 @@ cdioctl(struct dev_ioctl_args *ap) data->entry.track = bcd2bin(data->entry.track); bcopy(&data->entry, &te->entry, sizeof(struct cd_toc_entry)); - free(data, M_TEMP); + kfree(data, M_TEMP); } break; case CDIOCSETPATCH: @@ -2396,11 +2396,11 @@ cdioctl(struct dev_ioctl_args *ap) ("trying to do CDIOCSETPATCH\n")); params.alloc_len = sizeof(union cd_mode_data_6_10); - params.mode_buf = malloc(params.alloc_len, M_TEMP, + params.mode_buf = kmalloc(params.alloc_len, M_TEMP, M_WAITOK | M_ZERO); error = cdgetmode(periph, ¶ms, AUDIO_PAGE); if (error) { - free(params.mode_buf, M_TEMP); + kfree(params.mode_buf, M_TEMP); break; } page = cdgetpage(¶ms); @@ -2412,7 +2412,7 @@ cdioctl(struct dev_ioctl_args *ap) page->audio.port[2].channels = arg->patch[2]; page->audio.port[3].channels = arg->patch[3]; error = cdsetmode(periph, ¶ms); - free(params.mode_buf, M_TEMP); + kfree(params.mode_buf, M_TEMP); } break; case CDIOCGETVOL: @@ -2425,11 +2425,11 @@ cdioctl(struct dev_ioctl_args *ap) ("trying to do CDIOCGETVOL\n")); params.alloc_len = sizeof(union cd_mode_data_6_10); - params.mode_buf = malloc(params.alloc_len, M_TEMP, + params.mode_buf = kmalloc(params.alloc_len, M_TEMP, M_WAITOK | M_ZERO); error = cdgetmode(periph, ¶ms, AUDIO_PAGE); if (error) { - free(params.mode_buf, M_TEMP); + kfree(params.mode_buf, M_TEMP); break; } page = cdgetpage(¶ms); @@ -2440,7 +2440,7 @@ cdioctl(struct dev_ioctl_args *ap) page->audio.port[RIGHT_PORT].volume; arg->vol[2] = page->audio.port[2].volume; arg->vol[3] = page->audio.port[3].volume; - free(params.mode_buf, M_TEMP); + kfree(params.mode_buf, M_TEMP); } break; case CDIOCSETVOL: @@ -2453,11 +2453,11 @@ cdioctl(struct dev_ioctl_args *ap) ("trying to do CDIOCSETVOL\n")); params.alloc_len = sizeof(union cd_mode_data_6_10); - params.mode_buf = malloc(params.alloc_len, M_TEMP, + params.mode_buf = kmalloc(params.alloc_len, M_TEMP, M_WAITOK | M_ZERO); error = cdgetmode(periph, ¶ms, AUDIO_PAGE); if (error) { - free(params.mode_buf, M_TEMP); + kfree(params.mode_buf, M_TEMP); break; } page = cdgetpage(¶ms); @@ -2471,7 +2471,7 @@ cdioctl(struct dev_ioctl_args *ap) page->audio.port[2].volume = arg->vol[2]; page->audio.port[3].volume = arg->vol[3]; error = cdsetmode(periph, ¶ms); - free(params.mode_buf, M_TEMP); + kfree(params.mode_buf, M_TEMP); } break; case CDIOCSETMONO: @@ -2483,11 +2483,11 @@ cdioctl(struct dev_ioctl_args *ap) ("trying to do CDIOCSETMONO\n")); params.alloc_len = sizeof(union cd_mode_data_6_10); - params.mode_buf = malloc(params.alloc_len, M_TEMP, + params.mode_buf = kmalloc(params.alloc_len, M_TEMP, M_WAITOK | M_ZERO); error = cdgetmode(periph, ¶ms, AUDIO_PAGE); if (error) { - free(params.mode_buf, M_TEMP); + kfree(params.mode_buf, M_TEMP); break; } page = cdgetpage(¶ms); @@ -2499,7 +2499,7 @@ cdioctl(struct dev_ioctl_args *ap) page->audio.port[2].channels = 0; page->audio.port[3].channels = 0; error = cdsetmode(periph, ¶ms); - free(params.mode_buf, M_TEMP); + kfree(params.mode_buf, M_TEMP); } break; case CDIOCSETSTEREO: @@ -2511,11 +2511,11 @@ cdioctl(struct dev_ioctl_args *ap) ("trying to do CDIOCSETSTEREO\n")); params.alloc_len = sizeof(union cd_mode_data_6_10); - params.mode_buf = malloc(params.alloc_len, M_TEMP, + params.mode_buf = kmalloc(params.alloc_len, M_TEMP, M_WAITOK | M_ZERO); error = cdgetmode(periph, ¶ms, AUDIO_PAGE); if (error) { - free(params.mode_buf, M_TEMP); + kfree(params.mode_buf, M_TEMP); break; } page = cdgetpage(¶ms); @@ -2527,7 +2527,7 @@ cdioctl(struct dev_ioctl_args *ap) page->audio.port[2].channels = 0; page->audio.port[3].channels = 0; error = cdsetmode(periph, ¶ms); - free(params.mode_buf, M_TEMP); + kfree(params.mode_buf, M_TEMP); } break; case CDIOCSETMUTE: @@ -2539,11 +2539,11 @@ cdioctl(struct dev_ioctl_args *ap) ("trying to do CDIOCSETMUTE\n")); params.alloc_len = sizeof(union cd_mode_data_6_10); - params.mode_buf = malloc(params.alloc_len, M_TEMP, + params.mode_buf = kmalloc(params.alloc_len, M_TEMP, M_WAITOK | M_ZERO); error = cdgetmode(periph, ¶ms, AUDIO_PAGE); if (error) { - free(¶ms, M_TEMP); + kfree(¶ms, M_TEMP); break; } page = cdgetpage(¶ms); @@ -2553,7 +2553,7 @@ cdioctl(struct dev_ioctl_args *ap) page->audio.port[2].channels = 0; page->audio.port[3].channels = 0; error = cdsetmode(periph, ¶ms); - free(params.mode_buf, M_TEMP); + kfree(params.mode_buf, M_TEMP); } break; case CDIOCSETLEFT: @@ -2565,12 +2565,12 @@ cdioctl(struct dev_ioctl_args *ap) ("trying to do CDIOCSETLEFT\n")); params.alloc_len = sizeof(union cd_mode_data_6_10); - params.mode_buf = malloc(params.alloc_len, M_TEMP, + params.mode_buf = kmalloc(params.alloc_len, M_TEMP, M_WAITOK | M_ZERO); error = cdgetmode(periph, ¶ms, AUDIO_PAGE); if (error) { - free(params.mode_buf, M_TEMP); + kfree(params.mode_buf, M_TEMP); break; } page = cdgetpage(¶ms); @@ -2580,7 +2580,7 @@ cdioctl(struct dev_ioctl_args *ap) page->audio.port[2].channels = 0; page->audio.port[3].channels = 0; error = cdsetmode(periph, ¶ms); - free(params.mode_buf, M_TEMP); + kfree(params.mode_buf, M_TEMP); } break; case CDIOCSETRIGHT: @@ -2592,12 +2592,12 @@ cdioctl(struct dev_ioctl_args *ap) ("trying to do CDIOCSETRIGHT\n")); params.alloc_len = sizeof(union cd_mode_data_6_10); - params.mode_buf = malloc(params.alloc_len, M_TEMP, + params.mode_buf = kmalloc(params.alloc_len, M_TEMP, M_WAITOK | M_ZERO); error = cdgetmode(periph, ¶ms, AUDIO_PAGE); if (error) { - free(params.mode_buf, M_TEMP); + kfree(params.mode_buf, M_TEMP); break; } page = cdgetpage(¶ms); @@ -2607,7 +2607,7 @@ cdioctl(struct dev_ioctl_args *ap) page->audio.port[2].channels = 0; page->audio.port[3].channels = 0; error = cdsetmode(periph, ¶ms); - free(params.mode_buf, M_TEMP); + kfree(params.mode_buf, M_TEMP); } break; case CDIOCRESUME: @@ -3045,7 +3045,7 @@ cdsize(struct cam_periph *periph, u_int32_t *size) ccb = cdgetccb(periph, /* priority */ 1); - rcap_buf = malloc(sizeof(struct scsi_read_capacity_data), + rcap_buf = kmalloc(sizeof(struct scsi_read_capacity_data), M_TEMP, M_INTWAIT | M_ZERO); scsi_read_capacity(&ccb->csio, @@ -3074,7 +3074,7 @@ cdsize(struct cam_periph *periph, u_int32_t *size) if (softc->params.blksize > 2048 && softc->params.blksize <= 2352) softc->params.blksize = 2048; - free(rcap_buf, M_TEMP); + kfree(rcap_buf, M_TEMP); *size = softc->params.disksize; return (error); @@ -3904,7 +3904,7 @@ cdreportkey(struct cam_periph *periph, struct dvd_authinfo *authinfo) } if (length != 0) { - databuf = malloc(length, M_DEVBUF, M_INTWAIT | M_ZERO); + databuf = kmalloc(length, M_DEVBUF, M_INTWAIT | M_ZERO); } else { databuf = NULL; } @@ -4012,7 +4012,7 @@ cdreportkey(struct cam_periph *periph, struct dvd_authinfo *authinfo) } bailout: if (databuf != NULL) - free(databuf, M_DEVBUF); + kfree(databuf, M_DEVBUF); xpt_release_ccb(ccb); @@ -4038,7 +4038,7 @@ cdsendkey(struct cam_periph *periph, struct dvd_authinfo *authinfo) length = sizeof(*challenge_data); - challenge_data = malloc(length, M_DEVBUF, M_INTWAIT | M_ZERO); + challenge_data = kmalloc(length, M_DEVBUF, M_INTWAIT | M_ZERO); databuf = (u_int8_t *)challenge_data; @@ -4055,7 +4055,7 @@ cdsendkey(struct cam_periph *periph, struct dvd_authinfo *authinfo) length = sizeof(*key2_data); - key2_data = malloc(length, M_DEVBUF, M_INTWAIT | M_ZERO); + key2_data = kmalloc(length, M_DEVBUF, M_INTWAIT | M_ZERO); databuf = (u_int8_t *)key2_data; @@ -4072,7 +4072,7 @@ cdsendkey(struct cam_periph *periph, struct dvd_authinfo *authinfo) length = sizeof(*rpc_data); - rpc_data = malloc(length, M_DEVBUF, M_INTWAIT | M_ZERO); + rpc_data = kmalloc(length, M_DEVBUF, M_INTWAIT | M_ZERO); databuf = (u_int8_t *)rpc_data; @@ -4105,7 +4105,7 @@ cdsendkey(struct cam_periph *periph, struct dvd_authinfo *authinfo) bailout: if (databuf != NULL) - free(databuf, M_DEVBUF); + kfree(databuf, M_DEVBUF); xpt_release_ccb(ccb); @@ -4214,7 +4214,7 @@ cdreaddvdstructure(struct cam_periph *periph, struct dvd_struct *dvdstruct) } if (length != 0) { - databuf = malloc(length, M_DEVBUF, M_INTWAIT | M_ZERO); + databuf = kmalloc(length, M_DEVBUF, M_INTWAIT | M_ZERO); } else { databuf = NULL; } @@ -4309,7 +4309,7 @@ cdreaddvdstructure(struct cam_periph *periph, struct dvd_struct *dvdstruct) bailout: if (databuf != NULL) - free(databuf, M_DEVBUF); + kfree(databuf, M_DEVBUF); xpt_release_ccb(ccb); diff --git a/sys/bus/cam/scsi/scsi_ch.c b/sys/bus/cam/scsi/scsi_ch.c index 523cadd990..85346321cd 100644 --- a/sys/bus/cam/scsi/scsi_ch.c +++ b/sys/bus/cam/scsi/scsi_ch.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/cam/scsi/scsi_ch.c,v 1.20.2.2 2000/10/31 08:09:49 dwmalone Exp $ - * $DragonFly: src/sys/bus/cam/scsi/scsi_ch.c,v 1.14 2006/07/28 02:17:32 dillon Exp $ + * $DragonFly: src/sys/bus/cam/scsi/scsi_ch.c,v 1.15 2006/09/05 00:55:32 dillon Exp $ */ /* * Derived from the NetBSD SCSI changer driver. @@ -303,7 +303,7 @@ chcleanup(struct cam_periph *periph) xpt_print_path(periph->path); printf("removing device entry\n"); dev_ops_remove(&ch_ops, -1, periph->unit_number); - free(softc, M_DEVBUF); + kfree(softc, M_DEVBUF); } static void @@ -366,7 +366,7 @@ chregister(struct cam_periph *periph, void *arg) return(CAM_REQ_CMP_ERR); } - softc = malloc(sizeof(*softc), M_DEVBUF, M_INTWAIT | M_ZERO); + softc = kmalloc(sizeof(*softc), M_DEVBUF, M_INTWAIT | M_ZERO); softc->state = CH_STATE_PROBE; periph->softc = softc; cam_extend_set(chperiphs, periph->unit_number, periph); @@ -522,7 +522,7 @@ chstart(struct cam_periph *periph, union ccb *start_ccb) sizeof(struct scsi_mode_blk_desc) + sizeof(struct page_element_address_assignment); - mode_buffer = malloc(mode_buffer_len, M_TEMP, M_INTWAIT | M_ZERO); + mode_buffer = kmalloc(mode_buffer_len, M_TEMP, M_INTWAIT | M_ZERO); /* * Get the element address assignment page. */ @@ -663,7 +663,7 @@ chdone(struct cam_periph *periph, union ccb *done_ccb) if (announce_buf[0] != '\0') xpt_announce_periph(periph, announce_buf); softc->state = CH_STATE_NORMAL; - free(mode_header, M_TEMP); + kfree(mode_header, M_TEMP); /* * Since our peripheral may be invalidated by an error * above or an external event, we must release our CCB @@ -1100,7 +1100,7 @@ chgetelemstatus(struct cam_periph *periph, * we can allocate enough storage for all of them. We assume * that the first one can fit into 1k. */ - data = (caddr_t)malloc(1024, M_DEVBUF, M_INTWAIT); + data = (caddr_t)kmalloc(1024, M_DEVBUF, M_INTWAIT); ccb = cam_periph_getccb(periph, /*priority*/ 1); @@ -1136,8 +1136,8 @@ chgetelemstatus(struct cam_periph *periph, * Reallocate storage for descriptors and get them from the * device. */ - free(data, M_DEVBUF); - data = (caddr_t)malloc(size, M_DEVBUF, M_INTWAIT); + kfree(data, M_DEVBUF); + data = (caddr_t)kmalloc(size, M_DEVBUF, M_INTWAIT); scsi_read_element_status(&ccb->csio, /* retries */ 1, @@ -1198,9 +1198,9 @@ chgetelemstatus(struct cam_periph *periph, xpt_release_ccb(ccb); if (data != NULL) - free(data, M_DEVBUF); + kfree(data, M_DEVBUF); if (user_data != NULL) - free(user_data, M_DEVBUF); + kfree(user_data, M_DEVBUF); return (error); } @@ -1353,7 +1353,7 @@ chgetparams(struct cam_periph *periph) */ mode_buffer_len = sizeof(struct scsi_mode_sense_data); - mode_buffer = malloc(mode_buffer_len, M_TEMP, M_INTWAIT | M_ZERO); + mode_buffer = kmalloc(mode_buffer_len, M_TEMP, M_INTWAIT | M_ZERO); if (softc->quirks & CH_Q_NO_DBD) dbd = FALSE; @@ -1405,7 +1405,7 @@ chgetparams(struct cam_periph *periph) printf("chgetparams: error getting element " "address page\n"); xpt_release_ccb(ccb); - free(mode_buffer, M_TEMP); + kfree(mode_buffer, M_TEMP); return(error); } } @@ -1468,7 +1468,7 @@ chgetparams(struct cam_periph *periph) printf("chgetparams: error getting device " "capabilities page\n"); xpt_release_ccb(ccb); - free(mode_buffer, M_TEMP); + kfree(mode_buffer, M_TEMP); return(error); } } @@ -1487,7 +1487,7 @@ chgetparams(struct cam_periph *periph) softc->sc_exchangemask[from] = exchanges[from]; } - free(mode_buffer, M_TEMP); + kfree(mode_buffer, M_TEMP); return(error); } diff --git a/sys/bus/cam/scsi/scsi_da.c b/sys/bus/cam/scsi/scsi_da.c index 7dff480258..76e413fba2 100644 --- a/sys/bus/cam/scsi/scsi_da.c +++ b/sys/bus/cam/scsi/scsi_da.c @@ -26,7 +26,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/cam/scsi/scsi_da.c,v 1.42.2.46 2003/10/21 22:18:19 thomas Exp $ - * $DragonFly: src/sys/bus/cam/scsi/scsi_da.c,v 1.30 2006/07/28 02:17:32 dillon Exp $ + * $DragonFly: src/sys/bus/cam/scsi/scsi_da.c,v 1.31 2006/09/05 00:55:32 dillon Exp $ */ #ifdef _KERNEL @@ -556,7 +556,7 @@ daopen(struct dev_open_args *ap) struct scsi_read_capacity_data *rcap; union ccb *ccb; - rcap = malloc(sizeof(*rcap), M_TEMP, M_INTWAIT | M_ZERO); + rcap = kmalloc(sizeof(*rcap), M_TEMP, M_INTWAIT | M_ZERO); ccb = cam_periph_getccb(periph, /*priority*/1); scsi_read_capacity(&ccb->csio, @@ -579,7 +579,7 @@ daopen(struct dev_open_args *ap) dasetgeom(periph, rcap); } - free(rcap, M_TEMP); + kfree(rcap, M_TEMP); } if (error == 0) { @@ -1080,7 +1080,7 @@ dacleanup(struct cam_periph *periph) if (softc->disk.d_rawdev) { disk_destroy(&softc->disk); } - free(softc, M_DEVBUF); + kfree(softc, M_DEVBUF); } static void @@ -1231,7 +1231,7 @@ daregister(struct cam_periph *periph, void *arg) return(CAM_REQ_CMP_ERR); } - softc = malloc(sizeof(*softc), M_DEVBUF, M_INTWAIT | M_ZERO); + softc = kmalloc(sizeof(*softc), M_DEVBUF, M_INTWAIT | M_ZERO); LIST_INIT(&softc->pending_ccbs); softc->state = DA_STATE_PROBE; bioq_init(&softc->bio_queue); @@ -1440,7 +1440,7 @@ dastart(struct cam_periph *periph, union ccb *start_ccb) struct ccb_scsiio *csio; struct scsi_read_capacity_data *rcap; - rcap = malloc(sizeof(*rcap), M_TEMP, M_INTWAIT | M_ZERO); + rcap = kmalloc(sizeof(*rcap), M_TEMP, M_INTWAIT | M_ZERO); csio = &start_ccb->csio; scsi_read_capacity(csio, /*retries*/4, @@ -1715,7 +1715,7 @@ dadone(struct cam_periph *periph, union ccb *done_ccb) } } } - free(rdcap, M_TEMP); + kfree(rdcap, M_TEMP); if (announce_buf[0] != '\0') { xpt_announce_periph(periph, announce_buf); /* diff --git a/sys/bus/cam/scsi/scsi_low.c b/sys/bus/cam/scsi/scsi_low.c index 3072737f16..65ed4fc467 100644 --- a/sys/bus/cam/scsi/scsi_low.c +++ b/sys/bus/cam/scsi/scsi_low.c @@ -1,6 +1,6 @@ /* * $FreeBSD: src/sys/cam/scsi/scsi_low.c,v 1.1.2.5 2003/08/09 06:18:30 non Exp $ - * $DragonFly: src/sys/bus/cam/scsi/scsi_low.c,v 1.15 2006/01/22 14:03:51 swildner Exp $ + * $DragonFly: src/sys/bus/cam/scsi/scsi_low.c,v 1.16 2006/09/05 00:55:32 dillon Exp $ * $NetBSD: scsi_low.c,v 1.24.10.8 2001/06/26 07:39:44 honda Exp $ */ @@ -335,8 +335,8 @@ scsi_low_translate_error_code(struct slccb *cb, struct scsi_low_error_code *tp) /************************************************************** * SCSI INTERFACE (CAM) **************************************************************/ -#define SCSI_LOW_MALLOC(size) malloc((size), M_DEVBUF, M_INTWAIT) -#define SCSI_LOW_FREE(pt) free((pt), M_DEVBUF) +#define SCSI_LOW_MALLOC(size) kmalloc((size), M_DEVBUF, M_INTWAIT) +#define SCSI_LOW_FREE(pt) kfree((pt), M_DEVBUF) #define SCSI_LOW_ALLOC_CCB(flags) scsi_low_get_ccb() static void scsi_low_poll_cam (struct cam_sim *); @@ -402,14 +402,14 @@ static void scsi_low_cam_rescan_callback(struct cam_periph *periph, union ccb *ccb) { xpt_free_path(ccb->ccb_h.path); - free(ccb, M_DEVBUF); + kfree(ccb, M_DEVBUF); } static void scsi_low_rescan_bus_cam(struct scsi_low_softc *slp) { struct cam_path *path; - union ccb *ccb = malloc(sizeof(union ccb), M_DEVBUF, M_INTWAIT | M_ZERO); + union ccb *ccb = kmalloc(sizeof(union ccb), M_DEVBUF, M_INTWAIT | M_ZERO); cam_status status; status = xpt_create_path(&path, xpt_periph, diff --git a/sys/bus/cam/scsi/scsi_pass.c b/sys/bus/cam/scsi/scsi_pass.c index aab8af0281..e96c923f18 100644 --- a/sys/bus/cam/scsi/scsi_pass.c +++ b/sys/bus/cam/scsi/scsi_pass.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/cam/scsi/scsi_pass.c,v 1.19 2000/01/17 06:27:37 mjacob Exp $ - * $DragonFly: src/sys/bus/cam/scsi/scsi_pass.c,v 1.16 2006/07/28 02:17:32 dillon Exp $ + * $DragonFly: src/sys/bus/cam/scsi/scsi_pass.c,v 1.17 2006/09/05 00:55:32 dillon Exp $ */ #include @@ -234,7 +234,7 @@ passcleanup(struct cam_periph *periph) printf("removing device entry\n"); } dev_ops_remove(&pass_ops, -1, periph->unit_number); - free(softc, M_DEVBUF); + kfree(softc, M_DEVBUF); } static void @@ -294,7 +294,7 @@ passregister(struct cam_periph *periph, void *arg) return(CAM_REQ_CMP_ERR); } - softc = malloc(sizeof(*softc), M_DEVBUF, M_INTWAIT | M_ZERO); + softc = kmalloc(sizeof(*softc), M_DEVBUF, M_INTWAIT | M_ZERO); softc->state = PASS_STATE_NORMAL; softc->pd_type = SID_TYPE(&cgd->inq_data); bioq_init(&softc->bio_queue); diff --git a/sys/bus/cam/scsi/scsi_pt.c b/sys/bus/cam/scsi/scsi_pt.c index 2f18aeca24..ed1c74d700 100644 --- a/sys/bus/cam/scsi/scsi_pt.c +++ b/sys/bus/cam/scsi/scsi_pt.c @@ -26,7 +26,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/cam/scsi/scsi_pt.c,v 1.17 2000/01/17 06:27:37 mjacob Exp $ - * $DragonFly: src/sys/bus/cam/scsi/scsi_pt.c,v 1.15 2006/07/28 02:17:32 dillon Exp $ + * $DragonFly: src/sys/bus/cam/scsi/scsi_pt.c,v 1.16 2006/09/05 00:55:32 dillon Exp $ */ #include @@ -328,7 +328,7 @@ ptctor(struct cam_periph *periph, void *arg) return(CAM_REQ_CMP_ERR); } - softc = malloc(sizeof(*softc), M_DEVBUF, M_INTWAIT | M_ZERO); + softc = kmalloc(sizeof(*softc), M_DEVBUF, M_INTWAIT | M_ZERO); LIST_INIT(&softc->pending_ccbs); softc->state = PT_STATE_NORMAL; bioq_init(&softc->bio_queue); @@ -432,7 +432,7 @@ ptdtor(struct cam_periph *periph) xpt_print_path(periph->path); printf("removing device entry\n"); dev_ops_remove(&pt_ops, -1, periph->unit_number); - free(softc, M_DEVBUF); + kfree(softc, M_DEVBUF); } static void diff --git a/sys/bus/cam/scsi/scsi_sa.c b/sys/bus/cam/scsi/scsi_sa.c index fc816316c4..f0cf8cb00c 100644 --- a/sys/bus/cam/scsi/scsi_sa.c +++ b/sys/bus/cam/scsi/scsi_sa.c @@ -1,6 +1,6 @@ /* * $FreeBSD: src/sys/cam/scsi/scsi_sa.c,v 1.45.2.13 2002/12/17 17:08:50 trhodes Exp $ - * $DragonFly: src/sys/bus/cam/scsi/scsi_sa.c,v 1.18 2006/07/28 02:17:32 dillon Exp $ + * $DragonFly: src/sys/bus/cam/scsi/scsi_sa.c,v 1.19 2006/09/05 00:55:32 dillon Exp $ * * Implementation of SCSI Sequential Access Peripheral driver for CAM. * @@ -1364,7 +1364,7 @@ sacleanup(struct cam_periph *periph) xpt_print_path(periph->path); printf("removing device entry\n"); dev_ops_remove(&sa_ops, SA_UNITMASK, SA_UNIT(periph->unit_number)); - free(softc, M_DEVBUF); + kfree(softc, M_DEVBUF); } static void @@ -1429,7 +1429,7 @@ saregister(struct cam_periph *periph, void *arg) return (CAM_REQ_CMP_ERR); } - softc = malloc(sizeof (*softc), M_DEVBUF, M_INTWAIT | M_ZERO); + softc = kmalloc(sizeof (*softc), M_DEVBUF, M_INTWAIT | M_ZERO); softc->scsi_rev = SID_ANSI_REV(&cgd->inq_data); softc->state = SA_STATE_NORMAL; softc->fileno = (daddr_t) -1; @@ -1906,7 +1906,7 @@ samount(struct cam_periph *periph, int oflags, dev_t dev) * blocksize on tape is and don't expect to really * read a full record. */ - rblim = malloc(8192, M_TEMP, M_INTWAIT); + rblim = kmalloc(8192, M_TEMP, M_INTWAIT); if ((softc->quirks & SA_QUIRK_NODREAD) == 0) { scsi_sa_read_write(&ccb->csio, 0, sadone, @@ -2220,7 +2220,7 @@ tryagain: } exit: if (rblim != NULL) - free(rblim, M_TEMP); + kfree(rblim, M_TEMP); if (error != 0) { softc->dsreg = MTIO_DSREG_NIL; @@ -2524,7 +2524,7 @@ retry: mode_buffer_len += sizeof (sa_comp_t); } - mode_buffer = malloc(mode_buffer_len, M_TEMP, M_INTWAIT | M_ZERO); + mode_buffer = kmalloc(mode_buffer_len, M_TEMP, M_INTWAIT | M_ZERO); mode_hdr = (struct scsi_mode_header_6 *)mode_buffer; mode_blk = (struct scsi_mode_blk_desc *)&mode_hdr[1]; @@ -2553,7 +2553,7 @@ retry: goto retry; } softc->quirks |= SA_QUIRK_NOCOMP; - free(mode_buffer, M_TEMP); + kfree(mode_buffer, M_TEMP); goto retry; } else if (status == CAM_SCSI_STATUS_ERROR) { /* Tell the user about the fatal error. */ @@ -2662,7 +2662,7 @@ retry: sagetparamsexit: xpt_release_ccb(ccb); - free(mode_buffer, M_TEMP); + kfree(mode_buffer, M_TEMP); return (error); } @@ -2704,7 +2704,7 @@ sasetparams(struct cam_periph *periph, sa_params params_to_set, softc = (struct sa_softc *)periph->softc; - ccomp = malloc(sizeof (sa_comp_t), M_TEMP, M_INTWAIT); + ccomp = kmalloc(sizeof (sa_comp_t), M_TEMP, M_INTWAIT); /* * Since it doesn't make sense to set the number of blocks, or @@ -2719,7 +2719,7 @@ sasetparams(struct cam_periph *periph, sa_params params_to_set, ¤t_calg, ccomp); if (error != 0) { - free(ccomp, M_TEMP); + kfree(ccomp, M_TEMP); return (error); } @@ -2727,7 +2727,7 @@ sasetparams(struct cam_periph *periph, sa_params params_to_set, if (params_to_set & SA_PARAM_COMPRESSION) mode_buffer_len += sizeof (sa_comp_t); - mode_buffer = malloc(mode_buffer_len, M_TEMP, M_INTWAIT | M_ZERO); + mode_buffer = kmalloc(mode_buffer_len, M_TEMP, M_INTWAIT | M_ZERO); mode_hdr = (struct scsi_mode_header_6 *)mode_buffer; mode_blk = (struct scsi_mode_blk_desc *)&mode_hdr[1]; @@ -2873,7 +2873,7 @@ retry: * 'operation not supported'. */ if (params_to_set == SA_PARAM_NONE) { - free(mode_buffer, M_TEMP); + kfree(mode_buffer, M_TEMP); xpt_release_ccb(ccb); return (ENODEV); } @@ -2958,7 +2958,7 @@ retry: xpt_release_ccb(ccb); if (ccomp != NULL) - free(ccomp, M_TEMP); + kfree(ccomp, M_TEMP); if (params_to_set & SA_PARAM_COMPRESSION) { if (error) { @@ -2977,7 +2977,7 @@ retry: } } - free(mode_buffer, M_TEMP); + kfree(mode_buffer, M_TEMP); return (error); } diff --git a/sys/bus/cam/scsi/scsi_ses.c b/sys/bus/cam/scsi/scsi_ses.c index 27356b1ed5..98463f5fb7 100644 --- a/sys/bus/cam/scsi/scsi_ses.c +++ b/sys/bus/cam/scsi/scsi_ses.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/cam/scsi/scsi_ses.c,v 1.8.2.2 2000/08/08 23:19:21 mjacob Exp $ */ -/* $DragonFly: src/sys/bus/cam/scsi/scsi_ses.c,v 1.16 2006/08/03 16:40:46 swildner Exp $ */ +/* $DragonFly: src/sys/bus/cam/scsi/scsi_ses.c,v 1.17 2006/09/05 00:55:32 dillon Exp $ */ /* * Copyright (c) 2000 Matthew Jacob * All rights reserved. @@ -125,8 +125,8 @@ static int safte_set_objstat(ses_softc_t *, ses_objstat *, int); #define SES_DLOG if (0) ses_log #endif #define SES_VLOG if (bootverbose) ses_log -#define SES_MALLOC(amt) malloc(amt, M_DEVBUF, M_INTWAIT) -#define SES_FREE(ptr, amt) free(ptr, M_DEVBUF) +#define SES_MALLOC(amt) kmalloc(amt, M_DEVBUF, M_INTWAIT) +#define SES_FREE(ptr, amt) kfree(ptr, M_DEVBUF) #define MEMZERO bzero #define MEMCPY(dest, src, amt) bcopy(src, dest, amt) @@ -263,7 +263,7 @@ sescleanup(struct cam_periph *periph) xpt_print_path(periph->path); printf("removing device entry\n"); dev_ops_remove(&ses_ops, -1, periph->unit_number); - free(softc, M_DEVBUF); + kfree(softc, M_DEVBUF); } static void @@ -331,7 +331,7 @@ sesregister(struct cam_periph *periph, void *arg) return (CAM_REQ_CMP_ERR); } - softc = malloc(sizeof (struct ses_softc), M_DEVBUF, M_INTWAIT | M_ZERO); + softc = kmalloc(sizeof (struct ses_softc), M_DEVBUF, M_INTWAIT | M_ZERO); periph->softc = softc; softc->periph = periph; @@ -360,7 +360,7 @@ sesregister(struct cam_periph *periph, void *arg) break; case SES_NONE: default: - free(softc, M_DEVBUF); + kfree(softc, M_DEVBUF); return (CAM_REQ_CMP_ERR); } diff --git a/sys/bus/cam/scsi/scsi_targ_bh.c b/sys/bus/cam/scsi/scsi_targ_bh.c index 910381b90c..d7f4ed1590 100644 --- a/sys/bus/cam/scsi/scsi_targ_bh.c +++ b/sys/bus/cam/scsi/scsi_targ_bh.c @@ -26,7 +26,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/cam/scsi/scsi_targ_bh.c,v 1.4.2.6 2003/11/14 11:31:25 simokawa Exp $ - * $DragonFly: src/sys/bus/cam/scsi/scsi_targ_bh.c,v 1.11 2006/08/03 16:40:46 swildner Exp $ + * $DragonFly: src/sys/bus/cam/scsi/scsi_targ_bh.c,v 1.12 2006/09/05 00:55:33 dillon Exp $ */ #include #include @@ -276,7 +276,7 @@ targbhenlun(struct cam_periph *periph) for (i = 0; i < MAX_ACCEPT; i++) { struct ccb_accept_tio *atio; - atio = malloc(sizeof(*atio), M_DEVBUF, M_INTWAIT); + atio = kmalloc(sizeof(*atio), M_DEVBUF, M_INTWAIT); atio->ccb_h.ccb_descr = targbhallocdescr(); @@ -287,7 +287,7 @@ targbhenlun(struct cam_periph *periph) status = atio->ccb_h.status; if (status != CAM_REQ_INPROG) { targbhfreedescr(atio->ccb_h.ccb_descr); - free(atio, M_DEVBUF); + kfree(atio, M_DEVBUF); break; } ((struct targbh_cmd_desc*)atio->ccb_h.ccb_descr)->atio_link = @@ -310,7 +310,7 @@ targbhenlun(struct cam_periph *periph) for (i = 0; i < MAX_ACCEPT; i++) { struct ccb_immed_notify *inot; - inot = malloc(sizeof(*inot), M_DEVBUF, M_INTWAIT); + inot = kmalloc(sizeof(*inot), M_DEVBUF, M_INTWAIT); xpt_setup_ccb(&inot->ccb_h, periph->path, /*priority*/1); inot->ccb_h.func_code = XPT_IMMED_NOTIFY; @@ -318,7 +318,7 @@ targbhenlun(struct cam_periph *periph) xpt_action((union ccb *)inot); status = inot->ccb_h.status; if (status != CAM_REQ_INPROG) { - free(inot, M_DEVBUF); + kfree(inot, M_DEVBUF); break; } SLIST_INSERT_HEAD(&softc->immed_notify_slist, &inot->ccb_h, @@ -394,7 +394,7 @@ targbhctor(struct cam_periph *periph, void *arg) cpi = (struct ccb_pathinq *)arg; /* Allocate our per-instance private storage */ - softc = malloc(sizeof(*softc), M_DEVBUF, M_INTWAIT | M_ZERO); + softc = kmalloc(sizeof(*softc), M_DEVBUF, M_INTWAIT | M_ZERO); TAILQ_INIT(&softc->pending_queue); TAILQ_INIT(&softc->work_queue); softc->accept_tio_list = NULL; @@ -425,7 +425,7 @@ targbhdtor(struct cam_periph *periph) default: /* XXX Wait for callback of targbhdislun() */ tsleep(softc, 0, "targbh", hz/2); - free(softc, M_DEVBUF); + kfree(softc, M_DEVBUF); break; } } @@ -539,7 +539,7 @@ targbhdone(struct cam_periph *periph, union ccb *done_ccb) if (softc->state == TARGBH_STATE_TEARDOWN || atio->ccb_h.status == CAM_REQ_ABORTED) { targbhfreedescr(descr); - free(done_ccb, M_DEVBUF); + kfree(done_ccb, M_DEVBUF); return; } @@ -666,7 +666,7 @@ targbhdone(struct cam_periph *periph, union ccb *done_ccb) break; } else { targbhfreedescr(desc); - free(atio, M_DEVBUF); + kfree(atio, M_DEVBUF); } break; } @@ -675,7 +675,7 @@ targbhdone(struct cam_periph *periph, union ccb *done_ccb) if (softc->state == TARGBH_STATE_TEARDOWN || done_ccb->ccb_h.status == CAM_REQ_ABORTED) { printf("Freed an immediate notify\n"); - free(done_ccb, M_DEVBUF); + kfree(done_ccb, M_DEVBUF); } break; } @@ -699,10 +699,10 @@ targbhallocdescr(void) struct targbh_cmd_desc* descr; /* Allocate the targbh_descr structure */ - descr = malloc(sizeof(*descr), M_DEVBUF, M_INTWAIT | M_ZERO); + descr = kmalloc(sizeof(*descr), M_DEVBUF, M_INTWAIT | M_ZERO); /* Allocate buffer backing store */ - descr->backing_store = malloc(MAX_BUF_SIZE, M_DEVBUF, M_INTWAIT); + descr->backing_store = kmalloc(MAX_BUF_SIZE, M_DEVBUF, M_INTWAIT); descr->max_size = MAX_BUF_SIZE; return (descr); } @@ -710,6 +710,6 @@ targbhallocdescr(void) static void targbhfreedescr(struct targbh_cmd_desc *descr) { - free(descr->backing_store, M_DEVBUF); - free(descr, M_DEVBUF); + kfree(descr->backing_store, M_DEVBUF); + kfree(descr, M_DEVBUF); } diff --git a/sys/bus/eisa/eisaconf.c b/sys/bus/eisa/eisaconf.c index e1252307cf..b5e7293243 100644 --- a/sys/bus/eisa/eisaconf.c +++ b/sys/bus/eisa/eisaconf.c @@ -29,7 +29,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/eisa/eisaconf.c,v 1.55 2000/01/14 07:13:57 peter Exp $ - * $DragonFly: src/sys/bus/eisa/eisaconf.c,v 1.6 2006/01/22 14:03:51 swildner Exp $ + * $DragonFly: src/sys/bus/eisa/eisaconf.c,v 1.7 2006/09/05 00:55:34 dillon Exp $ */ #include "opt_eisa.h" @@ -173,7 +173,7 @@ eisa_probe(device_t dev) devices_found++; /* Prepare an eisa_device_node for this slot */ - e_dev = malloc(sizeof(*e_dev), M_DEVBUF, M_INTWAIT | M_ZERO); + e_dev = kmalloc(sizeof(*e_dev), M_DEVBUF, M_INTWAIT | M_ZERO); e_dev->id = eisa_id; e_dev->ioconf.slot = slot; @@ -503,7 +503,7 @@ eisa_add_intr(device_t dev, int irq, int trigger) struct eisa_device *e_dev = device_get_ivars(dev); struct irq_node *irq_info; - irq_info = malloc(sizeof(*irq_info), M_DEVBUF, M_INTWAIT); + irq_info = kmalloc(sizeof(*irq_info), M_DEVBUF, M_INTWAIT); irq_info->irq_no = irq; irq_info->irq_trigger = trigger; irq_info->idesc = NULL; @@ -517,7 +517,7 @@ eisa_add_resvaddr(struct eisa_device *e_dev, struct resvlist *head, u_long base, { resvaddr_t *reservation; - reservation = malloc(sizeof(resvaddr_t), M_DEVBUF, M_INTWAIT); + reservation = kmalloc(sizeof(resvaddr_t), M_DEVBUF, M_INTWAIT); reservation->addr = base; reservation->size = size; reservation->flags = flags; @@ -543,7 +543,7 @@ eisa_add_resvaddr(struct eisa_device *e_dev, struct resvlist *head, u_long base, * matches any already in here, * fail. */ - free(reservation, M_DEVBUF); + kfree(reservation, M_DEVBUF); return (EEXIST); } diff --git a/sys/bus/firewire/firewire.c b/sys/bus/firewire/firewire.c index 119365ef30..4f1f64c3cc 100644 --- a/sys/bus/firewire/firewire.c +++ b/sys/bus/firewire/firewire.c @@ -32,7 +32,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/firewire/firewire.c,v 1.68 2004/01/08 14:58:09 simokawa Exp $ - * $DragonFly: src/sys/bus/firewire/firewire.c,v 1.14 2006/01/22 14:03:51 swildner Exp $ + * $DragonFly: src/sys/bus/firewire/firewire.c,v 1.15 2006/09/05 00:55:35 dillon Exp $ * */ @@ -492,15 +492,15 @@ firewire_detach(device_t dev) for (fwdev = STAILQ_FIRST(&sc->fc->devices); fwdev != NULL; fwdev = fwdev_next) { fwdev_next = STAILQ_NEXT(fwdev, link); - free(fwdev, M_FW); + kfree(fwdev, M_FW); } for (csrd = SLIST_FIRST(&sc->fc->csrfree); csrd != NULL; csrd = next) { next = SLIST_NEXT(csrd, link); - free(csrd, M_FW); + kfree(csrd, M_FW); } - free(sc->fc->topology_map, M_FW); - free(sc->fc->speed_map, M_FW); - free(sc->fc->crom_src_buf, M_FW); + kfree(sc->fc->topology_map, M_FW); + kfree(sc->fc->speed_map, M_FW); + kfree(sc->fc->crom_src_buf, M_FW); return(0); } #if 0 @@ -587,7 +587,7 @@ fw_init_crom(struct firewire_comm *fc) struct crom_src *src; fc->crom_src_buf = (struct crom_src_buf *) - malloc(sizeof(struct crom_src_buf), M_FW, M_WAITOK | M_ZERO); + kmalloc(sizeof(struct crom_src_buf), M_FW, M_WAITOK | M_ZERO); if (fc->crom_src_buf == NULL) return; @@ -680,10 +680,10 @@ fw_busreset(struct firewire_comm *fc) if (fdc->post_busreset != NULL) fdc->post_busreset(fdc); } - free(devlistp, M_TEMP); + kfree(devlistp, M_TEMP); } - newrom = malloc(CROMSIZE, M_FW, M_WAITOK | M_ZERO); + newrom = kmalloc(CROMSIZE, M_FW, M_WAITOK | M_ZERO); src = &fc->crom_src_buf->src; crom_load(src, (u_int32_t *)newrom, CROMSIZE); if (bcmp(newrom, fc->config_rom, CROMSIZE) != 0) { @@ -695,7 +695,7 @@ fw_busreset(struct firewire_comm *fc) crom_load(src, (u_int32_t *)newrom, CROMSIZE); bcopy(newrom, (void *)fc->config_rom, CROMSIZE); } - free(newrom, M_FW); + kfree(newrom, M_FW); } /* Call once after reboot */ @@ -774,7 +774,7 @@ fw_init(struct firewire_comm *fc) SLIST_INIT(&fc->ongocsr); SLIST_INIT(&fc->csrfree); for( i = 0 ; i < FWMAXCSRDIR ; i++){ - csrd = malloc(sizeof(struct csrdir), M_FW, M_WAITOK); + csrd = kmalloc(sizeof(struct csrdir), M_FW, M_WAITOK); if(csrd == NULL) break; SLIST_INSERT_HEAD(&fc->csrfree, csrd, link); } @@ -806,7 +806,7 @@ fw_init(struct firewire_comm *fc) xfer = fw_xfer_alloc(); if(xfer == NULL) return; - fwb = malloc(sizeof (struct fw_bind), M_FW, M_WAITOK); + fwb = kmalloc(sizeof (struct fw_bind), M_FW, M_WAITOK); xfer->act.hand = fw_vmaccess; xfer->fc = fc; xfer->sc = NULL; @@ -922,7 +922,7 @@ fw_tl_free(struct firewire_comm *fc, struct fw_xfer *xfer) tl = STAILQ_NEXT(tl, link)){ if(tl->xfer == xfer){ STAILQ_REMOVE(&fc->tlabels[xfer->tl], tl, tlabel, link); - free(tl, M_FW); + kfree(tl, M_FW); break; } } @@ -964,7 +964,7 @@ fw_xfer_alloc(struct malloc_type *type) { struct fw_xfer *xfer; - xfer = malloc(sizeof(struct fw_xfer), type, M_INTWAIT | M_ZERO); + xfer = kmalloc(sizeof(struct fw_xfer), type, M_INTWAIT | M_ZERO); xfer->malloc = type; return xfer; @@ -981,17 +981,17 @@ fw_xfer_alloc_buf(struct malloc_type *type, int send_len, int recv_len) if (xfer == NULL) return(NULL); if (send_len > 0) { - xfer->send.payload = malloc(send_len, type, M_INTWAIT | M_ZERO); + xfer->send.payload = kmalloc(send_len, type, M_INTWAIT | M_ZERO); if (xfer->send.payload == NULL) { fw_xfer_free(xfer); return(NULL); } } if (recv_len > 0) { - xfer->recv.payload = malloc(recv_len, type, M_INTWAIT); + xfer->recv.payload = kmalloc(recv_len, type, M_INTWAIT); if (xfer->recv.payload == NULL) { if (xfer->send.payload != NULL) - free(xfer->send.payload, type); + kfree(xfer->send.payload, type); fw_xfer_free(xfer); return(NULL); } @@ -1055,12 +1055,12 @@ fw_xfer_free_buf( struct fw_xfer* xfer) } fw_xfer_unload(xfer); if(xfer->send.payload != NULL){ - free(xfer->send.payload, xfer->malloc); + kfree(xfer->send.payload, xfer->malloc); } if(xfer->recv.payload != NULL){ - free(xfer->recv.payload, xfer->malloc); + kfree(xfer->recv.payload, xfer->malloc); } - free(xfer, xfer->malloc); + kfree(xfer, xfer->malloc); } void @@ -1071,7 +1071,7 @@ fw_xfer_free( struct fw_xfer* xfer) return; } fw_xfer_unload(xfer); - free(xfer, xfer->malloc); + kfree(xfer, xfer->malloc); } void @@ -1333,7 +1333,7 @@ loop: addr = 0xf0000000 | fc->ongoaddr; goto dorequest; } - fwdev = malloc(sizeof(struct fw_device), M_FW, + fwdev = kmalloc(sizeof(struct fw_device), M_FW, M_WAITOK | M_ZERO); fwdev->fc = fc; fwdev->rommax = 0; @@ -1632,7 +1632,7 @@ fw_attach_dev(struct firewire_comm *fc) */ STAILQ_REMOVE(&fc->devices, fwdev, fw_device, link); - free(fwdev, M_FW); + kfree(fwdev, M_FW); } } } @@ -1647,7 +1647,7 @@ fw_attach_dev(struct firewire_comm *fc) fdc->post_explore(fdc); } } - free(devlistp, M_TEMP); + kfree(devlistp, M_TEMP); if (fc->retry_count > 0) { printf("probe failed for %d node\n", fc->retry_count); @@ -1679,7 +1679,7 @@ fw_get_tlabel(struct firewire_comm *fc, struct fw_xfer *xfer) break; } if(tmptl == NULL) { - tl = malloc(sizeof(struct tlabel), M_FW, M_WAITOK); + tl = kmalloc(sizeof(struct tlabel), M_FW, M_WAITOK); tl->xfer = xfer; STAILQ_INSERT_TAIL(&fc->tlabels[label], tl, link); crit_exit(); @@ -2078,7 +2078,7 @@ fw_vmaccess(struct fw_xfer *xfer){ switch(rfp->mode.hdr.tcode){ /* XXX need fix for 64bit arch */ case FWTCODE_WREQB: - xfer->send.buf = malloc(12, M_FW, M_WAITOK); + xfer->send.buf = kmalloc(12, M_FW, M_WAITOK); xfer->send.len = 12; sfp = (struct fw_pkt *)xfer->send.buf; bcopy(rfp->mode.wreqb.payload, @@ -2087,14 +2087,14 @@ fw_vmaccess(struct fw_xfer *xfer){ sfp->mode.wres.rtcode = 0; break; case FWTCODE_WREQQ: - xfer->send.buf = malloc(12, M_FW, M_WAITOK); + xfer->send.buf = kmalloc(12, M_FW, M_WAITOK); xfer->send.len = 12; sfp->mode.wres.tcode = FWTCODE_WRES; *((u_int32_t *)(ntohl(rfp->mode.wreqb.dest_lo))) = rfp->mode.wreqq.data; sfp->mode.wres.rtcode = 0; break; case FWTCODE_RREQB: - xfer->send.buf = malloc(16 + rfp->mode.rreqb.len, M_FW, M_WAITOK); + xfer->send.buf = kmalloc(16 + rfp->mode.rreqb.len, M_FW, M_WAITOK); xfer->send.len = 16 + ntohs(rfp->mode.rreqb.len); sfp = (struct fw_pkt *)xfer->send.buf; bcopy((caddr_t)ntohl(rfp->mode.rreqb.dest_lo), @@ -2105,7 +2105,7 @@ fw_vmaccess(struct fw_xfer *xfer){ sfp->mode.rresb.extcode = 0; break; case FWTCODE_RREQQ: - xfer->send.buf = malloc(16, M_FW, M_WAITOK); + xfer->send.buf = kmalloc(16, M_FW, M_WAITOK); xfer->send.len = 16; sfp = (struct fw_pkt *)xfer->send.buf; sfp->mode.rresq.data = *(u_int32_t *)(ntohl(rfp->mode.rreqq.dest_lo)); diff --git a/sys/bus/firewire/fwdev.c b/sys/bus/firewire/fwdev.c index c08e6187f2..a2ee50f891 100644 --- a/sys/bus/firewire/fwdev.c +++ b/sys/bus/firewire/fwdev.c @@ -32,7 +32,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/firewire/fwdev.c,v 1.36 2004/01/22 14:41:17 simokawa Exp $ - * $DragonFly: src/sys/bus/firewire/fwdev.c,v 1.12 2006/07/28 02:17:33 dillon Exp $ + * $DragonFly: src/sys/bus/firewire/fwdev.c,v 1.13 2006/09/05 00:55:35 dillon Exp $ * */ @@ -123,7 +123,7 @@ fwdev_allocbuf(struct firewire_comm *fc, struct fw_xferq *q, b->psize, b->nchunk * b->npacket, BUS_DMA_WAITOK); if (q->buf == NULL) { - free(q->bulkxfer, M_FW); + kfree(q->bulkxfer, M_FW); q->bulkxfer = NULL; return(ENOMEM); } @@ -157,7 +157,7 @@ fwdev_freebuf(struct fw_xferq *q) if (q->buf != NULL) fwdma_free_multiseg(q->buf); q->buf = NULL; - free(q->bulkxfer, M_FW); + kfree(q->bulkxfer, M_FW); q->bulkxfer = NULL; q->flag &= ~FWXFERQ_EXTBUF; q->psize = 0; @@ -190,7 +190,7 @@ fw_open (struct dev_open_args *ap) } #endif - dev->si_drv1 = malloc(sizeof(struct fw_drv1), M_FW, M_WAITOK | M_ZERO); + dev->si_drv1 = kmalloc(sizeof(struct fw_drv1), M_FW, M_WAITOK | M_ZERO); return err; } @@ -239,7 +239,7 @@ fw_close (struct dev_close_args *ap) fwb = STAILQ_FIRST(&ir->binds)) { STAILQ_REMOVE(&fc->binds, fwb, fw_bind, fclist); STAILQ_REMOVE_HEAD(&ir->binds, chlist); - free(fwb, M_FW); + kfree(fwb, M_FW); } ir->flag &= ~(FWXFERQ_OPEN | FWXFERQ_MODEMASK | FWXFERQ_CHTAGMASK); @@ -261,7 +261,7 @@ fw_close (struct dev_close_args *ap) FWXFERQ_MODEMASK | FWXFERQ_CHTAGMASK); d->it = NULL; } - free(dev->si_drv1, M_FW); + kfree(dev->si_drv1, M_FW); dev->si_drv1 = NULL; return err; @@ -614,7 +614,7 @@ out: } STAILQ_REMOVE(&sc->fc->binds, fwb, fw_bind, fclist); STAILQ_REMOVE(&ir->binds, fwb, fw_bind, chlist); - free(fwb, M_FW); + kfree(fwb, M_FW); break; case FW_SBINDADDR: if(bindreq->len <= 0 ){ @@ -625,7 +625,7 @@ out: err = EINVAL; break; } - fwb = malloc(sizeof (struct fw_bind), M_FW, M_WAITOK); + fwb = kmalloc(sizeof (struct fw_bind), M_FW, M_WAITOK); fwb->start = ((u_int64_t)bindreq->start.hi << 32) | bindreq->start.lo; fwb->end = fwb->start + bindreq->len; @@ -636,7 +636,7 @@ out: /* XXX alloc buf */ xfer = fw_xfer_alloc(M_FWXFER); if(xfer == NULL){ - free(fwb, M_FW); + kfree(fwb, M_FW); return (ENOMEM); } xfer->fc = sc->fc; @@ -684,7 +684,7 @@ out: break; } /* myself */ - ptr = malloc(CROMSIZE, M_FW, M_WAITOK); + ptr = kmalloc(CROMSIZE, M_FW, M_WAITOK); len = CROMSIZE; for (i = 0; i < CROMSIZE/4; i++) ((u_int32_t *)ptr)[i] @@ -704,7 +704,7 @@ out: err = copyout(ptr, crom_buf->ptr, len); if (fwdev == NULL) /* myself */ - free(ptr, M_FW); + kfree(ptr, M_FW); break; default: sc->fc->ioctl(ap); diff --git a/sys/bus/firewire/fwdma.c b/sys/bus/firewire/fwdma.c index 7ae5ec409c..b9c87ff3a9 100644 --- a/sys/bus/firewire/fwdma.c +++ b/sys/bus/firewire/fwdma.c @@ -31,7 +31,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/bus/firewire/fwdma.c,v 1.5 2004/02/05 17:51:43 joerg Exp $ + * $DragonFly: src/sys/bus/firewire/fwdma.c,v 1.6 2006/09/05 00:55:35 dillon Exp $ */ #ifndef __DragonFly__ @@ -196,7 +196,7 @@ fwdma_malloc_multiseg(struct firewire_comm *fc, int alignment, #endif &am->dma_tag)) { printf("fwdma_malloc_multiseg: tag_create failed\n"); - free(am, M_FW); + kfree(am, M_FW); return(NULL); } @@ -231,5 +231,5 @@ fwdma_free_multiseg(struct fwdma_alloc_multi *am) seg->v_addr, am->ssize); } bus_dma_tag_destroy(am->dma_tag); - free(am, M_FW); + kfree(am, M_FW); } diff --git a/sys/bus/firewire/fwmem.c b/sys/bus/firewire/fwmem.c index 9bf06a540e..983948a372 100644 --- a/sys/bus/firewire/fwmem.c +++ b/sys/bus/firewire/fwmem.c @@ -31,7 +31,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/bus/firewire/fwmem.c,v 1.10 2006/07/28 02:17:33 dillon Exp $ + * $DragonFly: src/sys/bus/firewire/fwmem.c,v 1.11 2006/09/05 00:55:35 dillon Exp $ */ #ifndef __DragonFly__ @@ -313,7 +313,7 @@ fwmem_close (struct dev_close_args *ap) if (fwmem_debug) printf("%s: refcount=%d\n", __func__, fms->refcount); if (fms->refcount < 1) { - free(dev->si_drv1, M_FW); + kfree(dev->si_drv1, M_FW); dev->si_drv1 = NULL; } diff --git a/sys/bus/firewire/fwohci.c b/sys/bus/firewire/fwohci.c index 1cc61bd14c..42a69201ee 100644 --- a/sys/bus/firewire/fwohci.c +++ b/sys/bus/firewire/fwohci.c @@ -33,7 +33,7 @@ * * $FreeBSD: src/sys/dev/firewire/fwohci.c,v 1.72 2004/01/22 14:41:17 simokawa Exp $ * $FreeBSD: src/sys/dev/firewire/fwohci.c,v 1.1.2.19 2003/05/01 06:24:37 simokawa Exp $ - * $DragonFly: src/sys/bus/firewire/fwohci.c,v 1.10 2006/07/28 02:17:33 dillon Exp $ + * $DragonFly: src/sys/bus/firewire/fwohci.c,v 1.11 2006/09/05 00:55:35 dillon Exp $ */ #define ATRQ_CH 0 @@ -1194,7 +1194,7 @@ fwohci_db_free(struct fwohci_dbch *dbch) dbch->ndb = 0; db_tr = STAILQ_FIRST(&dbch->db_trq); fwdma_free_multiseg(dbch->am); - free(db_tr, M_FW); + kfree(db_tr, M_FW); STAILQ_INIT(&dbch->db_trq); dbch->flags &= ~FWOHCI_DBCH_INIT; } @@ -1242,7 +1242,7 @@ fwohci_db_init(struct fwohci_softc *sc, struct fwohci_dbch *dbch) DB_SIZE(dbch), dbch->ndb, BUS_DMA_WAITOK); if (dbch->am == NULL) { printf("fwohci_db_init: fwdma_malloc_multiseg failed\n"); - free(db_tr, M_FW); + kfree(db_tr, M_FW); return; } /* Attach DB to DMA ch. */ @@ -1934,7 +1934,7 @@ busresetout: goto sidout; } plen -= 4; /* chop control info */ - buf = (u_int32_t *)malloc(OHCI_SIDSIZE, M_FW, M_INTWAIT); + buf = (u_int32_t *)kmalloc(OHCI_SIDSIZE, M_FW, M_INTWAIT); if (buf == NULL) { device_printf(fc->dev, "malloc failed\n"); goto sidout; @@ -1950,7 +1950,7 @@ busresetout: fw_drain_txq(fc); #endif fw_sidrcv(fc, buf, plen); - free(buf, M_FW); + kfree(buf, M_FW); } sidout: if((stat & OHCI_INT_DMA_ATRQ )){ diff --git a/sys/bus/isa/i386/isa_compat.c b/sys/bus/isa/i386/isa_compat.c index e284817a61..cb358bcc8f 100644 --- a/sys/bus/isa/i386/isa_compat.c +++ b/sys/bus/isa/i386/isa_compat.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/isa/isa_compat.c,v 1.18.2.1 2001/05/17 23:05:06 imp Exp $ - * $DragonFly: src/sys/bus/isa/i386/isa_compat.c,v 1.9 2005/05/24 20:58:50 dillon Exp $ + * $DragonFly: src/sys/bus/isa/i386/isa_compat.c,v 1.10 2006/09/05 00:55:35 dillon Exp $ */ #include @@ -289,7 +289,7 @@ isa_wrap_old_drivers(void) struct isa_compat_driver *driver; for (i = 0, op = &old_drivers[0]; i < old_drivers_count; i++, op++) { - driver = malloc(sizeof(struct isa_compat_driver), M_DEVBUF, M_WAITOK | M_ZERO); + driver = kmalloc(sizeof(struct isa_compat_driver), M_DEVBUF, M_WAITOK | M_ZERO); driver->driver.name = op->driver->name; driver->driver.methods = isa_compat_methods; driver->driver.size = sizeof(struct isa_device); diff --git a/sys/bus/isa/i386/isa_dma.c b/sys/bus/isa/i386/isa_dma.c index 4ddc48acef..37e24de1d8 100644 --- a/sys/bus/isa/i386/isa_dma.c +++ b/sys/bus/isa/i386/isa_dma.c @@ -35,7 +35,7 @@ * * from: @(#)isa.c 7.2 (Berkeley) 5/13/91 * $FreeBSD: src/sys/i386/isa/isa_dma.c,v 1.4.2.1 2000/08/08 19:49:53 peter Exp $ - * $DragonFly: src/sys/bus/isa/i386/isa_dma.c,v 1.8 2006/04/30 17:22:15 dillon Exp $ + * $DragonFly: src/sys/bus/isa/i386/isa_dma.c,v 1.9 2006/09/05 00:55:35 dillon Exp $ */ /* @@ -110,13 +110,13 @@ isa_dmainit(int chan, u_int bouncebufsize) dma_bouncebufsize[chan] = bouncebufsize; /* Try malloc() first. It works better if it works. */ - buf = malloc(bouncebufsize, M_DEVBUF, M_NOWAIT); + buf = kmalloc(bouncebufsize, M_DEVBUF, M_NOWAIT); if (buf != NULL) { if (isa_dmarangecheck(buf, bouncebufsize, chan) == 0) { dma_bouncebuf[chan] = buf; return; } - free(buf, M_DEVBUF); + kfree(buf, M_DEVBUF); } buf = contigmalloc(bouncebufsize, M_DEVBUF, M_NOWAIT, 0ul, 0xfffffful, 1ul, chan & 4 ? 0x20000ul : 0x10000ul); diff --git a/sys/bus/isa/isa_common.c b/sys/bus/isa/isa_common.c index 2adc6ad55e..786393d635 100644 --- a/sys/bus/isa/isa_common.c +++ b/sys/bus/isa/isa_common.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/isa/isa_common.c,v 1.16.2.1 2000/09/16 15:49:52 roger Exp $ - * $DragonFly: src/sys/bus/isa/isa_common.c,v 1.10 2006/08/03 16:40:46 swildner Exp $ + * $DragonFly: src/sys/bus/isa/isa_common.c,v 1.11 2006/09/05 00:55:35 dillon Exp $ */ /* * Modifications for Intel architecture by Garrett A. Wollman. @@ -516,7 +516,7 @@ isa_probe_children(device_t dev) } } - free(children, M_TEMP); + kfree(children, M_TEMP); isa_running = 1; } @@ -530,7 +530,7 @@ isa_add_child(device_t bus, device_t parent, int order, const char *name, int un device_t child; struct isa_device *idev; - idev = malloc(sizeof(struct isa_device), M_ISADEV, M_WAITOK | M_ZERO); + idev = kmalloc(sizeof(struct isa_device), M_ISADEV, M_WAITOK | M_ZERO); resource_list_init(&idev->id_resources); TAILQ_INIT(&idev->id_configs); @@ -885,7 +885,7 @@ isa_driver_added(device_t dev, driver_t *driver) } } - free(children, M_TEMP); + kfree(children, M_TEMP); } static int @@ -949,7 +949,7 @@ isa_add_config(device_t dev, device_t child, struct isa_device* idev = DEVTOISA(child); struct isa_config_entry *newice, *ice; - newice = malloc(sizeof *ice, M_DEVBUF, M_WAITOK); + newice = kmalloc(sizeof *ice, M_DEVBUF, M_WAITOK); newice->ice_priority = priority; newice->ice_config = *config; diff --git a/sys/bus/isa/pnp.c b/sys/bus/isa/pnp.c index 135649620d..9febff0963 100644 --- a/sys/bus/isa/pnp.c +++ b/sys/bus/isa/pnp.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/isa/pnp.c,v 1.5.2.1 2002/10/14 09:31:09 nyan Exp $ - * $DragonFly: src/sys/bus/isa/pnp.c,v 1.10 2006/08/03 16:40:46 swildner Exp $ + * $DragonFly: src/sys/bus/isa/pnp.c,v 1.11 2006/09/05 00:55:35 dillon Exp $ * from: pnp.c,v 1.11 1999/05/06 22:11:19 peter Exp */ @@ -527,7 +527,7 @@ pnp_create_devices(device_t parent, pnp_id *p, int csn, isa_set_vendorid(dev, p->vendor_id); isa_set_serial(dev, p->serial); isa_set_logicalid(dev, logical_id); - csnldn = malloc(sizeof *csnldn, M_DEVBUF, M_WAITOK); + csnldn = kmalloc(sizeof *csnldn, M_DEVBUF, M_WAITOK); csnldn->csn = csn; csnldn->ldn = ldn; ISA_SET_CONFIG_CALLBACK(parent, dev, @@ -577,16 +577,16 @@ pnp_read_bytes(int amount, u_char **resourcesp, int *spacep, int *lenp) if (space == 0) { space = 1024; - resources = malloc(space, M_TEMP, M_WAITOK); + resources = kmalloc(space, M_TEMP, M_WAITOK); } if (len + amount > space) { int extra = 1024; while (len + amount > space + extra) extra += 1024; - newres = malloc(space + extra, M_TEMP, M_WAITOK); + newres = kmalloc(space + extra, M_TEMP, M_WAITOK); bcopy(resources, newres, len); - free(resources, M_TEMP); + kfree(resources, M_TEMP); resources = newres; space += extra; } @@ -748,7 +748,7 @@ pnp_isolation_protocol(device_t parent) * Cleanup. */ if (resources) - free(resources, M_TEMP); + kfree(resources, M_TEMP); return found; } diff --git a/sys/bus/isa/pnpparse.c b/sys/bus/isa/pnpparse.c index bf5cef4c1b..fd8176b55a 100644 --- a/sys/bus/isa/pnpparse.c +++ b/sys/bus/isa/pnpparse.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/isa/pnpparse.c,v 1.14 2003/06/11 00:32:45 obrien Exp $ - * $DragonFly: src/sys/bus/isa/pnpparse.c,v 1.6 2004/04/07 05:54:32 dillon Exp $ + * $DragonFly: src/sys/bus/isa/pnpparse.c,v 1.7 2006/09/05 00:55:35 dillon Exp $ */ #include @@ -546,7 +546,7 @@ pnp_parse_resources(device_t dev, u_char *resources, int len, int ldn) if (ncfgs == 1) { /* Single config without dependants */ ISA_ADD_CONFIG(parent, dev, priorities[0], &configs[0]); - free(configs, M_DEVBUF); + kfree(configs, M_DEVBUF); return; } @@ -560,7 +560,7 @@ pnp_parse_resources(device_t dev, u_char *resources, int len, int ldn) ISA_ADD_CONFIG(parent, dev, priorities[i], &configs[i]); } - free(configs, M_DEVBUF); + kfree(configs, M_DEVBUF); } u_char * diff --git a/sys/bus/isa/vga_isa.c b/sys/bus/isa/vga_isa.c index 6378cee47a..2edf668555 100644 --- a/sys/bus/isa/vga_isa.c +++ b/sys/bus/isa/vga_isa.c @@ -24,7 +24,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/isa/vga_isa.c,v 1.17 2000/01/29 15:08:56 peter Exp $ - * $DragonFly: src/sys/bus/isa/vga_isa.c,v 1.10 2006/07/28 02:17:34 dillon Exp $ + * $DragonFly: src/sys/bus/isa/vga_isa.c,v 1.11 2006/09/05 00:55:35 dillon Exp $ */ #include "opt_vga.h" @@ -193,13 +193,13 @@ isavga_suspend(device_t dev) /* Save the video state across the suspend. */ if (sc->state_buf != NULL) { - free(sc->state_buf, M_TEMP); + kfree(sc->state_buf, M_TEMP); sc->state_buf = NULL; } nbytes = (*vidsw[sc->adp->va_index]->save_state)(sc->adp, NULL, 0); if (nbytes <= 0) return (0); - sc->state_buf = malloc(nbytes, M_TEMP, M_NOWAIT | M_ZERO); + sc->state_buf = kmalloc(nbytes, M_TEMP, M_NOWAIT | M_ZERO); if (sc->state_buf == NULL) return (0); if (bootverbose) @@ -208,7 +208,7 @@ isavga_suspend(device_t dev) nbytes) != 0) { device_printf(dev, "failed to save state (nbytes=%d)\n", nbytes); - free(sc->state_buf, M_TEMP); + kfree(sc->state_buf, M_TEMP); sc->state_buf = NULL; } return (0); @@ -224,7 +224,7 @@ isavga_resume(device_t dev) if ((*vidsw[sc->adp->va_index]->load_state)(sc->adp, sc->state_buf) != 0) device_printf(dev, "failed to reload state\n"); - free(sc->state_buf, M_TEMP); + kfree(sc->state_buf, M_TEMP); sc->state_buf = NULL; } diff --git a/sys/bus/pccard/pccard.c b/sys/bus/pccard/pccard.c index f40f54412d..cf3e90fe86 100644 --- a/sys/bus/pccard/pccard.c +++ b/sys/bus/pccard/pccard.c @@ -1,6 +1,6 @@ /* $NetBSD: pcmcia.c,v 1.23 2000/07/28 19:17:02 drochner Exp $ */ /* $FreeBSD: src/sys/dev/pccard/pccard.c,v 1.70 2002/11/14 14:02:32 mux Exp $ */ -/* $DragonFly: src/sys/bus/pccard/pccard.c,v 1.15 2005/12/19 01:18:57 dillon Exp $ */ +/* $DragonFly: src/sys/bus/pccard/pccard.c,v 1.16 2006/09/05 00:55:36 dillon Exp $ */ /* * Copyright (c) 1997 Marc Horowitz. All rights reserved. @@ -224,7 +224,7 @@ pccard_attach_card(device_t dev) * are combination cards, but only one of these units * can be on at a time. */ - ivar = malloc(sizeof(struct pccard_ivar), M_DEVBUF, + ivar = kmalloc(sizeof(struct pccard_ivar), M_DEVBUF, M_INTWAIT | M_ZERO); child = device_add_child(dev, NULL, -1); device_set_ivars(child, ivar); @@ -286,10 +286,10 @@ pccard_detach_card(device_t dev) while (NULL != (pf = STAILQ_FIRST(&sc->card.pf_head))) { while (NULL != (cfe = STAILQ_FIRST(&pf->cfe_head))) { STAILQ_REMOVE_HEAD(&pf->cfe_head, cfe_list); - free(cfe, M_DEVBUF); + kfree(cfe, M_DEVBUF); } STAILQ_REMOVE_HEAD(&sc->card.pf_head, pf_list); - free(pf, M_DEVBUF); + kfree(pf, M_DEVBUF); } return (0); } diff --git a/sys/bus/pccard/pccard_cis.c b/sys/bus/pccard/pccard_cis.c index 4dff42675e..1dbdf12991 100644 --- a/sys/bus/pccard/pccard_cis.c +++ b/sys/bus/pccard/pccard_cis.c @@ -1,6 +1,6 @@ /* $NetBSD: pcmcia_cis.c,v 1.17 2000/02/10 09:01:52 chopps Exp $ */ /* $FreeBSD: src/sys/dev/pccard/pccard_cis.c,v 1.23 2002/11/14 14:02:32 mux Exp $ */ -/* $DragonFly: src/sys/bus/pccard/pccard_cis.c,v 1.3 2004/06/28 02:34:44 dillon Exp $ */ +/* $DragonFly: src/sys/bus/pccard/pccard_cis.c,v 1.4 2006/09/05 00:55:36 dillon Exp $ */ /* * Copyright (c) 1997 Marc Horowitz. All rights reserved. @@ -641,7 +641,7 @@ pccard_parse_cis_tuple(struct pccard_tuple *tuple, void *arg) for (pf = STAILQ_FIRST(&state->card->pf_head); pf != NULL; pf = pfnext) { pfnext = STAILQ_NEXT(pf, pf_list); - free(pf, M_DEVBUF); + kfree(pf, M_DEVBUF); } STAILQ_INIT(&state->card->pf_head); @@ -791,7 +791,7 @@ pccard_parse_cis_tuple(struct pccard_tuple *tuple, void *arg) break; } if ((state->pf == NULL) || (state->gotmfc == 2)) { - state->pf = malloc(sizeof(*state->pf), M_DEVBUF, + state->pf = kmalloc(sizeof(*state->pf), M_DEVBUF, M_INTWAIT | M_ZERO); state->pf->number = state->count++; state->pf->last_config_index = -1; @@ -910,7 +910,7 @@ pccard_parse_cis_tuple(struct pccard_tuple *tuple, void *arg) * with the current default */ if (num != state->default_cfe->number) { - cfe = malloc(sizeof(*cfe), M_DEVBUF, M_INTWAIT); + cfe = kmalloc(sizeof(*cfe), M_DEVBUF, M_INTWAIT); *cfe = *state->default_cfe; diff --git a/sys/bus/pccard/pccard_cis_quirks.c b/sys/bus/pccard/pccard_cis_quirks.c index 5c7c2baad3..dafb872ae4 100644 --- a/sys/bus/pccard/pccard_cis_quirks.c +++ b/sys/bus/pccard/pccard_cis_quirks.c @@ -1,6 +1,6 @@ /* $NetBSD: pcmcia_cis_quirks.c,v 1.6 2000/04/12 21:07:55 scw Exp $ */ /* $FreeBSD: src/sys/dev/pccard/pccard_cis_quirks.c,v 1.7 2002/02/09 21:34:06 imp Exp $ */ -/* $DragonFly: src/sys/bus/pccard/pccard_cis_quirks.c,v 1.3 2006/01/22 14:03:51 swildner Exp $ */ +/* $DragonFly: src/sys/bus/pccard/pccard_cis_quirks.c,v 1.4 2006/09/05 00:55:36 dillon Exp $ */ #define PCCARDDEBUG @@ -250,10 +250,10 @@ pccard_check_cis_quirks(device_t dev) for (cfe = STAILQ_FIRST(&pf->cfe_head); cfe != NULL; cfe = cfe_next) { cfe_next = STAILQ_NEXT(cfe, cfe_list); - free(cfe, M_DEVBUF); + kfree(cfe, M_DEVBUF); } pf_next = STAILQ_NEXT(pf, pf_list); - free(pf, M_DEVBUF); + kfree(pf, M_DEVBUF); } STAILQ_INIT(&sc->card.pf_head); @@ -261,16 +261,16 @@ pccard_check_cis_quirks(device_t dev) } if (pf_last == pccard_cis_quirks[i].pf) { - cfe = malloc(sizeof(*cfe), M_DEVBUF, M_INTWAIT); + cfe = kmalloc(sizeof(*cfe), M_DEVBUF, M_INTWAIT); *cfe = *pccard_cis_quirks[i].cfe; STAILQ_INSERT_TAIL(&pf->cfe_head, cfe, cfe_list); } else { - pf = malloc(sizeof(*pf), M_DEVBUF, M_INTWAIT); + pf = kmalloc(sizeof(*pf), M_DEVBUF, M_INTWAIT); *pf = *pccard_cis_quirks[i].pf; STAILQ_INIT(&pf->cfe_head); - cfe = malloc(sizeof(*cfe), M_DEVBUF, M_INTWAIT); + cfe = kmalloc(sizeof(*cfe), M_DEVBUF, M_INTWAIT); *cfe = *pccard_cis_quirks[i].cfe; STAILQ_INSERT_TAIL(&pf->cfe_head, cfe, cfe_list); diff --git a/sys/bus/pci/i386/pci_cfgreg.c b/sys/bus/pci/i386/pci_cfgreg.c index b8bb7885f2..6e24ab8874 100644 --- a/sys/bus/pci/i386/pci_cfgreg.c +++ b/sys/bus/pci/i386/pci_cfgreg.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/i386/isa/pci_cfgreg.c,v 1.1.2.7 2001/11/28 05:47:03 imp Exp $ - * $DragonFly: src/sys/bus/pci/i386/pci_cfgreg.c,v 1.11 2005/11/04 08:57:23 dillon Exp $ + * $DragonFly: src/sys/bus/pci/i386/pci_cfgreg.c,v 1.12 2006/09/05 00:55:36 dillon Exp $ * */ @@ -495,10 +495,10 @@ pci_cfgintr_search(struct PIR_entry *pe, int bus, int device, int matchpin, int } } if (pci_children != NULL) - free(pci_children, M_TEMP); + kfree(pci_children, M_TEMP); } if (pci_devices != NULL) - free(pci_devices, M_TEMP); + kfree(pci_devices, M_TEMP); return (irq); } diff --git a/sys/bus/pci/i386/pcibus.c b/sys/bus/pci/i386/pcibus.c index 8a9ecf0799..21f1e578ef 100644 --- a/sys/bus/pci/i386/pcibus.c +++ b/sys/bus/pci/i386/pcibus.c @@ -24,7 +24,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/i386/isa/pcibus.c,v 1.57.2.12 2003/08/07 06:19:26 imp Exp $ - * $DragonFly: src/sys/bus/pci/i386/pcibus.c,v 1.14 2005/10/30 04:41:12 dillon Exp $ + * $DragonFly: src/sys/bus/pci/i386/pcibus.c,v 1.15 2006/09/05 00:55:36 dillon Exp $ * */ @@ -371,7 +371,7 @@ nexus_legacypci_probe(device_t dev) if (nexus_get_pcibus(devs[i]) == busnum) s = NULL; } - free(devs, M_TEMP); + kfree(devs, M_TEMP); } if (s == NULL) diff --git a/sys/bus/pci/pci.c b/sys/bus/pci/pci.c index a78336cd99..c62641b5d9 100644 --- a/sys/bus/pci/pci.c +++ b/sys/bus/pci/pci.c @@ -24,7 +24,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/pci/pci.c,v 1.141.2.15 2002/04/30 17:48:18 tmm Exp $ - * $DragonFly: src/sys/bus/pci/pci.c,v 1.31 2006/08/25 22:37:08 swildner Exp $ + * $DragonFly: src/sys/bus/pci/pci.c,v 1.32 2006/09/05 00:55:36 dillon Exp $ * */ @@ -221,7 +221,7 @@ pci_readppb(device_t pcib, int b, int s, int f) { pcih1cfgregs *p; - p = malloc(sizeof (pcih1cfgregs), M_DEVBUF, M_WAITOK | M_ZERO); + p = kmalloc(sizeof (pcih1cfgregs), M_DEVBUF, M_WAITOK | M_ZERO); if (p == NULL) return (NULL); @@ -265,7 +265,7 @@ pci_readpcb(device_t pcib, int b, int s, int f) { pcih2cfgregs *p; - p = malloc(sizeof (pcih2cfgregs), M_DEVBUF, M_WAITOK | M_ZERO); + p = kmalloc(sizeof (pcih2cfgregs), M_DEVBUF, M_WAITOK | M_ZERO); if (p == NULL) return (NULL); @@ -337,7 +337,7 @@ pci_read_device(device_t pcib, int b, int s, int f, size_t size) if (PCIB_READ_CONFIG(pcib, b, s, f, PCIR_DEVVENDOR, 4) != -1) { - devlist_entry = malloc(size, M_DEVBUF, M_WAITOK | M_ZERO); + devlist_entry = kmalloc(size, M_DEVBUF, M_WAITOK | M_ZERO); if (devlist_entry == NULL) return (NULL); @@ -488,10 +488,10 @@ pci_freecfg(struct pci_devinfo *dinfo) devlist_head = &pci_devq; if (dinfo->cfg.hdrspec != NULL) - free(dinfo->cfg.hdrspec, M_DEVBUF); + kfree(dinfo->cfg.hdrspec, M_DEVBUF); /* XXX this hasn't been tested */ STAILQ_REMOVE(devlist_head, dinfo, pci_devinfo, pci_links); - free(dinfo, M_DEVBUF); + kfree(dinfo, M_DEVBUF); /* increment the generation count */ pci_generation++; @@ -946,7 +946,7 @@ pci_ioctl(struct dev_ioctl_args *ap) /* * Allocate a buffer to hold the patterns. */ - pattern_buf = malloc(cio->pat_buf_len, M_TEMP, + pattern_buf = kmalloc(cio->pat_buf_len, M_TEMP, M_WAITOK); error = copyin(cio->patterns, pattern_buf, cio->pat_buf_len); @@ -1050,7 +1050,7 @@ pci_ioctl(struct dev_ioctl_args *ap) cio->status = PCI_GETCONF_MORE_DEVS; if (pattern_buf != NULL) - free(pattern_buf, M_TEMP); + kfree(pattern_buf, M_TEMP); break; } @@ -1888,7 +1888,7 @@ pci_resume(device_t dev) } } - free(children, M_TEMP); + kfree(children, M_TEMP); return (bus_generic_resume(dev)); } diff --git a/sys/bus/pci/pci_compat.c b/sys/bus/pci/pci_compat.c index 045d3103b6..ea1ebab7ca 100644 --- a/sys/bus/pci/pci_compat.c +++ b/sys/bus/pci/pci_compat.c @@ -24,7 +24,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/pci/pci_compat.c,v 1.35.2.1 2001/10/14 21:14:14 luigi Exp $ - * $DragonFly: src/sys/bus/pci/pci_compat.c,v 1.10 2005/11/04 08:57:22 dillon Exp $ + * $DragonFly: src/sys/bus/pci/pci_compat.c,v 1.11 2006/09/05 00:55:36 dillon Exp $ * */ @@ -297,7 +297,7 @@ compat_pci_handler(module_t mod, int type, void *data) switch (type) { case MOD_LOAD: - driver = malloc(sizeof(struct pci_compat_driver), M_DEVBUF, M_WAITOK | M_ZERO); + driver = kmalloc(sizeof(struct pci_compat_driver), M_DEVBUF, M_WAITOK | M_ZERO); driver->driver.name = dvp->pd_name; driver->driver.methods = pci_compat_methods; driver->driver.size = sizeof(struct pci_devinfo *); diff --git a/sys/bus/pci/pcisupport.c b/sys/bus/pci/pcisupport.c index d335f4d028..d71f7ead9d 100644 --- a/sys/bus/pci/pcisupport.c +++ b/sys/bus/pci/pcisupport.c @@ -1,7 +1,7 @@ /************************************************************************** ** ** $FreeBSD: src/sys/pci/pcisupport.c,v 1.154.2.15 2003/04/29 15:55:06 simokawa Exp $ -** $DragonFly: src/sys/bus/pci/pcisupport.c,v 1.16 2006/01/22 14:03:51 swildner Exp $ +** $DragonFly: src/sys/bus/pci/pcisupport.c,v 1.17 2006/09/05 00:55:36 dillon Exp $ ** ** Device driver for DEC/INTEL PCI chipsets. ** @@ -130,7 +130,7 @@ pci_bridge_type(device_t dev) snprintf(tmpbuf+strlen(tmpbuf), sizeof(tmpbuf)-strlen(tmpbuf), " bridge (vendor=%04x device=%04x)", pci_get_vendor(dev), pci_get_device(dev)); - descr = malloc (strlen(tmpbuf) +1, M_DEVBUF, M_WAITOK); + descr = kmalloc (strlen(tmpbuf) +1, M_DEVBUF, M_WAITOK); strcpy(descr, tmpbuf); return descr; } diff --git a/sys/bus/ppbus/ppbconf.c b/sys/bus/ppbus/ppbconf.c index a8383ea7b8..14e6c5755c 100644 --- a/sys/bus/ppbus/ppbconf.c +++ b/sys/bus/ppbus/ppbconf.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ppbus/ppbconf.c,v 1.17.2.1 2000/05/24 00:20:57 n_hibma Exp $ - * $DragonFly: src/sys/bus/ppbus/ppbconf.c,v 1.9 2005/10/30 04:41:14 dillon Exp $ + * $DragonFly: src/sys/bus/ppbus/ppbconf.c,v 1.10 2006/09/05 00:55:36 dillon Exp $ * */ #include "opt_ppb_1284.h" @@ -88,7 +88,7 @@ ppbus_add_child(device_t bus, device_t parent, int order, const char *name, int device_t child; /* allocate ivars for the new ppbus child */ - ppbdev = malloc(sizeof(struct ppb_device), M_PPBUSDEV, M_WAITOK | M_ZERO); + ppbdev = kmalloc(sizeof(struct ppb_device), M_PPBUSDEV, M_WAITOK | M_ZERO); /* initialize the ivars */ ppbdev->name = name; diff --git a/sys/bus/usb/ehci.c b/sys/bus/usb/ehci.c index 0e25c24980..5788dd4152 100644 --- a/sys/bus/usb/ehci.c +++ b/sys/bus/usb/ehci.c @@ -1,7 +1,7 @@ /* * $NetBSD: ehci.c,v 1.67 2004/07/06 04:18:05 mycroft Exp $ * $FreeBSD: src/sys/dev/usb/ehci.c,v 1.5 2003/11/10 00:20:52 joe Exp $ - * $DragonFly: src/sys/bus/usb/ehci.c,v 1.23 2006/08/03 16:40:46 swildner Exp $ + * $DragonFly: src/sys/bus/usb/ehci.c,v 1.24 2006/09/05 00:55:36 dillon Exp $ */ /* @@ -1049,7 +1049,7 @@ ehci_allocx(struct usbd_bus *bus) } #endif } else { - xfer = malloc(sizeof(struct ehci_xfer), M_USB, M_INTWAIT); + xfer = kmalloc(sizeof(struct ehci_xfer), M_USB, M_INTWAIT); } if (xfer != NULL) { memset(xfer, 0, sizeof(struct ehci_xfer)); diff --git a/sys/bus/usb/hid.c b/sys/bus/usb/hid.c index 3e53b42c4a..027d5942db 100644 --- a/sys/bus/usb/hid.c +++ b/sys/bus/usb/hid.c @@ -1,7 +1,7 @@ /* * $NetBSD: hid.c,v 1.17 2001/11/13 06:24:53 lukem Exp $ * $FreeBSD: src/sys/dev/usb/hid.c,v 1.23 2003/08/24 17:55:54 obrien Exp $ - * $DragonFly: src/sys/bus/usb/hid.c,v 1.7 2005/11/11 19:34:38 dillon Exp $ + * $DragonFly: src/sys/bus/usb/hid.c,v 1.8 2006/09/05 00:55:36 dillon Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -98,7 +98,7 @@ hid_start_parse(void *d, int len, int kindset) { struct hid_data *s; - s = malloc(sizeof *s, M_TEMP, M_INTWAIT|M_ZERO); + s = kmalloc(sizeof *s, M_TEMP, M_INTWAIT|M_ZERO); s->start = s->p = d; s->end = (char *)d + len; s->kindset = kindset; @@ -111,10 +111,10 @@ hid_end_parse(struct hid_data *s) while (s->cur.next != NULL) { struct hid_item *hi = s->cur.next->next; - free(s->cur.next, M_TEMP); + kfree(s->cur.next, M_TEMP); s->cur.next = hi; } - free(s, M_TEMP); + kfree(s, M_TEMP); } int @@ -290,7 +290,7 @@ hid_get_item(struct hid_data *s, struct hid_item *h) c->loc.count = dval; break; case 10: /* Push */ - hi = malloc(sizeof *hi, M_TEMP, M_INTWAIT); + hi = kmalloc(sizeof *hi, M_TEMP, M_INTWAIT); *hi = s->cur; c->next = hi; break; @@ -299,7 +299,7 @@ hid_get_item(struct hid_data *s, struct hid_item *h) oldpos = c->loc.pos; s->cur = *hi; c->loc.pos = oldpos; - free(hi, M_TEMP); + kfree(hi, M_TEMP); break; default: printf("Global bTag=%d\n", bTag); diff --git a/sys/bus/usb/ohci.c b/sys/bus/usb/ohci.c index df7ec460db..2b25c26aa8 100644 --- a/sys/bus/usb/ohci.c +++ b/sys/bus/usb/ohci.c @@ -1,7 +1,7 @@ /* * $NetBSD: ohci.c,v 1.138 2003/02/08 03:32:50 ichiro Exp $ * $FreeBSD: src/sys/dev/usb/ohci.c,v 1.141 2003/12/22 15:40:10 shiba Exp $ - * $DragonFly: src/sys/bus/usb/ohci.c,v 1.14 2006/05/03 15:08:41 dillon Exp $ + * $DragonFly: src/sys/bus/usb/ohci.c,v 1.15 2006/09/05 00:55:36 dillon Exp $ */ /* Also, already ported: * $NetBSD: ohci.c,v 1.140 2003/05/13 04:42:00 gson Exp $ @@ -986,7 +986,7 @@ ohci_allocx(struct usbd_bus *bus) } #endif } else { - xfer = malloc(sizeof(struct ohci_xfer), M_USB, M_INTWAIT); + xfer = kmalloc(sizeof(struct ohci_xfer), M_USB, M_INTWAIT); } if (xfer != NULL) { memset(xfer, 0, sizeof (struct ohci_xfer)); diff --git a/sys/bus/usb/uhci.c b/sys/bus/usb/uhci.c index 3bcebc7500..7b2bdf8653 100644 --- a/sys/bus/usb/uhci.c +++ b/sys/bus/usb/uhci.c @@ -2,7 +2,7 @@ * $NetBSD: uhci.c,v 1.80 2000/01/19 01:16:38 augustss Exp $ * $NetBSD: uhci.c,v 1.170 2003/02/19 01:35:04 augustss Exp $ * $FreeBSD: src/sys/dev/usb/uhci.c,v 1.149 2003/11/10 00:08:41 joe Exp $ - * $DragonFly: src/sys/bus/usb/uhci.c,v 1.14 2006/07/18 02:03:11 dillon Exp $ + * $DragonFly: src/sys/bus/usb/uhci.c,v 1.15 2006/09/05 00:55:36 dillon Exp $ */ /* Also already incorporated from NetBSD: @@ -598,7 +598,7 @@ uhci_detach(struct uhci_softc *sc, int flags) if (xfer == NULL) break; SIMPLEQ_REMOVE_HEAD(&sc->sc_free_xfers, next); - free(xfer, M_USB); + kfree(xfer, M_USB); } /* XXX free other data structures XXX */ @@ -635,7 +635,7 @@ uhci_allocx(struct usbd_bus *bus) } #endif } else { - xfer = malloc(sizeof(struct uhci_xfer), M_USB, M_INTWAIT); + xfer = kmalloc(sizeof(struct uhci_xfer), M_USB, M_INTWAIT); } if (xfer != NULL) { memset(xfer, 0, sizeof (struct uhci_xfer)); @@ -2173,7 +2173,7 @@ uhci_device_intr_close(usbd_pipe_handle pipe) for(i = 0; i < npoll; i++) uhci_free_sqh(sc, upipe->u.intr.qhs[i]); - free(upipe->u.intr.qhs, M_USBHC); + kfree(upipe->u.intr.qhs, M_USBHC); /* XXX free other resources */ } @@ -2539,7 +2539,7 @@ uhci_device_isoc_close(usbd_pipe_handle pipe) } crit_exit(); - free(iso->stds, M_USBHC); + kfree(iso->stds, M_USBHC); } usbd_status @@ -2593,7 +2593,7 @@ uhci_setup_isoc(usbd_pipe_handle pipe) bad: while (--i >= 0) uhci_free_std(sc, iso->stds[i]); - free(iso->stds, M_USBHC); + kfree(iso->stds, M_USBHC); return (USBD_NOMEM); } @@ -2818,7 +2818,7 @@ uhci_device_setintr(uhci_softc_t *sc, struct uhci_pipe *upipe, int ival) upipe->u.intr.npoll = npoll; upipe->u.intr.qhs = - malloc(npoll * sizeof(uhci_soft_qh_t *), M_USBHC, M_INTWAIT); + kmalloc(npoll * sizeof(uhci_soft_qh_t *), M_USBHC, M_INTWAIT); /* * Figure out which offset in the schedule that has most diff --git a/sys/bus/usb/uhub.c b/sys/bus/usb/uhub.c index db59a6b2cf..f89a07b54c 100644 --- a/sys/bus/usb/uhub.c +++ b/sys/bus/usb/uhub.c @@ -1,7 +1,7 @@ /* * $NetBSD: uhub.c,v 1.64 2003/02/08 03:32:51 ichiro Exp $ * $FreeBSD: src/sys/dev/usb/uhub.c,v 1.54 2003/08/24 17:55:55 obrien Exp $ - * $DragonFly: src/sys/bus/usb/uhub.c,v 1.6 2004/03/12 03:43:06 dillon Exp $ + * $DragonFly: src/sys/bus/usb/uhub.c,v 1.7 2006/09/05 00:55:36 dillon Exp $ */ /* @@ -167,7 +167,7 @@ USB_ATTACH(uhub) usbd_interface_handle iface; usb_endpoint_descriptor_t *ed; - devinfo = malloc(1024, M_TEMP, M_WAITOK); + devinfo = kmalloc(1024, M_TEMP, M_WAITOK); DPRINTFN(1,("uhub_attach\n")); sc->sc_hub = dev; usbd_devinfo(dev, 1, devinfo); @@ -178,14 +178,14 @@ USB_ATTACH(uhub) if (err) { DPRINTF(("%s: configuration failed, error=%s\n", USBDEVNAME(sc->sc_dev), usbd_errstr(err))); - free(devinfo, M_TEMP); + kfree(devinfo, M_TEMP); USB_ATTACH_ERROR_RETURN; } if (dev->depth > USB_HUB_MAX_DEPTH) { printf("%s: hub depth (%d) exceeded, hub ignored\n", USBDEVNAME(sc->sc_dev), USB_HUB_MAX_DEPTH); - free(devinfo, M_TEMP); + kfree(devinfo, M_TEMP); USB_ATTACH_ERROR_RETURN; } @@ -205,7 +205,7 @@ USB_ATTACH(uhub) if (err) { DPRINTF(("%s: getting hub descriptor failed, error=%s\n", USBDEVNAME(sc->sc_dev), usbd_errstr(err))); - free(devinfo, M_TEMP); + kfree(devinfo, M_TEMP); USB_ATTACH_ERROR_RETURN; } @@ -327,8 +327,8 @@ USB_ATTACH(uhub) USB_ATTACH_SUCCESS_RETURN; bad: - free(hub, M_USBDEV); - free(devinfo, M_TEMP); + kfree(hub, M_USBDEV); + kfree(devinfo, M_TEMP); dev->hub = 0; USB_ATTACH_ERROR_RETURN; } @@ -562,7 +562,7 @@ USB_DETACH(uhub) usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_hub, USBDEV(sc->sc_dev)); - free(hub, M_USBDEV); + kfree(hub, M_USBDEV); sc->sc_hub->hub = NULL; return (0); diff --git a/sys/bus/usb/usb.c b/sys/bus/usb/usb.c index 789f6756fc..8634fe17c8 100644 --- a/sys/bus/usb/usb.c +++ b/sys/bus/usb/usb.c @@ -1,7 +1,7 @@ /* * $NetBSD: usb.c,v 1.68 2002/02/20 20:30:12 christos Exp $ * $FreeBSD: src/sys/dev/usb/usb.c,v 1.95 2003/11/09 23:54:21 joe Exp $ - * $DragonFly: src/sys/bus/usb/usb.c,v 1.19 2006/09/03 18:29:14 dillon Exp $ + * $DragonFly: src/sys/bus/usb/usb.c,v 1.20 2006/09/05 00:55:36 dillon Exp $ */ /* Also already merged from NetBSD: @@ -603,7 +603,7 @@ usbioctl(struct dev_ioctl_args *ap) ur->ucr_request.bmRequestType & UT_READ ? UIO_READ : UIO_WRITE; uio.uio_td = curthread; - ptr = malloc(len, M_TEMP, M_WAITOK); + ptr = kmalloc(len, M_TEMP, M_WAITOK); if (uio.uio_rw == UIO_WRITE) { error = uiomove(ptr, len, &uio); if (error) @@ -626,7 +626,7 @@ usbioctl(struct dev_ioctl_args *ap) } ret: if (ptr) - free(ptr, M_TEMP); + kfree(ptr, M_TEMP); return (error); } @@ -741,7 +741,7 @@ usb_get_next_event(struct usb_event *ue) #endif *ue = ueq->ue; TAILQ_REMOVE(&usb_events, ueq, next); - free(ueq, M_USBDEV); + kfree(ueq, M_USBDEV); usb_nevents--; return (1); } @@ -773,7 +773,7 @@ usb_add_event(int type, struct usb_event *uep) struct usb_event ue; struct timeval thetime; - ueq = malloc(sizeof *ueq, M_USBDEV, M_INTWAIT); + ueq = kmalloc(sizeof *ueq, M_USBDEV, M_INTWAIT); ueq->ue = *uep; ueq->ue.ue_type = type; microtime(&thetime); @@ -788,7 +788,7 @@ usb_add_event(int type, struct usb_event *uep) if (ueqi->ue.u.ue_driver.ue_cookie.cookie == uep->u.ue_device.udi_cookie.cookie) { TAILQ_REMOVE(&usb_events, ueqi, next); - free(ueqi, M_USBDEV); + kfree(ueqi, M_USBDEV); usb_nevents--; ueqi_next = TAILQ_FIRST(&usb_events); } diff --git a/sys/bus/usb/usb_mem.c b/sys/bus/usb/usb_mem.c index 9573dac7ff..8c18b97646 100644 --- a/sys/bus/usb/usb_mem.c +++ b/sys/bus/usb/usb_mem.c @@ -1,7 +1,7 @@ /* * $NetBSD: usb_mem.c,v 1.26 2003/02/01 06:23:40 thorpej Exp $ * $FreeBSD: src/sys/dev/usb/usb_mem.c,v 1.5 2003/10/04 22:13:21 joe Exp $ - * $DragonFly: src/sys/bus/usb/usb_mem.c,v 1.6 2005/07/18 14:50:55 dillon Exp $ + * $DragonFly: src/sys/bus/usb/usb_mem.c,v 1.7 2006/09/05 00:55:36 dillon Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -167,7 +167,7 @@ usb_block_allocmem(bus_dma_tag_t tag, size_t size, size_t align, crit_exit(); DPRINTFN(6, ("usb_block_allocmem: no free\n")); - p = malloc(sizeof *p, M_USB, M_INTWAIT); + p = kmalloc(sizeof *p, M_USB, M_INTWAIT); logmemory(blkalloc, p, NULL, size, align); #if defined(__FreeBSD__) && __FreeBSD_version >= 500000 @@ -209,7 +209,7 @@ memfree: tagfree: bus_dma_tag_destroy(p->tag); free: - free(p, M_USB); + kfree(p, M_USB); return (USBD_NOMEM); } diff --git a/sys/bus/usb/usb_subr.c b/sys/bus/usb/usb_subr.c index c2ee22e832..1e10d29c3c 100644 --- a/sys/bus/usb/usb_subr.c +++ b/sys/bus/usb/usb_subr.c @@ -1,7 +1,7 @@ /* * $NetBSD: usb_subr.c,v 1.99 2002/07/11 21:14:34 augustss Exp $ * $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.58 2003/09/01 07:47:42 ticso Exp $ - * $DragonFly: src/sys/bus/usb/usb_subr.c,v 1.11 2006/01/22 14:03:51 swildner Exp $ + * $DragonFly: src/sys/bus/usb/usb_subr.c,v 1.12 2006/09/05 00:55:36 dillon Exp $ */ /* Also already have from NetBSD: @@ -528,7 +528,7 @@ usbd_fill_iface_data(usbd_device_handle dev, int ifaceidx, int altidx) bad: if (ifc->endpoints != NULL) { - free(ifc->endpoints, M_USB); + kfree(ifc->endpoints, M_USB); ifc->endpoints = NULL; } return (USBD_INVAL); @@ -539,7 +539,7 @@ usbd_free_iface_data(usbd_device_handle dev, int ifcno) { usbd_interface_handle ifc = &dev->ifaces[ifcno]; if (ifc->endpoints) - free(ifc->endpoints, M_USB); + kfree(ifc->endpoints, M_USB); } Static usbd_status @@ -594,8 +594,8 @@ usbd_set_config_index(usbd_device_handle dev, int index, int msg) nifc = dev->cdesc->bNumInterface; for (ifcidx = 0; ifcidx < nifc; ifcidx++) usbd_free_iface_data(dev, ifcidx); - free(dev->ifaces, M_USB); - free(dev->cdesc, M_USB); + kfree(dev->ifaces, M_USB); + kfree(dev->cdesc, M_USB); dev->ifaces = NULL; dev->cdesc = NULL; dev->config = USB_UNCONFIG_NO; @@ -616,7 +616,7 @@ usbd_set_config_index(usbd_device_handle dev, int index, int msg) if (err) return (err); len = UGETW(cd.wTotalLength); - cdp = malloc(len, M_USB, M_INTWAIT); + cdp = kmalloc(len, M_USB, M_INTWAIT); /* Get the full descriptor. */ err = usbd_get_desc(dev, UDESC_CONFIG, index, len, cdp); if (err) @@ -727,7 +727,7 @@ usbd_set_config_index(usbd_device_handle dev, int index, int msg) return (USBD_NORMAL_COMPLETION); bad: - free(cdp, M_USB); + kfree(cdp, M_USB); return (err); } @@ -742,7 +742,7 @@ usbd_setup_pipe(usbd_device_handle dev, usbd_interface_handle iface, DPRINTFN(1,("usbd_setup_pipe: dev=%p iface=%p ep=%p pipe=%p\n", dev, iface, ep, pipe)); - p = malloc(dev->bus->pipe_size, M_USB, M_INTWAIT); + p = kmalloc(dev->bus->pipe_size, M_USB, M_INTWAIT); p->device = dev; p->iface = iface; p->endpoint = ep; @@ -759,7 +759,7 @@ usbd_setup_pipe(usbd_device_handle dev, usbd_interface_handle iface, DPRINTFN(-1,("usbd_setup_pipe: endpoint=0x%x failed, error=" "%s\n", ep->edesc->bEndpointAddress, usbd_errstr(err))); - free(p, M_USB); + kfree(p, M_USB); return (err); } /* Clear any stall and make sure DATA0 toggle will be used next. */ @@ -776,7 +776,7 @@ usbd_kill_pipe(usbd_pipe_handle pipe) usbd_abort_pipe(pipe); pipe->methods->close(pipe); pipe->endpoint->refcnt--; - free(pipe, M_USB); + kfree(pipe, M_USB); } int @@ -833,7 +833,7 @@ usbd_probe_and_attach(device_ptr_t parent, usbd_device_handle dev, DPRINTF(("usbd_probe_and_attach: trying device specific drivers\n")); dv = USB_DO_ATTACH(dev, bdev, parent, &uaa, usbd_print, usbd_submatch); if (dv) { - dev->subdevs = malloc(2 * sizeof dv, M_USB, M_INTWAIT); + dev->subdevs = kmalloc(2 * sizeof dv, M_USB, M_INTWAIT); dev->subdevs[0] = dv; dev->subdevs[1] = 0; return (USBD_NORMAL_COMPLETION); @@ -869,7 +869,7 @@ usbd_probe_and_attach(device_ptr_t parent, usbd_device_handle dev, ifaces[i] = &dev->ifaces[i]; uaa.ifaces = ifaces; uaa.nifaces = nifaces; - dev->subdevs = malloc((nifaces+1) * sizeof dv, M_USB, M_INTWAIT); + dev->subdevs = kmalloc((nifaces+1) * sizeof dv, M_USB, M_INTWAIT); found = 0; for (i = 0; i < nifaces; i++) { @@ -904,7 +904,7 @@ usbd_probe_and_attach(device_ptr_t parent, usbd_device_handle dev, #endif return (USBD_NORMAL_COMPLETION); } - free(dev->subdevs, M_USB); + kfree(dev->subdevs, M_USB); dev->subdevs = 0; } /* No interfaces were attached in any of the configurations. */ @@ -921,7 +921,7 @@ usbd_probe_and_attach(device_ptr_t parent, usbd_device_handle dev, uaa.ifaceno = UHUB_UNK_INTERFACE; dv = USB_DO_ATTACH(dev, bdev, parent, &uaa, usbd_print, usbd_submatch); if (dv != NULL) { - dev->subdevs = malloc(2 * sizeof dv, M_USB, M_INTWAIT); + dev->subdevs = kmalloc(2 * sizeof dv, M_USB, M_INTWAIT); dev->subdevs[0] = dv; dev->subdevs[1] = 0; return (USBD_NORMAL_COMPLETION); @@ -967,7 +967,7 @@ usbd_new_device(device_ptr_t parent, usbd_bus_handle bus, int depth, return (USBD_NO_ADDR); } - dev = malloc(sizeof *dev, M_USB, M_INTWAIT | M_ZERO); + dev = kmalloc(sizeof *dev, M_USB, M_INTWAIT | M_ZERO); dev->bus = bus; /* Set up default endpoint handle. */ @@ -1129,7 +1129,7 @@ usbd_remove_device(usbd_device_handle dev, struct usbd_port *up) up->device = 0; dev->bus->devices[dev->address] = 0; - free(dev, M_USB); + kfree(dev, M_USB); } #if defined(__NetBSD__) || defined(__OpenBSD__) @@ -1299,13 +1299,13 @@ usb_free_device(usbd_device_handle dev) nifc = dev->cdesc->bNumInterface; for (ifcidx = 0; ifcidx < nifc; ifcidx++) usbd_free_iface_data(dev, ifcidx); - free(dev->ifaces, M_USB); + kfree(dev->ifaces, M_USB); } if (dev->cdesc != NULL) - free(dev->cdesc, M_USB); + kfree(dev->cdesc, M_USB); if (dev->subdevs != NULL) - free(dev->subdevs, M_USB); - free(dev, M_USB); + kfree(dev->subdevs, M_USB); + kfree(dev, M_USB); } /* @@ -1367,11 +1367,11 @@ usb_realloc(void *p, u_int size, int pool, int flags) { void *q; - q = malloc(size, pool, flags); + q = kmalloc(size, pool, flags); if (q == NULL) return (NULL); bcopy(p, q, size); - free(p, pool); + kfree(p, pool); return (q); } #endif diff --git a/sys/bus/usb/usbdi.c b/sys/bus/usb/usbdi.c index 50277f0415..cd1f80a683 100644 --- a/sys/bus/usb/usbdi.c +++ b/sys/bus/usb/usbdi.c @@ -1,7 +1,7 @@ /* * $NetBSD: usbdi.c,v 1.103 2002/09/27 15:37:38 provos Exp $ * $FreeBSD: src/sys/dev/usb/usbdi.c,v 1.84 2003/11/09 23:56:19 joe Exp $ - * $DragonFly: src/sys/bus/usb/usbdi.c,v 1.9 2005/06/02 20:40:40 dillon Exp $ + * $DragonFly: src/sys/bus/usb/usbdi.c,v 1.10 2006/09/05 00:55:36 dillon Exp $ */ /* @@ -275,7 +275,7 @@ usbd_close_pipe(usbd_pipe_handle pipe) pipe->methods->close(pipe); if (pipe->intrxfer != NULL) usbd_free_xfer(pipe->intrxfer); - free(pipe, M_USB); + kfree(pipe, M_USB); return (USBD_NORMAL_COMPLETION); } @@ -670,7 +670,7 @@ usbd_set_interface(usbd_interface_handle iface, int altidx) /* new setting works, we can free old endpoints */ if (endpoints != NULL) - free(endpoints, M_USB); + kfree(endpoints, M_USB); #ifdef DIAGNOSTIC if (iface->idesc == NULL) { diff --git a/sys/bus/usb/usbdi_util.c b/sys/bus/usb/usbdi_util.c index dc1b5c3870..5d527804c7 100644 --- a/sys/bus/usb/usbdi_util.c +++ b/sys/bus/usb/usbdi_util.c @@ -2,7 +2,7 @@ * $NetBSD: usbdi_util.c,v 1.24 1999/11/17 23:00:50 augustss Exp $ * $NetBSD: usbdi_util.c,v 1.36 2001/11/13 06:24:57 lukem Exp $ * $FreeBSD: src/sys/dev/usb/usbdi_util.c,v 1.31 2003/08/24 17:55:55 obrien Exp $ - * $DragonFly: src/sys/bus/usb/usbdi_util.c,v 1.8 2005/06/02 20:40:40 dillon Exp $ + * $DragonFly: src/sys/bus/usb/usbdi_util.c,v 1.9 2006/09/05 00:55:36 dillon Exp $ */ /* @@ -382,11 +382,11 @@ usbd_read_report_desc(usbd_interface_handle ifc, void **descp, int *sizep, if (hid == NULL) return (USBD_IOERROR); *sizep = UGETW(hid->descrs[0].wDescriptorLength); - *descp = malloc(*sizep, mem, M_INTWAIT); + *descp = kmalloc(*sizep, mem, M_INTWAIT); err = usbd_get_report_descriptor(dev, id->bInterfaceNumber, *sizep, *descp); if (err) { - free(*descp, mem); + kfree(*descp, mem); *descp = NULL; return (err); } diff --git a/sys/contrib/dev/ath/dragonfly/ah_osdep.c b/sys/contrib/dev/ath/dragonfly/ah_osdep.c index f421d13d25..94fedfd683 100644 --- a/sys/contrib/dev/ath/dragonfly/ah_osdep.c +++ b/sys/contrib/dev/ath/dragonfly/ah_osdep.c @@ -100,13 +100,13 @@ MALLOC_DEFINE(M_ATH_HAL, "ath_hal", "ath hal data"); void* ath_hal_malloc(size_t size) { - return malloc(size, M_ATH_HAL, M_NOWAIT | M_ZERO); + return kmalloc(size, M_ATH_HAL, M_NOWAIT | M_ZERO); } void ath_hal_free(void* p) { - return free(p, M_ATH_HAL); + return kfree(p, M_ATH_HAL); } void diff --git a/sys/contrib/dev/fla/fla.c b/sys/contrib/dev/fla/fla.c index 188b3746ca..fa22046bb6 100644 --- a/sys/contrib/dev/fla/fla.c +++ b/sys/contrib/dev/fla/fla.c @@ -7,7 +7,7 @@ * ---------------------------------------------------------------------------- * * $FreeBSD: src/sys/contrib/dev/fla/fla.c,v 1.16 1999/12/08 04:45:16 ken Exp $ - * $DragonFly: src/sys/contrib/dev/fla/Attic/fla.c,v 1.13 2006/07/28 02:17:35 dillon Exp $ + * $DragonFly: src/sys/contrib/dev/fla/Attic/fla.c,v 1.14 2006/09/05 00:55:36 dillon Exp $ * */ @@ -73,13 +73,13 @@ static struct dev_ops fla_ops = { void * doc2k_malloc(int bytes) { - return malloc(bytes, M_FLA, M_WAITOK); + return kmalloc(bytes, M_FLA, M_WAITOK); } void doc2k_free(void *ptr) { - free(ptr, M_FLA); + kfree(ptr, M_FLA); } void diff --git a/sys/contrib/dev/oltr/if_oltr.c b/sys/contrib/dev/oltr/if_oltr.c index 61aba18d3b..84ec8da5e9 100644 --- a/sys/contrib/dev/oltr/if_oltr.c +++ b/sys/contrib/dev/oltr/if_oltr.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/contrib/dev/oltr/if_oltr.c,v 1.11.2.5 2001/10/20 04:15:21 mdodd Exp $ - * $DragonFly: src/sys/contrib/dev/oltr/Attic/if_oltr.c,v 1.22 2005/11/30 13:35:24 sephe Exp $ + * $DragonFly: src/sys/contrib/dev/oltr/Attic/if_oltr.c,v 1.23 2006/09/05 00:55:36 dillon Exp $ */ #include @@ -331,7 +331,7 @@ oltr_pci_attach(device_t dev) scratch_size = TRlldAdapterSize(); if (bootverbose) device_printf(dev, "adapter memory block size %d bytes\n", scratch_size); - sc->TRlldAdapter = (TRlldAdapter_t)malloc(scratch_size, M_DEVBUF, M_NOWAIT); + sc->TRlldAdapter = (TRlldAdapter_t)kmalloc(scratch_size, M_DEVBUF, M_NOWAIT); if (sc->TRlldAdapter == NULL) { device_printf(dev, "couldn't allocate scratch buffer (%d bytes)\n", scratch_size); goto config_failed; @@ -342,18 +342,18 @@ oltr_pci_attach(device_t dev) */ for (i = 0; i < RING_BUFFER_LEN; i++) { sc->rx_ring[i].index = i; - sc->rx_ring[i].data = (char *)malloc(RX_BUFFER_LEN, M_DEVBUF, M_NOWAIT); + sc->rx_ring[i].data = (char *)kmalloc(RX_BUFFER_LEN, M_DEVBUF, M_NOWAIT); sc->rx_ring[i].address = vtophys(sc->rx_ring[i].data); sc->tx_ring[i].index = i; - sc->tx_ring[i].data = (char *)malloc(TX_BUFFER_LEN, M_DEVBUF, M_NOWAIT); + sc->tx_ring[i].data = (char *)kmalloc(TX_BUFFER_LEN, M_DEVBUF, M_NOWAIT); sc->tx_ring[i].address = vtophys(sc->tx_ring[i].data); if ((!sc->rx_ring[i].data) || (!sc->tx_ring[i].data)) { device_printf(dev, "unable to allocate ring buffers\n"); while (i > 0) { if (sc->rx_ring[i].data) - free(sc->rx_ring[i].data, M_DEVBUF); + kfree(sc->rx_ring[i].data, M_DEVBUF); if (sc->tx_ring[i].data) - free(sc->tx_ring[i].data, M_DEVBUF); + kfree(sc->tx_ring[i].data, M_DEVBUF); i--; } goto config_failed; @@ -450,12 +450,12 @@ oltr_pci_detach(device_t dev) /* Deallocate all dynamic memory regions */ for (i = 0; i < RING_BUFFER_LEN; i++) { - free(sc->rx_ring[i].data, M_DEVBUF); - free(sc->tx_ring[i].data, M_DEVBUF); + kfree(sc->rx_ring[i].data, M_DEVBUF); + kfree(sc->tx_ring[i].data, M_DEVBUF); } if (sc->work_memory) - free(sc->work_memory, M_DEVBUF); - free(sc->TRlldAdapter, M_DEVBUF); + kfree(sc->work_memory, M_DEVBUF); + kfree(sc->TRlldAdapter, M_DEVBUF); crit_exit(); @@ -537,7 +537,7 @@ oltr_pci_attach(pcici_t config_id, int unit) crit_enter(); - sc = malloc(sizeof(struct oltr_softc), M_DEVBUF, M_NOWAIT | M_ZERO); + sc = kmalloc(sizeof(struct oltr_softc), M_DEVBUF, M_NOWAIT | M_ZERO); if (sc == NULL) { printf("oltr%d: no memory for softc struct!\n", unit); goto config_failed; @@ -576,7 +576,7 @@ oltr_pci_attach(pcici_t config_id, int unit) scratch_size = TRlldAdapterSize(); if (bootverbose) printf("oltr%d: adapter memory block size %d bytes\n", unit, scratch_size); - sc->TRlldAdapter = (TRlldAdapter_t)malloc(scratch_size, M_DEVBUF, M_NOWAIT); + sc->TRlldAdapter = (TRlldAdapter_t)kmalloc(scratch_size, M_DEVBUF, M_NOWAIT); if (sc->TRlldAdapter == NULL) { printf("oltr%d: couldn't allocate scratch buffer (%d bytes)\n",unit, scratch_size); goto config_failed; @@ -587,18 +587,18 @@ oltr_pci_attach(pcici_t config_id, int unit) */ for (i = 0; i < RING_BUFFER_LEN; i++) { sc->rx_ring[i].index = i; - sc->rx_ring[i].data = (char *)malloc(RX_BUFFER_LEN, M_DEVBUF, M_NOWAIT); + sc->rx_ring[i].data = (char *)kmalloc(RX_BUFFER_LEN, M_DEVBUF, M_NOWAIT); sc->rx_ring[i].address = vtophys(sc->rx_ring[i].data); sc->tx_ring[i].index = i; - sc->tx_ring[i].data = (char *)malloc(TX_BUFFER_LEN, M_DEVBUF, M_NOWAIT); + sc->tx_ring[i].data = (char *)kmalloc(TX_BUFFER_LEN, M_DEVBUF, M_NOWAIT); sc->tx_ring[i].address = vtophys(sc->tx_ring[i].data); if ((!sc->rx_ring[i].data) || (!sc->tx_ring[i].data)) { printf("oltr%d: unable to allocate ring buffers\n", unit); while (i > 0) { if (sc->rx_ring[i].data) - free(sc->rx_ring[i].data, M_DEVBUF); + kfree(sc->rx_ring[i].data, M_DEVBUF); if (sc->tx_ring[i].data) - free(sc->tx_ring[i].data, M_DEVBUF); + kfree(sc->tx_ring[i].data, M_DEVBUF); i--; } goto config_failed; @@ -845,7 +845,7 @@ oltr_init(void * xsc) } if (work_size) { - if ((sc->work_memory = malloc(work_size, M_DEVBUF, M_NOWAIT)) == NULL) { + if ((sc->work_memory = kmalloc(work_size, M_DEVBUF, M_NOWAIT)) == NULL) { printf("oltr%d: failed to allocate work memory (%d octets).\n", sc->unit, work_size); } else { TRlldAddMemory(sc->TRlldAdapter, sc->work_memory, diff --git a/sys/dev/acpica5/Osd/OsdMemory.c b/sys/dev/acpica5/Osd/OsdMemory.c index 0e33e51904..3e2f5cbbe6 100644 --- a/sys/dev/acpica5/Osd/OsdMemory.c +++ b/sys/dev/acpica5/Osd/OsdMemory.c @@ -26,7 +26,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/acpica/Osd/OsdMemory.c,v 1.11 2004/04/14 03:39:08 njl Exp $ - * $DragonFly: src/sys/dev/acpica5/Osd/OsdMemory.c,v 1.3 2004/06/27 08:52:42 dillon Exp $ + * $DragonFly: src/sys/dev/acpica5/Osd/OsdMemory.c,v 1.4 2006/09/05 00:55:36 dillon Exp $ */ /* @@ -55,13 +55,13 @@ static acpi_memtrack_t acpi_mapbase; void * AcpiOsAllocate(ACPI_SIZE Size) { - return (malloc(Size, M_ACPICA, M_INTWAIT)); + return (kmalloc(Size, M_ACPICA, M_INTWAIT)); } void AcpiOsFree(void *Memory) { - free(Memory, M_ACPICA); + kfree(Memory, M_ACPICA); } ACPI_STATUS @@ -74,7 +74,7 @@ AcpiOsMapMemory(ACPI_PHYSICAL_ADDRESS PhysicalAddress, ACPI_SIZE Length, if (*LogicalAddress == NULL) return(AE_BAD_ADDRESS); else { - track = malloc(sizeof(struct acpi_memtrack), M_ACPICA, M_INTWAIT); + track = kmalloc(sizeof(struct acpi_memtrack), M_ACPICA, M_INTWAIT); track->next = acpi_mapbase; track->base = *LogicalAddress; track->size = Length; @@ -97,7 +97,7 @@ again: if (track->base == LogicalAddress && track->size == Length) { *ptrack = track->next; pmap_unmapdev((vm_offset_t)track->base, track->size); - free(track, M_ACPICA); + kfree(track, M_ACPICA); return; } /* @@ -112,7 +112,7 @@ again: " large! %p/%08x (actual was %p/%08x)\n", LogicalAddress, Length, track->base, track->size); - free(track, M_ACPICA); + kfree(track, M_ACPICA); goto again; } diff --git a/sys/dev/acpica5/Osd/OsdSchedule.c b/sys/dev/acpica5/Osd/OsdSchedule.c index 1deb9b2dd6..0bd51bb72e 100644 --- a/sys/dev/acpica5/Osd/OsdSchedule.c +++ b/sys/dev/acpica5/Osd/OsdSchedule.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/acpica/Osd/OsdSchedule.c,v 1.28 2004/05/06 02:18:58 njl Exp $ - * $DragonFly: src/sys/dev/acpica5/Osd/OsdSchedule.c,v 1.5 2005/03/12 14:33:40 y0netan1 Exp $ + * $DragonFly: src/sys/dev/acpica5/Osd/OsdSchedule.c,v 1.6 2006/09/05 00:55:36 dillon Exp $ */ /* @@ -140,7 +140,7 @@ AcpiOsQueueForExecution(UINT32 Priority, ACPI_OSD_EXEC_CALLBACK Function, } /* Note: Interrupt Context */ - at = malloc(sizeof(*at), M_ACPITASK, M_INTWAIT | M_ZERO); + at = kmalloc(sizeof(*at), M_ACPITASK, M_INTWAIT | M_ZERO); lwkt_initmsg(&at->at_msg, &acpi_afree_rport, 0, lwkt_cmd_op_none, lwkt_cmd_op_none); at->at_function = Function; @@ -156,7 +156,7 @@ AcpiOsQueueForExecution(UINT32 Priority, ACPI_OSD_EXEC_CALLBACK Function, static void acpi_autofree_reply(lwkt_port_t port, lwkt_msg_t msg) { - free(msg, M_ACPITASK); + kfree(msg, M_ACPITASK); } UINT64 diff --git a/sys/dev/acpica5/Osd/OsdSynch.c b/sys/dev/acpica5/Osd/OsdSynch.c index 3d9907af76..1fa1966e31 100644 --- a/sys/dev/acpica5/Osd/OsdSynch.c +++ b/sys/dev/acpica5/Osd/OsdSynch.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/acpica/Osd/OsdSynch.c,v 1.21 2004/05/05 20:07:52 njl Exp $ - * $DragonFly: src/sys/dev/acpica5/Osd/OsdSynch.c,v 1.7 2006/06/04 21:09:48 dillon Exp $ + * $DragonFly: src/sys/dev/acpica5/Osd/OsdSynch.c,v 1.8 2006/09/05 00:55:36 dillon Exp $ */ /* @@ -103,7 +103,7 @@ AcpiOsCreateSemaphore(UINT32 MaxUnits, UINT32 InitialUnits, if (InitialUnits > MaxUnits) return_ACPI_STATUS (AE_BAD_PARAMETER); - as = malloc(sizeof(*as), M_ACPISEM, M_INTWAIT | M_ZERO); + as = kmalloc(sizeof(*as), M_ACPISEM, M_INTWAIT | M_ZERO); #if __FreeBSD_version >= 500000 mtx_init(&as->as_mtx, "ACPI semaphore", NULL, MTX_DEF); @@ -136,7 +136,7 @@ AcpiOsDeleteSemaphore(ACPI_HANDLE Handle) #if __FreeBSD_version >= 500000 mtx_destroy(&as->as_mtx); #endif - free(as, M_ACPISEM); + kfree(as, M_ACPISEM); #endif /* !ACPI_NO_SEMAPHORES */ return_ACPI_STATUS (AE_OK); @@ -350,7 +350,7 @@ AcpiOsCreateLock(ACPI_HANDLE *OutHandle) if (OutHandle == NULL) return (AE_BAD_PARAMETER); - lock = malloc(sizeof(*lock), M_ACPISEM, M_INTWAIT|M_ZERO); + lock = kmalloc(sizeof(*lock), M_ACPISEM, M_INTWAIT|M_ZERO); lockinit(lock, "oslck", 0, 0); *OutHandle = (ACPI_HANDLE)lock; return (AE_OK); @@ -362,7 +362,7 @@ AcpiOsDeleteLock (ACPI_HANDLE Handle) struct lock *lock; if ((lock = (struct lock *)Handle) != NULL) - free(lock, M_ACPISEM); + kfree(lock, M_ACPISEM); } /* diff --git a/sys/dev/acpica5/acpi.c b/sys/dev/acpica5/acpi.c index 3c6f4514fd..b180867102 100644 --- a/sys/dev/acpica5/acpi.c +++ b/sys/dev/acpica5/acpi.c @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/acpica/acpi.c,v 1.157 2004/06/05 09:56:04 njl Exp $ - * $DragonFly: src/sys/dev/acpica5/acpi.c,v 1.21 2006/09/03 17:43:55 dillon Exp $ + * $DragonFly: src/sys/dev/acpica5/acpi.c,v 1.22 2006/09/05 00:55:36 dillon Exp $ */ #include "opt_acpi.h" @@ -671,13 +671,13 @@ acpi_quirks_set(void) (xsdt->OemRevision == quirk->OemRevision || quirk->OemRevision == ACPI_OEM_REV_ANY)) { len += strlen(quirk->value) + 2; - if ((tmp = malloc(len, M_TEMP, M_NOWAIT)) == NULL) + if ((tmp = kmalloc(len, M_TEMP, M_NOWAIT)) == NULL) goto out; sprintf(tmp, "%s %s", env ? env : "", quirk->value); #ifdef notyet setenv("debug.acpi.disabled", tmp); #endif /* notyet */ - free(tmp, M_TEMP); + kfree(tmp, M_TEMP); break; } } @@ -697,7 +697,7 @@ acpi_add_child(device_t bus, device_t parent, int order, struct acpi_device *ad; device_t child; - ad = malloc(sizeof(*ad), M_ACPIDEV, M_INTWAIT | M_ZERO); + ad = kmalloc(sizeof(*ad), M_ACPIDEV, M_INTWAIT | M_ZERO); resource_list_init(&ad->ad_rl); @@ -1437,7 +1437,7 @@ acpi_AllocBuffer(int size) { ACPI_BUFFER *buf; - buf = malloc(size + sizeof(*buf), M_ACPIDEV, M_INTWAIT); + buf = kmalloc(size + sizeof(*buf), M_ACPIDEV, M_INTWAIT); buf->Length = size; buf->Pointer = (void *)(buf + 1); return (buf); @@ -1998,7 +1998,7 @@ acpi_wake_sysctl_walk(device_t dev) } acpi_wake_sysctl_walk(child); } - free(devlist, M_TEMP); + kfree(devlist, M_TEMP); return (0); } @@ -2407,7 +2407,7 @@ acpi_register_ioctl(u_long cmd, acpi_ioctl_fn fn, void *arg) { struct acpi_ioctl_hook *hp; - hp = malloc(sizeof(*hp), M_ACPIDEV, M_INTWAIT); + hp = kmalloc(sizeof(*hp), M_ACPIDEV, M_INTWAIT); hp->cmd = cmd; hp->fn = fn; hp->arg = arg; @@ -2433,7 +2433,7 @@ acpi_deregister_ioctl(u_long cmd, acpi_ioctl_fn fn) if (hp != NULL) { TAILQ_REMOVE(&acpi_ioctl_hooks, hp, link); - free(hp, M_ACPIDEV); + kfree(hp, M_ACPIDEV); } } diff --git a/sys/dev/acpica5/acpi_battery.c b/sys/dev/acpica5/acpi_battery.c index 4423a2742b..a2651cdcae 100644 --- a/sys/dev/acpica5/acpi_battery.c +++ b/sys/dev/acpica5/acpi_battery.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/acpica/acpi_battery.c,v 1.8 2003/08/11 15:34:43 njl Exp $ - * $DragonFly: src/sys/dev/acpica5/acpi_battery.c,v 1.2 2004/05/05 22:19:24 dillon Exp $ + * $DragonFly: src/sys/dev/acpica5/acpi_battery.c,v 1.3 2006/09/05 00:55:36 dillon Exp $ */ #include "opt_acpi.h" @@ -224,12 +224,12 @@ acpi_battery_register(int type, int phys_unit) int error; error = 0; - bp = malloc(sizeof(*bp), M_ACPIBATT, M_INTWAIT); + bp = kmalloc(sizeof(*bp), M_ACPIBATT, M_INTWAIT); bp->battdesc.type = type; bp->battdesc.phys_unit = phys_unit; if (acpi_batteries_initted == 0) { if ((error = acpi_battery_init()) != 0) { - free(bp, M_ACPIBATT); + kfree(bp, M_ACPIBATT); return (error); } } diff --git a/sys/dev/acpica5/acpi_cmbat.c b/sys/dev/acpica5/acpi_cmbat.c index 664dc6e7f8..bd89e62ff9 100644 --- a/sys/dev/acpica5/acpi_cmbat.c +++ b/sys/dev/acpica5/acpi_cmbat.c @@ -26,7 +26,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/acpica/acpi_cmbat.c,v 1.29 2004/05/30 20:08:23 phk Exp $ - * $DragonFly: src/sys/dev/acpica5/acpi_cmbat.c,v 1.6 2005/03/12 14:33:40 y0netan1 Exp $ + * $DragonFly: src/sys/dev/acpica5/acpi_cmbat.c,v 1.7 2006/09/05 00:55:36 dillon Exp $ */ #include "opt_acpi.h" @@ -457,7 +457,7 @@ acpi_cmbat_get_total_battinfo(struct acpi_battinfo *battinfo) /* Allocate array of softc pointers */ if (bat_units != acpi_cmbat_units) { if (bat != NULL) { - free(bat, M_ACPICMBAT); + kfree(bat, M_ACPICMBAT); bat = NULL; } bat_units = 0; diff --git a/sys/dev/acpica5/acpi_ec.c b/sys/dev/acpica5/acpi_ec.c index fb5c171916..64da0c1ff0 100644 --- a/sys/dev/acpica5/acpi_ec.c +++ b/sys/dev/acpica5/acpi_ec.c @@ -26,7 +26,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/acpica/acpi_ec.c,v 1.51 2004/05/30 20:08:23 phk Exp $ - * $DragonFly: src/sys/dev/acpica5/acpi_ec.c,v 1.7 2006/06/04 21:09:47 dillon Exp $ + * $DragonFly: src/sys/dev/acpica5/acpi_ec.c,v 1.8 2006/09/05 00:55:36 dillon Exp $ */ /****************************************************************************** * @@ -138,7 +138,7 @@ *****************************************************************************/ /* * $FreeBSD: src/sys/dev/acpica/acpi_ec.c,v 1.51 2004/05/30 20:08:23 phk Exp $ - * $DragonFly: src/sys/dev/acpica5/acpi_ec.c,v 1.7 2006/06/04 21:09:47 dillon Exp $ + * $DragonFly: src/sys/dev/acpica5/acpi_ec.c,v 1.8 2006/09/05 00:55:36 dillon Exp $ * */ @@ -414,7 +414,7 @@ acpi_ec_ecdt_probe(device_t parent) * before initializing devices, but in practice this function * should be safe to call at this point. */ - params = malloc(sizeof(struct acpi_ec_params), M_TEMP, M_WAITOK | M_ZERO); + params = kmalloc(sizeof(struct acpi_ec_params), M_TEMP, M_WAITOK | M_ZERO); params->gpe_handle = NULL; params->gpe_bit = ecdt->gpe_bit; params->uid = ecdt->uid; @@ -456,7 +456,7 @@ acpi_ec_probe(device_t dev) params = acpi_get_private(dev); ret = 0; } else if (acpi_MatchHid(dev, "PNP0C09")) { - params = malloc(sizeof(struct acpi_ec_params), M_TEMP, + params = kmalloc(sizeof(struct acpi_ec_params), M_TEMP, M_WAITOK | M_ZERO); h = acpi_get_handle(dev); @@ -530,7 +530,7 @@ out: } if (ret > 0 && params) - free(params, M_TEMP); + kfree(params, M_TEMP); if (buf.Pointer) AcpiOsFree(buf.Pointer); return (ret); @@ -557,7 +557,7 @@ acpi_ec_attach(device_t dev) sc->ec_gpebit = params->gpe_bit; sc->ec_gpehandle = params->gpe_handle; sc->ec_uid = params->uid; - free(params, M_TEMP); + kfree(params, M_TEMP); /* Attach bus resources for data and command/status ports. */ sc->ec_data_rid = 0; diff --git a/sys/dev/acpica5/acpi_pci.c b/sys/dev/acpica5/acpi_pci.c index 52b5846106..25ccd5723a 100644 --- a/sys/dev/acpica5/acpi_pci.c +++ b/sys/dev/acpica5/acpi_pci.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/acpica/acpi_pci.c,v 1.16 2004/05/29 04:32:50 njl Exp $ - * $DragonFly: src/sys/dev/acpica5/acpi_pci.c,v 1.4 2005/10/30 04:41:15 dillon Exp $ + * $DragonFly: src/sys/dev/acpica5/acpi_pci.c,v 1.5 2006/09/05 00:55:36 dillon Exp $ */ #include "opt_bus.h" @@ -231,11 +231,11 @@ acpi_pci_save_handle(ACPI_HANDLE handle, UINT32 level, void *context, if (dinfo->ap_dinfo.cfg.func == func && dinfo->ap_dinfo.cfg.slot == slot) { dinfo->ap_handle = handle; - free(devlist, M_TEMP); + kfree(devlist, M_TEMP); return_ACPI_STATUS (AE_OK); } } - free(devlist, M_TEMP); + kfree(devlist, M_TEMP); return_ACPI_STATUS (AE_OK); } diff --git a/sys/dev/acpica5/acpi_powerres.c b/sys/dev/acpica5/acpi_powerres.c index 3f20444f12..fd4038f977 100644 --- a/sys/dev/acpica5/acpi_powerres.c +++ b/sys/dev/acpica5/acpi_powerres.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/acpica/acpi_powerres.c,v 1.22 2004/04/14 17:58:19 njl Exp $ - * $DragonFly: src/sys/dev/acpica5/acpi_powerres.c,v 1.3 2004/06/27 08:52:39 dillon Exp $ + * $DragonFly: src/sys/dev/acpica5/acpi_powerres.c,v 1.4 2006/09/05 00:55:36 dillon Exp $ */ #include "opt_acpi.h" @@ -144,7 +144,7 @@ acpi_pwr_register_resource(ACPI_HANDLE res) return_ACPI_STATUS (AE_OK); /* already know about it */ /* Allocate a new resource */ - rp = malloc(sizeof(*rp), M_ACPIPWR, M_INTWAIT | M_ZERO); + rp = kmalloc(sizeof(*rp), M_ACPIPWR, M_INTWAIT | M_ZERO); TAILQ_INIT(&rp->ap_references); rp->ap_resource = res; @@ -188,7 +188,7 @@ acpi_pwr_register_resource(ACPI_HANDLE res) if (buf.Pointer != NULL) AcpiOsFree(buf.Pointer); if (ACPI_FAILURE(status) && rp != NULL) - free(rp, M_ACPIPWR); + kfree(rp, M_ACPIPWR); return_ACPI_STATUS (status); } @@ -215,7 +215,7 @@ acpi_pwr_deregister_resource(ACPI_HANDLE res) /* Pull it off the list and free it */ TAILQ_REMOVE(&acpi_powerresources, rp, ap_link); - free(rp, M_ACPIPWR); + kfree(rp, M_ACPIPWR); ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "deregistered power resource %s\n", acpi_name(res))); @@ -241,7 +241,7 @@ acpi_pwr_register_consumer(ACPI_HANDLE consumer) return_ACPI_STATUS (AE_OK); /* Allocate a new power consumer */ - pc = malloc(sizeof(*pc), M_ACPIPWR, M_INTWAIT); + pc = kmalloc(sizeof(*pc), M_ACPIPWR, M_INTWAIT); TAILQ_INSERT_HEAD(&acpi_powerconsumers, pc, ac_link); TAILQ_INIT(&pc->ac_references); pc->ac_consumer = consumer; @@ -421,7 +421,7 @@ acpi_pwr_switch_consumer(ACPI_HANDLE consumer, int state) acpi_name(pr->ar_resource->ap_resource))); TAILQ_REMOVE(&pr->ar_resource->ap_references, pr, ar_rlink); TAILQ_REMOVE(&pc->ac_references, pr, ar_clink); - free(pr, M_ACPIPWR); + kfree(pr, M_ACPIPWR); } /* @@ -519,7 +519,7 @@ acpi_pwr_reference_resource(ACPI_OBJECT *obj, void *arg) acpi_name(rp->ap_resource))); /* Create a reference between the consumer and resource */ - pr = malloc(sizeof(*pr), M_ACPIPWR, M_INTWAIT | M_ZERO); + pr = kmalloc(sizeof(*pr), M_ACPIPWR, M_INTWAIT | M_ZERO); pr->ar_consumer = pc; pr->ar_resource = rp; TAILQ_INSERT_TAIL(&pc->ac_references, pr, ar_clink); diff --git a/sys/dev/agp/agp.c b/sys/dev/agp/agp.c index 96125de84b..ce82017b07 100644 --- a/sys/dev/agp/agp.c +++ b/sys/dev/agp/agp.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/pci/agp.c,v 1.3.2.4 2002/08/11 19:58:12 alc Exp $ - * $DragonFly: src/sys/dev/agp/agp.c,v 1.22 2006/08/03 16:40:46 swildner Exp $ + * $DragonFly: src/sys/dev/agp/agp.c,v 1.23 2006/09/05 00:55:36 dillon Exp $ */ #include "opt_bus.h" @@ -144,12 +144,12 @@ agp_find_display(void) if (pci_get_class(dev) == PCIC_DISPLAY && pci_get_subclass(dev) == PCIS_DISPLAY_VGA) if (agp_find_caps(dev)) { - free(kids, M_TEMP); + kfree(kids, M_TEMP); return dev; } } - free(kids, M_TEMP); + kfree(kids, M_TEMP); } return 0; @@ -172,14 +172,14 @@ agp_alloc_gatt(device_t dev) return NULL; } - gatt = malloc(sizeof(struct agp_gatt), M_AGP, M_INTWAIT); + gatt = kmalloc(sizeof(struct agp_gatt), M_AGP, M_INTWAIT); gatt->ag_entries = entries; gatt->ag_virtual = contigmalloc(entries * sizeof(u_int32_t), M_AGP, M_WAITOK, 0, ~0, PAGE_SIZE, 0); if (!gatt->ag_virtual) { if (bootverbose) device_printf(dev, "contiguous allocation failed\n"); - free(gatt, M_AGP); + kfree(gatt, M_AGP); return 0; } bzero(gatt->ag_virtual, entries * sizeof(u_int32_t)); @@ -194,7 +194,7 @@ agp_free_gatt(struct agp_gatt *gatt) { contigfree(gatt->ag_virtual, gatt->ag_entries * sizeof(u_int32_t), M_AGP); - free(gatt, M_AGP); + kfree(gatt, M_AGP); } static int agp_max[][2] = { @@ -437,7 +437,7 @@ agp_generic_alloc_memory(device_t dev, int type, vm_size_t size) return 0; } - mem = malloc(sizeof *mem, M_AGP, M_INTWAIT); + mem = kmalloc(sizeof *mem, M_AGP, M_INTWAIT); mem->am_id = sc->as_nextid++; mem->am_size = size; mem->am_type = 0; @@ -462,7 +462,7 @@ agp_generic_free_memory(device_t dev, struct agp_memory *mem) sc->as_allocated -= mem->am_size; TAILQ_REMOVE(&sc->as_memory, mem, am_link); vm_object_deallocate(mem->am_obj); - free(mem, M_AGP); + kfree(mem, M_AGP); return 0; } diff --git a/sys/dev/agp/agp_amd.c b/sys/dev/agp/agp_amd.c index bb1a3b1ed7..915e98053a 100644 --- a/sys/dev/agp/agp_amd.c +++ b/sys/dev/agp/agp_amd.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/pci/agp_amd.c,v 1.3.2.4 2002/04/25 23:41:36 cokane Exp $ - * $DragonFly: src/sys/dev/agp/agp_amd.c,v 1.5 2004/03/24 20:42:12 dillon Exp $ + * $DragonFly: src/sys/dev/agp/agp_amd.c,v 1.6 2006/09/05 00:55:36 dillon Exp $ */ #include "opt_bus.h" @@ -87,7 +87,7 @@ agp_amd_alloc_gatt(device_t dev) "allocating GATT for aperture of size %dM\n", apsize / (1024*1024)); - gatt = malloc(sizeof(struct agp_amd_gatt), M_AGP, M_INTWAIT); + gatt = kmalloc(sizeof(struct agp_amd_gatt), M_AGP, M_INTWAIT); /* * The AMD751 uses a page directory to map a non-contiguous @@ -102,7 +102,7 @@ agp_amd_alloc_gatt(device_t dev) /* * Allocate the page directory. */ - gatt->ag_vdir = malloc(AGP_PAGE_SIZE, M_AGP, M_INTWAIT | M_ZERO); + gatt->ag_vdir = kmalloc(AGP_PAGE_SIZE, M_AGP, M_INTWAIT | M_ZERO); gatt->ag_pdir = vtophys((vm_offset_t) gatt->ag_vdir); if(bootverbose) device_printf(dev, "gatt -> ag_pdir %8x\n", @@ -150,9 +150,9 @@ agp_amd_alloc_gatt(device_t dev) static void agp_amd_free_gatt(struct agp_amd_gatt *gatt) { - free(gatt->ag_virtual, M_AGP); - free(gatt->ag_vdir, M_AGP); - free(gatt, M_AGP); + kfree(gatt->ag_virtual, M_AGP); + kfree(gatt->ag_vdir, M_AGP); + kfree(gatt, M_AGP); } static const char* diff --git a/sys/dev/agp/agp_i810.c b/sys/dev/agp/agp_i810.c index 9cced763c6..9e98b3f660 100644 --- a/sys/dev/agp/agp_i810.c +++ b/sys/dev/agp/agp_i810.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/pci/agp_i810.c,v 1.1.2.5 2002/09/15 08:45:41 anholt Exp $ - * $DragonFly: src/sys/dev/agp/agp_i810.c,v 1.8 2004/07/04 00:24:52 dillon Exp $ + * $DragonFly: src/sys/dev/agp/agp_i810.c,v 1.9 2006/09/05 00:55:36 dillon Exp $ */ /* @@ -167,11 +167,11 @@ agp_i810_find_bridge(device_t dev) child = children[i]; if (pci_get_devid(child) == devid) { - free(children, M_TEMP); + kfree(children, M_TEMP); return child; } } - free(children, M_TEMP); + kfree(children, M_TEMP); return 0; } @@ -284,7 +284,7 @@ agp_i810_attach(device_t dev) return ENXIO; } - gatt = malloc( sizeof(struct agp_gatt), M_AGP, M_INTWAIT); + gatt = kmalloc( sizeof(struct agp_gatt), M_AGP, M_INTWAIT); sc->gatt = gatt; gatt->ag_entries = AGP_GET_APERTURE(dev) >> AGP_PAGE_SHIFT; @@ -302,7 +302,7 @@ agp_i810_attach(device_t dev) if (!gatt->ag_virtual) { if (bootverbose) device_printf(dev, "contiguous allocation failed\n"); - free(gatt, M_AGP); + kfree(gatt, M_AGP); agp_generic_detach(dev); return ENOMEM; } @@ -416,7 +416,7 @@ agp_i810_detach(device_t dev) if ( sc->chiptype == CHIP_I810 ) { contigfree(sc->gatt->ag_virtual, 64 * 1024, M_AGP); } - free(sc->gatt, M_AGP); + kfree(sc->gatt, M_AGP); bus_release_resource(dev, SYS_RES_MEMORY, AGP_I810_MMADR, sc->regs); @@ -573,7 +573,7 @@ agp_i810_alloc_memory(device_t dev, int type, vm_size_t size) return 0; } - mem = malloc(sizeof *mem, M_AGP, M_INTWAIT); + mem = kmalloc(sizeof *mem, M_AGP, M_INTWAIT); mem->am_id = sc->agp.as_nextid++; mem->am_size = size; mem->am_type = type; @@ -628,7 +628,7 @@ agp_i810_free_memory(device_t dev, struct agp_memory *mem) TAILQ_REMOVE(&sc->agp.as_memory, mem, am_link); if (mem->am_obj) vm_object_deallocate(mem->am_obj); - free(mem, M_AGP); + kfree(mem, M_AGP); return 0; } diff --git a/sys/dev/crypto/hifn/hifn7751.c b/sys/dev/crypto/hifn/hifn7751.c index ca02386742..ce2345b064 100644 --- a/sys/dev/crypto/hifn/hifn7751.c +++ b/sys/dev/crypto/hifn/hifn7751.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/dev/hifn/hifn7751.c,v 1.5.2.5 2003/06/04 17:56:59 sam Exp $ */ -/* $DragonFly: src/sys/dev/crypto/hifn/hifn7751.c,v 1.10 2005/10/12 17:35:49 dillon Exp $ */ +/* $DragonFly: src/sys/dev/crypto/hifn/hifn7751.c,v 1.11 2006/09/05 00:55:36 dillon Exp $ */ /* $OpenBSD: hifn7751.c,v 1.120 2002/05/17 00:33:34 deraadt Exp $ */ /* @@ -2221,7 +2221,7 @@ hifn_process(void *arg, struct cryptop *crp, int hint) goto errout; } - cmd = malloc(sizeof(struct hifn_command), M_DEVBUF, M_INTWAIT | M_ZERO); + cmd = kmalloc(sizeof(struct hifn_command), M_DEVBUF, M_INTWAIT | M_ZERO); if (crp->crp_flags & CRYPTO_F_IMBUF) { cmd->src_m = (struct mbuf *)crp->crp_buf; @@ -2416,14 +2416,14 @@ hifn_process(void *arg, struct cryptop *crp, int hint) if (hifn_debug) device_printf(sc->sc_dev, "requeue request\n"); #endif - free(cmd, M_DEVBUF); + kfree(cmd, M_DEVBUF); sc->sc_needwakeup |= CRYPTO_SYMQ; return (err); } errout: if (cmd != NULL) - free(cmd, M_DEVBUF); + kfree(cmd, M_DEVBUF); if (err == EINVAL) hifnstats.hst_invalid++; else @@ -2490,7 +2490,7 @@ hifn_abort(struct hifn_softc *sc) bus_dmamap_unload(sc->sc_dmat, cmd->src_map); bus_dmamap_destroy(sc->sc_dmat, cmd->src_map); - free(cmd, M_DEVBUF); + kfree(cmd, M_DEVBUF); if (crp->crp_etype != EAGAIN) crypto_done(crp); } @@ -2624,7 +2624,7 @@ hifn_callback(struct hifn_softc *sc, struct hifn_command *cmd, u_int8_t *macbuf) } bus_dmamap_unload(sc->sc_dmat, cmd->src_map); bus_dmamap_destroy(sc->sc_dmat, cmd->src_map); - free(cmd, M_DEVBUF); + kfree(cmd, M_DEVBUF); crypto_done(crp); } diff --git a/sys/dev/crypto/rndtest/rndtest.c b/sys/dev/crypto/rndtest/rndtest.c index 4317788cb8..b400366d39 100644 --- a/sys/dev/crypto/rndtest/rndtest.c +++ b/sys/dev/crypto/rndtest/rndtest.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/dev/rndtest/rndtest.c,v 1.1.4.1 2003/06/04 17:10:30 sam Exp $ */ -/* $DragonFly: src/sys/dev/crypto/rndtest/rndtest.c,v 1.7 2004/09/17 00:18:16 dillon Exp $ */ +/* $DragonFly: src/sys/dev/crypto/rndtest/rndtest.c,v 1.8 2006/09/05 00:55:36 dillon Exp $ */ /* $OpenBSD$ */ /* @@ -86,7 +86,7 @@ rndtest_attach(device_t dev) { struct rndtest_state *rsp; - rsp = malloc(sizeof (*rsp), M_DEVBUF, M_INTWAIT); + rsp = kmalloc(sizeof (*rsp), M_DEVBUF, M_INTWAIT); rsp->rs_begin = rsp->rs_buf; rsp->rs_end = rsp->rs_buf + sizeof(rsp->rs_buf); rsp->rs_current = rsp->rs_begin; @@ -102,7 +102,7 @@ void rndtest_detach(struct rndtest_state *rsp) { callout_stop(&rsp->rs_to); - free(rsp, M_DEVBUF); + kfree(rsp, M_DEVBUF); } void diff --git a/sys/dev/crypto/ubsec/ubsec.c b/sys/dev/crypto/ubsec/ubsec.c index 32fe80a0e9..a8e43d2d4a 100644 --- a/sys/dev/crypto/ubsec/ubsec.c +++ b/sys/dev/crypto/ubsec/ubsec.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/dev/ubsec/ubsec.c,v 1.6.2.12 2003/06/04 17:56:59 sam Exp $ */ -/* $DragonFly: src/sys/dev/crypto/ubsec/ubsec.c,v 1.9 2005/10/12 17:35:49 dillon Exp $ */ +/* $DragonFly: src/sys/dev/crypto/ubsec/ubsec.c,v 1.10 2006/09/05 00:55:37 dillon Exp $ */ /* $OpenBSD: ubsec.c,v 1.115 2002/09/24 18:33:26 jason Exp $ */ /* @@ -382,11 +382,11 @@ ubsec_attach(device_t dev) for (i = 0; i < UBS_MAX_NQUEUE; i++, dmap++) { struct ubsec_q *q; - q = malloc(sizeof(struct ubsec_q), M_DEVBUF, M_WAITOK); + q = kmalloc(sizeof(struct ubsec_q), M_DEVBUF, M_WAITOK); if (ubsec_dma_malloc(sc, sizeof(struct ubsec_dmachunk), &dmap->d_alloc, 0)) { device_printf(dev, "cannot allocate dma buffers\n"); - free(q, M_DEVBUF); + kfree(q, M_DEVBUF); break; } dmap->d_dma = (struct ubsec_dmachunk *)dmap->d_alloc.dma_vaddr; @@ -516,7 +516,7 @@ ubsec_detach(device_t dev) q = SIMPLEQ_FIRST(&sc->sc_freequeue); SIMPLEQ_REMOVE_HEAD(&sc->sc_freequeue, q, q_next); ubsec_dma_free(sc, &q->q_dma->d_alloc); - free(q, M_DEVBUF); + kfree(q, M_DEVBUF); } #ifndef UBSEC_NO_RNG if (sc->sc_flags & UBS_FLAGS_RNG) { @@ -874,7 +874,7 @@ ubsec_newsession(void *arg, u_int32_t *sidp, struct cryptoini *cri) sizeof(struct ubsec_session)); bzero(sc->sc_sessions, sesn * sizeof(struct ubsec_session)); - free(sc->sc_sessions, M_DEVBUF); + kfree(sc->sc_sessions, M_DEVBUF); sc->sc_sessions = ses; ses = &sc->sc_sessions[sesn]; sc->sc_nsessions++; @@ -2067,7 +2067,7 @@ ubsec_kfree(struct ubsec_softc *sc, struct ubsec_q2 *q) ubsec_dma_free(sc, &me->me_E); ubsec_dma_free(sc, &me->me_C); ubsec_dma_free(sc, &me->me_epb); - free(me, M_DEVBUF); + kfree(me, M_DEVBUF); break; } case UBS_CTXOP_RSAPRIV: { @@ -2077,7 +2077,7 @@ ubsec_kfree(struct ubsec_softc *sc, struct ubsec_q2 *q) ubsec_dma_free(sc, &rp->rpr_q.q_ctx); ubsec_dma_free(sc, &rp->rpr_msgin); ubsec_dma_free(sc, &rp->rpr_msgout); - free(rp, M_DEVBUF); + kfree(rp, M_DEVBUF); break; } default: @@ -2135,7 +2135,7 @@ ubsec_kprocess_modexp_sw(struct ubsec_softc *sc, struct cryptkop *krp, int hint) int err = 0; u_int nbits, normbits, mbits, shiftbits, ebits; - me = malloc(sizeof *me, M_DEVBUF, M_INTWAIT | M_ZERO); + me = kmalloc(sizeof *me, M_DEVBUF, M_INTWAIT | M_ZERO); me->me_krp = krp; me->me_q.q_type = UBS_CTXOP_MODEXP; @@ -2312,7 +2312,7 @@ errout: } if (me->me_epb.dma_map != NULL) ubsec_dma_free(sc, &me->me_epb); - free(me, M_DEVBUF); + kfree(me, M_DEVBUF); } krp->krp_status = err; crypto_kdone(krp); @@ -2332,7 +2332,7 @@ ubsec_kprocess_modexp_hw(struct ubsec_softc *sc, struct cryptkop *krp, int hint) int err = 0; u_int nbits, normbits, mbits, shiftbits, ebits; - me = malloc(sizeof *me, M_DEVBUF, M_INTWAIT | M_ZERO); + me = kmalloc(sizeof *me, M_DEVBUF, M_INTWAIT | M_ZERO); me->me_krp = krp; me->me_q.q_type = UBS_CTXOP_MODEXP; @@ -2508,7 +2508,7 @@ errout: } if (me->me_epb.dma_map != NULL) ubsec_dma_free(sc, &me->me_epb); - free(me, M_DEVBUF); + kfree(me, M_DEVBUF); } krp->krp_status = err; crypto_kdone(krp); @@ -2559,7 +2559,7 @@ ubsec_kprocess_rsapriv(struct ubsec_softc *sc, struct cryptkop *krp, int hint) goto errout; } - rp = malloc(sizeof *rp, M_DEVBUF, M_INTWAIT | M_ZERO); + rp = kmalloc(sizeof *rp, M_DEVBUF, M_INTWAIT | M_ZERO); rp->rpr_krp = krp; rp->rpr_q.q_type = UBS_CTXOP_RSAPRIV; @@ -2689,7 +2689,7 @@ errout: bzero(rp->rpr_msgout.dma_vaddr, rp->rpr_msgout.dma_size); ubsec_dma_free(sc, &rp->rpr_msgout); } - free(rp, M_DEVBUF); + kfree(rp, M_DEVBUF); } krp->krp_status = err; crypto_kdone(krp); diff --git a/sys/dev/disk/advansys/advansys.c b/sys/dev/disk/advansys/advansys.c index 52a5dd6670..1e2a6bbe57 100644 --- a/sys/dev/disk/advansys/advansys.c +++ b/sys/dev/disk/advansys/advansys.c @@ -33,7 +33,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/advansys/advansys.c,v 1.14.2.4 2002/01/06 21:21:42 dwmalone Exp $ - * $DragonFly: src/sys/dev/disk/advansys/advansys.c,v 1.7 2005/06/03 16:57:12 eirikn Exp $ + * $DragonFly: src/sys/dev/disk/advansys/advansys.c,v 1.8 2006/09/05 00:55:37 dillon Exp $ */ /* * Ported from: @@ -759,7 +759,7 @@ adv_free(struct adv_softc *adv) bus_dma_tag_destroy(adv->parent_dmat); case 1: if (adv->ccb_infos != NULL) - free(adv->ccb_infos, M_DEVBUF); + kfree(adv->ccb_infos, M_DEVBUF); case 0: break; } @@ -1287,7 +1287,7 @@ adv_attach(adv) * a transaction and use it for mapping the queue to the * upper level SCSI transaction it represents. */ - adv->ccb_infos = malloc(sizeof(*adv->ccb_infos) * adv->max_openings, + adv->ccb_infos = kmalloc(sizeof(*adv->ccb_infos) * adv->max_openings, M_DEVBUF, M_WAITOK); adv->init_level++; diff --git a/sys/dev/disk/advansys/adwcam.c b/sys/dev/disk/advansys/adwcam.c index 4b0f2fcd62..779ff6ee93 100644 --- a/sys/dev/disk/advansys/adwcam.c +++ b/sys/dev/disk/advansys/adwcam.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/advansys/adwcam.c,v 1.7.2.2 2001/03/05 13:08:55 obrien Exp $ - * $DragonFly: src/sys/dev/disk/advansys/adwcam.c,v 1.11 2005/10/12 17:35:49 dillon Exp $ + * $DragonFly: src/sys/dev/disk/advansys/adwcam.c,v 1.12 2006/09/05 00:55:37 dillon Exp $ */ /* * Ported from: @@ -161,12 +161,12 @@ adwallocsgmap(struct adw_softc *adw) { struct sg_map_node *sg_map; - sg_map = malloc(sizeof(*sg_map), M_DEVBUF, M_INTWAIT); + sg_map = kmalloc(sizeof(*sg_map), M_DEVBUF, M_INTWAIT); /* Allocate S/G space for the next batch of ACBS */ if (bus_dmamem_alloc(adw->sg_dmat, (void **)&sg_map->sg_vaddr, BUS_DMA_NOWAIT, &sg_map->sg_dmamap) != 0) { - free(sg_map, M_DEVBUF); + kfree(sg_map, M_DEVBUF); return (NULL); } @@ -813,7 +813,7 @@ adw_alloc(device_t dev, struct resource *regs, int regs_type, int regs_id) /* * Allocate a storage area for us */ - adw = malloc(sizeof(struct adw_softc), M_DEVBUF, M_INTWAIT | M_ZERO); + adw = kmalloc(sizeof(struct adw_softc), M_DEVBUF, M_INTWAIT | M_ZERO); LIST_INIT(&adw->pending_ccbs); SLIST_INIT(&adw->sg_maps); adw->device = dev; @@ -825,7 +825,7 @@ adw_alloc(device_t dev, struct resource *regs, int regs_type, int regs_id) adw->bsh = rman_get_bushandle(regs); KKASSERT(adw->unit >= 0 && adw->unit < 100); i = adw->unit / 10; - adw->name = malloc(sizeof("adw") + i + 1, M_DEVBUF, M_INTWAIT); + adw->name = kmalloc(sizeof("adw") + i + 1, M_DEVBUF, M_INTWAIT); sprintf(adw->name, "adw%d", adw->unit); return(adw); } @@ -844,7 +844,7 @@ adw_free(struct adw_softc *adw) sg_map->sg_dmamap); bus_dmamem_free(adw->sg_dmat, sg_map->sg_vaddr, sg_map->sg_dmamap); - free(sg_map, M_DEVBUF); + kfree(sg_map, M_DEVBUF); } bus_dma_tag_destroy(adw->sg_dmat); } @@ -871,8 +871,8 @@ adw_free(struct adw_softc *adw) case 0: break; } - free(adw->name, M_DEVBUF); - free(adw, M_DEVBUF); + kfree(adw->name, M_DEVBUF); + kfree(adw, M_DEVBUF); } int diff --git a/sys/dev/disk/aha/aha.c b/sys/dev/disk/aha/aha.c index 866d1b331f..93876f7410 100644 --- a/sys/dev/disk/aha/aha.c +++ b/sys/dev/disk/aha/aha.c @@ -56,7 +56,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/aha/aha.c,v 1.34.2.1 2000/08/02 22:24:39 peter Exp $ - * $DragonFly: src/sys/dev/disk/aha/aha.c,v 1.12 2005/09/11 13:33:40 sephe Exp $ + * $DragonFly: src/sys/dev/disk/aha/aha.c,v 1.13 2006/09/05 00:55:37 dillon Exp $ */ #include @@ -227,7 +227,7 @@ aha_alloc(device_t dev, bus_space_tag_t tag, bus_space_handle_t bsh) } } - aha = malloc(sizeof(struct aha_softc), M_DEVBUF, M_INTWAIT | M_ZERO); + aha = kmalloc(sizeof(struct aha_softc), M_DEVBUF, M_INTWAIT | M_ZERO); SLIST_INIT(&aha->free_aha_ccbs); LIST_INIT(&aha->pending_ccbs); SLIST_INIT(&aha->sg_maps); @@ -260,7 +260,7 @@ aha_free(struct aha_softc *aha) sg_map->sg_dmamap); bus_dmamem_free(aha->sg_dmat, sg_map->sg_vaddr, sg_map->sg_dmamap); - free(sg_map, M_DEVBUF); + kfree(sg_map, M_DEVBUF); } bus_dma_tag_destroy(aha->sg_dmat); } @@ -296,7 +296,7 @@ aha_free(struct aha_softc *aha) if (unit != AHA_TEMP_UNIT) { aha_softcs[unit] = NULL; } - free(aha, M_DEVBUF); + kfree(aha, M_DEVBUF); } /* @@ -721,12 +721,12 @@ ahaallocccbs(struct aha_softc *aha) next_ccb = &aha->aha_ccb_array[aha->num_ccbs]; - sg_map = malloc(sizeof(*sg_map), M_DEVBUF, M_INTWAIT); + sg_map = kmalloc(sizeof(*sg_map), M_DEVBUF, M_INTWAIT); /* Allocate S/G space for the next batch of CCBS */ if (bus_dmamem_alloc(aha->sg_dmat, (void **)&sg_map->sg_vaddr, BUS_DMA_NOWAIT, &sg_map->sg_dmamap) != 0) { - free(sg_map, M_DEVBUF); + kfree(sg_map, M_DEVBUF); return; } diff --git a/sys/dev/disk/ahb/ahb.c b/sys/dev/disk/ahb/ahb.c index db92b8b5f0..1ec93f88d8 100644 --- a/sys/dev/disk/ahb/ahb.c +++ b/sys/dev/disk/ahb/ahb.c @@ -26,7 +26,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ahb/ahb.c,v 1.18.2.3 2001/03/05 13:08:55 obrien Exp $ - * $DragonFly: src/sys/dev/disk/ahb/ahb.c,v 1.11 2005/10/12 17:35:49 dillon Exp $ + * $DragonFly: src/sys/dev/disk/ahb/ahb.c,v 1.12 2006/09/05 00:55:37 dillon Exp $ */ #include @@ -391,7 +391,7 @@ ahballoc(u_long unit, struct resource *res) /* * Allocate a storage area for us */ - ahb = malloc(sizeof(struct ahb_softc), M_DEVBUF, M_INTWAIT | M_ZERO); + ahb = kmalloc(sizeof(struct ahb_softc), M_DEVBUF, M_INTWAIT | M_ZERO); SLIST_INIT(&ahb->free_ecbs); LIST_INIT(&ahb->pending_ccbs); ahb->unit = unit; @@ -425,7 +425,7 @@ ahbfree(struct ahb_softc *ahb) case 0: break; } - free(ahb, M_DEVBUF); + kfree(ahb, M_DEVBUF); } /* diff --git a/sys/dev/disk/aic7xxx/ahc_eisa.c b/sys/dev/disk/aic7xxx/ahc_eisa.c index b491163cec..9f133e09bc 100644 --- a/sys/dev/disk/aic7xxx/ahc_eisa.c +++ b/sys/dev/disk/aic7xxx/ahc_eisa.c @@ -29,7 +29,7 @@ * $Id: //depot/aic7xxx/freebsd/dev/aic7xxx/ahc_eisa.c#11 $ * * $FreeBSD: src/sys/dev/aic7xxx/ahc_eisa.c,v 1.15.2.11 2003/06/10 03:26:07 gibbs Exp $ - * $DragonFly: src/sys/dev/disk/aic7xxx/ahc_eisa.c,v 1.4 2004/03/15 01:10:42 dillon Exp $ + * $DragonFly: src/sys/dev/disk/aic7xxx/ahc_eisa.c,v 1.5 2006/09/05 00:55:37 dillon Exp $ */ #include "aic7xxx_osm.h" @@ -120,7 +120,7 @@ aic7770_attach(device_t dev) * set it up for attachment by our * common detect routine. */ - name = malloc(strlen(device_get_nameunit(dev)) + 1, M_DEVBUF, M_WAITOK); + name = kmalloc(strlen(device_get_nameunit(dev)) + 1, M_DEVBUF, M_WAITOK); strcpy(name, device_get_nameunit(dev)); ahc = ahc_alloc(dev, name); if (ahc == NULL) diff --git a/sys/dev/disk/aic7xxx/ahc_pci.c b/sys/dev/disk/aic7xxx/ahc_pci.c index e52d8b23ec..f290124326 100644 --- a/sys/dev/disk/aic7xxx/ahc_pci.c +++ b/sys/dev/disk/aic7xxx/ahc_pci.c @@ -31,7 +31,7 @@ * $Id: //depot/aic7xxx/freebsd/dev/aic7xxx/ahc_pci.c#13 $ * * $FreeBSD: src/sys/dev/aic7xxx/ahc_pci.c,v 1.29.2.14 2003/06/10 03:26:07 gibbs Exp $ - * $DragonFly: src/sys/dev/disk/aic7xxx/ahc_pci.c,v 1.5 2004/03/15 01:10:42 dillon Exp $ + * $DragonFly: src/sys/dev/disk/aic7xxx/ahc_pci.c,v 1.6 2006/09/05 00:55:37 dillon Exp $ */ #include "aic7xxx_osm.h" @@ -91,7 +91,7 @@ ahc_pci_attach(device_t dev) * set it up for attachment by our * common detect routine. */ - name = malloc(strlen(device_get_nameunit(dev)) + 1, M_DEVBUF, M_WAITOK); + name = kmalloc(strlen(device_get_nameunit(dev)) + 1, M_DEVBUF, M_WAITOK); strcpy(name, device_get_nameunit(dev)); ahc = ahc_alloc(dev, name); if (ahc == NULL) diff --git a/sys/dev/disk/aic7xxx/ahd_pci.c b/sys/dev/disk/aic7xxx/ahd_pci.c index 023f281114..0084197810 100644 --- a/sys/dev/disk/aic7xxx/ahd_pci.c +++ b/sys/dev/disk/aic7xxx/ahd_pci.c @@ -31,7 +31,7 @@ * $Id: //depot/aic7xxx/freebsd/dev/aic7xxx/ahd_pci.c#13 $ * * $FreeBSD: src/sys/dev/aic7xxx/ahd_pci.c,v 1.2.2.5 2003/06/10 03:26:07 gibbs Exp $ - * $DragonFly: src/sys/dev/disk/aic7xxx/ahd_pci.c,v 1.5 2004/03/15 01:10:42 dillon Exp $ + * $DragonFly: src/sys/dev/disk/aic7xxx/ahd_pci.c,v 1.6 2006/09/05 00:55:37 dillon Exp $ */ #include "aic79xx_osm.h" @@ -94,7 +94,7 @@ ahd_pci_attach(device_t dev) * set it up for attachment by our * common detect routine. */ - name = malloc(strlen(device_get_nameunit(dev)) + 1, M_DEVBUF, M_WAITOK); + name = kmalloc(strlen(device_get_nameunit(dev)) + 1, M_DEVBUF, M_WAITOK); strcpy(name, device_get_nameunit(dev)); ahd = ahd_alloc(dev, name); if (ahd == NULL) diff --git a/sys/dev/disk/aic7xxx/aic7770.c b/sys/dev/disk/aic7xxx/aic7770.c index 86a8213105..746eefc845 100644 --- a/sys/dev/disk/aic7xxx/aic7770.c +++ b/sys/dev/disk/aic7xxx/aic7770.c @@ -40,7 +40,7 @@ * $Id: //depot/aic7xxx/aic7xxx/aic7770.c#32 $ * * $FreeBSD: src/sys/dev/aic7xxx/aic7770.c,v 1.1.2.9 2003/06/10 03:26:07 gibbs Exp $ - * $DragonFly: src/sys/dev/disk/aic7xxx/aic7770.c,v 1.4 2006/08/03 16:40:46 swildner Exp $ + * $DragonFly: src/sys/dev/disk/aic7xxx/aic7770.c,v 1.5 2006/09/05 00:55:37 dillon Exp $ */ #ifdef __linux__ @@ -227,7 +227,7 @@ aic7770_config(struct ahc_softc *ahc, struct aic7770_identity *entry, u_int io) break; } if (have_seeprom == 0) { - free(ahc->seep_config, M_DEVBUF); + kfree(ahc->seep_config, M_DEVBUF); ahc->seep_config = NULL; } diff --git a/sys/dev/disk/aic7xxx/aic79xx.c b/sys/dev/disk/aic7xxx/aic79xx.c index aa32c5225b..17a782ea04 100644 --- a/sys/dev/disk/aic7xxx/aic79xx.c +++ b/sys/dev/disk/aic7xxx/aic79xx.c @@ -40,7 +40,7 @@ * $Id: //depot/aic7xxx/aic7xxx/aic79xx.c#198 $ * * $FreeBSD: src/sys/dev/aic7xxx/aic79xx.c,v 1.3.2.5 2003/06/10 03:26:07 gibbs Exp $ - * $DragonFly: src/sys/dev/disk/aic7xxx/aic79xx.c,v 1.7 2004/08/25 01:53:38 dillon Exp $ + * $DragonFly: src/sys/dev/disk/aic7xxx/aic79xx.c,v 1.8 2006/09/05 00:55:37 dillon Exp $ */ #include "aic79xx_osm.h" @@ -2348,7 +2348,7 @@ ahd_alloc_tstate(struct ahd_softc *ahd, u_int scsi_id, char channel) && ahd->enabled_targets[scsi_id] != master_tstate) panic("%s: ahd_alloc_tstate - Target already allocated", ahd_name(ahd)); - tstate = malloc(sizeof(*tstate), M_DEVBUF, M_INTWAIT); + tstate = kmalloc(sizeof(*tstate), M_DEVBUF, M_INTWAIT); /* * If we have allocated a master tstate, copy user settings from @@ -2391,7 +2391,7 @@ ahd_free_tstate(struct ahd_softc *ahd, u_int scsi_id, char channel, int force) tstate = ahd->enabled_targets[scsi_id]; if (tstate != NULL) - free(tstate, M_DEVBUF); + kfree(tstate, M_DEVBUF); ahd->enabled_targets[scsi_id] = NULL; } #endif @@ -4778,12 +4778,12 @@ ahd_alloc(void *platform_arg, char *name) struct ahd_softc *ahd; #if !defined(__DragonFly__) && !defined(__FreeBSD__) - ahd = malloc(sizeof(*ahd), M_DEVBUF, M_INTWAIT); + ahd = kmalloc(sizeof(*ahd), M_DEVBUF, M_INTWAIT); #else ahd = device_get_softc((device_t)platform_arg); #endif memset(ahd, 0, sizeof(*ahd)); - ahd->seep_config = malloc(sizeof(*ahd->seep_config),M_DEVBUF,M_INTWAIT); + ahd->seep_config = kmalloc(sizeof(*ahd->seep_config),M_DEVBUF,M_INTWAIT); LIST_INIT(&ahd->pending_scbs); /* We don't know our unit number until the OSM sets it */ ahd->name = name; @@ -4906,7 +4906,7 @@ void ahd_set_name(struct ahd_softc *ahd, char *name) { if (ahd->name != NULL) - free(ahd->name, M_DEVBUF); + kfree(ahd->name, M_DEVBUF); ahd->name = name; } @@ -4961,27 +4961,27 @@ ahd_free(struct ahd_softc *ahd) lstate = tstate->enabled_luns[j]; if (lstate != NULL) { xpt_free_path(lstate->path); - free(lstate, M_DEVBUF); + kfree(lstate, M_DEVBUF); } } #endif - free(tstate, M_DEVBUF); + kfree(tstate, M_DEVBUF); } } #if AHD_TARGET_MODE if (ahd->black_hole != NULL) { xpt_free_path(ahd->black_hole->path); - free(ahd->black_hole, M_DEVBUF); + kfree(ahd->black_hole, M_DEVBUF); } #endif if (ahd->name != NULL) - free(ahd->name, M_DEVBUF); + kfree(ahd->name, M_DEVBUF); if (ahd->seep_config != NULL) - free(ahd->seep_config, M_DEVBUF); + kfree(ahd->seep_config, M_DEVBUF); if (ahd->saved_stack != NULL) - free(ahd->saved_stack, M_DEVBUF); + kfree(ahd->saved_stack, M_DEVBUF); #if !defined(__DragonFly__) && !defined(__FreeBSD__) - free(ahd, M_DEVBUF); + kfree(ahd, M_DEVBUF); #endif return; } @@ -5324,7 +5324,7 @@ ahd_fini_scbdata(struct ahd_softc *ahd) sns_map->dmamap); ahd_dmamem_free(ahd, scb_data->sense_dmat, sns_map->vaddr, sns_map->dmamap); - free(sns_map, M_DEVBUF); + kfree(sns_map, M_DEVBUF); } ahd_dma_tag_destroy(ahd, scb_data->sense_dmat); /* FALLTHROUGH */ @@ -5339,7 +5339,7 @@ ahd_fini_scbdata(struct ahd_softc *ahd) sg_map->dmamap); ahd_dmamem_free(ahd, scb_data->sg_dmat, sg_map->vaddr, sg_map->dmamap); - free(sg_map, M_DEVBUF); + kfree(sg_map, M_DEVBUF); } ahd_dma_tag_destroy(ahd, scb_data->sg_dmat); /* FALLTHROUGH */ @@ -5354,7 +5354,7 @@ ahd_fini_scbdata(struct ahd_softc *ahd) hscb_map->dmamap); ahd_dmamem_free(ahd, scb_data->hscb_dmat, hscb_map->vaddr, hscb_map->dmamap); - free(hscb_map, M_DEVBUF); + kfree(hscb_map, M_DEVBUF); } ahd_dma_tag_destroy(ahd, scb_data->hscb_dmat); /* FALLTHROUGH */ @@ -5590,13 +5590,13 @@ ahd_alloc_scbs(struct ahd_softc *ahd) hscb = &((struct hardware_scb *)hscb_map->vaddr)[offset]; hscb_busaddr = hscb_map->physaddr + (offset * sizeof(*hscb)); } else { - hscb_map = malloc(sizeof(*hscb_map), M_DEVBUF, M_INTWAIT); + hscb_map = kmalloc(sizeof(*hscb_map), M_DEVBUF, M_INTWAIT); /* Allocate the next batch of hardware SCBs */ if (ahd_dmamem_alloc(ahd, scb_data->hscb_dmat, (void **)&hscb_map->vaddr, BUS_DMA_NOWAIT, &hscb_map->dmamap) != 0) { - free(hscb_map, M_DEVBUF); + kfree(hscb_map, M_DEVBUF); return; } @@ -5620,13 +5620,13 @@ ahd_alloc_scbs(struct ahd_softc *ahd) segs = sg_map->vaddr + offset; sg_busaddr = sg_map->physaddr + offset; } else { - sg_map = malloc(sizeof(*sg_map), M_DEVBUF, M_INTWAIT); + sg_map = kmalloc(sizeof(*sg_map), M_DEVBUF, M_INTWAIT); /* Allocate the next batch of S/G lists */ if (ahd_dmamem_alloc(ahd, scb_data->sg_dmat, (void **)&sg_map->vaddr, BUS_DMA_NOWAIT, &sg_map->dmamap) != 0) { - free(sg_map, M_DEVBUF); + kfree(sg_map, M_DEVBUF); return; } @@ -5654,13 +5654,13 @@ ahd_alloc_scbs(struct ahd_softc *ahd) sense_data = sense_map->vaddr + offset; sense_busaddr = sense_map->physaddr + offset; } else { - sense_map = malloc(sizeof(*sense_map), M_DEVBUF, M_INTWAIT); + sense_map = kmalloc(sizeof(*sense_map), M_DEVBUF, M_INTWAIT); /* Allocate the next batch of sense buffers */ if (ahd_dmamem_alloc(ahd, scb_data->sense_dmat, (void **)&sense_map->vaddr, BUS_DMA_NOWAIT, &sense_map->dmamap) != 0) { - free(sense_map, M_DEVBUF); + kfree(sense_map, M_DEVBUF); return; } @@ -5692,8 +5692,8 @@ ahd_alloc_scbs(struct ahd_softc *ahd) #ifndef __linux__ int error; #endif - next_scb = malloc(sizeof(*next_scb), M_DEVBUF, M_INTWAIT); - pdata = malloc(sizeof(*pdata), M_DEVBUF, M_INTWAIT); + next_scb = kmalloc(sizeof(*next_scb), M_DEVBUF, M_INTWAIT); + pdata = kmalloc(sizeof(*pdata), M_DEVBUF, M_INTWAIT); next_scb->platform_data = pdata; next_scb->hscb_map = hscb_map; next_scb->sg_map = sg_map; @@ -5721,8 +5721,8 @@ ahd_alloc_scbs(struct ahd_softc *ahd) error = ahd_dmamap_create(ahd, ahd->buffer_dmat, /*flags*/0, &next_scb->dmamap); if (error != 0) { - free(next_scb, M_DEVBUF); - free(pdata, M_DEVBUF); + kfree(next_scb, M_DEVBUF); + kfree(pdata, M_DEVBUF); break; } #endif @@ -8183,7 +8183,7 @@ ahd_loadseq(struct ahd_softc *ahd) ahd->num_critical_sections = cs_count; if (cs_count != 0) { cs_count *= sizeof(struct cs); - ahd->critical_sections = malloc(cs_count, M_DEVBUF, M_INTWAIT); + ahd->critical_sections = kmalloc(cs_count, M_DEVBUF, M_INTWAIT); memcpy(ahd->critical_sections, cs_table, cs_count); } ahd_outb(ahd, SEQCTL0, PERRORDIS|FAILDIS|FASTMODE); @@ -9103,13 +9103,13 @@ ahd_handle_en_lun(struct ahd_softc *ahd, struct cam_sim *sim, union ccb *ccb) return; } } - lstate = malloc(sizeof(*lstate), M_DEVBUF, M_INTWAIT | M_ZERO); + lstate = kmalloc(sizeof(*lstate), M_DEVBUF, M_INTWAIT | M_ZERO); status = xpt_create_path(&lstate->path, /*periph*/NULL, xpt_path_path_id(ccb->ccb_h.path), xpt_path_target_id(ccb->ccb_h.path), xpt_path_lun_id(ccb->ccb_h.path)); if (status != CAM_REQ_CMP) { - free(lstate, M_DEVBUF); + kfree(lstate, M_DEVBUF); xpt_print_path(ccb->ccb_h.path); printf("Couldn't allocate path\n"); ccb->ccb_h.status = CAM_RESRC_UNAVAIL; @@ -9227,7 +9227,7 @@ ahd_handle_en_lun(struct ahd_softc *ahd, struct cam_sim *sim, union ccb *ccb) xpt_print_path(ccb->ccb_h.path); printf("Target mode disabled\n"); xpt_free_path(lstate->path); - free(lstate, M_DEVBUF); + kfree(lstate, M_DEVBUF); ahd_pause(ahd); /* Can we clean up the target too? */ diff --git a/sys/dev/disk/aic7xxx/aic79xx_osm.c b/sys/dev/disk/aic7xxx/aic79xx_osm.c index f9a37936df..de89281d73 100644 --- a/sys/dev/disk/aic7xxx/aic79xx_osm.c +++ b/sys/dev/disk/aic7xxx/aic79xx_osm.c @@ -32,7 +32,7 @@ * $Id: //depot/aic7xxx/freebsd/dev/aic7xxx/aic79xx_osm.c#27 $ * * $FreeBSD: src/sys/dev/aic7xxx/aic79xx_osm.c,v 1.3.2.4 2003/06/10 03:26:07 gibbs Exp $ - * $DragonFly: src/sys/dev/disk/aic7xxx/aic79xx_osm.c,v 1.9 2005/10/12 17:35:49 dillon Exp $ + * $DragonFly: src/sys/dev/disk/aic7xxx/aic79xx_osm.c,v 1.10 2006/09/05 00:55:37 dillon Exp $ */ #include "aic79xx_osm.h" @@ -1726,7 +1726,7 @@ ahd_platform_set_tags(struct ahd_softc *ahd, int ahd_platform_alloc(struct ahd_softc *ahd, void *platform_arg) { - ahd->platform_data = malloc(sizeof(struct ahd_platform_data), M_DEVBUF, + ahd->platform_data = kmalloc(sizeof(struct ahd_platform_data), M_DEVBUF, M_INTWAIT | M_ZERO); return (0); } @@ -1769,7 +1769,7 @@ ahd_platform_free(struct ahd_softc *ahd) } if (pdata->eh != NULL) EVENTHANDLER_DEREGISTER(shutdown_final, pdata->eh); - free(ahd->platform_data, M_DEVBUF); + kfree(ahd->platform_data, M_DEVBUF); } } diff --git a/sys/dev/disk/aic7xxx/aic79xx_pci.c b/sys/dev/disk/aic7xxx/aic79xx_pci.c index b2cbac5628..8bdfde0485 100644 --- a/sys/dev/disk/aic7xxx/aic79xx_pci.c +++ b/sys/dev/disk/aic7xxx/aic79xx_pci.c @@ -41,7 +41,7 @@ * $Id: //depot/aic7xxx/aic7xxx/aic79xx_pci.c#75 $ * * $FreeBSD: src/sys/dev/aic7xxx/aic79xx_pci.c,v 1.3.2.5 2003/06/10 03:26:07 gibbs Exp $ - * $DragonFly: src/sys/dev/disk/aic7xxx/aic79xx_pci.c,v 1.3 2003/08/07 21:16:51 dillon Exp $ + * $DragonFly: src/sys/dev/disk/aic7xxx/aic79xx_pci.c,v 1.4 2006/09/05 00:55:37 dillon Exp $ */ #ifdef __linux__ @@ -627,7 +627,7 @@ ahd_check_extport(struct ahd_softc *ahd) ahd->flags |= AHD_USEDEFAULTS; error = ahd_default_config(ahd); adapter_control = CFAUTOTERM|CFSEAUTOTERM; - free(ahd->seep_config, M_DEVBUF); + kfree(ahd->seep_config, M_DEVBUF); ahd->seep_config = NULL; } else { error = ahd_parse_cfgdata(ahd, sc); diff --git a/sys/dev/disk/aic7xxx/aic7xxx.c b/sys/dev/disk/aic7xxx/aic7xxx.c index 45e64d611c..6df244b787 100644 --- a/sys/dev/disk/aic7xxx/aic7xxx.c +++ b/sys/dev/disk/aic7xxx/aic7xxx.c @@ -40,7 +40,7 @@ * $Id: //depot/aic7xxx/aic7xxx/aic7xxx.c#134 $ * * $FreeBSD: src/sys/dev/aic7xxx/aic7xxx.c,v 1.41.2.27 2003/06/10 03:26:08 gibbs Exp $ - * $DragonFly: src/sys/dev/disk/aic7xxx/aic7xxx.c,v 1.7 2004/08/25 01:53:38 dillon Exp $ + * $DragonFly: src/sys/dev/disk/aic7xxx/aic7xxx.c,v 1.8 2006/09/05 00:55:37 dillon Exp $ */ #include "aic7xxx_osm.h" @@ -1562,7 +1562,7 @@ ahc_alloc_tstate(struct ahc_softc *ahc, u_int scsi_id, char channel) && ahc->enabled_targets[scsi_id] != master_tstate) panic("%s: ahc_alloc_tstate - Target already allocated", ahc_name(ahc)); - tstate = malloc(sizeof(*tstate), M_DEVBUF, M_INTWAIT); + tstate = kmalloc(sizeof(*tstate), M_DEVBUF, M_INTWAIT); /* * If we have allocated a master tstate, copy user settings from @@ -1609,7 +1609,7 @@ ahc_free_tstate(struct ahc_softc *ahc, u_int scsi_id, char channel, int force) scsi_id += 8; tstate = ahc->enabled_targets[scsi_id]; if (tstate != NULL) - free(tstate, M_DEVBUF); + kfree(tstate, M_DEVBUF); ahc->enabled_targets[scsi_id] = NULL; } #endif @@ -3802,7 +3802,7 @@ ahc_alloc(void *platform_arg, char *name) int i; #if !defined(__DragonFly__) && !defined(__FreeBSD__) - ahc = malloc(sizeof(*ahc), M_DEVBUF, M_WAITOK); + ahc = kmalloc(sizeof(*ahc), M_DEVBUF, M_WAITOK); #else ahc = device_get_softc((device_t)platform_arg); #endif @@ -3937,7 +3937,7 @@ void ahc_set_name(struct ahc_softc *ahc, char *name) { if (ahc->name != NULL) - free(ahc->name, M_DEVBUF); + kfree(ahc->name, M_DEVBUF); ahc->name = name; } @@ -3992,25 +3992,25 @@ ahc_free(struct ahc_softc *ahc) lstate = tstate->enabled_luns[j]; if (lstate != NULL) { xpt_free_path(lstate->path); - free(lstate, M_DEVBUF); + kfree(lstate, M_DEVBUF); } } #endif - free(tstate, M_DEVBUF); + kfree(tstate, M_DEVBUF); } } #ifdef AHC_TARGET_MODE if (ahc->black_hole != NULL) { xpt_free_path(ahc->black_hole->path); - free(ahc->black_hole, M_DEVBUF); + kfree(ahc->black_hole, M_DEVBUF); } #endif if (ahc->name != NULL) - free(ahc->name, M_DEVBUF); + kfree(ahc->name, M_DEVBUF); if (ahc->seep_config != NULL) - free(ahc->seep_config, M_DEVBUF); + kfree(ahc->seep_config, M_DEVBUF); #if !defined(__DragonFly__) && !defined(__FreeBSD__) - free(ahc, M_DEVBUF); + kfree(ahc, M_DEVBUF); #endif return; } @@ -4391,7 +4391,7 @@ ahc_fini_scbdata(struct ahc_softc *ahc) ahc_dmamem_free(ahc, scb_data->sg_dmat, sg_map->sg_vaddr, sg_map->sg_dmamap); - free(sg_map, M_DEVBUF); + kfree(sg_map, M_DEVBUF); } ahc_dma_tag_destroy(ahc, scb_data->sg_dmat); } @@ -4420,7 +4420,7 @@ ahc_fini_scbdata(struct ahc_softc *ahc) break; } if (scb_data->scbarray != NULL) - free(scb_data->scbarray, M_DEVBUF); + kfree(scb_data->scbarray, M_DEVBUF); } void @@ -4441,13 +4441,13 @@ ahc_alloc_scbs(struct ahc_softc *ahc) next_scb = &scb_data->scbarray[scb_data->numscbs]; - sg_map = malloc(sizeof(*sg_map), M_DEVBUF, M_INTWAIT); + sg_map = kmalloc(sizeof(*sg_map), M_DEVBUF, M_INTWAIT); /* Allocate S/G space for the next batch of SCBS */ if (ahc_dmamem_alloc(ahc, scb_data->sg_dmat, (void **)&sg_map->sg_vaddr, BUS_DMA_NOWAIT, &sg_map->sg_dmamap) != 0) { - free(sg_map, M_DEVBUF); + kfree(sg_map, M_DEVBUF); return; } @@ -4467,7 +4467,7 @@ ahc_alloc_scbs(struct ahc_softc *ahc) #ifndef __linux__ int error; #endif - pdata = malloc(sizeof(*pdata), M_DEVBUF, M_INTWAIT); + pdata = kmalloc(sizeof(*pdata), M_DEVBUF, M_INTWAIT); next_scb->platform_data = pdata; next_scb->sg_map = sg_map; next_scb->sg_list = segs; @@ -6386,7 +6386,7 @@ ahc_loadseq(struct ahc_softc *ahc) ahc->num_critical_sections = cs_count; if (cs_count != 0) { cs_count *= sizeof(struct cs); - ahc->critical_sections = malloc(cs_count, M_DEVBUF, M_INTWAIT); + ahc->critical_sections = kmalloc(cs_count, M_DEVBUF, M_INTWAIT); memcpy(ahc->critical_sections, cs_table, cs_count); } ahc_outb(ahc, SEQCTL, PERRORDIS|FAILDIS|FASTMODE); @@ -7001,13 +7001,13 @@ ahc_handle_en_lun(struct ahc_softc *ahc, struct cam_sim *sim, union ccb *ccb) return; } } - lstate = malloc(sizeof(*lstate), M_DEVBUF, M_INTWAIT | M_ZERO); + lstate = kmalloc(sizeof(*lstate), M_DEVBUF, M_INTWAIT | M_ZERO); status = xpt_create_path(&lstate->path, /*periph*/NULL, xpt_path_path_id(ccb->ccb_h.path), xpt_path_target_id(ccb->ccb_h.path), xpt_path_lun_id(ccb->ccb_h.path)); if (status != CAM_REQ_CMP) { - free(lstate, M_DEVBUF); + kfree(lstate, M_DEVBUF); xpt_print_path(ccb->ccb_h.path); printf("Couldn't allocate path\n"); ccb->ccb_h.status = CAM_RESRC_UNAVAIL; @@ -7128,7 +7128,7 @@ ahc_handle_en_lun(struct ahc_softc *ahc, struct cam_sim *sim, union ccb *ccb) xpt_print_path(ccb->ccb_h.path); printf("Target mode disabled\n"); xpt_free_path(lstate->path); - free(lstate, M_DEVBUF); + kfree(lstate, M_DEVBUF); ahc_pause(ahc); /* Can we clean up the target too? */ diff --git a/sys/dev/disk/aic7xxx/aic7xxx_osm.c b/sys/dev/disk/aic7xxx/aic7xxx_osm.c index f59ca829e8..156b435928 100644 --- a/sys/dev/disk/aic7xxx/aic7xxx_osm.c +++ b/sys/dev/disk/aic7xxx/aic7xxx_osm.c @@ -31,7 +31,7 @@ * $Id: //depot/aic7xxx/freebsd/dev/aic7xxx/aic7xxx_osm.c#13 $ * * $FreeBSD: src/sys/dev/aic7xxx/aic7xxx_osm.c,v 1.27.2.6 2003/06/10 03:26:09 gibbs Exp $ - * $DragonFly: src/sys/dev/disk/aic7xxx/aic7xxx_osm.c,v 1.9 2005/10/12 17:35:49 dillon Exp $ + * $DragonFly: src/sys/dev/disk/aic7xxx/aic7xxx_osm.c,v 1.10 2006/09/05 00:55:37 dillon Exp $ */ #include "aic7xxx_osm.h" @@ -1841,7 +1841,7 @@ ahc_platform_set_tags(struct ahc_softc *ahc, int ahc_platform_alloc(struct ahc_softc *ahc, void *platform_arg) { - ahc->platform_data = malloc(sizeof(struct ahc_platform_data), M_DEVBUF, + ahc->platform_data = kmalloc(sizeof(struct ahc_platform_data), M_DEVBUF, M_INTWAIT | M_ZERO); return (0); } @@ -1878,7 +1878,7 @@ ahc_platform_free(struct ahc_softc *ahc) } if (pdata->eh != NULL) EVENTHANDLER_DEREGISTER(shutdown_final, pdata->eh); - free(ahc->platform_data, M_DEVBUF); + kfree(ahc->platform_data, M_DEVBUF); } } diff --git a/sys/dev/disk/aic7xxx/aic7xxx_pci.c b/sys/dev/disk/aic7xxx/aic7xxx_pci.c index 42e76b56e5..97112476e2 100644 --- a/sys/dev/disk/aic7xxx/aic7xxx_pci.c +++ b/sys/dev/disk/aic7xxx/aic7xxx_pci.c @@ -42,7 +42,7 @@ * $Id: //depot/aic7xxx/aic7xxx/aic7xxx_pci.c#69 $ * * $FreeBSD: src/sys/dev/aic7xxx/aic7xxx_pci.c,v 1.2.2.17 2003/06/10 03:26:09 gibbs Exp $ - * $DragonFly: src/sys/dev/disk/aic7xxx/aic7xxx_pci.c,v 1.3 2003/08/07 21:16:51 dillon Exp $ + * $DragonFly: src/sys/dev/disk/aic7xxx/aic7xxx_pci.c,v 1.4 2006/09/05 00:55:37 dillon Exp $ */ #ifdef __linux__ @@ -1431,7 +1431,7 @@ check_extport(struct ahc_softc *ahc, u_int *sxfrctl1) if (bootverbose) printf("%s: No SEEPROM available.\n", ahc_name(ahc)); ahc->flags |= AHC_USEDEFAULTS; - free(ahc->seep_config, M_DEVBUF); + kfree(ahc->seep_config, M_DEVBUF); ahc->seep_config = NULL; sc = NULL; } else { diff --git a/sys/dev/disk/ata/ata-all.c b/sys/dev/disk/ata/ata-all.c index 8f2a98a649..f24ac7aa15 100644 --- a/sys/dev/disk/ata/ata-all.c +++ b/sys/dev/disk/ata/ata-all.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ata/ata-all.c,v 1.50.2.45 2003/03/12 14:47:12 sos Exp $ - * $DragonFly: src/sys/dev/disk/ata/ata-all.c,v 1.29 2006/07/28 02:17:35 dillon Exp $ + * $DragonFly: src/sys/dev/disk/ata/ata-all.c,v 1.30 2006/09/05 00:55:37 dillon Exp $ */ #include "opt_ata.h" @@ -270,11 +270,11 @@ ata_detach(device_t dev) crit_exit(); if (ch->device[MASTER].param) { - free(ch->device[MASTER].param, M_ATA); + kfree(ch->device[MASTER].param, M_ATA); ch->device[MASTER].param = NULL; } if (ch->device[SLAVE].param) { - free(ch->device[SLAVE].param, M_ATA); + kfree(ch->device[SLAVE].param, M_ATA); ch->device[SLAVE].param = NULL; } ch->device[MASTER].driver = NULL; @@ -448,7 +448,7 @@ ataioctl(struct dev_ioctl_args *ap) ATA_ATAPI_MASTER : ATA_ATAPI_SLAVE))) return ENODEV; - buf = malloc(iocmd->u.atapi.count, M_ATA, M_INTWAIT); + buf = kmalloc(iocmd->u.atapi.count, M_ATA, M_INTWAIT); if (iocmd->u.atapi.flags & ATAPI_CMD_WRITE) { error = copyin(iocmd->u.atapi.data, buf, iocmd->u.atapi.count); @@ -469,7 +469,7 @@ ataioctl(struct dev_ioctl_args *ap) else if (iocmd->u.atapi.flags & ATAPI_CMD_READ) error = copyout(buf, iocmd->u.atapi.data, iocmd->u.atapi.count); - free(buf, M_ATA); + kfree(buf, M_ATA); return error; } #endif @@ -485,20 +485,20 @@ ata_getparam(struct ata_device *atadev, u_int8_t command) struct ata_params *ata_parm; int retry = 0; - ata_parm = malloc(sizeof(struct ata_params), M_ATA, M_INTWAIT); + ata_parm = kmalloc(sizeof(struct ata_params), M_ATA, M_INTWAIT); /* apparently some devices needs this repeated */ do { if (ata_command(atadev, command, 0, 0, 0, ATA_IMMEDIATE)) { ata_prtdev(atadev, "%s identify failed\n", command == ATA_C_ATAPI_IDENTIFY ? "ATAPI" : "ATA"); - free(ata_parm, M_ATA); + kfree(ata_parm, M_ATA); return -1; } if (retry++ > 4) { ata_prtdev(atadev, "%s identify retries exceeded\n", command == ATA_C_ATAPI_IDENTIFY ? "ATAPI" : "ATA"); - free(ata_parm, M_ATA); + kfree(ata_parm, M_ATA); return -1; } } while (ata_wait(atadev, ((command == ATA_C_ATAPI_IDENTIFY) ? @@ -531,7 +531,7 @@ ata_boot_attach(void) if (ata_delayed_attach) { config_intrhook_disestablish(ata_delayed_attach); - free(ata_delayed_attach, M_TEMP); + kfree(ata_delayed_attach, M_TEMP); ata_delayed_attach = NULL; } crit_enter(); @@ -892,12 +892,12 @@ ata_reinit(struct ata_channel *ch) #endif if (misdev & ATA_ATA_MASTER || misdev & ATA_ATAPI_MASTER) { if (ch->device[MASTER].param) - free(ch->device[MASTER].param, M_ATA); + kfree(ch->device[MASTER].param, M_ATA); ch->device[MASTER].param = NULL; } if (misdev & ATA_ATA_SLAVE || misdev & ATA_ATAPI_SLAVE) { if (ch->device[SLAVE].param) - free(ch->device[SLAVE].param, M_ATA); + kfree(ch->device[SLAVE].param, M_ATA); ch->device[SLAVE].param = NULL; } } @@ -1423,7 +1423,7 @@ ata_prtdev(struct ata_device *atadev, const char * fmt, ...) void ata_set_name(struct ata_device *atadev, char *name, int lun) { - atadev->name = malloc(strlen(name) + 4, M_ATA, M_INTWAIT); + atadev->name = kmalloc(strlen(name) + 4, M_ATA, M_INTWAIT); sprintf(atadev->name, "%s%d", name, lun); } @@ -1431,7 +1431,7 @@ void ata_free_name(struct ata_device *atadev) { if (atadev->name) - free(atadev->name, M_ATA); + kfree(atadev->name, M_ATA); atadev->name = NULL; } @@ -1580,14 +1580,14 @@ ata_init(void) make_dev(&ata_ops, 0, UID_ROOT, GID_OPERATOR, 0600, "ata"); /* register boot attach to be run when interrupts are enabled */ - ata_delayed_attach = malloc(sizeof(struct intr_config_hook), + ata_delayed_attach = kmalloc(sizeof(struct intr_config_hook), M_TEMP, M_WAITOK | M_ZERO); ata_delayed_attach->ich_func = (void*)ata_boot_attach; ata_delayed_attach->ich_desc = "ata"; if (config_intrhook_establish(ata_delayed_attach) != 0) { printf("ata: config_intrhook_establish failed\n"); - free(ata_delayed_attach, M_TEMP); + kfree(ata_delayed_attach, M_TEMP); } } SYSINIT(atadev, SI_SUB_DRIVERS, SI_ORDER_SECOND, ata_init, NULL) diff --git a/sys/dev/disk/ata/ata-disk.c b/sys/dev/disk/ata/ata-disk.c index d54d19917d..1537d2b150 100644 --- a/sys/dev/disk/ata/ata-disk.c +++ b/sys/dev/disk/ata/ata-disk.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ata/ata-disk.c,v 1.60.2.24 2003/01/30 07:19:59 sos Exp $ - * $DragonFly: src/sys/dev/disk/ata/ata-disk.c,v 1.29 2006/07/28 02:17:35 dillon Exp $ + * $DragonFly: src/sys/dev/disk/ata/ata-disk.c,v 1.30 2006/09/05 00:55:37 dillon Exp $ */ #include "opt_ata.h" @@ -108,7 +108,7 @@ ad_attach(struct ata_device *atadev, int alreadylocked) struct ad_softc *adp; dev_t dev; - adp = malloc(sizeof(struct ad_softc), M_AD, M_WAITOK | M_ZERO); + adp = kmalloc(sizeof(struct ad_softc), M_AD, M_WAITOK | M_ZERO); KKASSERT(atadev->channel->req_mpipe.max_count != 0); @@ -264,7 +264,7 @@ ad_detach(struct ata_device *atadev, int flush) /* get rid of flush XXX SOS */ ata_free_lun(&adp_lun_map, adp->lun); atadev->driver = NULL; atadev->flags = 0; - free(adp, M_AD); + kfree(adp, M_AD); } static int diff --git a/sys/dev/disk/ata/ata-pci.c b/sys/dev/disk/ata/ata-pci.c index eba516ed0e..f0530242c1 100644 --- a/sys/dev/disk/ata/ata-pci.c +++ b/sys/dev/disk/ata/ata-pci.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ata/ata-pci.c,v 1.32.2.15 2003/06/06 13:27:05 fjoe Exp $ - * $DragonFly: src/sys/dev/disk/ata/ata-pci.c,v 1.22 2006/03/28 22:18:59 dillon Exp $ + * $DragonFly: src/sys/dev/disk/ata/ata-pci.c,v 1.23 2006/09/05 00:55:37 dillon Exp $ */ #include @@ -74,11 +74,11 @@ ata_find_dev(device_t dev, u_int32_t devid, u_int32_t revid) for (i = 0; i < nchildren; i++) { if (pci_get_devid(children[i]) == devid && pci_get_revid(children[i]) >= revid) { - free(children, M_TEMP); + kfree(children, M_TEMP); return 1; } } - free(children, M_TEMP); + kfree(children, M_TEMP); return 0; } @@ -107,7 +107,7 @@ ata_via_southbridge_fixup(device_t dev) break; } } - free(children, M_TEMP); + kfree(children, M_TEMP); } static const char * @@ -946,7 +946,7 @@ ata_pcisub_probe(device_t dev) if (children[i] == dev) ch->unit = i; } - free(children, M_TEMP); + kfree(children, M_TEMP); ch->chiptype = pci_get_devid(device_get_parent(dev)); ch->intr_func = ata_pci_intr; return ata_probe(dev); diff --git a/sys/dev/disk/ata/ata-raid.c b/sys/dev/disk/ata/ata-raid.c index 7c90619df1..c44ce152b6 100644 --- a/sys/dev/disk/ata/ata-raid.c +++ b/sys/dev/disk/ata/ata-raid.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ata/ata-raid.c,v 1.3.2.19 2003/01/30 07:19:59 sos Exp $ - * $DragonFly: src/sys/dev/disk/ata/ata-raid.c,v 1.21 2006/07/28 02:17:35 dillon Exp $ + * $DragonFly: src/sys/dev/disk/ata/ata-raid.c,v 1.22 2006/09/05 00:55:37 dillon Exp $ */ #include "opt_ata.h" @@ -107,7 +107,7 @@ ata_raiddisk_attach(struct ad_softc *adp) } if (!ar_table) { - ar_table = malloc(sizeof(struct ar_soft *) * MAX_ARRAYS, + ar_table = kmalloc(sizeof(struct ar_soft *) * MAX_ARRAYS, M_AR, M_WAITOK | M_ZERO); } @@ -238,7 +238,7 @@ ata_raid_create(struct raid_setup *setup) int ctlr = 0, disk_size = 0, total_disks = 0; if (!ar_table) { - ar_table = malloc(sizeof(struct ar_soft *) * MAX_ARRAYS, + ar_table = kmalloc(sizeof(struct ar_soft *) * MAX_ARRAYS, M_AR, M_WAITOK | M_ZERO); } for (array = 0; array < MAX_ARRAYS; array++) { @@ -248,14 +248,14 @@ ata_raid_create(struct raid_setup *setup) if (array >= MAX_ARRAYS) return ENOSPC; - rdp = malloc(sizeof(struct ar_softc), M_AR, M_WAITOK | M_ZERO); + rdp = kmalloc(sizeof(struct ar_softc), M_AR, M_WAITOK | M_ZERO); for (disk = 0; disk < setup->total_disks; disk++) { if ((atadev = ar_locate_disk(setup->disks[disk]))) { rdp->disks[disk].device = atadev; if (AD_SOFTC(rdp->disks[disk])->flags & AD_F_RAID_SUBDISK) { setup->disks[disk] = -1; - free(rdp, M_AR); + kfree(rdp, M_AR); return EBUSY; } @@ -279,7 +279,7 @@ ata_raid_create(struct raid_setup *setup) if ((rdp->flags & (AR_F_PROMISE_RAID|AR_F_HIGHPOINT_RAID)) && (rdp->flags & (AR_F_PROMISE_RAID|AR_F_HIGHPOINT_RAID)) != (ctlr & (AR_F_PROMISE_RAID|AR_F_HIGHPOINT_RAID))) { - free(rdp, M_AR); + kfree(rdp, M_AR); return EXDEV; } else @@ -296,12 +296,12 @@ ata_raid_create(struct raid_setup *setup) } else { setup->disks[disk] = -1; - free(rdp, M_AR); + kfree(rdp, M_AR); return ENXIO; } } if (!total_disks) { - free(rdp, M_AR); + kfree(rdp, M_AR); return ENODEV; } @@ -312,14 +312,14 @@ ata_raid_create(struct raid_setup *setup) case 2: rdp->flags |= AR_F_RAID1; if (total_disks != 2) { - free(rdp, M_AR); + kfree(rdp, M_AR); return EPERM; } break; case 3: rdp->flags |= (AR_F_RAID0 | AR_F_RAID1); if (total_disks % 2 != 0) { - free(rdp, M_AR); + kfree(rdp, M_AR); return EPERM; } break; @@ -392,7 +392,7 @@ ata_raid_delete(int array) ar_highpoint_write_conf(rdp); disk_invalidate(&rdp->disk); disk_destroy(&rdp->disk); - free(rdp, M_AR); + kfree(rdp, M_AR); ar_table[array] = NULL; return 0; } @@ -541,7 +541,7 @@ arstrategy(struct dev_strategy_args *ap) return(0); } - buf1 = malloc(sizeof(struct ar_buf), M_AR, M_INTWAIT | M_ZERO); + buf1 = kmalloc(sizeof(struct ar_buf), M_AR, M_INTWAIT | M_ZERO); BUF_LOCKINIT(&buf1->bp); BUF_LOCK(&buf1->bp, LK_EXCLUSIVE); initbufbio(&buf1->bp); @@ -565,7 +565,7 @@ arstrategy(struct dev_strategy_args *ap) !AD_SOFTC(rdp->disks[buf1->drive])->dev) { rdp->disks[buf1->drive].flags &= ~AR_DF_ONLINE; ar_config_changed(rdp, 1); - free(buf1, M_AR); + kfree(buf1, M_AR); bp->b_flags |= B_ERROR; bp->b_error = EIO; biodone(bio); @@ -601,7 +601,7 @@ arstrategy(struct dev_strategy_args *ap) ar_config_changed(rdp, 1); if (!(rdp->flags & AR_F_READY)) { - free(buf1, M_AR); + kfree(buf1, M_AR); bp->b_flags |= B_ERROR; bp->b_error = EIO; biodone(bio); @@ -624,7 +624,7 @@ arstrategy(struct dev_strategy_args *ap) ((rdp->flags & AR_F_REBUILDING) && (rdp->disks[buf1->drive].flags & AR_DF_SPARE) && buf1_blkno < rdp->lock_start)) { - buf2 = malloc(sizeof(struct ar_buf), M_AR, M_INTWAIT); + buf2 = kmalloc(sizeof(struct ar_buf), M_AR, M_INTWAIT); bcopy(buf1, buf2, sizeof(struct ar_buf)); BUF_LOCKINIT(&buf2->bp); BUF_LOCK(&buf2->bp, LK_EXCLUSIVE); @@ -725,7 +725,7 @@ ar_done(struct bio *bio) default: printf("ar%d: unknown array type in ar_done\n", rdp->lun); } - free(buf, M_AR); + kfree(buf, M_AR); } static void @@ -829,7 +829,7 @@ ar_rebuild(struct ar_softc *rdp) rdp->lock_end = rdp->lock_start + 256; rdp->flags |= AR_F_REBUILDING; crit_exit(); - buffer = malloc(256 * DEV_BSIZE, M_AR, M_WAITOK | M_ZERO); + buffer = kmalloc(256 * DEV_BSIZE, M_AR, M_WAITOK | M_ZERO); /* now go copy entire disk(s) */ while (rdp->lock_end < (rdp->total_sectors / rdp->width)) { @@ -864,7 +864,7 @@ ar_rebuild(struct ar_softc *rdp) } if (error) { wakeup(rdp); - free(buffer, M_AR); + kfree(buffer, M_AR); return error; } crit_enter(); @@ -873,7 +873,7 @@ ar_rebuild(struct ar_softc *rdp) crit_exit(); wakeup(rdp); } - free(buffer, M_AR); + kfree(buffer, M_AR); for (disk = 0; disk < rdp->total_disks; disk++) { if ((rdp->disks[disk].flags&(AR_DF_PRESENT|AR_DF_ONLINE|AR_DF_SPARE))== (AR_DF_PRESENT | AR_DF_SPARE)) { @@ -897,7 +897,7 @@ ar_highpoint_read_conf(struct ad_softc *adp, struct ar_softc **raidp) struct ar_softc *raid = NULL; int array, disk_number = 0, retval = 0; - info = malloc(sizeof(struct highpoint_raid_conf), M_AR, M_INTWAIT|M_ZERO); + info = kmalloc(sizeof(struct highpoint_raid_conf), M_AR, M_INTWAIT|M_ZERO); if (ar_rw(adp, HPT_LBA, sizeof(struct highpoint_raid_conf), (caddr_t)info, AR_READ | AR_WAIT)) { @@ -923,7 +923,7 @@ ar_highpoint_read_conf(struct ad_softc *adp, struct ar_softc **raidp) /* now convert HighPoint config info into our generic form */ for (array = 0; array < MAX_ARRAYS; array++) { if (!raidp[array]) { - raidp[array] = malloc(sizeof(struct ar_softc), M_AR, + raidp[array] = kmalloc(sizeof(struct ar_softc), M_AR, M_INTWAIT | M_ZERO); } raid = raidp[array]; @@ -1022,7 +1022,7 @@ highpoint_raid01: break; } highpoint_out: - free(info, M_AR); + kfree(info, M_AR); return retval; } @@ -1038,7 +1038,7 @@ ar_highpoint_write_conf(struct ar_softc *rdp) rdp->magic_1 = timestamp.tv_sec; for (disk = 0; disk < rdp->total_disks; disk++) { - config = malloc(sizeof(struct highpoint_raid_conf), + config = kmalloc(sizeof(struct highpoint_raid_conf), M_AR, M_INTWAIT | M_ZERO); if ((rdp->disks[disk].flags & (AR_DF_PRESENT | AR_DF_ONLINE)) == (AR_DF_PRESENT | AR_DF_ONLINE)) @@ -1115,7 +1115,7 @@ ar_promise_read_conf(struct ad_softc *adp, struct ar_softc **raidp, int local) u_int32_t magic, cksum, *ckptr; int array, count, disk, disksum = 0, retval = 0; - info = malloc(sizeof(struct promise_raid_conf), M_AR, M_INTWAIT | M_ZERO); + info = kmalloc(sizeof(struct promise_raid_conf), M_AR, M_INTWAIT | M_ZERO); if (ar_rw(adp, PR_LBA(adp), sizeof(struct promise_raid_conf), (caddr_t)info, AR_READ | AR_WAIT)) { @@ -1158,7 +1158,7 @@ ar_promise_read_conf(struct ad_softc *adp, struct ar_softc **raidp, int local) for (array = 0; array < MAX_ARRAYS; array++) { if (!raidp[array]) { - raidp[array] = malloc(sizeof(struct ar_softc), M_AR, + raidp[array] = kmalloc(sizeof(struct ar_softc), M_AR, M_INTWAIT | M_ZERO); } raid = raidp[array]; @@ -1236,7 +1236,7 @@ ar_promise_read_conf(struct ad_softc *adp, struct ar_softc **raidp, int local) raid->disks[disk].flags &= ~AR_DF_ONLINE; } if (!disksum) { - free(raidp[array], M_AR); + kfree(raidp[array], M_AR); raidp[array] = NULL; goto promise_out; } @@ -1252,7 +1252,7 @@ ar_promise_read_conf(struct ad_softc *adp, struct ar_softc **raidp, int local) break; } promise_out: - free(info, M_AR); + kfree(info, M_AR); return retval; } @@ -1269,7 +1269,7 @@ ar_promise_write_conf(struct ar_softc *rdp) microtime(×tamp); for (disk = 0; disk < rdp->total_disks; disk++) { - config = malloc(sizeof(struct promise_raid_conf), M_AR, M_INTWAIT); + config = kmalloc(sizeof(struct promise_raid_conf), M_AR, M_INTWAIT); for (count = 0; count < sizeof(struct promise_raid_conf); count++) *(((u_int8_t *)config) + count) = 255 - (count % 256); @@ -1382,8 +1382,8 @@ ar_rw_done(struct bio *bio) { struct buf *bp = bio->bio_buf; - free(bp->b_data, M_AR); - free(bp, M_AR); + kfree(bp->b_data, M_AR); + kfree(bp, M_AR); } static int @@ -1392,7 +1392,7 @@ ar_rw(struct ad_softc *adp, u_int32_t lba, int count, caddr_t data, int flags) struct buf *bp; int retry = 0, error = 0; - bp = malloc(sizeof(struct buf), M_AR, M_INTWAIT|M_ZERO); + bp = kmalloc(sizeof(struct buf), M_AR, M_INTWAIT|M_ZERO); BUF_LOCKINIT(bp); BUF_LOCK(bp, LK_EXCLUSIVE); initbufbio(bp); @@ -1416,7 +1416,7 @@ ar_rw(struct ad_softc *adp, u_int32_t lba, int count, caddr_t data, int flags) error = tsleep(&bp->b_bio1, 0, "arrw", 10); if (!error && (bp->b_flags & B_ERROR)) error = bp->b_error; - free(bp, M_AR); + kfree(bp, M_AR); } return error; } diff --git a/sys/dev/disk/ata/atapi-all.c b/sys/dev/disk/ata/atapi-all.c index 1628702964..b8a13cfe18 100644 --- a/sys/dev/disk/ata/atapi-all.c +++ b/sys/dev/disk/ata/atapi-all.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ata/atapi-all.c,v 1.46.2.18 2002/10/31 23:10:33 thomas Exp $ - * $DragonFly: src/sys/dev/disk/ata/atapi-all.c,v 1.16 2006/02/17 19:17:54 dillon Exp $ + * $DragonFly: src/sys/dev/disk/ata/atapi-all.c,v 1.17 2006/09/05 00:55:37 dillon Exp $ */ #include "opt_ata.h" @@ -96,7 +96,7 @@ atapi_attach(struct ata_device *atadev, int alreadylocked) -1, -1); ATA_UNLOCK_CH(atadev->channel); - atadev->result = malloc(sizeof(struct atapi_reqsense), M_ATAPI, + atadev->result = kmalloc(sizeof(struct atapi_reqsense), M_ATAPI, M_INTWAIT | M_ZERO); switch (atadev->param->type) { @@ -122,7 +122,7 @@ atapi_attach(struct ata_device *atadev, int alreadylocked) #if NATAPICAM == 0 ata_prtdev(atadev, "<%.40s/%.8s> - NO DRIVER!\n", atadev->param->model, atadev->param->revision); - free(atadev->result, M_ATAPI); + kfree(atadev->result, M_ATAPI); atadev->driver = NULL; #endif } @@ -164,9 +164,9 @@ atapi_detach(struct ata_device *atadev) biodone(bio); } ata_dmafree(atadev); - free(request, M_ATAPI); + kfree(request, M_ATAPI); } - free(atadev->result, M_ATAPI); + kfree(atadev->result, M_ATAPI); atadev->driver = NULL; atadev->flags = 0; @@ -180,7 +180,7 @@ atapi_queue_cmd(struct ata_device *atadev, int8_t *ccb, caddr_t data, struct atapi_request *request; int error; - request = malloc(sizeof(struct atapi_request), M_ATAPI, M_INTWAIT|M_ZERO); + request = kmalloc(sizeof(struct atapi_request), M_ATAPI, M_INTWAIT|M_ZERO); request->device = atadev; request->data = data; request->bytecount = count; @@ -224,7 +224,7 @@ atapi_queue_cmd(struct ata_device *atadev, int8_t *ccb, caddr_t data, error = request->error; if (error) bcopy(&request->sense, atadev->result, sizeof(struct atapi_reqsense)); - free(request, M_ATAPI); + kfree(request, M_ATAPI); return error; } @@ -615,7 +615,7 @@ atapi_finish(struct atapi_request *request) #endif if (request->callback) { if (!((request->callback)(request))) { - free(request, M_ATAPI); + kfree(request, M_ATAPI); } } else diff --git a/sys/dev/disk/ata/atapi-cam.c b/sys/dev/disk/ata/atapi-cam.c index c08013e2dd..dcb675066f 100644 --- a/sys/dev/disk/ata/atapi-cam.c +++ b/sys/dev/disk/ata/atapi-cam.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ata/atapi-cam.c,v 1.10.2.3 2003/05/21 09:24:55 thomas Exp $ - * $DragonFly: src/sys/dev/disk/ata/atapi-cam.c,v 1.8 2005/06/03 21:56:23 swildner Exp $ + * $DragonFly: src/sys/dev/disk/ata/atapi-cam.c,v 1.9 2006/09/05 00:55:37 dillon Exp $ */ #include @@ -119,7 +119,7 @@ atapi_cam_attach_bus(struct ata_channel *ata_ch) return; } - scp = malloc(sizeof(struct atapi_xpt_softc), M_ATACAM, M_INTWAIT | M_ZERO); + scp = kmalloc(sizeof(struct atapi_xpt_softc), M_ATACAM, M_INTWAIT | M_ZERO); scp->ata_ch = ata_ch; TAILQ_INIT(&scp->pending_hcbs); LIST_INSERT_HEAD(&all_buses, scp, chain); @@ -485,7 +485,7 @@ atapi_action(struct cam_sim *sim, union ccb *ccb) if ((ccb_h->flags & CAM_DIR_MASK) == CAM_DIR_IN && (len & 1)) { /* ATA always transfers an even number of bytes */ ++len; - buf = hcb->dxfer_alloc = malloc(len, M_ATACAM, M_INTWAIT | M_ZERO); + buf = hcb->dxfer_alloc = kmalloc(len, M_ATACAM, M_INTWAIT | M_ZERO); } crit_enter(); TAILQ_INSERT_TAIL(&softc->pending_hcbs, hcb, chain); @@ -628,14 +628,14 @@ cam_rescan_callback(struct cam_periph *periph, union ccb *ccb) ("Rescan succeeded\n")); } xpt_free_path(ccb->ccb_h.path); - free(ccb, M_ATACAM); + kfree(ccb, M_ATACAM); } static void cam_rescan(struct cam_sim *sim) { struct cam_path *path; - union ccb *ccb = malloc(sizeof(union ccb), M_ATACAM, M_INTWAIT | M_ZERO); + union ccb *ccb = kmalloc(sizeof(union ccb), M_ATACAM, M_INTWAIT | M_ZERO); if (xpt_create_path(&path, xpt_periph, cam_sim_path(sim), CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) @@ -655,7 +655,7 @@ allocate_hcb(struct atapi_xpt_softc *softc, int unit, int bus, union ccb *ccb) { struct atapi_hcb *hcb; - hcb = malloc(sizeof(struct atapi_hcb), M_ATACAM, M_INTWAIT | M_ZERO); + hcb = kmalloc(sizeof(struct atapi_hcb), M_ATACAM, M_INTWAIT | M_ZERO); if (hcb != NULL) { hcb->softc = softc; @@ -671,8 +671,8 @@ free_hcb(struct atapi_hcb *hcb) { TAILQ_REMOVE(&hcb->softc->pending_hcbs, hcb, chain); if (hcb->dxfer_alloc != NULL) - free(hcb->dxfer_alloc, M_ATACAM); - free(hcb, M_ATACAM); + kfree(hcb->dxfer_alloc, M_ATACAM); + kfree(hcb, M_ATACAM); } static void @@ -700,7 +700,7 @@ free_softc(struct atapi_xpt_softc *scp) cam_sim_name(scp->sim)); } LIST_REMOVE(scp, chain); - free(scp, M_ATACAM); + kfree(scp, M_ATACAM); } } diff --git a/sys/dev/disk/ata/atapi-cd.c b/sys/dev/disk/ata/atapi-cd.c index dbf14135df..45768408e4 100644 --- a/sys/dev/disk/ata/atapi-cd.c +++ b/sys/dev/disk/ata/atapi-cd.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ata/atapi-cd.c,v 1.48.2.20 2002/11/25 05:30:31 njl Exp $ - * $DragonFly: src/sys/dev/disk/ata/atapi-cd.c,v 1.23 2006/07/28 02:17:35 dillon Exp $ + * $DragonFly: src/sys/dev/disk/ata/atapi-cd.c,v 1.24 2006/09/05 00:55:37 dillon Exp $ */ #include "opt_ata.h" @@ -126,7 +126,7 @@ acdattach(struct ata_device *atadev) sizeof(struct changer)>>8, sizeof(struct changer), 0, 0, 0, 0, 0, 0 }; - chp = malloc(sizeof(struct changer), M_ACD, M_WAITOK | M_ZERO); + chp = kmalloc(sizeof(struct changer), M_ACD, M_WAITOK | M_ZERO); if (!atapi_queue_cmd(cdp->device, ccb, (caddr_t)chp, sizeof(struct changer), ATPR_F_READ, 60, NULL, NULL)) { @@ -136,7 +136,7 @@ acdattach(struct ata_device *atadev) int count; chp->table_length = htons(chp->table_length); - cdparr = malloc(sizeof(struct acd_softc) * chp->slots, + cdparr = kmalloc(sizeof(struct acd_softc) * chp->slots, M_ACD, M_WAITOK); for (count = 0; count < chp->slots; count++) { if (count > 0) { @@ -156,12 +156,12 @@ acdattach(struct ata_device *atadev) DEVSTAT_TYPE_CDROM | DEVSTAT_TYPE_IF_IDE, DEVSTAT_PRIORITY_CD); } - name = malloc(strlen(atadev->name) + 2, M_ACD, M_WAITOK); + name = kmalloc(strlen(atadev->name) + 2, M_ACD, M_WAITOK); strcpy(name, atadev->name); strcat(name, "-"); ata_free_name(atadev); ata_set_name(atadev, name, cdp->lun + cdp->changer_info->slots - 1); - free(name, M_ACD); + kfree(name, M_ACD); } } else { @@ -198,15 +198,15 @@ acddetach(struct ata_device *atadev) while ((entry = TAILQ_FIRST(&cdp->driver[subdev]->dev_list))) { release_dev(entry->dev); TAILQ_REMOVE(&cdp->driver[subdev]->dev_list, entry, chain); - free(entry, M_ACD); + kfree(entry, M_ACD); } devstat_remove_entry(cdp->driver[subdev]->stats); - free(cdp->driver[subdev]->stats, M_ACD); + kfree(cdp->driver[subdev]->stats, M_ACD); ata_free_lun(&acd_lun_map, cdp->driver[subdev]->lun); - free(cdp->driver[subdev], M_ACD); + kfree(cdp->driver[subdev], M_ACD); } - free(cdp->driver, M_ACD); - free(cdp->changer_info, M_ACD); + kfree(cdp->driver, M_ACD); + kfree(cdp->changer_info, M_ACD); } while ((bio = bioq_first(&cdp->bio_queue))) { bio->bio_buf->b_flags |= B_ERROR; @@ -216,15 +216,15 @@ acddetach(struct ata_device *atadev) while ((entry = TAILQ_FIRST(&cdp->dev_list))) { release_dev(entry->dev); TAILQ_REMOVE(&cdp->dev_list, entry, chain); - free(entry, M_ACD); + kfree(entry, M_ACD); } release_dev(cdp->dev); devstat_remove_entry(cdp->stats); dev_ops_remove(&acd_ops, dkunitmask(), dkmakeunit(cdp->lun)); - free(cdp->stats, M_ACD); + kfree(cdp->stats, M_ACD); ata_free_name(atadev); ata_free_lun(&acd_lun_map, cdp->lun); - free(cdp, M_ACD); + kfree(cdp, M_ACD); atadev->driver = NULL; } @@ -233,7 +233,7 @@ acd_init_lun(struct ata_device *atadev) { struct acd_softc *cdp; - cdp = malloc(sizeof(struct acd_softc), M_ACD, M_WAITOK | M_ZERO); + cdp = kmalloc(sizeof(struct acd_softc), M_ACD, M_WAITOK | M_ZERO); TAILQ_INIT(&cdp->dev_list); bioq_init(&cdp->bio_queue); cdp->device = atadev; @@ -241,7 +241,7 @@ acd_init_lun(struct ata_device *atadev) cdp->block_size = 2048; cdp->slot = -1; cdp->changer_info = NULL; - cdp->stats = malloc(sizeof(struct devstat), M_ACD, M_WAITOK | M_ZERO); + cdp->stats = kmalloc(sizeof(struct devstat), M_ACD, M_WAITOK | M_ZERO); return cdp; } @@ -659,7 +659,7 @@ acdioctl(struct dev_ioctl_args *ap) if (te->address_format == CD_MSF_FORMAT) { struct cd_toc_entry *entry; - toc = malloc(sizeof(struct toc), M_ACD, M_WAITOK | M_ZERO); + toc = kmalloc(sizeof(struct toc), M_ACD, M_WAITOK | M_ZERO); bcopy(&cdp->toc, toc, sizeof(struct toc)); entry = toc->tab + (toc->hdr.ending_track + 1 - toc->hdr.starting_track) + 1; @@ -670,7 +670,7 @@ acdioctl(struct dev_ioctl_args *ap) error = copyout(toc->tab + starting_track - toc->hdr.starting_track, te->data, len); if (te->address_format == CD_MSF_FORMAT) - free(toc, M_ACD); + kfree(toc, M_ACD); break; } case CDIOREADTOCENTRY: @@ -704,7 +704,7 @@ acdioctl(struct dev_ioctl_args *ap) if (te->address_format == CD_MSF_FORMAT) { struct cd_toc_entry *entry; - toc = malloc(sizeof(struct toc), M_ACD, M_WAITOK | M_ZERO); + toc = kmalloc(sizeof(struct toc), M_ACD, M_WAITOK | M_ZERO); bcopy(&cdp->toc, toc, sizeof(struct toc)); entry = toc->tab + (track - toc->hdr.starting_track); @@ -714,7 +714,7 @@ acdioctl(struct dev_ioctl_args *ap) bcopy(toc->tab + track - toc->hdr.starting_track, &te->entry, sizeof(struct cd_toc_entry)); if (te->address_format == CD_MSF_FORMAT) - free(toc, M_ACD); + kfree(toc, M_ACD); } break; @@ -844,7 +844,7 @@ acdioctl(struct dev_ioctl_args *ap) #ifndef CD_BUFFER_BLOCKS #define CD_BUFFER_BLOCKS 13 #endif - if (!(buffer = malloc(CD_BUFFER_BLOCKS * 2352, M_ACD, M_WAITOK))){ + if (!(buffer = kmalloc(CD_BUFFER_BLOCKS * 2352, M_ACD, M_WAITOK))){ error = ENOMEM; break; } @@ -875,7 +875,7 @@ acdioctl(struct dev_ioctl_args *ap) frames -= blocks; lba += blocks; } - free(buffer, M_ACD); + kfree(buffer, M_ACD); if (args->address_format == CD_LBA_FORMAT) args->address.lba = lba; else if (args->address_format == CD_MSF_FORMAT) @@ -1323,13 +1323,13 @@ acd_read_toc(struct acd_softc *cdp) while ((entry = TAILQ_FIRST(&cdp->dev_list))) { destroy_dev(entry->dev); TAILQ_REMOVE(&cdp->dev_list, entry, chain); - free(entry, M_ACD); + kfree(entry, M_ACD); } for (track = 1; track <= ntracks; track ++) { char name[16]; sprintf(name, "acd%dt%d", cdp->lun, track); - entry = malloc(sizeof(struct acd_devlist), M_ACD, M_WAITOK | M_ZERO); + entry = kmalloc(sizeof(struct acd_devlist), M_ACD, M_WAITOK | M_ZERO); entry->dev = make_dev(&acd_ops, (cdp->lun << 3) | (track << 16), 0, 0, 0644, name, NULL); entry->dev->si_drv1 = cdp->dev->si_drv1; @@ -1639,7 +1639,7 @@ acd_send_cue(struct acd_softc *cdp, struct cdr_cuesheet *cuesheet) if ((error = acd_mode_select(cdp, (caddr_t)¶m, param.page_length + 10))) return error; - buffer = malloc(cuesheet->len, M_ACD, M_WAITOK); + buffer = kmalloc(cuesheet->len, M_ACD, M_WAITOK); if (!buffer) return ENOMEM; if ((error = copyin(cuesheet->entries, buffer, cuesheet->len))) @@ -1655,7 +1655,7 @@ acd_send_cue(struct acd_softc *cdp, struct cdr_cuesheet *cuesheet) #endif error = atapi_queue_cmd(cdp->device, ccb, buffer, cuesheet->len, 0, 30, NULL, NULL); - free(buffer, M_ACD); + kfree(buffer, M_ACD); return error; } @@ -1702,13 +1702,13 @@ acd_report_key(struct acd_softc *cdp, struct dvd_authinfo *ai) ccb[8] = (length >> 8) & 0xff; ccb[9] = length & 0xff; - d = malloc(length, M_ACD, M_WAITOK | M_ZERO); + d = kmalloc(length, M_ACD, M_WAITOK | M_ZERO); d->length = htons(length - 2); error = atapi_queue_cmd(cdp->device, ccb, (caddr_t)d, length, ATPR_F_READ, 10, NULL, NULL); if (error) { - free(d, M_ACD); + kfree(d, M_ACD); return(error); } @@ -1751,7 +1751,7 @@ acd_report_key(struct acd_softc *cdp, struct dvd_authinfo *ai) default: error = EINVAL; } - free(d, M_ACD); + kfree(d, M_ACD); return error; } @@ -1766,19 +1766,19 @@ acd_send_key(struct acd_softc *cdp, struct dvd_authinfo *ai) switch (ai->format) { case DVD_SEND_CHALLENGE: length = 16; - d = malloc(length, M_ACD, M_WAITOK | M_ZERO); + d = kmalloc(length, M_ACD, M_WAITOK | M_ZERO); bcopy(ai->keychal, &d->data[0], 10); break; case DVD_SEND_KEY2: length = 12; - d = malloc(length, M_ACD, M_WAITOK | M_ZERO); + d = kmalloc(length, M_ACD, M_WAITOK | M_ZERO); bcopy(&ai->keychal[0], &d->data[0], 5); break; case DVD_SEND_RPC: length = 8; - d = malloc(length, M_ACD, M_WAITOK | M_ZERO); + d = kmalloc(length, M_ACD, M_WAITOK | M_ZERO); d->data[0] = ai->region; break; @@ -1794,7 +1794,7 @@ acd_send_key(struct acd_softc *cdp, struct dvd_authinfo *ai) d->length = htons(length - 2); error = atapi_queue_cmd(cdp->device, ccb, (caddr_t)d, length, 0, 10, NULL, NULL); - free(d, M_ACD); + kfree(d, M_ACD); return error; } @@ -1841,7 +1841,7 @@ acd_read_structure(struct acd_softc *cdp, struct dvd_struct *s) return EINVAL; } - d = malloc(length, M_ACD, M_WAITOK | M_ZERO); + d = kmalloc(length, M_ACD, M_WAITOK | M_ZERO); d->length = htons(length - 2); bzero(ccb, sizeof(ccb)); @@ -1854,7 +1854,7 @@ acd_read_structure(struct acd_softc *cdp, struct dvd_struct *s) error = atapi_queue_cmd(cdp->device, ccb, (caddr_t)d, length, ATPR_F_READ, 30, NULL, NULL); if (error) { - free(d, M_ACD); + kfree(d, M_ACD); return error; } @@ -1900,7 +1900,7 @@ acd_read_structure(struct acd_softc *cdp, struct dvd_struct *s) default: error = EINVAL; } - free(d, M_ACD); + kfree(d, M_ACD); return error; } diff --git a/sys/dev/disk/ata/atapi-fd.c b/sys/dev/disk/ata/atapi-fd.c index 9f93347b99..1f03e1ec17 100644 --- a/sys/dev/disk/ata/atapi-fd.c +++ b/sys/dev/disk/ata/atapi-fd.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ata/atapi-fd.c,v 1.44.2.9 2002/07/31 11:19:26 sos Exp $ - * $DragonFly: src/sys/dev/disk/ata/atapi-fd.c,v 1.16 2006/07/28 02:17:35 dillon Exp $ + * $DragonFly: src/sys/dev/disk/ata/atapi-fd.c,v 1.17 2006/09/05 00:55:37 dillon Exp $ */ #include @@ -82,7 +82,7 @@ afdattach(struct ata_device *atadev) struct afd_softc *fdp; dev_t dev; - fdp = malloc(sizeof(struct afd_softc), M_AFD, M_WAITOK | M_ZERO); + fdp = kmalloc(sizeof(struct afd_softc), M_AFD, M_WAITOK | M_ZERO); if (!fdp) { ata_prtdev(atadev, "out of memory\n"); return 0; @@ -94,7 +94,7 @@ afdattach(struct ata_device *atadev) bioq_init(&fdp->bio_queue); if (afd_sense(fdp)) { - free(fdp, M_AFD); + kfree(fdp, M_AFD); return 0; } @@ -137,7 +137,7 @@ afddetach(struct ata_device *atadev) devstat_remove_entry(&fdp->stats); ata_free_name(atadev); ata_free_lun(&afd_lun_map, fdp->lun); - free(fdp, M_AFD); + kfree(fdp, M_AFD); atadev->driver = NULL; } diff --git a/sys/dev/disk/ata/atapi-tape.c b/sys/dev/disk/ata/atapi-tape.c index ef57b0d05a..fd2e91f10d 100644 --- a/sys/dev/disk/ata/atapi-tape.c +++ b/sys/dev/disk/ata/atapi-tape.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ata/atapi-tape.c,v 1.36.2.12 2002/07/31 11:19:26 sos Exp $ - * $DragonFly: src/sys/dev/disk/ata/atapi-tape.c,v 1.16 2006/07/28 02:17:35 dillon Exp $ + * $DragonFly: src/sys/dev/disk/ata/atapi-tape.c,v 1.17 2006/09/05 00:55:37 dillon Exp $ */ #include "opt_ata.h" @@ -92,7 +92,7 @@ astattach(struct ata_device *atadev) struct ast_readposition position; dev_t dev; - stp = malloc(sizeof(struct ast_softc), M_AST, M_WAITOK | M_ZERO); + stp = kmalloc(sizeof(struct ast_softc), M_AST, M_WAITOK | M_ZERO); if (!stp) { ata_prtdev(atadev, "out of memory\n"); return 0; @@ -104,7 +104,7 @@ astattach(struct ata_device *atadev) bioq_init(&stp->bio_queue); if (ast_sense(stp)) { - free(stp, M_AST); + kfree(stp, M_AST); return 0; } @@ -161,7 +161,7 @@ astdetach(struct ata_device *atadev) dev_ops_remove(&ast_ops, dkunitmask(), dkmakeunit(stp->lun)); ata_free_name(atadev); ata_free_lun(&ast_lun_map, stp->lun); - free(stp, M_AST); + kfree(stp, M_AST); atadev->driver = NULL; } diff --git a/sys/dev/disk/buslogic/bt.c b/sys/dev/disk/buslogic/bt.c index ef90db8b7c..9a3bd4e2bd 100644 --- a/sys/dev/disk/buslogic/bt.c +++ b/sys/dev/disk/buslogic/bt.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/buslogic/bt.c,v 1.25.2.1 2000/08/02 22:32:26 peter Exp $ - * $DragonFly: src/sys/dev/disk/buslogic/bt.c,v 1.11 2005/10/12 17:35:50 dillon Exp $ + * $DragonFly: src/sys/dev/disk/buslogic/bt.c,v 1.12 2006/09/05 00:55:37 dillon Exp $ */ /* @@ -248,7 +248,7 @@ bt_free_softc(device_t dev) sg_map->sg_dmamap); bus_dmamem_free(bt->sg_dmat, sg_map->sg_vaddr, sg_map->sg_dmamap); - free(sg_map, M_DEVBUF); + kfree(sg_map, M_DEVBUF); } bus_dma_tag_destroy(bt->sg_dmat); } @@ -965,12 +965,12 @@ btallocccbs(struct bt_softc *bt) next_ccb = &bt->bt_ccb_array[bt->num_ccbs]; - sg_map = malloc(sizeof(*sg_map), M_DEVBUF, M_WAITOK); + sg_map = kmalloc(sizeof(*sg_map), M_DEVBUF, M_WAITOK); /* Allocate S/G space for the next batch of CCBS */ if (bus_dmamem_alloc(bt->sg_dmat, (void **)&sg_map->sg_vaddr, BUS_DMA_NOWAIT, &sg_map->sg_dmamap) != 0) { - free(sg_map, M_DEVBUF); + kfree(sg_map, M_DEVBUF); goto error_exit; } diff --git a/sys/dev/disk/ccd/ccd.c b/sys/dev/disk/ccd/ccd.c index 860ba3a0ce..b270f2dcc2 100644 --- a/sys/dev/disk/ccd/ccd.c +++ b/sys/dev/disk/ccd/ccd.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/dev/ccd/ccd.c,v 1.73.2.1 2001/09/11 09:49:52 kris Exp $ */ -/* $DragonFly: src/sys/dev/disk/ccd/ccd.c,v 1.34 2006/08/12 00:26:17 dillon Exp $ */ +/* $DragonFly: src/sys/dev/disk/ccd/ccd.c,v 1.35 2006/09/05 00:55:37 dillon Exp $ */ /* $NetBSD: ccd.c,v 1.22 1995/12/08 19:13:26 thorpej Exp $ */ @@ -238,7 +238,7 @@ getccdbuf(void) --numccdfreebufs; reinitbufbio(&cbp->cb_buf); } else { - cbp = malloc(sizeof(struct ccdbuf), M_DEVBUF, M_WAITOK|M_ZERO); + cbp = kmalloc(sizeof(struct ccdbuf), M_DEVBUF, M_WAITOK|M_ZERO); initbufbio(&cbp->cb_buf); } @@ -272,7 +272,7 @@ putccdbuf(struct ccdbuf *cbp) ccdfreebufs = cbp; ++numccdfreebufs; } else { - free((caddr_t)cbp, M_DEVBUF); + kfree((caddr_t)cbp, M_DEVBUF); } } @@ -302,9 +302,9 @@ ccdattach(void) else printf("ccd0: Concatenated disk driver\n"); - ccd_softc = malloc(num * sizeof(struct ccd_softc), M_DEVBUF, + ccd_softc = kmalloc(num * sizeof(struct ccd_softc), M_DEVBUF, M_WAITOK | M_ZERO); - ccddevs = malloc(num * sizeof(struct ccddevice), M_DEVBUF, + ccddevs = kmalloc(num * sizeof(struct ccddevice), M_DEVBUF, M_WAITOK | M_ZERO); numccd = num; @@ -389,7 +389,7 @@ ccdinit(struct ccddevice *ccd, char **cpaths, struct ucred *cred) #endif goto fail; } - ci->ci_path = malloc(ci->ci_pathlen, M_DEVBUF, M_WAITOK); + ci->ci_path = kmalloc(ci->ci_pathlen, M_DEVBUF, M_WAITOK); bcopy(tmppath, ci->ci_path, ci->ci_pathlen); ci->ci_dev = vn_todev(vp); @@ -533,9 +533,9 @@ ccdinit(struct ccddevice *ccd, char **cpaths, struct ucred *cred) fail: while (ci > cs->sc_cinfo) { ci--; - free(ci->ci_path, M_DEVBUF); + kfree(ci->ci_path, M_DEVBUF); } - free(cs->sc_cinfo, M_DEVBUF); + kfree(cs->sc_cinfo, M_DEVBUF); return (error); } @@ -561,7 +561,7 @@ ccdinterleave(struct ccd_softc *cs, int unit) * Chances are this is too big, but we don't care. */ size = (cs->sc_nccdisks + 1) * sizeof(struct ccdiinfo); - cs->sc_itable = (struct ccdiinfo *)malloc(size, M_DEVBUF, M_WAITOK); + cs->sc_itable = (struct ccdiinfo *)kmalloc(size, M_DEVBUF, M_WAITOK); bzero((caddr_t)cs->sc_itable, size); /* @@ -576,7 +576,7 @@ ccdinterleave(struct ccd_softc *cs, int unit) for (ix = 0; ix < cs->sc_nccdisks; ix++) { /* Allocate space for ii_index. */ - ii->ii_index = malloc(sizeof(int), M_DEVBUF, M_WAITOK); + ii->ii_index = kmalloc(sizeof(int), M_DEVBUF, M_WAITOK); ii->ii_ndisk = 1; ii->ii_startblk = bn; ii->ii_startoff = 0; @@ -1323,8 +1323,8 @@ ccdioctl(struct dev_ioctl_args *ap) error = copyin((caddr_t)ccio->ccio_disks, (caddr_t)cpp, ccio->ccio_ndisks * sizeof(char **)); if (error) { - free(vpp, M_DEVBUF); - free(cpp, M_DEVBUF); + kfree(vpp, M_DEVBUF); + kfree(cpp, M_DEVBUF); ccdunlock(cs); return (error); } @@ -1344,8 +1344,8 @@ ccdioctl(struct dev_ioctl_args *ap) if ((error = ccdlookup(cpp[i], &vpp[i])) != 0) { for (j = 0; j < lookedup; ++j) (void)vn_close(vpp[j], FREAD|FWRITE); - free(vpp, M_DEVBUF); - free(cpp, M_DEVBUF); + kfree(vpp, M_DEVBUF); + kfree(cpp, M_DEVBUF); ccdunlock(cs); return (error); } @@ -1362,8 +1362,8 @@ ccdioctl(struct dev_ioctl_args *ap) for (j = 0; j < lookedup; ++j) (void)vn_close(vpp[j], FREAD|FWRITE); bzero(&ccd_softc[unit], sizeof(struct ccd_softc)); - free(vpp, M_DEVBUF); - free(cpp, M_DEVBUF); + kfree(vpp, M_DEVBUF); + kfree(cpp, M_DEVBUF); ccdunlock(cs); return (error); } @@ -1416,23 +1416,23 @@ ccdioctl(struct dev_ioctl_args *ap) cs->sc_cinfo[i].ci_vp); #endif (void)vn_close(cs->sc_cinfo[i].ci_vp, FREAD|FWRITE); - free(cs->sc_cinfo[i].ci_path, M_DEVBUF); + kfree(cs->sc_cinfo[i].ci_path, M_DEVBUF); } /* Free interleave index. */ for (i = 0; cs->sc_itable[i].ii_ndisk; ++i) - free(cs->sc_itable[i].ii_index, M_DEVBUF); + kfree(cs->sc_itable[i].ii_index, M_DEVBUF); /* Free component info and interleave table. */ - free(cs->sc_cinfo, M_DEVBUF); - free(cs->sc_itable, M_DEVBUF); + kfree(cs->sc_cinfo, M_DEVBUF); + kfree(cs->sc_itable, M_DEVBUF); cs->sc_flags &= ~CCDF_INITED; /* * Free ccddevice information and clear entry. */ - free(ccddevs[unit].ccd_cpp, M_DEVBUF); - free(ccddevs[unit].ccd_vpp, M_DEVBUF); + kfree(ccddevs[unit].ccd_cpp, M_DEVBUF); + kfree(ccddevs[unit].ccd_vpp, M_DEVBUF); ccd.ccd_dk = -1; bcopy(&ccd, &ccddevs[unit], sizeof(ccd)); diff --git a/sys/dev/disk/fd/fd.c b/sys/dev/disk/fd/fd.c index af21f65c51..7d284e5cb9 100644 --- a/sys/dev/disk/fd/fd.c +++ b/sys/dev/disk/fd/fd.c @@ -51,7 +51,7 @@ * * from: @(#)fd.c 7.4 (Berkeley) 5/25/91 * $FreeBSD: src/sys/isa/fd.c,v 1.176.2.8 2002/05/15 21:56:14 joerg Exp $ - * $DragonFly: src/sys/dev/disk/fd/fd.c,v 1.31 2006/07/28 02:17:35 dillon Exp $ + * $DragonFly: src/sys/dev/disk/fd/fd.c,v 1.32 2006/09/05 00:55:37 dillon Exp $ * */ @@ -758,7 +758,7 @@ fdc_add_child(device_t dev, const char *name, int unit) struct fdc_ivars *ivar; device_t child; - ivar = malloc(sizeof *ivar, M_DEVBUF /* XXX */, M_WAITOK | M_ZERO); + ivar = kmalloc(sizeof *ivar, M_DEVBUF /* XXX */, M_WAITOK | M_ZERO); if (resource_int_value(name, unit, "drive", &ivar->fdunit) != 0) ivar->fdunit = 0; child = device_add_child(dev, name, unit); diff --git a/sys/dev/disk/isp/isp_freebsd.c b/sys/dev/disk/isp/isp_freebsd.c index 8406bb255f..5074736498 100644 --- a/sys/dev/disk/isp/isp_freebsd.c +++ b/sys/dev/disk/isp/isp_freebsd.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/dev/isp/isp_freebsd.c,v 1.32.2.20 2002/10/11 18:49:25 mjacob Exp $ */ -/* $DragonFly: src/sys/dev/disk/isp/isp_freebsd.c,v 1.14 2006/07/28 02:17:35 dillon Exp $ */ +/* $DragonFly: src/sys/dev/disk/isp/isp_freebsd.c,v 1.15 2006/09/05 00:55:37 dillon Exp $ */ /* * Platform (FreeBSD) dependent common attachment code for Qlogic adapters. * @@ -659,11 +659,11 @@ create_lun_state(struct ispsoftc *isp, int bus, if (is_lun_enabled(isp, bus, lun)) { return (CAM_LUN_ALRDY_ENA); } - new = malloc(sizeof (tstate_t), M_DEVBUF, M_WAITOK | M_ZERO); + new = kmalloc(sizeof (tstate_t), M_DEVBUF, M_WAITOK | M_ZERO); status = xpt_create_path(&new->owner, NULL, xpt_path_path_id(path), xpt_path_target_id(path), xpt_path_lun_id(path)); if (status != CAM_REQ_CMP) { - free(new, M_DEVBUF); + kfree(new, M_DEVBUF); return (status); } new->bus = bus; @@ -715,7 +715,7 @@ destroy_lun_state(struct ispsoftc *isp, tstate_t *tptr) return; } } - free(tptr, M_DEVBUF); + kfree(tptr, M_DEVBUF); } /* diff --git a/sys/dev/disk/isp/isp_pci.c b/sys/dev/disk/isp/isp_pci.c index 1f895d1c81..55a371347e 100644 --- a/sys/dev/disk/isp/isp_pci.c +++ b/sys/dev/disk/isp/isp_pci.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/dev/isp/isp_pci.c,v 1.78.2.4 2002/10/11 18:50:53 mjacob Exp $ */ -/* $DragonFly: src/sys/dev/disk/isp/isp_pci.c,v 1.9 2006/09/03 17:43:56 dillon Exp $ */ +/* $DragonFly: src/sys/dev/disk/isp/isp_pci.c,v 1.10 2006/09/05 00:55:37 dillon Exp $ */ /* * PCI specific probe and attach routines for Qlogic ISP SCSI adapters. * FreeBSD Version. @@ -366,7 +366,7 @@ isp_pci_attach(device_t dev) } } - pcs = malloc(sizeof (struct isp_pcisoftc), M_DEVBUF, M_WAITOK | M_ZERO); + pcs = kmalloc(sizeof (struct isp_pcisoftc), M_DEVBUF, M_WAITOK | M_ZERO); /* * Figure out which we should try first - memory mapping or i/o mapping? @@ -503,7 +503,7 @@ isp_pci_attach(device_t dev) PCI_MBOX_REGS2300_OFF; } isp = &pcs->pci_isp; - isp->isp_param = malloc(psize, M_DEVBUF, M_WAITOK | M_ZERO); + isp->isp_param = kmalloc(psize, M_DEVBUF, M_WAITOK | M_ZERO); isp->isp_mdvec = mdvp; isp->isp_type = basetype; isp->isp_revision = pci_get_revid(dev); @@ -654,7 +654,7 @@ isp_pci_attach(device_t dev) } if (amt) { FCPARAM(isp)->isp_dump_data = - malloc(amt, M_DEVBUF, M_WAITOK); + kmalloc(amt, M_DEVBUF, M_WAITOK); bzero(FCPARAM(isp)->isp_dump_data, amt); } else { device_printf(dev, @@ -731,8 +731,8 @@ bad: if (pcs) { if (pcs->pci_isp.isp_param) - free(pcs->pci_isp.isp_param, M_DEVBUF); - free(pcs, M_DEVBUF); + kfree(pcs->pci_isp.isp_param, M_DEVBUF); + kfree(pcs, M_DEVBUF); } /* @@ -1054,17 +1054,17 @@ isp_pci_mbxdma(struct ispsoftc *isp) len = sizeof (XS_T **) * isp->isp_maxcmds; - isp->isp_xflist = (XS_T **) malloc(len, M_DEVBUF, M_WAITOK | M_ZERO); + isp->isp_xflist = (XS_T **) kmalloc(len, M_DEVBUF, M_WAITOK | M_ZERO); if (isp->isp_xflist == NULL) { isp_prt(isp, ISP_LOGERR, "cannot alloc xflist array"); ISP_LOCK(isp); return (1); } len = sizeof (bus_dmamap_t) * isp->isp_maxcmds; - pcs->dmaps = (bus_dmamap_t *) malloc(len, M_DEVBUF, M_WAITOK); + pcs->dmaps = (bus_dmamap_t *) kmalloc(len, M_DEVBUF, M_WAITOK); if (pcs->dmaps == NULL) { isp_prt(isp, ISP_LOGERR, "can't alloc dma map storage"); - free(isp->isp_xflist, M_DEVBUF); + kfree(isp->isp_xflist, M_DEVBUF); ISP_LOCK(isp); return (1); } @@ -1083,8 +1083,8 @@ isp_pci_mbxdma(struct ispsoftc *isp) NULL, NULL, len, ns, slim, 0, &isp->isp_cdmat)) { isp_prt(isp, ISP_LOGERR, "cannot create a dma tag for control spaces"); - free(pcs->dmaps, M_DEVBUF); - free(isp->isp_xflist, M_DEVBUF); + kfree(pcs->dmaps, M_DEVBUF); + kfree(isp->isp_xflist, M_DEVBUF); ISP_LOCK(isp); return (1); } @@ -1094,8 +1094,8 @@ isp_pci_mbxdma(struct ispsoftc *isp) isp_prt(isp, ISP_LOGERR, "cannot allocate %d bytes of CCB memory", len); bus_dma_tag_destroy(isp->isp_cdmat); - free(isp->isp_xflist, M_DEVBUF); - free(pcs->dmaps, M_DEVBUF); + kfree(isp->isp_xflist, M_DEVBUF); + kfree(pcs->dmaps, M_DEVBUF); ISP_LOCK(isp); return (1); } @@ -1134,8 +1134,8 @@ isp_pci_mbxdma(struct ispsoftc *isp) bad: bus_dmamem_free(isp->isp_cdmat, base, isp->isp_cdmap); bus_dma_tag_destroy(isp->isp_cdmat); - free(isp->isp_xflist, M_DEVBUF); - free(pcs->dmaps, M_DEVBUF); + kfree(isp->isp_xflist, M_DEVBUF); + kfree(pcs->dmaps, M_DEVBUF); ISP_LOCK(isp); isp->isp_rquest = NULL; return (1); diff --git a/sys/dev/disk/ispfw/ispfw.c b/sys/dev/disk/ispfw/ispfw.c index 0e7aee975e..9d6aa6ac51 100644 --- a/sys/dev/disk/ispfw/ispfw.c +++ b/sys/dev/disk/ispfw/ispfw.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/dev/ispfw/ispfw.c,v 1.2.2.5 2002/10/12 00:13:09 mjacob Exp $ */ -/* $DragonFly: src/sys/dev/disk/ispfw/ispfw.c,v 1.5 2004/03/15 01:10:43 dillon Exp $ */ +/* $DragonFly: src/sys/dev/disk/ispfw/ispfw.c,v 1.6 2006/09/05 00:55:37 dillon Exp $ */ /* * ISP Firmware Helper Pseudo Device for FreeBSD * @@ -80,7 +80,7 @@ addcaller(const u_int16_t **caller) } newcallp[ncallers] = caller; if (ncallers++) - free(callp, M_DEVBUF); + kfree(callp, M_DEVBUF); callp = newcallp; return (1); } @@ -146,7 +146,7 @@ isp_module_handler(module_t mod, int what, void *arg) for (i = 0; i < ncallers; i++) { *callp[i] = NULL; } - free(callp, M_DEVBUF); + kfree(callp, M_DEVBUF); } break; default: diff --git a/sys/dev/disk/mpt/mpt_pci.c b/sys/dev/disk/mpt/mpt_pci.c index 5b8083ca28..9651c55eb9 100644 --- a/sys/dev/disk/mpt/mpt_pci.c +++ b/sys/dev/disk/mpt/mpt_pci.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/dev/mpt/mpt_pci.c,v 1.3.2.3 2002/09/24 21:37:25 mjacob Exp $ */ -/* $DragonFly: src/sys/dev/disk/mpt/mpt_pci.c,v 1.7 2006/09/03 17:43:57 dillon Exp $ */ +/* $DragonFly: src/sys/dev/disk/mpt/mpt_pci.c,v 1.8 2006/09/05 00:55:37 dillon Exp $ */ /* * PCI specific probe and attach routines for LSI '909 FC adapters. * FreeBSD Version. @@ -455,7 +455,7 @@ mpt_dma_mem_alloc(mpt_softc_t *mpt) len = sizeof (request_t *) * MPT_REQ_MEM_SIZE(mpt); #ifdef RELENG_4 - mpt->request_pool = (request_t *) malloc(len, M_DEVBUF, M_WAITOK); + mpt->request_pool = (request_t *) kmalloc(len, M_DEVBUF, M_WAITOK); if (mpt->request_pool == NULL) { device_printf(dev, "cannot allocate request pool\n"); return (1); @@ -463,7 +463,7 @@ mpt_dma_mem_alloc(mpt_softc_t *mpt) bzero(mpt->request_pool, len); #else mpt->request_pool = (request_t *) - malloc(len, M_DEVBUF, M_WAITOK | M_ZERO); + kmalloc(len, M_DEVBUF, M_WAITOK | M_ZERO); if (mpt->request_pool == NULL) { device_printf(dev, "cannot allocate request pool\n"); return (1); @@ -614,7 +614,7 @@ mpt_dma_mem_free(mpt_softc_t *mpt) bus_dma_tag_destroy(mpt->reply_dmat); bus_dma_tag_destroy(mpt->parent_dmat); mpt->reply_dmat = 0; - free(mpt->request_pool, M_DEVBUF); + kfree(mpt->request_pool, M_DEVBUF); mpt->request_pool = 0; } diff --git a/sys/dev/disk/ncr/ncr.c b/sys/dev/disk/ncr/ncr.c index 04b0a6cbeb..9ef3d357f7 100644 --- a/sys/dev/disk/ncr/ncr.c +++ b/sys/dev/disk/ncr/ncr.c @@ -1,7 +1,7 @@ /************************************************************************** ** ** $FreeBSD: src/sys/pci/ncr.c,v 1.155.2.3 2001/03/05 13:09:10 obrien Exp $ -** $DragonFly: src/sys/dev/disk/ncr/ncr.c,v 1.13 2006/08/03 16:40:47 swildner Exp $ +** $DragonFly: src/sys/dev/disk/ncr/ncr.c,v 1.14 2006/09/05 00:55:38 dillon Exp $ ** ** Device driver for the NCR 53C8XX PCI-SCSI-Controller Family. ** @@ -3598,7 +3598,7 @@ ncr_attach (device_t dev) 0, 0xffffffff, PAGE_SIZE); } else { np->script = (struct script *) - malloc (sizeof (struct script), M_DEVBUF, M_WAITOK); + kmalloc (sizeof (struct script), M_DEVBUF, M_WAITOK); } /* XXX JGibbs - Use contigmalloc */ @@ -3609,7 +3609,7 @@ ncr_attach (device_t dev) } else { np->scripth = (struct scripth *) - malloc (sizeof (struct scripth), M_DEVBUF, M_WAITOK); + kmalloc (sizeof (struct scripth), M_DEVBUF, M_WAITOK); } #ifdef SCSI_NCR_PCI_CONFIG_FIXUP @@ -6525,7 +6525,7 @@ ncr_alloc_nccb (ncb_p np, u_long target, u_long lun) /* ** Allocate a lcb */ - lp = malloc (sizeof (struct lcb), M_DEVBUF, M_WAITOK | M_ZERO); + lp = kmalloc (sizeof (struct lcb), M_DEVBUF, M_WAITOK | M_ZERO); /* ** Initialize it @@ -6552,7 +6552,7 @@ ncr_alloc_nccb (ncb_p np, u_long target, u_long lun) /* ** Allocate a nccb */ - cp = malloc (sizeof (struct nccb), M_DEVBUF, M_WAITOK | M_ZERO); + cp = kmalloc (sizeof (struct nccb), M_DEVBUF, M_WAITOK | M_ZERO); if (DEBUG_FLAGS & DEBUG_ALLOC) { printf ("new nccb @%p.\n", cp); diff --git a/sys/dev/disk/sbp/sbp.c b/sys/dev/disk/sbp/sbp.c index d5ff8ea4ca..3c6a751487 100644 --- a/sys/dev/disk/sbp/sbp.c +++ b/sys/dev/disk/sbp/sbp.c @@ -32,7 +32,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/firewire/sbp.c,v 1.74 2004/01/08 14:58:09 simokawa Exp $ - * $DragonFly: src/sys/dev/disk/sbp/sbp.c,v 1.16 2006/08/03 16:40:47 swildner Exp $ + * $DragonFly: src/sys/dev/disk/sbp/sbp.c,v 1.17 2006/09/05 00:55:38 dillon Exp $ * */ @@ -521,7 +521,7 @@ END_DEBUG if (sdev->dma.v_addr == NULL) { printf("%s: dma space allocation failed\n", __func__); - free(sdev, M_SBP); + kfree(sdev, M_SBP); target->luns[lun] = NULL; goto next; } @@ -963,7 +963,7 @@ END_DEBUG } sdev = sbp_next_dev(target, sdev->lun_id + 1); if (sdev == NULL) { - free(ccb, M_SBP); + kfree(ccb, M_SBP); return; } /* reuse ccb */ @@ -991,7 +991,7 @@ SBP_DEBUG(0) sbp_show_sdev_info(sdev, 2); printf("sbp_cam_scan_target\n"); END_DEBUG - ccb = malloc(sizeof(union ccb), M_SBP, M_WAITOK | M_ZERO); + ccb = kmalloc(sizeof(union ccb), M_SBP, M_WAITOK | M_ZERO); xpt_setup_ccb(&ccb->ccb_h, sdev->path, SCAN_PRI); ccb->ccb_h.func_code = XPT_SCAN_LUN; ccb->ccb_h.cbfcnp = sbp_cam_scan_lun; @@ -1994,7 +1994,7 @@ sbp_free_sdev(struct sbp_dev *sdev) bus_dmamap_destroy(sdev->target->sbp->dmat, sdev->ocb[i].dmamap); fwdma_free(sdev->target->sbp->fd.fc, &sdev->dma); - free(sdev, M_SBP); + kfree(sdev, M_SBP); } static void @@ -2017,7 +2017,7 @@ sbp_free_target(struct sbp_target *target) fw_xfer_free_buf(xfer); } STAILQ_INIT(&target->xferlist); - free(target->luns, M_SBP); + kfree(target->luns, M_SBP); target->num_lun = 0; target->luns = NULL; target->fwdev = NULL; @@ -2183,7 +2183,7 @@ sbp_timeout(void *arg) /* XXX give up */ sbp_cam_detach_target(target); if (target->luns != NULL) - free(target->luns, M_SBP); + kfree(target->luns, M_SBP); target->num_lun = 0; target->luns = NULL; target->fwdev = NULL; diff --git a/sys/dev/disk/simos/simos.c b/sys/dev/disk/simos/simos.c index 0941504560..23f6523ad4 100644 --- a/sys/dev/disk/simos/simos.c +++ b/sys/dev/disk/simos/simos.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/pci/simos.c,v 1.7 1999/08/28 00:51:06 peter Exp $ - * $DragonFly: src/sys/dev/disk/simos/Attic/simos.c,v 1.6 2005/06/06 21:48:16 eirikn Exp $ + * $DragonFly: src/sys/dev/disk/simos/Attic/simos.c,v 1.7 2006/09/05 00:55:38 dillon Exp $ */ #include @@ -104,7 +104,7 @@ simos_attach(pcici_t config_id, int unit) struct simos_softc* sc; struct cam_devq *devq; - sc = malloc(sizeof(struct simos_softc), M_DEVBUF, M_WAITOK); + sc = kmalloc(sizeof(struct simos_softc), M_DEVBUF, M_WAITOK); simosp[unit] = sc; bzero(sc, sizeof *sc); diff --git a/sys/dev/disk/sym/sym_hipd.c b/sys/dev/disk/sym/sym_hipd.c index 9399db2839..ed96926ed9 100644 --- a/sys/dev/disk/sym/sym_hipd.c +++ b/sys/dev/disk/sym/sym_hipd.c @@ -56,7 +56,7 @@ */ /* $FreeBSD: src/sys/dev/sym/sym_hipd.c,v 1.6.2.12 2001/12/02 19:01:10 groudier Exp $ */ -/* $DragonFly: src/sys/dev/disk/sym/sym_hipd.c,v 1.16 2005/10/12 17:35:50 dillon Exp $ */ +/* $DragonFly: src/sys/dev/disk/sym/sym_hipd.c,v 1.17 2006/09/05 00:55:38 dillon Exp $ */ #define SYM_DRIVER_NAME "sym-1.6.5-20000902" @@ -458,8 +458,8 @@ static void MDELAY(int ms) { while (ms--) UDELAY(1000); } #define MEMO_CLUSTER_SIZE (1UL << MEMO_CLUSTER_SHIFT) #define MEMO_CLUSTER_MASK (MEMO_CLUSTER_SIZE-1) -#define get_pages() malloc(MEMO_CLUSTER_SIZE, M_DEVBUF, M_INTWAIT) -#define free_pages(p) free((p), M_DEVBUF) +#define get_pages() kmalloc(MEMO_CLUSTER_SIZE, M_DEVBUF, M_INTWAIT) +#define free_pages(p) kfree((p), M_DEVBUF) typedef u_long m_addr_t; /* Enough bits to bit-hack addresses */ diff --git a/sys/dev/disk/vn/vn.c b/sys/dev/disk/vn/vn.c index e15d99646a..de4917feef 100644 --- a/sys/dev/disk/vn/vn.c +++ b/sys/dev/disk/vn/vn.c @@ -39,7 +39,7 @@ * * from: @(#)vn.c 8.6 (Berkeley) 4/1/94 * $FreeBSD: src/sys/dev/vn/vn.c,v 1.105.2.4 2001/11/18 07:11:00 dillon Exp $ - * $DragonFly: src/sys/dev/disk/vn/vn.c,v 1.26 2006/08/12 00:26:18 dillon Exp $ + * $DragonFly: src/sys/dev/disk/vn/vn.c,v 1.27 2006/09/05 00:55:38 dillon Exp $ */ /* @@ -176,7 +176,7 @@ vnfindvn(dev_t dev) } } if (vn == NULL) { - vn = malloc(sizeof *vn, M_DEVBUF, M_WAITOK | M_ZERO); + vn = kmalloc(sizeof *vn, M_DEVBUF, M_WAITOK | M_ZERO); vn->sc_unit = unit; dev->si_drv1 = vn; vn->sc_devlist = make_dev(&vn_ops, 0, UID_ROOT, @@ -708,7 +708,7 @@ vnsetcred(struct vn_softc *vn, struct ucred *cred) struct uio auio; struct iovec aiov; - tmpbuf = malloc(vn->sc_secsize, M_TEMP, M_WAITOK); + tmpbuf = kmalloc(vn->sc_secsize, M_TEMP, M_WAITOK); bzero(&auio, sizeof(auio)); aiov.iov_base = tmpbuf; @@ -722,7 +722,7 @@ vnsetcred(struct vn_softc *vn, struct ucred *cred) vn_lock(vn->sc_vp, LK_EXCLUSIVE | LK_RETRY); error = VOP_READ(vn->sc_vp, &auio, 0, vn->sc_cred); vn_unlock(vn->sc_vp); - free(tmpbuf, M_TEMP); + kfree(tmpbuf, M_TEMP); } return (error); } @@ -790,7 +790,7 @@ vn_modevent(module_t mod, int type, void *data) dev->si_drv1 = dev->si_drv2 = NULL; destroy_dev(dev); } - free(vn, M_DEVBUF); + kfree(vn, M_DEVBUF); } dev_ops_remove(&vn_ops, 0, 0); break; diff --git a/sys/dev/disk/vpo/immio.c b/sys/dev/disk/vpo/immio.c index 2f7bea79cc..64da805a81 100644 --- a/sys/dev/disk/vpo/immio.c +++ b/sys/dev/disk/vpo/immio.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ppbus/immio.c,v 1.10.2.3 2001/10/02 05:27:20 nsouch Exp $ - * $DragonFly: src/sys/dev/disk/vpo/immio.c,v 1.5 2004/03/15 01:10:44 dillon Exp $ + * $DragonFly: src/sys/dev/disk/vpo/immio.c,v 1.6 2006/09/05 00:55:38 dillon Exp $ * */ @@ -583,7 +583,7 @@ imm_attach(struct vpoio_data *vpo) /* * Initialize microsequence code */ - vpo->vpo_nibble_inbyte_msq = malloc(sizeof(nibble_inbyte_submicroseq), + vpo->vpo_nibble_inbyte_msq = kmalloc(sizeof(nibble_inbyte_submicroseq), M_DEVBUF, M_WAITOK); bcopy((void *)nibble_inbyte_submicroseq, diff --git a/sys/dev/disk/vpo/vpo.c b/sys/dev/disk/vpo/vpo.c index 1902cf68d0..5f0efa71fc 100644 --- a/sys/dev/disk/vpo/vpo.c +++ b/sys/dev/disk/vpo/vpo.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ppbus/vpo.c,v 1.20.2.1 2000/05/07 21:08:18 n_hibma Exp $ - * $DragonFly: src/sys/dev/disk/vpo/vpo.c,v 1.6 2005/10/28 03:25:43 dillon Exp $ + * $DragonFly: src/sys/dev/disk/vpo/vpo.c,v 1.7 2006/09/05 00:55:38 dillon Exp $ */ #include @@ -175,14 +175,14 @@ vpo_attach(device_t dev) static void vpo_cam_rescan_callback(struct cam_periph *periph, union ccb *ccb) { - free(ccb, M_TEMP); + kfree(ccb, M_TEMP); } static void vpo_cam_rescan(struct vpo_data *vpo) { struct cam_path *path; - union ccb *ccb = malloc(sizeof(union ccb), M_TEMP, M_WAITOK); + union ccb *ccb = kmalloc(sizeof(union ccb), M_TEMP, M_WAITOK); bzero(ccb, sizeof(union ccb)); diff --git a/sys/dev/disk/wt/wt.c b/sys/dev/disk/wt/wt.c index 54f62ff17e..0da61258a2 100644 --- a/sys/dev/disk/wt/wt.c +++ b/sys/dev/disk/wt/wt.c @@ -21,7 +21,7 @@ * * Version 1.3, Thu Nov 11 12:09:13 MSK 1993 * $FreeBSD: src/sys/i386/isa/wt.c,v 1.57.2.1 2000/08/08 19:49:53 peter Exp $ - * $DragonFly: src/sys/dev/disk/wt/wt.c,v 1.16 2006/07/28 02:17:35 dillon Exp $ + * $DragonFly: src/sys/dev/disk/wt/wt.c,v 1.17 2006/09/05 00:55:38 dillon Exp $ * */ @@ -334,7 +334,7 @@ wtopen (struct dev_open_args *ap) return (ENXIO); t->bsize = (minor (dev) & WT_BSIZE) ? 1024 : 512; - t->buf = malloc (t->bsize, M_TEMP, M_WAITOK); + t->buf = kmalloc (t->bsize, M_TEMP, M_WAITOK); if (! t->buf) return (EAGAIN); @@ -392,7 +392,7 @@ wtclose (struct dev_close_args *ap) wtreadfm (t); done: t->flags &= TPREW | TPRMARK | TPSTART | TPTIMER; - free (t->buf, M_TEMP); + kfree (t->buf, M_TEMP); isa_dma_release(t->chan); return (0); } diff --git a/sys/dev/misc/atkbdc_layer/atkbdc_isa.c b/sys/dev/misc/atkbdc_layer/atkbdc_isa.c index 1fb238d72b..8a45dad054 100644 --- a/sys/dev/misc/atkbdc_layer/atkbdc_isa.c +++ b/sys/dev/misc/atkbdc_layer/atkbdc_isa.c @@ -24,7 +24,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/isa/atkbdc_isa.c,v 1.14.2.1 2000/03/31 12:52:05 yokota Exp $ - * $DragonFly: src/sys/dev/misc/atkbdc_layer/atkbdc_isa.c,v 1.4 2004/05/13 19:44:32 dillon Exp $ + * $DragonFly: src/sys/dev/misc/atkbdc_layer/atkbdc_isa.c,v 1.5 2006/09/05 00:55:38 dillon Exp $ */ #include "opt_kbd.h" @@ -147,7 +147,7 @@ atkbdc_add_device(device_t dev, const char *name, int unit) if (resource_int_value(name, unit, "disabled", &t) == 0 && t != 0) return; - kdev = malloc(sizeof(struct atkbdc_device), M_ATKBDDEV, + kdev = kmalloc(sizeof(struct atkbdc_device), M_ATKBDDEV, M_WAITOK | M_ZERO); if (resource_int_value(name, unit, "irq", &t) == 0) diff --git a/sys/dev/misc/gpib/gpib.c b/sys/dev/misc/gpib/gpib.c index 114f69952b..58506c7018 100644 --- a/sys/dev/misc/gpib/gpib.c +++ b/sys/dev/misc/gpib/gpib.c @@ -17,7 +17,7 @@ * all derivative works or modified versions. * * $FreeBSD: src/sys/i386/isa/gpib.c,v 1.29 2000/01/29 16:17:32 peter Exp $ - * $DragonFly: src/sys/dev/misc/gpib/gpib.c,v 1.11 2006/07/28 02:17:36 dillon Exp $ + * $DragonFly: src/sys/dev/misc/gpib/gpib.c,v 1.12 2006/09/05 00:55:38 dillon Exp $ * */ /*Please read the README file for usage information*/ @@ -163,7 +163,7 @@ gpopen(struct dev_open_args *ap) } /* Have memory for buffer? */ - sc->sc_inbuf = malloc(BUFSIZE, M_DEVBUF, M_WAITOK); + sc->sc_inbuf = kmalloc(BUFSIZE, M_DEVBUF, M_WAITOK); if (sc->sc_inbuf == 0) return(ENOMEM); @@ -303,7 +303,7 @@ while (!(inb(ISR1)&2)&&(status==EWOULDBLOCK)); } closegpib(); sc->sc_flags = ATTACHED; - free(sc->sc_inbuf, M_DEVBUF); + kfree(sc->sc_inbuf, M_DEVBUF); sc->sc_inbuf = 0; /* Sanity */ return(0); } diff --git a/sys/dev/misc/kbd/atkbd.c b/sys/dev/misc/kbd/atkbd.c index 56c213cb70..f67d6efa53 100644 --- a/sys/dev/misc/kbd/atkbd.c +++ b/sys/dev/misc/kbd/atkbd.c @@ -24,7 +24,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/kbd/atkbd.c,v 1.25.2.4 2002/04/08 19:21:38 asmodai Exp $ - * $DragonFly: src/sys/dev/misc/kbd/atkbd.c,v 1.10 2006/08/03 16:40:47 swildner Exp $ + * $DragonFly: src/sys/dev/misc/kbd/atkbd.c,v 1.11 2006/09/05 00:55:38 dillon Exp $ */ #include "opt_kbd.h" @@ -354,11 +354,11 @@ atkbd_init(int unit, keyboard_t **kbdp, void *arg, int flags) fkeymap_size = sizeof(default_fkeytab)/sizeof(default_fkeytab[0]); } else if (*kbdp == NULL) { - *kbdp = kbd = malloc(sizeof(*kbd), M_DEVBUF, M_WAITOK|M_ZERO); - state = malloc(sizeof(*state), M_DEVBUF, M_WAITOK|M_ZERO); - keymap = malloc(sizeof(key_map), M_DEVBUF, M_WAITOK); - accmap = malloc(sizeof(accent_map), M_DEVBUF, M_WAITOK); - fkeymap = malloc(sizeof(fkey_tab), M_DEVBUF, M_WAITOK); + *kbdp = kbd = kmalloc(sizeof(*kbd), M_DEVBUF, M_WAITOK|M_ZERO); + state = kmalloc(sizeof(*state), M_DEVBUF, M_WAITOK|M_ZERO); + keymap = kmalloc(sizeof(key_map), M_DEVBUF, M_WAITOK); + accmap = kmalloc(sizeof(accent_map), M_DEVBUF, M_WAITOK); + fkeymap = kmalloc(sizeof(fkey_tab), M_DEVBUF, M_WAITOK); fkeymap_size = sizeof(fkey_tab)/sizeof(fkey_tab[0]); } else if (KBD_IS_INITIALIZED(*kbdp) && KBD_IS_CONFIGURED(*kbdp)) { return 0; diff --git a/sys/dev/misc/kbd/atkbdc.c b/sys/dev/misc/kbd/atkbdc.c index 8532303225..08924235ab 100644 --- a/sys/dev/misc/kbd/atkbdc.c +++ b/sys/dev/misc/kbd/atkbdc.c @@ -28,7 +28,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/kbd/atkbdc.c,v 1.5.2.2 2002/03/31 11:02:02 murray Exp $ - * $DragonFly: src/sys/dev/misc/kbd/atkbdc.c,v 1.6 2005/10/30 23:00:56 swildner Exp $ + * $DragonFly: src/sys/dev/misc/kbd/atkbdc.c,v 1.7 2006/09/05 00:55:38 dillon Exp $ * from kbdio.c,v 1.13 1998/09/25 11:55:46 yokota Exp */ @@ -112,7 +112,7 @@ atkbdc_get_softc(int unit) return NULL; sc = atkbdc_softc[unit]; if (sc == NULL) { - sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO); + sc = kmalloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO); atkbdc_softc[unit] = sc; } return sc; diff --git a/sys/dev/misc/kbd/kbd.c b/sys/dev/misc/kbd/kbd.c index cce432cb1a..aee4069661 100644 --- a/sys/dev/misc/kbd/kbd.c +++ b/sys/dev/misc/kbd/kbd.c @@ -24,7 +24,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/kbd/kbd.c,v 1.17.2.2 2001/07/30 16:46:43 yokota Exp $ - * $DragonFly: src/sys/dev/misc/kbd/kbd.c,v 1.18 2006/09/03 17:31:53 dillon Exp $ + * $DragonFly: src/sys/dev/misc/kbd/kbd.c,v 1.19 2006/09/05 00:55:38 dillon Exp $ */ /* * Generic keyboard driver. @@ -91,16 +91,16 @@ kbd_realloc_array(void) int newsize; newsize = ((keyboards + ARRAY_DELTA)/ARRAY_DELTA)*ARRAY_DELTA; - new_kbd = malloc(sizeof(*new_kbd) * newsize, M_DEVBUF, + new_kbd = kmalloc(sizeof(*new_kbd) * newsize, M_DEVBUF, M_WAITOK | M_ZERO); - new_kbdsw = malloc(sizeof(*new_kbdsw) * newsize, M_DEVBUF, + new_kbdsw = kmalloc(sizeof(*new_kbdsw) * newsize, M_DEVBUF, M_WAITOK | M_ZERO); bcopy(keyboard, new_kbd, sizeof(*keyboard)*keyboards); bcopy(kbdsw, new_kbdsw, sizeof(*kbdsw)*keyboards); crit_enter(); if (keyboards > 1) { - free(keyboard, M_DEVBUF); - free(kbdsw, M_DEVBUF); + kfree(keyboard, M_DEVBUF); + kfree(kbdsw, M_DEVBUF); } keyboard = new_kbd; kbdsw = new_kbdsw; @@ -470,7 +470,7 @@ kbd_attach(keyboard_t *kbd) dev = make_dev(&kbd_ops, kbd->kb_index, UID_ROOT, GID_WHEEL, 0600, "kbd%r", kbd->kb_index); if (dev->si_drv1 == NULL) - dev->si_drv1 = malloc(sizeof(genkbd_softc_t), M_DEVBUF, + dev->si_drv1 = kmalloc(sizeof(genkbd_softc_t), M_DEVBUF, M_WAITOK); bzero(dev->si_drv1, sizeof(genkbd_softc_t)); @@ -494,7 +494,7 @@ kbd_detach(keyboard_t *kbd) */ if ((dev = make_adhoc_dev(&kbd_ops, kbd->kb_index)) != NODEV) { if (dev->si_drv1) { - free(dev->si_drv1, M_DEVBUF); + kfree(dev->si_drv1, M_DEVBUF); dev->si_drv1 = NULL; } } diff --git a/sys/dev/misc/labpc/labpc.c b/sys/dev/misc/labpc/labpc.c index 086c77177f..8c9ba092e7 100644 --- a/sys/dev/misc/labpc/labpc.c +++ b/sys/dev/misc/labpc/labpc.c @@ -39,7 +39,7 @@ * dufault@hda.com * * $FreeBSD: src/sys/i386/isa/labpc.c,v 1.35 1999/09/25 18:24:08 phk Exp $ - * $DragonFly: src/sys/dev/misc/labpc/labpc.c,v 1.17 2006/07/28 02:17:36 dillon Exp $ + * $DragonFly: src/sys/dev/misc/labpc/labpc.c,v 1.18 2006/09/05 00:55:38 dillon Exp $ * */ @@ -396,7 +396,7 @@ labpcinit(void) if (NLABPC > MAX_UNITS) return 0; - labpcs = malloc(NLABPC * sizeof(struct ctlr *), M_DEVBUF, + labpcs = kmalloc(NLABPC * sizeof(struct ctlr *), M_DEVBUF, M_WAITOK | M_ZERO); /* * XXX this is really odd code, adding the device only if @@ -454,7 +454,7 @@ labpcprobe(struct isa_device *dev) */ reset(ctlr); - l = malloc(sizeof(struct ctlr), M_DEVBUF, M_WAITOK | M_ZERO); + l = kmalloc(sizeof(struct ctlr), M_DEVBUF, M_WAITOK | M_ZERO); l->base = ctlr->base; l->unit = unit; labpcs[unit] = l; diff --git a/sys/dev/misc/lpt/lpt.c b/sys/dev/misc/lpt/lpt.c index 84f78aee10..263bed1886 100644 --- a/sys/dev/misc/lpt/lpt.c +++ b/sys/dev/misc/lpt/lpt.c @@ -49,7 +49,7 @@ * From Id: lpt.c,v 1.55.2.1 1996/11/12 09:08:38 phk Exp * From Id: nlpt.c,v 1.14 1999/02/08 13:55:43 des Exp * $FreeBSD: src/sys/dev/ppbus/lpt.c,v 1.15.2.3 2000/07/07 00:30:40 obrien Exp $ - * $DragonFly: src/sys/dev/misc/lpt/lpt.c,v 1.15 2006/07/28 02:17:36 dillon Exp $ + * $DragonFly: src/sys/dev/misc/lpt/lpt.c,v 1.16 2006/09/05 00:55:38 dillon Exp $ */ /* @@ -542,8 +542,8 @@ lptopen(struct dev_open_args *ap) ppb_wctr(ppbus, sc->sc_control); sc->sc_state = OPEN; - sc->sc_inbuf = malloc(BUFSIZE, M_LPT, M_WAITOK); - sc->sc_statbuf = malloc(BUFSTATSIZE, M_LPT, M_WAITOK); + sc->sc_inbuf = kmalloc(BUFSIZE, M_LPT, M_WAITOK); + sc->sc_statbuf = kmalloc(BUFSTATSIZE, M_LPT, M_WAITOK); sc->sc_xfercnt = 0; crit_exit(); @@ -601,8 +601,8 @@ lptclose(struct dev_close_args *ap) } callout_stop(&sc->sc_callout); ppb_wctr(ppbus, LPC_NINIT); - free(sc->sc_inbuf, M_LPT); - free(sc->sc_statbuf, M_LPT); + kfree(sc->sc_inbuf, M_LPT); + kfree(sc->sc_statbuf, M_LPT); end_close: /* release the bus anyway diff --git a/sys/dev/misc/nmdm/nmdm.c b/sys/dev/misc/nmdm/nmdm.c index c1e502f202..0722c729af 100644 --- a/sys/dev/misc/nmdm/nmdm.c +++ b/sys/dev/misc/nmdm/nmdm.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/nmdm/nmdm.c,v 1.5.2.1 2001/08/11 00:54:14 mp Exp $ - * $DragonFly: src/sys/dev/misc/nmdm/nmdm.c,v 1.13 2006/07/28 02:17:36 dillon Exp $ + * $DragonFly: src/sys/dev/misc/nmdm/nmdm.c,v 1.14 2006/09/05 00:55:38 dillon Exp $ */ /* @@ -128,7 +128,7 @@ nmdminit(int n) if (n & ~0x7f) return; - pt = malloc(sizeof(*pt), M_NLMDM, M_WAITOK); + pt = kmalloc(sizeof(*pt), M_NLMDM, M_WAITOK); bzero(pt, sizeof(*pt)); dev_ops_add(&nmdm_ops, ~1, n << 1); pt->part1.dev = dev1 = make_dev(&nmdm_ops, n << 1, diff --git a/sys/dev/misc/puc/puc.c b/sys/dev/misc/puc/puc.c index a0bd8ae98b..475999dfd5 100644 --- a/sys/dev/misc/puc/puc.c +++ b/sys/dev/misc/puc/puc.c @@ -1,7 +1,7 @@ /* * $NetBSD: puc.c,v 1.7 2000/07/29 17:43:38 jlam Exp $ * $FreeBSD: src/sys/dev/puc/puc.c,v 1.3.2.5 2003/04/04 08:42:17 sobomax Exp $ - * $DragonFly: src/sys/dev/misc/puc/puc.c,v 1.8 2005/10/12 17:35:51 dillon Exp $ + * $DragonFly: src/sys/dev/misc/puc/puc.c,v 1.9 2006/09/05 00:55:38 dillon Exp $ */ /*- @@ -299,7 +299,7 @@ puc_pci_attach(device_t dev) default: continue; } - pdev = malloc(sizeof(struct puc_device), M_DEVBUF, + pdev = kmalloc(sizeof(struct puc_device), M_DEVBUF, M_WAITOK | M_ZERO); resource_list_init(&pdev->resources); @@ -321,10 +321,10 @@ puc_pci_attach(device_t dev) if (sc->barmuxed == 0) { rle->res = sc->sc_bar_mappings[bidx].res; } else { - rle->res = malloc(sizeof(struct resource), M_DEVBUF, + rle->res = kmalloc(sizeof(struct resource), M_DEVBUF, M_WAITOK | M_ZERO); if (rle->res == NULL) { - free(pdev, M_DEVBUF); + kfree(pdev, M_DEVBUF); return (ENOMEM); } @@ -347,8 +347,8 @@ puc_pci_attach(device_t dev) bus_space_unmap(rman_get_bustag(rle->res), rman_get_bushandle(rle->res), 8); - free(rle->res, M_DEVBUF); - free(pdev, M_DEVBUF); + kfree(rle->res, M_DEVBUF); + kfree(pdev, M_DEVBUF); } continue; } @@ -370,8 +370,8 @@ puc_pci_attach(device_t dev) bus_space_unmap(rman_get_bustag(rle->res), rman_get_bushandle(rle->res), 8); - free(rle->res, M_DEVBUF); - free(pdev, M_DEVBUF); + kfree(rle->res, M_DEVBUF); + kfree(pdev, M_DEVBUF); } } } diff --git a/sys/dev/misc/snp/snp.c b/sys/dev/misc/snp/snp.c index f910d91ee7..7716ca3be1 100644 --- a/sys/dev/misc/snp/snp.c +++ b/sys/dev/misc/snp/snp.c @@ -13,7 +13,7 @@ * Snoop stuff. * * $FreeBSD: src/sys/dev/snp/snp.c,v 1.69.2.2 2002/05/06 07:30:02 dd Exp $ - * $DragonFly: src/sys/dev/misc/snp/snp.c,v 1.14 2006/07/28 02:17:36 dillon Exp $ + * $DragonFly: src/sys/dev/misc/snp/snp.c,v 1.15 2006/09/05 00:55:38 dillon Exp $ */ #include @@ -138,7 +138,7 @@ snplwrite(struct tty *tp, struct uio *uio, int flag) snp = tp->t_sc; while (uio->uio_resid > 0) { ilen = imin(512, uio->uio_resid); - ibuf = malloc(ilen, M_SNP, M_WAITOK); + ibuf = kmalloc(ilen, M_SNP, M_WAITOK); error = uiomove(ibuf, ilen, uio); if (error != 0) break; @@ -156,11 +156,11 @@ snplwrite(struct tty *tp, struct uio *uio, int flag) error = ttwrite(tp, &uio2, flag); if (error != 0) break; - free(ibuf, M_SNP); + kfree(ibuf, M_SNP); ibuf = NULL; } if (ibuf != NULL) - free(ibuf, M_SNP); + kfree(ibuf, M_SNP); return (error); } @@ -266,9 +266,9 @@ snpread(struct dev_read_args *ap) if (((nblen / 2) >= SNOOP_MINLEN) && (nblen / 2) >= snp->snp_len) { while (nblen / 2 >= snp->snp_len && nblen / 2 >= SNOOP_MINLEN) nblen = nblen / 2; - if ((nbuf = malloc(nblen, M_SNP, M_NOWAIT)) != NULL) { + if ((nbuf = kmalloc(nblen, M_SNP, M_NOWAIT)) != NULL) { bcopy(snp->snp_buf + snp->snp_base, nbuf, snp->snp_len); - free(snp->snp_buf, M_SNP); + kfree(snp->snp_buf, M_SNP); snp->snp_buf = nbuf; snp->snp_blen = nblen; snp->snp_base = 0; @@ -319,9 +319,9 @@ snp_in(struct snoop *snp, char *buf, int n) nblen = snp->snp_blen * 2; s_free = nblen - (snp->snp_len + snp->snp_base); } - if ((n <= s_free) && (nbuf = malloc(nblen, M_SNP, M_NOWAIT))) { + if ((n <= s_free) && (nbuf = kmalloc(nblen, M_SNP, M_NOWAIT))) { bcopy(snp->snp_buf + snp->snp_base, nbuf, snp->snp_len); - free(snp->snp_buf, M_SNP); + kfree(snp->snp_buf, M_SNP); snp->snp_buf = nbuf; snp->snp_blen = nblen; snp->snp_base = 0; @@ -366,7 +366,7 @@ snpopen(struct dev_open_args *ap) if (dev->si_drv1 == NULL) { make_dev(&snp_ops, minor(dev), UID_ROOT, GID_WHEEL, 0600, "snp%d", minor(dev)); - dev->si_drv1 = snp = malloc(sizeof(*snp), M_SNP, + dev->si_drv1 = snp = kmalloc(sizeof(*snp), M_SNP, M_WAITOK | M_ZERO); } else { return (EBUSY); @@ -378,7 +378,7 @@ snpopen(struct dev_open_args *ap) */ snp->snp_flags = SNOOP_OPEN; - snp->snp_buf = malloc(SNOOP_MINLEN, M_SNP, M_WAITOK); + snp->snp_buf = kmalloc(SNOOP_MINLEN, M_SNP, M_WAITOK); snp->snp_blen = SNOOP_MINLEN; snp->snp_base = 0; snp->snp_len = 0; @@ -425,7 +425,7 @@ detach_notty: selwakeup(&snp->snp_sel); snp->snp_sel.si_pid = 0; if ((snp->snp_flags & SNOOP_OPEN) == 0) - free(snp, M_SNP); + kfree(snp, M_SNP); return (0); } @@ -439,7 +439,7 @@ snpclose(struct dev_close_args *ap) snp = dev->si_drv1; snp->snp_blen = 0; LIST_REMOVE(snp, snp_list); - free(snp->snp_buf, M_SNP); + kfree(snp->snp_buf, M_SNP); snp->snp_flags &= ~SNOOP_OPEN; dev->si_drv1 = NULL; @@ -451,8 +451,8 @@ snp_down(struct snoop *snp) { if (snp->snp_blen != SNOOP_MINLEN) { - free(snp->snp_buf, M_SNP); - snp->snp_buf = malloc(SNOOP_MINLEN, M_SNP, M_WAITOK); + kfree(snp->snp_buf, M_SNP); + snp->snp_buf = kmalloc(SNOOP_MINLEN, M_SNP, M_WAITOK); snp->snp_blen = SNOOP_MINLEN; } snp->snp_flags |= SNOOP_DOWN; diff --git a/sys/dev/misc/syscons/daemon/daemon_saver.c b/sys/dev/misc/syscons/daemon/daemon_saver.c index a525c6501e..3c7751744e 100644 --- a/sys/dev/misc/syscons/daemon/daemon_saver.c +++ b/sys/dev/misc/syscons/daemon/daemon_saver.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/modules/syscons/daemon/daemon_saver.c,v 1.18.2.2 2001/05/06 05:44:29 nyan Exp $ - * $DragonFly: src/sys/dev/misc/syscons/daemon/Attic/daemon_saver.c,v 1.5 2005/03/28 21:30:23 swildner Exp $ + * $DragonFly: src/sys/dev/misc/syscons/daemon/Attic/daemon_saver.c,v 1.6 2006/09/05 00:55:38 dillon Exp $ */ #include @@ -351,7 +351,7 @@ daemon_init(video_adapter_t *adp) { messagelen = strlen(hostname) + 3 + strlen(ostype) + 1 + strlen(osrelease); - message = malloc(messagelen + 1, M_SYSCONS, M_WAITOK); + message = kmalloc(messagelen + 1, M_SYSCONS, M_WAITOK); sprintf(message, "%s - %s %s", hostname, ostype, osrelease); blanked = 0; return 0; @@ -360,7 +360,7 @@ daemon_init(video_adapter_t *adp) static int daemon_term(video_adapter_t *adp) { - free(message, M_SYSCONS); + kfree(message, M_SYSCONS); return 0; } diff --git a/sys/dev/misc/syscons/fred/fred_saver.c b/sys/dev/misc/syscons/fred/fred_saver.c index fcc3a351b7..c21779f9ff 100644 --- a/sys/dev/misc/syscons/fred/fred_saver.c +++ b/sys/dev/misc/syscons/fred/fred_saver.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/modules/syscons/daemon/daemon_saver.c,v 1.18.2.2 2001/05/06 05:44:29 nyan Exp $ - * $DragonFly: src/sys/dev/misc/syscons/fred/fred_saver.c,v 1.5 2005/03/28 21:30:23 swildner Exp $ + * $DragonFly: src/sys/dev/misc/syscons/fred/fred_saver.c,v 1.6 2006/09/05 00:55:38 dillon Exp $ */ #include @@ -351,7 +351,7 @@ daemon_init(video_adapter_t *adp) { messagelen = strlen(hostname) + 3 + strlen(ostype) + 1 + strlen(osrelease); - message = malloc(messagelen + 1, M_SYSCONS, M_WAITOK); + message = kmalloc(messagelen + 1, M_SYSCONS, M_WAITOK); sprintf(message, "%s - %s %s", hostname, ostype, osrelease); blanked = 0; return 0; @@ -360,7 +360,7 @@ daemon_init(video_adapter_t *adp) static int daemon_term(video_adapter_t *adp) { - free(message, M_SYSCONS); + kfree(message, M_SYSCONS); return 0; } diff --git a/sys/dev/misc/syscons/schistory.c b/sys/dev/misc/syscons/schistory.c index b97367d74e..833232444a 100644 --- a/sys/dev/misc/syscons/schistory.c +++ b/sys/dev/misc/syscons/schistory.c @@ -27,7 +27,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/syscons/schistory.c,v 1.8.2.1 2001/07/19 06:38:53 dd Exp $ - * $DragonFly: src/sys/dev/misc/syscons/schistory.c,v 1.7 2006/07/28 02:17:36 dillon Exp $ + * $DragonFly: src/sys/dev/misc/syscons/schistory.c,v 1.8 2006/09/05 00:55:38 dillon Exp $ */ #include "use_sc.h" @@ -113,7 +113,7 @@ sc_alloc_history_buffer(scr_stat *scp, int lines, int prev_ysize, int wait) } /* allocate a new buffer */ - history = malloc(sizeof(*history), M_SYSCONS, + history = kmalloc(sizeof(*history), M_SYSCONS, (wait) ? M_WAITOK : M_NOWAIT); if (history != NULL) { if (lines > min_lines) @@ -135,7 +135,7 @@ sc_alloc_history_buffer(scr_stat *scp, int lines, int prev_ysize, int wait) if (prev_history != NULL) { extra_history_size += delta; sc_vtb_destroy(prev_history); - free(prev_history, M_SYSCONS); + kfree(prev_history, M_SYSCONS); } scp->history = history; @@ -186,7 +186,7 @@ sc_free_history_buffer(scr_stat *scp, int prev_ysize) cur_lines - min_lines : 0; sc_vtb_destroy(history); - free(history, M_SYSCONS); + kfree(history, M_SYSCONS); } /* copy entire screen into the top of the history buffer */ diff --git a/sys/dev/misc/syscons/scmouse.c b/sys/dev/misc/syscons/scmouse.c index 4e0f6b7872..8f6fb5007b 100644 --- a/sys/dev/misc/syscons/scmouse.c +++ b/sys/dev/misc/syscons/scmouse.c @@ -24,7 +24,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/syscons/scmouse.c,v 1.12.2.3 2001/07/28 12:51:47 yokota Exp $ - * $DragonFly: src/sys/dev/misc/syscons/scmouse.c,v 1.12 2006/09/03 18:29:16 dillon Exp $ + * $DragonFly: src/sys/dev/misc/syscons/scmouse.c,v 1.13 2006/09/05 00:55:38 dillon Exp $ */ #include "opt_syscons.h" @@ -84,9 +84,9 @@ sc_alloc_cut_buffer(scr_stat *scp, int wait) p = cut_buffer; cut_buffer = NULL; if (p != NULL) - free(p, M_SYSCONS); + kfree(p, M_SYSCONS); cut_buffer_size = scp->xsize * scp->ysize + 1; - p = malloc(cut_buffer_size, M_SYSCONS, (wait) ? M_WAITOK : M_NOWAIT); + p = kmalloc(cut_buffer_size, M_SYSCONS, (wait) ? M_WAITOK : M_NOWAIT); if (p != NULL) p[0] = '\0'; cut_buffer = p; diff --git a/sys/dev/misc/syscons/scvtb.c b/sys/dev/misc/syscons/scvtb.c index b672741fb9..f53f382c52 100644 --- a/sys/dev/misc/syscons/scvtb.c +++ b/sys/dev/misc/syscons/scvtb.c @@ -24,7 +24,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/syscons/scvtb.c,v 1.5.2.1 2001/07/16 05:21:23 yokota Exp $ - * $DragonFly: src/sys/dev/misc/syscons/scvtb.c,v 1.7 2005/09/24 14:40:00 swildner Exp $ + * $DragonFly: src/sys/dev/misc/syscons/scvtb.c,v 1.8 2006/09/05 00:55:38 dillon Exp $ */ #include "opt_syscons.h" @@ -93,7 +93,7 @@ sc_vtb_destroy(sc_vtb_t *vtb) case VTB_MEMORY: case VTB_RINGBUFFER: if ((vtb->vtb_flags & VTB_ALLOCED) && (p != NULL)) - free(p, M_SYSCONS); + kfree(p, M_SYSCONS); break; default: break; diff --git a/sys/dev/misc/syscons/snake/snake_saver.c b/sys/dev/misc/syscons/snake/snake_saver.c index 72e0fe3a74..3823b57961 100644 --- a/sys/dev/misc/syscons/snake/snake_saver.c +++ b/sys/dev/misc/syscons/snake/snake_saver.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/modules/syscons/snake/snake_saver.c,v 1.26.2.2 2001/05/06 05:44:29 nyan Exp $ - * $DragonFly: src/sys/dev/misc/syscons/snake/snake_saver.c,v 1.6 2006/09/03 18:52:28 dillon Exp $ + * $DragonFly: src/sys/dev/misc/syscons/snake/snake_saver.c,v 1.7 2006/09/05 00:55:39 dillon Exp $ */ #include @@ -113,17 +113,17 @@ static int snake_init(video_adapter_t *adp) { messagelen = strlen(ostype) + 1 + strlen(osrelease); - message = malloc(messagelen + 1, M_SYSCONS, M_WAITOK); + message = kmalloc(messagelen + 1, M_SYSCONS, M_WAITOK); sprintf(message, "%s %s", ostype, osrelease); - messagep = malloc(messagelen * sizeof *messagep, M_SYSCONS, M_WAITOK); + messagep = kmalloc(messagelen * sizeof *messagep, M_SYSCONS, M_WAITOK); return 0; } static int snake_term(video_adapter_t *adp) { - free(message, M_SYSCONS); - free(messagep, M_SYSCONS); + kfree(message, M_SYSCONS); + kfree(messagep, M_SYSCONS); return 0; } diff --git a/sys/dev/misc/syscons/syscons.c b/sys/dev/misc/syscons/syscons.c index 7afb1f13c9..d0d74bcdc4 100644 --- a/sys/dev/misc/syscons/syscons.c +++ b/sys/dev/misc/syscons/syscons.c @@ -29,7 +29,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: /usr/local/www/cvsroot/FreeBSD/src/sys/dev/syscons/syscons.c,v 1.336.2.17 2004/03/25 08:41:09 ru Exp $ - * $DragonFly: src/sys/dev/misc/syscons/syscons.c,v 1.25 2006/09/03 18:29:16 dillon Exp $ + * $DragonFly: src/sys/dev/misc/syscons/syscons.c,v 1.26 2006/09/05 00:55:38 dillon Exp $ */ #include "use_splash.h" @@ -528,7 +528,7 @@ scclose(struct dev_close_args *ap) sc_vtb_destroy(&scp->scr); sc_free_history_buffer(scp, scp->ysize); SC_STAT(dev) = NULL; - free(scp, M_SYSCONS); + kfree(scp, M_SYSCONS); } #else scp->pid = 0; @@ -2507,9 +2507,9 @@ scinit(int unit, int flags) sc->font_16 = font_16; } else if (sc->font_8 == NULL) { /* assert(sc_malloc) */ - sc->font_8 = malloc(sizeof(font_8), M_SYSCONS, M_WAITOK); - sc->font_14 = malloc(sizeof(font_14), M_SYSCONS, M_WAITOK); - sc->font_16 = malloc(sizeof(font_16), M_SYSCONS, M_WAITOK); + sc->font_8 = kmalloc(sizeof(font_8), M_SYSCONS, M_WAITOK); + sc->font_14 = kmalloc(sizeof(font_14), M_SYSCONS, M_WAITOK); + sc->font_16 = kmalloc(sizeof(font_16), M_SYSCONS, M_WAITOK); } #endif @@ -2537,7 +2537,7 @@ scinit(int unit, int flags) kernel_default.rev_color); } else { /* assert(sc_malloc) */ - sc->dev = malloc(sizeof(dev_t)*sc->vtys, M_SYSCONS, M_WAITOK | M_ZERO); + sc->dev = kmalloc(sizeof(dev_t)*sc->vtys, M_SYSCONS, M_WAITOK | M_ZERO); sc->dev[0] = make_dev(&sc_ops, unit*MAXCONS, UID_ROOT, GID_WHEEL, 0600, "ttyv%r", unit*MAXCONS); sc->dev[0]->si_tty = ttymalloc(sc->dev[0]->si_tty); @@ -2665,20 +2665,20 @@ scterm(int unit, int flags) if (scp->tsw) (*scp->tsw->te_term)(scp, &scp->ts); if (scp->ts != NULL) - free(scp->ts, M_SYSCONS); + kfree(scp->ts, M_SYSCONS); /* clear the structure */ if (!(flags & SC_KERNEL_CONSOLE)) { /* XXX: We need delete_dev() for this */ - free(sc->dev, M_SYSCONS); + kfree(sc->dev, M_SYSCONS); #if 0 /* XXX: We need a ttyunregister for this */ - free(sc->tty, M_SYSCONS); + kfree(sc->tty, M_SYSCONS); #endif #ifndef SC_NO_FONT_LOADING - free(sc->font_8, M_SYSCONS); - free(sc->font_14, M_SYSCONS); - free(sc->font_16, M_SYSCONS); + kfree(sc->font_8, M_SYSCONS); + kfree(sc->font_14, M_SYSCONS); + kfree(sc->font_16, M_SYSCONS); #endif /* XXX vtb, history */ } @@ -2755,7 +2755,7 @@ alloc_scp(sc_softc_t *sc, int vty) /* assert(sc_malloc) */ - scp = malloc(sizeof(scr_stat), M_SYSCONS, M_WAITOK); + scp = kmalloc(sizeof(scr_stat), M_SYSCONS, M_WAITOK); init_scp(sc, vty, scp); sc_alloc_scr_buffer(scp, TRUE, TRUE); @@ -2889,7 +2889,7 @@ sc_init_emulator(scr_stat *scp, char *name) } if (sc_malloc && (sw->te_size > 0)) - p = malloc(sw->te_size, M_SYSCONS, M_NOWAIT); + p = kmalloc(sw->te_size, M_SYSCONS, M_NOWAIT); else p = NULL; error = (*sw->te_init)(scp, &p, SC_TE_COLD_INIT); @@ -2899,7 +2899,7 @@ sc_init_emulator(scr_stat *scp, char *name) if (scp->tsw) (*scp->tsw->te_term)(scp, &scp->ts); if (scp->ts != NULL) - free(scp->ts, M_SYSCONS); + kfree(scp->ts, M_SYSCONS); scp->tsw = sw; scp->ts = p; scp->rndr = rndr; diff --git a/sys/dev/misc/xrpu/xrpu.c b/sys/dev/misc/xrpu/xrpu.c index e9937f9c6f..f9be187fe2 100644 --- a/sys/dev/misc/xrpu/xrpu.c +++ b/sys/dev/misc/xrpu/xrpu.c @@ -7,7 +7,7 @@ * ---------------------------------------------------------------------------- * * $FreeBSD: src/sys/pci/xrpu.c,v 1.19.2.1 2000/08/02 22:19:57 peter Exp $ - * $DragonFly: src/sys/dev/misc/xrpu/Attic/xrpu.c,v 1.9 2006/07/28 02:17:37 dillon Exp $ + * $DragonFly: src/sys/dev/misc/xrpu/Attic/xrpu.c,v 1.10 2006/09/05 00:55:39 dillon Exp $ * * A very simple device driver for PCI cards based on Xilinx 6200 series * FPGA/RPU devices. Current Functionality is to allow you to open and @@ -164,7 +164,7 @@ xrpu_ioctl(struct dev_ioctl_args *ap) /* Name SHALL be zero terminated */ xt->xt_name[sizeof xt->xt_name - 1] = '\0'; i = strlen(xt->xt_name); - sc->tc.tc_name = (char *)malloc(i + 1, M_XRPU, M_WAITOK); + sc->tc.tc_name = (char *)kmalloc(i + 1, M_XRPU, M_WAITOK); strcpy(sc->tc.tc_name, xt->xt_name); sc->tc.tc_frequency = xt->xt_frequency; sc->tc.tc_get_timecount = xrpu_get_timecount; diff --git a/sys/dev/netif/acx/if_acx.c b/sys/dev/netif/acx/if_acx.c index 4eda650f25..2bc06e4a40 100644 --- a/sys/dev/netif/acx/if_acx.c +++ b/sys/dev/netif/acx/if_acx.c @@ -31,7 +31,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/dev/netif/acx/if_acx.c,v 1.6 2006/09/03 05:05:25 sephe Exp $ + * $DragonFly: src/sys/dev/netif/acx/if_acx.c,v 1.7 2006/09/05 00:55:39 dillon Exp $ */ /* @@ -1603,13 +1603,13 @@ acx_copyin_firmware(struct acx_softc *sc, struct ifreq *req) if (ufw.base_fw_len <= 0 || ufw.radio_fw_len < 0) return EINVAL; - base_fw = malloc(ufw.base_fw_len, M_DEVBUF, M_INTWAIT); + base_fw = kmalloc(ufw.base_fw_len, M_DEVBUF, M_INTWAIT); error = copyin(ufw.base_fw, base_fw, ufw.base_fw_len); if (error) goto fail; if (ufw.radio_fw_len > 0) { - radio_fw = malloc(ufw.radio_fw_len, M_DEVBUF, M_INTWAIT); + radio_fw = kmalloc(ufw.radio_fw_len, M_DEVBUF, M_INTWAIT); error = copyin(ufw.radio_fw, radio_fw, ufw.radio_fw_len); if (error) goto fail; @@ -1617,20 +1617,20 @@ acx_copyin_firmware(struct acx_softc *sc, struct ifreq *req) kfw->base_fw_len = ufw.base_fw_len; if (kfw->base_fw != NULL) - free(kfw->base_fw, M_DEVBUF); + kfree(kfw->base_fw, M_DEVBUF); kfw->base_fw = base_fw; kfw->radio_fw_len = ufw.radio_fw_len; if (kfw->radio_fw != NULL) - free(kfw->radio_fw, M_DEVBUF); + kfree(kfw->radio_fw, M_DEVBUF); kfw->radio_fw = radio_fw; return 0; fail: if (base_fw != NULL) - free(base_fw, M_DEVBUF); + kfree(base_fw, M_DEVBUF); if (radio_fw != NULL) - free(radio_fw, M_DEVBUF); + kfree(radio_fw, M_DEVBUF); return error; } @@ -1640,12 +1640,12 @@ acx_free_firmware(struct acx_softc *sc) struct acx_firmware *fw = &sc->sc_firmware; if (fw->base_fw != NULL) { - free(fw->base_fw, M_DEVBUF); + kfree(fw->base_fw, M_DEVBUF); fw->base_fw = NULL; fw->base_fw_len = 0; } if (fw->radio_fw != NULL) { - free(fw->radio_fw, M_DEVBUF); + kfree(fw->radio_fw, M_DEVBUF); fw->radio_fw = NULL; fw->radio_fw_len = 0; } diff --git a/sys/dev/netif/an/if_an.c b/sys/dev/netif/an/if_an.c index 00c5e32c0c..03cea55a65 100644 --- a/sys/dev/netif/an/if_an.c +++ b/sys/dev/netif/an/if_an.c @@ -30,7 +30,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/an/if_an.c,v 1.2.2.13 2003/02/11 03:32:48 ambrisko Exp $ - * $DragonFly: src/sys/dev/netif/an/if_an.c,v 1.37 2006/08/06 12:49:04 swildner Exp $ + * $DragonFly: src/sys/dev/netif/an/if_an.c,v 1.38 2006/09/05 00:55:39 dillon Exp $ */ /* @@ -2668,7 +2668,7 @@ an_stop(struct an_softc *sc) ifp->if_flags &= ~(IFF_RUNNING|IFF_OACTIVE); if (sc->an_flash_buffer) { - free(sc->an_flash_buffer, M_DEVBUF); + kfree(sc->an_flash_buffer, M_DEVBUF); sc->an_flash_buffer = NULL; } } @@ -3465,10 +3465,10 @@ flashcard(struct ifnet *ifp, struct aironet_ioctl *l_ioctl) break; case AIROFLSHSTFL: if (sc->an_flash_buffer) { - free(sc->an_flash_buffer, M_DEVBUF); + kfree(sc->an_flash_buffer, M_DEVBUF); sc->an_flash_buffer = NULL; } - sc->an_flash_buffer = malloc(FLASH_SIZE, M_DEVBUF, 0); + sc->an_flash_buffer = kmalloc(FLASH_SIZE, M_DEVBUF, 0); if (sc->an_flash_buffer) return setflashmode(ifp); else diff --git a/sys/dev/netif/ath/ath/if_ath.c b/sys/dev/netif/ath/ath/if_ath.c index 882885715f..5cbf61cc52 100644 --- a/sys/dev/netif/ath/ath/if_ath.c +++ b/sys/dev/netif/ath/ath/if_ath.c @@ -34,7 +34,7 @@ * THE POSSIBILITY OF SUCH DAMAGES. * * $FreeBSD: src/sys/dev/ath/if_ath.c,v 1.94.2.17 2006/04/19 16:14:47 sam Exp $ - * $DragonFly: src/sys/dev/netif/ath/ath/if_ath.c,v 1.2 2006/08/06 12:49:04 swildner Exp $ + * $DragonFly: src/sys/dev/netif/ath/ath/if_ath.c,v 1.3 2006/09/05 00:55:39 dillon Exp $ */ /* @@ -2444,7 +2444,7 @@ ath_descdma_setup(struct ath_softc *sc, struct ath_descdma *dd, /* allocate rx buffers */ bsize = sizeof(struct ath_buf) * nbuf; - bf = malloc(bsize, M_ATHDEV, M_WAITOK | M_ZERO); + bf = kmalloc(bsize, M_ATHDEV, M_WAITOK | M_ZERO); dd->dd_bufptr = bf; for (i = 0; i < nbuf; i++, bf++, ds += ndesc) { @@ -2521,7 +2521,7 @@ ath_descdma_cleanup(struct ath_softc *sc, STAILQ_INIT(head); if (dd->dd_bufptr != NULL) - free(dd->dd_bufptr, M_ATHDEV); + kfree(dd->dd_bufptr, M_ATHDEV); memset(dd, 0, sizeof(*dd)); } @@ -2573,7 +2573,7 @@ ath_node_alloc(struct ieee80211_node_table *nt) const size_t space = sizeof(struct ath_node) + sc->sc_rc->arc_space; struct ath_node *an; - an = malloc(space, M_80211_NODE, M_NOWAIT|M_ZERO); + an = kmalloc(space, M_80211_NODE, M_NOWAIT|M_ZERO); if (an == NULL) { /* XXX stat+msg */ return NULL; @@ -4614,7 +4614,7 @@ ath_getchannels(struct ath_softc *sc, u_int cc, HAL_CHANNEL *chans; int i, ix, nchan; - chans = malloc(IEEE80211_CHAN_MAX * sizeof(HAL_CHANNEL), M_TEMP, + chans = kmalloc(IEEE80211_CHAN_MAX * sizeof(HAL_CHANNEL), M_TEMP, M_WAITOK); if (!ath_hal_init_channels(ah, chans, IEEE80211_CHAN_MAX, &nchan, @@ -4625,7 +4625,7 @@ ath_getchannels(struct ath_softc *sc, u_int cc, ath_hal_getregdomain(ah, &rd); if_printf(ifp, "unable to collect channel list from hal; " "regdomain likely %u country code %u\n", rd, cc); - free(chans, M_TEMP); + kfree(chans, M_TEMP); return EINVAL; } @@ -4668,7 +4668,7 @@ ath_getchannels(struct ath_softc *sc, u_int cc, ic->ic_channels[ix].ic_flags |= flags; } } - free(chans, M_TEMP); + kfree(chans, M_TEMP); return 0; #undef COMPAT } @@ -4966,7 +4966,7 @@ ath_ioctl_diag(struct ath_softc *sc, struct ath_diag *ad) /* * Copy in data. */ - indata = malloc(insize, M_TEMP, M_NOWAIT); + indata = kmalloc(insize, M_TEMP, M_NOWAIT); if (indata == NULL) { error = ENOMEM; goto bad; @@ -4983,7 +4983,7 @@ ath_ioctl_diag(struct ath_softc *sc, struct ath_diag *ad) * pointer for us to use below in reclaiming the buffer; * may want to be more defensive. */ - outdata = malloc(outsize, M_TEMP, M_NOWAIT); + outdata = kmalloc(outsize, M_TEMP, M_NOWAIT); if (outdata == NULL) { error = ENOMEM; goto bad; @@ -5000,9 +5000,9 @@ ath_ioctl_diag(struct ath_softc *sc, struct ath_diag *ad) } bad: if ((ad->ad_id & ATH_DIAG_IN) && indata != NULL) - free(indata, M_TEMP); + kfree(indata, M_TEMP); if ((ad->ad_id & ATH_DIAG_DYN) && outdata != NULL) - free(outdata, M_TEMP); + kfree(outdata, M_TEMP); return error; } #endif /* ATH_DIAGAPI */ diff --git a/sys/dev/netif/ath/rate_amrr/amrr.c b/sys/dev/netif/ath/rate_amrr/amrr.c index c943f71fed..affef791d8 100644 --- a/sys/dev/netif/ath/rate_amrr/amrr.c +++ b/sys/dev/netif/ath/rate_amrr/amrr.c @@ -35,7 +35,7 @@ * THE POSSIBILITY OF SUCH DAMAGES. * * $FreeBSD: src/sys/dev/ath/ath_rate/amrr/amrr.c,v 1.8.2.3 2006/02/24 19:51:11 sam Exp $ - * $DragonFly: src/sys/dev/netif/ath/rate_amrr/amrr.c,v 1.1 2006/07/13 09:15:22 sephe Exp $ + * $DragonFly: src/sys/dev/netif/ath/rate_amrr/amrr.c,v 1.2 2006/09/05 00:55:39 dillon Exp $ */ /* @@ -497,7 +497,7 @@ ath_rate_attach(struct ath_softc *sc) { struct amrr_softc *asc; - asc = malloc(sizeof(struct amrr_softc), M_DEVBUF, M_NOWAIT|M_ZERO); + asc = kmalloc(sizeof(struct amrr_softc), M_DEVBUF, M_NOWAIT|M_ZERO); if (asc == NULL) return NULL; asc->arc.arc_space = sizeof(struct amrr_node); @@ -512,7 +512,7 @@ ath_rate_detach(struct ath_ratectrl *arc) { struct amrr_softc *asc = (struct amrr_softc *)arc; - free(asc, M_DEVBUF); + kfree(asc, M_DEVBUF); } void diff --git a/sys/dev/netif/ath/rate_onoe/onoe.c b/sys/dev/netif/ath/rate_onoe/onoe.c index ca0039d4a9..b63213eb1f 100644 --- a/sys/dev/netif/ath/rate_onoe/onoe.c +++ b/sys/dev/netif/ath/rate_onoe/onoe.c @@ -34,7 +34,7 @@ * THE POSSIBILITY OF SUCH DAMAGES. * * $FreeBSD: src/sys/dev/ath/ath_rate/onoe/onoe.c,v 1.8.2.3 2006/02/24 19:51:11 sam Exp $ - * $DragonFly: src/sys/dev/netif/ath/rate_onoe/onoe.c,v 1.1 2006/07/13 09:15:22 sephe Exp $ + * $DragonFly: src/sys/dev/netif/ath/rate_onoe/onoe.c,v 1.2 2006/09/05 00:55:39 dillon Exp $ */ /* @@ -481,7 +481,7 @@ ath_rate_attach(struct ath_softc *sc) { struct onoe_softc *osc; - osc = malloc(sizeof(struct onoe_softc), M_DEVBUF, M_WAITOK | M_ZERO); + osc = kmalloc(sizeof(struct onoe_softc), M_DEVBUF, M_WAITOK | M_ZERO); osc->arc.arc_space = sizeof(struct onoe_node); callout_init(&osc->timer); ath_rate_sysctlattach(sc); @@ -493,7 +493,7 @@ ath_rate_detach(struct ath_ratectrl *arc) { struct onoe_softc *osc = (struct onoe_softc *) arc; - free(osc, M_DEVBUF); + kfree(osc, M_DEVBUF); } void diff --git a/sys/dev/netif/ath/rate_sample/sample.c b/sys/dev/netif/ath/rate_sample/sample.c index 67be3ae54c..5e3503cb06 100644 --- a/sys/dev/netif/ath/rate_sample/sample.c +++ b/sys/dev/netif/ath/rate_sample/sample.c @@ -34,7 +34,7 @@ * THE POSSIBILITY OF SUCH DAMAGES. * * $FreeBSD: src/sys/dev/ath/ath_rate/sample/sample.c,v 1.8.2.3 2006/03/14 23:22:27 sam Exp $ - * $DragonFly: src/sys/dev/netif/ath/rate_sample/sample.c,v 1.2 2006/08/06 12:49:04 swildner Exp $ + * $DragonFly: src/sys/dev/netif/ath/rate_sample/sample.c,v 1.3 2006/09/05 00:55:39 dillon Exp $ */ /* @@ -786,7 +786,7 @@ ath_rate_attach(struct ath_softc *sc) struct sample_softc *osc; DPRINTF(sc, "%s:\n", __func__); - osc = malloc(sizeof(struct sample_softc), M_DEVBUF, M_NOWAIT|M_ZERO); + osc = kmalloc(sizeof(struct sample_softc), M_DEVBUF, M_NOWAIT|M_ZERO); if (osc == NULL) return NULL; osc->arc.arc_space = sizeof(struct sample_node); @@ -801,7 +801,7 @@ ath_rate_detach(struct ath_ratectrl *arc) { struct sample_softc *osc = (struct sample_softc *) arc; - free(osc, M_DEVBUF); + kfree(osc, M_DEVBUF); } void diff --git a/sys/dev/netif/aue/if_aue.c b/sys/dev/netif/aue/if_aue.c index 1f6af85f7f..dc4d5b5f7e 100644 --- a/sys/dev/netif/aue/if_aue.c +++ b/sys/dev/netif/aue/if_aue.c @@ -30,7 +30,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/usb/if_aue.c,v 1.78 2003/12/17 14:23:07 sanpei Exp $ - * $DragonFly: src/sys/dev/netif/aue/if_aue.c,v 1.29 2005/11/28 17:13:41 dillon Exp $ + * $DragonFly: src/sys/dev/netif/aue/if_aue.c,v 1.30 2006/09/05 00:55:39 dillon Exp $ */ /* @@ -831,7 +831,7 @@ aue_tx_list_init(struct aue_softc *sc) if (c->aue_xfer == NULL) return (ENOBUFS); } - c->aue_buf = malloc(AUE_BUFSZ, M_USBDEV, M_WAITOK); + c->aue_buf = kmalloc(AUE_BUFSZ, M_USBDEV, M_WAITOK); if (c->aue_buf == NULL) return (ENOBUFS); } @@ -1210,7 +1210,7 @@ aue_init(void *xsc) } #ifdef AUE_INTR_PIPE - sc->aue_cdata.aue_ibuf = malloc(AUE_INTR_PKTLEN, M_USBDEV, M_WAITOK); + sc->aue_cdata.aue_ibuf = kmalloc(AUE_INTR_PKTLEN, M_USBDEV, M_WAITOK); #endif /* Load the multicast filter. */ @@ -1449,7 +1449,7 @@ aue_stop(struct aue_softc *sc) /* Free RX resources. */ for (i = 0; i < AUE_RX_LIST_CNT; i++) { if (sc->aue_cdata.aue_rx_chain[i].aue_buf != NULL) { - free(sc->aue_cdata.aue_rx_chain[i].aue_buf, M_USBDEV); + kfree(sc->aue_cdata.aue_rx_chain[i].aue_buf, M_USBDEV); sc->aue_cdata.aue_rx_chain[i].aue_buf = NULL; } if (sc->aue_cdata.aue_rx_chain[i].aue_mbuf != NULL) { @@ -1465,7 +1465,7 @@ aue_stop(struct aue_softc *sc) /* Free TX resources. */ for (i = 0; i < AUE_TX_LIST_CNT; i++) { if (sc->aue_cdata.aue_tx_chain[i].aue_buf != NULL) { - free(sc->aue_cdata.aue_tx_chain[i].aue_buf, M_USBDEV); + kfree(sc->aue_cdata.aue_tx_chain[i].aue_buf, M_USBDEV); sc->aue_cdata.aue_tx_chain[i].aue_buf = NULL; } if (sc->aue_cdata.aue_tx_chain[i].aue_mbuf != NULL) { @@ -1480,7 +1480,7 @@ aue_stop(struct aue_softc *sc) #ifdef AUE_INTR_PIPE if (sc->aue_cdata.aue_ibuf != NULL) { - free(sc->aue_cdata.aue_ibuf, M_USBDEV); + kfree(sc->aue_cdata.aue_ibuf, M_USBDEV); sc->aue_cdata.aue_ibuf = NULL; } #endif diff --git a/sys/dev/netif/awi/awi.c b/sys/dev/netif/awi/awi.c index 67d1945443..81be53d3d4 100644 --- a/sys/dev/netif/awi/awi.c +++ b/sys/dev/netif/awi/awi.c @@ -35,7 +35,7 @@ * * $NetBSD: awi.c,v 1.26 2000/07/21 04:48:55 onoe Exp $ * $FreeBSD: src/sys/dev/awi/awi.c,v 1.10.2.2 2003/01/23 21:06:42 sam Exp $ - * $DragonFly: src/sys/dev/netif/awi/Attic/awi.c,v 1.26 2006/08/06 12:49:04 swildner Exp $ + * $DragonFly: src/sys/dev/netif/awi/Attic/awi.c,v 1.27 2006/09/05 00:55:39 dillon Exp $ */ /* * Driver for AMD 802.11 firmware. @@ -651,7 +651,7 @@ awi_stop(struct awi_softc *sc) ifq_purge(&ifp->if_snd); while ((bp = TAILQ_FIRST(&sc->sc_scan)) != NULL) { TAILQ_REMOVE(&sc->sc_scan, bp, list); - free(bp, M_DEVBUF); + kfree(bp, M_DEVBUF); } } @@ -1404,7 +1404,7 @@ awi_start_scan(struct awi_softc *sc) while ((bp = TAILQ_FIRST(&sc->sc_scan)) != NULL) { TAILQ_REMOVE(&sc->sc_scan, bp, list); - free(bp, M_DEVBUF); + kfree(bp, M_DEVBUF); } if (!sc->sc_mib_local.Network_Mode && sc->sc_no_bssid) { memset(&sc->sc_bss, 0, sizeof(sc->sc_bss)); @@ -1640,7 +1640,7 @@ awi_recv_beacon(struct awi_softc *sc, struct mbuf *m0, u_int32_t rxts, break; } if (bp == NULL) { - bp = malloc(sizeof(struct awi_bss), M_DEVBUF, M_INTWAIT); + bp = kmalloc(sizeof(struct awi_bss), M_DEVBUF, M_INTWAIT); if (bp == NULL) return; TAILQ_INSERT_TAIL(&sc->sc_scan, bp, list); diff --git a/sys/dev/netif/awi/awi_wep.c b/sys/dev/netif/awi/awi_wep.c index dd0ee24b15..d47e2d17ea 100644 --- a/sys/dev/netif/awi/awi_wep.c +++ b/sys/dev/netif/awi/awi_wep.c @@ -1,6 +1,6 @@ /* $NetBSD: awi_wep.c,v 1.4 2000/08/14 11:28:03 onoe Exp $ */ /* $FreeBSD: src/sys/dev/awi/awi_wep.c,v 1.3.2.2 2003/01/23 21:06:42 sam Exp $ */ -/* $DragonFly: src/sys/dev/netif/awi/Attic/awi_wep.c,v 1.15 2006/09/03 18:52:28 dillon Exp $ */ +/* $DragonFly: src/sys/dev/netif/awi/Attic/awi_wep.c,v 1.16 2006/09/05 00:55:39 dillon Exp $ */ /* * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -217,11 +217,11 @@ awi_wep_setalgo(struct awi_softc *sc, int algo) } else ctxlen = awa->awa_ctxlen(); if (sc->sc_wep_ctx != NULL) { - free(sc->sc_wep_ctx, M_DEVBUF); + kfree(sc->sc_wep_ctx, M_DEVBUF); sc->sc_wep_ctx = NULL; } if (ctxlen) { - sc->sc_wep_ctx = malloc(ctxlen, M_DEVBUF, M_INTWAIT); + sc->sc_wep_ctx = kmalloc(ctxlen, M_DEVBUF, M_INTWAIT); if (sc->sc_wep_ctx == NULL) return ENOMEM; } diff --git a/sys/dev/netif/axe/if_axe.c b/sys/dev/netif/axe/if_axe.c index 8faa08f981..a2b2b64808 100644 --- a/sys/dev/netif/axe/if_axe.c +++ b/sys/dev/netif/axe/if_axe.c @@ -30,7 +30,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/usb/if_axe.c,v 1.10 2003/12/08 07:54:14 obrien Exp $ - * $DragonFly: src/sys/dev/netif/axe/if_axe.c,v 1.19 2005/11/28 17:13:41 dillon Exp $ + * $DragonFly: src/sys/dev/netif/axe/if_axe.c,v 1.20 2006/09/05 00:55:39 dillon Exp $ */ /* * ASIX Electronics AX88172 USB 2.0 ethernet driver. Used in the @@ -583,7 +583,7 @@ axe_tx_list_init(struct axe_softc *sc) if (c->axe_xfer == NULL) return(ENOBUFS); } - c->axe_buf = malloc(AXE_BUFSZ, M_USBDEV, M_WAITOK); + c->axe_buf = kmalloc(AXE_BUFSZ, M_USBDEV, M_WAITOK); if (c->axe_buf == NULL) return(ENOBUFS); } @@ -1037,7 +1037,7 @@ axe_stop(struct axe_softc *sc) /* Free RX resources. */ for (i = 0; i < AXE_RX_LIST_CNT; i++) { if (sc->axe_cdata.axe_rx_chain[i].axe_buf != NULL) { - free(sc->axe_cdata.axe_rx_chain[i].axe_buf, M_USBDEV); + kfree(sc->axe_cdata.axe_rx_chain[i].axe_buf, M_USBDEV); sc->axe_cdata.axe_rx_chain[i].axe_buf = NULL; } if (sc->axe_cdata.axe_rx_chain[i].axe_mbuf != NULL) { @@ -1053,7 +1053,7 @@ axe_stop(struct axe_softc *sc) /* Free TX resources. */ for (i = 0; i < AXE_TX_LIST_CNT; i++) { if (sc->axe_cdata.axe_tx_chain[i].axe_buf != NULL) { - free(sc->axe_cdata.axe_tx_chain[i].axe_buf, M_USBDEV); + kfree(sc->axe_cdata.axe_tx_chain[i].axe_buf, M_USBDEV); sc->axe_cdata.axe_tx_chain[i].axe_buf = NULL; } if (sc->axe_cdata.axe_tx_chain[i].axe_mbuf != NULL) { diff --git a/sys/dev/netif/bge/if_bge.c b/sys/dev/netif/bge/if_bge.c index 7469034aef..2d6a0f1642 100644 --- a/sys/dev/netif/bge/if_bge.c +++ b/sys/dev/netif/bge/if_bge.c @@ -31,7 +31,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/bge/if_bge.c,v 1.3.2.29 2003/12/01 21:06:59 ambrisko Exp $ - * $DragonFly: src/sys/dev/netif/bge/if_bge.c,v 1.54 2006/08/12 05:17:03 swildner Exp $ + * $DragonFly: src/sys/dev/netif/bge/if_bge.c,v 1.55 2006/09/05 00:55:39 dillon Exp $ * */ @@ -373,9 +373,9 @@ bge_vpd_read(struct bge_softc *sc) struct vpd_res res; if (sc->bge_vpd_prodname != NULL) - free(sc->bge_vpd_prodname, M_DEVBUF); + kfree(sc->bge_vpd_prodname, M_DEVBUF); if (sc->bge_vpd_readonly != NULL) - free(sc->bge_vpd_readonly, M_DEVBUF); + kfree(sc->bge_vpd_readonly, M_DEVBUF); sc->bge_vpd_prodname = NULL; sc->bge_vpd_readonly = NULL; @@ -389,7 +389,7 @@ bge_vpd_read(struct bge_softc *sc) } pos += sizeof(res); - sc->bge_vpd_prodname = malloc(res.vr_len + 1, M_DEVBUF, M_INTWAIT); + sc->bge_vpd_prodname = kmalloc(res.vr_len + 1, M_DEVBUF, M_INTWAIT); for (i = 0; i < res.vr_len; i++) sc->bge_vpd_prodname[i] = bge_vpd_readbyte(sc, i + pos); sc->bge_vpd_prodname[i] = '\0'; @@ -405,7 +405,7 @@ bge_vpd_read(struct bge_softc *sc) } pos += sizeof(res); - sc->bge_vpd_readonly = malloc(res.vr_len, M_DEVBUF, M_INTWAIT); + sc->bge_vpd_readonly = kmalloc(res.vr_len, M_DEVBUF, M_INTWAIT); for (i = 0; i < res.vr_len + 1; i++) sc->bge_vpd_readonly[i] = bge_vpd_readbyte(sc, i + pos); } @@ -1500,13 +1500,13 @@ bge_probe(device_t dev) bge_vpd_read(sc); device_set_desc(dev, sc->bge_vpd_prodname); #endif - descbuf = malloc(BGE_DEVDESC_MAX, M_TEMP, M_WAITOK); + descbuf = kmalloc(BGE_DEVDESC_MAX, M_TEMP, M_WAITOK); snprintf(descbuf, BGE_DEVDESC_MAX, "%s, ASIC rev. %#04x", t->bge_name, pci_read_config(dev, BGE_PCI_MISC_CTL, 4) >> 16); device_set_desc_copy(dev, descbuf); if (pci_get_subvendor(dev) == PCI_VENDOR_DELL) sc->bge_no_3_led = 1; - free(descbuf, M_TEMP); + kfree(descbuf, M_TEMP); return(0); } @@ -1795,10 +1795,10 @@ bge_release_resources(struct bge_softc *sc) dev = sc->bge_dev; if (sc->bge_vpd_prodname != NULL) - free(sc->bge_vpd_prodname, M_DEVBUF); + kfree(sc->bge_vpd_prodname, M_DEVBUF); if (sc->bge_vpd_readonly != NULL) - free(sc->bge_vpd_readonly, M_DEVBUF); + kfree(sc->bge_vpd_readonly, M_DEVBUF); if (sc->bge_irq != NULL) bus_release_resource(dev, SYS_RES_IRQ, 0, sc->bge_irq); diff --git a/sys/dev/netif/cs/if_cs.c b/sys/dev/netif/cs/if_cs.c index a0ba9ba689..798ea254f4 100644 --- a/sys/dev/netif/cs/if_cs.c +++ b/sys/dev/netif/cs/if_cs.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/cs/if_cs.c,v 1.19.2.1 2001/01/25 20:13:48 imp Exp $ - * $DragonFly: src/sys/dev/netif/cs/if_cs.c,v 1.25 2006/08/06 12:49:05 swildner Exp $ + * $DragonFly: src/sys/dev/netif/cs/if_cs.c,v 1.26 2006/09/05 00:55:39 dillon Exp $ */ /* @@ -637,13 +637,13 @@ cs_attach(device_t dev) /* * this code still in progress (DMA support) */ - sc->recv_ring=malloc(CS_DMA_BUFFER_SIZE<<1, M_DEVBUF, M_WAITOK); + sc->recv_ring=kmalloc(CS_DMA_BUFFER_SIZE<<1, M_DEVBUF, M_WAITOK); if ((sc->recv_ring-(sc->recv_ring & 0x1FFFF)) < (128*1024-CS_DMA_BUFFER_SIZE)) sc->recv_ring+=16*1024; #endif - sc->buffer=malloc(ETHER_MAX_LEN-ETHER_CRC_LEN,M_DEVBUF,M_WAITOK); + sc->buffer=kmalloc(ETHER_MAX_LEN-ETHER_CRC_LEN,M_DEVBUF,M_WAITOK); if (sc->adapter_cnf & A_CNF_10B_T) { ifmedia_add(&sc->media, IFM_ETHER|IFM_10_T, 0, NULL); @@ -713,11 +713,11 @@ cs_detach(device_t dev) * this code still in progress (DMA support) */ if (sc->recv_ring != NULL) - free(sc->recv_ring, M_DEVBUF); + kfree(sc->recv_ring, M_DEVBUF); #endif if (sc->buffer != NULL) - free(sc->buffer, M_DEVBUF); + kfree(sc->buffer, M_DEVBUF); cs_release_resources(dev); ifmedia_removeall(&sc->media); diff --git a/sys/dev/netif/cue/if_cue.c b/sys/dev/netif/cue/if_cue.c index b71970477e..a6735b63f6 100644 --- a/sys/dev/netif/cue/if_cue.c +++ b/sys/dev/netif/cue/if_cue.c @@ -30,7 +30,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/usb/if_cue.c,v 1.45 2003/12/08 07:54:14 obrien Exp $ - * $DragonFly: src/sys/dev/netif/cue/if_cue.c,v 1.24 2005/11/28 17:13:41 dillon Exp $ + * $DragonFly: src/sys/dev/netif/cue/if_cue.c,v 1.25 2006/09/05 00:55:39 dillon Exp $ */ /* @@ -604,7 +604,7 @@ cue_tx_list_init(struct cue_softc *sc) if (c->cue_xfer == NULL) return(ENOBUFS); } - c->cue_buf = malloc(CUE_BUFSZ, M_USBDEV, M_WAITOK); + c->cue_buf = kmalloc(CUE_BUFSZ, M_USBDEV, M_WAITOK); } return(0); @@ -1106,7 +1106,7 @@ cue_stop(struct cue_softc *sc) /* Free RX resources. */ for (i = 0; i < CUE_RX_LIST_CNT; i++) { if (sc->cue_cdata.cue_rx_chain[i].cue_buf != NULL) { - free(sc->cue_cdata.cue_rx_chain[i].cue_buf, M_USBDEV); + kfree(sc->cue_cdata.cue_rx_chain[i].cue_buf, M_USBDEV); sc->cue_cdata.cue_rx_chain[i].cue_buf = NULL; } if (sc->cue_cdata.cue_rx_chain[i].cue_mbuf != NULL) { @@ -1122,7 +1122,7 @@ cue_stop(struct cue_softc *sc) /* Free TX resources. */ for (i = 0; i < CUE_TX_LIST_CNT; i++) { if (sc->cue_cdata.cue_tx_chain[i].cue_buf != NULL) { - free(sc->cue_cdata.cue_tx_chain[i].cue_buf, M_USBDEV); + kfree(sc->cue_cdata.cue_tx_chain[i].cue_buf, M_USBDEV); sc->cue_cdata.cue_tx_chain[i].cue_buf = NULL; } if (sc->cue_cdata.cue_tx_chain[i].cue_mbuf != NULL) { diff --git a/sys/dev/netif/cx/if_cx.c b/sys/dev/netif/cx/if_cx.c index 817f5eb499..18b6256ce0 100644 --- a/sys/dev/netif/cx/if_cx.c +++ b/sys/dev/netif/cx/if_cx.c @@ -17,7 +17,7 @@ * Version 1.9, Wed Oct 4 18:58:15 MSK 1995 * * $FreeBSD: src/sys/i386/isa/if_cx.c,v 1.32 1999/11/18 08:36:42 peter Exp $ - * $DragonFly: src/sys/dev/netif/cx/if_cx.c,v 1.21 2006/08/06 12:49:05 swildner Exp $ + * $DragonFly: src/sys/dev/netif/cx/if_cx.c,v 1.22 2006/09/05 00:55:39 dillon Exp $ * */ #undef DEBUG @@ -248,10 +248,10 @@ cxattach (struct isa_device *id) continue; /* Allocate the buffer memory. */ - c->arbuf = malloc (DMABUFSZ, M_DEVBUF, M_WAITOK); - c->brbuf = malloc (DMABUFSZ, M_DEVBUF, M_WAITOK); - c->atbuf = malloc (DMABUFSZ, M_DEVBUF, M_WAITOK); - c->btbuf = malloc (DMABUFSZ, M_DEVBUF, M_WAITOK); + c->arbuf = kmalloc (DMABUFSZ, M_DEVBUF, M_WAITOK); + c->brbuf = kmalloc (DMABUFSZ, M_DEVBUF, M_WAITOK); + c->atbuf = kmalloc (DMABUFSZ, M_DEVBUF, M_WAITOK); + c->btbuf = kmalloc (DMABUFSZ, M_DEVBUF, M_WAITOK); #if 0 /* All buffers should be located in lower 16M of memory! */ @@ -270,7 +270,7 @@ cxattach (struct isa_device *id) case T_UNIV_RS232: case T_UNIV_RS449: case T_UNIV_V35: - c->ifp = malloc (IFSTRUCTSZ, M_DEVBUF, M_WAITOK | M_ZERO); + c->ifp = kmalloc (IFSTRUCTSZ, M_DEVBUF, M_WAITOK | M_ZERO); c->master = c->ifp; c->ifp->if_softc = c; if_initname(c->ifp, "cx", u); diff --git a/sys/dev/netif/dc/if_dc.c b/sys/dev/netif/dc/if_dc.c index 7742f76aa5..16eb419c6d 100644 --- a/sys/dev/netif/dc/if_dc.c +++ b/sys/dev/netif/dc/if_dc.c @@ -30,7 +30,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/pci/if_dc.c,v 1.9.2.45 2003/06/08 14:31:53 mux Exp $ - * $DragonFly: src/sys/dev/netif/dc/if_dc.c,v 1.50 2006/04/30 02:02:06 sephe Exp $ + * $DragonFly: src/sys/dev/netif/dc/if_dc.c,v 1.51 2006/09/05 00:55:39 dillon Exp $ */ /* @@ -1671,7 +1671,7 @@ dc_decode_leaf_sia(struct dc_softc *sc, struct dc_eblock_sia *l) { struct dc_mediainfo *m; - m = malloc(sizeof(struct dc_mediainfo), M_DEVBUF, M_INTWAIT | M_ZERO); + m = kmalloc(sizeof(struct dc_mediainfo), M_DEVBUF, M_INTWAIT | M_ZERO); switch (l->dc_sia_code & ~DC_SIA_CODE_EXT){ case DC_SIA_CODE_10BT: m->dc_media = IFM_10_T; @@ -1712,7 +1712,7 @@ dc_decode_leaf_sym(struct dc_softc *sc, struct dc_eblock_sym *l) { struct dc_mediainfo *m; - m = malloc(sizeof(struct dc_mediainfo), M_DEVBUF, M_INTWAIT | M_ZERO); + m = kmalloc(sizeof(struct dc_mediainfo), M_DEVBUF, M_INTWAIT | M_ZERO); if (l->dc_sym_code == DC_SYM_CODE_100BT) m->dc_media = IFM_100_TX; @@ -1736,7 +1736,7 @@ dc_decode_leaf_mii(struct dc_softc *sc, struct dc_eblock_mii *l) u_int8_t *p; struct dc_mediainfo *m; - m = malloc(sizeof(struct dc_mediainfo), M_DEVBUF, M_INTWAIT | M_ZERO); + m = kmalloc(sizeof(struct dc_mediainfo), M_DEVBUF, M_INTWAIT | M_ZERO); /* We abuse IFM_AUTO to represent MII. */ m->dc_media = IFM_AUTO; m->dc_gp_len = l->dc_gpr_len; @@ -1761,7 +1761,7 @@ dc_read_srom(struct dc_softc *sc, int bits) int size; size = 2 << bits; - sc->dc_srom = malloc(size, M_DEVBUF, M_INTWAIT); + sc->dc_srom = kmalloc(size, M_DEVBUF, M_INTWAIT); dc_read_eeprom(sc, (caddr_t)sc->dc_srom, 0, (size / 2), 0); } @@ -1970,7 +1970,7 @@ dc_attach(device_t dev) sc->dc_type = DC_TYPE_PNIC; sc->dc_flags |= DC_TX_STORENFWD|DC_TX_INTR_ALWAYS; sc->dc_flags |= DC_PNIC_RX_BUG_WAR; - sc->dc_pnic_rx_buf = malloc(DC_RXLEN * 5, M_DEVBUF, M_WAITOK); + sc->dc_pnic_rx_buf = kmalloc(DC_RXLEN * 5, M_DEVBUF, M_WAITOK); if (revision < DC_REVISION_82C169) sc->dc_pmode = DC_PMODE_SYM; break; @@ -2220,16 +2220,16 @@ dc_detach(device_t dev) if (sc->dc_ldata) contigfree(sc->dc_ldata, sizeof(struct dc_list_data), M_DEVBUF); if (sc->dc_pnic_rx_buf != NULL) - free(sc->dc_pnic_rx_buf, M_DEVBUF); + kfree(sc->dc_pnic_rx_buf, M_DEVBUF); while (sc->dc_mi != NULL) { m = sc->dc_mi->dc_next; - free(sc->dc_mi, M_DEVBUF); + kfree(sc->dc_mi, M_DEVBUF); sc->dc_mi = m; } if (sc->dc_srom) - free(sc->dc_srom, M_DEVBUF); + kfree(sc->dc_srom, M_DEVBUF); return(0); } diff --git a/sys/dev/netif/de/if_de.c b/sys/dev/netif/de/if_de.c index 1b06238302..f62c0aa83f 100644 --- a/sys/dev/netif/de/if_de.c +++ b/sys/dev/netif/de/if_de.c @@ -1,7 +1,7 @@ /* $NetBSD: if_de.c,v 1.86 1999/06/01 19:17:59 thorpej Exp $ */ /* $FreeBSD: src/sys/pci/if_de.c,v 1.123.2.4 2000/08/04 23:25:09 peter Exp $ */ -/* $DragonFly: src/sys/dev/netif/de/if_de.c,v 1.43 2006/08/03 16:40:47 swildner Exp $ */ +/* $DragonFly: src/sys/dev/netif/de/if_de.c,v 1.44 2006/09/05 00:55:39 dillon Exp $ */ /*- * Copyright (c) 1994-1997 Matt Thomas (matt@3am-software.com) @@ -4189,8 +4189,8 @@ tulip_pci_attach(device_t dev) sc->tulip_if.if_serializer)) { device_printf(dev, "couldn't map interrupt\n"); tulip_detach(sc); - free((caddr_t) sc->tulip_rxdescs, M_DEVBUF); - free((caddr_t) sc->tulip_txdescs, M_DEVBUF); + kfree((caddr_t) sc->tulip_rxdescs, M_DEVBUF); + kfree((caddr_t) sc->tulip_txdescs, M_DEVBUF); return ENXIO; } } diff --git a/sys/dev/netif/em/if_em.c b/sys/dev/netif/em/if_em.c index 4595d5c53c..6a68eee4ed 100644 --- a/sys/dev/netif/em/if_em.c +++ b/sys/dev/netif/em/if_em.c @@ -64,7 +64,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/dev/netif/em/if_em.c,v 1.47 2006/08/12 13:03:44 sephe Exp $ + * $DragonFly: src/sys/dev/netif/em/if_em.c,v 1.48 2006/09/05 00:55:40 dillon Exp $ * $FreeBSD$ */ /* @@ -2426,7 +2426,7 @@ em_free_transmit_structures(struct adapter * adapter) } } if (adapter->tx_buffer_area != NULL) { - free(adapter->tx_buffer_area, M_DEVBUF); + kfree(adapter->tx_buffer_area, M_DEVBUF); adapter->tx_buffer_area = NULL; } if (adapter->txtag != NULL) { @@ -2656,7 +2656,7 @@ em_allocate_receive_structures(struct adapter *adapter) struct em_buffer *rx_buffer; size = adapter->num_rx_desc * sizeof(struct em_buffer); - adapter->rx_buffer_area = malloc(size, M_DEVBUF, M_WAITOK | M_ZERO); + adapter->rx_buffer_area = kmalloc(size, M_DEVBUF, M_WAITOK | M_ZERO); error = bus_dma_tag_create(NULL, /* parent */ 1, 0, /* alignment, bounds */ @@ -2705,7 +2705,7 @@ fail_1: bus_dma_tag_destroy(adapter->rxtag); fail_0: adapter->rxtag = NULL; - free(adapter->rx_buffer_area, M_DEVBUF); + kfree(adapter->rx_buffer_area, M_DEVBUF); adapter->rx_buffer_area = NULL; return(error); } @@ -2842,7 +2842,7 @@ em_free_receive_structures(struct adapter *adapter) } } if (adapter->rx_buffer_area != NULL) { - free(adapter->rx_buffer_area, M_DEVBUF); + kfree(adapter->rx_buffer_area, M_DEVBUF); adapter->rx_buffer_area = NULL; } if (adapter->rxtag != NULL) { diff --git a/sys/dev/netif/en_pci/if_en_pci.c b/sys/dev/netif/en_pci/if_en_pci.c index 171c2326f5..8c00214798 100644 --- a/sys/dev/netif/en_pci/if_en_pci.c +++ b/sys/dev/netif/en_pci/if_en_pci.c @@ -32,7 +32,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/pci/if_en_pci.c,v 1.12 1999/08/21 22:10:49 msmith Exp $ - * $DragonFly: src/sys/dev/netif/en_pci/if_en_pci.c,v 1.12 2006/08/06 12:49:05 swildner Exp $ + * $DragonFly: src/sys/dev/netif/en_pci/if_en_pci.c,v 1.13 2006/09/05 00:55:40 dillon Exp $ */ /* @@ -223,13 +223,13 @@ en_pci_attach(pcici_t config_id, int unit) return; } - scp = malloc(sizeof(*scp), M_DEVBUF, M_WAITOK | M_ZERO); + scp = kmalloc(sizeof(*scp), M_DEVBUF, M_WAITOK | M_ZERO); sc = &scp->esc; retval = pci_map_mem(config_id, PCI_CBMA, (vm_offset_t *) &sc->en_base, &pa); if (!retval) { - free((caddr_t) scp, M_DEVBUF); + kfree((caddr_t) scp, M_DEVBUF); return; } enpcis[unit] = scp; /* lock it in */ diff --git a/sys/dev/netif/fpa/if_fpa.c b/sys/dev/netif/fpa/if_fpa.c index ec08575ca3..fd5eda1a7e 100644 --- a/sys/dev/netif/fpa/if_fpa.c +++ b/sys/dev/netif/fpa/if_fpa.c @@ -22,7 +22,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/pdq/if_fpa.c,v 1.13 1999/08/28 00:50:50 peter Exp $ - * $DragonFly: src/sys/dev/netif/fpa/Attic/if_fpa.c,v 1.15 2006/08/06 12:49:05 swildner Exp $ + * $DragonFly: src/sys/dev/netif/fpa/Attic/if_fpa.c,v 1.16 2006/09/05 00:55:40 dillon Exp $ */ /* @@ -172,9 +172,9 @@ pdq_pci_attach( pci_conf_write(config_id, PCI_CFLT, data); } - sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO); + sc = kmalloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO); if (!pci_map_mem(config_id, PCI_CBMA, &va_csrs, &pa_csrs)) { - free((void *) sc, M_DEVBUF); + kfree((void *) sc, M_DEVBUF); return; } @@ -184,7 +184,7 @@ pdq_pci_attach( sc->sc_if.if_dname, sc->sc_if.if_dunit, (void *) sc, PDQ_DEFPA); if (sc->sc_pdq == NULL) { - free((void *) sc, M_DEVBUF); + kfree((void *) sc, M_DEVBUF); return; } bcopy((caddr_t) sc->sc_pdq->pdq_hwaddr.lanaddr_bytes, sc->sc_ac.ac_enaddr, 6); diff --git a/sys/dev/netif/fwe/if_fwe.c b/sys/dev/netif/fwe/if_fwe.c index 0aa7e80219..ba7c0e62a2 100644 --- a/sys/dev/netif/fwe/if_fwe.c +++ b/sys/dev/netif/fwe/if_fwe.c @@ -32,7 +32,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/firewire/if_fwe.c,v 1.27 2004/01/08 14:58:09 simokawa Exp $ - * $DragonFly: src/sys/dev/netif/fwe/if_fwe.c,v 1.24 2005/12/31 14:07:59 sephe Exp $ + * $DragonFly: src/sys/dev/netif/fwe/if_fwe.c,v 1.25 2006/09/05 00:55:40 dillon Exp $ */ #include "opt_inet.h" @@ -234,7 +234,7 @@ fwe_stop(struct fwe_softc *fwe) for (i = 0; i < xferq->bnchunk; i ++) m_freem(xferq->bulkxfer[i].mbuf); - free(xferq->bulkxfer, M_FWE); + kfree(xferq->bulkxfer, M_FWE); for (xfer = STAILQ_FIRST(&fwe->xferlist); xfer != NULL; xfer = next) { diff --git a/sys/dev/netif/fxp/if_fxp.c b/sys/dev/netif/fxp/if_fxp.c index 1e95d9ab2f..6034f3e485 100644 --- a/sys/dev/netif/fxp/if_fxp.c +++ b/sys/dev/netif/fxp/if_fxp.c @@ -26,7 +26,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/fxp/if_fxp.c,v 1.110.2.30 2003/06/12 16:47:05 mux Exp $ - * $DragonFly: src/sys/dev/netif/fxp/if_fxp.c,v 1.43 2006/08/06 12:49:05 swildner Exp $ + * $DragonFly: src/sys/dev/netif/fxp/if_fxp.c,v 1.44 2006/09/05 00:55:40 dillon Exp $ */ /* @@ -475,10 +475,10 @@ fxp_attach(device_t dev) sc->cbl_base = malloc(sizeof(struct fxp_cb_tx) * FXP_NTXCB, M_DEVBUF, M_WAITOK | M_ZERO); - sc->fxp_stats = malloc(sizeof(struct fxp_stats), M_DEVBUF, + sc->fxp_stats = kmalloc(sizeof(struct fxp_stats), M_DEVBUF, M_WAITOK | M_ZERO); - sc->mcsp = malloc(sizeof(struct fxp_cb_mcs), M_DEVBUF, M_WAITOK); + sc->mcsp = kmalloc(sizeof(struct fxp_cb_mcs), M_DEVBUF, M_WAITOK); /* * Pre-allocate our receive buffers. @@ -708,11 +708,11 @@ fxp_release(device_t dev) bus_generic_detach(dev); if (sc->cbl_base) - free(sc->cbl_base, M_DEVBUF); + kfree(sc->cbl_base, M_DEVBUF); if (sc->fxp_stats) - free(sc->fxp_stats, M_DEVBUF); + kfree(sc->fxp_stats, M_DEVBUF); if (sc->mcsp) - free(sc->mcsp, M_DEVBUF); + kfree(sc->mcsp, M_DEVBUF); if (sc->rfa_headm) m_freem(sc->rfa_headm); diff --git a/sys/dev/netif/ic/if_ic.c b/sys/dev/netif/ic/if_ic.c index 9c12d22ebd..20b3b3bce6 100644 --- a/sys/dev/netif/ic/if_ic.c +++ b/sys/dev/netif/ic/if_ic.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/iicbus/if_ic.c,v 1.8 1999/12/29 04:35:39 peter Exp $ - * $DragonFly: src/sys/dev/netif/ic/if_ic.c,v 1.14 2005/11/28 17:13:42 dillon Exp $ + * $DragonFly: src/sys/dev/netif/ic/if_ic.c,v 1.15 2006/09/05 00:55:40 dillon Exp $ */ /* @@ -220,7 +220,7 @@ icioctl(struct ifnet *ifp, u_long cmd, caddr_t data, struct ucred *cr) optr = sc->ic_obuf; /* allocate input buffer */ - sc->ic_ifbuf = malloc(ifr->ifr_mtu+ICHDRLEN, M_DEVBUF, M_WAITOK); + sc->ic_ifbuf = kmalloc(ifr->ifr_mtu+ICHDRLEN, M_DEVBUF, M_WAITOK); if (!sc->ic_ifbuf) { sc->ic_ifbuf = iptr; @@ -230,10 +230,10 @@ icioctl(struct ifnet *ifp, u_long cmd, caddr_t data, struct ucred *cr) } /* allocate output buffer */ - sc->ic_ifbuf = malloc(ifr->ifr_mtu+ICHDRLEN, M_DEVBUF, M_WAITOK); + sc->ic_ifbuf = kmalloc(ifr->ifr_mtu+ICHDRLEN, M_DEVBUF, M_WAITOK); if (!sc->ic_obuf) { - free(sc->ic_ifbuf,M_DEVBUF); + kfree(sc->ic_ifbuf,M_DEVBUF); sc->ic_ifbuf = iptr; sc->ic_obuf = optr; @@ -242,10 +242,10 @@ icioctl(struct ifnet *ifp, u_long cmd, caddr_t data, struct ucred *cr) } if (iptr) - free(iptr,M_DEVBUF); + kfree(iptr,M_DEVBUF); if (optr) - free(optr,M_DEVBUF); + kfree(optr,M_DEVBUF); sc->ic_if.if_mtu = ifr->ifr_mtu; break; diff --git a/sys/dev/netif/ie/if_ie.c b/sys/dev/netif/ie/if_ie.c index 303de6f6e0..32288c8197 100644 --- a/sys/dev/netif/ie/if_ie.c +++ b/sys/dev/netif/ie/if_ie.c @@ -48,7 +48,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ie/if_ie.c,v 1.72.2.4 2003/03/27 21:01:49 mdodd Exp $ - * $DragonFly: src/sys/dev/netif/ie/if_ie.c,v 1.27 2006/08/06 12:49:05 swildner Exp $ + * $DragonFly: src/sys/dev/netif/ie/if_ie.c,v 1.28 2006/09/05 00:55:40 dillon Exp $ */ /* @@ -800,7 +800,7 @@ ieattach(struct isa_device *dvp) allocsize = sizeof(void *) * (ie->nframes + (ie->nrxbufs * 2) + (ie->ntxbufs * 3)); - ie->rframes = malloc(allocsize, M_DEVBUF, M_WAITOK); + ie->rframes = kmalloc(allocsize, M_DEVBUF, M_WAITOK); ie->rbuffs = (volatile struct ie_recv_buf_desc **)&ie->rframes[ie->nframes]; ie->cbuffs = (volatile u_char **)&ie->rbuffs[ie->nrxbufs]; diff --git a/sys/dev/netif/ipw/if_ipw.c b/sys/dev/netif/ipw/if_ipw.c index a20e9ca80a..ec686fc7dc 100644 --- a/sys/dev/netif/ipw/if_ipw.c +++ b/sys/dev/netif/ipw/if_ipw.c @@ -27,7 +27,7 @@ * * $Id: if_ipw.c,v 1.7.2.1 2005/01/13 20:01:03 damien Exp $ * $FreeBSD: src/sys/dev/ipw/if_ipw.c,v 1.7.2.4 2006/01/29 15:13:01 damien Exp $ - * $DragonFly: src/sys/dev/netif/ipw/Attic/if_ipw.c,v 1.15 2006/08/06 12:49:05 swildner Exp $ + * $DragonFly: src/sys/dev/netif/ipw/Attic/if_ipw.c,v 1.16 2006/09/05 00:55:40 dillon Exp $ */ /*- @@ -1809,13 +1809,13 @@ ipw_cache_firmware(struct ipw_softc *sc, void *data) fw->ucode_size = le32toh(hdr.ucode_size); p += sizeof hdr; - fw->main = malloc(fw->main_size, M_DEVBUF, M_WAITOK); + fw->main = kmalloc(fw->main_size, M_DEVBUF, M_WAITOK); if (fw->main == NULL) { error = ENOMEM; goto fail1; } - fw->ucode = malloc(fw->ucode_size, M_DEVBUF, M_WAITOK); + fw->ucode = kmalloc(fw->ucode_size, M_DEVBUF, M_WAITOK); if (fw->ucode == NULL) { error = ENOMEM; goto fail2; @@ -1835,8 +1835,8 @@ ipw_cache_firmware(struct ipw_softc *sc, void *data) return 0; -fail3: free(fw->ucode, M_DEVBUF); -fail2: free(fw->main, M_DEVBUF); +fail3: kfree(fw->ucode, M_DEVBUF); +fail2: kfree(fw->main, M_DEVBUF); fail1: return error; @@ -1848,8 +1848,8 @@ ipw_free_firmware(struct ipw_softc *sc) if (!(sc->flags & IPW_FLAG_FW_CACHED)) return; - free(sc->fw.main, M_DEVBUF); - free(sc->fw.ucode, M_DEVBUF); + kfree(sc->fw.main, M_DEVBUF); + kfree(sc->fw.ucode, M_DEVBUF); sc->flags &= ~IPW_FLAG_FW_CACHED; } diff --git a/sys/dev/netif/iwi/if_iwi.c b/sys/dev/netif/iwi/if_iwi.c index b17e201797..edb8ba310f 100644 --- a/sys/dev/netif/iwi/if_iwi.c +++ b/sys/dev/netif/iwi/if_iwi.c @@ -29,7 +29,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/iwi/if_iwi.c,v 1.8.2.6 2006/02/23 02:06:46 sam Exp $ - * $DragonFly: src/sys/dev/netif/iwi/if_iwi.c,v 1.14 2006/09/03 17:31:54 dillon Exp $ + * $DragonFly: src/sys/dev/netif/iwi/if_iwi.c,v 1.15 2006/09/05 00:55:40 dillon Exp $ */ /*- @@ -720,7 +720,7 @@ iwi_alloc_tx_ring(struct iwi_softc *sc, struct iwi_tx_ring *ring, int count, goto fail; } - ring->data = malloc(count * sizeof (struct iwi_tx_data), M_DEVBUF, + ring->data = kmalloc(count * sizeof (struct iwi_tx_data), M_DEVBUF, M_WAITOK | M_ZERO); error = bus_dma_tag_create(NULL, 1, 0, BUS_SPACE_MAXADDR_32BIT, @@ -815,7 +815,7 @@ iwi_free_tx_ring(struct iwi_softc *sc, struct iwi_tx_ring *ring) } } - free(ring->data, M_DEVBUF); + kfree(ring->data, M_DEVBUF); ring->data = NULL; } @@ -834,7 +834,7 @@ iwi_alloc_rx_ring(struct iwi_softc *sc, struct iwi_rx_ring *ring, int count) ring->count = count; ring->cur = 0; - ring->data = malloc(count * sizeof (struct iwi_rx_data), M_DEVBUF, + ring->data = kmalloc(count * sizeof (struct iwi_rx_data), M_DEVBUF, M_WAITOK | M_ZERO); error = bus_dma_tag_create(NULL, 1, 0, BUS_SPACE_MAXADDR_32BIT, @@ -913,7 +913,7 @@ iwi_free_rx_ring(struct iwi_softc *sc, struct iwi_rx_ring *ring) } } - free(ring->data, M_DEVBUF); + kfree(ring->data, M_DEVBUF); ring->data = NULL; } @@ -975,7 +975,7 @@ iwi_node_alloc(struct ieee80211_node_table *nt) { struct iwi_node *in; - in = malloc(sizeof (struct iwi_node), M_80211_NODE, M_NOWAIT | M_ZERO); + in = kmalloc(sizeof (struct iwi_node), M_80211_NODE, M_NOWAIT | M_ZERO); if (in == NULL) return NULL; @@ -2273,9 +2273,9 @@ iwi_cache_firmware(struct iwi_softc *sc, void *data) kfw->ucode_size = ufw.ucode_size; kfw->main_size = ufw.main_size; - kfw->boot = malloc(kfw->boot_size, M_DEVBUF, M_WAITOK); - kfw->ucode = malloc(kfw->ucode_size, M_DEVBUF, M_WAITOK); - kfw->main = malloc(kfw->main_size, M_DEVBUF, M_WAITOK); + kfw->boot = kmalloc(kfw->boot_size, M_DEVBUF, M_WAITOK); + kfw->ucode = kmalloc(kfw->ucode_size, M_DEVBUF, M_WAITOK); + kfw->main = kmalloc(kfw->main_size, M_DEVBUF, M_WAITOK); if ((error = copyin(ufw.boot, kfw->boot, kfw->boot_size)) != 0) goto fail; @@ -2294,9 +2294,9 @@ iwi_cache_firmware(struct iwi_softc *sc, void *data) return 0; fail: - free(kfw->boot, M_DEVBUF); - free(kfw->ucode, M_DEVBUF); - free(kfw->main, M_DEVBUF); + kfree(kfw->boot, M_DEVBUF); + kfree(kfw->ucode, M_DEVBUF); + kfree(kfw->main, M_DEVBUF); return error; } @@ -2307,9 +2307,9 @@ iwi_free_firmware(struct iwi_softc *sc) if (!(sc->flags & IWI_FLAG_FW_CACHED)) return; - free(sc->fw.boot, M_DEVBUF); - free(sc->fw.ucode, M_DEVBUF); - free(sc->fw.main, M_DEVBUF); + kfree(sc->fw.boot, M_DEVBUF); + kfree(sc->fw.ucode, M_DEVBUF); + kfree(sc->fw.main, M_DEVBUF); sc->flags &= ~IWI_FLAG_FW_CACHED; } diff --git a/sys/dev/netif/kue/if_kue.c b/sys/dev/netif/kue/if_kue.c index c04e3f8414..b5ff98081d 100644 --- a/sys/dev/netif/kue/if_kue.c +++ b/sys/dev/netif/kue/if_kue.c @@ -30,7 +30,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/usb/if_kue.c,v 1.17.2.9 2003/04/13 02:39:25 murray Exp $ - * $DragonFly: src/sys/dev/netif/kue/if_kue.c,v 1.19 2006/08/06 12:49:05 swildner Exp $ + * $DragonFly: src/sys/dev/netif/kue/if_kue.c,v 1.20 2006/09/05 00:55:40 dillon Exp $ */ /* @@ -521,7 +521,7 @@ kue_detach(device_ptr_t dev) usbd_abort_pipe(sc->kue_ep[KUE_ENDPT_INTR]); if (sc->kue_mcfilters != NULL) - free(sc->kue_mcfilters, M_USBDEV); + kfree(sc->kue_mcfilters, M_USBDEV); KUE_UNLOCK(sc); #if defined(__FreeBSD__) && __FreeBSD_version >= 500000 @@ -608,7 +608,7 @@ kue_tx_list_init(struct kue_softc *sc) if (c->kue_xfer == NULL) return(ENOBUFS); } - c->kue_buf = malloc(KUE_BUFSZ, M_USBDEV, M_WAITOK); + c->kue_buf = kmalloc(KUE_BUFSZ, M_USBDEV, M_WAITOK); if (c->kue_buf == NULL) return(ENOBUFS); } @@ -1076,7 +1076,7 @@ kue_stop(struct kue_softc *sc) /* Free RX resources. */ for (i = 0; i < KUE_RX_LIST_CNT; i++) { if (sc->kue_cdata.kue_rx_chain[i].kue_buf != NULL) { - free(sc->kue_cdata.kue_rx_chain[i].kue_buf, M_USBDEV); + kfree(sc->kue_cdata.kue_rx_chain[i].kue_buf, M_USBDEV); sc->kue_cdata.kue_rx_chain[i].kue_buf = NULL; } if (sc->kue_cdata.kue_rx_chain[i].kue_mbuf != NULL) { @@ -1092,7 +1092,7 @@ kue_stop(struct kue_softc *sc) /* Free TX resources. */ for (i = 0; i < KUE_TX_LIST_CNT; i++) { if (sc->kue_cdata.kue_tx_chain[i].kue_buf != NULL) { - free(sc->kue_cdata.kue_tx_chain[i].kue_buf, M_USBDEV); + kfree(sc->kue_cdata.kue_tx_chain[i].kue_buf, M_USBDEV); sc->kue_cdata.kue_tx_chain[i].kue_buf = NULL; } if (sc->kue_cdata.kue_tx_chain[i].kue_mbuf != NULL) { diff --git a/sys/dev/netif/le/if_le.c b/sys/dev/netif/le/if_le.c index 7b82b41eb1..6de28bcef1 100644 --- a/sys/dev/netif/le/if_le.c +++ b/sys/dev/netif/le/if_le.c @@ -22,7 +22,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/i386/isa/if_le.c,v 1.56.2.4 2002/06/05 23:24:10 paul Exp $ - * $DragonFly: src/sys/dev/netif/le/if_le.c,v 1.33 2005/11/28 17:13:42 dillon Exp $ + * $DragonFly: src/sys/dev/netif/le/if_le.c,v 1.34 2006/09/05 00:55:40 dillon Exp $ */ /* @@ -1329,7 +1329,7 @@ lance_init_ring(struct le_softc *sc, ln_ring_t *rp, lance_ring_t *ri, * our ring information data structure. All these are * our copies and do not live in the LANCE RAM. */ - ri->ri_first = malloc(ndescs * sizeof(*di), M_DEVBUF, M_WAITOK); + ri->ri_first = kmalloc(ndescs * sizeof(*di), M_DEVBUF, M_WAITOK); ri->ri_free = ri->ri_max = ndescs; ri->ri_last = ri->ri_first + ri->ri_max; for (di = ri->ri_first; di < ri->ri_last; di++) { diff --git a/sys/dev/netif/mii_layer/mii.c b/sys/dev/netif/mii_layer/mii.c index 33d045673f..bb5bf6180c 100644 --- a/sys/dev/netif/mii_layer/mii.c +++ b/sys/dev/netif/mii_layer/mii.c @@ -37,7 +37,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/mii/mii.c,v 1.6.2.2 2002/08/19 16:56:33 ambrisko Exp $ - * $DragonFly: src/sys/dev/netif/mii_layer/mii.c,v 1.10 2006/08/06 12:49:05 swildner Exp $ + * $DragonFly: src/sys/dev/netif/mii_layer/mii.c,v 1.11 2006/09/05 00:55:40 dillon Exp $ */ /* @@ -145,7 +145,7 @@ miibus_probe(device_t dev) ma.mii_data = mii; ma.mii_capmask = capmask; - args = malloc(sizeof(struct mii_attach_args), + args = kmalloc(sizeof(struct mii_attach_args), M_DEVBUF, M_INTWAIT); *args = ma; child = device_add_child(dev, NULL, -1); @@ -250,7 +250,7 @@ mii_phy_probe(device_t dev, device_t *child, ifm_change_cb_t ifmedia_upd, void **v; int i; - v = malloc(sizeof(vm_offset_t) * 2, M_DEVBUF, M_INTWAIT); + v = kmalloc(sizeof(vm_offset_t) * 2, M_DEVBUF, M_INTWAIT); v[0] = ifmedia_upd; v[1] = ifmedia_sts; *child = device_add_child(dev, "miibus", -1); diff --git a/sys/dev/netif/mii_layer/mlphy.c b/sys/dev/netif/mii_layer/mlphy.c index 06fa9d7b01..61bbe5ae72 100644 --- a/sys/dev/netif/mii_layer/mlphy.c +++ b/sys/dev/netif/mii_layer/mlphy.c @@ -30,7 +30,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/mii/mlphy.c,v 1.2.2.3 2001/02/09 09:50:15 asmodai Exp $ - * $DragonFly: src/sys/dev/netif/mii_layer/mlphy.c,v 1.9 2006/08/06 10:32:23 sephe Exp $ + * $DragonFly: src/sys/dev/netif/mii_layer/mlphy.c,v 1.10 2006/09/05 00:55:40 dillon Exp $ */ /* @@ -216,7 +216,7 @@ mlphy_service(struct mii_softc *xsc, struct mii_data *mii, int cmd) break; } } - free(devlist, M_TEMP); + kfree(devlist, M_TEMP); KKASSERT(ife->ifm_data >= 0 && ife->ifm_data < MII_NMEDIA); mm = &mii_media_table[ife->ifm_data]; @@ -426,7 +426,7 @@ mlphy_status(struct mii_softc *sc) break; } } - free(devlist, M_TEMP); + kfree(devlist, M_TEMP); if (other == NULL) return; diff --git a/sys/dev/netif/mii_layer/tlphy.c b/sys/dev/netif/mii_layer/tlphy.c index 4e08a0a428..246d36901d 100644 --- a/sys/dev/netif/mii_layer/tlphy.c +++ b/sys/dev/netif/mii_layer/tlphy.c @@ -37,7 +37,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/mii/tlphy.c,v 1.2.2.2 2001/07/29 22:48:37 kris Exp $ - * $DragonFly: src/sys/dev/netif/mii_layer/tlphy.c,v 1.9 2006/08/06 10:32:23 sephe Exp $ + * $DragonFly: src/sys/dev/netif/mii_layer/tlphy.c,v 1.10 2006/09/05 00:55:40 dillon Exp $ */ /* @@ -181,7 +181,7 @@ tlphy_attach(device_t dev) break; } } - free(devlist, M_TEMP); + kfree(devlist, M_TEMP); } mii->mii_instance++; diff --git a/sys/dev/netif/mn/if_mn.c b/sys/dev/netif/mn/if_mn.c index 43ae838888..eb809aebbd 100644 --- a/sys/dev/netif/mn/if_mn.c +++ b/sys/dev/netif/mn/if_mn.c @@ -22,7 +22,7 @@ * this gadget. * * $FreeBSD: src/sys/pci/if_mn.c,v 1.11.2.3 2001/01/23 12:47:09 phk Exp $ - * $DragonFly: src/sys/dev/netif/mn/if_mn.c,v 1.11 2005/11/28 17:13:43 dillon Exp $ + * $DragonFly: src/sys/dev/netif/mn/if_mn.c,v 1.12 2006/09/05 00:55:40 dillon Exp $ */ /* @@ -494,7 +494,7 @@ mn_alloc_desc(void) if (dp) mn_desc_free = dp->vnext; else - dp = (struct trxd *)malloc(sizeof *dp, M_MN, M_INTWAIT); + dp = (struct trxd *)kmalloc(sizeof *dp, M_MN, M_INTWAIT); return (dp); } @@ -1312,7 +1312,7 @@ mn_attach (device_t self) once++; } - sc = (struct softc *)malloc(sizeof *sc, M_MN, M_WAITOK | M_ZERO); + sc = (struct softc *)kmalloc(sizeof *sc, M_MN, M_WAITOK | M_ZERO); device_set_softc(self, sc); sc->dev = self; diff --git a/sys/dev/netif/ndis/if_ndis.c b/sys/dev/netif/ndis/if_ndis.c index 0518f3a6b4..6e2cd45e69 100644 --- a/sys/dev/netif/ndis/if_ndis.c +++ b/sys/dev/netif/ndis/if_ndis.c @@ -30,7 +30,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/if_ndis/if_ndis.c,v 1.65 2004/07/07 17:46:30 wpaul Exp $ - * $DragonFly: src/sys/dev/netif/ndis/if_ndis.c,v 1.16 2006/08/06 12:49:05 swildner Exp $ + * $DragonFly: src/sys/dev/netif/ndis/if_ndis.c,v 1.17 2006/09/05 00:55:40 dillon Exp $ */ #include @@ -158,7 +158,7 @@ ndis_setmulti(struct ndis_softc *sc) len = sizeof(mclistsz); ndis_get_info(sc, OID_802_3_MAXIMUM_LIST_SIZE, &mclistsz, &len); - mclist = malloc(ETHER_ADDR_LEN * mclistsz, M_TEMP, M_NOWAIT|M_ZERO); + mclist = kmalloc(ETHER_ADDR_LEN * mclistsz, M_TEMP, M_NOWAIT|M_ZERO); if (mclist == NULL) { sc->ndis_filter |= NDIS_PACKET_TYPE_ALL_MULTICAST; @@ -190,7 +190,7 @@ ndis_setmulti(struct ndis_softc *sc) } out: - free(mclist, M_TEMP); + kfree(mclist, M_TEMP); len = sizeof(sc->ndis_filter); error = ndis_set_info(sc, OID_GEN_CURRENT_PACKET_FILTER, @@ -225,7 +225,7 @@ ndis_set_offload(struct ndis_softc *sc) len = sizeof(ndis_task_offload_hdr) + sizeof(ndis_task_offload) + sizeof(ndis_task_tcpip_csum); - ntoh = malloc(len, M_TEMP, M_NOWAIT|M_ZERO); + ntoh = kmalloc(len, M_TEMP, M_NOWAIT|M_ZERO); if (ntoh == NULL) return(ENOMEM); @@ -255,7 +255,7 @@ ndis_set_offload(struct ndis_softc *sc) nttc->nttc_v4rx = sc->ndis_v4rx; error = ndis_set_info(sc, OID_TCP_TASK_OFFLOAD, ntoh, &len); - free(ntoh, M_TEMP); + kfree(ntoh, M_TEMP); return(error); } @@ -277,7 +277,7 @@ ndis_probe_offload(struct ndis_softc *sc) if (error != ENOSPC) return(error); - ntoh = malloc(len, M_TEMP, M_NOWAIT|M_ZERO); + ntoh = kmalloc(len, M_TEMP, M_NOWAIT|M_ZERO); if (ntoh == NULL) return(ENOMEM); @@ -291,12 +291,12 @@ ndis_probe_offload(struct ndis_softc *sc) error = ndis_get_info(sc, OID_TCP_TASK_OFFLOAD, ntoh, &len); if (error) { - free(ntoh, M_TEMP); + kfree(ntoh, M_TEMP); return(error); } if (ntoh->ntoh_vers != NDIS_TASK_OFFLOAD_VERSION) { - free(ntoh, M_TEMP); + kfree(ntoh, M_TEMP); return(EINVAL); } @@ -321,7 +321,7 @@ ndis_probe_offload(struct ndis_softc *sc) } if (nttc == NULL) { - free(ntoh, M_TEMP); + kfree(ntoh, M_TEMP); return(ENOENT); } @@ -345,7 +345,7 @@ ndis_probe_offload(struct ndis_softc *sc) if (nttc->nttc_v4rx & NDIS_TCPSUM_FLAGS_UDP_CSUM) ifp->if_capabilities |= IFCAP_RXCSUM; - free(ntoh, M_TEMP); + kfree(ntoh, M_TEMP); return(0); } @@ -482,11 +482,11 @@ ndis_attach(device_t dev) NULL, &len); if (r != ENOSPC) goto nonettypes; - ntl = malloc(len, M_DEVBUF, M_WAITOK|M_ZERO); + ntl = kmalloc(len, M_DEVBUF, M_WAITOK|M_ZERO); r = ndis_get_info(sc, OID_802_11_NETWORK_TYPES_SUPPORTED, ntl, &len); if (r != 0) { - free(ntl, M_DEVBUF); + kfree(ntl, M_DEVBUF); goto nonettypes; } @@ -506,7 +506,7 @@ ndis_attach(device_t dev) break; } } - free(ntl, M_DEVBUF); + kfree(ntl, M_DEVBUF); nonettypes: len = sizeof(rates); bzero((char *)&rates, len); @@ -1602,12 +1602,12 @@ ndis_get_assoc(struct ndis_softc *sc, ndis_wlan_bssid_ex **assoc) return (error); } - bl = malloc(len, M_TEMP, M_NOWAIT|M_ZERO); + bl = kmalloc(len, M_TEMP, M_NOWAIT|M_ZERO); if (bl == NULL) return (ENOMEM); error = ndis_get_info(sc, OID_802_11_BSSID_LIST, bl, &len); if (error) { - free(bl, M_TEMP); + kfree(bl, M_TEMP); device_printf(sc->ndis_dev, "bssid_list failed\n"); return (error); } @@ -1615,19 +1615,19 @@ ndis_get_assoc(struct ndis_softc *sc, ndis_wlan_bssid_ex **assoc) bs = (ndis_wlan_bssid_ex *)&bl->nblx_bssid[0]; for (i = 0; i < bl->nblx_items; i++) { if (bcmp(bs->nwbx_macaddr, bssid, sizeof(bssid)) == 0) { - *assoc = malloc(bs->nwbx_len, M_TEMP, M_NOWAIT); + *assoc = kmalloc(bs->nwbx_len, M_TEMP, M_NOWAIT); if (*assoc == NULL) { - free(bl, M_TEMP); + kfree(bl, M_TEMP); return(ENOMEM); } bcopy((char *)bs, (char *)*assoc, bs->nwbx_len); - free(bl, M_TEMP); + kfree(bl, M_TEMP); return(0); } bs = (ndis_wlan_bssid_ex *)((char *)bs + bs->nwbx_len); } - free(bl, M_TEMP); + kfree(bl, M_TEMP); return(ENOENT); } @@ -1674,7 +1674,7 @@ ndis_getstate_80211(struct ndis_softc *sc) "unknown nettype %d\n", arg); break; } - free(bs, M_TEMP); + kfree(bs, M_TEMP); } else { return; } @@ -1885,10 +1885,10 @@ ndis_wi_ioctl_get(struct ifnet *ifp, u_long command, caddr_t data) error = ndis_get_info(sc, OID_802_11_BSSID_LIST, NULL, &len); if (error != ENOSPC) break; - bl = malloc(len, M_DEVBUF, M_WAITOK|M_ZERO); + bl = kmalloc(len, M_DEVBUF, M_WAITOK|M_ZERO); error = ndis_get_info(sc, OID_802_11_BSSID_LIST, bl, &len); if (error) { - free(bl, M_DEVBUF); + kfree(bl, M_DEVBUF); break; } maxaps = (2 * wreq.wi_len - sizeof(int)) / sizeof(*api); @@ -1925,7 +1925,7 @@ ndis_wi_ioctl_get(struct ifnet *ifp, u_long command, caddr_t data) api++; wb = (ndis_wlan_bssid_ex *)((char *)wb + wb->nwbx_len); } - free(bl, M_DEVBUF); + kfree(bl, M_DEVBUF); error = copyout(&wreq, ifr->ifr_data, sizeof(wreq)); break; default: diff --git a/sys/dev/netif/plip/if_plip.c b/sys/dev/netif/plip/if_plip.c index 20602f3647..eeae51a413 100644 --- a/sys/dev/netif/plip/if_plip.c +++ b/sys/dev/netif/plip/if_plip.c @@ -25,7 +25,7 @@ * * From Id: lpt.c,v 1.55.2.1 1996/11/12 09:08:38 phk Exp * $FreeBSD: src/sys/dev/ppbus/if_plip.c,v 1.19.2.1 2000/05/24 00:20:57 n_hibma Exp $ - * $DragonFly: src/sys/dev/netif/plip/if_plip.c,v 1.16 2005/11/28 17:13:43 dillon Exp $ + * $DragonFly: src/sys/dev/netif/plip/if_plip.c,v 1.17 2006/09/05 00:55:40 dillon Exp $ */ /* @@ -257,10 +257,10 @@ lpinittables (void) int i; if (!txmith) - txmith = malloc(4*LPIPTBLSIZE, M_DEVBUF, M_WAITOK); + txmith = kmalloc(4*LPIPTBLSIZE, M_DEVBUF, M_WAITOK); if (!ctxmith) - ctxmith = malloc(4*LPIPTBLSIZE, M_DEVBUF, M_WAITOK); + ctxmith = kmalloc(4*LPIPTBLSIZE, M_DEVBUF, M_WAITOK); for (i=0; i < LPIPTBLSIZE; i++) { ctxmith[i] = (i & 0xF0) >> 4; @@ -332,7 +332,7 @@ lpioctl (struct ifnet *ifp, u_long cmd, caddr_t data, struct ucred *cr) return ENOBUFS; } - sc->sc_ifbuf = malloc(sc->sc_if.if_mtu + MLPIPHDRLEN, + sc->sc_ifbuf = kmalloc(sc->sc_if.if_mtu + MLPIPHDRLEN, M_DEVBUF, M_WAITOK); if (!sc->sc_ifbuf) { ppb_release_bus(ppbus, dev); @@ -354,9 +354,9 @@ lpioctl (struct ifnet *ifp, u_long cmd, caddr_t data, struct ucred *cr) case SIOCSIFMTU: ptr = sc->sc_ifbuf; - sc->sc_ifbuf = malloc(ifr->ifr_mtu+MLPIPHDRLEN, M_DEVBUF, M_WAITOK); + sc->sc_ifbuf = kmalloc(ifr->ifr_mtu+MLPIPHDRLEN, M_DEVBUF, M_WAITOK); if (ptr) - free(ptr,M_DEVBUF); + kfree(ptr,M_DEVBUF); sc->sc_if.if_mtu = ifr->ifr_mtu; break; diff --git a/sys/dev/netif/ral/rt2560.c b/sys/dev/netif/ral/rt2560.c index 7553cc43f1..27d1795dfe 100644 --- a/sys/dev/netif/ral/rt2560.c +++ b/sys/dev/netif/ral/rt2560.c @@ -15,7 +15,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * $FreeBSD: src/sys/dev/ral/rt2560.c,v 1.3 2006/03/21 21:15:43 damien Exp $ - * $DragonFly: src/sys/dev/netif/ral/rt2560.c,v 1.1 2006/05/20 09:13:09 sephe Exp $ + * $DragonFly: src/sys/dev/netif/ral/rt2560.c,v 1.2 2006/09/05 00:55:40 dillon Exp $ */ /* @@ -512,7 +512,7 @@ rt2560_alloc_tx_ring(struct rt2560_softc *sc, struct rt2560_tx_ring *ring, goto fail; } - ring->data = malloc(count * sizeof (struct rt2560_tx_data), M_DEVBUF, + ring->data = kmalloc(count * sizeof (struct rt2560_tx_data), M_DEVBUF, M_WAITOK | M_ZERO); error = bus_dma_tag_create(NULL, 1, 0, BUS_SPACE_MAXADDR_32BIT, @@ -613,7 +613,7 @@ rt2560_free_tx_ring(struct rt2560_softc *sc, struct rt2560_tx_ring *ring) } } - free(ring->data, M_DEVBUF); + kfree(ring->data, M_DEVBUF); ring->data = NULL; } @@ -662,7 +662,7 @@ rt2560_alloc_rx_ring(struct rt2560_softc *sc, struct rt2560_rx_ring *ring, goto fail; } - ring->data = malloc(count * sizeof (struct rt2560_rx_data), M_DEVBUF, + ring->data = kmalloc(count * sizeof (struct rt2560_rx_data), M_DEVBUF, M_WAITOK | M_ZERO); /* @@ -772,7 +772,7 @@ rt2560_free_rx_ring(struct rt2560_softc *sc, struct rt2560_rx_ring *ring) } } - free(ring->data, M_DEVBUF); + kfree(ring->data, M_DEVBUF); ring->data = NULL; } @@ -787,7 +787,7 @@ rt2560_node_alloc(struct ieee80211_node_table *nt) { struct rt2560_node *rn; - rn = malloc(sizeof(struct rt2560_node), M_80211_NODE, + rn = kmalloc(sizeof(struct rt2560_node), M_80211_NODE, M_NOWAIT | M_ZERO); return (rn != NULL) ? &rn->ni : NULL; diff --git a/sys/dev/netif/ral/rt2661.c b/sys/dev/netif/ral/rt2661.c index 67519728e8..632617cf82 100644 --- a/sys/dev/netif/ral/rt2661.c +++ b/sys/dev/netif/ral/rt2661.c @@ -15,7 +15,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * $FreeBSD: src/sys/dev/ral/rt2661.c,v 1.4 2006/03/21 21:15:43 damien Exp $ - * $DragonFly: src/sys/dev/netif/ral/rt2661.c,v 1.2 2006/07/02 10:03:17 sephe Exp $ + * $DragonFly: src/sys/dev/netif/ral/rt2661.c,v 1.3 2006/09/05 00:55:40 dillon Exp $ */ /* @@ -539,7 +539,7 @@ rt2661_alloc_tx_ring(struct rt2661_softc *sc, struct rt2661_tx_ring *ring, goto fail; } - ring->data = malloc(count * sizeof (struct rt2661_tx_data), M_DEVBUF, + ring->data = kmalloc(count * sizeof (struct rt2661_tx_data), M_DEVBUF, M_WAITOK | M_ZERO); error = bus_dma_tag_create(NULL, 1, 0, BUS_SPACE_MAXADDR_32BIT, @@ -639,7 +639,7 @@ rt2661_free_tx_ring(struct rt2661_softc *sc, struct rt2661_tx_ring *ring) } } - free(ring->data, M_DEVBUF); + kfree(ring->data, M_DEVBUF); ring->data = NULL; } @@ -687,7 +687,7 @@ rt2661_alloc_rx_ring(struct rt2661_softc *sc, struct rt2661_rx_ring *ring, goto fail; } - ring->data = malloc(count * sizeof (struct rt2661_rx_data), M_DEVBUF, + ring->data = kmalloc(count * sizeof (struct rt2661_rx_data), M_DEVBUF, M_WAITOK | M_ZERO); /* @@ -793,7 +793,7 @@ rt2661_free_rx_ring(struct rt2661_softc *sc, struct rt2661_rx_ring *ring) } } - free(ring->data, M_DEVBUF); + kfree(ring->data, M_DEVBUF); ring->data = NULL; } @@ -808,7 +808,7 @@ rt2661_node_alloc(struct ieee80211_node_table *nt) { struct rt2661_node *rn; - rn = malloc(sizeof (struct rt2661_node), M_80211_NODE, + rn = kmalloc(sizeof (struct rt2661_node), M_80211_NODE, M_NOWAIT | M_ZERO); return (rn != NULL) ? &rn->ni : NULL; diff --git a/sys/dev/netif/re/if_re.c b/sys/dev/netif/re/if_re.c index d66e1dabbf..f127ca5944 100644 --- a/sys/dev/netif/re/if_re.c +++ b/sys/dev/netif/re/if_re.c @@ -33,7 +33,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/re/if_re.c,v 1.25 2004/06/09 14:34:01 naddy Exp $ - * $DragonFly: src/sys/dev/netif/re/if_re.c,v 1.22 2006/08/01 18:07:12 swildner Exp $ + * $DragonFly: src/sys/dev/netif/re/if_re.c,v 1.23 2006/09/05 00:55:40 dillon Exp $ */ /* @@ -759,13 +759,13 @@ re_probe(device_t dev) /* * Temporarily map the I/O space so we can read the chip ID register. */ - sc = malloc(sizeof(*sc), M_TEMP, M_WAITOK | M_ZERO); + sc = kmalloc(sizeof(*sc), M_TEMP, M_WAITOK | M_ZERO); rid = RE_PCI_LOIO; sc->re_res = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid, RF_ACTIVE); if (sc->re_res == NULL) { device_printf(dev, "couldn't map ports/memory\n"); - free(sc, M_TEMP); + kfree(sc, M_TEMP); return(ENXIO); } @@ -774,7 +774,7 @@ re_probe(device_t dev) hwrev = CSR_READ_4(sc, RE_TXCFG) & RE_TXCFG_HWREV; bus_release_resource(dev, SYS_RES_IOPORT, RE_PCI_LOIO, sc->re_res); - free(sc, M_TEMP); + kfree(sc, M_TEMP); /* * and continue matching for the specific chip... diff --git a/sys/dev/netif/rtw/rtw.c b/sys/dev/netif/rtw/rtw.c index 05441d776e..898d40909b 100644 --- a/sys/dev/netif/rtw/rtw.c +++ b/sys/dev/netif/rtw/rtw.c @@ -32,7 +32,7 @@ * SUCH DAMAGE. * * $NetBSD: rtw.c,v 1.72 2006/03/28 00:48:10 dyoung Exp $ - * $DragonFly: src/sys/dev/netif/rtw/rtw.c,v 1.1 2006/09/03 07:37:58 sephe Exp $ + * $DragonFly: src/sys/dev/netif/rtw/rtw.c,v 1.2 2006/09/05 00:55:41 dillon Exp $ */ /* @@ -916,7 +916,7 @@ rtw_srom_read(struct rtw_softc *sc) RTW_WRITE8(regs, RTW_9346CR, ecr); - sr->sr_content = malloc(sr->sr_size, M_DEVBUF, M_WAITOK | M_ZERO); + sr->sr_content = kmalloc(sr->sr_size, M_DEVBUF, M_WAITOK | M_ZERO); /* * RTL8180 has a single 8-bit register for controlling the @@ -940,7 +940,7 @@ rtw_srom_read(struct rtw_softc *sc) /* TBD bus barriers */ if (!read_seeprom(&sd, sr->sr_content, 0, sr->sr_size / 2)) { if_printf(&sc->sc_ic.ic_if, "could not read SROM\n"); - free(sr->sr_content, M_DEVBUF); + kfree(sr->sr_content, M_DEVBUF); sr->sr_content = NULL; return EIO; /* XXX */ } @@ -3932,7 +3932,7 @@ rtw_detach(device_t dev) rtw_rf_destroy(sc->sc_rf); if (sc->sc_srom.sr_content != NULL) - free(sc->sc_srom.sr_content, M_DEVBUF); + kfree(sc->sc_srom.sr_content, M_DEVBUF); if (sc->sc_irq_res != NULL) { bus_release_resource(dev, SYS_RES_IRQ, sc->sc_irq_rid, @@ -4081,7 +4081,7 @@ rtw_txsoft_blk_free(struct rtw_softc *sc, int n_sd, int q_no) bus_dmamap_destroy(sc->sc_txsoft_dmat, tsb->tsb_desc[i].ts_dmamap); } - free(tsb->tsb_desc, M_DEVBUF); + kfree(tsb->tsb_desc, M_DEVBUF); tsb->tsb_desc = NULL; } } @@ -4095,7 +4095,7 @@ rtw_txsoft_blk_alloc(struct rtw_softc *sc, int q_len, int q_no, uint8_t q_poll) STAILQ_INIT(&tsb->tsb_dirtyq); STAILQ_INIT(&tsb->tsb_freeq); tsb->tsb_ndesc = q_len; - tsb->tsb_desc = malloc(q_len * sizeof(*tsb->tsb_desc), M_DEVBUF, + tsb->tsb_desc = kmalloc(q_len * sizeof(*tsb->tsb_desc), M_DEVBUF, M_WAITOK | M_ZERO); tsb->tsb_poll = q_poll; diff --git a/sys/dev/netif/rtw/rtwphy.c b/sys/dev/netif/rtw/rtwphy.c index 2e69fba258..33745be2ed 100644 --- a/sys/dev/netif/rtw/rtwphy.c +++ b/sys/dev/netif/rtw/rtwphy.c @@ -29,7 +29,7 @@ * OF SUCH DAMAGE. * * $NetBSD: rtwphy.c,v 1.9 2006/03/08 00:24:06 dyoung Exp $ - * $DragonFly: src/sys/dev/netif/rtw/rtwphy.c,v 1.1 2006/09/03 07:37:58 sephe Exp $ + * $DragonFly: src/sys/dev/netif/rtw/rtwphy.c,v 1.2 2006/09/05 00:55:41 dillon Exp $ */ /* @@ -368,7 +368,7 @@ rtw_sa2400_destroy(struct rtw_rf *rf) struct rtw_sa2400 *sa = (struct rtw_sa2400 *)rf; memset(sa, 0, sizeof(*sa)); - free(sa, M_DEVBUF); + kfree(sa, M_DEVBUF); } static int @@ -432,7 +432,7 @@ rtw_sa2400_create(struct rtw_regs *regs, rtw_rf_write_t rf_write, int digphy) struct rtw_rf *rf; struct rtw_bbpset *bb; - sa = malloc(sizeof(*sa), M_DEVBUF, M_WAITOK | M_ZERO); + sa = kmalloc(sizeof(*sa), M_DEVBUF, M_WAITOK | M_ZERO); sa->sa_digphy = digphy; @@ -592,7 +592,7 @@ rtw_grf5101_destroy(struct rtw_rf *rf) struct rtw_grf5101 *gr = (struct rtw_grf5101 *)rf; memset(gr, 0, sizeof(*gr)); - free(gr, M_DEVBUF); + kfree(gr, M_DEVBUF); } struct rtw_rf * @@ -603,7 +603,7 @@ rtw_grf5101_create(struct rtw_regs *regs, rtw_rf_write_t rf_write, int digphy) struct rtw_rf *rf; struct rtw_bbpset *bb; - gr = malloc(sizeof(*gr), M_DEVBUF, M_WAITOK | M_ZERO); + gr = kmalloc(sizeof(*gr), M_DEVBUF, M_WAITOK | M_ZERO); rf = &gr->gr_rf; bus = &gr->gr_bus; @@ -655,7 +655,7 @@ rtw_max2820_destroy(struct rtw_rf *rf) struct rtw_max2820 *mx = (struct rtw_max2820 *)rf; memset(mx, 0, sizeof(*mx)); - free(mx, M_DEVBUF); + kfree(mx, M_DEVBUF); } static int @@ -744,7 +744,7 @@ rtw_max2820_create(struct rtw_regs *regs, rtw_rf_write_t rf_write, int is_a) struct rtw_rf *rf; struct rtw_bbpset *bb; - mx = malloc(sizeof(*mx), M_DEVBUF, M_WAITOK | M_ZERO); + mx = kmalloc(sizeof(*mx), M_DEVBUF, M_WAITOK | M_ZERO); mx->mx_is_a = is_a; diff --git a/sys/dev/netif/rue/if_rue.c b/sys/dev/netif/rue/if_rue.c index 7cf9f1a330..6d25e8dcef 100644 --- a/sys/dev/netif/rue/if_rue.c +++ b/sys/dev/netif/rue/if_rue.c @@ -55,7 +55,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/usb/if_rue.c,v 1.14 2004/06/09 14:34:03 naddy Exp $ - * $DragonFly: src/sys/dev/netif/rue/if_rue.c,v 1.5 2005/11/28 17:13:43 dillon Exp $ + * $DragonFly: src/sys/dev/netif/rue/if_rue.c,v 1.6 2006/09/05 00:55:41 dillon Exp $ */ /* @@ -725,7 +725,7 @@ rue_tx_list_init(struct rue_softc *sc) if (c->rue_xfer == NULL) return (ENOBUFS); } - c->rue_buf = malloc(RUE_BUFSZ, M_USBDEV, M_WAITOK); + c->rue_buf = kmalloc(RUE_BUFSZ, M_USBDEV, M_WAITOK); } return (0); @@ -1082,7 +1082,7 @@ rue_init(void *xsc) } #ifdef RUE_INTR_PIPE - sc->rue_cdata.rue_ibuf = malloc(RUE_INTR_PKTLEN, M_USBDEV, M_WAITOK); + sc->rue_cdata.rue_ibuf = kmalloc(RUE_INTR_PKTLEN, M_USBDEV, M_WAITOK); #endif /* @@ -1342,7 +1342,7 @@ rue_stop(struct rue_softc *sc) /* Free RX resources. */ for (i = 0; i < RUE_RX_LIST_CNT; i++) { if (sc->rue_cdata.rue_rx_chain[i].rue_buf != NULL) { - free(sc->rue_cdata.rue_rx_chain[i].rue_buf, M_USBDEV); + kfree(sc->rue_cdata.rue_rx_chain[i].rue_buf, M_USBDEV); sc->rue_cdata.rue_rx_chain[i].rue_buf = NULL; } if (sc->rue_cdata.rue_rx_chain[i].rue_mbuf != NULL) { @@ -1358,7 +1358,7 @@ rue_stop(struct rue_softc *sc) /* Free TX resources. */ for (i = 0; i < RUE_TX_LIST_CNT; i++) { if (sc->rue_cdata.rue_tx_chain[i].rue_buf != NULL) { - free(sc->rue_cdata.rue_tx_chain[i].rue_buf, M_USBDEV); + kfree(sc->rue_cdata.rue_tx_chain[i].rue_buf, M_USBDEV); sc->rue_cdata.rue_tx_chain[i].rue_buf = NULL; } if (sc->rue_cdata.rue_tx_chain[i].rue_mbuf != NULL) { @@ -1373,7 +1373,7 @@ rue_stop(struct rue_softc *sc) #ifdef RUE_INTR_PIPE if (sc->rue_cdata.rue_ibuf != NULL) { - free(sc->rue_cdata.rue_ibuf, M_USBDEV); + kfree(sc->rue_cdata.rue_ibuf, M_USBDEV); sc->rue_cdata.rue_ibuf = NULL; } #endif diff --git a/sys/dev/netif/sbni/if_sbni_pci.c b/sys/dev/netif/sbni/if_sbni_pci.c index 529c1e1a1e..cc56dcc951 100644 --- a/sys/dev/netif/sbni/if_sbni_pci.c +++ b/sys/dev/netif/sbni/if_sbni_pci.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/sbni/if_sbni_pci.c,v 1.6 2002/09/28 20:59:59 phk Exp $ - * $DragonFly: src/sys/dev/netif/sbni/if_sbni_pci.c,v 1.10 2006/06/11 08:43:34 y0netan1 Exp $ + * $DragonFly: src/sys/dev/netif/sbni/if_sbni_pci.c,v 1.11 2006/09/05 00:55:41 dillon Exp $ */ @@ -99,7 +99,7 @@ sbni_pci_probe(device_t dev) if (!sc->io_res) { printf("sbni: cannot allocate io ports!\n"); if (sc->slave_sc) - free(sc->slave_sc, M_DEVBUF); + kfree(sc->slave_sc, M_DEVBUF); return (ENOENT); } @@ -111,7 +111,7 @@ sbni_pci_probe(device_t dev) bus_release_resource(dev, SYS_RES_IOPORT, sc->io_rid, sc->io_res); if (sc->slave_sc) - free(sc->slave_sc, M_DEVBUF); + kfree(sc->slave_sc, M_DEVBUF); return (ENXIO); } @@ -161,7 +161,7 @@ sbni_pci_attach(device_t dev) dev, SYS_RES_IRQ, sc->irq_rid, sc->irq_res); } if (sc->slave_sc) - free(sc->slave_sc, M_DEVBUF); + kfree(sc->slave_sc, M_DEVBUF); return (error); #endif } diff --git a/sys/dev/netif/sis/if_sis.c b/sys/dev/netif/sis/if_sis.c index 274009fe1e..afc13c58fd 100644 --- a/sys/dev/netif/sis/if_sis.c +++ b/sys/dev/netif/sis/if_sis.c @@ -30,7 +30,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/pci/if_sis.c,v 1.13.4.24 2003/03/05 18:42:33 njl Exp $ - * $DragonFly: src/sys/dev/netif/sis/if_sis.c,v 1.34 2006/08/06 12:49:06 swildner Exp $ + * $DragonFly: src/sys/dev/netif/sis/if_sis.c,v 1.35 2006/09/05 00:55:41 dillon Exp $ */ /* @@ -413,8 +413,8 @@ sis_find_bridge(device_t dev) } done: - free(pci_devices, M_TEMP); - free(pci_children, M_TEMP); + kfree(pci_devices, M_TEMP); + kfree(pci_children, M_TEMP); return(child); } diff --git a/sys/dev/netif/sk/if_sk.c b/sys/dev/netif/sk/if_sk.c index e771b348ed..1e5148d647 100644 --- a/sys/dev/netif/sk/if_sk.c +++ b/sys/dev/netif/sk/if_sk.c @@ -31,7 +31,7 @@ * * $OpenBSD: if_sk.c,v 1.33 2003/08/12 05:23:06 nate Exp $ * $FreeBSD: src/sys/pci/if_sk.c,v 1.19.2.9 2003/03/05 18:42:34 njl Exp $ - * $DragonFly: src/sys/dev/netif/sk/if_sk.c,v 1.44 2006/08/06 12:49:06 swildner Exp $ + * $DragonFly: src/sys/dev/netif/sk/if_sk.c,v 1.45 2006/09/05 00:55:41 dillon Exp $ */ /* @@ -400,9 +400,9 @@ sk_vpd_read(struct sk_softc *sc) int i, pos = 0; if (sc->sk_vpd_prodname != NULL) - free(sc->sk_vpd_prodname, M_DEVBUF); + kfree(sc->sk_vpd_prodname, M_DEVBUF); if (sc->sk_vpd_readonly != NULL) - free(sc->sk_vpd_readonly, M_DEVBUF); + kfree(sc->sk_vpd_readonly, M_DEVBUF); sc->sk_vpd_prodname = NULL; sc->sk_vpd_readonly = NULL; @@ -415,7 +415,7 @@ sk_vpd_read(struct sk_softc *sc) } pos += sizeof(res); - sc->sk_vpd_prodname = malloc(res.vr_len + 1, M_DEVBUF, M_INTWAIT); + sc->sk_vpd_prodname = kmalloc(res.vr_len + 1, M_DEVBUF, M_INTWAIT); for (i = 0; i < res.vr_len; i++) sc->sk_vpd_prodname[i] = sk_vpd_readbyte(sc, i + pos); sc->sk_vpd_prodname[i] = '\0'; @@ -430,7 +430,7 @@ sk_vpd_read(struct sk_softc *sc) } pos += sizeof(res); - sc->sk_vpd_readonly = malloc(res.vr_len, M_DEVBUF, M_INTWAIT); + sc->sk_vpd_readonly = kmalloc(res.vr_len, M_DEVBUF, M_INTWAIT); for (i = 0; i < res.vr_len + 1; i++) sc->sk_vpd_readonly[i] = sk_vpd_readbyte(sc, i + pos); } @@ -1171,7 +1171,7 @@ sk_attach(device_t dev) int i, port; port = *(int *)device_get_ivars(dev); - free(device_get_ivars(dev), M_DEVBUF); + kfree(device_get_ivars(dev), M_DEVBUF); device_set_ivars(dev, NULL); sc_if->sk_dev = dev; callout_init(&sc_if->sk_tick_timer); @@ -1505,13 +1505,13 @@ skc_attach(device_t dev) /* Announce the product name. */ printf("skc%d: %s\n", sc->sk_unit, sc->sk_vpd_prodname); sc->sk_devs[SK_PORT_A] = device_add_child(dev, "sk", -1); - port = malloc(sizeof(int), M_DEVBUF, M_WAITOK); + port = kmalloc(sizeof(int), M_DEVBUF, M_WAITOK); *port = SK_PORT_A; device_set_ivars(sc->sk_devs[SK_PORT_A], port); if (!(sk_win_read_1(sc, SK_CONFIG) & SK_CONFIG_SINGLEMAC)) { sc->sk_devs[SK_PORT_B] = device_add_child(dev, "sk", -1); - port = malloc(sizeof(int), M_DEVBUF, M_WAITOK); + port = kmalloc(sizeof(int), M_DEVBUF, M_WAITOK); *port = SK_PORT_B; device_set_ivars(sc->sk_devs[SK_PORT_B], port); } diff --git a/sys/dev/netif/sr/if_sr.c b/sys/dev/netif/sr/if_sr.c index 15734bf01a..5f1a37e8f2 100644 --- a/sys/dev/netif/sr/if_sr.c +++ b/sys/dev/netif/sr/if_sr.c @@ -28,7 +28,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/sr/if_sr.c,v 1.48.2.1 2002/06/17 15:10:58 jhay Exp $ - * $DragonFly: src/sys/dev/netif/sr/if_sr.c,v 1.17 2005/11/28 17:13:44 dillon Exp $ + * $DragonFly: src/sys/dev/netif/sr/if_sr.c,v 1.18 2006/09/05 00:55:41 dillon Exp $ */ /* @@ -2869,7 +2869,7 @@ ngsr_rcvmsg(node_p node, error = EINVAL; break; } - free(msg, M_NETGRAPH); + kfree(msg, M_NETGRAPH); return (error); } diff --git a/sys/dev/netif/ti/if_ti.c b/sys/dev/netif/ti/if_ti.c index 3ff15eed44..445959c1b8 100644 --- a/sys/dev/netif/ti/if_ti.c +++ b/sys/dev/netif/ti/if_ti.c @@ -30,7 +30,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/pci/if_ti.c,v 1.25.2.14 2002/02/15 04:20:20 silby Exp $ - * $DragonFly: src/sys/dev/netif/ti/if_ti.c,v 1.40 2005/12/31 14:08:00 sephe Exp $ + * $DragonFly: src/sys/dev/netif/ti/if_ti.c,v 1.41 2006/09/05 00:55:41 dillon Exp $ */ /* @@ -1034,14 +1034,14 @@ ti_setmulti(struct ti_softc *sc) mc = sc->ti_mc_listhead.slh_first; ti_del_mcast(sc, &mc->mc_addr); SLIST_REMOVE_HEAD(&sc->ti_mc_listhead, mc_entries); - free(mc, M_DEVBUF); + kfree(mc, M_DEVBUF); } /* Now program new ones. */ LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; - mc = malloc(sizeof(struct ti_mc_entry), M_DEVBUF, M_INTWAIT); + mc = kmalloc(sizeof(struct ti_mc_entry), M_DEVBUF, M_INTWAIT); bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr), &mc->mc_addr, ETHER_ADDR_LEN); SLIST_INSERT_HEAD(&sc->ti_mc_listhead, mc, mc_entries); diff --git a/sys/dev/netif/tx/if_tx.c b/sys/dev/netif/tx/if_tx.c index ba48f92843..ed86d08df6 100644 --- a/sys/dev/netif/tx/if_tx.c +++ b/sys/dev/netif/tx/if_tx.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/tx/if_tx.c,v 1.61.2.1 2002/10/29 01:43:49 semenu Exp $ - * $DragonFly: src/sys/dev/netif/tx/if_tx.c,v 1.35 2006/08/06 12:49:06 swildner Exp $ + * $DragonFly: src/sys/dev/netif/tx/if_tx.c,v 1.36 2006/09/05 00:55:41 dillon Exp $ */ /* @@ -319,11 +319,11 @@ epic_detach(device_t dev) bus_release_resource(dev, EPIC_RES, EPIC_RID, sc->res); if (sc->tx_flist) - free(sc->tx_flist, M_DEVBUF); + kfree(sc->tx_flist, M_DEVBUF); if (sc->tx_desc) - free(sc->tx_desc, M_DEVBUF); + kfree(sc->tx_desc, M_DEVBUF); if (sc->rx_desc) - free(sc->rx_desc, M_DEVBUF); + kfree(sc->rx_desc, M_DEVBUF); return(0); } diff --git a/sys/dev/netif/txp/if_txp.c b/sys/dev/netif/txp/if_txp.c index 36be679465..cbcb4d7411 100644 --- a/sys/dev/netif/txp/if_txp.c +++ b/sys/dev/netif/txp/if_txp.c @@ -1,6 +1,6 @@ /* $OpenBSD: if_txp.c,v 1.48 2001/06/27 06:34:50 kjc Exp $ */ /* $FreeBSD: src/sys/dev/txp/if_txp.c,v 1.4.2.4 2001/12/14 19:50:43 jlemon Exp $ */ -/* $DragonFly: src/sys/dev/netif/txp/if_txp.c,v 1.37 2006/08/03 16:40:47 swildner Exp $ */ +/* $DragonFly: src/sys/dev/netif/txp/if_txp.c,v 1.38 2006/09/05 00:55:41 dillon Exp $ */ /* * Copyright (c) 2001 @@ -350,7 +350,7 @@ txp_detach(device_t dev) ether_ifdetach(ifp); for (i = 0; i < RXBUF_ENTRIES; i++) - free(sc->sc_rxbufs[i].rb_sd, M_DEVBUF); + kfree(sc->sc_rxbufs[i].rb_sd, M_DEVBUF); txp_release_resources(dev); @@ -798,7 +798,7 @@ txp_rxbuf_reclaim(struct txp_softc *sc) err_mbuf: m_freem(sd->sd_mbuf); err_sd: - free(sd, M_DEVBUF); + kfree(sd, M_DEVBUF); } /* @@ -1182,7 +1182,7 @@ txp_tick(void *vsc) out: if (rsp != NULL) - free(rsp, M_DEVBUF); + kfree(rsp, M_DEVBUF); callout_reset(&sc->txp_stat_timer, hz, txp_tick, sc); lwkt_serialize_exit(ifp->if_serializer); @@ -1316,7 +1316,7 @@ txp_command(struct txp_softc *sc, u_int16_t id, u_int16_t in1, u_int32_t in2, *out2 = rsp->rsp_par2; if (out3 != NULL) *out3 = rsp->rsp_par3; - free(rsp, M_DEVBUF); + kfree(rsp, M_DEVBUF); return (0); } @@ -1763,7 +1763,7 @@ txp_capabilities(struct txp_softc *sc) out: if (rsp != NULL) - free(rsp, M_DEVBUF); + kfree(rsp, M_DEVBUF); return; } diff --git a/sys/dev/pccard/cardbus/cardbus.c b/sys/dev/pccard/cardbus/cardbus.c index e26554e395..846734f190 100644 --- a/sys/dev/pccard/cardbus/cardbus.c +++ b/sys/dev/pccard/cardbus/cardbus.c @@ -26,7 +26,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/cardbus/cardbus.c,v 1.28 2002/11/27 17:30:41 imp Exp $ - * $DragonFly: src/sys/dev/pccard/cardbus/cardbus.c,v 1.6 2005/12/18 12:02:15 sephe Exp $ + * $DragonFly: src/sys/dev/pccard/cardbus/cardbus.c,v 1.7 2006/09/05 00:55:41 dillon Exp $ */ /* @@ -283,7 +283,7 @@ cardbus_detach_card(device_t cbdev) device_get_children(cbdev, &devlist, &numdevs); if (numdevs == 0) { - free(devlist, M_TEMP); + kfree(devlist, M_TEMP); return (ENOENT); } @@ -300,7 +300,7 @@ cardbus_detach_card(device_t cbdev) cardbus_freecfg(dinfo); } POWER_DISABLE_SOCKET(device_get_parent(cbdev), cbdev); - free(devlist, M_TEMP); + kfree(devlist, M_TEMP); return (err); } @@ -332,7 +332,7 @@ cardbus_driver_added(device_t cbdev, driver_t *driver) } } - free(devlist, M_TEMP); + kfree(devlist, M_TEMP); } /************************************************************************/ @@ -425,7 +425,7 @@ cardbus_read_device(device_t brdev, int b, int s, int f) struct cardbus_devinfo *devlist_entry = NULL; if (REG(PCIR_DEVVENDOR, 4) != 0xffffffff) { - devlist_entry = malloc(sizeof(struct cardbus_devinfo), + devlist_entry = kmalloc(sizeof(struct cardbus_devinfo), M_DEVBUF, M_WAITOK | M_ZERO); if (devlist_entry == NULL) return (NULL); @@ -484,7 +484,7 @@ cardbus_read_device(device_t brdev, int b, int s, int f) static int cardbus_freecfg(struct cardbus_devinfo *dinfo) { - free(dinfo, M_DEVBUF); + kfree(dinfo, M_DEVBUF); return (0); } diff --git a/sys/dev/pccard/cardbus/cardbus_cis.c b/sys/dev/pccard/cardbus/cardbus_cis.c index 40a94798f1..68ce8d260e 100644 --- a/sys/dev/pccard/cardbus/cardbus_cis.c +++ b/sys/dev/pccard/cardbus/cardbus_cis.c @@ -26,7 +26,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/cardbus/cardbus_cis.c,v 1.27 2002/11/27 06:56:29 imp Exp $ - * $DragonFly: src/sys/dev/pccard/cardbus/cardbus_cis.c,v 1.1 2004/02/10 07:55:47 joerg Exp $ + * $DragonFly: src/sys/dev/pccard/cardbus/cardbus_cis.c,v 1.2 2006/09/05 00:55:41 dillon Exp $ */ /* @@ -168,18 +168,18 @@ DECODE_PROTOTYPE(copy) { struct cis_tupleinfo *tmpbuf; - tmpbuf = malloc(sizeof(struct cis_tupleinfo) * (ncisread_buf+1), + tmpbuf = kmalloc(sizeof(struct cis_tupleinfo) * (ncisread_buf+1), M_DEVBUF, M_WAITOK); if (ncisread_buf > 0) { memcpy(tmpbuf, cisread_buf, sizeof(struct cis_tupleinfo) * ncisread_buf); - free(cisread_buf, M_DEVBUF); + kfree(cisread_buf, M_DEVBUF); } cisread_buf = tmpbuf; cisread_buf[ncisread_buf].id = id; cisread_buf[ncisread_buf].len = len; - cisread_buf[ncisread_buf].data = malloc(len, M_DEVBUF, M_WAITOK); + cisread_buf[ncisread_buf].data = kmalloc(len, M_DEVBUF, M_WAITOK); memcpy(cisread_buf[ncisread_buf].data, tupledata, len); ncisread_buf++; return (0); @@ -705,7 +705,7 @@ cardbus_alloc_resources(device_t cbdev, device_t child) } if (count == 0) return (0); - barlist = malloc(sizeof(struct resource_list_entry*) * count, M_DEVBUF, + barlist = kmalloc(sizeof(struct resource_list_entry*) * count, M_DEVBUF, M_WAITOK); count = 0; SLIST_FOREACH(rle, &dinfo->pci.resources, link) { @@ -835,7 +835,7 @@ cardbus_alloc_resources(device_t cbdev, device_t child) if (barlist[tmp]->res == NULL) { DEVPRINTF((cbdev, "Cannot pre-allocate " "memory for cardbus device\n")); - free(barlist, M_DEVBUF); + kfree(barlist, M_DEVBUF); return (ENOMEM); } barlist[tmp]->start = @@ -892,7 +892,7 @@ cardbus_alloc_resources(device_t cbdev, device_t child) if (barlist[tmp]->res == NULL) { DEVPRINTF((cbdev, "Cannot pre-allocate " "IO port for cardbus device\n")); - free(barlist, M_DEVBUF); + kfree(barlist, M_DEVBUF); return (ENOMEM); } barlist[tmp]->start = @@ -919,7 +919,7 @@ cardbus_alloc_resources(device_t cbdev, device_t child) dinfo->pci.cfg.intline = rman_get_start(res); pci_write_config(child, PCIR_INTLINE, rman_get_start(res), 1); - free(barlist, M_DEVBUF); + kfree(barlist, M_DEVBUF); return (0); } @@ -1054,9 +1054,9 @@ cardbus_cis_free(device_t cbdev, struct cis_tupleinfo *buff, int *nret) { int i; for (i = 0; i < *nret; i++) - free(buff[i].data, M_DEVBUF); + kfree(buff[i].data, M_DEVBUF); if (*nret > 0) - free(buff, M_DEVBUF); + kfree(buff, M_DEVBUF); } int diff --git a/sys/dev/pccard/pccbb/pccbb.c b/sys/dev/pccard/pccbb/pccbb.c index 5717e45148..0be1383d33 100644 --- a/sys/dev/pccard/pccbb/pccbb.c +++ b/sys/dev/pccard/pccbb/pccbb.c @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/pccbb/pccbb.c,v 1.64 2002/11/23 23:09:45 imp Exp $ - * $DragonFly: src/sys/dev/pccard/pccbb/pccbb.c,v 1.16 2006/05/14 17:28:36 dillon Exp $ + * $DragonFly: src/sys/dev/pccard/pccbb/pccbb.c,v 1.17 2006/09/05 00:55:41 dillon Exp $ */ /* @@ -299,7 +299,7 @@ cbb_remove_res(struct cbb_softc *sc, struct resource *res) SLIST_FOREACH(rle, &sc->rl, link) { if (rle->res == res) { SLIST_REMOVE(&sc->rl, rle, cbb_reslist, link); - free(rle, M_DEVBUF); + kfree(rle, M_DEVBUF); return; } } @@ -326,7 +326,7 @@ cbb_insert_res(struct cbb_softc *sc, struct resource *res, int type, * Need to record allocated resource so we can iterate through * it later. */ - rle = malloc(sizeof(struct cbb_reslist), M_DEVBUF, M_NOWAIT); + rle = kmalloc(sizeof(struct cbb_reslist), M_DEVBUF, M_NOWAIT); if (rle == NULL) return (ENOMEM); rle->res = res; @@ -347,7 +347,7 @@ cbb_destroy_res(struct cbb_softc *sc) "(rid=%x, type=%d, addr=%lx)\n", rle->rid, rle->type, rman_get_start(rle->res)); SLIST_REMOVE_HEAD(&sc->rl, link); - free(rle, M_DEVBUF); + kfree(rle, M_DEVBUF); } } @@ -755,7 +755,7 @@ cbb_detach(device_t brdev) else error++; } - free (devlist, M_TEMP); + kfree (devlist, M_TEMP); if (error == 0) cbb_release_helper(brdev); else @@ -776,7 +776,7 @@ cbb_shutdown(device_t brdev) if (device_shutdown(devlist[i]) == 0) ; /* XXX delete the child without detach? */ } - free (devlist, M_TEMP); + kfree (devlist, M_TEMP); cbb_release_helper(brdev); /* @@ -800,7 +800,7 @@ cbb_setup_intr(device_t dev, device_t child, struct resource *irq, * the PCI interrupt for the status change interrupts, it can't be * free for use by the driver. Fast interrupts must not be shared. */ - ih = malloc(sizeof(struct cbb_intrhand), M_DEVBUF, M_WAITOK|M_ZERO); + ih = kmalloc(sizeof(struct cbb_intrhand), M_DEVBUF, M_WAITOK|M_ZERO); if (ih == NULL) return (ENOMEM); *cookiep = ih; @@ -830,7 +830,7 @@ cbb_teardown_intr(device_t dev, device_t child, struct resource *irq, /* XXX Need to do different things for ISA interrupts. */ ih = (struct cbb_intrhand *) cookie; STAILQ_REMOVE(&sc->intr_handlers, ih, cbb_intrhand, entries); - free(ih, M_DEVBUF); + kfree(ih, M_DEVBUF); return (0); } @@ -870,7 +870,7 @@ cbb_driver_added(device_t brdev, driver_t *driver) driver->name); } } - free(devlist, M_TEMP); + kfree(devlist, M_TEMP); if (wake > 0) { if ((cbb_get(sc, CBB_SOCKET_STATE) & CBB_SOCKET_STAT_CD) diff --git a/sys/dev/raid/amr/amr.c b/sys/dev/raid/amr/amr.c index ecc8392e39..c193c0d295 100644 --- a/sys/dev/raid/amr/amr.c +++ b/sys/dev/raid/amr/amr.c @@ -53,7 +53,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/amr/amr.c,v 1.7.2.13 2003/01/15 13:41:18 emoore Exp $ - * $DragonFly: src/sys/dev/raid/amr/amr.c,v 1.20 2006/08/03 16:40:47 swildner Exp $ + * $DragonFly: src/sys/dev/raid/amr/amr.c,v 1.21 2006/09/05 00:55:41 dillon Exp $ */ /* @@ -435,7 +435,7 @@ amr_ioctl(struct dev_ioctl_args *ap) debug(1, "AMR_IO_COMMAND 0x%x", au->au_cmd[0]); /* handle inbound data buffer */ if (au->au_length != 0) { - if ((dp = malloc(au->au_length, M_DEVBUF, M_WAITOK)) == NULL) { + if ((dp = kmalloc(au->au_length, M_DEVBUF, M_WAITOK)) == NULL) { error = ENOMEM; break; } @@ -451,7 +451,7 @@ amr_ioctl(struct dev_ioctl_args *ap) /* handle SCSI passthrough command */ if (au->au_cmd[0] == AMR_CMD_PASS) { - if ((apt = malloc(sizeof(*apt), M_DEVBUF, M_WAITOK | M_ZERO)) == NULL) { + if ((apt = kmalloc(sizeof(*apt), M_DEVBUF, M_WAITOK | M_ZERO)) == NULL) { error = ENOMEM; break; } @@ -524,9 +524,9 @@ amr_ioctl(struct dev_ioctl_args *ap) } if (dp != NULL) - free(dp, M_DEVBUF); + kfree(dp, M_DEVBUF); if (apt != NULL) - free(apt, M_DEVBUF); + kfree(apt, M_DEVBUF); if (ac != NULL) amr_releasecmd(ac); return(error); @@ -606,7 +606,7 @@ amr_query_controller(struct amr_softc *sc) debug(2, " drive %d: %d state %x properties %x\n", ldrv, sc->amr_drive[ldrv].al_size, sc->amr_drive[ldrv].al_state, sc->amr_drive[ldrv].al_properties); } - free(aex, M_DEVBUF); + kfree(aex, M_DEVBUF); /* * Get product info for channel count. @@ -619,7 +619,7 @@ amr_query_controller(struct amr_softc *sc) sc->amr_maxchan = ap->ap_nschan; sc->amr_maxio = ap->ap_maxio; sc->amr_type |= AMR_TYPE_40LD; - free(ap, M_DEVBUF); + kfree(ap, M_DEVBUF); } else { @@ -646,7 +646,7 @@ amr_query_controller(struct amr_softc *sc) sc->amr_maxdrives = 8; sc->amr_maxchan = ae->ae_adapter.aa_channels; sc->amr_maxio = ae->ae_adapter.aa_maxio; - free(ae, M_DEVBUF); + kfree(ae, M_DEVBUF); } /* @@ -684,7 +684,7 @@ amr_enquiry(struct amr_softc *sc, size_t bufsize, u_int8_t cmd, u_int8_t cmdsub, if ((ac = amr_alloccmd(sc)) == NULL) goto out; /* allocate the response structure */ - result = malloc(bufsize, M_DEVBUF, M_INTWAIT); + result = kmalloc(bufsize, M_DEVBUF, M_INTWAIT); /* set command flags */ ac->ac_flags |= AMR_CMD_PRIORITY | AMR_CMD_DATAOUT; @@ -707,7 +707,7 @@ amr_enquiry(struct amr_softc *sc, size_t bufsize, u_int8_t cmd, u_int8_t cmdsub, if (ac != NULL) amr_releasecmd(ac); if ((error != 0) && (result != NULL)) { - free(result, M_DEVBUF); + kfree(result, M_DEVBUF); result = NULL; } return(result); @@ -1485,7 +1485,7 @@ amr_alloccmd_cluster(struct amr_softc *sc) struct amr_command *ac; int i; - acc = malloc(AMR_CMD_CLUSTERSIZE, M_DEVBUF, M_INTWAIT); + acc = kmalloc(AMR_CMD_CLUSTERSIZE, M_DEVBUF, M_INTWAIT); crit_enter(); TAILQ_INSERT_TAIL(&sc->amr_cmd_clusters, acc, acc_link); crit_exit(); @@ -1510,7 +1510,7 @@ amr_freecmd_cluster(struct amr_command_cluster *acc) for (i = 0; i < AMR_CMD_CLUSTERCOUNT; i++) bus_dmamap_destroy(sc->amr_buffer_dmat, acc->acc_command[i].ac_dmamap); - free(acc, M_DEVBUF); + kfree(acc, M_DEVBUF); } /******************************************************************************** @@ -1721,7 +1721,7 @@ amr_describe_controller(struct amr_softc *sc) ap->ap_product, ap->ap_firmware, ap->ap_bios, ap->ap_memsize); - free(ap, M_DEVBUF); + kfree(ap, M_DEVBUF); return; } @@ -1787,7 +1787,7 @@ amr_describe_controller(struct amr_softc *sc) prod, ae->ae_adapter.aa_firmware, ae->ae_adapter.aa_bios, ae->ae_adapter.aa_memorysize); } - free(ae, M_DEVBUF); + kfree(ae, M_DEVBUF); } int diff --git a/sys/dev/raid/amr/amr_cam.c b/sys/dev/raid/amr/amr_cam.c index 137fe126dd..6d09412da4 100644 --- a/sys/dev/raid/amr/amr_cam.c +++ b/sys/dev/raid/amr/amr_cam.c @@ -53,7 +53,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/amr/amr_cam.c,v 1.1.2.3 2002/11/11 13:19:10 emoore Exp $ - * $DragonFly: src/sys/dev/raid/amr/amr_cam.c,v 1.6 2005/06/09 20:55:05 swildner Exp $ + * $DragonFly: src/sys/dev/raid/amr/amr_cam.c,v 1.7 2006/09/05 00:55:41 dillon Exp $ */ #include @@ -398,7 +398,7 @@ amr_cam_command(struct amr_softc *sc, struct amr_command **acp) /* construct passthrough */ if (sc->support_ext_cdb ) { - aep = malloc(sizeof(*aep), M_DEVBUF, M_INTWAIT | M_ZERO); + aep = kmalloc(sizeof(*aep), M_DEVBUF, M_INTWAIT | M_ZERO); aep->ap_timeout = 2; aep->ap_ars = 1; aep->ap_request_sense_length = 14; @@ -419,7 +419,7 @@ amr_cam_command(struct amr_softc *sc, struct amr_command **acp) aep->ap_channel, aep->ap_scsi_id, aep->ap_logical_drive_no); } else { - ap = malloc(sizeof(*ap), M_DEVBUF, M_INTWAIT | M_ZERO); + ap = kmalloc(sizeof(*ap), M_DEVBUF, M_INTWAIT | M_ZERO); ap->ap_timeout = 0; ap->ap_ars = 1; ap->ap_request_sense_length = 14; @@ -473,9 +473,9 @@ out: if (ac != NULL) amr_releasecmd(ac); if (ap != NULL) - free(ap, M_DEVBUF); + kfree(ap, M_DEVBUF); if (aep != NULL) - free(aep, M_DEVBUF); + kfree(aep, M_DEVBUF); if (csio != NULL) /* put it back and try again later */ amr_requeue_ccb(sc, (union ccb *)csio); } @@ -547,7 +547,7 @@ amr_cam_complete(struct amr_command *ac) break; } } - free(ap, M_DEVBUF); + kfree(ap, M_DEVBUF); if ((csio->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE) debug(2, "%*D\n", imin(csio->dxfer_len, 16), csio->data_ptr, " "); xpt_done((union ccb *)csio); @@ -610,7 +610,7 @@ amr_cam_complete_extcdb(struct amr_command *ac) break; } } - free(aep, M_DEVBUF); + kfree(aep, M_DEVBUF); if ((csio->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE) debug(2, "%*D\n", imin(csio->dxfer_len, 16), csio->data_ptr, " "); xpt_done((union ccb *)csio); diff --git a/sys/dev/raid/asr/asr.c b/sys/dev/raid/asr/asr.c index 8941e7c404..3e83462305 100644 --- a/sys/dev/raid/asr/asr.c +++ b/sys/dev/raid/asr/asr.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/dev/asr/asr.c,v 1.3.2.2 2001/08/23 05:21:29 scottl Exp $ */ -/* $DragonFly: src/sys/dev/raid/asr/asr.c,v 1.23 2006/07/28 02:17:37 dillon Exp $ */ +/* $DragonFly: src/sys/dev/raid/asr/asr.c,v 1.24 2006/09/05 00:55:41 dillon Exp $ */ /* * Copyright (c) 1996-2000 Distributed Processing Technology Corporation * Copyright (c) 2000-2001 Adaptec Corporation @@ -789,7 +789,7 @@ asr_alloc_ccb ( { OUT union asr_ccb * new_ccb; - if ((new_ccb = (union asr_ccb *)malloc(sizeof(*new_ccb), + if ((new_ccb = (union asr_ccb *)kmalloc(sizeof(*new_ccb), M_DEVBUF, M_WAITOK)) != (union asr_ccb *)NULL) { bzero (new_ccb, sizeof(*new_ccb)); new_ccb->ccb_h.pinfo.priority = 1; @@ -803,7 +803,7 @@ STATIC INLINE void asr_free_ccb ( IN union asr_ccb * free_ccb) { - free(free_ccb, M_DEVBUF); + kfree(free_ccb, M_DEVBUF); } /* asr_free_ccb */ /* @@ -1077,7 +1077,7 @@ ASR_getTidAddress( * needed for size has been abstracted. */ if ((new_entry == FALSE) - || ((sc->ha_targets[bus] = bus_ptr = (target2lun_t *)malloc ( + || ((sc->ha_targets[bus] = bus_ptr = (target2lun_t *)kmalloc ( sizeof(*bus_ptr) + (sizeof(bus_ptr->LUN) * new_size), M_TEMP, M_WAITOK)) == (target2lun_t *)NULL)) { @@ -1096,7 +1096,7 @@ ASR_getTidAddress( * needed for size has been abstracted. */ if ((new_entry == FALSE) - || ((new_bus_ptr = (target2lun_t *)malloc ( + || ((new_bus_ptr = (target2lun_t *)kmalloc ( sizeof(*bus_ptr) + (sizeof(bus_ptr->LUN) * new_size), M_TEMP, M_WAITOK)) == (target2lun_t *)NULL)) { @@ -1112,7 +1112,7 @@ ASR_getTidAddress( bcopy (bus_ptr, new_bus_ptr, sizeof(*bus_ptr) + (sizeof(bus_ptr->LUN) * (bus_ptr->size - 1))); sc->ha_targets[bus] = new_bus_ptr; - free (bus_ptr, M_TEMP); + kfree (bus_ptr, M_TEMP); bus_ptr = new_bus_ptr; bus_ptr->size = new_size + 1; } @@ -1134,7 +1134,7 @@ ASR_getTidAddress( * needed for size has been abstracted. */ if ((new_entry == FALSE) - || ((bus_ptr->LUN[target] = target_ptr = (lun2tid_t *)malloc ( + || ((bus_ptr->LUN[target] = target_ptr = (lun2tid_t *)kmalloc ( sizeof(*target_ptr) + (sizeof(target_ptr->TID) * new_size), M_TEMP, M_WAITOK)) == (lun2tid_t *)NULL)) { @@ -1153,7 +1153,7 @@ ASR_getTidAddress( * needed for size has been abstracted. */ if ((new_entry == FALSE) - || ((new_target_ptr = (lun2tid_t *)malloc ( + || ((new_target_ptr = (lun2tid_t *)kmalloc ( sizeof(*target_ptr) + (sizeof(target_ptr->TID) * new_size), M_TEMP, M_WAITOK)) == (lun2tid_t *)NULL)) { @@ -1170,7 +1170,7 @@ ASR_getTidAddress( sizeof(*target_ptr) + (sizeof(target_ptr->TID) * (target_ptr->size - 1))); bus_ptr->LUN[target] = new_target_ptr; - free (target_ptr, M_TEMP); + kfree (target_ptr, M_TEMP); target_ptr = new_target_ptr; target_ptr->size = new_size + 1; } @@ -1659,7 +1659,7 @@ ASR_acquireLct ( */ MessageSizeInBytes = sizeof(I2O_EXEC_LCT_NOTIFY_MESSAGE) - sizeof(I2O_SG_ELEMENT) + sizeof(I2O_SGE_SIMPLE_ELEMENT); - if ((Message_Ptr = (PI2O_EXEC_LCT_NOTIFY_MESSAGE)malloc ( + if ((Message_Ptr = (PI2O_EXEC_LCT_NOTIFY_MESSAGE)kmalloc ( MessageSizeInBytes, M_TEMP, M_WAITOK)) == (PI2O_EXEC_LCT_NOTIFY_MESSAGE)NULL) { return (ENOMEM); @@ -1692,21 +1692,21 @@ ASR_acquireLct ( * Determine the size of the LCT table. */ if (sc->ha_LCT) { - free (sc->ha_LCT, M_TEMP); + kfree (sc->ha_LCT, M_TEMP); } /* - * malloc only generates contiguous memory when less than a + * kmalloc only generates contiguous memory when less than a * page is expected. We must break the request up into an SG list ... */ if (((len = (I2O_LCT_getTableSize(&Table) << 2)) <= (sizeof(I2O_LCT) - sizeof(I2O_LCT_ENTRY))) || (len > (128 * 1024))) { /* Arbitrary */ - free (Message_Ptr, M_TEMP); + kfree (Message_Ptr, M_TEMP); return (EINVAL); } - if ((sc->ha_LCT = (PI2O_LCT)malloc (len, M_TEMP, M_WAITOK)) + if ((sc->ha_LCT = (PI2O_LCT)kmalloc (len, M_TEMP, M_WAITOK)) == (PI2O_LCT)NULL) { - free (Message_Ptr, M_TEMP); + kfree (Message_Ptr, M_TEMP); return (ENOMEM); } /* @@ -1773,17 +1773,17 @@ ASR_acquireLct ( PI2O_EXEC_LCT_NOTIFY_MESSAGE NewMessage_Ptr; if ((NewMessage_Ptr = (PI2O_EXEC_LCT_NOTIFY_MESSAGE) - malloc (MessageSizeInBytes, M_TEMP, M_WAITOK)) + kmalloc (MessageSizeInBytes, M_TEMP, M_WAITOK)) == (PI2O_EXEC_LCT_NOTIFY_MESSAGE)NULL) { - free (sc->ha_LCT, M_TEMP); + kfree (sc->ha_LCT, M_TEMP); sc->ha_LCT = (PI2O_LCT)NULL; - free (Message_Ptr, M_TEMP); + kfree (Message_Ptr, M_TEMP); return (ENOMEM); } span = ((caddr_t)sg) - (caddr_t)Message_Ptr; bcopy ((caddr_t)Message_Ptr, (caddr_t)NewMessage_Ptr, span); - free (Message_Ptr, M_TEMP); + kfree (Message_Ptr, M_TEMP); sg = (PI2O_SGE_SIMPLE_ELEMENT) (((caddr_t)NewMessage_Ptr) + span); Message_Ptr = NewMessage_Ptr; @@ -1792,7 +1792,7 @@ ASR_acquireLct ( { int retval; retval = ASR_queue_c(sc, (PI2O_MESSAGE_FRAME)Message_Ptr); - free (Message_Ptr, M_TEMP); + kfree (Message_Ptr, M_TEMP); if (retval != CAM_REQ_CMP) { return (ENODEV); } @@ -2147,7 +2147,7 @@ ASR_setSysTab( PI2O_SGE_SIMPLE_ELEMENT sg; int retVal; - if ((SystemTable = (PI2O_SET_SYSTAB_HEADER)malloc ( + if ((SystemTable = (PI2O_SET_SYSTAB_HEADER)kmalloc ( sizeof(I2O_SET_SYSTAB_HEADER), M_TEMP, M_WAITOK)) == (PI2O_SET_SYSTAB_HEADER)NULL) { return (ENOMEM); @@ -2156,11 +2156,11 @@ ASR_setSysTab( for (ha = Asr_softc; ha; ha = ha->ha_next) { ++SystemTable->NumberEntries; } - if ((Message_Ptr = (PI2O_EXEC_SYS_TAB_SET_MESSAGE)malloc ( + if ((Message_Ptr = (PI2O_EXEC_SYS_TAB_SET_MESSAGE)kmalloc ( sizeof(I2O_EXEC_SYS_TAB_SET_MESSAGE) - sizeof(I2O_SG_ELEMENT) + ((3+SystemTable->NumberEntries) * sizeof(I2O_SGE_SIMPLE_ELEMENT)), M_TEMP, M_WAITOK)) == (PI2O_EXEC_SYS_TAB_SET_MESSAGE)NULL) { - free (SystemTable, M_TEMP); + kfree (SystemTable, M_TEMP); return (ENOMEM); } (void)ASR_fillMessage((char *)Message_Ptr, @@ -2196,8 +2196,8 @@ ASR_setSysTab( SG(sg, 1, I2O_SGL_FLAGS_DIR | I2O_SGL_FLAGS_LAST_ELEMENT | I2O_SGL_FLAGS_END_OF_BUFFER, NULL, 0); retVal = ASR_queue_c(sc, (PI2O_MESSAGE_FRAME)Message_Ptr); - free (Message_Ptr, M_TEMP); - free (SystemTable, M_TEMP); + kfree (Message_Ptr, M_TEMP); + kfree (SystemTable, M_TEMP); return (retVal); } /* ASR_setSysTab */ @@ -2518,7 +2518,7 @@ asr_attach (ATTACH_ARGS) struct scsi_inquiry_data * iq; ATTACH_SET(); - sc = malloc(sizeof(*sc), M_DEVBUF, M_INTWAIT); + sc = kmalloc(sizeof(*sc), M_DEVBUF, M_INTWAIT); if (Asr_softc == (Asr_softc_t *)NULL) { /* * Fixup the OS revision as saved in the dptsig for the @@ -2567,7 +2567,7 @@ asr_attach (ATTACH_ARGS) } /* Check if the device is there? */ if ((ASR_resetIOP(sc->ha_Virt, sc->ha_Fvirt) == 0) - || ((status = (PI2O_EXEC_STATUS_GET_REPLY)malloc ( + || ((status = (PI2O_EXEC_STATUS_GET_REPLY)kmalloc ( sizeof(I2O_EXEC_STATUS_GET_REPLY), M_TEMP, M_WAITOK)) == (PI2O_EXEC_STATUS_GET_REPLY)NULL) || (ASR_getStatus(sc->ha_Virt, sc->ha_Fvirt, status) == NULL)) { @@ -2613,7 +2613,7 @@ asr_attach (ATTACH_ARGS) status) << 2)) > MAX_INBOUND_SIZE) { size = MAX_INBOUND_SIZE; } - free (status, M_TEMP); + kfree (status, M_TEMP); sc->ha_SgSize = (size - sizeof(PRIVATE_SCSI_SCB_EXECUTE_MESSAGE) + sizeof(I2O_SG_ELEMENT)) / sizeof(I2O_SGE_SIMPLE_ELEMENT); } @@ -2686,7 +2686,7 @@ asr_attach (ATTACH_ARGS) printf ("asr%d:", unit); - if ((iq = (struct scsi_inquiry_data *)malloc ( + if ((iq = (struct scsi_inquiry_data *)kmalloc ( sizeof(struct scsi_inquiry_data), M_TEMP, M_WAITOK)) != (struct scsi_inquiry_data *)NULL) { defAlignLong(PRIVATE_SCSI_SCB_EXECUTE_MESSAGE,Message); @@ -2761,7 +2761,7 @@ asr_attach (ATTACH_ARGS) ASR_prstring (iq->revision, 4); ++posted; } - free ((caddr_t)iq, M_TEMP); + kfree ((caddr_t)iq, M_TEMP); if (posted) { printf (","); } @@ -3339,7 +3339,7 @@ ASR_queue_i( return (EIO); } /* Copy in the message into a local allocation */ - if ((Message_Ptr = (PI2O_MESSAGE_FRAME)malloc ( + if ((Message_Ptr = (PI2O_MESSAGE_FRAME)kmalloc ( sizeof(I2O_MESSAGE_FRAME), M_TEMP, M_WAITOK)) == (PI2O_MESSAGE_FRAME)NULL) { debug_usr_cmd_printf ( @@ -3348,7 +3348,7 @@ ASR_queue_i( } if ((error = copyin ((caddr_t)Packet, (caddr_t)Message_Ptr, sizeof(I2O_MESSAGE_FRAME))) != 0) { - free (Message_Ptr, M_TEMP); + kfree (Message_Ptr, M_TEMP); debug_usr_cmd_printf ("Can't copy in packet errno=%d\n", error); return (error); } @@ -3360,7 +3360,7 @@ ASR_queue_i( /* Check if the message is a synchronous initialization command */ s = I2O_MESSAGE_FRAME_getFunction(Message_Ptr); - free (Message_Ptr, M_TEMP); + kfree (Message_Ptr, M_TEMP); switch (s) { case I2O_EXEC_IOP_RESET: @@ -3406,7 +3406,7 @@ ASR_queue_i( return (EINVAL); } - if ((Message_Ptr = (PI2O_MESSAGE_FRAME)malloc (MessageSizeInBytes, + if ((Message_Ptr = (PI2O_MESSAGE_FRAME)kmalloc (MessageSizeInBytes, M_TEMP, M_WAITOK)) == (PI2O_MESSAGE_FRAME)NULL) { debug_usr_cmd_printf ("Failed to acquire frame[%d] memory\n", MessageSizeInBytes); @@ -3414,7 +3414,7 @@ ASR_queue_i( } if ((error = copyin ((caddr_t)Packet, (caddr_t)Message_Ptr, MessageSizeInBytes)) != 0) { - free (Message_Ptr, M_TEMP); + kfree (Message_Ptr, M_TEMP); debug_usr_cmd_printf ("Can't copy in packet[%d] errno=%d\n", MessageSizeInBytes, error); return (error); @@ -3422,18 +3422,18 @@ ASR_queue_i( /* Check the size of the reply frame, and start constructing */ - if ((Reply_Ptr = (PI2O_SCSI_ERROR_REPLY_MESSAGE_FRAME)malloc ( + if ((Reply_Ptr = (PI2O_SCSI_ERROR_REPLY_MESSAGE_FRAME)kmalloc ( sizeof(I2O_MESSAGE_FRAME), M_TEMP, M_WAITOK)) == (PI2O_SCSI_ERROR_REPLY_MESSAGE_FRAME)NULL) { - free (Message_Ptr, M_TEMP); + kfree (Message_Ptr, M_TEMP); debug_usr_cmd_printf ( "Failed to acquire I2O_MESSAGE_FRAME memory\n"); return (ENOMEM); } if ((error = copyin ((caddr_t)Reply, (caddr_t)Reply_Ptr, sizeof(I2O_MESSAGE_FRAME))) != 0) { - free (Reply_Ptr, M_TEMP); - free (Message_Ptr, M_TEMP); + kfree (Reply_Ptr, M_TEMP); + kfree (Message_Ptr, M_TEMP); debug_usr_cmd_printf ( "Failed to copy in reply frame, errno=%d\n", error); @@ -3441,21 +3441,21 @@ ASR_queue_i( } ReplySizeInBytes = (I2O_MESSAGE_FRAME_getMessageSize( &(Reply_Ptr->StdReplyFrame.StdMessageFrame)) << 2); - free (Reply_Ptr, M_TEMP); + kfree (Reply_Ptr, M_TEMP); if (ReplySizeInBytes < sizeof(I2O_SINGLE_REPLY_MESSAGE_FRAME)) { - free (Message_Ptr, M_TEMP); + kfree (Message_Ptr, M_TEMP); debug_usr_cmd_printf ( "Failed to copy in reply frame[%d], errno=%d\n", ReplySizeInBytes, error); return (EINVAL); } - if ((Reply_Ptr = (PI2O_SCSI_ERROR_REPLY_MESSAGE_FRAME)malloc ( + if ((Reply_Ptr = (PI2O_SCSI_ERROR_REPLY_MESSAGE_FRAME)kmalloc ( ((ReplySizeInBytes > sizeof(I2O_SCSI_ERROR_REPLY_MESSAGE_FRAME)) ? ReplySizeInBytes : sizeof(I2O_SCSI_ERROR_REPLY_MESSAGE_FRAME)), M_TEMP, M_WAITOK)) == (PI2O_SCSI_ERROR_REPLY_MESSAGE_FRAME)NULL) { - free (Message_Ptr, M_TEMP); + kfree (Message_Ptr, M_TEMP); debug_usr_cmd_printf ("Failed to acquire frame[%d] memory\n", ReplySizeInBytes); return (ENOMEM); @@ -3476,7 +3476,7 @@ ASR_queue_i( case I2O_EXEC_SYS_TAB_SET: /* Special Case of empty Scatter Gather */ if (MessageSizeInBytes == ((I2O_MESSAGE_FRAME_getVersionOffset( Message_Ptr) & 0xF0) >> 2)) { - free (Message_Ptr, M_TEMP); + kfree (Message_Ptr, M_TEMP); I2O_SINGLE_REPLY_MESSAGE_FRAME_setDetailedStatusCode( &(Reply_Ptr->StdReplyFrame), (ASR_setSysTab(sc) != CAM_REQ_CMP)); @@ -3485,7 +3485,7 @@ ASR_queue_i( sizeof(I2O_SINGLE_REPLY_MESSAGE_FRAME)); error = copyout ((caddr_t)Reply_Ptr, (caddr_t)Reply, ReplySizeInBytes); - free (Reply_Ptr, M_TEMP); + kfree (Reply_Ptr, M_TEMP); return (error); } } @@ -3521,7 +3521,7 @@ ASR_queue_i( Message_Ptr) & 0xF0) >> 2)), I2O_SGE_SIMPLE_ELEMENT_getPhysicalAddress(sg), len); - if ((elm = (struct ioctlSgList_S *)malloc ( + if ((elm = (struct ioctlSgList_S *)kmalloc ( sizeof(*elm) - sizeof(elm->KernelSpace) + len, M_TEMP, M_WAITOK)) == (struct ioctlSgList_S *)NULL) { @@ -3611,7 +3611,7 @@ ASR_queue_i( if ((NewMessage_Ptr = (PI2O_MESSAGE_FRAME) - malloc (MessageSizeInBytes, + kmalloc (MessageSizeInBytes, M_TEMP, M_WAITOK)) == (PI2O_MESSAGE_FRAME)NULL) { debug_usr_cmd_printf ( @@ -3627,7 +3627,7 @@ ASR_queue_i( bcopy ((caddr_t)(sg-1), ((caddr_t)NewMessage_Ptr) + span, MessageSizeInBytes - span); - free (Message_Ptr, M_TEMP); + kfree (Message_Ptr, M_TEMP); sg = (PI2O_SGE_SIMPLE_ELEMENT) (((caddr_t)NewMessage_Ptr) + span); Message_Ptr = NewMessage_Ptr; @@ -3644,10 +3644,10 @@ ASR_queue_i( while ((elm = SLIST_FIRST(&sgList)) != (struct ioctlSgList_S *)NULL) { SLIST_REMOVE_HEAD(&sgList, link); - free (elm, M_TEMP); + kfree (elm, M_TEMP); } - free (Reply_Ptr, M_TEMP); - free (Message_Ptr, M_TEMP); + kfree (Reply_Ptr, M_TEMP); + kfree (Message_Ptr, M_TEMP); return (error); } } @@ -3661,10 +3661,10 @@ ASR_queue_i( while ((elm = SLIST_FIRST(&sgList)) != (struct ioctlSgList_S *)NULL) { SLIST_REMOVE_HEAD(&sgList, link); - free (elm, M_TEMP); + kfree (elm, M_TEMP); } - free (Reply_Ptr, M_TEMP); - free (Message_Ptr, M_TEMP); + kfree (Reply_Ptr, M_TEMP); + kfree (Message_Ptr, M_TEMP); return (ENOMEM); } @@ -3677,7 +3677,7 @@ ASR_queue_i( (void)ASR_queue (sc, (PI2O_MESSAGE_FRAME)Message_Ptr); - free (Message_Ptr, M_TEMP); + kfree (Message_Ptr, M_TEMP); /* * Wait for the board to report a finished instruction. @@ -3698,9 +3698,9 @@ ASR_queue_i( while ((elm = SLIST_FIRST(&sgList)) != (struct ioctlSgList_S *)NULL) { SLIST_REMOVE_HEAD(&sgList, link); - free (elm, M_TEMP); + kfree (elm, M_TEMP); } - free (Reply_Ptr, M_TEMP); + kfree (Reply_Ptr, M_TEMP); asr_free_ccb(ccb); return (EIO); } @@ -3749,14 +3749,14 @@ ASR_queue_i( I2O_FLAGS_COUNT_getCount(&(elm->FlagsCount))); } SLIST_REMOVE_HEAD(&sgList, link); - free (elm, M_TEMP); + kfree (elm, M_TEMP); } if (error == 0) { /* Copy reply frame to user space */ error = copyout ((caddr_t)Reply_Ptr, (caddr_t)Reply, ReplySizeInBytes); } - free (Reply_Ptr, M_TEMP); + kfree (Reply_Ptr, M_TEMP); asr_free_ccb(ccb); return (error); diff --git a/sys/dev/raid/ciss/ciss.c b/sys/dev/raid/ciss/ciss.c index c9aa3a0be7..ef7ac6d4b1 100644 --- a/sys/dev/raid/ciss/ciss.c +++ b/sys/dev/raid/ciss/ciss.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ciss/ciss.c,v 1.2.2.6 2003/02/18 22:27:41 ps Exp $ - * $DragonFly: src/sys/dev/raid/ciss/ciss.c,v 1.17 2006/07/28 02:17:37 dillon Exp $ + * $DragonFly: src/sys/dev/raid/ciss/ciss.c,v 1.18 2006/09/05 00:55:41 dillon Exp $ */ /* @@ -675,7 +675,7 @@ ciss_flush_adapter(struct ciss_softc *sc) * it, as we may be going to do more I/O (eg. we are emulating * the Synchronise Cache command). */ - cbfc = malloc(sizeof(*cbfc), CISS_MALLOC_CLASS, M_INTWAIT | M_ZERO); + cbfc = kmalloc(sizeof(*cbfc), CISS_MALLOC_CLASS, M_INTWAIT | M_ZERO); if ((error = ciss_get_bmic_request(sc, &cr, CISS_BMIC_FLUSH_CACHE, (void **)&cbfc, sizeof(*cbfc))) != 0) goto out; @@ -704,7 +704,7 @@ ciss_flush_adapter(struct ciss_softc *sc) out: if (cbfc != NULL) - free(cbfc, CISS_MALLOC_CLASS); + kfree(cbfc, CISS_MALLOC_CLASS); if (cr != NULL) ciss_release_request(cr); return(error); @@ -879,7 +879,7 @@ ciss_identify_adapter(struct ciss_softc *sc) out: if (error) { if (sc->ciss_id != NULL) { - free(sc->ciss_id, CISS_MALLOC_CLASS); + kfree(sc->ciss_id, CISS_MALLOC_CLASS); sc->ciss_id = NULL; } } @@ -914,7 +914,7 @@ ciss_init_logical(struct ciss_softc *sc) if ((error = ciss_get_request(sc, &cr)) != 0) goto out; report_size = sizeof(*cll) + CISS_MAX_LOGICAL * sizeof(union ciss_device_address); - cll = malloc(report_size, CISS_MALLOC_CLASS, M_INTWAIT | M_ZERO); + cll = kmalloc(report_size, CISS_MALLOC_CLASS, M_INTWAIT | M_ZERO); /* * Build the Report Logical LUNs command. @@ -1011,7 +1011,7 @@ ciss_init_logical(struct ciss_softc *sc) if (cr != NULL) ciss_release_request(cr); if (cll != NULL) - free(cll, CISS_MALLOC_CLASS); + kfree(cll, CISS_MALLOC_CLASS); return(error); } @@ -1157,11 +1157,11 @@ out: /* make the drive not-exist */ ld->cl_status = CISS_LD_NONEXISTENT; if (ld->cl_ldrive != NULL) { - free(ld->cl_ldrive, CISS_MALLOC_CLASS); + kfree(ld->cl_ldrive, CISS_MALLOC_CLASS); ld->cl_ldrive = NULL; } if (ld->cl_lstatus != NULL) { - free(ld->cl_lstatus, CISS_MALLOC_CLASS); + kfree(ld->cl_lstatus, CISS_MALLOC_CLASS); ld->cl_lstatus = NULL; } } @@ -1353,7 +1353,7 @@ ciss_free(struct ciss_softc *sc) /* free the controller data */ if (sc->ciss_id != NULL) - free(sc->ciss_id, CISS_MALLOC_CLASS); + kfree(sc->ciss_id, CISS_MALLOC_CLASS); /* release I/O resources */ if (sc->ciss_regs_resource != NULL) @@ -1856,7 +1856,7 @@ ciss_get_bmic_request(struct ciss_softc *sc, struct ciss_request **crp, dataout = 0; if ((bufsize > 0) && (bufp != NULL)) { if (*bufp == NULL) { - buf = malloc(bufsize, CISS_MALLOC_CLASS, M_INTWAIT | M_ZERO); + buf = kmalloc(bufsize, CISS_MALLOC_CLASS, M_INTWAIT | M_ZERO); } else { buf = *bufp; dataout = 1; /* we are given a buffer, so we are writing */ @@ -1892,7 +1892,7 @@ out: if (cr != NULL) ciss_release_request(cr); if ((bufp != NULL) && (*bufp == NULL) && (buf != NULL)) - free(buf, CISS_MALLOC_CLASS); + kfree(buf, CISS_MALLOC_CLASS); } else { *crp = cr; if ((bufp != NULL) && (*bufp == NULL) && (buf != NULL)) @@ -1928,7 +1928,7 @@ ciss_user_command(struct ciss_softc *sc, IOCTL_Command_struct *ioc) */ cr->cr_length = ioc->buf_size; if (ioc->buf_size > 0) { - if ((cr->cr_data = malloc(ioc->buf_size, CISS_MALLOC_CLASS, M_WAITOK)) == NULL) { + if ((cr->cr_data = kmalloc(ioc->buf_size, CISS_MALLOC_CLASS, M_WAITOK)) == NULL) { error = ENOMEM; goto out; } @@ -1970,7 +1970,7 @@ ciss_user_command(struct ciss_softc *sc, IOCTL_Command_struct *ioc) out: if ((cr != NULL) && (cr->cr_data != NULL)) - free(cr->cr_data, CISS_MALLOC_CLASS); + kfree(cr->cr_data, CISS_MALLOC_CLASS); if (cr != NULL) ciss_release_request(cr); return(error); @@ -2109,7 +2109,7 @@ ciss_cam_rescan_target(struct ciss_softc *sc, int target) debug_called(1); - if ((ccb = malloc(sizeof(union ccb), M_TEMP, M_WAITOK | M_ZERO)) == NULL) { + if ((ccb = kmalloc(sizeof(union ccb), M_TEMP, M_WAITOK | M_ZERO)) == NULL) { ciss_printf(sc, "rescan failed (can't allocate CCB)\n"); return; } @@ -2139,7 +2139,7 @@ static void ciss_cam_rescan_callback(struct cam_periph *periph, union ccb *ccb) { xpt_free_path(ccb->ccb_h.path); - free(ccb, M_TEMP); + kfree(ccb, M_TEMP); } /************************************************************************ @@ -2664,7 +2664,7 @@ ciss_notify_event(struct ciss_softc *sc) * structure. */ if (cr->cr_data == NULL) { - cr->cr_data = malloc(CISS_NOTIFY_DATA_SIZE, CISS_MALLOC_CLASS, M_INTWAIT); + cr->cr_data = kmalloc(CISS_NOTIFY_DATA_SIZE, CISS_MALLOC_CLASS, M_INTWAIT); cr->cr_length = CISS_NOTIFY_DATA_SIZE; } @@ -2701,7 +2701,7 @@ ciss_notify_event(struct ciss_softc *sc) if (error) { if (cr != NULL) { if (cr->cr_data != NULL) - free(cr->cr_data, CISS_MALLOC_CLASS); + kfree(cr->cr_data, CISS_MALLOC_CLASS); ciss_release_request(cr); } sc->ciss_periodic_notify = NULL; @@ -2831,7 +2831,7 @@ ciss_notify_abort(struct ciss_softc *sc) goto out; /* get a buffer for the result */ - cr->cr_data = malloc(CISS_NOTIFY_DATA_SIZE, CISS_MALLOC_CLASS, M_INTWAIT); + cr->cr_data = kmalloc(CISS_NOTIFY_DATA_SIZE, CISS_MALLOC_CLASS, M_INTWAIT); cr->cr_length = CISS_NOTIFY_DATA_SIZE; /* build the CDB */ @@ -2919,7 +2919,7 @@ ciss_notify_abort(struct ciss_softc *sc) /* release the cancel request */ if (cr != NULL) { if (cr->cr_data != NULL) - free(cr->cr_data, CISS_MALLOC_CLASS); + kfree(cr->cr_data, CISS_MALLOC_CLASS); ciss_release_request(cr); } if (error == 0) diff --git a/sys/dev/raid/dpt/dpt_control.c b/sys/dev/raid/dpt/dpt_control.c index 4b6c6ae4ed..d38904dd19 100644 --- a/sys/dev/raid/dpt/dpt_control.c +++ b/sys/dev/raid/dpt/dpt_control.c @@ -37,7 +37,7 @@ */ #ident "$FreeBSD: src/sys/dev/dpt/dpt_control.c,v 1.16 1999/09/25 18:23:48 phk Exp $" -#ident "$DragonFly: src/sys/dev/raid/dpt/dpt_control.c,v 1.8 2005/06/10 15:46:31 swildner Exp $" +#ident "$DragonFly: src/sys/dev/raid/dpt/dpt_control.c,v 1.9 2006/09/05 00:55:41 dillon Exp $" #include "opt_dpt.h" @@ -559,7 +559,7 @@ dpt_read(dev_t dev, struct uio * uio, int ioflag) if ((dpt = dpt_minor2softc(minor_no)) == NULL) return (ENXIO); - work_buffer = (u_int8_t *) malloc(PAGE_SIZE, M_TEMP, M_WAITOK); + work_buffer = (u_int8_t *) kmalloc(PAGE_SIZE, M_TEMP, M_WAITOK); wbp = work_buffer; work_size = 0; diff --git a/sys/dev/raid/dpt/dpt_scsi.c b/sys/dev/raid/dpt/dpt_scsi.c index e00643cdf9..0d047638df 100644 --- a/sys/dev/raid/dpt/dpt_scsi.c +++ b/sys/dev/raid/dpt/dpt_scsi.c @@ -44,7 +44,7 @@ */ #ident "$FreeBSD: src/sys/dev/dpt/dpt_scsi.c,v 1.28.2.3 2003/01/31 02:47:10 grog Exp $" -#ident "$DragonFly: src/sys/dev/raid/dpt/dpt_scsi.c,v 1.9 2005/06/10 15:46:31 swildner Exp $" +#ident "$DragonFly: src/sys/dev/raid/dpt/dpt_scsi.c,v 1.10 2006/09/05 00:55:41 dillon Exp $" #define _DPT_C_ @@ -305,12 +305,12 @@ dptallocsgmap(struct dpt_softc *dpt) { struct sg_map_node *sg_map; - sg_map = malloc(sizeof(*sg_map), M_DEVBUF, M_INTWAIT); + sg_map = kmalloc(sizeof(*sg_map), M_DEVBUF, M_INTWAIT); /* Allocate S/G space for the next batch of CCBS */ if (bus_dmamem_alloc(dpt->sg_dmat, (void **)&sg_map->sg_vaddr, BUS_DMA_NOWAIT, &sg_map->sg_dmamap) != 0) { - free(sg_map, M_DEVBUF); + kfree(sg_map, M_DEVBUF); return (NULL); } @@ -395,7 +395,7 @@ dpt_pio_get_conf (u_int32_t base) * Allocate a dpt_conf_t */ if (conf == NULL) - conf = malloc(sizeof(dpt_conf_t), M_DEVBUF, M_INTWAIT); + conf = kmalloc(sizeof(dpt_conf_t), M_DEVBUF, M_INTWAIT); /* * If we have one, clean it up. @@ -1205,7 +1205,7 @@ dpt_free(struct dpt_softc *dpt) sg_map->sg_dmamap); bus_dmamem_free(dpt->sg_dmat, sg_map->sg_vaddr, sg_map->sg_dmamap); - free(sg_map, M_DEVBUF); + kfree(sg_map, M_DEVBUF); } bus_dma_tag_destroy(dpt->sg_dmat); } @@ -2155,7 +2155,7 @@ valid_unit: dpt->target_ccb[channel][target][lun] = ccb; dpt->rw_buffer[channel][target][lun] = - malloc(DPT_RW_BUFFER_SIZE, M_DEVBUF, M_INTWAIT); + kmalloc(DPT_RW_BUFFER_SIZE, M_DEVBUF, M_INTWAIT); dpt_set_target(0, dpt, channel, target, lun, mode, length, offset, ccb); return (SUCCESSFULLY_REGISTERED); @@ -2173,7 +2173,7 @@ valid_unit: crit_enter(); dpt_Qpush_free(dpt, ccb); crit_exit(); - free(dpt->rw_buffer[channel][target][lun], M_DEVBUF); + kfree(dpt->rw_buffer[channel][target][lun], M_DEVBUF); return (SUCCESSFULLY_REGISTERED); } else return (INVALID_CALLBACK); @@ -2288,7 +2288,7 @@ dpt_user_cmd(dpt_softc_t * dpt, eata_pt_t * user_cmd, ccb->eata_ccb.cp_datalen, 0x10000); } else { - data = malloc(ccb->eata_ccb.cp_datalen, M_TEMP, + data = kmalloc(ccb->eata_ccb.cp_datalen, M_TEMP, M_WAITOK); } @@ -2317,7 +2317,7 @@ dpt_user_cmd(dpt_softc_t * dpt, eata_pt_t * user_cmd, if (dpt_scatter_gather(dpt, ccb, ccb->eata_ccb.cp_datalen, data) != 0) { if (data != NULL) - free(data, M_TEMP); + kfree(data, M_TEMP); return (EFAULT); } } @@ -2384,7 +2384,7 @@ dpt_user_cmd(dpt_softc_t * dpt, eata_pt_t * user_cmd, /* Free allocated memory */ if (data != NULL) - free(data, M_TEMP); + kfree(data, M_TEMP); return (0); } diff --git a/sys/dev/raid/ida/ida.c b/sys/dev/raid/ida/ida.c index 98b1b5ce6e..6821117124 100644 --- a/sys/dev/raid/ida/ida.c +++ b/sys/dev/raid/ida/ida.c @@ -28,7 +28,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ida/ida.c,v 1.7.2.3 2001/03/01 01:57:32 ps Exp $ - * $DragonFly: src/sys/dev/raid/ida/ida.c,v 1.11 2006/04/30 17:22:16 dillon Exp $ + * $DragonFly: src/sys/dev/raid/ida/ida.c,v 1.12 2006/09/05 00:55:41 dillon Exp $ */ /* @@ -96,7 +96,7 @@ ida_free(struct ida_softc *ida) bus_dma_tag_destroy(ida->hwqcb_dmat); if (ida->qcbs != NULL) - free(ida->qcbs, M_DEVBUF); + kfree(ida->qcbs, M_DEVBUF); if (ida->ih != NULL) bus_teardown_intr(ida->dev, ida->irq, ida->ih); diff --git a/sys/dev/raid/iir/iir.c b/sys/dev/raid/iir/iir.c index f1acde15ad..91262a6f88 100644 --- a/sys/dev/raid/iir/iir.c +++ b/sys/dev/raid/iir/iir.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/dev/iir/iir.c,v 1.2.2.3 2002/05/05 08:18:12 asmodai Exp $ */ -/* $DragonFly: src/sys/dev/raid/iir/iir.c,v 1.11 2005/12/11 01:54:09 swildner Exp $ */ +/* $DragonFly: src/sys/dev/raid/iir/iir.c,v 1.12 2006/09/05 00:55:42 dillon Exp $ */ /* * Copyright (c) 2000-01 Intel Corporation * All Rights Reserved @@ -1516,7 +1516,7 @@ iir_shutdown( void *arg, int howto ) gdt->sc_hanum); /* allocate ucmd buffer */ - ucmd = malloc(sizeof(gdt_ucmd_t), M_DEVBUF, M_INTWAIT | M_ZERO); + ucmd = kmalloc(sizeof(gdt_ucmd_t), M_DEVBUF, M_INTWAIT | M_ZERO); /* wait for pending IOs */ crit_enter(); @@ -1541,7 +1541,7 @@ iir_shutdown( void *arg, int howto ) } } - free(ucmd, M_DEVBUF); + kfree(ucmd, M_DEVBUF); printf("Done.\n"); } diff --git a/sys/dev/raid/ips/ips.c b/sys/dev/raid/ips/ips.c index c32ca1fc7a..5f3888aae7 100644 --- a/sys/dev/raid/ips/ips.c +++ b/sys/dev/raid/ips/ips.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ips/ips.c,v 1.12 2004/05/30 04:01:29 scottl Exp $ - * $DragonFly: src/sys/dev/raid/ips/ips.c,v 1.14 2006/07/28 02:17:37 dillon Exp $ + * $DragonFly: src/sys/dev/raid/ips/ips.c,v 1.15 2006/09/05 00:55:42 dillon Exp $ */ #include @@ -134,7 +134,7 @@ ips_cmdqueue_free(ips_softc_t *sc) sc->state |= IPS_OFFLINE; } sc->staticcmd = NULL; - free(sc->commandarray, M_IPSBUF); + kfree(sc->commandarray, M_IPSBUF); crit_exit(); return error; } diff --git a/sys/dev/raid/ips/ips_ioctl.c b/sys/dev/raid/ips/ips_ioctl.c index eb92dcc316..8ac8fa5e5b 100644 --- a/sys/dev/raid/ips/ips_ioctl.c +++ b/sys/dev/raid/ips/ips_ioctl.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ips/ips_ioctl.c,v 1.5 2004/05/30 04:01:29 scottl Exp $ - * $DragonFly: src/sys/dev/raid/ips/ips_ioctl.c,v 1.6 2006/06/04 21:09:50 dillon Exp $ + * $DragonFly: src/sys/dev/raid/ips/ips_ioctl.c,v 1.7 2006/09/05 00:55:42 dillon Exp $ */ #include @@ -163,20 +163,20 @@ ips_ioctl_request(ips_softc_t *sc, u_long ioctl_request, caddr_t addr, switch (ioctl_request) { case IPS_USER_CMD: user_request = (ips_user_request *)addr; - ioctl_cmd = malloc(sizeof(ips_ioctl_t), M_IPSBUF, M_WAITOK); + ioctl_cmd = kmalloc(sizeof(ips_ioctl_t), M_IPSBUF, M_WAITOK); ioctl_cmd->command_buffer = malloc(sizeof(ips_generic_cmd), M_IPSBUF, M_WAITOK); if (copyin(user_request->command_buffer, ioctl_cmd->command_buffer, sizeof(ips_generic_cmd))) { - free(ioctl_cmd->command_buffer, M_IPSBUF); - free(ioctl_cmd, M_IPSBUF); + kfree(ioctl_cmd->command_buffer, M_IPSBUF); + kfree(ioctl_cmd, M_IPSBUF); break; } ioctl_cmd->readwrite = IPS_IOCTL_READ | IPS_IOCTL_WRITE; ioctl_cmd->datasize = IPS_IOCTL_BUFFER_SIZE; error = ips_ioctl_cmd(sc, ioctl_cmd, user_request); - free(ioctl_cmd->command_buffer, M_IPSBUF); - free(ioctl_cmd, M_IPSBUF); + kfree(ioctl_cmd->command_buffer, M_IPSBUF); + kfree(ioctl_cmd, M_IPSBUF); break; } return error; diff --git a/sys/dev/raid/mlx/mlx.c b/sys/dev/raid/mlx/mlx.c index 2d8926277a..5fbd15c41a 100644 --- a/sys/dev/raid/mlx/mlx.c +++ b/sys/dev/raid/mlx/mlx.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/mlx/mlx.c,v 1.14.2.5 2001/09/11 09:49:53 kris Exp $ - * $DragonFly: src/sys/dev/raid/mlx/mlx.c,v 1.19 2006/07/28 02:17:37 dillon Exp $ + * $DragonFly: src/sys/dev/raid/mlx/mlx.c,v 1.20 2006/09/05 00:55:42 dillon Exp $ */ /* @@ -195,7 +195,7 @@ mlx_free(struct mlx_softc *sc) /* free controller enquiry data */ if (sc->mlx_enq2 != NULL) - free(sc->mlx_enq2, M_DEVBUF); + kfree(sc->mlx_enq2, M_DEVBUF); dev_ops_remove(&mlx_ops, -1, device_get_unit(sc->mlx_dev)); } @@ -421,7 +421,7 @@ mlx_attach(struct mlx_softc *sc) return(ENXIO); } sc->mlx_enq2->me_firmware_id = ('0' << 24) | (0 << 16) | (meo->me_fwminor << 8) | meo->me_fwmajor; - free(meo, M_DEVBUF); + kfree(meo, M_DEVBUF); /* XXX require 2.42 or better (PCI) or 2.14 or better (EISA) */ if (meo->me_fwminor < 42) { @@ -538,7 +538,7 @@ mlx_startup(struct mlx_softc *sc) device_set_ivars(dr->ms_disk, dr); } } - free(mes, M_DEVBUF); + kfree(mes, M_DEVBUF); if ((error = bus_generic_attach(sc->mlx_dev)) != 0) device_printf(sc->mlx_dev, "bus_generic_attach returned %d", error); @@ -1169,7 +1169,7 @@ mlx_periodic_enquiry(struct mlx_command *mc) } out: - free(mc->mc_data, M_DEVBUF); + kfree(mc->mc_data, M_DEVBUF); mlx_releasecmd(mc); } @@ -1194,7 +1194,7 @@ mlx_periodic_eventlog_poll(struct mlx_softc *sc) * allocate the response structure - sizeof(struct mlx_eventlog_entry)? * Called from timeout - use M_NOWAIT (repoll later on failure?) */ - if ((result = malloc(1024, M_DEVBUF, M_NOWAIT)) == NULL) + if ((result = kmalloc(1024, M_DEVBUF, M_NOWAIT)) == NULL) goto out; /* get a command slot */ if (mlx_getslot(mc)) @@ -1220,7 +1220,7 @@ mlx_periodic_eventlog_poll(struct mlx_softc *sc) if (mc != NULL) mlx_releasecmd(mc); if (result != NULL) - free(result, M_DEVBUF); + kfree(result, M_DEVBUF); } } @@ -1302,7 +1302,7 @@ mlx_periodic_eventlog_respond(struct mlx_command *mc) } /* dispose of command and data */ - free(mc->mc_data, M_DEVBUF); + kfree(mc->mc_data, M_DEVBUF); mlx_releasecmd(mc); /* is there another message to obtain? */ @@ -1353,7 +1353,7 @@ mlx_periodic_rebuild(struct mlx_command *mc) sc->mlx_rebuildstat.rs_code = MLX_REBUILDSTAT_IDLE; break; } - free(mc->mc_data, M_DEVBUF); + kfree(mc->mc_data, M_DEVBUF); mlx_releasecmd(mc); } @@ -1470,7 +1470,7 @@ mlx_enquire(struct mlx_softc *sc, int command, size_t bufsize, void (* complete) if ((mc = mlx_alloccmd(sc)) == NULL) goto out; /* allocate the response structure */ - result = malloc(bufsize, M_DEVBUF, M_INTWAIT); + result = kmalloc(bufsize, M_DEVBUF, M_INTWAIT); /* get a command slot */ mc->mc_flags |= MLX_CMD_PRIORITY | MLX_CMD_DATAOUT; if (mlx_getslot(mc)) @@ -1508,7 +1508,7 @@ mlx_enquire(struct mlx_softc *sc, int command, size_t bufsize, void (* complete) mlx_releasecmd(mc); /* we got an error, and we allocated a result */ if ((error != 0) && (result != NULL)) { - free(result, M_DEVBUF); + kfree(result, M_DEVBUF); result = NULL; } return(result); @@ -1881,7 +1881,7 @@ mlx_user_command(struct mlx_softc *sc, struct mlx_usercommand *mu) if (mu->mu_datasize > 0) { if (mu->mu_datasize > MAXPHYS) return (EINVAL); - if (((kbuf = malloc(mu->mu_datasize, M_DEVBUF, M_WAITOK)) == NULL) || + if (((kbuf = kmalloc(mu->mu_datasize, M_DEVBUF, M_WAITOK)) == NULL) || (error = copyin(mu->mu_buf, kbuf, mu->mu_datasize))) goto out; debug(0, "got kernel buffer"); @@ -1940,7 +1940,7 @@ mlx_user_command(struct mlx_softc *sc, struct mlx_usercommand *mu) out: mlx_releasecmd(mc); if (kbuf != NULL) - free(kbuf, M_DEVBUF); + kfree(kbuf, M_DEVBUF); return(error); } @@ -2268,11 +2268,11 @@ mlx_alloccmd(struct mlx_softc *sc) /* allocate a new command buffer? */ if (mc == NULL) { - mc = malloc(sizeof(*mc), M_DEVBUF, M_INTWAIT | M_ZERO); + mc = kmalloc(sizeof(*mc), M_DEVBUF, M_INTWAIT | M_ZERO); mc->mc_sc = sc; error = bus_dmamap_create(sc->mlx_buffer_dmat, 0, &mc->mc_dmamap); if (error) { - free(mc, M_DEVBUF); + kfree(mc, M_DEVBUF); return(NULL); } } @@ -2305,7 +2305,7 @@ mlx_freecmd(struct mlx_command *mc) debug_called(1); bus_dmamap_destroy(sc->mlx_buffer_dmat, mc->mc_dmamap); - free(mc, M_DEVBUF); + kfree(mc, M_DEVBUF); } diff --git a/sys/dev/raid/mly/mly.c b/sys/dev/raid/mly/mly.c index aad54be32b..c27e5e3cc8 100644 --- a/sys/dev/raid/mly/mly.c +++ b/sys/dev/raid/mly/mly.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/mly/mly.c,v 1.3.2.3 2001/03/05 20:17:24 msmith Exp $ - * $DragonFly: src/sys/dev/raid/mly/mly.c,v 1.13 2006/07/28 02:17:37 dillon Exp $ + * $DragonFly: src/sys/dev/raid/mly/mly.c,v 1.14 2006/09/05 00:55:42 dillon Exp $ */ #include @@ -250,7 +250,7 @@ mly_get_controllerinfo(struct mly_softc *sc) debug_called(1); if (sc->mly_controllerinfo != NULL) - free(sc->mly_controllerinfo, M_DEVBUF); + kfree(sc->mly_controllerinfo, M_DEVBUF); /* build the getcontrollerinfo ioctl and send it */ bzero(&mci, sizeof(mci)); @@ -263,7 +263,7 @@ mly_get_controllerinfo(struct mly_softc *sc) return(EIO); if (sc->mly_controllerparam != NULL) - free(sc->mly_controllerparam, M_DEVBUF); + kfree(sc->mly_controllerparam, M_DEVBUF); /* build the getcontrollerparameter ioctl and send it */ bzero(&mci, sizeof(mci)); @@ -323,7 +323,7 @@ mly_rescan_btl(struct mly_softc *sc, int bus, int target) return; /* we'll be retried soon */ /* set up the data buffer */ - mc->mc_data = malloc(sizeof(union mly_devinfo), M_DEVBUF, M_INTWAIT | M_ZERO); + mc->mc_data = kmalloc(sizeof(union mly_devinfo), M_DEVBUF, M_INTWAIT | M_ZERO); mc->mc_flags |= MLY_CMD_DATAIN; mc->mc_complete = mly_complete_rescan; @@ -409,7 +409,7 @@ mly_complete_rescan(struct mly_command *mc) * We don't care about this, so we do nothing about it. */ } - free(mc->mc_data, M_DEVBUF); + kfree(mc->mc_data, M_DEVBUF); mly_release_command(mc); } @@ -444,7 +444,7 @@ mly_get_eventstatus(struct mly_softc *sc) debug(1, "initial change counter %d, event counter %d", mh->change_counter, mh->next_event); - free(mh, M_DEVBUF); + kfree(mh, M_DEVBUF); return(0); } @@ -557,7 +557,7 @@ mly_ioctl(struct mly_softc *sc, struct mly_command_ioctl *ioctl, void **data, si if (data != NULL) { if (*data == NULL) { /* allocate data buffer */ - mc->mc_data = malloc(datasize, M_DEVBUF, M_INTWAIT); + mc->mc_data = kmalloc(datasize, M_DEVBUF, M_INTWAIT); mc->mc_flags |= MLY_CMD_DATAIN; } else { mc->mc_data = *data; @@ -590,7 +590,7 @@ out: if (mc != NULL) { /* do we need to free a data buffer we allocated? */ if (error && (mc->mc_data != NULL) && (*data == NULL)) - free(mc->mc_data, M_DEVBUF); + kfree(mc->mc_data, M_DEVBUF); mly_release_command(mc); } return(error); @@ -614,7 +614,7 @@ mly_fetch_event(struct mly_softc *sc) return; /* we'll get retried the next time a command completes */ /* set up the data buffer */ - mc->mc_data = malloc(sizeof(struct mly_event), M_DEVBUF, M_INTWAIT|M_ZERO); + mc->mc_data = kmalloc(sizeof(struct mly_event), M_DEVBUF, M_INTWAIT|M_ZERO); mc->mc_length = sizeof(struct mly_event); mc->mc_flags |= MLY_CMD_DATAIN; mc->mc_complete = mly_complete_event; @@ -678,7 +678,7 @@ mly_complete_event(struct mly_command *mc) */ if (mc->mc_status == SCSI_STATUS_OK) { mly_process_event(sc, me); - free(me, M_DEVBUF); + kfree(me, M_DEVBUF); } mly_release_command(mc); } @@ -1764,7 +1764,7 @@ mly_user_command(struct mly_softc *sc, struct mly_user_command *uc) /* handle data size/direction */ mc->mc_length = (uc->DataTransferLength >= 0) ? uc->DataTransferLength : -uc->DataTransferLength; if (mc->mc_length > 0) - mc->mc_data = malloc(mc->mc_length, M_DEVBUF, M_INTWAIT); + mc->mc_data = kmalloc(mc->mc_length, M_DEVBUF, M_INTWAIT); if (uc->DataTransferLength > 0) { mc->mc_flags |= MLY_CMD_DATAIN; bzero(mc->mc_data, mc->mc_length); @@ -1809,7 +1809,7 @@ mly_user_command(struct mly_softc *sc, struct mly_user_command *uc) out: if (mc->mc_data != NULL) - free(mc->mc_data, M_DEVBUF); + kfree(mc->mc_data, M_DEVBUF); if (mc != NULL) mly_release_command(mc); return(error); diff --git a/sys/dev/raid/mly/mly_pci.c b/sys/dev/raid/mly/mly_pci.c index 6c4ff69d8d..15b1a2b3a2 100644 --- a/sys/dev/raid/mly/mly_pci.c +++ b/sys/dev/raid/mly/mly_pci.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/mly/mly_pci.c,v 1.1.2.2 2001/03/05 20:17:24 msmith Exp $ - * $DragonFly: src/sys/dev/raid/mly/Attic/mly_pci.c,v 1.6 2005/10/12 17:35:54 dillon Exp $ + * $DragonFly: src/sys/dev/raid/mly/Attic/mly_pci.c,v 1.7 2006/09/05 00:55:42 dillon Exp $ */ #include @@ -537,11 +537,11 @@ mly_free(struct mly_softc *sc) /* throw away the controllerinfo structure */ if (sc->mly_controllerinfo != NULL) - free(sc->mly_controllerinfo, M_DEVBUF); + kfree(sc->mly_controllerinfo, M_DEVBUF); /* throw away the controllerparam structure */ if (sc->mly_controllerparam != NULL) - free(sc->mly_controllerparam, M_DEVBUF); + kfree(sc->mly_controllerparam, M_DEVBUF); /* destroy data-transfer DMA tag */ if (sc->mly_buffer_dmat) diff --git a/sys/dev/raid/pst/pst-iop.c b/sys/dev/raid/pst/pst-iop.c index 1c02c9278a..87090f9872 100644 --- a/sys/dev/raid/pst/pst-iop.c +++ b/sys/dev/raid/pst/pst-iop.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/pst/pst-iop.c,v 1.2.2.1 2002/08/18 12:32:36 sos Exp $ - * $DragonFly: src/sys/dev/raid/pst/pst-iop.c,v 1.7 2005/10/12 17:35:54 dillon Exp $ + * $DragonFly: src/sys/dev/raid/pst/pst-iop.c,v 1.8 2006/09/05 00:55:42 dillon Exp $ */ #include @@ -84,7 +84,7 @@ iop_init(struct iop_softc *sc) sc->iop_delayed_attach->ich_desc = "pst"; if (config_intrhook_establish(sc->iop_delayed_attach)) { printf("pstiop: config_intrhook_establish failed\n"); - free(sc->iop_delayed_attach, M_PSTIOP); + kfree(sc->iop_delayed_attach, M_PSTIOP); } return 1; } @@ -96,7 +96,7 @@ iop_attach(struct iop_softc *sc) if (sc->iop_delayed_attach) { config_intrhook_disestablish(sc->iop_delayed_attach); - free(sc->iop_delayed_attach, M_PSTIOP); + kfree(sc->iop_delayed_attach, M_PSTIOP); sc->iop_delayed_attach = NULL; } diff --git a/sys/dev/raid/pst/pst-raid.c b/sys/dev/raid/pst/pst-raid.c index 5aee9d6917..d7f3f5ded0 100644 --- a/sys/dev/raid/pst/pst-raid.c +++ b/sys/dev/raid/pst/pst-raid.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/pst/pst-raid.c,v 1.2.2.1 2002/08/18 12:32:36 sos Exp $ - * $DragonFly: src/sys/dev/raid/pst/pst-raid.c,v 1.16 2006/07/28 02:17:37 dillon Exp $ + * $DragonFly: src/sys/dev/raid/pst/pst-raid.c,v 1.17 2006/09/05 00:55:42 dillon Exp $ */ #include @@ -106,7 +106,7 @@ pst_add_raid(struct iop_softc *sc, struct i2o_lct_entry *lct) if (!child) return ENOMEM; - psc = malloc(sizeof(struct pst_softc), M_PSTRAID, M_INTWAIT | M_ZERO); + psc = kmalloc(sizeof(struct pst_softc), M_PSTRAID, M_INTWAIT | M_ZERO); psc->iop = sc; psc->lct = lct; device_set_softc(child, psc); @@ -134,7 +134,7 @@ pst_attach(device_t dev) I2O_BSA_DEVICE_INFO_GROUP_NO))) return ENODEV; - psc->info = malloc(sizeof(struct i2o_bsa_device), M_PSTRAID, M_INTWAIT); + psc->info = kmalloc(sizeof(struct i2o_bsa_device), M_PSTRAID, M_INTWAIT); bcopy(reply->result, psc->info, sizeof(struct i2o_bsa_device)); contigfree(reply, PAGE_SIZE, M_PSTRAID); @@ -255,7 +255,7 @@ pst_start(struct pst_softc *psc) iop_free_mfa(request->psc->iop, request->mfa); psc->outstanding--; callout_stop(&request->timeout); - free(request, M_PSTRAID); + kfree(request, M_PSTRAID); } } } @@ -277,7 +277,7 @@ pst_done(struct iop_softc *sc, u_int32_t mfa, struct i2o_single_reply *reply) bp->b_flags |= B_ERROR; } biodone(request->bio); - free(request, M_PSTRAID); + kfree(request, M_PSTRAID); crit_enter(); psc->iop->reg->oqueue = mfa; psc->outstanding--; diff --git a/sys/dev/raid/twa/twa.c b/sys/dev/raid/twa/twa.c index 949e0a8baa..03228446b0 100644 --- a/sys/dev/raid/twa/twa.c +++ b/sys/dev/raid/twa/twa.c @@ -26,7 +26,7 @@ * SUCH DAMAGE. * * $FreeBSD$ - * $DragonFly: src/sys/dev/raid/twa/twa.c,v 1.4 2005/06/26 22:03:28 dillon Exp $ + * $DragonFly: src/sys/dev/raid/twa/twa.c,v 1.5 2006/09/05 00:55:42 dillon Exp $ */ /* @@ -173,7 +173,7 @@ twa_flash_firmware(struct twa_softc *sc) tr->tr_cmd_pkt_type |= TWA_CMD_PKT_TYPE_INTERNAL; /* Allocate sufficient memory to hold a chunk of the firmware image. */ fw_img_chunk_size = ((twa_fw_img_size/NUM_FW_IMAGE_CHUNKS) + 511) & ~511; - if ((tr->tr_data = malloc(fw_img_chunk_size, M_DEVBUF, M_WAITOK)) == NULL) { + if ((tr->tr_data = kmalloc(fw_img_chunk_size, M_DEVBUF, M_WAITOK)) == NULL) { twa_printf (sc, "Could not allocate memory for firmware image.\n"); error = ENOMEM; goto out; @@ -251,7 +251,7 @@ twa_flash_firmware(struct twa_softc *sc) } /* for */ if (tr->tr_data) - free(tr->tr_data, M_DEVBUF); + kfree(tr->tr_data, M_DEVBUF); out: if (tr) twa_release_request(tr); @@ -583,7 +583,7 @@ twa_ioctl(struct twa_softc *sc, int cmd, void *buf) */ data_buf_size_adjusted = (user_buf->twa_drvr_pkt.buffer_length + 511) & ~511; if ((tr->tr_length = data_buf_size_adjusted)) { - if ((tr->tr_data = malloc(data_buf_size_adjusted, M_DEVBUF, M_WAITOK)) == NULL) { + if ((tr->tr_data = kmalloc(data_buf_size_adjusted, M_DEVBUF, M_WAITOK)) == NULL) { twa_printf(sc, "Could not alloc mem for fw_passthru data_buf.\n"); error = ENOMEM; goto fw_passthru_done; @@ -634,7 +634,7 @@ twa_ioctl(struct twa_softc *sc, int cmd, void *buf) fw_passthru_done: /* Free resources. */ if (tr->tr_data) - free(tr->tr_data, M_DEVBUF); + kfree(tr->tr_data, M_DEVBUF); if (tr) twa_release_request(tr); break; @@ -941,7 +941,7 @@ twa_get_param(struct twa_softc *sc, int table_id, int param_id, tr->tr_cmd_pkt_type |= TWA_CMD_PKT_TYPE_INTERNAL; /* Allocate memory to read data into. */ - param = malloc(TWA_SECTOR_SIZE, M_DEVBUF, M_INTWAIT); + param = kmalloc(TWA_SECTOR_SIZE, M_DEVBUF, M_INTWAIT); bzero(param, sizeof(struct twa_param_9k) - 1 + param_size); tr->tr_data = param; tr->tr_length = TWA_SECTOR_SIZE; @@ -998,7 +998,7 @@ twa_get_param(struct twa_softc *sc, int table_id, int param_id, out: twa_printf(sc, "get_param failed. error = 0x%x\n", error); if (param) - free(param, M_DEVBUF); + kfree(param, M_DEVBUF); if (tr) twa_release_request(tr); return(NULL); @@ -1037,7 +1037,7 @@ twa_set_param(struct twa_softc *sc, int table_id, tr->tr_cmd_pkt_type |= TWA_CMD_PKT_TYPE_INTERNAL; /* Allocate memory to send data using. */ - param = malloc(TWA_SECTOR_SIZE, M_DEVBUF, M_INTWAIT); + param = kmalloc(TWA_SECTOR_SIZE, M_DEVBUF, M_INTWAIT); bzero(param, sizeof(struct twa_param_9k) - 1 + param_size); tr->tr_data = param; tr->tr_length = TWA_SECTOR_SIZE; @@ -1079,7 +1079,7 @@ twa_set_param(struct twa_softc *sc, int table_id, tr->tr_command->cmd_hdr.err_specific_desc); goto out; /* twa_drain_complete_queue will have done the unmapping */ } - free(param, M_DEVBUF); + kfree(param, M_DEVBUF); twa_release_request(tr); return(error); } else { @@ -1096,7 +1096,7 @@ twa_set_param(struct twa_softc *sc, int table_id, out: twa_printf(sc, "set_param failed. error = 0x%x\n", error); if (param) - free(param, M_DEVBUF); + kfree(param, M_DEVBUF); if (tr) twa_release_request(tr); return(error); @@ -1264,7 +1264,7 @@ twa_wait_request(struct twa_request *tr, u_int32_t timeout) twa_remove_pending(tr); twa_unmap_request(tr); if (tr->tr_data) - free(tr->tr_data, M_DEVBUF); + kfree(tr->tr_data, M_DEVBUF); twa_release_request(tr); } return(ETIMEDOUT); @@ -1336,7 +1336,7 @@ twa_immediate_request(struct twa_request *tr, u_int32_t timeout) twa_remove_pending(tr); twa_unmap_request(tr); if (tr->tr_data) - free(tr->tr_data, M_DEVBUF); + kfree(tr->tr_data, M_DEVBUF); twa_release_request(tr); } return(ETIMEDOUT); @@ -1854,7 +1854,7 @@ twa_fetch_aen(struct twa_softc *sc) tr->tr_callback = twa_aen_callback; if ((error = twa_send_scsi_cmd(tr, 0x03 /* REQUEST_SENSE */))) { if (tr->tr_data) - free(tr->tr_data, M_DEVBUF); + kfree(tr->tr_data, M_DEVBUF); twa_release_request(tr); } return(error); @@ -1906,7 +1906,7 @@ twa_aen_callback(struct twa_request *tr) } if (tr->tr_data) - free(tr->tr_data, M_DEVBUF); + kfree(tr->tr_data, M_DEVBUF); twa_release_request(tr); } @@ -1962,13 +1962,13 @@ twa_drain_aen_queue(struct twa_softc *sc) break; twa_enqueue_aen(sc, cmd_hdr); - free(tr->tr_data, M_DEVBUF); + kfree(tr->tr_data, M_DEVBUF); twa_release_request(tr); } if (tr) { if (tr->tr_data) - free(tr->tr_data, M_DEVBUF); + kfree(tr->tr_data, M_DEVBUF); twa_release_request(tr); } return(error); @@ -2224,7 +2224,7 @@ twa_describe_controller(struct twa_softc *sc) TWA_PARAM_CONTROLLER_PORT_COUNT, 1, NULL); if (p[0]) { num_ports = *(u_int8_t *)(p[0]->data); - free(p[0], M_DEVBUF); + kfree(p[0], M_DEVBUF); } /* Get the firmware and BIOS versions. */ @@ -2251,18 +2251,18 @@ twa_describe_controller(struct twa_softc *sc) p[4]?(p[4]->data):NULL, p[5]?(p[5]->data):NULL); if (p[2]) - free(p[2], M_DEVBUF); + kfree(p[2], M_DEVBUF); if (p[3]) - free(p[3], M_DEVBUF); + kfree(p[3], M_DEVBUF); if (p[4]) - free(p[4], M_DEVBUF); + kfree(p[4], M_DEVBUF); if (p[5]) - free(p[5], M_DEVBUF); + kfree(p[5], M_DEVBUF); } if (p[0]) - free(p[0], M_DEVBUF); + kfree(p[0], M_DEVBUF); if (p[1]) - free(p[1], M_DEVBUF); + kfree(p[1], M_DEVBUF); } diff --git a/sys/dev/raid/twa/twa_cam.c b/sys/dev/raid/twa/twa_cam.c index 09cec4c3bc..15a7e74926 100644 --- a/sys/dev/raid/twa/twa_cam.c +++ b/sys/dev/raid/twa/twa_cam.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD$ - * $DragonFly: src/sys/dev/raid/twa/twa_cam.c,v 1.2 2004/06/21 15:39:31 dillon Exp $ + * $DragonFly: src/sys/dev/raid/twa/twa_cam.c,v 1.3 2006/09/05 00:55:42 dillon Exp $ */ /* @@ -173,7 +173,7 @@ twa_send_scsi_cmd(struct twa_request *tr, int cmd) ccb.csio.cdb_io.cdb_bytes[0] = (u_int8_t)cmd; ccb.csio.cdb_io.cdb_bytes[4] = 128; ccb.csio.cdb_len = 16; - ccb.csio.data_ptr = malloc(TWA_SECTOR_SIZE, M_DEVBUF, M_INTWAIT|M_ZERO); + ccb.csio.data_ptr = kmalloc(TWA_SECTOR_SIZE, M_DEVBUF, M_INTWAIT|M_ZERO); ccb.csio.dxfer_len = TWA_SECTOR_SIZE; ccb.ccb_h.target_id = 0; @@ -509,7 +509,7 @@ twa_request_bus_scan(struct twa_softc *sc) struct cam_path *path; union ccb *ccb; - if ((ccb = malloc(sizeof(union ccb), M_TEMP, M_WAITOK)) == NULL) + if ((ccb = kmalloc(sizeof(union ccb), M_TEMP, M_WAITOK)) == NULL) return; bzero(ccb, sizeof(union ccb)); if (xpt_create_path(&path, xpt_periph, cam_sim_path(sc->twa_sim), @@ -545,7 +545,7 @@ twa_bus_scan_cb(struct cam_periph *periph, union ccb *ccb) twa_dbg_print(3, "success"); xpt_free_path(ccb->ccb_h.path); - free(ccb, M_TEMP); + kfree(ccb, M_TEMP); } @@ -662,7 +662,7 @@ twa_drain_busy_queue(struct twa_softc *sc) (tr->tr_cmd_pkt_type & TWA_CMD_PKT_TYPE_IOCTL)) { /* It's an internal/ioctl request. Simply free it. */ if (tr->tr_data) - free(tr->tr_data, M_DEVBUF); + kfree(tr->tr_data, M_DEVBUF); } else { if ((ccb = tr->tr_private)) { /* It's a SCSI request. Complete it. */ diff --git a/sys/dev/raid/twa/twa_freebsd.c b/sys/dev/raid/twa/twa_freebsd.c index b311a06ef2..1788cde18c 100644 --- a/sys/dev/raid/twa/twa_freebsd.c +++ b/sys/dev/raid/twa/twa_freebsd.c @@ -26,7 +26,7 @@ * SUCH DAMAGE. * * $FreeBSD$ - * $DragonFly: src/sys/dev/raid/twa/twa_freebsd.c,v 1.10 2006/07/28 02:17:38 dillon Exp $ + * $DragonFly: src/sys/dev/raid/twa/twa_freebsd.c,v 1.11 2006/09/05 00:55:42 dillon Exp $ */ /* @@ -346,12 +346,12 @@ twa_free(struct twa_softc *sc) /* Free all memory allocated so far. */ if (sc->twa_req_buf) - free(sc->twa_req_buf, TWA_MALLOC_CLASS); + kfree(sc->twa_req_buf, TWA_MALLOC_CLASS); if (sc->twa_cmd_pkt_buf) bus_dmamem_free(sc->twa_dma_tag, sc->twa_cmd_pkt_buf, sc->twa_cmd_map); if (sc->twa_aen_queue[0]) - free (sc->twa_aen_queue[0], M_DEVBUF); + kfree (sc->twa_aen_queue[0], M_DEVBUF); /* Destroy the data-transfer DMA tag. */ if (sc->twa_dma_tag) @@ -809,7 +809,7 @@ twa_map_request(struct twa_request *tr) tr->tr_length = 512; while (tr->tr_length < tr->tr_real_length) tr->tr_length <<= 1; - tr->tr_data = malloc(tr->tr_length, TWA_MALLOC_CLASS, M_INTWAIT); + tr->tr_data = kmalloc(tr->tr_length, TWA_MALLOC_CLASS, M_INTWAIT); } /* @@ -827,7 +827,7 @@ twa_map_request(struct twa_request *tr) } else { /* Free alignment buffer if it was used. */ if (tr->tr_flags & TWA_CMD_DATA_COPY_NEEDED) { - free(tr->tr_data, TWA_MALLOC_CLASS); + kfree(tr->tr_data, TWA_MALLOC_CLASS); tr->tr_data = tr->tr_real_data; /* restore 'real' data pointer */ tr->tr_length = tr->tr_real_length;/* restore 'real' data length */ } @@ -889,7 +889,7 @@ twa_unmap_request(struct twa_request *tr) /* Free alignment buffer if it was used. */ if (tr->tr_flags & TWA_CMD_DATA_COPY_NEEDED) { - free(tr->tr_data, TWA_MALLOC_CLASS); + kfree(tr->tr_data, TWA_MALLOC_CLASS); tr->tr_data = tr->tr_real_data; /* restore 'real' data pointer */ tr->tr_length = tr->tr_real_length;/* restore 'real' data length */ } diff --git a/sys/dev/raid/twe/twe.c b/sys/dev/raid/twe/twe.c index c3123d4dc4..05d0a62dfd 100644 --- a/sys/dev/raid/twe/twe.c +++ b/sys/dev/raid/twe/twe.c @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/twe/twe.c,v 1.1.2.10 2004/06/11 18:57:31 vkashyap Exp $ - * $DragonFly: src/sys/dev/raid/twe/twe.c,v 1.15 2006/04/30 17:22:17 dillon Exp $ + * $DragonFly: src/sys/dev/raid/twe/twe.c,v 1.16 2006/09/05 00:55:42 dillon Exp $ */ /* @@ -261,9 +261,9 @@ twe_add_unit(struct twe_softc *sc, int unit) out: if (param != NULL) - free(param, M_DEVBUF); + kfree(param, M_DEVBUF); if (drives != NULL) - free(drives, M_DEVBUF); + kfree(drives, M_DEVBUF); return (error); } @@ -522,7 +522,7 @@ twe_ioctl(struct twe_softc *sc, int cmd, void *addr) */ tr->tr_length = (tu->tu_size + 511) & ~511; if (tr->tr_length > 0) { - if ((tr->tr_data = malloc(tr->tr_length, M_DEVBUF, M_WAITOK)) == NULL) { + if ((tr->tr_data = kmalloc(tr->tr_length, M_DEVBUF, M_WAITOK)) == NULL) { error = ENOMEM; goto cmd_done; } @@ -546,7 +546,7 @@ twe_ioctl(struct twe_softc *sc, int cmd, void *addr) cmd_done: /* free resources */ if (tr->tr_data != NULL) - free(tr->tr_data, M_DEVBUF); + kfree(tr->tr_data, M_DEVBUF); if (tr != NULL) twe_release_request(tr); @@ -599,18 +599,18 @@ twe_ioctl(struct twe_softc *sc, int cmd, void *addr) } else { error = copyout(param->data, tp->tp_data, param->parameter_size_bytes); } - free(param, M_DEVBUF); + kfree(param, M_DEVBUF); } break; case TWEIO_SET_PARAM: - if ((data = malloc(tp->tp_size, M_DEVBUF, M_WAITOK)) == NULL) { + if ((data = kmalloc(tp->tp_size, M_DEVBUF, M_WAITOK)) == NULL) { error = ENOMEM; } else { error = copyin(tp->tp_data, data, tp->tp_size); if (error == 0) error = twe_set_param(sc, tp->tp_table_id, tp->tp_param_id, tp->tp_size, data); - free(data, M_DEVBUF); + kfree(data, M_DEVBUF); } break; @@ -676,7 +676,7 @@ twe_get_param_1(struct twe_softc *sc, int table_id, int param_id, u_int8_t *resu if ((param = twe_get_param(sc, table_id, param_id, 1, NULL)) == NULL) return(ENOENT); *result = *(u_int8_t *)param->data; - free(param, M_DEVBUF); + kfree(param, M_DEVBUF); return(0); } @@ -688,7 +688,7 @@ twe_get_param_2(struct twe_softc *sc, int table_id, int param_id, u_int16_t *res if ((param = twe_get_param(sc, table_id, param_id, 2, NULL)) == NULL) return(ENOENT); *result = *(u_int16_t *)param->data; - free(param, M_DEVBUF); + kfree(param, M_DEVBUF); return(0); } @@ -700,7 +700,7 @@ twe_get_param_4(struct twe_softc *sc, int table_id, int param_id, u_int32_t *res if ((param = twe_get_param(sc, table_id, param_id, 4, NULL)) == NULL) return(ENOENT); *result = *(u_int32_t *)param->data; - free(param, M_DEVBUF); + kfree(param, M_DEVBUF); return(0); } @@ -729,7 +729,7 @@ twe_get_param(struct twe_softc *sc, int table_id, int param_id, size_t param_siz goto err; /* get a buffer */ - param = (TWE_Param *)malloc(TWE_SECTOR_SIZE, M_DEVBUF, M_INTWAIT); + param = (TWE_Param *)kmalloc(TWE_SECTOR_SIZE, M_DEVBUF, M_INTWAIT); tr->tr_data = param; tr->tr_length = TWE_SECTOR_SIZE; tr->tr_flags = TWE_CMD_DATAIN | TWE_CMD_DATAOUT; @@ -771,7 +771,7 @@ err: if (tr != NULL) twe_release_request(tr); if (param != NULL) - free(param, M_DEVBUF); + kfree(param, M_DEVBUF); return(NULL); } @@ -822,7 +822,7 @@ twe_set_param(struct twe_softc *sc, int table_id, int param_id, int param_size, goto out; /* get a buffer */ - param = (TWE_Param *)malloc(TWE_SECTOR_SIZE, M_DEVBUF, M_INTWAIT); + param = (TWE_Param *)kmalloc(TWE_SECTOR_SIZE, M_DEVBUF, M_INTWAIT); tr->tr_data = param; tr->tr_length = TWE_SECTOR_SIZE; tr->tr_flags = TWE_CMD_DATAIN | TWE_CMD_DATAOUT; @@ -851,7 +851,7 @@ out: if (tr != NULL) twe_release_request(tr); if (param != NULL) - free(param, M_DEVBUF); + kfree(param, M_DEVBUF); return(error); } @@ -1353,7 +1353,7 @@ twe_handle_aen(struct twe_request *tr) param = (TWE_Param *)tr->tr_data; aen = *(u_int16_t *)(param->data); - free(tr->tr_data, M_DEVBUF); + kfree(tr->tr_data, M_DEVBUF); twe_release_request(tr); twe_enqueue_aen(sc, aen); @@ -1583,18 +1583,18 @@ twe_describe_controller(struct twe_softc *sc) p[2]->data, p[3]->data, p[4]->data, p[5]->data); if (p[2]) - free(p[2], M_DEVBUF); + kfree(p[2], M_DEVBUF); if (p[3]) - free(p[3], M_DEVBUF); + kfree(p[3], M_DEVBUF); if (p[4]) - free(p[4], M_DEVBUF); + kfree(p[4], M_DEVBUF); if (p[5]) - free(p[5], M_DEVBUF); + kfree(p[5], M_DEVBUF); } if (p[0]) - free(p[0], M_DEVBUF); + kfree(p[0], M_DEVBUF); if (p[1]) - free(p[1], M_DEVBUF); + kfree(p[1], M_DEVBUF); /* print attached drives */ if (bootverbose) { @@ -1606,13 +1606,13 @@ twe_describe_controller(struct twe_softc *sc) p[1] = twe_get_param(sc, TWE_PARAM_DRIVEINFO + i, TWE_PARAM_DRIVEINFO_Model, 40, NULL); if (p[1] != NULL) { twe_printf(sc, "port %d: %.40s %dMB\n", i, p[1]->data, size / 2048); - free(p[1], M_DEVBUF); + kfree(p[1], M_DEVBUF); } else { twe_printf(sc, "port %d, drive status unavailable\n", i); } } if (p[0]) - free(p[0], M_DEVBUF); + kfree(p[0], M_DEVBUF); } } diff --git a/sys/dev/raid/twe/twe_freebsd.c b/sys/dev/raid/twe/twe_freebsd.c index fb7226ce3c..db023ce3ef 100644 --- a/sys/dev/raid/twe/twe_freebsd.c +++ b/sys/dev/raid/twe/twe_freebsd.c @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/twe/twe_freebsd.c,v 1.2.2.9 2004/06/11 18:57:31 vkashyap Exp $ - * $DragonFly: src/sys/dev/raid/twe/twe_freebsd.c,v 1.21 2006/07/28 02:17:38 dillon Exp $ + * $DragonFly: src/sys/dev/raid/twe/twe_freebsd.c,v 1.22 2006/09/05 00:55:42 dillon Exp $ */ /* @@ -883,7 +883,7 @@ twe_allocate_request(struct twe_softc *sc) */ aligned_size = (sizeof(struct twe_request) + TWE_ALIGNMASK) & ~TWE_ALIGNMASK; - tr = malloc(aligned_size, TWE_MALLOC_CLASS, M_INTWAIT|M_ZERO); + tr = kmalloc(aligned_size, TWE_MALLOC_CLASS, M_INTWAIT|M_ZERO); tr->tr_sc = sc; if (bus_dmamap_create(sc->twe_buffer_dmat, 0, &tr->tr_cmdmap)) { twe_free_request(tr); @@ -912,7 +912,7 @@ twe_free_request(struct twe_request *tr) bus_dmamap_unload(sc->twe_buffer_dmat, tr->tr_cmdmap); bus_dmamap_destroy(sc->twe_buffer_dmat, tr->tr_cmdmap); bus_dmamap_destroy(sc->twe_buffer_dmat, tr->tr_dmamap); - free(tr, TWE_MALLOC_CLASS); + kfree(tr, TWE_MALLOC_CLASS); } /******************************************************************************** @@ -1060,7 +1060,7 @@ twe_map_request(struct twe_request *tr) while (aligned_size < tr->tr_length) aligned_size <<= 1; tr->tr_flags |= TWE_CMD_ALIGNBUF; - tr->tr_data = malloc(aligned_size, TWE_MALLOC_CLASS, M_INTWAIT); + tr->tr_data = kmalloc(aligned_size, TWE_MALLOC_CLASS, M_INTWAIT); if (tr->tr_data == NULL) { twe_printf(sc, "%s: malloc failed\n", __func__); tr->tr_data = tr->tr_realdata; /* restore original data pointer */ @@ -1118,7 +1118,7 @@ twe_unmap_request(struct twe_request *tr) /* free alignment buffer if it was used */ if (tr->tr_flags & TWE_CMD_ALIGNBUF) { - free(tr->tr_data, TWE_MALLOC_CLASS); + kfree(tr->tr_data, TWE_MALLOC_CLASS); tr->tr_data = tr->tr_realdata; /* restore 'real' data pointer */ } } diff --git a/sys/dev/raid/vinum/vinum.c b/sys/dev/raid/vinum/vinum.c index 66abcb5f55..2924e698bc 100644 --- a/sys/dev/raid/vinum/vinum.c +++ b/sys/dev/raid/vinum/vinum.c @@ -37,7 +37,7 @@ * * $Id: vinum.c,v 1.33 2001/01/09 06:19:15 grog Exp grog $ * $FreeBSD: src/sys/dev/vinum/vinum.c,v 1.38.2.3 2003/01/07 12:14:16 joerg Exp $ - * $DragonFly: src/sys/dev/raid/vinum/vinum.c,v 1.15 2006/09/03 17:43:59 dillon Exp $ + * $DragonFly: src/sys/dev/raid/vinum/vinum.c,v 1.16 2006/09/05 00:55:42 dillon Exp $ */ #define STATIC static /* nothing while we're testing XXX */ @@ -149,7 +149,7 @@ vinumattach(void *dummy) if (rv) log(LOG_NOTICE, "vinum_scandisk() returned %d", rv); bailout: - free(drives, M_TEMP); + kfree(drives, M_TEMP); } if ((cp = kgetenv("vinum.root")) != NULL) { for (i = 0; i < vinum_conf.volumes_used; i++) { diff --git a/sys/dev/raid/vinum/vinummemory.c b/sys/dev/raid/vinum/vinummemory.c index 47bd26325c..04298fe16c 100644 --- a/sys/dev/raid/vinum/vinummemory.c +++ b/sys/dev/raid/vinum/vinummemory.c @@ -35,7 +35,7 @@ * * $Id: vinummemory.c,v 1.25 2000/05/04 01:57:48 grog Exp grog $ * $FreeBSD: src/sys/dev/vinum/vinummemory.c,v 1.22.2.1 2000/06/02 04:26:11 grog Exp $ - * $DragonFly: src/sys/dev/raid/vinum/vinummemory.c,v 1.8 2005/07/30 18:52:35 joerg Exp $ + * $DragonFly: src/sys/dev/raid/vinum/vinummemory.c,v 1.9 2006/09/05 00:55:42 dillon Exp $ */ #include "vinumhdr.h" @@ -150,7 +150,7 @@ MMalloc(int size, char *file, int line) return 0; /* can't continue */ } /* Wait for malloc if we can */ - result = malloc(size, M_DEVBUF, mycpu->gd_intr_nesting_level == 0 ? M_WAITOK : M_INTWAIT); + result = kmalloc(size, M_DEVBUF, mycpu->gd_intr_nesting_level == 0 ? M_WAITOK : M_INTWAIT); if (result == NULL) log(LOG_ERR, "vinum: can't allocate %d bytes from %s:%d\n", size, file, line); else { @@ -189,7 +189,7 @@ FFree(void *mem, char *file, int line) for (i = 0; i < malloccount; i++) { if ((caddr_t) mem == malloced[i].address) { /* found it */ bzero(mem, malloced[i].size); /* XXX */ - free(mem, M_DEVBUF); + kfree(mem, M_DEVBUF); malloccount--; total_malloced -= malloced[i].size; if (debug & DEBUG_MEMFREE) { /* keep track of recent frees */ diff --git a/sys/dev/serial/cy/cy.c b/sys/dev/serial/cy/cy.c index 8e5edcfd70..a9cdf83a3d 100644 --- a/sys/dev/serial/cy/cy.c +++ b/sys/dev/serial/cy/cy.c @@ -28,7 +28,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/i386/isa/cy.c,v 1.97.2.2 2001/08/22 13:04:58 bde Exp $ - * $DragonFly: src/sys/dev/serial/cy/cy.c,v 1.20 2006/07/28 02:17:38 dillon Exp $ + * $DragonFly: src/sys/dev/serial/cy/cy.c,v 1.21 2006/09/05 00:55:42 dillon Exp $ */ #include "opt_compat.h" @@ -556,7 +556,7 @@ cyattach_common(cy_iobase, cy_align) for (cdu = 0; cdu < CD1400_NO_OF_CHANNELS; ++cdu, ++unit) { struct com_s *com; - com = malloc(sizeof *com, M_DEVBUF, M_WAITOK | M_ZERO); + com = kmalloc(sizeof *com, M_DEVBUF, M_WAITOK | M_ZERO); com->unit = unit; callout_init(&com->dtr_ch); com->gfrcr_image = firmware_version; @@ -597,7 +597,7 @@ cyattach_common(cy_iobase, cy_align) } if (siosetwater(com, com->it_in.c_ispeed) != 0) { enable_intr(); - free(com, M_DEVBUF); + kfree(com, M_DEVBUF); return (0); } enable_intr(); @@ -2165,7 +2165,7 @@ comparam(tp, t) crit_exit(); comstart(tp); if (com->ibufold != NULL) { - free(com->ibufold, M_DEVBUF); + kfree(com->ibufold, M_DEVBUF); com->ibufold = NULL; } return (0); @@ -2199,7 +2199,7 @@ siosetwater(com, speed) * Allocate input buffer. The extra factor of 2 in the size is * to allow for an error byte for each input byte. */ - ibuf = malloc(2 * ibufsize, M_DEVBUF, M_WAITOK); + ibuf = kmalloc(2 * ibufsize, M_DEVBUF, M_WAITOK); /* Initialize non-critical variables. */ com->ibufold = com->ibuf; diff --git a/sys/dev/serial/digi/digi.c b/sys/dev/serial/digi/digi.c index 0b0257ddab..279d4355a3 100644 --- a/sys/dev/serial/digi/digi.c +++ b/sys/dev/serial/digi/digi.c @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/digi/digi.c,v 1.36 2003/09/26 09:05:57 phk Exp $ - * $DragonFly: src/sys/dev/serial/digi/digi.c,v 1.5 2006/07/28 02:17:38 dillon Exp $ + * $DragonFly: src/sys/dev/serial/digi/digi.c,v 1.6 2006/09/05 00:55:42 dillon Exp $ */ /*- @@ -185,15 +185,15 @@ static void digi_freedata(struct digi_softc *sc) { if (sc->fep.data != NULL) { - free(sc->fep.data, M_TTYS); + kfree(sc->fep.data, M_TTYS); sc->fep.data = NULL; } if (sc->link.data != NULL) { - free(sc->link.data, M_TTYS); + kfree(sc->link.data, M_TTYS); sc->link.data = NULL; } if (sc->bios.data != NULL) { - free(sc->bios.data, M_TTYS); + kfree(sc->bios.data, M_TTYS); sc->bios.data = NULL; } } @@ -539,12 +539,12 @@ digi_init(struct digi_softc *sc) sc->numports); if (sc->ports) - free(sc->ports, M_TTYS); + kfree(sc->ports, M_TTYS); sc->ports = malloc(sizeof(struct digi_p) * sc->numports, M_TTYS, M_WAITOK | M_ZERO); if (sc->ttys) - free(sc->ttys, M_TTYS); + kfree(sc->ttys, M_TTYS); sc->ttys = malloc(sizeof(struct tty) * sc->numports, M_TTYS, M_WAITOK | M_ZERO); @@ -1038,13 +1038,13 @@ digi_loaddata(struct digi_softc *sc) sc->bios.size = bios->bios_size; if (sc->bios.size != 0 && bios->bios != NULL) { - sc->bios.data = malloc(sc->bios.size, M_TTYS, M_WAITOK); + sc->bios.data = kmalloc(sc->bios.size, M_TTYS, M_WAITOK); bcopy(bios->bios, sc->bios.data, sc->bios.size); } sc->fep.size = bios->fep_size; if (sc->fep.size != 0 && bios->fep != NULL) { - sc->fep.data = malloc(sc->fep.size, M_TTYS, M_WAITOK); + sc->fep.data = kmalloc(sc->fep.size, M_TTYS, M_WAITOK); bcopy(bios->fep, sc->fep.data, sc->fep.size); } @@ -1875,9 +1875,9 @@ digi_free_state(struct digi_softc *sc) if (sc->numports) { KASSERT(sc->ports, ("digi%d: Lost my ports ?", sc->res.unit)); KASSERT(sc->ttys, ("digi%d: Lost my ttys ?", sc->res.unit)); - free(sc->ports, M_TTYS); + kfree(sc->ports, M_TTYS); sc->ports = NULL; - free(sc->ttys, M_TTYS); + kfree(sc->ttys, M_TTYS); sc->ttys = NULL; sc->numports = 0; } diff --git a/sys/dev/serial/rp/rp.c b/sys/dev/serial/rp/rp.c index 6435d5b563..a9510e966d 100644 --- a/sys/dev/serial/rp/rp.c +++ b/sys/dev/serial/rp/rp.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/rp/rp.c,v 1.45.2.2 2002/11/07 22:26:59 tegge Exp $ - * $DragonFly: src/sys/dev/serial/rp/rp.c,v 1.16 2006/07/28 02:17:38 dillon Exp $ + * $DragonFly: src/sys/dev/serial/rp/rp.c,v 1.17 2006/09/05 00:55:42 dillon Exp $ */ /* @@ -918,11 +918,11 @@ rp_releaseresource(CONTROLLER_t *ctlp) if (p_rp_table[i] == ctlp->rp) p_rp_table[i] = NULL; crit_exit(); - free(ctlp->rp, M_DEVBUF); + kfree(ctlp->rp, M_DEVBUF); ctlp->rp = NULL; } if (ctlp->tty != NULL) { - free(ctlp->tty, M_DEVBUF); + kfree(ctlp->tty, M_DEVBUF); ctlp->tty = NULL; } if (ctlp->dev != NULL) diff --git a/sys/dev/serial/rp/rp_isa.c b/sys/dev/serial/rp/rp_isa.c index 2d123e1e5e..4b7ed741b3 100644 --- a/sys/dev/serial/rp/rp_isa.c +++ b/sys/dev/serial/rp/rp_isa.c @@ -33,7 +33,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/rp/rp_isa.c,v 1.3.2.1 2002/06/18 03:11:46 obrien Exp $ - * $DragonFly: src/sys/dev/serial/rp/rp_isa.c,v 1.4 2004/09/18 20:02:36 dillon Exp $ + * $DragonFly: src/sys/dev/serial/rp/rp_isa.c,v 1.5 2006/09/05 00:55:42 dillon Exp $ */ #include @@ -274,17 +274,17 @@ rp_isareleaseresource(CONTROLLER_t *ctlp) for (i = 0 ; i < MAX_AIOPS_PER_BOARD ; i++) if (ctlp->io[i] != NULL) bus_release_resource(ctlp->dev, SYS_RES_IOPORT, ctlp->io_rid[i], ctlp->io[i]); - free(ctlp->io, M_DEVBUF); + kfree(ctlp->io, M_DEVBUF); } if (ctlp->io_rid != NULL) - free(ctlp->io_rid, M_DEVBUF); + kfree(ctlp->io_rid, M_DEVBUF); if (rp_controller != NULL && rp_controller->io[ISACTL(ctlp)->MBaseIO] != NULL) { bus_release_resource(rp_controller->dev, SYS_RES_IOPORT, rp_controller->io_rid[ISACTL(ctlp)->MBaseIO], rp_controller->io[ISACTL(ctlp)->MBaseIO]); rp_controller->io[ISACTL(ctlp)->MBaseIO] = NULL; rp_controller->io_rid[ISACTL(ctlp)->MBaseIO] = 0; } if (ctlp->bus_ctlp != NULL) - free(ctlp->bus_ctlp, M_DEVBUF); + kfree(ctlp->bus_ctlp, M_DEVBUF); } /*************************************************************************** diff --git a/sys/dev/serial/rp/rp_pci.c b/sys/dev/serial/rp/rp_pci.c index f29e8cabe7..cd1d056364 100644 --- a/sys/dev/serial/rp/rp_pci.c +++ b/sys/dev/serial/rp/rp_pci.c @@ -33,7 +33,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/rp/rp_pci.c,v 1.3.2.1 2002/06/18 03:11:46 obrien Exp $ - * $DragonFly: src/sys/dev/serial/rp/rp_pci.c,v 1.5 2006/08/12 05:18:31 swildner Exp $ + * $DragonFly: src/sys/dev/serial/rp/rp_pci.c,v 1.6 2006/09/05 00:55:42 dillon Exp $ */ #include @@ -232,10 +232,10 @@ rp_pcireleaseresource(CONTROLLER_t *ctlp) if (ctlp->io != NULL) { if (ctlp->io[0] != NULL) bus_release_resource(ctlp->dev, SYS_RES_IOPORT, ctlp->io_rid[0], ctlp->io[0]); - free(ctlp->io, M_DEVBUF); + kfree(ctlp->io, M_DEVBUF); } if (ctlp->io_rid != NULL) - free(ctlp->io_rid, M_DEVBUF); + kfree(ctlp->io_rid, M_DEVBUF); } static int diff --git a/sys/dev/serial/si/si.c b/sys/dev/serial/si/si.c index 15877fb778..b982a8d14b 100644 --- a/sys/dev/serial/si/si.c +++ b/sys/dev/serial/si/si.c @@ -31,7 +31,7 @@ * NO EVENT SHALL THE AUTHORS BE LIABLE. * * $FreeBSD: src/sys/dev/si/si.c,v 1.101.2.1 2001/02/26 04:23:06 jlemon Exp $ - * $DragonFly: src/sys/dev/serial/si/si.c,v 1.17 2006/08/03 16:40:47 swildner Exp $ + * $DragonFly: src/sys/dev/serial/si/si.c,v 1.18 2006/09/05 00:55:42 dillon Exp $ */ #ifndef lint @@ -520,7 +520,7 @@ try_next: /* * allocate tty structures for ports */ - tp = malloc(sizeof(*tp) * nport, M_DEVBUF, M_WAITOK | M_ZERO); + tp = kmalloc(sizeof(*tp) * nport, M_DEVBUF, M_WAITOK | M_ZERO); si__tty = tp; /* diff --git a/sys/dev/serial/sio/sio.c b/sys/dev/serial/sio/sio.c index 9b8761e1b0..56cc3e37da 100644 --- a/sys/dev/serial/sio/sio.c +++ b/sys/dev/serial/sio/sio.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/isa/sio.c,v 1.291.2.35 2003/05/18 08:51:15 murray Exp $ - * $DragonFly: src/sys/dev/serial/sio/sio.c,v 1.32 2006/07/28 02:17:38 dillon Exp $ + * $DragonFly: src/sys/dev/serial/sio/sio.c,v 1.33 2006/09/05 00:55:42 dillon Exp $ * from: @(#)com.c 7.5 (Berkeley) 5/16/91 * from: i386/isa sio.c,v 1.234 */ @@ -614,7 +614,7 @@ sioprobe(dev, xrid, rclk) NULL) == 0) outb(xioport + com_mcr, 0); } - free(devs, M_TEMP); + kfree(devs, M_TEMP); already_init = TRUE; } #endif @@ -1452,7 +1452,7 @@ sioclose(struct dev_close_args *ap) printf("sio%d: gone\n", com->unit); crit_enter(); if (com->ibuf != NULL) - free(com->ibuf, M_DEVBUF); + kfree(com->ibuf, M_DEVBUF); bzero(tp, sizeof *tp); crit_exit(); } @@ -2387,7 +2387,7 @@ comparam(tp, t) crit_exit(); comstart(tp); if (com->ibufold != NULL) { - free(com->ibufold, M_DEVBUF); + kfree(com->ibufold, M_DEVBUF); com->ibufold = NULL; } return (0); @@ -2421,7 +2421,7 @@ siosetwater(com, speed) * Allocate input buffer. The extra factor of 2 in the size is * to allow for an error byte for each input byte. */ - ibuf = malloc(2 * ibufsize, M_DEVBUF, M_WAITOK | M_ZERO); + ibuf = kmalloc(2 * ibufsize, M_DEVBUF, M_WAITOK | M_ZERO); /* Initialize non-critical variables. */ com->ibufold = com->ibuf; diff --git a/sys/dev/serial/sio/sio_pccard.c b/sys/dev/serial/sio/sio_pccard.c index 8d5b1fe7ce..d0a186b839 100644 --- a/sys/dev/serial/sio/sio_pccard.c +++ b/sys/dev/serial/sio/sio_pccard.c @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/dev/serial/sio/sio_pccard.c,v 1.3 2004/05/31 20:48:41 eirikn Exp $ + * $DragonFly: src/sys/dev/serial/sio/sio_pccard.c,v 1.4 2006/09/05 00:55:42 dillon Exp $ */ #include #include @@ -147,7 +147,7 @@ sio_pccard_detach(dev) ttwwakeup(com->tp); } else { if (com->ibuf != NULL) - free(com->ibuf, M_DEVBUF); + kfree(com->ibuf, M_DEVBUF); } device_printf(dev, "unloaded\n"); return (0); diff --git a/sys/dev/serial/stl/stallion.c b/sys/dev/serial/stl/stallion.c index 8dd882bc08..7a6c953f20 100644 --- a/sys/dev/serial/stl/stallion.c +++ b/sys/dev/serial/stl/stallion.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/isa/stallion.c,v 1.39.2.2 2001/08/30 12:29:57 murray Exp $ - * $DragonFly: src/sys/dev/serial/stl/stallion.c,v 1.19 2006/08/03 16:40:47 swildner Exp $ + * $DragonFly: src/sys/dev/serial/stl/stallion.c,v 1.20 2006/09/05 00:55:42 dillon Exp $ */ /*****************************************************************************/ @@ -846,7 +846,7 @@ static int stlattach(struct isa_device *idp) /* idp->id_intr = (inthand2_t *)stlintr; */ - brdp = malloc(sizeof(stlbrd_t), M_TTYS, M_WAITOK | M_ZERO); + brdp = kmalloc(sizeof(stlbrd_t), M_TTYS, M_WAITOK | M_ZERO); if ((brdp->brdnr = stl_findfreeunit()) < 0) { printf("STALLION: too many boards found, max=%d\n", @@ -1017,7 +1017,7 @@ void stlpciattach(pcici_t tag, int unit) printf("stlpciattach(tag=%x,unit=%x)\n", (int) &tag, unit); #endif - brdp = malloc(sizeof(stlbrd_t), M_TTYS, M_WAITOK | M_ZERO); + brdp = kmalloc(sizeof(stlbrd_t), M_TTYS, M_WAITOK | M_ZERO); if ((unit < 0) || (unit > STL_MAXBRDS)) { printf("STALLION: bad PCI board unit number=%d\n", unit); @@ -2202,7 +2202,7 @@ static int stl_initports(stlbrd_t *brdp, stlpanel_t *panelp) * UART port. */ for (i = 0; (i < panelp->nrports); i++) { - portp = malloc(sizeof(stlport_t), M_TTYS, M_WAITOK | M_ZERO); + portp = kmalloc(sizeof(stlport_t), M_TTYS, M_WAITOK | M_ZERO); portp->portnr = i; portp->brdnr = panelp->brdnr; @@ -2212,7 +2212,7 @@ static int stl_initports(stlbrd_t *brdp, stlpanel_t *panelp) panelp->ports[i] = portp; j = STL_TXBUFSIZE + (2 * STL_RXBUFSIZE); - portp->tx.buf = malloc(j, M_TTYS, M_WAITOK); + portp->tx.buf = kmalloc(j, M_TTYS, M_WAITOK); portp->tx.endbuf = portp->tx.buf + STL_TXBUFSIZE; portp->tx.head = portp->tx.buf; portp->tx.tail = portp->tx.buf; @@ -2314,7 +2314,7 @@ static int stl_initeio(stlbrd_t *brdp) ((brdp->irqtype) ? EIO_INTLEVEL : EIO_INTEDGE))); } - panelp = malloc(sizeof(stlpanel_t), M_TTYS, M_WAITOK | M_ZERO); + panelp = kmalloc(sizeof(stlpanel_t), M_TTYS, M_WAITOK | M_ZERO); panelp->brdnr = brdp->brdnr; panelp->panelnr = 0; panelp->nrports = brdp->nrports; @@ -2436,7 +2436,7 @@ static int stl_initech(stlbrd_t *brdp) status = inb(ioaddr + ECH_PNLSTATUS); if ((status & ECH_PNLIDMASK) != nxtid) break; - panelp = malloc(sizeof(stlpanel_t), M_TTYS, M_WAITOK | M_ZERO); + panelp = kmalloc(sizeof(stlpanel_t), M_TTYS, M_WAITOK | M_ZERO); panelp->brdnr = brdp->brdnr; panelp->panelnr = panelnr; panelp->iobase = ioaddr; diff --git a/sys/dev/serial/stli/istallion.c b/sys/dev/serial/stli/istallion.c index 845775bc6a..cbeb94001b 100644 --- a/sys/dev/serial/stli/istallion.c +++ b/sys/dev/serial/stli/istallion.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/isa/istallion.c,v 1.36.2.2 2001/08/30 12:29:57 murray Exp $ - * $DragonFly: src/sys/dev/serial/stli/istallion.c,v 1.18 2006/08/03 16:40:47 swildner Exp $ + * $DragonFly: src/sys/dev/serial/stli/istallion.c,v 1.19 2006/09/05 00:55:43 dillon Exp $ */ /*****************************************************************************/ @@ -650,7 +650,7 @@ static stlibrd_t *stli_brdalloc(void) { stlibrd_t *brdp; - brdp = malloc(sizeof(stlibrd_t), M_TTYS, M_WAITOK | M_ZERO); + brdp = kmalloc(sizeof(stlibrd_t), M_TTYS, M_WAITOK | M_ZERO); return(brdp); } @@ -2472,7 +2472,7 @@ static int stli_initports(stlibrd_t *brdp) #endif for (i = 0, panelnr = 0, panelport = 0; (i < brdp->nrports); i++) { - portp = malloc(sizeof(stliport_t), M_TTYS, M_WAITOK | M_ZERO); + portp = kmalloc(sizeof(stliport_t), M_TTYS, M_WAITOK | M_ZERO); callout_init(&portp->dtr_ch); portp->portnr = i; portp->brdnr = brdp->brdnr; diff --git a/sys/dev/sound/isa/ad1816.c b/sys/dev/sound/isa/ad1816.c index 7284582c60..8c7d2a37b2 100644 --- a/sys/dev/sound/isa/ad1816.c +++ b/sys/dev/sound/isa/ad1816.c @@ -26,7 +26,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/sound/isa/ad1816.c,v 1.7.2.9 2002/12/24 21:17:41 semenu Exp $ - * $DragonFly: src/sys/dev/sound/isa/ad1816.c,v 1.3 2005/05/24 20:59:04 dillon Exp $ + * $DragonFly: src/sys/dev/sound/isa/ad1816.c,v 1.4 2006/09/05 00:55:43 dillon Exp $ */ #include @@ -34,7 +34,7 @@ #include "mixer_if.h" -SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/isa/ad1816.c,v 1.3 2005/05/24 20:59:04 dillon Exp $"); +SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/isa/ad1816.c,v 1.4 2006/09/05 00:55:43 dillon Exp $"); struct ad1816_info; @@ -507,7 +507,7 @@ ad1816_release_resources(struct ad1816_info *ad1816, device_t dev) if (ad1816->lock) snd_mtxfree(ad1816->lock); - free(ad1816, M_DEVBUF); + kfree(ad1816, M_DEVBUF); } static int @@ -588,7 +588,7 @@ ad1816_attach(device_t dev) struct ad1816_info *ad1816; char status[SND_STATUSLEN], status2[SND_STATUSLEN]; - ad1816 = (struct ad1816_info *)malloc(sizeof *ad1816, M_DEVBUF, M_NOWAIT | M_ZERO); + ad1816 = (struct ad1816_info *)kmalloc(sizeof *ad1816, M_DEVBUF, M_NOWAIT | M_ZERO); if (!ad1816) return ENXIO; ad1816->lock = snd_mtxcreate(device_get_nameunit(dev), "sound softc"); diff --git a/sys/dev/sound/isa/ess.c b/sys/dev/sound/isa/ess.c index 0f40d64185..a5c5f4e252 100644 --- a/sys/dev/sound/isa/ess.c +++ b/sys/dev/sound/isa/ess.c @@ -29,7 +29,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/sound/isa/ess.c,v 1.3.2.8 2002/12/24 21:17:41 semenu Exp $ - * $DragonFly: src/sys/dev/sound/isa/ess.c,v 1.3 2005/05/24 20:59:04 dillon Exp $ + * $DragonFly: src/sys/dev/sound/isa/ess.c,v 1.4 2006/09/05 00:55:43 dillon Exp $ */ #include @@ -39,7 +39,7 @@ #include "mixer_if.h" -SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/isa/ess.c,v 1.3 2005/05/24 20:59:04 dillon Exp $"); +SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/isa/ess.c,v 1.4 2006/09/05 00:55:43 dillon Exp $"); #define ESS_BUFFSIZE (4096) #define ABS(x) (((x) < 0)? -(x) : (x)) @@ -307,7 +307,7 @@ ess_release_resources(struct ess_info *sc, device_t dev) bus_dma_tag_destroy(sc->parent_dmat); sc->parent_dmat = 0; } - free(sc, M_DEVBUF); + kfree(sc, M_DEVBUF); } static int @@ -807,7 +807,7 @@ ess_attach(device_t dev) char status[SND_STATUSLEN], buf[64]; int ver; - sc = (struct ess_info *)malloc(sizeof *sc, M_DEVBUF, M_NOWAIT | M_ZERO); + sc = (struct ess_info *)kmalloc(sizeof *sc, M_DEVBUF, M_NOWAIT | M_ZERO); if (!sc) return ENXIO; diff --git a/sys/dev/sound/isa/gusc.c b/sys/dev/sound/isa/gusc.c index fe6edd5ce9..df8fe9db00 100644 --- a/sys/dev/sound/isa/gusc.c +++ b/sys/dev/sound/isa/gusc.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/sound/isa/gusc.c,v 1.5.2.6 2002/04/22 15:49:30 cg Exp $ - * $DragonFly: src/sys/dev/sound/isa/gusc.c,v 1.7 2006/08/25 22:37:08 swildner Exp $ + * $DragonFly: src/sys/dev/sound/isa/gusc.c,v 1.8 2006/09/05 00:55:43 dillon Exp $ */ #include @@ -45,7 +45,7 @@ #include #include -SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/isa/gusc.c,v 1.7 2006/08/25 22:37:08 swildner Exp $"); +SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/isa/gusc.c,v 1.8 2006/09/05 00:55:43 dillon Exp $"); #define LOGICALID_NOPNP 0 #define LOGICALID_PCM 0x0000561e @@ -123,7 +123,7 @@ gusc_probe(device_t dev) switch (logical_id) { case LOGICALID_PCM: s = "Gravis UltraSound Plug & Play PCM"; - func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT | M_ZERO); + func = kmalloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT | M_ZERO); if (func == NULL) return (ENOMEM); func->func = SCF_PCM; @@ -132,7 +132,7 @@ gusc_probe(device_t dev) break; case LOGICALID_OPL: s = "Gravis UltraSound Plug & Play OPL"; - func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT | M_ZERO); + func = kmalloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT | M_ZERO); if (func == NULL) return (ENOMEM); func->func = SCF_SYNTH; @@ -141,7 +141,7 @@ gusc_probe(device_t dev) break; case LOGICALID_MIDI: s = "Gravis UltraSound Plug & Play MIDI"; - func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT | M_ZERO); + func = kmalloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT | M_ZERO); if (func == NULL) return (ENOMEM); func->func = SCF_MIDI; @@ -269,14 +269,14 @@ gusisa_probe(device_t dev) /* We can support the CS4231 and MIDI devices. */ - func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT | M_ZERO); + func = kmalloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT | M_ZERO); if (func == NULL) return ENOMEM; func->func = SCF_MIDI; child = device_add_child(dev, "midi", -1); device_set_ivars(child, func); - func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT | M_ZERO); + func = kmalloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT | M_ZERO); if (func == NULL) printf("xxx: gus pcm not attached, out of memory\n"); else { diff --git a/sys/dev/sound/isa/mss.c b/sys/dev/sound/isa/mss.c index be079a1e35..4d29cf1801 100644 --- a/sys/dev/sound/isa/mss.c +++ b/sys/dev/sound/isa/mss.c @@ -27,12 +27,12 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/sound/isa/mss.c,v 1.48.2.11 2002/12/24 21:17:41 semenu Exp $ - * $DragonFly: src/sys/dev/sound/isa/mss.c,v 1.6 2005/09/01 00:18:24 swildner Exp $ + * $DragonFly: src/sys/dev/sound/isa/mss.c,v 1.7 2006/09/05 00:55:43 dillon Exp $ */ #include -SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/isa/mss.c,v 1.6 2005/09/01 00:18:24 swildner Exp $"); +SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/isa/mss.c,v 1.7 2006/09/05 00:55:43 dillon Exp $"); /* board-specific include files */ #include @@ -307,7 +307,7 @@ mss_release_resources(struct mss_info *mss, device_t dev) } if (mss->lock) snd_mtxfree(mss->lock); - free(mss, M_DEVBUF); + kfree(mss, M_DEVBUF); } static int @@ -1252,7 +1252,7 @@ mss_probe(device_t dev) if (isa_get_logicalid(dev)) return ENXIO; /* not yet */ - mss = (struct mss_info *)malloc(sizeof *mss, M_DEVBUF, M_NOWAIT | M_ZERO); + mss = (struct mss_info *)kmalloc(sizeof *mss, M_DEVBUF, M_NOWAIT | M_ZERO); if (!mss) return ENXIO; mss->io_rid = 0; @@ -1752,7 +1752,7 @@ mss_attach(device_t dev) struct mss_info *mss; int flags = device_get_flags(dev); - mss = (struct mss_info *)malloc(sizeof *mss, M_DEVBUF, M_NOWAIT | M_ZERO); + mss = (struct mss_info *)kmalloc(sizeof *mss, M_DEVBUF, M_NOWAIT | M_ZERO); if (!mss) return ENXIO; mss->io_rid = 0; @@ -1926,7 +1926,7 @@ pnpmss_attach(device_t dev) { struct mss_info *mss; - mss = (struct mss_info *)malloc(sizeof *mss, M_DEVBUF, M_NOWAIT | M_ZERO); + mss = (struct mss_info *)kmalloc(sizeof *mss, M_DEVBUF, M_NOWAIT | M_ZERO); if (!mss) return ENXIO; @@ -2190,7 +2190,7 @@ guspcm_attach(device_t dev) int base, flags; unsigned char ctl; - mss = (struct mss_info *)malloc(sizeof *mss, M_DEVBUF, M_NOWAIT | M_ZERO); + mss = (struct mss_info *)kmalloc(sizeof *mss, M_DEVBUF, M_NOWAIT | M_ZERO); if (mss == NULL) return ENOMEM; diff --git a/sys/dev/sound/isa/sb16.c b/sys/dev/sound/isa/sb16.c index 413a611b19..e43263ba15 100644 --- a/sys/dev/sound/isa/sb16.c +++ b/sys/dev/sound/isa/sb16.c @@ -29,7 +29,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/sound/isa/sb16.c,v 1.64.2.7 2002/12/24 21:17:42 semenu Exp $ - * $DragonFly: src/sys/dev/sound/isa/sb16.c,v 1.4 2005/05/24 20:59:04 dillon Exp $ + * $DragonFly: src/sys/dev/sound/isa/sb16.c,v 1.5 2006/09/05 00:55:43 dillon Exp $ */ #include @@ -39,7 +39,7 @@ #include "mixer_if.h" -SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/isa/sb16.c,v 1.4 2005/05/24 20:59:04 dillon Exp $"); +SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/isa/sb16.c,v 1.5 2006/09/05 00:55:43 dillon Exp $"); #define SB16_BUFFSIZE 4096 #define PLAIN_SB16(x) ((((x)->bd_flags) & (BD_F_SB16|BD_F_SB16X)) == BD_F_SB16) @@ -431,7 +431,7 @@ sb16_release_resources(struct sb_info *sb, device_t dev) bus_dma_tag_destroy(sb->parent_dmat); sb->parent_dmat = 0; } - free(sb, M_DEVBUF); + kfree(sb, M_DEVBUF); } static int @@ -784,7 +784,7 @@ sb16_attach(device_t dev) uintptr_t ver; char status[SND_STATUSLEN], status2[SND_STATUSLEN]; - sb = (struct sb_info *)malloc(sizeof *sb, M_DEVBUF, M_NOWAIT | M_ZERO); + sb = (struct sb_info *)kmalloc(sizeof *sb, M_DEVBUF, M_NOWAIT | M_ZERO); if (!sb) return ENXIO; diff --git a/sys/dev/sound/isa/sb8.c b/sys/dev/sound/isa/sb8.c index ccfeb9f084..1ec158e925 100644 --- a/sys/dev/sound/isa/sb8.c +++ b/sys/dev/sound/isa/sb8.c @@ -29,7 +29,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/sound/isa/sb8.c,v 1.62.2.5 2002/12/24 21:17:42 semenu Exp $ - * $DragonFly: src/sys/dev/sound/isa/sb8.c,v 1.3 2005/05/24 20:59:04 dillon Exp $ + * $DragonFly: src/sys/dev/sound/isa/sb8.c,v 1.4 2006/09/05 00:55:43 dillon Exp $ */ #include @@ -39,7 +39,7 @@ #include "mixer_if.h" -SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/isa/sb8.c,v 1.3 2005/05/24 20:59:04 dillon Exp $"); +SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/isa/sb8.c,v 1.4 2006/09/05 00:55:43 dillon Exp $"); #define SB_DEFAULT_BUFSZ 4096 @@ -277,7 +277,7 @@ sb_release_resources(struct sb_info *sb, device_t dev) bus_dma_tag_destroy(sb->parent_dmat); sb->parent_dmat = 0; } - free(sb, M_DEVBUF); + kfree(sb, M_DEVBUF); } static int @@ -698,7 +698,7 @@ sb_attach(device_t dev) char status[SND_STATUSLEN]; uintptr_t ver; - sb = (struct sb_info *)malloc(sizeof *sb, M_DEVBUF, M_NOWAIT | M_ZERO); + sb = (struct sb_info *)kmalloc(sizeof *sb, M_DEVBUF, M_NOWAIT | M_ZERO); if (!sb) return ENXIO; diff --git a/sys/dev/sound/isa/sbc.c b/sys/dev/sound/isa/sbc.c index cf19a1eed5..8bd5339f4b 100644 --- a/sys/dev/sound/isa/sbc.c +++ b/sys/dev/sound/isa/sbc.c @@ -24,14 +24,14 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/sound/isa/sbc.c,v 1.19.2.12 2002/12/24 21:17:42 semenu Exp $ - * $DragonFly: src/sys/dev/sound/isa/sbc.c,v 1.6 2005/09/01 00:40:51 swildner Exp $ + * $DragonFly: src/sys/dev/sound/isa/sbc.c,v 1.7 2006/09/05 00:55:43 dillon Exp $ */ #include #include #include -SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/isa/sbc.c,v 1.6 2005/09/01 00:40:51 swildner Exp $"); +SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/isa/sbc.c,v 1.7 2006/09/05 00:55:43 dillon Exp $"); #define IO_MAX 3 #define IRQ_MAX 1 @@ -397,21 +397,21 @@ sbc_attach(device_t dev) } /* PCM Audio */ - func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT | M_ZERO); + func = kmalloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT | M_ZERO); if (func == NULL) goto bad; func->func = SCF_PCM; scp->child_pcm = device_add_child(dev, "pcm", -1); device_set_ivars(scp->child_pcm, func); /* Midi Interface */ - func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT | M_ZERO); + func = kmalloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT | M_ZERO); if (func == NULL) goto bad; func->func = SCF_MIDI; scp->child_midi1 = device_add_child(dev, "midi", -1); device_set_ivars(scp->child_midi1, func); /* OPL FM Synthesizer */ - func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT | M_ZERO); + func = kmalloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT | M_ZERO); if (func == NULL) goto bad; func->func = SCF_SYNTH; scp->child_midi2 = device_add_child(dev, "midi", -1); diff --git a/sys/dev/sound/pci/als4000.c b/sys/dev/sound/pci/als4000.c index 237685ed0e..edeae743cf 100644 --- a/sys/dev/sound/pci/als4000.c +++ b/sys/dev/sound/pci/als4000.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/sound/pci/als4000.c,v 1.2.2.5 2002/04/22 15:49:31 cg Exp $ - * $DragonFly: src/sys/dev/sound/pci/als4000.c,v 1.6 2005/10/12 17:35:55 dillon Exp $ + * $DragonFly: src/sys/dev/sound/pci/als4000.c,v 1.7 2006/09/05 00:55:43 dillon Exp $ */ /* @@ -45,7 +45,7 @@ #include "mixer_if.h" -SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pci/als4000.c,v 1.6 2005/10/12 17:35:55 dillon Exp $"); +SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pci/als4000.c,v 1.7 2006/09/05 00:55:43 dillon Exp $"); /* Debugging macro's */ #undef DEB @@ -764,7 +764,7 @@ als_pci_attach(device_t dev) u_int32_t data; char status[SND_STATUSLEN]; - if ((sc = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) { + if ((sc = kmalloc(sizeof(*sc), M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) { device_printf(dev, "cannot allocate softc\n"); return ENXIO; } @@ -826,7 +826,7 @@ als_pci_attach(device_t dev) bad_attach: als_resource_free(dev, sc); - free(sc, M_DEVBUF); + kfree(sc, M_DEVBUF); return ENXIO; } @@ -843,7 +843,7 @@ als_pci_detach(device_t dev) sc = pcm_getdevinfo(dev); als_uninit(sc); als_resource_free(dev, sc); - free(sc, M_DEVBUF); + kfree(sc, M_DEVBUF); return 0; } diff --git a/sys/dev/sound/pci/aureal.c b/sys/dev/sound/pci/aureal.c index f1a60593af..d5e76d522f 100644 --- a/sys/dev/sound/pci/aureal.c +++ b/sys/dev/sound/pci/aureal.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/sound/pci/aureal.c,v 1.8.2.7 2002/04/22 15:49:31 cg Exp $ - * $DragonFly: src/sys/dev/sound/pci/aureal.c,v 1.6 2005/05/24 20:59:04 dillon Exp $ + * $DragonFly: src/sys/dev/sound/pci/aureal.c,v 1.7 2006/09/05 00:55:43 dillon Exp $ */ #include @@ -34,7 +34,7 @@ #include #include -SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pci/aureal.c,v 1.6 2005/05/24 20:59:04 dillon Exp $"); +SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pci/aureal.c,v 1.7 2006/09/05 00:55:43 dillon Exp $"); /* PCI IDs of supported chips */ #define AU8820_PCI_ID 0x000112eb @@ -560,7 +560,7 @@ au_pci_attach(device_t dev) struct ac97_info *codec; char status[SND_STATUSLEN]; - if ((au = malloc(sizeof(*au), M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) { + if ((au = kmalloc(sizeof(*au), M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) { device_printf(dev, "cannot allocate softc\n"); return ENXIO; } @@ -613,7 +613,7 @@ au_pci_attach(device_t dev) #if 0 if (j < config_id->nummaps) { printf("pcm%d: unable to map a required resource\n", unit); - free(au, M_DEVBUF); + kfree(au, M_DEVBUF); return; } #endif @@ -661,7 +661,7 @@ au_pci_attach(device_t dev) return 0; bad: - if (au) free(au, M_DEVBUF); + if (au) kfree(au, M_DEVBUF); for (i = 0; i < j; i++) bus_release_resource(dev, type[i], regid[i], reg[i]); if (ih) bus_teardown_intr(dev, irq, ih); diff --git a/sys/dev/sound/pci/cmi.c b/sys/dev/sound/pci/cmi.c index 83271eccce..39da88f596 100644 --- a/sys/dev/sound/pci/cmi.c +++ b/sys/dev/sound/pci/cmi.c @@ -40,7 +40,7 @@ * those that don't. * * $FreeBSD: src/sys/dev/sound/pci/cmi.c,v 1.1.2.8 2002/08/27 00:17:34 orion Exp $ - * $DragonFly: src/sys/dev/sound/pci/cmi.c,v 1.5 2005/05/24 20:59:04 dillon Exp $ + * $DragonFly: src/sys/dev/sound/pci/cmi.c,v 1.6 2006/09/05 00:55:43 dillon Exp $ */ #include @@ -54,7 +54,7 @@ #include "mixer_if.h" -SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pci/cmi.c,v 1.5 2005/05/24 20:59:04 dillon Exp $"); +SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pci/cmi.c,v 1.6 2006/09/05 00:55:43 dillon Exp $"); /* Supported chip ID's */ #define CMI8338A_PCI_ID 0x010013f6 @@ -839,7 +839,7 @@ cmi_attach(device_t dev) char status[SND_STATUSLEN]; d = device_get_softc(dev); - sc = malloc(sizeof(struct sc_info), M_DEVBUF, M_NOWAIT | M_ZERO); + sc = kmalloc(sizeof(struct sc_info), M_DEVBUF, M_NOWAIT | M_ZERO); if (sc == NULL) { device_printf(dev, "cannot allocate softc\n"); return ENXIO; @@ -918,7 +918,7 @@ cmi_attach(device_t dev) if (sc->lock) snd_mtxfree(sc->lock); if (sc) - free(sc, M_DEVBUF); + kfree(sc, M_DEVBUF); return ENXIO; } @@ -941,7 +941,7 @@ cmi_detach(device_t dev) bus_release_resource(dev, SYS_RES_IRQ, sc->irqid, sc->irq); bus_release_resource(dev, SYS_RES_IOPORT, sc->regid, sc->reg); snd_mtxfree(sc->lock); - free(sc, M_DEVBUF); + kfree(sc, M_DEVBUF); return 0; } diff --git a/sys/dev/sound/pci/cs4281.c b/sys/dev/sound/pci/cs4281.c index 2dd85854fc..6f67f01fa4 100644 --- a/sys/dev/sound/pci/cs4281.c +++ b/sys/dev/sound/pci/cs4281.c @@ -29,7 +29,7 @@ * contributed towards power management. * * $FreeBSD: src/sys/dev/sound/pci/cs4281.c,v 1.2.2.8 2002/08/27 00:25:55 orion Exp $ - * $DragonFly: src/sys/dev/sound/pci/cs4281.c,v 1.6 2005/05/24 20:59:04 dillon Exp $ + * $DragonFly: src/sys/dev/sound/pci/cs4281.c,v 1.7 2006/09/05 00:55:43 dillon Exp $ */ #include @@ -40,7 +40,7 @@ #include -SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pci/cs4281.c,v 1.6 2005/05/24 20:59:04 dillon Exp $"); +SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pci/cs4281.c,v 1.7 2006/09/05 00:55:43 dillon Exp $"); #define CS4281_DEFAULT_BUFSZ 16384 @@ -756,7 +756,7 @@ cs4281_pci_attach(device_t dev) u_int32_t data; char status[SND_STATUSLEN]; - if ((sc = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) { + if ((sc = kmalloc(sizeof(*sc), M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) { device_printf(dev, "cannot allocate softc\n"); return ENXIO; } @@ -880,7 +880,7 @@ cs4281_pci_attach(device_t dev) bus_release_resource(dev, SYS_RES_IRQ, sc->irqid, sc->irq); if (sc->parent_dmat) bus_dma_tag_destroy(sc->parent_dmat); - free(sc, M_DEVBUF); + kfree(sc, M_DEVBUF); return ENXIO; } @@ -905,7 +905,7 @@ cs4281_pci_detach(device_t dev) bus_teardown_intr(dev, sc->irq, sc->ih); bus_release_resource(dev, SYS_RES_IRQ, sc->irqid, sc->irq); bus_dma_tag_destroy(sc->parent_dmat); - free(sc, M_DEVBUF); + kfree(sc, M_DEVBUF); return 0; } diff --git a/sys/dev/sound/pci/csa.c b/sys/dev/sound/pci/csa.c index 34dc98604c..06f7b89bb2 100644 --- a/sys/dev/sound/pci/csa.c +++ b/sys/dev/sound/pci/csa.c @@ -28,7 +28,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/sound/pci/csa.c,v 1.8.2.12 2002/10/05 19:53:18 orion Exp $ - * $DragonFly: src/sys/dev/sound/pci/csa.c,v 1.4 2005/05/24 20:59:04 dillon Exp $ + * $DragonFly: src/sys/dev/sound/pci/csa.c,v 1.5 2006/09/05 00:55:43 dillon Exp $ */ #include @@ -51,7 +51,7 @@ #include "gnu/csaimg.h" -SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pci/csa.c,v 1.4 2005/05/24 20:59:04 dillon Exp $"); +SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pci/csa.c,v 1.5 2006/09/05 00:55:43 dillon Exp $"); /* This is the pci device id. */ #define CS4610_PCI_ID 0x60011013 @@ -136,15 +136,15 @@ clkrun_hack(int run) control &= ~0x2000; control |= run? 0 : 0x2000; bus_space_write_2(btag, 0x0, port, control); - free(pci_devices, M_TEMP); - free(pci_children, M_TEMP); + kfree(pci_devices, M_TEMP); + kfree(pci_children, M_TEMP); return 0; } } - free(pci_children, M_TEMP); + kfree(pci_children, M_TEMP); } - free(pci_devices, M_TEMP); + kfree(pci_devices, M_TEMP); return ENXIO; #else return 0; @@ -297,7 +297,7 @@ csa_attach(device_t dev) /* Attach the children. */ /* PCM Audio */ - func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT | M_ZERO); + func = kmalloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT | M_ZERO); if (func == NULL) { error = ENOMEM; goto err_teardown; @@ -308,7 +308,7 @@ csa_attach(device_t dev) device_set_ivars(scp->pcm, func); /* Midi Interface */ - func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT | M_ZERO); + func = kmalloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT | M_ZERO); if (func == NULL) { error = ENOMEM; goto err_teardown; diff --git a/sys/dev/sound/pci/csapcm.c b/sys/dev/sound/pci/csapcm.c index 0b8a25d81d..840deb6ff6 100644 --- a/sys/dev/sound/pci/csapcm.c +++ b/sys/dev/sound/pci/csapcm.c @@ -28,7 +28,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/sound/pci/csapcm.c,v 1.8.2.7 2002/04/22 15:49:32 cg Exp $ - * $DragonFly: src/sys/dev/sound/pci/csapcm.c,v 1.4 2005/05/24 20:59:04 dillon Exp $ + * $DragonFly: src/sys/dev/sound/pci/csapcm.c,v 1.5 2006/09/05 00:55:43 dillon Exp $ */ #include @@ -41,7 +41,7 @@ #include #include -SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pci/csapcm.c,v 1.4 2005/05/24 20:59:04 dillon Exp $"); +SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pci/csapcm.c,v 1.5 2006/09/05 00:55:43 dillon Exp $"); /* Buffer size on dma transfer. Fixed for CS416x. */ #define CS461x_BUFFSIZE (4 * 1024) @@ -714,7 +714,7 @@ csa_releaseres(struct csa_info *csa, device_t dev) csa->parent_dmat = NULL; } if (csa != NULL) { - free(csa, M_DEVBUF); + kfree(csa, M_DEVBUF); csa = NULL; } } @@ -747,7 +747,7 @@ pcmcsa_attach(device_t dev) struct ac97_info *codec; struct sndcard_func *func; - csa = malloc(sizeof(*csa), M_DEVBUF, M_NOWAIT | M_ZERO); + csa = kmalloc(sizeof(*csa), M_DEVBUF, M_NOWAIT | M_ZERO); if (csa == NULL) return (ENOMEM); unit = device_get_unit(dev); diff --git a/sys/dev/sound/pci/ds1.c b/sys/dev/sound/pci/ds1.c index 543af99ae1..770b8cc629 100644 --- a/sys/dev/sound/pci/ds1.c +++ b/sys/dev/sound/pci/ds1.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/sound/pci/ds1.c,v 1.8.2.9 2003/04/28 03:59:03 simokawa Exp $ - * $DragonFly: src/sys/dev/sound/pci/ds1.c,v 1.4 2005/05/24 20:59:04 dillon Exp $ + * $DragonFly: src/sys/dev/sound/pci/ds1.c,v 1.5 2006/09/05 00:55:43 dillon Exp $ */ #include @@ -36,7 +36,7 @@ #include #include -SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pci/ds1.c,v 1.4 2005/05/24 20:59:04 dillon Exp $"); +SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pci/ds1.c,v 1.5 2006/09/05 00:55:43 dillon Exp $"); /* -------------------------------------------------------------------- */ @@ -937,7 +937,7 @@ ds_pci_attach(device_t dev) struct ac97_info *codec = NULL; char status[SND_STATUSLEN]; - if ((sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO)) == NULL) { + if ((sc = kmalloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO)) == NULL) { device_printf(dev, "cannot allocate softc\n"); return ENXIO; } @@ -1023,7 +1023,7 @@ bad: bus_dma_tag_destroy(sc->control_dmat); if (sc->lock) snd_mtxfree(sc->lock); - free(sc, M_DEVBUF); + kfree(sc, M_DEVBUF); return ENXIO; } @@ -1063,7 +1063,7 @@ ds_pci_detach(device_t dev) bus_dma_tag_destroy(sc->buffer_dmat); bus_dma_tag_destroy(sc->control_dmat); snd_mtxfree(sc->lock); - free(sc, M_DEVBUF); + kfree(sc, M_DEVBUF); return 0; } diff --git a/sys/dev/sound/pci/emu10k1.c b/sys/dev/sound/pci/emu10k1.c index 8d53812540..34ff991012 100644 --- a/sys/dev/sound/pci/emu10k1.c +++ b/sys/dev/sound/pci/emu10k1.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/sound/pci/emu10k1.c,v 1.6.2.9 2002/04/22 15:49:32 cg Exp $ - * $DragonFly: src/sys/dev/sound/pci/emu10k1.c,v 1.8 2005/05/24 20:59:04 dillon Exp $ + * $DragonFly: src/sys/dev/sound/pci/emu10k1.c,v 1.9 2006/09/05 00:55:43 dillon Exp $ */ #include @@ -35,7 +35,7 @@ #include #include -SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pci/emu10k1.c,v 1.8 2005/05/24 20:59:04 dillon Exp $"); +SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pci/emu10k1.c,v 1.9 2006/09/05 00:55:43 dillon Exp $"); /* -------------------------------------------------------------------- */ @@ -1146,12 +1146,12 @@ emu_memalloc(struct sc_info *sc, u_int32_t sz) } if (!found) return NULL; - blk = malloc(sizeof(*blk), M_DEVBUF, M_NOWAIT); + blk = kmalloc(sizeof(*blk), M_DEVBUF, M_NOWAIT); if (blk == NULL) return NULL; buf = emu_malloc(sc, sz); if (buf == NULL) { - free(blk, M_DEVBUF); + kfree(blk, M_DEVBUF); return NULL; } blk->buf = buf; @@ -1191,7 +1191,7 @@ emu_memfree(struct sc_info *sc, void *buf) mem->bmap[idx >> 3] &= ~(1 << (idx & 7)); mem->ptb_pages[idx] = tmp | idx; } - free(blk, M_DEVBUF); + kfree(blk, M_DEVBUF); return 0; } @@ -1834,7 +1834,7 @@ emu_pci_attach(device_t dev) int i, gotmic; char status[SND_STATUSLEN]; - if ((sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO)) == NULL) { + if ((sc = kmalloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO)) == NULL) { device_printf(dev, "cannot allocate softc\n"); return ENXIO; } @@ -1910,7 +1910,7 @@ bad: if (sc->irq) bus_release_resource(dev, SYS_RES_IRQ, 0, sc->irq); if (sc->parent_dmat) bus_dma_tag_destroy(sc->parent_dmat); if (sc->lock) snd_mtxfree(sc->lock); - free(sc, M_DEVBUF); + kfree(sc, M_DEVBUF); return ENXIO; } @@ -1933,7 +1933,7 @@ emu_pci_detach(device_t dev) bus_release_resource(dev, SYS_RES_IRQ, 0, sc->irq); bus_dma_tag_destroy(sc->parent_dmat); snd_mtxfree(sc->lock); - free(sc, M_DEVBUF); + kfree(sc, M_DEVBUF); return 0; } diff --git a/sys/dev/sound/pci/es137x.c b/sys/dev/sound/pci/es137x.c index 90e56ee387..9be4a6aeca 100644 --- a/sys/dev/sound/pci/es137x.c +++ b/sys/dev/sound/pci/es137x.c @@ -39,7 +39,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/sound/pci/es137x.c,v 1.13.2.10 2002/05/07 17:02:25 greid Exp $ - * $DragonFly: src/sys/dev/sound/pci/es137x.c,v 1.5 2005/06/10 23:06:59 dillon Exp $ + * $DragonFly: src/sys/dev/sound/pci/es137x.c,v 1.6 2006/09/05 00:55:43 dillon Exp $ */ /* @@ -62,7 +62,7 @@ #include "mixer_if.h" -SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pci/es137x.c,v 1.5 2005/06/10 23:06:59 dillon Exp $"); +SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pci/es137x.c,v 1.6 2006/09/05 00:55:43 dillon Exp $"); static int debug = 0; SYSCTL_INT(_debug, OID_AUTO, es_debug, CTLFLAG_RW, &debug, 0, ""); @@ -827,7 +827,7 @@ es_pci_attach(device_t dev) struct ac97_info *codec = 0; kobj_class_t ct = NULL; - if ((es = malloc(sizeof *es, M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) { + if ((es = kmalloc(sizeof *es, M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) { device_printf(dev, "cannot allocate softc\n"); return ENXIO; } @@ -925,7 +925,7 @@ es_pci_attach(device_t dev) if (es->ih) bus_teardown_intr(dev, es->irq, es->ih); if (es->irq) bus_release_resource(dev, SYS_RES_IRQ, es->irqid, es->irq); if (es->parent_dmat) bus_dma_tag_destroy(es->parent_dmat); - if (es) free(es, M_DEVBUF); + if (es) kfree(es, M_DEVBUF); return ENXIO; } @@ -944,7 +944,7 @@ es_pci_detach(device_t dev) bus_teardown_intr(dev, es->irq, es->ih); bus_release_resource(dev, SYS_RES_IRQ, es->irqid, es->irq); bus_dma_tag_destroy(es->parent_dmat); - free(es, M_DEVBUF); + kfree(es, M_DEVBUF); return 0; } diff --git a/sys/dev/sound/pci/fm801.c b/sys/dev/sound/pci/fm801.c index 96e364fc12..8b3dd60506 100644 --- a/sys/dev/sound/pci/fm801.c +++ b/sys/dev/sound/pci/fm801.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/sound/pci/fm801.c,v 1.3.2.8 2002/12/24 21:17:42 semenu Exp $ - * $DragonFly: src/sys/dev/sound/pci/fm801.c,v 1.6 2005/05/24 20:59:04 dillon Exp $ + * $DragonFly: src/sys/dev/sound/pci/fm801.c,v 1.7 2006/09/05 00:55:43 dillon Exp $ */ #include @@ -32,7 +32,7 @@ #include #include -SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pci/fm801.c,v 1.6 2005/05/24 20:59:04 dillon Exp $"); +SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pci/fm801.c,v 1.7 2006/09/05 00:55:43 dillon Exp $"); #define PCI_VENDOR_FORTEMEDIA 0x1319 #define PCI_DEVICE_FORTEMEDIA1 0x08011319 @@ -577,7 +577,7 @@ fm801_pci_attach(device_t dev) int mapped = 0; char status[SND_STATUSLEN]; - if ((fm801 = (struct fm801_info *)malloc(sizeof(*fm801), M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) { + if ((fm801 = (struct fm801_info *)kmalloc(sizeof(*fm801), M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) { device_printf(dev, "cannot allocate softc\n"); return ENXIO; } @@ -661,7 +661,7 @@ oops: if (fm801->ih) bus_teardown_intr(dev, fm801->irq, fm801->ih); if (fm801->irq) bus_release_resource(dev, SYS_RES_IRQ, fm801->irqid, fm801->irq); if (fm801->parent_dmat) bus_dma_tag_destroy(fm801->parent_dmat); - free(fm801, M_DEVBUF); + kfree(fm801, M_DEVBUF); return ENXIO; } @@ -693,7 +693,7 @@ fm801_pci_detach(device_t dev) bus_teardown_intr(dev, fm801->irq, fm801->ih); bus_release_resource(dev, SYS_RES_IRQ, fm801->irqid, fm801->irq); bus_dma_tag_destroy(fm801->parent_dmat); - free(fm801, M_DEVBUF); + kfree(fm801, M_DEVBUF); return 0; } diff --git a/sys/dev/sound/pci/ich.c b/sys/dev/sound/pci/ich.c index d18045e657..3ddb6a9ed3 100644 --- a/sys/dev/sound/pci/ich.c +++ b/sys/dev/sound/pci/ich.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/sound/pci/ich.c,v 1.3.2.12 2003/01/20 03:59:42 orion Exp $ - * $DragonFly: src/sys/dev/sound/pci/ich.c,v 1.9 2005/05/24 20:59:04 dillon Exp $ + * $DragonFly: src/sys/dev/sound/pci/ich.c,v 1.10 2006/09/05 00:55:43 dillon Exp $ */ #include @@ -35,7 +35,7 @@ #include #include -SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pci/ich.c,v 1.9 2005/05/24 20:59:04 dillon Exp $"); +SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pci/ich.c,v 1.10 2006/09/05 00:55:43 dillon Exp $"); /* -------------------------------------------------------------------- */ @@ -683,7 +683,7 @@ ich_pci_attach(device_t dev) struct sc_info *sc; char status[SND_STATUSLEN]; - if ((sc = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT)) == NULL) { + if ((sc = kmalloc(sizeof(*sc), M_DEVBUF, M_NOWAIT)) == NULL) { device_printf(dev, "cannot allocate softc\n"); return ENXIO; } @@ -816,7 +816,7 @@ bad: if (sc->nabmbar) bus_release_resource(dev, sc->regtype, sc->nabmbarid, sc->nabmbar); - free(sc, M_DEVBUF); + kfree(sc, M_DEVBUF); return ENXIO; } @@ -836,7 +836,7 @@ ich_pci_detach(device_t dev) bus_release_resource(dev, sc->regtype, sc->nambarid, sc->nambar); bus_release_resource(dev, sc->regtype, sc->nabmbarid, sc->nabmbar); bus_dma_tag_destroy(sc->dmat); - free(sc, M_DEVBUF); + kfree(sc, M_DEVBUF); return 0; } diff --git a/sys/dev/sound/pci/maestro.c b/sys/dev/sound/pci/maestro.c index d51aeeaf83..0c5374a872 100644 --- a/sys/dev/sound/pci/maestro.c +++ b/sys/dev/sound/pci/maestro.c @@ -25,7 +25,7 @@ * * $Id: maestro.c,v 1.12 2000/09/06 03:32:34 taku Exp $ * $FreeBSD: src/sys/dev/sound/pci/maestro.c,v 1.2.2.5 2002/04/22 15:49:32 cg Exp $ - * $DragonFly: src/sys/dev/sound/pci/maestro.c,v 1.5 2005/06/10 23:06:59 dillon Exp $ + * $DragonFly: src/sys/dev/sound/pci/maestro.c,v 1.6 2006/09/05 00:55:43 dillon Exp $ */ /* @@ -53,7 +53,7 @@ #include -SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pci/maestro.c,v 1.5 2005/06/10 23:06:59 dillon Exp $"); +SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pci/maestro.c,v 1.6 2006/09/05 00:55:43 dillon Exp $"); #define inline __inline @@ -960,7 +960,7 @@ agg_attach(device_t dev) void *ih = NULL; char status[SND_STATUSLEN]; - if ((ess = malloc(sizeof *ess, M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) { + if ((ess = kmalloc(sizeof *ess, M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) { device_printf(dev, "cannot allocate softc\n"); return ENXIO; } @@ -1065,7 +1065,7 @@ agg_attach(device_t dev) dma_free(ess, ess->stat); if (ess->parent_dmat != NULL) bus_dma_tag_destroy(ess->parent_dmat); - free(ess, M_DEVBUF); + kfree(ess, M_DEVBUF); } return ENXIO; @@ -1094,7 +1094,7 @@ agg_detach(device_t dev) bus_release_resource(dev, SYS_RES_IRQ, ess->irqid, ess->irq); bus_release_resource(dev, SYS_RES_IOPORT, ess->regid, ess->reg); bus_dma_tag_destroy(ess->parent_dmat); - free(ess, M_DEVBUF); + kfree(ess, M_DEVBUF); return 0; } diff --git a/sys/dev/sound/pci/maestro3.c b/sys/dev/sound/pci/maestro3.c index 79b690d3d5..76d5fb2e9a 100644 --- a/sys/dev/sound/pci/maestro3.c +++ b/sys/dev/sound/pci/maestro3.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/sound/pci/maestro3.c,v 1.2.2.11 2002/09/16 19:52:33 scottl Exp $ - * $DragonFly: src/sys/dev/sound/pci/maestro3.c,v 1.6 2006/08/03 16:40:47 swildner Exp $ + * $DragonFly: src/sys/dev/sound/pci/maestro3.c,v 1.7 2006/09/05 00:55:43 dillon Exp $ */ /* @@ -64,7 +64,7 @@ #include "gnu/maestro3_reg.h" #include "gnu/maestro3_dsp.h" -SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pci/maestro3.c,v 1.6 2006/08/03 16:40:47 swildner Exp $"); +SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pci/maestro3.c,v 1.7 2006/09/05 00:55:43 dillon Exp $"); /* -------------------------------------------------------------------- */ @@ -1091,7 +1091,7 @@ m3_pci_attach(device_t dev) M3_DEBUG(CALL, ("m3_pci_attach\n")); - if ((sc = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) { + if ((sc = kmalloc(sizeof(*sc), M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) { device_printf(dev, "cannot allocate softc\n"); return ENXIO; } @@ -1204,7 +1204,7 @@ m3_pci_attach(device_t dev) /* Create the buffer for saving the card state during suspend */ len = sizeof(u_int16_t) * (REV_B_CODE_MEMORY_LENGTH + REV_B_DATA_MEMORY_LENGTH); - sc->savemem = (u_int16_t*)malloc(len, M_DEVBUF, M_NOWAIT | M_ZERO); + sc->savemem = (u_int16_t*)kmalloc(len, M_DEVBUF, M_NOWAIT | M_ZERO); if (sc->savemem == NULL) { device_printf(dev, "Failed to create suspend buffer\n"); goto bad; @@ -1228,7 +1228,7 @@ m3_pci_attach(device_t dev) if (sc->parent_dmat) { bus_dma_tag_destroy(sc->parent_dmat); } - free(sc, M_DEVBUF); + kfree(sc, M_DEVBUF); return ENXIO; } @@ -1251,8 +1251,8 @@ m3_pci_detach(device_t dev) bus_release_resource(dev, SYS_RES_IRQ, sc->irqid, sc->irq); bus_dma_tag_destroy(sc->parent_dmat); - free(sc->savemem, M_DEVBUF); - free(sc, M_DEVBUF); + kfree(sc->savemem, M_DEVBUF); + kfree(sc, M_DEVBUF); return 0; } diff --git a/sys/dev/sound/pci/neomagic.c b/sys/dev/sound/pci/neomagic.c index 40eb173ea9..bf8dfee4ce 100644 --- a/sys/dev/sound/pci/neomagic.c +++ b/sys/dev/sound/pci/neomagic.c @@ -26,7 +26,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/sound/pci/neomagic.c,v 1.7.2.11 2002/04/22 15:49:32 cg Exp $ - * $DragonFly: src/sys/dev/sound/pci/neomagic.c,v 1.4 2005/05/24 20:59:04 dillon Exp $ + * $DragonFly: src/sys/dev/sound/pci/neomagic.c,v 1.5 2006/09/05 00:55:43 dillon Exp $ */ #include @@ -37,7 +37,7 @@ #include #include -SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pci/neomagic.c,v 1.4 2005/05/24 20:59:04 dillon Exp $"); +SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pci/neomagic.c,v 1.5 2006/09/05 00:55:43 dillon Exp $"); /* -------------------------------------------------------------------- */ @@ -601,7 +601,7 @@ nm_pci_probe(device_t dev) /* Try to catch other non-ac97 cards */ if (i == NUM_BADCARDS) { - if (!(sc = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT | M_ZERO))) { + if (!(sc = kmalloc(sizeof(*sc), M_DEVBUF, M_NOWAIT | M_ZERO))) { device_printf(dev, "cannot allocate softc\n"); return ENXIO; } @@ -619,7 +619,7 @@ nm_pci_probe(device_t dev) if (!sc->reg) { device_printf(dev, "unable to map register space\n"); pci_write_config(dev, PCIR_COMMAND, data, 2); - free(sc, M_DEVBUF); + kfree(sc, M_DEVBUF); return ENXIO; } @@ -638,7 +638,7 @@ nm_pci_probe(device_t dev) pci_write_config(dev, PCIR_COMMAND, data, 2); bus_release_resource(dev, SYS_RES_MEMORY, sc->regid, sc->reg); - free(sc, M_DEVBUF); + kfree(sc, M_DEVBUF); } if (i == NUM_BADCARDS) @@ -665,7 +665,7 @@ nm_pci_attach(device_t dev) struct ac97_info *codec = 0; char status[SND_STATUSLEN]; - if ((sc = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) { + if ((sc = kmalloc(sizeof(*sc), M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) { device_printf(dev, "cannot allocate softc\n"); return ENXIO; } @@ -724,7 +724,7 @@ bad: if (sc->reg) bus_release_resource(dev, SYS_RES_MEMORY, sc->regid, sc->reg); if (sc->ih) bus_teardown_intr(dev, sc->irq, sc->ih); if (sc->irq) bus_release_resource(dev, SYS_RES_IRQ, sc->irqid, sc->irq); - free(sc, M_DEVBUF); + kfree(sc, M_DEVBUF); return ENXIO; } @@ -743,7 +743,7 @@ nm_pci_detach(device_t dev) bus_release_resource(dev, SYS_RES_MEMORY, sc->regid, sc->reg); bus_teardown_intr(dev, sc->irq, sc->ih); bus_release_resource(dev, SYS_RES_IRQ, sc->irqid, sc->irq); - free(sc, M_DEVBUF); + kfree(sc, M_DEVBUF); return 0; } diff --git a/sys/dev/sound/pci/solo.c b/sys/dev/sound/pci/solo.c index 8853163784..15c8d3ea75 100644 --- a/sys/dev/sound/pci/solo.c +++ b/sys/dev/sound/pci/solo.c @@ -23,7 +23,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/sound/pci/solo.c,v 1.9.2.8 2002/04/22 15:49:32 cg Exp $ - * $DragonFly: src/sys/dev/sound/pci/solo.c,v 1.5 2005/06/10 23:06:59 dillon Exp $ + * $DragonFly: src/sys/dev/sound/pci/solo.c,v 1.6 2006/09/05 00:55:43 dillon Exp $ */ #include @@ -36,7 +36,7 @@ #include "mixer_if.h" -SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pci/solo.c,v 1.5 2005/06/10 23:06:59 dillon Exp $"); +SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pci/solo.c,v 1.6 2006/09/05 00:55:43 dillon Exp $"); #define SOLO_DEFAULT_BUFSZ 16384 #define ABS(x) (((x) < 0)? -(x) : (x)) @@ -840,7 +840,7 @@ ess_release_resources(struct ess_info *sc, device_t dev) sc->parent_dmat = 0; } - free(sc, M_DEVBUF); + kfree(sc, M_DEVBUF); } static int @@ -904,7 +904,7 @@ ess_attach(device_t dev) u_int16_t ddma; u_int32_t data; - sc = (struct ess_info *)malloc(sizeof *sc, M_DEVBUF, M_NOWAIT | M_ZERO); + sc = (struct ess_info *)kmalloc(sizeof *sc, M_DEVBUF, M_NOWAIT | M_ZERO); if (!sc) return ENXIO; diff --git a/sys/dev/sound/pci/t4dwave.c b/sys/dev/sound/pci/t4dwave.c index 8422685b73..59853953d5 100644 --- a/sys/dev/sound/pci/t4dwave.c +++ b/sys/dev/sound/pci/t4dwave.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/sound/pci/t4dwave.c,v 1.9.2.11 2002/10/22 08:27:13 cognet Exp $ - * $DragonFly: src/sys/dev/sound/pci/t4dwave.c,v 1.5 2005/05/24 20:59:04 dillon Exp $ + * $DragonFly: src/sys/dev/sound/pci/t4dwave.c,v 1.6 2006/09/05 00:55:43 dillon Exp $ */ #include @@ -34,7 +34,7 @@ #include #include -SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pci/t4dwave.c,v 1.5 2005/05/24 20:59:04 dillon Exp $"); +SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pci/t4dwave.c,v 1.6 2006/09/05 00:55:43 dillon Exp $"); /* -------------------------------------------------------------------- */ #define TDX_PCI_ID 0x20001023 @@ -816,7 +816,7 @@ tr_pci_attach(device_t dev) int i; char status[SND_STATUSLEN]; - if ((tr = malloc(sizeof(*tr), M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) { + if ((tr = kmalloc(sizeof(*tr), M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) { device_printf(dev, "cannot allocate softc\n"); return ENXIO; } @@ -889,7 +889,7 @@ bad: if (tr->irq) bus_release_resource(dev, SYS_RES_IRQ, tr->irqid, tr->irq); if (tr->parent_dmat) bus_dma_tag_destroy(tr->parent_dmat); if (tr->lock) snd_mtxfree(tr->lock); - free(tr, M_DEVBUF); + kfree(tr, M_DEVBUF); return ENXIO; } @@ -909,7 +909,7 @@ tr_pci_detach(device_t dev) bus_release_resource(dev, SYS_RES_IRQ, tr->irqid, tr->irq); bus_dma_tag_destroy(tr->parent_dmat); snd_mtxfree(tr->lock); - free(tr, M_DEVBUF); + kfree(tr, M_DEVBUF); return 0; } diff --git a/sys/dev/sound/pci/via8233.c b/sys/dev/sound/pci/via8233.c index 329ea86aee..3d250f0a7b 100644 --- a/sys/dev/sound/pci/via8233.c +++ b/sys/dev/sound/pci/via8233.c @@ -26,7 +26,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/sound/pci/via8233.c,v 1.2.2.2 2003/02/06 17:35:56 orion Exp $ - * $DragonFly: src/sys/dev/sound/pci/via8233.c,v 1.4 2005/05/24 20:59:04 dillon Exp $ + * $DragonFly: src/sys/dev/sound/pci/via8233.c,v 1.5 2006/09/05 00:55:43 dillon Exp $ */ /* Some Credits: @@ -46,7 +46,7 @@ #include -SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pci/via8233.c,v 1.4 2005/05/24 20:59:04 dillon Exp $"); +SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pci/via8233.c,v 1.5 2006/09/05 00:55:43 dillon Exp $"); #define VIA8233_PCI_ID 0x30591106 @@ -522,7 +522,7 @@ via_attach(device_t dev) struct via_info *via = 0; char status[SND_STATUSLEN]; - if ((via = malloc(sizeof *via, M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) { + if ((via = kmalloc(sizeof *via, M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) { device_printf(dev, "cannot allocate softc\n"); return ENXIO; } @@ -627,7 +627,7 @@ bad: if (via->parent_dmat) bus_dma_tag_destroy(via->parent_dmat); if (via->sgd_dmamap) bus_dmamap_unload(via->sgd_dmat, via->sgd_dmamap); if (via->sgd_dmat) bus_dma_tag_destroy(via->sgd_dmat); - if (via) free(via, M_DEVBUF); + if (via) kfree(via, M_DEVBUF); return ENXIO; } @@ -647,7 +647,7 @@ via_detach(device_t dev) bus_dma_tag_destroy(via->parent_dmat); bus_dmamap_unload(via->sgd_dmat, via->sgd_dmamap); bus_dma_tag_destroy(via->sgd_dmat); - free(via, M_DEVBUF); + kfree(via, M_DEVBUF); return 0; } diff --git a/sys/dev/sound/pci/via82c686.c b/sys/dev/sound/pci/via82c686.c index 7e8a25db91..3022529a89 100644 --- a/sys/dev/sound/pci/via82c686.c +++ b/sys/dev/sound/pci/via82c686.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/sound/pci/via82c686.c,v 1.4.2.10 2003/05/11 01:45:53 orion Exp $ - * $DragonFly: src/sys/dev/sound/pci/via82c686.c,v 1.4 2005/05/24 20:59:04 dillon Exp $ + * $DragonFly: src/sys/dev/sound/pci/via82c686.c,v 1.5 2006/09/05 00:55:43 dillon Exp $ */ #include @@ -36,7 +36,7 @@ #include -SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pci/via82c686.c,v 1.4 2005/05/24 20:59:04 dillon Exp $"); +SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pci/via82c686.c,v 1.5 2006/09/05 00:55:43 dillon Exp $"); #define VIA_PCI_ID 0x30581106 #define NSEGS 4 /* Number of segments in SGD table */ @@ -455,7 +455,7 @@ via_attach(device_t dev) char status[SND_STATUSLEN]; u_int32_t data, cnt; - if ((via = malloc(sizeof *via, M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) { + if ((via = kmalloc(sizeof *via, M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) { device_printf(dev, "cannot allocate softc\n"); return ENXIO; } @@ -577,7 +577,7 @@ bad: if (via->parent_dmat) bus_dma_tag_destroy(via->parent_dmat); if (via->sgd_dmamap) bus_dmamap_unload(via->sgd_dmat, via->sgd_dmamap); if (via->sgd_dmat) bus_dma_tag_destroy(via->sgd_dmat); - if (via) free(via, M_DEVBUF); + if (via) kfree(via, M_DEVBUF); return ENXIO; } @@ -598,7 +598,7 @@ via_detach(device_t dev) bus_dma_tag_destroy(via->parent_dmat); bus_dmamap_unload(via->sgd_dmat, via->sgd_dmamap); bus_dma_tag_destroy(via->sgd_dmat); - free(via, M_DEVBUF); + kfree(via, M_DEVBUF); return 0; } diff --git a/sys/dev/sound/pci/vibes.c b/sys/dev/sound/pci/vibes.c index 4c75102ec8..1b96cecf14 100644 --- a/sys/dev/sound/pci/vibes.c +++ b/sys/dev/sound/pci/vibes.c @@ -28,7 +28,7 @@ * muting. * * $FreeBSD: src/sys/dev/sound/pci/vibes.c,v 1.4.2.6 2002/04/22 15:49:33 cg Exp $ - * $DragonFly: src/sys/dev/sound/pci/vibes.c,v 1.6 2005/10/12 17:35:55 dillon Exp $ + * $DragonFly: src/sys/dev/sound/pci/vibes.c,v 1.7 2006/09/05 00:55:43 dillon Exp $ */ #include @@ -39,7 +39,7 @@ #include "mixer_if.h" -SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pci/vibes.c,v 1.6 2005/10/12 17:35:55 dillon Exp $"); +SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pci/vibes.c,v 1.7 2006/09/05 00:55:43 dillon Exp $"); /* ------------------------------------------------------------------------- */ /* Constants */ @@ -722,7 +722,7 @@ sv_attach(device_t dev) { d = device_get_softc(dev); - sc = malloc(sizeof(struct sc_info), M_DEVBUF, M_NOWAIT | M_ZERO); + sc = kmalloc(sizeof(struct sc_info), M_DEVBUF, M_NOWAIT | M_ZERO); if (sc == NULL) { device_printf(dev, "cannot allocate softc"); return ENXIO; @@ -923,7 +923,7 @@ sv_detach(device_t dev) { bus_release_resource(dev, sc->dmaa_type, sc->dmaa_rid, sc->dmaa_reg); bus_release_resource(dev, sc->dmac_type, sc->dmac_rid, sc->dmac_reg); - free(sc, M_DEVBUF); + kfree(sc, M_DEVBUF); return 0; } diff --git a/sys/dev/sound/pcm/ac97.c b/sys/dev/sound/pcm/ac97.c index bbaf9879b2..d1fb646c1b 100644 --- a/sys/dev/sound/pcm/ac97.c +++ b/sys/dev/sound/pcm/ac97.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/sound/pcm/ac97.c,v 1.49 2003/11/11 22:15:17 kuriyama Exp $ - * $DragonFly: src/sys/dev/sound/pcm/ac97.c,v 1.19 2004/07/16 08:13:28 asmodai Exp $ + * $DragonFly: src/sys/dev/sound/pcm/ac97.c,v 1.20 2006/09/05 00:55:43 dillon Exp $ */ #include @@ -33,7 +33,7 @@ #include "mixer_if.h" -SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pcm/ac97.c,v 1.19 2004/07/16 08:13:28 asmodai Exp $"); +SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pcm/ac97.c,v 1.20 2006/09/05 00:55:43 dillon Exp $"); MALLOC_DEFINE(M_AC97, "ac97", "ac97 codec"); @@ -691,7 +691,7 @@ ac97_create(device_t dev, void *devinfo, kobj_class_t cls) { struct ac97_info *codec; - codec = (struct ac97_info *)malloc(sizeof *codec, M_AC97, M_NOWAIT); + codec = (struct ac97_info *)kmalloc(sizeof *codec, M_AC97, M_NOWAIT); if (codec == NULL) return NULL; @@ -701,7 +701,7 @@ ac97_create(device_t dev, void *devinfo, kobj_class_t cls) if (codec->methods == NULL) { snd_mtxlock(codec->lock); snd_mtxfree(codec->lock); - free(codec, M_AC97); + kfree(codec, M_AC97); return NULL; } @@ -718,7 +718,7 @@ ac97_destroy(struct ac97_info *codec) if (codec->methods != NULL) kobj_delete(codec->methods, M_AC97); snd_mtxfree(codec->lock); - free(codec, M_AC97); + kfree(codec, M_AC97); } void diff --git a/sys/dev/sound/pcm/buffer.c b/sys/dev/sound/pcm/buffer.c index d259f07ada..9f2fed8c1e 100644 --- a/sys/dev/sound/pcm/buffer.c +++ b/sys/dev/sound/pcm/buffer.c @@ -24,14 +24,14 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/sound/pcm/buffer.c,v 1.1.2.4 2002/04/22 15:49:35 cg Exp $ - * $DragonFly: src/sys/dev/sound/pcm/buffer.c,v 1.4 2006/04/30 17:22:17 dillon Exp $ + * $DragonFly: src/sys/dev/sound/pcm/buffer.c,v 1.5 2006/09/05 00:55:43 dillon Exp $ */ #include #include "feeder_if.h" -SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pcm/buffer.c,v 1.4 2006/04/30 17:22:17 dillon Exp $"); +SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pcm/buffer.c,v 1.5 2006/09/05 00:55:43 dillon Exp $"); #define SNDBUF_NAMELEN 48 struct snd_dbuf { @@ -60,7 +60,7 @@ sndbuf_create(device_t dev, char *drv, char *desc) { struct snd_dbuf *b; - b = malloc(sizeof(*b), M_DEVBUF, M_WAITOK | M_ZERO); + b = kmalloc(sizeof(*b), M_DEVBUF, M_WAITOK | M_ZERO); snprintf(b->name, SNDBUF_NAMELEN, "%s:%s", drv, desc); b->dev = dev; @@ -70,7 +70,7 @@ sndbuf_create(device_t dev, char *drv, char *desc) void sndbuf_destroy(struct snd_dbuf *b) { - free(b, M_DEVBUF); + kfree(b, M_DEVBUF); } static void @@ -115,7 +115,7 @@ void sndbuf_free(struct snd_dbuf *b) { if (b->tmpbuf) - free(b->tmpbuf, M_DEVBUF); + kfree(b->tmpbuf, M_DEVBUF); b->tmpbuf = NULL; if (b->dmamap) @@ -144,8 +144,8 @@ sndbuf_resize(struct snd_dbuf *b, unsigned int blkcnt, unsigned int blksz) b->blksz = blksz; b->bufsize = blkcnt * blksz; if (b->tmpbuf) - free(b->tmpbuf, M_DEVBUF); - b->tmpbuf = malloc(b->bufsize, M_DEVBUF, M_WAITOK); + kfree(b->tmpbuf, M_DEVBUF); + b->tmpbuf = kmalloc(b->bufsize, M_DEVBUF, M_WAITOK); sndbuf_reset(b); return 0; } @@ -163,14 +163,14 @@ sndbuf_remalloc(struct snd_dbuf *b, unsigned int blkcnt, unsigned int blksz) b->bufsize = b->maxsize; if (b->buf) - free(b->buf, M_DEVBUF); - b->buf = malloc(b->bufsize, M_DEVBUF, M_WAITOK); + kfree(b->buf, M_DEVBUF); + b->buf = kmalloc(b->bufsize, M_DEVBUF, M_WAITOK); if (b->buf == NULL) return ENOMEM; if (b->tmpbuf) - free(b->tmpbuf, M_DEVBUF); - b->tmpbuf = malloc(b->bufsize, M_DEVBUF, M_WAITOK); + kfree(b->tmpbuf, M_DEVBUF); + b->tmpbuf = kmalloc(b->bufsize, M_DEVBUF, M_WAITOK); if (b->tmpbuf == NULL) return ENOMEM; diff --git a/sys/dev/sound/pcm/fake.c b/sys/dev/sound/pcm/fake.c index 0119ae752c..0927b2650c 100644 --- a/sys/dev/sound/pcm/fake.c +++ b/sys/dev/sound/pcm/fake.c @@ -24,12 +24,12 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/sound/pcm/fake.c,v 1.4.2.5 2002/04/22 15:49:36 cg Exp $ - * $DragonFly: src/sys/dev/sound/pcm/fake.c,v 1.2 2003/06/17 04:28:31 dillon Exp $ + * $DragonFly: src/sys/dev/sound/pcm/fake.c,v 1.3 2006/09/05 00:55:43 dillon Exp $ */ #include -SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pcm/fake.c,v 1.2 2003/06/17 04:28:31 dillon Exp $"); +SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pcm/fake.c,v 1.3 2006/09/05 00:55:43 dillon Exp $"); static u_int32_t fk_fmt[] = { AFMT_U8, @@ -120,7 +120,7 @@ fkchan_setup(device_t dev) struct snddev_info *d = device_get_softc(dev); struct pcm_channel *c; - c = malloc(sizeof(*c), M_DEVBUF, M_WAITOK); + c = kmalloc(sizeof(*c), M_DEVBUF, M_WAITOK); c->methods = kobj_create(&fkchan_class, M_DEVBUF, M_WAITOK); c->parentsnddev = d; snprintf(c->name, CHN_NAMELEN, "%s:fake", device_get_nameunit(dev)); @@ -133,7 +133,7 @@ fkchan_kill(struct pcm_channel *c) { kobj_delete(c->methods, M_DEVBUF); c->methods = NULL; - free(c, M_DEVBUF); + kfree(c, M_DEVBUF); return 0; } diff --git a/sys/dev/sound/pcm/feeder.c b/sys/dev/sound/pcm/feeder.c index 91d8afa6c0..8ea8424552 100644 --- a/sys/dev/sound/pcm/feeder.c +++ b/sys/dev/sound/pcm/feeder.c @@ -24,14 +24,14 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/sound/pcm/feeder.c,v 1.8.2.9 2003/02/08 01:43:07 orion Exp $ - * $DragonFly: src/sys/dev/sound/pcm/feeder.c,v 1.3 2003/11/15 21:05:42 dillon Exp $ + * $DragonFly: src/sys/dev/sound/pcm/feeder.c,v 1.4 2006/09/05 00:55:43 dillon Exp $ */ #include #include "feeder_if.h" -SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pcm/feeder.c,v 1.3 2003/11/15 21:05:42 dillon Exp $"); +SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pcm/feeder.c,v 1.4 2006/09/05 00:55:43 dillon Exp $"); MALLOC_DEFINE(M_FEEDER, "feeder", "pcm feeder"); @@ -62,7 +62,7 @@ feeder_register(void *p) KASSERT(fc->desc == NULL, ("first feeder not root: %s", fc->name)); SLIST_INIT(&feedertab); - fte = malloc(sizeof(*fte), M_FEEDER, M_WAITOK | M_ZERO); + fte = kmalloc(sizeof(*fte), M_FEEDER, M_WAITOK | M_ZERO); if (fte == NULL) { printf("can't allocate memory for root feeder\n"); return; @@ -85,7 +85,7 @@ feeder_register(void *p) i = 0; while ((feedercnt < MAXFEEDERS) && (fc->desc[i].type > 0)) { /* printf("adding feeder %s, %x -> %x\n", fc->name, fc->desc[i].in, fc->desc[i].out); */ - fte = malloc(sizeof(*fte), M_FEEDER, M_WAITOK | M_ZERO); + fte = kmalloc(sizeof(*fte), M_FEEDER, M_WAITOK | M_ZERO); if (fte == NULL) { printf("can't allocate memory for feeder '%s', %x -> %x\n", fc->name, fc->desc[i].in, fc->desc[i].out); @@ -112,7 +112,7 @@ feeder_unregisterall(void *p) while (next != NULL) { fte = next; next = SLIST_NEXT(fte, link); - free(fte, M_FEEDER); + kfree(fte, M_FEEDER); } } diff --git a/sys/dev/sound/pcm/feeder_fmt.c b/sys/dev/sound/pcm/feeder_fmt.c index 4f9e737537..55aba1e9a8 100644 --- a/sys/dev/sound/pcm/feeder_fmt.c +++ b/sys/dev/sound/pcm/feeder_fmt.c @@ -24,14 +24,14 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/sound/pcm/feeder_fmt.c,v 1.1.2.5 2002/04/22 15:49:36 cg Exp $ - * $DragonFly: src/sys/dev/sound/pcm/feeder_fmt.c,v 1.2 2003/06/17 04:28:31 dillon Exp $ + * $DragonFly: src/sys/dev/sound/pcm/feeder_fmt.c,v 1.3 2006/09/05 00:55:43 dillon Exp $ */ #include #include "feeder_if.h" -SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pcm/feeder_fmt.c,v 1.2 2003/06/17 04:28:31 dillon Exp $"); +SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pcm/feeder_fmt.c,v 1.3 2006/09/05 00:55:43 dillon Exp $"); MALLOC_DEFINE(M_FMTFEEDER, "fmtfeed", "pcm format feeder"); @@ -212,7 +212,7 @@ FEEDER_DECLARE(feeder_8to16le, 0, NULL); static int feed_16to8_init(struct pcm_feeder *f) { - f->data = malloc(FEEDBUFSZ, M_FMTFEEDER, M_WAITOK | M_ZERO); + f->data = kmalloc(FEEDBUFSZ, M_FMTFEEDER, M_WAITOK | M_ZERO); return (f->data)? 0 : ENOMEM; } @@ -220,7 +220,7 @@ static int feed_16to8_free(struct pcm_feeder *f) { if (f->data) - free(f->data, M_FMTFEEDER); + kfree(f->data, M_FMTFEEDER); f->data = NULL; return 0; } @@ -321,7 +321,7 @@ FEEDER_DECLARE(feeder_monotostereo16, 0, NULL); static int feed_stereotomono8_init(struct pcm_feeder *f) { - f->data = malloc(FEEDBUFSZ, M_FMTFEEDER, M_WAITOK | M_ZERO); + f->data = kmalloc(FEEDBUFSZ, M_FMTFEEDER, M_WAITOK | M_ZERO); return (f->data)? 0 : ENOMEM; } @@ -329,7 +329,7 @@ static int feed_stereotomono8_free(struct pcm_feeder *f) { if (f->data) - free(f->data, M_FMTFEEDER); + kfree(f->data, M_FMTFEEDER); f->data = NULL; return 0; } @@ -366,7 +366,7 @@ FEEDER_DECLARE(feeder_stereotomono8, 1, NULL); static int feed_stereotomono16_init(struct pcm_feeder *f) { - f->data = malloc(FEEDBUFSZ, M_FMTFEEDER, M_WAITOK | M_ZERO); + f->data = kmalloc(FEEDBUFSZ, M_FMTFEEDER, M_WAITOK | M_ZERO); return (f->data)? 0 : ENOMEM; } @@ -374,7 +374,7 @@ static int feed_stereotomono16_free(struct pcm_feeder *f) { if (f->data) - free(f->data, M_FMTFEEDER); + kfree(f->data, M_FMTFEEDER); f->data = NULL; return 0; } diff --git a/sys/dev/sound/pcm/feeder_rate.c b/sys/dev/sound/pcm/feeder_rate.c index 13929511e9..68d1016527 100644 --- a/sys/dev/sound/pcm/feeder_rate.c +++ b/sys/dev/sound/pcm/feeder_rate.c @@ -43,7 +43,7 @@ * testing revisions. * * $FreeBSD: src/sys/dev/sound/pcm/feeder_rate.c,v 1.2.2.3 2003/02/08 02:38:21 orion Exp $ - * $DragonFly: src/sys/dev/sound/pcm/feeder_rate.c,v 1.2 2003/06/17 04:28:31 dillon Exp $ + * $DragonFly: src/sys/dev/sound/pcm/feeder_rate.c,v 1.3 2006/09/05 00:55:43 dillon Exp $ */ #ifdef _KERNEL @@ -51,7 +51,7 @@ #include #include "feeder_if.h" -SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pcm/feeder_rate.c,v 1.2 2003/06/17 04:28:31 dillon Exp $"); +SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pcm/feeder_rate.c,v 1.3 2006/09/05 00:55:43 dillon Exp $"); #endif /* _KERNEL */ @@ -252,7 +252,7 @@ feed_rate_init(struct pcm_feeder *f) { struct feed_rate_info *info; - info = malloc(sizeof(*info), M_RATEFEEDER, M_WAITOK | M_ZERO); + info = kmalloc(sizeof(*info), M_RATEFEEDER, M_WAITOK | M_ZERO); if (info == NULL) return ENOMEM; @@ -270,7 +270,7 @@ feed_rate_free(struct pcm_feeder *f) struct feed_rate_info *info = f->data; if (info) { - free(info, M_RATEFEEDER); + kfree(info, M_RATEFEEDER); } f->data = NULL; return 0; diff --git a/sys/dev/sound/pcm/sndstat.c b/sys/dev/sound/pcm/sndstat.c index 3a45f7516a..3ca2f5ebd7 100644 --- a/sys/dev/sound/pcm/sndstat.c +++ b/sys/dev/sound/pcm/sndstat.c @@ -24,13 +24,13 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/sound/pcm/sndstat.c,v 1.4.2.2 2002/04/22 15:49:36 cg Exp $ - * $DragonFly: src/sys/dev/sound/pcm/sndstat.c,v 1.9 2006/07/28 02:17:38 dillon Exp $ + * $DragonFly: src/sys/dev/sound/pcm/sndstat.c,v 1.10 2006/09/05 00:55:43 dillon Exp $ */ #include #include -SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pcm/sndstat.c,v 1.9 2006/07/28 02:17:38 dillon Exp $"); +SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pcm/sndstat.c,v 1.10 2006/09/05 00:55:43 dillon Exp $"); #define SS_TYPE_MODULE 0 #define SS_TYPE_FIRST 1 @@ -193,7 +193,7 @@ sndstat_register(device_t dev, char *str, sndstat_handler handler) unit = -1; } - ent = malloc(sizeof *ent, M_DEVBUF, M_ZERO | M_WAITOK); + ent = kmalloc(sizeof *ent, M_DEVBUF, M_ZERO | M_WAITOK); if (!ent) return ENOSPC; @@ -228,7 +228,7 @@ sndstat_unregister(device_t dev) SLIST_FOREACH(ent, &sndstat_devlist, link) { if (ent->dev == dev) { SLIST_REMOVE(&sndstat_devlist, ent, sndstat_entry, link); - free(ent, M_DEVBUF); + kfree(ent, M_DEVBUF); crit_exit(); return 0; @@ -248,7 +248,7 @@ sndstat_unregisterfile(char *str) SLIST_FOREACH(ent, &sndstat_devlist, link) { if (ent->dev == NULL && ent->str == str) { SLIST_REMOVE(&sndstat_devlist, ent, sndstat_entry, link); - free(ent, M_DEVBUF); + kfree(ent, M_DEVBUF); sndstat_files--; crit_exit(); diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c index a13579d353..6e542e9d05 100644 --- a/sys/dev/sound/pcm/sound.c +++ b/sys/dev/sound/pcm/sound.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/sound/pcm/sound.c,v 1.17.2.14 2002/11/07 23:17:18 cognet Exp $ - * $DragonFly: src/sys/dev/sound/pcm/sound.c,v 1.5 2005/10/12 17:35:55 dillon Exp $ + * $DragonFly: src/sys/dev/sound/pcm/sound.c,v 1.6 2006/09/05 00:55:43 dillon Exp $ */ #include @@ -34,7 +34,7 @@ #include "feeder_if.h" -SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pcm/sound.c,v 1.5 2005/10/12 17:35:55 dillon Exp $"); +SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pcm/sound.c,v 1.6 2006/09/05 00:55:43 dillon Exp $"); struct snddev_channel { SLIST_ENTRY(snddev_channel) link; @@ -94,7 +94,7 @@ snd_mtxcreate(const char *desc, const char *type) #ifdef USING_MUTEX struct mtx *m; - m = malloc(sizeof(*m), M_DEVBUF, M_WAITOK | M_ZERO); + m = kmalloc(sizeof(*m), M_DEVBUF, M_WAITOK | M_ZERO); if (m == NULL) return NULL; mtx_init(m, desc, type, MTX_RECURSE); @@ -112,7 +112,7 @@ snd_mtxfree(void *m) mtx_assert(mtx, MA_OWNED); mtx_destroy(mtx); - free(mtx, M_DEVBUF); + kfree(mtx, M_DEVBUF); #endif } @@ -372,13 +372,13 @@ pcm_chn_create(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t c return NULL; } - ch = malloc(sizeof(*ch), M_DEVBUF, M_WAITOK | M_ZERO); + ch = kmalloc(sizeof(*ch), M_DEVBUF, M_WAITOK | M_ZERO); if (!ch) return NULL; ch->methods = kobj_create(cls, M_DEVBUF, M_WAITOK); if (!ch->methods) { - free(ch, M_DEVBUF); + kfree(ch, M_DEVBUF); return NULL; } @@ -395,7 +395,7 @@ pcm_chn_create(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t c if (err) { device_printf(d->dev, "chn_init(%s) failed: err = %d\n", ch->name, err); kobj_delete(ch->methods, M_DEVBUF); - free(ch, M_DEVBUF); + kfree(ch, M_DEVBUF); (*pnum)--; return NULL; @@ -425,7 +425,7 @@ pcm_chn_destroy(struct pcm_channel *ch) d->playcount--; kobj_delete(ch->methods, M_DEVBUF); - free(ch, M_DEVBUF); + kfree(ch, M_DEVBUF); return 0; } @@ -438,7 +438,7 @@ pcm_chn_add(struct snddev_info *d, struct pcm_channel *ch, int mkdev) snd_mtxlock(d->lock); - sce = malloc(sizeof(*sce), M_DEVBUF, M_WAITOK | M_ZERO); + sce = kmalloc(sizeof(*sce), M_DEVBUF, M_WAITOK | M_ZERO); if (!sce) { snd_mtxunlock(d->lock); return ENOMEM; @@ -481,7 +481,7 @@ pcm_chn_remove(struct snddev_info *d, struct pcm_channel *ch, int rmdev) return EINVAL; gotit: SLIST_REMOVE(&d->channels, sce, snddev_channel, link); - free(sce, M_DEVBUF); + kfree(sce, M_DEVBUF); if (rmdev) { dsp_unregister(unit, --d->devcount); diff --git a/sys/dev/sound/pcm/vchan.c b/sys/dev/sound/pcm/vchan.c index b538a84ea3..727757427d 100644 --- a/sys/dev/sound/pcm/vchan.c +++ b/sys/dev/sound/pcm/vchan.c @@ -24,14 +24,14 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/sound/pcm/vchan.c,v 1.5.2.4 2003/02/11 15:54:16 orion Exp $ - * $DragonFly: src/sys/dev/sound/pcm/vchan.c,v 1.2 2003/06/17 04:28:31 dillon Exp $ + * $DragonFly: src/sys/dev/sound/pcm/vchan.c,v 1.3 2006/09/05 00:55:43 dillon Exp $ */ #include #include #include "feeder_if.h" -SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pcm/vchan.c,v 1.2 2003/06/17 04:28:31 dillon Exp $"); +SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pcm/vchan.c,v 1.3 2006/09/05 00:55:43 dillon Exp $"); struct vchinfo { u_int32_t spd, fmt, blksz, bps, run; @@ -125,7 +125,7 @@ vchan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel *c, struct pcm_channel *parent = devinfo; KASSERT(dir == PCMDIR_PLAY, ("vchan_init: bad direction")); - ch = malloc(sizeof(*ch), M_DEVBUF, M_WAITOK | M_ZERO); + ch = kmalloc(sizeof(*ch), M_DEVBUF, M_WAITOK | M_ZERO); ch->parent = parent; ch->channel = c; ch->fmt = AFMT_U8; @@ -244,7 +244,7 @@ vchan_create(struct pcm_channel *parent) return EBUSY; } - pce = malloc(sizeof(*pce), M_DEVBUF, M_WAITOK | M_ZERO); + pce = kmalloc(sizeof(*pce), M_DEVBUF, M_WAITOK | M_ZERO); if (!pce) { CHN_UNLOCK(parent); return ENOMEM; @@ -253,7 +253,7 @@ vchan_create(struct pcm_channel *parent) /* create a new playback channel */ child = pcm_chn_create(d, parent, &vchan_class, PCMDIR_VIRTUAL, parent); if (!child) { - free(pce, M_DEVBUF); + kfree(pce, M_DEVBUF); CHN_UNLOCK(parent); return ENODEV; } @@ -268,7 +268,7 @@ vchan_create(struct pcm_channel *parent) err = pcm_chn_add(d, child, !first); if (err) { pcm_chn_destroy(child); - free(pce, M_DEVBUF); + kfree(pce, M_DEVBUF); } /* XXX gross ugly hack, kill murder death */ @@ -311,7 +311,7 @@ vchan_destroy(struct pcm_channel *c) return EINVAL; gotch: SLIST_REMOVE(&parent->children, pce, pcmchan_children, link); - free(pce, M_DEVBUF); + kfree(pce, M_DEVBUF); last = SLIST_EMPTY(&parent->children); if (last) diff --git a/sys/dev/sound/usb/uaudio.c b/sys/dev/sound/usb/uaudio.c index 9703e377e2..d0e7ddfb42 100644 --- a/sys/dev/sound/usb/uaudio.c +++ b/sys/dev/sound/usb/uaudio.c @@ -1,6 +1,6 @@ /* $NetBSD: uaudio.c,v 1.41 2001/01/23 14:04:13 augustss Exp $ */ /* $FreeBSD: src/sys/dev/sound/usb/uaudio.c,v 1.6.2.2 2002/11/06 21:18:17 joe Exp $: */ -/* $DragonFly: src/sys/dev/sound/usb/uaudio.c,v 1.7 2005/06/10 23:07:02 dillon Exp $: */ +/* $DragonFly: src/sys/dev/sound/usb/uaudio.c,v 1.8 2006/09/05 00:55:43 dillon Exp $: */ /* * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -658,8 +658,8 @@ uaudio_mixer_add_ctl(struct uaudio_softc *sc, struct mixerctl *mc) int res; size_t len = sizeof(*mc) * (sc->sc_nctls + 1); struct mixerctl *nmc = sc->sc_nctls == 0 ? - malloc(len, M_USBDEV, M_NOWAIT) : - realloc(sc->sc_ctls, len, M_USBDEV, M_NOWAIT); + kmalloc(len, M_USBDEV, M_NOWAIT) : + krealloc(sc->sc_ctls, len, M_USBDEV, M_NOWAIT); if(nmc == NULL){ printf("uaudio_mixer_add_ctl: no memory\n"); @@ -1210,8 +1210,8 @@ uaudio_add_alt(struct uaudio_softc *sc, struct as_info *ai) { size_t len = sizeof(*ai) * (sc->sc_nalts + 1); struct as_info *nai = sc->sc_nalts == 0 ? - malloc(len, M_USBDEV, M_NOWAIT) : - realloc(sc->sc_alts, len, M_USBDEV, M_NOWAIT); + kmalloc(len, M_USBDEV, M_NOWAIT) : + krealloc(sc->sc_alts, len, M_USBDEV, M_NOWAIT); if (nai == NULL) { printf("uaudio_add_alt: no memory\n"); @@ -2888,7 +2888,7 @@ audio_attach_mi(device_t dev) /* Attach the children. */ /* PCM Audio */ - func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT); + func = kmalloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT); if (func == NULL) return (ENOMEM); bzero(func, sizeof(*func)); diff --git a/sys/dev/sound/usb/uaudio_pcm.c b/sys/dev/sound/usb/uaudio_pcm.c index df344c0b04..671d899a04 100644 --- a/sys/dev/sound/usb/uaudio_pcm.c +++ b/sys/dev/sound/usb/uaudio_pcm.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/dev/sound/usb/uaudio_pcm.c,v 1.1.2.1 2002/08/24 08:03:07 nsayer Exp $ */ -/* $DragonFly: src/sys/dev/sound/usb/uaudio_pcm.c,v 1.2 2003/06/17 04:28:31 dillon Exp $ */ +/* $DragonFly: src/sys/dev/sound/usb/uaudio_pcm.c,v 1.3 2006/09/05 00:55:43 dillon Exp $ */ /* * Copyright (c) 2000-2002 Hiroyuki Aizu @@ -289,7 +289,7 @@ ua_attach(device_t dev) char status[SND_STATUSLEN]; unsigned int bufsz; - ua = (struct ua_info *)malloc(sizeof *ua, M_DEVBUF, M_NOWAIT); + ua = (struct ua_info *)kmalloc(sizeof *ua, M_DEVBUF, M_NOWAIT); if (!ua) return ENXIO; bzero(ua, sizeof *ua); @@ -329,7 +329,7 @@ ua_attach(device_t dev) bad: if (ua->parent_dmat) bus_dma_tag_destroy(ua->parent_dmat); - free(ua, M_DEVBUF); + kfree(ua, M_DEVBUF); return ENXIO; } @@ -346,7 +346,7 @@ ua_detach(device_t dev) sc = pcm_getdevinfo(dev); bus_dma_tag_destroy(sc->parent_dmat); - free(sc, M_DEVBUF); + kfree(sc, M_DEVBUF); return 0; } diff --git a/sys/dev/usbmisc/ubsa/ubsa.c b/sys/dev/usbmisc/ubsa/ubsa.c index b0bf2e2fe7..8fc73dc0c5 100644 --- a/sys/dev/usbmisc/ubsa/ubsa.c +++ b/sys/dev/usbmisc/ubsa/ubsa.c @@ -60,7 +60,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/usb/ubsa.c,v 1.11 2003/11/16 12:13:39 akiyama Exp $ - * $DragonFly: src/sys/dev/usbmisc/ubsa/ubsa.c,v 1.7 2004/03/15 02:27:56 dillon Exp $ + * $DragonFly: src/sys/dev/usbmisc/ubsa/ubsa.c,v 1.8 2006/09/05 00:55:43 dillon Exp $ */ #include @@ -288,7 +288,7 @@ USB_ATTACH(ubsa) int i; dev = uaa->device; - devinfo = malloc(1024, M_USBDEV, M_INTWAIT); + devinfo = kmalloc(1024, M_USBDEV, M_INTWAIT); ucom = &sc->sc_ucom; bzero(sc, sizeof (struct ubsa_softc)); @@ -418,11 +418,11 @@ USB_ATTACH(ubsa) ucom_attach(ucom); - free(devinfo, M_USBDEV); + kfree(devinfo, M_USBDEV); USB_ATTACH_SUCCESS_RETURN; error: - free(devinfo, M_USBDEV); + kfree(devinfo, M_USBDEV); USB_ATTACH_ERROR_RETURN; } @@ -437,7 +437,7 @@ USB_DETACH(ubsa) if (sc->sc_intr_pipe != NULL) { usbd_abort_pipe(sc->sc_intr_pipe); usbd_close_pipe(sc->sc_intr_pipe); - free(sc->sc_intr_buf, M_USBDEV); + kfree(sc->sc_intr_buf, M_USBDEV); sc->sc_intr_pipe = NULL; } @@ -662,7 +662,7 @@ ubsa_open(void *addr, int portno) DPRINTF(("ubsa_open: sc = %p\n", sc)); if (sc->sc_intr_number != -1 && sc->sc_intr_pipe == NULL) { - sc->sc_intr_buf = malloc(sc->sc_isize, M_USBDEV, M_WAITOK); + sc->sc_intr_buf = kmalloc(sc->sc_isize, M_USBDEV, M_WAITOK); err = usbd_open_pipe_intr(sc->sc_intr_iface, sc->sc_intr_number, USBD_SHORT_XFER_OK, @@ -706,7 +706,7 @@ ubsa_close(void *addr, int portno) printf("%s: close interrupt pipe failed: %s\n", USBDEVNAME(sc->sc_ucom.sc_dev), usbd_errstr(err)); - free(sc->sc_intr_buf, M_USBDEV); + kfree(sc->sc_intr_buf, M_USBDEV); sc->sc_intr_pipe = NULL; } } diff --git a/sys/dev/usbmisc/udbp/udbp.c b/sys/dev/usbmisc/udbp/udbp.c index 178047b78f..beaee0432b 100644 --- a/sys/dev/usbmisc/udbp/udbp.c +++ b/sys/dev/usbmisc/udbp/udbp.c @@ -27,7 +27,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/usb/udbp.c,v 1.24 2003/08/24 17:55:55 obrien Exp $ - * $DragonFly: src/sys/dev/usbmisc/udbp/Attic/udbp.c,v 1.6 2005/06/10 23:11:55 dillon Exp $ + * $DragonFly: src/sys/dev/usbmisc/udbp/Attic/udbp.c,v 1.7 2006/09/05 00:55:43 dillon Exp $ */ /* Driver for arbitrary double bulk pipe devices. @@ -329,11 +329,11 @@ USB_ATTACH(udbp) if (!sc->sc_bulkout_xfer) { goto bad; } - sc->sc_bulkin_buffer = malloc(UDBP_BUFFERSIZE, M_USBDEV, M_INTWAIT); + sc->sc_bulkin_buffer = kmalloc(UDBP_BUFFERSIZE, M_USBDEV, M_INTWAIT); if (!sc->sc_bulkin_buffer) { goto bad; } - sc->sc_bulkout_buffer = malloc(UDBP_BUFFERSIZE, M_USBDEV, M_INTWAIT); + sc->sc_bulkout_buffer = kmalloc(UDBP_BUFFERSIZE, M_USBDEV, M_INTWAIT); if (!sc->sc_bulkout_xfer || !sc->sc_bulkout_buffer) { goto bad; } @@ -444,9 +444,9 @@ USB_DETACH(udbp) usbd_free_xfer(sc->sc_bulkout_xfer); if (sc->sc_bulkin_buffer) - free(sc->sc_bulkin_buffer, M_USBDEV); + kfree(sc->sc_bulkin_buffer, M_USBDEV); if (sc->sc_bulkout_buffer) - free(sc->sc_bulkout_buffer, M_USBDEV); + kfree(sc->sc_bulkout_buffer, M_USBDEV); return 0; } diff --git a/sys/dev/usbmisc/uftdi/uftdi.c b/sys/dev/usbmisc/uftdi/uftdi.c index cffbae9f84..3f1a3653c1 100644 --- a/sys/dev/usbmisc/uftdi/uftdi.c +++ b/sys/dev/usbmisc/uftdi/uftdi.c @@ -1,7 +1,7 @@ /* * $NetBSD: uftdi.c,v 1.13 2002/09/23 05:51:23 simonb Exp $ * $FreeBSD: src/sys/dev/usb/uftdi.c,v 1.10 2003/08/24 17:55:55 obrien Exp $ - * $DragonFly: src/sys/dev/usbmisc/uftdi/uftdi.c,v 1.7 2004/03/15 02:27:56 dillon Exp $ + * $DragonFly: src/sys/dev/usbmisc/uftdi/uftdi.c,v 1.8 2006/09/05 00:55:43 dillon Exp $ */ /* @@ -172,7 +172,7 @@ USB_ATTACH(uftdi) usbd_status err; struct ucom_softc *ucom = &sc->sc_ucom; DPRINTFN(10,("\nuftdi_attach: sc=%p\n", sc)); - devinfo = malloc(1024, M_USBDEV, M_INTWAIT); + devinfo = kmalloc(1024, M_USBDEV, M_INTWAIT); ucom->sc_dev = self; ucom->sc_udev = dev; @@ -264,14 +264,14 @@ USB_ATTACH(uftdi) #endif DPRINTF(("uftdi: in=0x%x out=0x%x\n", ucom->sc_bulkin_no, ucom->sc_bulkout_no)); ucom_attach(&sc->sc_ucom); - free(devinfo, M_USBDEV); + kfree(devinfo, M_USBDEV); USB_ATTACH_SUCCESS_RETURN; bad: DPRINTF(("uftdi_attach: ATTACH ERROR\n")); ucom->sc_dying = 1; - free(devinfo, M_USBDEV); + kfree(devinfo, M_USBDEV); USB_ATTACH_ERROR_RETURN; } diff --git a/sys/dev/usbmisc/ugen/ugen.c b/sys/dev/usbmisc/ugen/ugen.c index 4c306d9d38..f8b6d70400 100644 --- a/sys/dev/usbmisc/ugen/ugen.c +++ b/sys/dev/usbmisc/ugen/ugen.c @@ -2,7 +2,7 @@ * $NetBSD: ugen.c,v 1.27 1999/10/28 12:08:38 augustss Exp $ * $NetBSD: ugen.c,v 1.59 2002/07/11 21:14:28 augustss Exp $ * $FreeBSD: src/sys/dev/usb/ugen.c,v 1.81 2003/11/09 09:17:22 tanimura Exp $ - * $DragonFly: src/sys/dev/usbmisc/ugen/ugen.c,v 1.18 2006/07/28 02:17:39 dillon Exp $ + * $DragonFly: src/sys/dev/usbmisc/ugen/ugen.c,v 1.19 2006/09/05 00:55:43 dillon Exp $ */ /* @@ -461,7 +461,7 @@ ugenopen(struct dev_open_args *ap) isize = UGETW(edesc->wMaxPacketSize); if (isize == 0) /* shouldn't happen */ return (EINVAL); - sce->ibuf = malloc(isize, M_USBDEV, M_WAITOK); + sce->ibuf = kmalloc(isize, M_USBDEV, M_WAITOK); DPRINTFN(5, ("ugenopen: intr endpt=%d,isize=%d\n", endpt, isize)); if (clalloc(&sce->q, UGEN_IBSIZE, 0) == -1) @@ -472,7 +472,7 @@ ugenopen(struct dev_open_args *ap) sce->ibuf, isize, ugenintr, USBD_DEFAULT_INTERVAL); if (err) { - free(sce->ibuf, M_USBDEV); + kfree(sce->ibuf, M_USBDEV); clfree(&sce->q); return (EIO); } @@ -499,7 +499,7 @@ ugenopen(struct dev_open_args *ap) err = usbd_open_pipe(sce->iface, edesc->bEndpointAddress, 0, &sce->pipeh); if (err) { - free(sce->ibuf, M_USBDEV); + kfree(sce->ibuf, M_USBDEV); return (EIO); } for(i = 0; i < UGEN_NISOREQS; ++i) { @@ -593,7 +593,7 @@ ugenclose(struct dev_close_args *ap) } if (sce->ibuf != NULL) { - free(sce->ibuf, M_USBDEV); + kfree(sce->ibuf, M_USBDEV); sce->ibuf = NULL; clfree(&sce->q); } @@ -1129,7 +1129,7 @@ ugen_get_cdesc(struct ugen_softc *sc, int index, int *lenp) len = UGETW(tdesc->wTotalLength); if (lenp) *lenp = len; - cdesc = malloc(len, M_TEMP, M_INTWAIT); + cdesc = kmalloc(len, M_TEMP, M_INTWAIT); memcpy(cdesc, tdesc, len); DPRINTFN(5,("ugen_get_cdesc: current, len=%d\n", len)); } else { @@ -1140,10 +1140,10 @@ ugen_get_cdesc(struct ugen_softc *sc, int index, int *lenp) DPRINTFN(5,("ugen_get_cdesc: index=%d, len=%d\n", index, len)); if (lenp) *lenp = len; - cdesc = malloc(len, M_TEMP, M_INTWAIT); + cdesc = kmalloc(len, M_TEMP, M_INTWAIT); err = usbd_get_config_desc_full(sc->sc_udev, index, cdesc, len); if (err) { - free(cdesc, M_TEMP); + kfree(cdesc, M_TEMP); return (0); } } @@ -1270,11 +1270,11 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd, return (EINVAL); idesc = usbd_find_idesc(cdesc, ai->uai_interface_index, 0); if (idesc == NULL) { - free(cdesc, M_TEMP); + kfree(cdesc, M_TEMP); return (EINVAL); } ai->uai_alt_no = usbd_get_no_alts(cdesc, idesc->bInterfaceNumber); - free(cdesc, M_TEMP); + kfree(cdesc, M_TEMP); break; case USB_GET_DEVICE_DESC: *(usb_device_descriptor_t *)addr = @@ -1286,7 +1286,7 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd, if (cdesc == NULL) return (EINVAL); cd->ucd_desc = *cdesc; - free(cdesc, M_TEMP); + kfree(cdesc, M_TEMP); break; case USB_GET_INTERFACE_DESC: id = (struct usb_interface_desc *)addr; @@ -1300,11 +1300,11 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd, alt = id->uid_alt_index; idesc = usbd_find_idesc(cdesc, id->uid_interface_index, alt); if (idesc == NULL) { - free(cdesc, M_TEMP); + kfree(cdesc, M_TEMP); return (EINVAL); } id->uid_desc = *idesc; - free(cdesc, M_TEMP); + kfree(cdesc, M_TEMP); break; case USB_GET_ENDPOINT_DESC: ed = (struct usb_endpoint_desc *)addr; @@ -1319,11 +1319,11 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd, edesc = usbd_find_edesc(cdesc, ed->ued_interface_index, alt, ed->ued_endpoint_index); if (edesc == NULL) { - free(cdesc, M_TEMP); + kfree(cdesc, M_TEMP); return (EINVAL); } ed->ued_desc = *edesc; - free(cdesc, M_TEMP); + kfree(cdesc, M_TEMP); break; case USB_GET_FULL_DESC: { @@ -1346,7 +1346,7 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd, uio.uio_rw = UIO_READ; uio.uio_procp = curthread; error = uiomove((void *)cdesc, len, &uio); - free(cdesc, M_TEMP); + kfree(cdesc, M_TEMP); return (error); } case USB_GET_STRING_DESC: @@ -1391,7 +1391,7 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd, ur->ucr_request.bmRequestType & UT_READ ? UIO_READ : UIO_WRITE; uio.uio_td = curthread; - ptr = malloc(len, M_TEMP, M_WAITOK); + ptr = kmalloc(len, M_TEMP, M_WAITOK); if (uio.uio_rw == UIO_WRITE) { error = uiomove(ptr, len, &uio); if (error) @@ -1414,7 +1414,7 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd, } ret: if (ptr) - free(ptr, M_TEMP); + kfree(ptr, M_TEMP); return (error); } case USB_GET_DEVICEINFO: diff --git a/sys/dev/usbmisc/ugen/ugenbuf.c b/sys/dev/usbmisc/ugen/ugenbuf.c index d565883f05..c4ab2f8123 100644 --- a/sys/dev/usbmisc/ugen/ugenbuf.c +++ b/sys/dev/usbmisc/ugen/ugenbuf.c @@ -32,7 +32,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/dev/usbmisc/ugen/ugenbuf.c,v 1.2 2004/07/08 16:18:10 dillon Exp $ + * $DragonFly: src/sys/dev/usbmisc/ugen/ugenbuf.c,v 1.3 2006/09/05 00:55:43 dillon Exp $ */ #include @@ -65,11 +65,11 @@ getugenbuf(int reqsize, int *bsize) buf = ugencache_buf; if (buf == NULL) { - buf = malloc(reqsize, M_UGENBUF, M_WAITOK); + buf = kmalloc(reqsize, M_UGENBUF, M_WAITOK); } else if (ugencache_size != reqsize) { ugencache_buf = NULL; - free(buf, M_UGENBUF); - buf = malloc(reqsize, M_UGENBUF, M_WAITOK); + kfree(buf, M_UGENBUF); + buf = kmalloc(reqsize, M_UGENBUF, M_WAITOK); } else { buf = ugencache_buf; ugencache_buf = NULL; @@ -90,7 +90,7 @@ relugenbuf(void *buf, int bsize) ugencache_buf = buf; ugencache_size = bsize; } else { - free(buf, M_UGENBUF); + kfree(buf, M_UGENBUF); } } diff --git a/sys/dev/usbmisc/uhid/uhid.c b/sys/dev/usbmisc/uhid/uhid.c index de4ecabe28..d0c9ae6bf2 100644 --- a/sys/dev/usbmisc/uhid/uhid.c +++ b/sys/dev/usbmisc/uhid/uhid.c @@ -1,7 +1,7 @@ /* * $NetBSD: uhid.c,v 1.46 2001/11/13 06:24:55 lukem Exp $ * $FreeBSD: src/sys/dev/usb/uhid.c,v 1.65 2003/11/09 09:17:22 tanimura Exp $ - * $DragonFly: src/sys/dev/usbmisc/uhid/uhid.c,v 1.17 2006/09/03 18:29:16 dillon Exp $ + * $DragonFly: src/sys/dev/usbmisc/uhid/uhid.c,v 1.18 2006/09/05 00:55:43 dillon Exp $ */ /* Also already merged from NetBSD: @@ -239,7 +239,7 @@ USB_ATTACH(uhid) uaa->revision == 0x???? */) { /* XXX should use revision */ /* The report descriptor for the Wacom Graphire is broken. */ size = sizeof uhid_graphire_report_descr; - desc = malloc(size, M_USBDEV, M_INTWAIT); + desc = kmalloc(size, M_USBDEV, M_INTWAIT); err = USBD_NORMAL_COMPLETION; memcpy(desc, uhid_graphire_report_descr, size); } else { @@ -332,7 +332,7 @@ USB_DETACH(uhid) #endif if (sc->sc_repdesc) - free(sc->sc_repdesc, M_USBDEV); + kfree(sc->sc_repdesc, M_USBDEV); return (0); } @@ -404,8 +404,8 @@ uhidopen(struct dev_open_args *ap) return (ENOMEM); } - sc->sc_ibuf = malloc(sc->sc_isize, M_USBDEV, M_WAITOK); - sc->sc_obuf = malloc(sc->sc_osize, M_USBDEV, M_WAITOK); + sc->sc_ibuf = kmalloc(sc->sc_isize, M_USBDEV, M_WAITOK); + sc->sc_obuf = kmalloc(sc->sc_osize, M_USBDEV, M_WAITOK); /* Set up interrupt pipe. */ err = usbd_open_pipe_intr(sc->sc_iface, sc->sc_ep_addr, @@ -414,8 +414,8 @@ uhidopen(struct dev_open_args *ap) if (err) { DPRINTF(("uhidopen: usbd_open_pipe_intr failed, " "error=%d\n",err)); - free(sc->sc_ibuf, M_USBDEV); - free(sc->sc_obuf, M_USBDEV); + kfree(sc->sc_ibuf, M_USBDEV); + kfree(sc->sc_obuf, M_USBDEV); sc->sc_ibuf = sc->sc_obuf = NULL; sc->sc_state &= ~UHID_OPEN; @@ -447,8 +447,8 @@ uhidclose(struct dev_close_args *ap) ndflush(&sc->sc_q, sc->sc_q.c_cc); clfree(&sc->sc_q); - free(sc->sc_ibuf, M_USBDEV); - free(sc->sc_obuf, M_USBDEV); + kfree(sc->sc_ibuf, M_USBDEV); + kfree(sc->sc_obuf, M_USBDEV); sc->sc_ibuf = sc->sc_obuf = NULL; sc->sc_state &= ~UHID_OPEN; diff --git a/sys/dev/usbmisc/ukbd/ukbd.c b/sys/dev/usbmisc/ukbd/ukbd.c index 06c5741bcc..2d53191242 100644 --- a/sys/dev/usbmisc/ukbd/ukbd.c +++ b/sys/dev/usbmisc/ukbd/ukbd.c @@ -1,6 +1,6 @@ /* * $FreeBSD: src/sys/dev/usb/ukbd.c,v 1.45 2003/10/04 21:41:01 joe Exp $ - * $DragonFly: src/sys/dev/usbmisc/ukbd/ukbd.c,v 1.15 2006/02/28 18:48:01 dillon Exp $ + * $DragonFly: src/sys/dev/usbmisc/ukbd/ukbd.c,v 1.16 2006/09/05 00:55:44 dillon Exp $ */ /* @@ -535,23 +535,23 @@ ukbd_init(int unit, keyboard_t **kbdp, void *arg, int flags) fkeymap_size = sizeof(default_fkeytab)/sizeof(default_fkeytab[0]); } else if (*kbdp == NULL) { - *kbdp = kbd = malloc(sizeof(*kbd), M_DEVBUF, M_INTWAIT | M_ZERO); - state = malloc(sizeof(*state), M_DEVBUF, M_INTWAIT); - keymap = malloc(sizeof(key_map), M_DEVBUF, M_INTWAIT); - accmap = malloc(sizeof(accent_map), M_DEVBUF, M_INTWAIT); - fkeymap = malloc(sizeof(fkey_tab), M_DEVBUF, M_INTWAIT); + *kbdp = kbd = kmalloc(sizeof(*kbd), M_DEVBUF, M_INTWAIT | M_ZERO); + state = kmalloc(sizeof(*state), M_DEVBUF, M_INTWAIT); + keymap = kmalloc(sizeof(key_map), M_DEVBUF, M_INTWAIT); + accmap = kmalloc(sizeof(accent_map), M_DEVBUF, M_INTWAIT); + fkeymap = kmalloc(sizeof(fkey_tab), M_DEVBUF, M_INTWAIT); fkeymap_size = sizeof(fkey_tab)/sizeof(fkey_tab[0]); if ((state == NULL) || (keymap == NULL) || (accmap == NULL) || (fkeymap == NULL)) { if (state != NULL) - free(state, M_DEVBUF); + kfree(state, M_DEVBUF); if (keymap != NULL) - free(keymap, M_DEVBUF); + kfree(keymap, M_DEVBUF); if (accmap != NULL) - free(accmap, M_DEVBUF); + kfree(accmap, M_DEVBUF); if (fkeymap != NULL) - free(fkeymap, M_DEVBUF); - free(kbd, M_DEVBUF); + kfree(fkeymap, M_DEVBUF); + kfree(kbd, M_DEVBUF); return ENOMEM; } } else if (KBD_IS_INITIALIZED(*kbdp) && KBD_IS_CONFIGURED(*kbdp)) { @@ -682,11 +682,11 @@ ukbd_term(keyboard_t *kbd) if (error == 0) { kbd->kb_flags = 0; if (kbd != &default_kbd) { - free(kbd->kb_keymap, M_DEVBUF); - free(kbd->kb_accentmap, M_DEVBUF); - free(kbd->kb_fkeytab, M_DEVBUF); - free(state, M_DEVBUF); - free(kbd, M_DEVBUF); + kfree(kbd->kb_keymap, M_DEVBUF); + kfree(kbd->kb_accentmap, M_DEVBUF); + kfree(kbd->kb_fkeytab, M_DEVBUF); + kfree(state, M_DEVBUF); + kfree(kbd, M_DEVBUF); } } crit_exit(); diff --git a/sys/dev/usbmisc/umass/umass.c b/sys/dev/usbmisc/umass/umass.c index 89ae4f1da9..47f12496c9 100644 --- a/sys/dev/usbmisc/umass/umass.c +++ b/sys/dev/usbmisc/umass/umass.c @@ -26,7 +26,7 @@ * * $NetBSD: umass.c,v 1.28 2000/04/02 23:46:53 augustss Exp $ * $FreeBSD: src/sys/dev/usb/umass.c,v 1.96 2003/12/19 12:19:11 sanpei Exp $ - * $DragonFly: src/sys/dev/usbmisc/umass/umass.c,v 1.17 2006/05/03 15:08:43 dillon Exp $ + * $DragonFly: src/sys/dev/usbmisc/umass/umass.c,v 1.18 2006/09/05 00:55:44 dillon Exp $ */ /* @@ -2181,7 +2181,7 @@ umass_cam_rescan_callback(struct cam_periph *periph, union ccb *ccb) #endif xpt_free_path(ccb->ccb_h.path); - free(ccb, M_USBDEV); + kfree(ccb, M_USBDEV); } Static void @@ -2191,7 +2191,7 @@ umass_cam_rescan(void *addr) struct cam_path *path; union ccb *ccb; - ccb = malloc(sizeof(union ccb), M_USBDEV, M_INTWAIT|M_ZERO); + ccb = kmalloc(sizeof(union ccb), M_USBDEV, M_INTWAIT|M_ZERO); DPRINTF(UDMASS_SCSI, ("scbus%d: scanning for %s:%d:%d:%d\n", cam_sim_path(sc->umass_sim), @@ -2201,7 +2201,7 @@ umass_cam_rescan(void *addr) if (xpt_create_path(&path, xpt_periph, cam_sim_path(sc->umass_sim), CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { - free(ccb, M_USBDEV); + kfree(ccb, M_USBDEV); return; } diff --git a/sys/dev/usbmisc/umct/umct.c b/sys/dev/usbmisc/umct/umct.c index 0473916096..4a986b0892 100644 --- a/sys/dev/usbmisc/umct/umct.c +++ b/sys/dev/usbmisc/umct/umct.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/usb/umct.c,v 1.5 2003/11/16 12:13:39 akiyama Exp $ - * $DragonFly: src/sys/dev/usbmisc/umct/umct.c,v 1.3 2004/03/15 02:27:57 dillon Exp $ + * $DragonFly: src/sys/dev/usbmisc/umct/umct.c,v 1.4 2006/09/05 00:55:44 dillon Exp $ */ /* @@ -169,7 +169,7 @@ USB_ATTACH(umct) int i; dev = uaa->device; - devinfo = malloc(1024, M_USBDEV, M_INTWAIT | M_ZERO); + devinfo = kmalloc(1024, M_USBDEV, M_INTWAIT | M_ZERO); bzero(sc, sizeof(struct umct_softc)); ucom = &sc->sc_ucom; ucom->sc_dev = self; @@ -273,11 +273,11 @@ USB_ATTACH(umct) swi_add(&umct_ithd, "ucom", umct_notify, sc, SWI_TTY, 0, &sc->sc_swicookie); - free(devinfo, M_USBDEV); + kfree(devinfo, M_USBDEV); USB_ATTACH_SUCCESS_RETURN; error: - free(devinfo, M_USBDEV); + kfree(devinfo, M_USBDEV); USB_ATTACH_ERROR_RETURN; } @@ -289,7 +289,7 @@ USB_DETACH(umct) if (sc->sc_intr_pipe != NULL) { usbd_abort_pipe(sc->sc_intr_pipe); usbd_close_pipe(sc->sc_intr_pipe); - free(sc->sc_intr_buf, M_USBDEV); + kfree(sc->sc_intr_buf, M_USBDEV); sc->sc_intr_pipe = NULL; } @@ -471,7 +471,7 @@ umct_open(void *addr, int portno) } if (sc->sc_intr_number != -1 && sc->sc_intr_pipe == NULL) { - sc->sc_intr_buf = malloc(sc->sc_isize, M_USBDEV, M_WAITOK); + sc->sc_intr_buf = kmalloc(sc->sc_isize, M_USBDEV, M_WAITOK); err = usbd_open_pipe_intr(sc->sc_intr_iface, sc->sc_intr_number, USBD_SHORT_XFER_OK, &sc->sc_intr_pipe, sc, sc->sc_intr_buf, sc->sc_isize, umct_intr, UMCT_INTR_INTERVAL); @@ -479,7 +479,7 @@ umct_open(void *addr, int portno) printf("%s: cannot open interrupt pipe (addr %d)\n", USBDEVNAME(sc->sc_ucom.sc_dev), sc->sc_intr_number); - free(sc->sc_intr_buf, M_USBDEV); + kfree(sc->sc_intr_buf, M_USBDEV); return (EIO); } } @@ -506,7 +506,7 @@ umct_close(void *addr, int portno) if (err) printf("%s: close interrupt pipe failed: %s\n", USBDEVNAME(sc->sc_ucom.sc_dev), usbd_errstr(err)); - free(sc->sc_intr_buf, M_USBDEV); + kfree(sc->sc_intr_buf, M_USBDEV); sc->sc_intr_pipe = NULL; } } diff --git a/sys/dev/usbmisc/umodem/umodem.c b/sys/dev/usbmisc/umodem/umodem.c index 3ab9da7cba..f2afa34ca5 100644 --- a/sys/dev/usbmisc/umodem/umodem.c +++ b/sys/dev/usbmisc/umodem/umodem.c @@ -2,7 +2,7 @@ * $NetBSD: umodem.c,v 1.5 1999/01/08 11:58:25 augustss Exp $ * $NetBSD: umodem.c,v 1.45 2002/09/23 05:51:23 simonb Exp $ * $FreeBSD: src/sys/dev/usb/umodem.c,v 1.48 2003/08/24 17:55:55 obrien Exp $ - * $DragonFly: src/sys/dev/usbmisc/umodem/umodem.c,v 1.10 2004/03/15 02:27:57 dillon Exp $ + * $DragonFly: src/sys/dev/usbmisc/umodem/umodem.c,v 1.11 2006/09/05 00:55:44 dillon Exp $ */ /*- @@ -250,7 +250,7 @@ USB_ATTACH(umodem) int i; struct ucom_softc *ucom; - devinfo = malloc(1024, M_USBDEV, M_INTWAIT); + devinfo = kmalloc(1024, M_USBDEV, M_INTWAIT); usbd_devinfo(dev, 0, devinfo); ucom = &sc->sc_ucom; ucom->sc_dev = self; @@ -389,12 +389,12 @@ USB_ATTACH(umodem) ucom_attach(&sc->sc_ucom); - free(devinfo, M_USBDEV); + kfree(devinfo, M_USBDEV); USB_ATTACH_SUCCESS_RETURN; bad: ucom->sc_dying = 1; - free(devinfo, M_USBDEV); + kfree(devinfo, M_USBDEV); USB_ATTACH_ERROR_RETURN; } diff --git a/sys/dev/usbmisc/ums/ums.c b/sys/dev/usbmisc/ums/ums.c index 1ee1b345f6..f0d5d5676f 100644 --- a/sys/dev/usbmisc/ums/ums.c +++ b/sys/dev/usbmisc/ums/ums.c @@ -1,6 +1,6 @@ /* * $FreeBSD: src/sys/dev/usb/ums.c,v 1.64 2003/11/09 09:17:22 tanimura Exp $ - * $DragonFly: src/sys/dev/usbmisc/ums/ums.c,v 1.17 2006/07/28 02:17:39 dillon Exp $ + * $DragonFly: src/sys/dev/usbmisc/ums/ums.c,v 1.18 2006/09/05 00:55:44 dillon Exp $ */ /* @@ -189,7 +189,7 @@ USB_MATCH(ums) else ret = UMATCH_NONE; - free(desc, M_TEMP); + kfree(desc, M_TEMP); return (ret); } @@ -292,10 +292,10 @@ USB_ATTACH(ums) hid_input, &sc->sc_loc_btn[i-1], 0); sc->sc_isize = hid_report_size(desc, size, hid_input, &sc->sc_iid); - sc->sc_ibuf = malloc(sc->sc_isize, M_USB, M_INTWAIT); + sc->sc_ibuf = kmalloc(sc->sc_isize, M_USB, M_INTWAIT); sc->sc_ep_addr = ed->bEndpointAddress; sc->sc_disconnected = 0; - free(desc, M_TEMP); + kfree(desc, M_TEMP); #ifdef USB_DEBUG DPRINTF(("ums_attach: sc=%p\n", sc)); @@ -363,8 +363,8 @@ ums_detach(device_t self) DPRINTF(("%s: disconnected\n", USBDEVNAME(self))); - free(sc->sc_loc_btn, M_USB); - free(sc->sc_ibuf, M_USB); + kfree(sc->sc_loc_btn, M_USB); + kfree(sc->sc_ibuf, M_USB); /* someone waiting for data */ /* diff --git a/sys/dev/usbmisc/uplcom/uplcom.c b/sys/dev/usbmisc/uplcom/uplcom.c index 5976e9e725..025a62d793 100644 --- a/sys/dev/usbmisc/uplcom/uplcom.c +++ b/sys/dev/usbmisc/uplcom/uplcom.c @@ -1,7 +1,7 @@ /* * $NetBSD: uplcom.c,v 1.21 2001/11/13 06:24:56 lukem Exp $ * $FreeBSD: src/sys/dev/usb/uplcom.c,v 1.17 2003/11/16 13:13:16 akiyama Exp $ - * $DragonFly: src/sys/dev/usbmisc/uplcom/uplcom.c,v 1.7 2004/03/15 02:27:57 dillon Exp $ + * $DragonFly: src/sys/dev/usbmisc/uplcom/uplcom.c,v 1.8 2006/09/05 00:55:44 dillon Exp $ */ /*- @@ -294,7 +294,7 @@ USB_ATTACH(uplcom) usbd_status err; int i; - devinfo = malloc(1024, M_USBDEV, M_INTWAIT); + devinfo = kmalloc(1024, M_USBDEV, M_INTWAIT); ucom = &sc->sc_ucom; bzero(sc, sizeof (struct uplcom_softc)); @@ -463,11 +463,11 @@ USB_ATTACH(uplcom) ucom_attach(&sc->sc_ucom); - free(devinfo, M_USBDEV); + kfree(devinfo, M_USBDEV); USB_ATTACH_SUCCESS_RETURN; error: - free(devinfo, M_USBDEV); + kfree(devinfo, M_USBDEV); USB_ATTACH_ERROR_RETURN; } @@ -481,7 +481,7 @@ USB_DETACH(uplcom) if (sc->sc_intr_pipe != NULL) { usbd_abort_pipe(sc->sc_intr_pipe); usbd_close_pipe(sc->sc_intr_pipe); - free(sc->sc_intr_buf, M_USBDEV); + kfree(sc->sc_intr_buf, M_USBDEV); sc->sc_intr_pipe = NULL; } @@ -719,7 +719,7 @@ uplcom_open(void *addr, int portno) if (sc->sc_intr_number != -1 && sc->sc_intr_pipe == NULL) { sc->sc_status = 0; /* clear status bit */ - sc->sc_intr_buf = malloc(sc->sc_isize, M_USBDEV, M_WAITOK); + sc->sc_intr_buf = kmalloc(sc->sc_isize, M_USBDEV, M_WAITOK); err = usbd_open_pipe_intr(sc->sc_intr_iface, sc->sc_intr_number, USBD_SHORT_XFER_OK, @@ -762,7 +762,7 @@ uplcom_close(void *addr, int portno) printf("%s: close interrupt pipe failed: %s\n", USBDEVNAME(sc->sc_ucom.sc_dev), usbd_errstr(err)); - free(sc->sc_intr_buf, M_USBDEV); + kfree(sc->sc_intr_buf, M_USBDEV); sc->sc_intr_pipe = NULL; } } diff --git a/sys/dev/usbmisc/urio/urio.c b/sys/dev/usbmisc/urio/urio.c index ff801190e0..35e404748b 100644 --- a/sys/dev/usbmisc/urio/urio.c +++ b/sys/dev/usbmisc/urio/urio.c @@ -30,7 +30,7 @@ /* * $FreeBSD: src/sys/dev/usb/urio.c,v 1.28 2003/08/25 22:01:06 joe Exp $ - * $DragonFly: src/sys/dev/usbmisc/urio/urio.c,v 1.12 2006/07/28 02:17:39 dillon Exp $ + * $DragonFly: src/sys/dev/usbmisc/urio/urio.c,v 1.13 2006/09/05 00:55:44 dillon Exp $ */ /* @@ -561,7 +561,7 @@ urioioctl(struct dev_ioctl_args *ap) req.bmRequestType & UT_READ ? UIO_READ : UIO_WRITE; uio.uio_td = curthread; - ptr = malloc(len, M_TEMP, M_WAITOK); + ptr = kmalloc(len, M_TEMP, M_WAITOK); if (uio.uio_rw == UIO_WRITE) { error = uiomove(ptr, len, &uio); if (error) @@ -585,7 +585,7 @@ urioioctl(struct dev_ioctl_args *ap) ret: if (ptr) - free(ptr, M_TEMP); + kfree(ptr, M_TEMP); return error; } diff --git a/sys/dev/usbmisc/uscanner/uscanner.c b/sys/dev/usbmisc/uscanner/uscanner.c index beccda8c0a..54d33cfdb0 100644 --- a/sys/dev/usbmisc/uscanner/uscanner.c +++ b/sys/dev/usbmisc/uscanner/uscanner.c @@ -1,7 +1,7 @@ /* * $NetBSD: uscanner.c,v 1.30 2002/07/11 21:14:36 augustss Exp $ * $FreeBSD: src/sys/dev/usb/uscanner.c,v 1.48 2003/12/22 19:58:27 sanpei Exp $ - * $DragonFly: src/sys/dev/usbmisc/uscanner/uscanner.c,v 1.12 2006/07/28 02:17:39 dillon Exp $ + * $DragonFly: src/sys/dev/usbmisc/uscanner/uscanner.c,v 1.13 2006/09/05 00:55:44 dillon Exp $ */ /* Also already merged from NetBSD: @@ -393,8 +393,8 @@ uscanneropen(struct dev_open_args *ap) sc->sc_state |= USCANNER_OPEN; - sc->sc_bulkin_buffer = malloc(USCANNER_BUFFERSIZE, M_USBDEV, M_WAITOK); - sc->sc_bulkout_buffer = malloc(USCANNER_BUFFERSIZE, M_USBDEV, M_WAITOK); + sc->sc_bulkin_buffer = kmalloc(USCANNER_BUFFERSIZE, M_USBDEV, M_WAITOK); + sc->sc_bulkout_buffer = kmalloc(USCANNER_BUFFERSIZE, M_USBDEV, M_WAITOK); /* No need to check buffers for NULL since we have WAITOK */ sc->sc_bulkin_bufferlen = USCANNER_BUFFERSIZE; @@ -485,11 +485,11 @@ uscanner_do_close(struct uscanner_softc *sc) } if (sc->sc_bulkin_buffer) { - free(sc->sc_bulkin_buffer, M_USBDEV); + kfree(sc->sc_bulkin_buffer, M_USBDEV); sc->sc_bulkin_buffer = NULL; } if (sc->sc_bulkout_buffer) { - free(sc->sc_bulkout_buffer, M_USBDEV); + kfree(sc->sc_bulkout_buffer, M_USBDEV); sc->sc_bulkout_buffer = NULL; } diff --git a/sys/dev/usbmisc/uvisor/uvisor.c b/sys/dev/usbmisc/uvisor/uvisor.c index 2266d1af4c..546f31d747 100644 --- a/sys/dev/usbmisc/uvisor/uvisor.c +++ b/sys/dev/usbmisc/uvisor/uvisor.c @@ -1,7 +1,7 @@ /* * $NetBSD: uvisor.c,v 1.9 2001/01/23 14:04:14 augustss Exp $ * $FreeBSD: src/sys/dev/usb/uvisor.c,v 1.16 2003/11/08 11:23:07 joe Exp $ - * $DragonFly: src/sys/dev/usbmisc/uvisor/uvisor.c,v 1.7 2004/03/15 02:27:57 dillon Exp $ + * $DragonFly: src/sys/dev/usbmisc/uvisor/uvisor.c,v 1.8 2006/09/05 00:55:44 dillon Exp $ */ /* @@ -256,7 +256,7 @@ USB_ATTACH(uvisor) usbd_status err; struct ucom_softc *ucom; - devinfo = malloc(1024, M_USBDEV, M_INTWAIT); + devinfo = kmalloc(1024, M_USBDEV, M_INTWAIT); ucom = &sc->sc_ucom; bzero(sc, sizeof (struct uvisor_softc)); diff --git a/sys/dev/usbmisc/uvscom/uvscom.c b/sys/dev/usbmisc/uvscom/uvscom.c index 9d6121b28f..9b03064377 100644 --- a/sys/dev/usbmisc/uvscom/uvscom.c +++ b/sys/dev/usbmisc/uvscom/uvscom.c @@ -25,7 +25,7 @@ * * $NetBSD: usb/uvscom.c,v 1.1 2002/03/19 15:08:42 augustss Exp $ * $FreeBSD: src/sys/dev/usb/uvscom.c,v 1.19 2003/11/16 12:26:10 akiyama Exp $ - * $DragonFly: src/sys/dev/usbmisc/uvscom/uvscom.c,v 1.7 2004/03/15 02:27:57 dillon Exp $ + * $DragonFly: src/sys/dev/usbmisc/uvscom/uvscom.c,v 1.8 2006/09/05 00:55:44 dillon Exp $ */ /* @@ -266,7 +266,7 @@ USB_ATTACH(uvscom) usbd_status err; int i; - devinfo = malloc(1024, M_USBDEV, M_INTWAIT); + devinfo = kmalloc(1024, M_USBDEV, M_INTWAIT); ucom = &sc->sc_ucom; bzero(sc, sizeof (struct uvscom_softc)); @@ -382,12 +382,12 @@ USB_ATTACH(uvscom) ucom_attach(&sc->sc_ucom); - free(devinfo, M_USBDEV); + kfree(devinfo, M_USBDEV); USB_ATTACH_SUCCESS_RETURN; error: ucom->sc_dying = 1; - free(devinfo, M_USBDEV); + kfree(devinfo, M_USBDEV); USB_ATTACH_ERROR_RETURN; } @@ -403,7 +403,7 @@ USB_DETACH(uvscom) if (sc->sc_intr_pipe != NULL) { usbd_abort_pipe(sc->sc_intr_pipe); usbd_close_pipe(sc->sc_intr_pipe); - free(sc->sc_intr_buf, M_USBDEV); + kfree(sc->sc_intr_buf, M_USBDEV); sc->sc_intr_pipe = NULL; } @@ -729,7 +729,7 @@ uvscom_open(void *addr, int portno) return (ENXIO); } - sc->sc_intr_buf = malloc(sc->sc_isize, M_USBDEV, M_WAITOK); + sc->sc_intr_buf = kmalloc(sc->sc_isize, M_USBDEV, M_WAITOK); err = usbd_open_pipe_intr(sc->sc_ucom.sc_iface, sc->sc_intr_number, USBD_SHORT_XFER_OK, @@ -798,7 +798,7 @@ uvscom_close(void *addr, int portno) printf("%s: close interrupt pipe failed: %s\n", USBDEVNAME(sc->sc_ucom.sc_dev), usbd_errstr(err)); - free(sc->sc_intr_buf, M_USBDEV); + kfree(sc->sc_intr_buf, M_USBDEV); sc->sc_intr_pipe = NULL; } } diff --git a/sys/dev/video/bktr/msp34xx.c b/sys/dev/video/bktr/msp34xx.c index 385e5a6940..a5d88e565d 100644 --- a/sys/dev/video/bktr/msp34xx.c +++ b/sys/dev/video/bktr/msp34xx.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/bktr/msp34xx.c,v 1.5 2004/12/16 23:19:57 julian Exp - * $DragonFly: src/sys/dev/video/bktr/msp34xx.c,v 1.3 2005/03/12 11:35:27 corecode Exp $ + * $DragonFly: src/sys/dev/video/bktr/msp34xx.c,v 1.4 2006/09/05 00:55:44 dillon Exp $ */ /* @@ -1137,7 +1137,7 @@ int msp_attach(bktr_ptr_t bktr) int err; char buf[20]; - msp = (struct msp3400c *) malloc(sizeof(struct msp3400c), M_DEVBUF, M_NOWAIT); + msp = (struct msp3400c *) kmalloc(sizeof(struct msp3400c), M_DEVBUF, M_NOWAIT); if (msp == NULL) return ENOMEM; bktr->msp3400c_info = msp; @@ -1148,9 +1148,9 @@ int msp_attach(bktr_ptr_t bktr) msp->bass = 32768; msp->treble = 32768; msp->input = -1; - msp->threaddesc = malloc(15 * sizeof(char), M_DEVBUF, M_NOWAIT); + msp->threaddesc = kmalloc(15 * sizeof(char), M_DEVBUF, M_NOWAIT); if (msp->threaddesc == NULL) { - free(msp, M_DEVBUF); + kfree(msp, M_DEVBUF); return ENOMEM; } snprintf(msp->threaddesc, 14, "%s_msp34xx_thread", bktr->bktr_xname); @@ -1164,8 +1164,8 @@ int msp_attach(bktr_ptr_t bktr) if (-1 != rev1) rev2 = msp3400c_read(bktr, I2C_MSP3400C_DFP, 0x1f); if ((-1 == rev1) || (0 == rev1 && 0 == rev2)) { - free(msp->threaddesc, M_DEVBUF); - free(msp, M_DEVBUF); + kfree(msp->threaddesc, M_DEVBUF); + kfree(msp, M_DEVBUF); bktr->msp3400c_info = NULL; printf("%s: msp3400: error while reading chip version\n", bktr_name(bktr)); return ENXIO; @@ -1202,8 +1202,8 @@ int msp_attach(bktr_ptr_t bktr) bktr, &msp->kthread, msp->threaddesc); if (err) { printf("%s: Error returned by kthread_create: %d", bktr_name(bktr), err); - free(msp->threaddesc, M_DEVBUF); - free(msp, M_DEVBUF); + kfree(msp->threaddesc, M_DEVBUF); + kfree(msp, M_DEVBUF); bktr->msp3400c_info = NULL; return ENXIO; } @@ -1230,7 +1230,7 @@ int msp_detach(bktr_ptr_t client) } if (client->msp3400c_info != NULL) { - free(client->msp3400c_info, M_DEVBUF); + kfree(client->msp3400c_info, M_DEVBUF); client->msp3400c_info = NULL; } diff --git a/sys/dev/video/ctx/ctx.c b/sys/dev/video/ctx/ctx.c index a25856a6ef..238ce21a4d 100644 --- a/sys/dev/video/ctx/ctx.c +++ b/sys/dev/video/ctx/ctx.c @@ -9,7 +9,7 @@ * for damages incurred with its use. * * $FreeBSD: src/sys/i386/isa/ctx.c,v 1.36 2000/01/29 16:17:31 peter Exp $ - * $DragonFly: src/sys/dev/video/ctx/ctx.c,v 1.9 2006/07/28 02:17:39 dillon Exp $ + * $DragonFly: src/sys/dev/video/ctx/ctx.c,v 1.10 2006/09/05 00:55:44 dillon Exp $ */ /* @@ -220,7 +220,7 @@ ctxopen(struct dev_open_args *ap) /* get space for the LUT buffer */ - sr->lutp = malloc(LUTSIZE, M_DEVBUF, M_WAITOK); + sr->lutp = kmalloc(LUTSIZE, M_DEVBUF, M_WAITOK); if (sr->lutp == NULL) return (ENOMEM); @@ -263,7 +263,7 @@ ctxclose(struct dev_close_args *ap) unit = UNIT(minor(dev)); ctx_sr[unit].flag = 0; - free(ctx_sr[unit].lutp, M_DEVBUF); + kfree(ctx_sr[unit].lutp, M_DEVBUF); ctx_sr[unit].lutp = NULL; return (0); } diff --git a/sys/dev/video/fb/fb.c b/sys/dev/video/fb/fb.c index ee1ada2ce1..8c94b8d6c3 100644 --- a/sys/dev/video/fb/fb.c +++ b/sys/dev/video/fb/fb.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/fb/fb.c,v 1.11.2.2 2000/08/02 22:35:22 peter Exp $ - * $DragonFly: src/sys/dev/video/fb/fb.c,v 1.14 2006/07/28 02:17:39 dillon Exp $ + * $DragonFly: src/sys/dev/video/fb/fb.c,v 1.15 2006/09/05 00:55:44 dillon Exp $ */ #include "opt_fb.h" @@ -87,11 +87,11 @@ vid_realloc_array(void) crit_enter(); newsize = ((adapters + ARRAY_DELTA)/ARRAY_DELTA)*ARRAY_DELTA; - new_adp = malloc(sizeof(*new_adp)*newsize, M_DEVBUF, M_WAITOK | M_ZERO); - new_vidsw = malloc(sizeof(*new_vidsw)*newsize, M_DEVBUF, + new_adp = kmalloc(sizeof(*new_adp)*newsize, M_DEVBUF, M_WAITOK | M_ZERO); + new_vidsw = kmalloc(sizeof(*new_vidsw)*newsize, M_DEVBUF, M_WAITOK | M_ZERO); #ifdef FB_INSTALL_CDEV - new_cdevsw = malloc(sizeof(*new_cdevsw)*newsize, M_DEVBUF, + new_cdevsw = kmalloc(sizeof(*new_cdevsw)*newsize, M_DEVBUF, M_WAITOK | M_ZERO); #endif bcopy(adapter, new_adp, sizeof(*adapter)*adapters); @@ -100,10 +100,10 @@ vid_realloc_array(void) bcopy(vidcdevsw, new_cdevsw, sizeof(*vidcdevsw)*adapters); #endif if (adapters > 1) { - free(adapter, M_DEVBUF); - free(vidsw, M_DEVBUF); + kfree(adapter, M_DEVBUF); + kfree(vidsw, M_DEVBUF); #ifdef FB_INSTALL_CDEV - free(vidcdevsw, M_DEVBUF); + kfree(vidcdevsw, M_DEVBUF); #endif } adapter = new_adp; diff --git a/sys/dev/video/fb/splash.c b/sys/dev/video/fb/splash.c index 7397637f92..fa860207c9 100644 --- a/sys/dev/video/fb/splash.c +++ b/sys/dev/video/fb/splash.c @@ -24,7 +24,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/fb/splash.c,v 1.8 2000/01/29 14:42:57 peter Exp $ - * $DragonFly: src/sys/dev/video/fb/splash.c,v 1.3 2003/08/07 21:17:16 dillon Exp $ + * $DragonFly: src/sys/dev/video/fb/splash.c,v 1.4 2006/09/05 00:55:44 dillon Exp $ */ #include @@ -132,7 +132,7 @@ splash_register(splash_decoder_t *decoder) return ENOMEM; if (decoder_set != NULL) { bcopy(decoder_set, p, sizeof(*p)*decoders); - free(decoder_set, M_DEVBUF); + kfree(decoder_set, M_DEVBUF); } decoder_set = p; i = decoders++; diff --git a/sys/dev/video/fb/vga.c b/sys/dev/video/fb/vga.c index 2f90762513..f2b8cd19ed 100644 --- a/sys/dev/video/fb/vga.c +++ b/sys/dev/video/fb/vga.c @@ -27,7 +27,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/fb/vga.c,v 1.9.2.1 2001/08/11 02:58:44 yokota Exp $ - * $DragonFly: src/sys/dev/video/fb/vga.c,v 1.16 2006/07/28 02:17:39 dillon Exp $ + * $DragonFly: src/sys/dev/video/fb/vga.c,v 1.17 2006/09/05 00:55:44 dillon Exp $ */ #include "opt_vga.h" @@ -2826,11 +2826,11 @@ get_palette(video_adapter_t *adp, int base, int count, base + count > 256) return EINVAL; - r = malloc(count*3, M_DEVBUF, M_WAITOK); + r = kmalloc(count*3, M_DEVBUF, M_WAITOK); g = r + count; b = g + count; if (vga_save_palette2(adp, base, count, r, g, b)) { - free(r, M_DEVBUF); + kfree(r, M_DEVBUF); return ENODEV; } copyout(r, red, count); @@ -2840,7 +2840,7 @@ get_palette(video_adapter_t *adp, int base, int count, bzero(r, count); copyout(r, trans, count); } - free(r, M_DEVBUF); + kfree(r, M_DEVBUF); return 0; } @@ -2858,7 +2858,7 @@ set_palette(video_adapter_t *adp, int base, int count, base + count > 256) return EINVAL; - r = malloc(count*3, M_DEVBUF, M_WAITOK); + r = kmalloc(count*3, M_DEVBUF, M_WAITOK); g = r + count; b = g + count; err = copyin(red, r, count); @@ -2868,7 +2868,7 @@ set_palette(video_adapter_t *adp, int base, int count, err = copyin(blue, b, count); if (!err) err = vga_load_palette2(adp, base, count, r, g, b); - free(r, M_DEVBUF); + kfree(r, M_DEVBUF); return (err ? ENODEV : 0); } diff --git a/sys/dev/video/i386/vesa/vesa.c b/sys/dev/video/i386/vesa/vesa.c index feb49d4b03..358b071bc2 100644 --- a/sys/dev/video/i386/vesa/vesa.c +++ b/sys/dev/video/i386/vesa/vesa.c @@ -24,7 +24,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/i386/isa/vesa.c,v 1.32.2.1 2002/08/13 02:42:33 rwatson Exp $ - * $DragonFly: src/sys/dev/video/i386/vesa/vesa.c,v 1.13 2006/01/14 23:04:46 swildner Exp $ + * $DragonFly: src/sys/dev/video/i386/vesa/vesa.c,v 1.14 2006/09/05 00:55:44 dillon Exp $ */ #include "opt_vga.h" @@ -630,7 +630,7 @@ vesa_bios_init(void) vesa_vmode[0].vi_mode = EOT; /* Allocate a buffer and add each page to the vm86 context. */ - vesa_vm86_buf = malloc(VESA_VM86_BUFSIZE, M_DEVBUF, M_WAITOK | M_ZERO); + vesa_vm86_buf = kmalloc(VESA_VM86_BUFSIZE, M_DEVBUF, M_WAITOK | M_ZERO); KASSERT(((vm_offset_t)vesa_vm86_buf & PAGE_MASK) == 0, ("bad vesa_vm86_buf alignment")); for (i = 0; i < howmany(VESA_VM86_BUFSIZE, PAGE_SIZE); i++) @@ -719,7 +719,7 @@ vesa_bios_init(void) #endif if (modes > 0) { bcopy(vesa_vmode, p, sizeof(*vesa_vmode)*modes); - free(vesa_vmode, M_DEVBUF); + kfree(vesa_vmode, M_DEVBUF); } vesa_vmode = p; } @@ -1366,7 +1366,7 @@ get_palette(video_adapter_t *adp, int base, int count, if (bits <= 6) return 1; - r = malloc(count*3, M_DEVBUF, M_WAITOK); + r = kmalloc(count*3, M_DEVBUF, M_WAITOK); g = r + count; b = g + count; error = vesa_bios_save_palette2(base, count, r, g, b, bits); @@ -1379,7 +1379,7 @@ get_palette(video_adapter_t *adp, int base, int count, copyout(r, trans, count); } } - free(r, M_DEVBUF); + kfree(r, M_DEVBUF); /* if error && bits != 6 at this point, we are in in trouble... XXX */ return error; @@ -1403,7 +1403,7 @@ set_palette(video_adapter_t *adp, int base, int count, || ((bits = vesa_bios_set_dac(8)) <= 6)) return 1; - r = malloc(count*3, M_DEVBUF, M_WAITOK); + r = kmalloc(count*3, M_DEVBUF, M_WAITOK); g = r + count; b = g + count; copyin(red, r, count); @@ -1411,7 +1411,7 @@ set_palette(video_adapter_t *adp, int base, int count, copyin(blue, b, count); error = vesa_bios_load_palette2(base, count, r, g, b, bits); - free(r, M_DEVBUF); + kfree(r, M_DEVBUF); if (error == 0) return 0; @@ -1652,7 +1652,7 @@ vesa_unload(void) crit_exit(); if (vesa_vm86_buf != NULL) - free(vesa_vm86_buf, M_DEVBUF); + kfree(vesa_vm86_buf, M_DEVBUF); return error; } diff --git a/sys/emulation/43bsd/43bsd_file.c b/sys/emulation/43bsd/43bsd_file.c index 6d84866a6b..6c2714bbf6 100644 --- a/sys/emulation/43bsd/43bsd_file.c +++ b/sys/emulation/43bsd/43bsd_file.c @@ -37,7 +37,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/emulation/43bsd/43bsd_file.c,v 1.10 2006/06/05 07:26:07 dillon Exp $ + * $DragonFly: src/sys/emulation/43bsd/43bsd_file.c,v 1.11 2006/09/05 00:55:44 dillon Exp $ * from: DragonFly kern/vfs_syscalls.c,v 1.20 * * These syscalls used to live in kern/vfs_syscalls.c. They are modified @@ -140,19 +140,19 @@ sys_ogetdirentries(struct ogetdirentries_args *uap) else len = uap->count; - buf = malloc(len, M_TEMP, M_WAITOK); + buf = kmalloc(len, M_TEMP, M_WAITOK); error = kern_getdirentries(uap->fd, buf, len, &base, &bytes_transfered, UIO_SYSSPACE); if (error) { - free(buf, M_TEMP); + kfree(buf, M_TEMP); return(error); } ndp = (struct dirent *)buf; outbuf = uap->buf; - destdp = malloc(PADDED_SIZE(MAX_NAMELEN), M_TEMP, M_WAITOK); + destdp = kmalloc(PADDED_SIZE(MAX_NAMELEN), M_TEMP, M_WAITOK); for (; (char *)ndp < buf + bytes_transfered; ndp = _DIRENT_NEXT(ndp)) { if ((char *)_DIRENT_NEXT(ndp) > buf + bytes_transfered) @@ -182,8 +182,8 @@ sys_ogetdirentries(struct ogetdirentries_args *uap) len -= PADDED_SIZE(destdp->od_namlen); } - free(destdp, M_TEMP); - free(buf, M_TEMP); + kfree(destdp, M_TEMP); + kfree(buf, M_TEMP); uap->sysmsg_result = outbuf - uap->buf; return (0); } diff --git a/sys/emulation/43bsd/43bsd_hostinfo.c b/sys/emulation/43bsd/43bsd_hostinfo.c index 58a2d56ba1..bb72015e93 100644 --- a/sys/emulation/43bsd/43bsd_hostinfo.c +++ b/sys/emulation/43bsd/43bsd_hostinfo.c @@ -32,7 +32,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/emulation/43bsd/43bsd_hostinfo.c,v 1.3 2006/06/05 07:26:07 dillon Exp $ + * $DragonFly: src/sys/emulation/43bsd/43bsd_hostinfo.c,v 1.4 2006/09/05 00:55:44 dillon Exp $ * from: DragonFly kern/kern_xxx.c,v 1.7 * from: DragonFly kern/kern_sysctl.c,v 1.12 * @@ -60,14 +60,14 @@ sys_ogethostname(struct gethostname_args *uap) name[0] = CTL_KERN; name[1] = KERN_HOSTNAME; len = MIN(uap->len, MAXHOSTNAMELEN); - hostname = malloc(MAXHOSTNAMELEN, M_TEMP, M_WAITOK); + hostname = kmalloc(MAXHOSTNAMELEN, M_TEMP, M_WAITOK); error = kernel_sysctl(name, 2, hostname, &len, NULL, 0, NULL); if (error == 0) error = copyout(hostname, uap->hostname, len); - free(hostname, M_TEMP); + kfree(hostname, M_TEMP); return (error); } @@ -88,17 +88,17 @@ sys_osethostname(struct sethostname_args *uap) if (error) return (error); len = MIN(uap->len, MAXHOSTNAMELEN); - hostname = malloc(MAXHOSTNAMELEN, M_TEMP, M_WAITOK); + hostname = kmalloc(MAXHOSTNAMELEN, M_TEMP, M_WAITOK); error = copyin(uap->hostname, hostname, len); if (error) { - free(hostname, M_TEMP); + kfree(hostname, M_TEMP); return (error); } error = kernel_sysctl(name, 2, NULL, 0, hostname, len, NULL); - free(hostname, M_TEMP); + kfree(hostname, M_TEMP); return (error); } diff --git a/sys/emulation/dragonfly12/dfbsd12_getdirentries.c b/sys/emulation/dragonfly12/dfbsd12_getdirentries.c index eb9a6977f6..168982ea34 100644 --- a/sys/emulation/dragonfly12/dfbsd12_getdirentries.c +++ b/sys/emulation/dragonfly12/dfbsd12_getdirentries.c @@ -31,7 +31,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/emulation/dragonfly12/dfbsd12_getdirentries.c,v 1.2 2006/06/05 07:26:08 dillon Exp $ + * $DragonFly: src/sys/emulation/dragonfly12/dfbsd12_getdirentries.c,v 1.3 2006/09/05 00:55:44 dillon Exp $ */ #include "opt_compatdf12.h" @@ -70,19 +70,19 @@ common_getdirentries(long *base, int *result, int fd, char *usr_buf, size_t coun else len = count; - buf = malloc(len, M_TEMP, M_WAITOK); + buf = kmalloc(len, M_TEMP, M_WAITOK); error = kern_getdirentries(fd, buf, len, base, &bytes_transfered, UIO_SYSSPACE); if (error) { - free(buf, M_TEMP); + kfree(buf, M_TEMP); return(error); } ndp = (struct dirent *)buf; outbuf = usr_buf; - destdp = malloc(PADDED_SIZE(MAX_NAMELEN), M_TEMP, M_WAITOK); + destdp = kmalloc(PADDED_SIZE(MAX_NAMELEN), M_TEMP, M_WAITOK); for (; (char *)ndp < buf + bytes_transfered; ndp = _DIRENT_NEXT(ndp)) { if ((char *)_DIRENT_NEXT(ndp) > buf + bytes_transfered) @@ -107,8 +107,8 @@ common_getdirentries(long *base, int *result, int fd, char *usr_buf, size_t coun len -= PADDED_SIZE(destdp->df12_d_namlen); } - free(destdp, M_TEMP); - free(buf, M_TEMP); + kfree(destdp, M_TEMP); + kfree(buf, M_TEMP); *result = outbuf - usr_buf; return (0); } diff --git a/sys/emulation/linux/i386/linprocfs/linprocfs_vnops.c b/sys/emulation/linux/i386/linprocfs/linprocfs_vnops.c index af3e9e5d55..cc694b2803 100644 --- a/sys/emulation/linux/i386/linprocfs/linprocfs_vnops.c +++ b/sys/emulation/linux/i386/linprocfs/linprocfs_vnops.c @@ -39,7 +39,7 @@ * @(#)procfs_vnops.c 8.18 (Berkeley) 5/21/95 * * $FreeBSD: src/sys/i386/linux/linprocfs/linprocfs_vnops.c,v 1.3.2.5 2001/08/12 14:29:19 rwatson Exp $ - * $DragonFly: src/sys/emulation/linux/i386/linprocfs/linprocfs_vnops.c,v 1.35 2006/09/03 18:29:16 dillon Exp $ + * $DragonFly: src/sys/emulation/linux/i386/linprocfs/linprocfs_vnops.c,v 1.36 2006/09/05 00:55:45 dillon Exp $ */ /* @@ -495,7 +495,7 @@ linprocfs_getattr(struct vop_getattr_args *ap) error = vn_fullpath(procp, NULL, &fullpath, &freepath); if (error == 0) { vap->va_size = strlen(fullpath); - free(freepath, M_TEMP); + kfree(freepath, M_TEMP); } else { vap->va_size = sizeof("unknown") - 1; error = 0; @@ -1053,7 +1053,7 @@ linprocfs_readlink(struct vop_readlink_args *ap) return (uiomove("unknown", sizeof("unknown") - 1, ap->a_uio)); error = uiomove(fullpath, strlen(fullpath), ap->a_uio); - free(freepath, M_TEMP); + kfree(freepath, M_TEMP); return (error); default: return (EINVAL); diff --git a/sys/emulation/linux/i386/linux_sysvec.c b/sys/emulation/linux/i386/linux_sysvec.c index 267d79e497..bf9e581b0f 100644 --- a/sys/emulation/linux/i386/linux_sysvec.c +++ b/sys/emulation/linux/i386/linux_sysvec.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/i386/linux/linux_sysvec.c,v 1.55.2.9 2002/01/12 11:03:30 bde Exp $ - * $DragonFly: src/sys/emulation/linux/i386/linux_sysvec.c,v 1.22 2006/09/03 18:29:16 dillon Exp $ + * $DragonFly: src/sys/emulation/linux/i386/linux_sysvec.c,v 1.23 2006/09/05 00:55:45 dillon Exp $ */ /* XXX we use functions that might not exist. */ @@ -233,7 +233,7 @@ elf_linux_fixup(register_t **stack_base, struct image_params *imgp) AUXARGS_ENTRY(pos, AT_EGID, imgp->proc->p_ucred->cr_svgid); AUXARGS_ENTRY(pos, AT_NULL, 0); - free(imgp->auxargs, M_TEMP); + kfree(imgp->auxargs, M_TEMP); imgp->auxargs = NULL; (*stack_base)--; diff --git a/sys/emulation/linux/linux_file.c b/sys/emulation/linux/linux_file.c index 1a5d021a8a..aa034e8311 100644 --- a/sys/emulation/linux/linux_file.c +++ b/sys/emulation/linux/linux_file.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/compat/linux/linux_file.c,v 1.41.2.6 2003/01/06 09:19:43 fjoe Exp $ - * $DragonFly: src/sys/emulation/linux/linux_file.c,v 1.35 2006/08/19 17:27:20 dillon Exp $ + * $DragonFly: src/sys/emulation/linux/linux_file.c,v 1.36 2006/09/05 00:55:44 dillon Exp $ */ #include "opt_compat.h" @@ -295,7 +295,7 @@ getdents_common(struct linux_getdents64_args *args, int is64bit) buflen = max(LINUX_DIRBLKSIZ, nbytes); buflen = min(buflen, MAXBSIZE); - buf = malloc(buflen, M_TEMP, M_WAITOK); + buf = kmalloc(buflen, M_TEMP, M_WAITOK); again: aiov.iov_base = buf; @@ -309,7 +309,7 @@ again: auio.uio_offset = off; if (cookies) { - free(cookies, M_TEMP); + kfree(cookies, M_TEMP); cookies = NULL; } @@ -432,9 +432,9 @@ eof: out: if (cookies) - free(cookies, M_TEMP); + kfree(cookies, M_TEMP); - free(buf, M_TEMP); + kfree(buf, M_TEMP); done: fdrop(fp); return (error); diff --git a/sys/emulation/linux/linux_getcwd.c b/sys/emulation/linux/linux_getcwd.c index 1287707964..fcd87c7890 100644 --- a/sys/emulation/linux/linux_getcwd.c +++ b/sys/emulation/linux/linux_getcwd.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/compat/linux/linux_getcwd.c,v 1.2.2.3 2001/11/05 19:08:22 marcel Exp $ */ -/* $DragonFly: src/sys/emulation/linux/linux_getcwd.c,v 1.21 2006/06/05 07:26:09 dillon Exp $ */ +/* $DragonFly: src/sys/emulation/linux/linux_getcwd.c,v 1.22 2006/09/05 00:55:45 dillon Exp $ */ /* $OpenBSD: linux_getcwd.c,v 1.2 2001/05/16 12:50:21 ho Exp $ */ /* $NetBSD: vfs_getcwd.c,v 1.3.2.3 1999/07/11 10:24:09 sommerfeld Exp $ */ @@ -87,14 +87,14 @@ sys_linux_getcwd(struct linux_getcwd_args *args) if (buflen > MAXPATHLEN) buflen = MAXPATHLEN; - buf = malloc(buflen, M_TEMP, M_WAITOK); + buf = kmalloc(buflen, M_TEMP, M_WAITOK); bp = kern_getcwd(buf, buflen, &error); if (error == 0) { buflen = strlen(bp) + 1; error = copyout(bp, args->buf, buflen); args->sysmsg_result = buflen; } - free(buf, M_TEMP); + kfree(buf, M_TEMP); return (error); } diff --git a/sys/emulation/linux/linux_sysctl.c b/sys/emulation/linux/linux_sysctl.c index cd041e53a4..46106f9dfc 100644 --- a/sys/emulation/linux/linux_sysctl.c +++ b/sys/emulation/linux/linux_sysctl.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/compat/linux/linux_sysctl.c,v 1.2.2.1 2001/10/21 03:57:35 marcel Exp $ - * $DragonFly: src/sys/emulation/linux/linux_sysctl.c,v 1.7 2006/06/05 07:26:09 dillon Exp $ + * $DragonFly: src/sys/emulation/linux/linux_sysctl.c,v 1.8 2006/09/05 00:55:45 dillon Exp $ */ #include "opt_compat.h" @@ -89,10 +89,10 @@ sys_linux_sysctl(struct linux_sysctl_args *args) if (la.nlen <= 0 || la.nlen > LINUX_CTL_MAXNAME) return (ENOTDIR); - mib = malloc(la.nlen * sizeof(l_int), M_TEMP, M_WAITOK); + mib = kmalloc(la.nlen * sizeof(l_int), M_TEMP, M_WAITOK); error = copyin(la.name, mib, la.nlen * sizeof(l_int)); if (error) { - free(mib, M_TEMP); + kfree(mib, M_TEMP); return (error); } @@ -103,7 +103,7 @@ sys_linux_sysctl(struct linux_sysctl_args *args) switch (mib[1]) { case LINUX_KERN_VERSION: - free(mib, M_TEMP); + kfree(mib, M_TEMP); return (handle_string(&la, version)); default: break; @@ -118,6 +118,6 @@ sys_linux_sysctl(struct linux_sysctl_args *args) printf("%c%d", (i) ? ',' : '{', mib[i]); printf("}\n"); - free(mib, M_TEMP); + kfree(mib, M_TEMP); return (ENOTDIR); } diff --git a/sys/emulation/linux/linux_util.c b/sys/emulation/linux/linux_util.c index aa62f55f08..7e2d59c2b3 100644 --- a/sys/emulation/linux/linux_util.c +++ b/sys/emulation/linux/linux_util.c @@ -28,7 +28,7 @@ * * from: svr4_util.c,v 1.5 1995/01/22 23:44:50 christos Exp * $FreeBSD: src/sys/compat/linux/linux_util.c,v 1.12.2.2 2001/11/05 19:08:23 marcel Exp $ - * $DragonFly: src/sys/emulation/linux/linux_util.c,v 1.12 2006/08/09 22:47:31 dillon Exp $ + * $DragonFly: src/sys/emulation/linux/linux_util.c,v 1.13 2006/09/05 00:55:45 dillon Exp $ */ #include @@ -58,7 +58,7 @@ linux_copyin_path(char *uname, char **kname, int flags) char *buf, *cp; int error, length, dummy; - buf = (char *) malloc(MAXPATHLEN, M_TEMP, M_WAITOK); + buf = (char *) kmalloc(MAXPATHLEN, M_TEMP, M_WAITOK); *kname = buf; /* @@ -178,7 +178,7 @@ linux_translate_path(char *path, int size) char *buf; int error, length, dummy; - buf = (char *) malloc(MAXPATHLEN, M_TEMP, M_WAITOK); + buf = (char *) kmalloc(MAXPATHLEN, M_TEMP, M_WAITOK); length = strlen(linux_emul_path); bcopy(linux_emul_path, buf, length); error = copystr(path, buf + length, MAXPATHLEN - length, &dummy); @@ -206,6 +206,6 @@ linux_translate_path(char *path, int size) cleanup: - free(buf, M_TEMP); + kfree(buf, M_TEMP); return (error); } diff --git a/sys/emulation/ndis/kern_ndis.c b/sys/emulation/ndis/kern_ndis.c index b25941a93c..6a5dc316d9 100644 --- a/sys/emulation/ndis/kern_ndis.c +++ b/sys/emulation/ndis/kern_ndis.c @@ -30,7 +30,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/compat/ndis/kern_ndis.c,v 1.57 2004/07/11 00:19:30 wpaul Exp $ - * $DragonFly: src/sys/emulation/ndis/kern_ndis.c,v 1.10 2006/09/04 07:00:56 dillon Exp $ + * $DragonFly: src/sys/emulation/ndis/kern_ndis.c,v 1.11 2006/09/05 00:55:45 dillon Exp $ */ #include @@ -256,7 +256,7 @@ ndis_create_kthreads(void) STAILQ_INIT(&ndis_free); for (i = 0; i < ndis_jobs; i++) { - r = malloc(sizeof(struct ndis_req), M_DEVBUF, M_WAITOK); + r = kmalloc(sizeof(struct ndis_req), M_DEVBUF, M_WAITOK); STAILQ_INSERT_HEAD(&ndis_free, r, link); } @@ -279,7 +279,7 @@ ndis_create_kthreads(void) if (error) { while ((r = STAILQ_FIRST(&ndis_free)) != NULL) { STAILQ_REMOVE_HEAD(&ndis_free, link); - free(r, M_DEVBUF); + kfree(r, M_DEVBUF); } return(error); } @@ -301,7 +301,7 @@ ndis_destroy_kthreads(void) while ((r = STAILQ_FIRST(&ndis_free)) != NULL) { STAILQ_REMOVE_HEAD(&ndis_free, link); - free(r, M_DEVBUF); + kfree(r, M_DEVBUF); } lwkt_token_uninit(&ndis_thr_token); @@ -362,7 +362,7 @@ ndis_enlarge_thrqueue(int cnt) struct lwkt_tokref tokref; for (i = 0; i < cnt; i++) { - r = malloc(sizeof(struct ndis_req), M_DEVBUF, M_WAITOK); + r = kmalloc(sizeof(struct ndis_req), M_DEVBUF, M_WAITOK); lwkt_gettoken(&tokref, &ndis_thr_token); STAILQ_INSERT_HEAD(&ndis_free, r, link); ndis_jobs++; @@ -389,7 +389,7 @@ ndis_shrink_thrqueue(int cnt) STAILQ_REMOVE_HEAD(&ndis_free, link); ndis_jobs--; lwkt_reltoken(&tokref); - free(r, M_DEVBUF); + kfree(r, M_DEVBUF); } return(0); @@ -655,7 +655,7 @@ ndis_add_sysctl(void *arg, char *key, char *desc, char *val, int flag) sc = arg; - cfg = malloc(sizeof(struct ndis_cfglist), M_DEVBUF, M_WAITOK|M_ZERO); + cfg = kmalloc(sizeof(struct ndis_cfglist), M_DEVBUF, M_WAITOK|M_ZERO); cfg->ndis_cfg.nc_cfgkey = kstrdup(key, M_DEVBUF); if (desc == NULL) { snprintf(descstr, sizeof(descstr), "%s (dynamic)", key); @@ -693,9 +693,9 @@ ndis_flush_sysctls(void *arg) while (!TAILQ_EMPTY(&sc->ndis_cfglist_head)) { cfg = TAILQ_FIRST(&sc->ndis_cfglist_head); TAILQ_REMOVE(&sc->ndis_cfglist_head, cfg, link); - free(cfg->ndis_cfg.nc_cfgkey, M_DEVBUF); - free(cfg->ndis_cfg.nc_cfgdesc, M_DEVBUF); - free(cfg, M_DEVBUF); + kfree(cfg->ndis_cfg.nc_cfgkey, M_DEVBUF); + kfree(cfg->ndis_cfg.nc_cfgdesc, M_DEVBUF); + kfree(cfg, M_DEVBUF); } return(0); @@ -769,7 +769,7 @@ ndis_free_bufs(ndis_buffer *b0) while(b0 != NULL) { next = b0->nb_next; - free(b0, M_NDIS_BUFFER); + kfree(b0, M_NDIS_BUFFER); b0 = next; } @@ -783,7 +783,7 @@ ndis_free_packet(ndis_packet *p) return; ndis_free_bufs(p->np_private.npp_head); - free(p, M_NDIS_PACKET); + kfree(p, M_NDIS_PACKET); return; } @@ -892,7 +892,7 @@ bad: while (!SLIST_EMPTY(&brl_rev)) { n = SLIST_FIRST(&brl_rev); SLIST_REMOVE_HEAD(&brl_rev, link); - free (n, M_TEMP); + kfree (n, M_TEMP); } return(error); @@ -989,7 +989,7 @@ ndis_mtop(struct mbuf *m0, ndis_packet **p) /* If caller didn't supply a packet, make one. */ if (*p == NULL) { - *p = malloc(sizeof(ndis_packet), M_NDIS_PACKET, M_NOWAIT|M_ZERO); + *p = kmalloc(sizeof(ndis_packet), M_NDIS_PACKET, M_NOWAIT|M_ZERO); if (*p == NULL) return(ENOMEM); } @@ -1002,7 +1002,7 @@ ndis_mtop(struct mbuf *m0, ndis_packet **p) for (m = m0; m != NULL; m = m->m_next) { if (m->m_len == 0) continue; - buf = malloc(sizeof(ndis_buffer), M_NDIS_BUFFER, M_NOWAIT|M_ZERO); + buf = kmalloc(sizeof(ndis_buffer), M_NDIS_BUFFER, M_NOWAIT|M_ZERO); if (buf == NULL) { ndis_free_packet(*p); *p = NULL; @@ -1034,12 +1034,12 @@ ndis_get_supported_oids(void *arg, ndis_oid **oids, int *oidcnt) len = 0; ndis_get_info(arg, OID_GEN_SUPPORTED_LIST, NULL, &len); - o = malloc(len, M_DEVBUF, M_WAITOK); + o = kmalloc(len, M_DEVBUF, M_WAITOK); rval = ndis_get_info(arg, OID_GEN_SUPPORTED_LIST, o, &len); if (rval) { - free(o, M_DEVBUF); + kfree(o, M_DEVBUF); return(rval); } @@ -1182,7 +1182,7 @@ ndis_init_dma(void *arg) error = bus_dmamap_create(sc->ndis_ttag, 0, &sc->ndis_tmaps[i]); if (error) { - free(sc->ndis_tmaps, M_DEVBUF); + kfree(sc->ndis_tmaps, M_DEVBUF); return(ENODEV); } } @@ -1211,7 +1211,7 @@ ndis_destroy_dma(void *arg) bus_dmamap_destroy(sc->ndis_ttag, sc->ndis_tmaps[i]); } if (sc->ndis_tmaps) - free(sc->ndis_tmaps, M_DEVBUF); + kfree(sc->ndis_tmaps, M_DEVBUF); bus_dma_tag_destroy(sc->ndis_ttag); return(0); @@ -1474,7 +1474,7 @@ ndis_unload_driver(void *arg) sc = arg; - free(sc->ndis_block.nmb_rlist, M_DEVBUF); + kfree(sc->ndis_block.nmb_rlist, M_DEVBUF); ndis_flush_sysctls(sc); @@ -1575,7 +1575,7 @@ ndis_load_driver(vm_offset_t img, void *arg) */ status = entry(&block->nmb_devobj, &dummystr); - free (dummystr.nus_buf, M_DEVBUF); + kfree (dummystr.nus_buf, M_DEVBUF); if (status != NDIS_STATUS_SUCCESS) return(ENODEV); diff --git a/sys/emulation/ndis/subr_ndis.c b/sys/emulation/ndis/subr_ndis.c index 19a142720b..c0f774c431 100644 --- a/sys/emulation/ndis/subr_ndis.c +++ b/sys/emulation/ndis/subr_ndis.c @@ -30,7 +30,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/compat/ndis/subr_ndis.c,v 1.62 2004/07/11 00:19:30 wpaul Exp $ - * $DragonFly: src/sys/emulation/ndis/subr_ndis.c,v 1.14 2006/08/12 00:26:19 dillon Exp $ + * $DragonFly: src/sys/emulation/ndis/subr_ndis.c,v 1.15 2006/09/05 00:55:45 dillon Exp $ */ /* @@ -318,7 +318,7 @@ ndis_ascii_to_unicode(char *ascii, uint16_t **unicode) int i; if (*unicode == NULL) - *unicode = malloc(strlen(ascii) * 2, M_DEVBUF, M_WAITOK); + *unicode = kmalloc(strlen(ascii) * 2, M_DEVBUF, M_WAITOK); ustr = *unicode; for (i = 0; i < strlen(ascii); i++) { *ustr = (uint16_t)ascii[i]; @@ -335,7 +335,7 @@ ndis_unicode_to_ascii(uint16_t *unicode, int ulen, char **ascii) int i; if (*ascii == NULL) - *ascii = malloc((ulen / 2) + 1, M_DEVBUF, M_WAITOK|M_ZERO); + *ascii = kmalloc((ulen / 2) + 1, M_DEVBUF, M_WAITOK|M_ZERO); astr = *ascii; for (i = 0; i < ulen / 2; i++) { *astr = (uint8_t)unicode[i]; @@ -390,7 +390,7 @@ ndis_malloc_withtag(void **vaddr, uint32_t len, uint32_t tag) { void *mem; - mem = malloc(len, M_DEVBUF, M_INTWAIT|M_NULLOK); + mem = kmalloc(len, M_DEVBUF, M_INTWAIT|M_NULLOK); if (mem == NULL) return(NDIS_STATUS_RESOURCES); *vaddr = mem; @@ -404,7 +404,7 @@ ndis_malloc(void **vaddr, uint32_t len, uint32_t flags, { void *mem; - mem = malloc(len, M_DEVBUF, M_INTWAIT|M_NULLOK); + mem = kmalloc(len, M_DEVBUF, M_INTWAIT|M_NULLOK); if (mem == NULL) return(NDIS_STATUS_RESOURCES); *vaddr = mem; @@ -417,7 +417,7 @@ ndis_free(void *vaddr, uint32_t len, uint32_t flags) { if (len == 0) return; - free(vaddr, M_DEVBUF); + kfree(vaddr, M_DEVBUF); return; } @@ -569,12 +569,12 @@ ndis_read_cfg(ndis_status *status, ndis_config_parm **parm, ndis_handle cfg, oidp = e->entry; if (ndis_strcasecmp(oidp->oid_name, keystr) == 0) { if (strcmp((char *)oidp->oid_arg1, "UNSET") == 0) { - free(keystr, M_DEVBUF); + kfree(keystr, M_DEVBUF); *status = NDIS_STATUS_FAILURE; return; } *status = ndis_encode_parm(block, oidp, type, parm); - free(keystr, M_DEVBUF); + kfree(keystr, M_DEVBUF); return; } } @@ -598,7 +598,7 @@ ndis_read_cfg(ndis_status *status, ndis_config_parm **parm, ndis_handle cfg, ndis_add_sysctl(sc, keystr, "(dynamic string key)", "UNSET", CTLFLAG_RW); - free(keystr, M_DEVBUF); + kfree(keystr, M_DEVBUF); *status = NDIS_STATUS_FAILURE; return; } @@ -615,7 +615,7 @@ ndis_decode_parm(ndis_miniport_block *block, ndis_config_parm *parm, ustr = &parm->ncp_parmdata.ncp_stringdata; ndis_unicode_to_ascii(ustr->nus_buf, ustr->nus_len, &astr); bcopy(astr, val, 254); - free(astr, M_DEVBUF); + kfree(astr, M_DEVBUF); break; case ndis_parm_int: sprintf(val, "%d", parm->ncp_parmdata.ncp_intdata); @@ -650,7 +650,7 @@ ndis_write_cfg(ndis_status *status, ndis_handle cfg, ndis_unicode_string *key, bzero(val, sizeof(val)); *status = ndis_decode_parm(block, parm, val); if (*status != NDIS_STATUS_SUCCESS) { - free(keystr, M_DEVBUF); + kfree(keystr, M_DEVBUF); return; } @@ -665,7 +665,7 @@ ndis_write_cfg(ndis_status *status, ndis_handle cfg, ndis_unicode_string *key, if (ndis_strcasecmp(oidp->oid_name, keystr) == 0) { /* Found it, set the value. */ strcpy((char *)oidp->oid_arg1, val); - free(keystr, M_DEVBUF); + kfree(keystr, M_DEVBUF); return; } } @@ -674,7 +674,7 @@ ndis_write_cfg(ndis_status *status, ndis_handle cfg, ndis_unicode_string *key, ndis_add_sysctl(sc, keystr, "(dynamically set key)", val, CTLFLAG_RW); - free(keystr, M_DEVBUF); + kfree(keystr, M_DEVBUF); *status = NDIS_STATUS_SUCCESS; return; } @@ -1108,7 +1108,7 @@ ndis_alloc_mapreg(ndis_handle adapter, uint32_t dmachannel, uint8_t dmasize, &sc->ndis_mtag); if (error) { - free(sc->ndis_mmaps, M_DEVBUF); + kfree(sc->ndis_mmaps, M_DEVBUF); return(NDIS_STATUS_RESOURCES); } @@ -1133,7 +1133,7 @@ ndis_free_mapreg(ndis_handle adapter) for (i = 0; i < sc->ndis_mmapcnt; i++) bus_dmamap_destroy(sc->ndis_mtag, sc->ndis_mmaps[i]); - free(sc->ndis_mmaps, M_DEVBUF); + kfree(sc->ndis_mmaps, M_DEVBUF); bus_dma_tag_destroy(sc->ndis_mtag); @@ -1173,7 +1173,7 @@ ndis_alloc_sharedmem(ndis_handle adapter, uint32_t len, uint8_t cached, block = (ndis_miniport_block *)adapter; sc = (struct ndis_softc *)(block->nmb_ifp); - sh = malloc(sizeof(struct ndis_shmem), M_DEVBUF, M_INTWAIT|M_ZERO); + sh = kmalloc(sizeof(struct ndis_shmem), M_DEVBUF, M_INTWAIT|M_ZERO); if (sh == NULL) return; @@ -1197,7 +1197,7 @@ ndis_alloc_sharedmem(ndis_handle adapter, uint32_t len, uint8_t cached, &sh->ndis_stag); if (error) { - free(sh, M_DEVBUF); + kfree(sh, M_DEVBUF); return; } @@ -1206,7 +1206,7 @@ ndis_alloc_sharedmem(ndis_handle adapter, uint32_t len, uint8_t cached, if (error) { bus_dma_tag_destroy(sh->ndis_stag); - free(sh, M_DEVBUF); + kfree(sh, M_DEVBUF); return; } @@ -1216,7 +1216,7 @@ ndis_alloc_sharedmem(ndis_handle adapter, uint32_t len, uint8_t cached, if (error) { bus_dmamem_free(sh->ndis_stag, *vaddr, sh->ndis_smap); bus_dma_tag_destroy(sh->ndis_stag); - free(sh, M_DEVBUF); + kfree(sh, M_DEVBUF); return; } @@ -1256,7 +1256,7 @@ ndis_asyncmem_complete(void *arg) w->na_cached, &vaddr, &paddr); donefunc(w->na_adapter, vaddr, &paddr, w->na_len, w->na_ctx); - free(arg, M_DEVBUF); + kfree(arg, M_DEVBUF); return; } @@ -1270,7 +1270,7 @@ ndis_alloc_sharedmem_async(ndis_handle adapter, uint32_t len, if (adapter == NULL) return(NDIS_STATUS_FAILURE); - w = malloc(sizeof(struct ndis_allocwork), M_TEMP, M_INTWAIT); + w = kmalloc(sizeof(struct ndis_allocwork), M_TEMP, M_INTWAIT); if (w == NULL) return(NDIS_STATUS_FAILURE); @@ -1323,7 +1323,7 @@ ndis_free_sharedmem(ndis_handle adapter, uint32_t len, uint8_t cached, else prev->ndis_next = sh->ndis_next; - free(sh, M_DEVBUF); + kfree(sh, M_DEVBUF); return; } @@ -1466,7 +1466,7 @@ ndis_free_packetpool(ndis_handle pool) /* If there are no buffers loaned out, destroy the pool. */ if (head->np_private.npp_count == 0) - free(pool, M_DEVBUF); + kfree(pool, M_DEVBUF); else printf("NDIS: buggy driver deleting active packet pool!\n"); @@ -1548,7 +1548,7 @@ ndis_release_packet(ndis_packet *packet) */ if (head->np_private.npp_totlen && head->np_private.npp_count == 0) - free(head, M_DEVBUF); + kfree(head, M_DEVBUF); return; } @@ -1649,7 +1649,7 @@ ndis_free_bufpool(ndis_handle pool) /* If there are no buffers loaned out, destroy the pool. */ if (head->nb_bytecount == 0) - free(pool, M_DEVBUF); + kfree(pool, M_DEVBUF); else printf("NDIS: buggy driver deleting active buffer pool!\n"); @@ -1731,7 +1731,7 @@ ndis_release_buf(ndis_buffer *buf) */ if (head->nb_byteoffset && head->nb_bytecount == 0) - free(head, M_DEVBUF); + kfree(head, M_DEVBUF); return; } @@ -1870,15 +1870,15 @@ ndis_ansi2unicode(ndis_unicode_string *dstr, ndis_ansi_string *sstr) char *str; if (dstr == NULL || sstr == NULL) return(NDIS_STATUS_FAILURE); - str = malloc(sstr->nas_len + 1, M_DEVBUF, M_WAITOK); + str = kmalloc(sstr->nas_len + 1, M_DEVBUF, M_WAITOK); strncpy(str, sstr->nas_buf, sstr->nas_len); *(str + sstr->nas_len) = '\0'; if (ndis_ascii_to_unicode(str, &dstr->nus_buf)) { - free(str, M_DEVBUF); + kfree(str, M_DEVBUF); return(NDIS_STATUS_FAILURE); } dstr->nus_len = dstr->nus_maxlen = sstr->nas_len * 2; - free(str, M_DEVBUF); + kfree(str, M_DEVBUF); return (NDIS_STATUS_SUCCESS); } @@ -2179,8 +2179,8 @@ ndis_free_string(ndis_unicode_string *str) if (str == NULL) return; if (str->nus_buf != NULL) - free(str->nus_buf, M_DEVBUF); - free(str, M_DEVBUF); + kfree(str->nus_buf, M_DEVBUF); + kfree(str, M_DEVBUF); return; } @@ -2295,16 +2295,16 @@ ndis_open_file(ndis_status *status, ndis_handle *filehandle, uint32_t *filelengt filename->nus_len, &afilename); sprintf(path, "%s/%s", ndis_filepath, afilename); - free(afilename, M_DEVBUF); + kfree(afilename, M_DEVBUF); - fh = malloc(sizeof(ndis_fh), M_TEMP, M_WAITOK); + fh = kmalloc(sizeof(ndis_fh), M_TEMP, M_WAITOK); error = nlookup_init(&nd, path, UIO_SYSSPACE, NLC_FOLLOW|NLC_LOCKVP); if (error == 0) error = vn_open(&nd, NULL, FREAD, 0); if (error) { *status = NDIS_STATUS_FILE_NOT_FOUND; - free(fh, M_TEMP); + kfree(fh, M_TEMP); printf("NDIS: open file %s failed: %d\n", path, error); goto done; } @@ -2350,7 +2350,7 @@ ndis_map_file(ndis_status *status, void **mappedbuffer, ndis_handle filehandle) return; } - fh->nf_map = malloc(fh->nf_maplen, M_DEVBUF, M_WAITOK); + fh->nf_map = kmalloc(fh->nf_maplen, M_DEVBUF, M_WAITOK); error = vn_rdwr(UIO_READ, fh->nf_vp, fh->nf_map, fh->nf_maplen, 0, UIO_SYSSPACE, 0, proc0.p_ucred, &resid); @@ -2373,7 +2373,7 @@ ndis_unmap_file(ndis_handle filehandle) if (fh->nf_map == NULL) return; - free(fh->nf_map, M_DEVBUF); + kfree(fh->nf_map, M_DEVBUF); fh->nf_map = NULL; return; @@ -2389,7 +2389,7 @@ ndis_close_file(ndis_handle filehandle) fh = (ndis_fh *)filehandle; if (fh->nf_map != NULL) { - free(fh->nf_map, M_DEVBUF); + kfree(fh->nf_map, M_DEVBUF); fh->nf_map = NULL; } @@ -2399,7 +2399,7 @@ ndis_close_file(ndis_handle filehandle) vn_close(fh->nf_vp, FREAD); fh->nf_vp = NULL; - free(fh, M_DEVBUF); + kfree(fh, M_DEVBUF); return; } diff --git a/sys/emulation/ndis/subr_ntoskrnl.c b/sys/emulation/ndis/subr_ntoskrnl.c index 7221857fd5..0eb7538e71 100644 --- a/sys/emulation/ndis/subr_ntoskrnl.c +++ b/sys/emulation/ndis/subr_ntoskrnl.c @@ -30,7 +30,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/compat/ndis/subr_ntoskrnl.c,v 1.40 2004/07/20 20:28:57 wpaul Exp $ - * $DragonFly: src/sys/emulation/ndis/subr_ntoskrnl.c,v 1.8 2006/09/03 18:52:28 dillon Exp $ + * $DragonFly: src/sys/emulation/ndis/subr_ntoskrnl.c,v 1.9 2006/09/05 00:55:45 dillon Exp $ */ #include @@ -790,13 +790,13 @@ ntoskrnl_popsl(slist_header *head) __stdcall static void * ntoskrnl_allocfunc(uint32_t pooltype, size_t size, uint32_t tag) { - return(malloc(size, M_DEVBUF, M_WAITOK)); + return(kmalloc(size, M_DEVBUF, M_WAITOK)); } __stdcall static void ntoskrnl_freefunc(void *buf) { - free(buf, M_DEVBUF); + kfree(buf, M_DEVBUF); return; } @@ -1011,7 +1011,7 @@ ntoskrnl_freemdl(ndis_buffer *mdl) */ if (head->nb_byteoffset && head->nb_bytecount == 0) - free(head, M_DEVBUF); + kfree(head, M_DEVBUF); return; } @@ -1184,7 +1184,7 @@ ntoskrnl_free_unicode_string(ndis_unicode_string *ustr) { if (ustr->nus_buf == NULL) return; - free(ustr->nus_buf, M_DEVBUF); + kfree(ustr->nus_buf, M_DEVBUF); ustr->nus_buf = NULL; return; } @@ -1194,7 +1194,7 @@ ntoskrnl_free_ansi_string(ndis_ansi_string *astr) { if (astr->nas_buf == NULL) return; - free(astr->nas_buf, M_DEVBUF); + kfree(astr->nas_buf, M_DEVBUF); astr->nas_buf = NULL; return; } @@ -1346,7 +1346,7 @@ ntoskrnl_objref(ndis_handle handle, uint32_t reqaccess, void *otype, { nt_objref *nr; - nr = malloc(sizeof(nt_objref), M_DEVBUF, M_WAITOK|M_ZERO); + nr = kmalloc(sizeof(nt_objref), M_DEVBUF, M_WAITOK|M_ZERO); INIT_LIST_HEAD((&nr->no_dh.dh_waitlisthead)); nr->no_obj = handle; @@ -1364,7 +1364,7 @@ ntoskrnl_objderef(REGARGS1(void *object)) nr = object; TAILQ_REMOVE(&ntoskrnl_reflist, nr, link); - free(nr, M_DEVBUF); + kfree(nr, M_DEVBUF); return; } @@ -1390,7 +1390,7 @@ ntoskrnl_thrfunc(void *arg) thrctx = arg; tfunc = thrctx->tc_thrfunc; tctx = thrctx->tc_thrctx; - free(thrctx, M_TEMP); + kfree(thrctx, M_TEMP); rval = tfunc(tctx); @@ -1408,7 +1408,7 @@ ntoskrnl_create_thread(ndis_handle *handle, uint32_t reqaccess, thread_context *tc; thread_t td; - tc = malloc(sizeof(thread_context), M_TEMP, M_WAITOK); + tc = kmalloc(sizeof(thread_context), M_TEMP, M_WAITOK); tc->tc_thrctx = thrctx; tc->tc_thrfunc = thrfunc; @@ -1497,7 +1497,7 @@ ntoskrnl_timercall(void *arg) ntoskrnl_timercall, timer); } else { callout_deactivate(timer->k_handle); - free(timer->k_handle, M_NDIS); + kfree(timer->k_handle, M_NDIS); timer->k_handle = NULL; } @@ -1629,7 +1629,7 @@ ntoskrnl_set_timer_ex(ktimer *timer, int64_t duetime, uint32_t period, ticks = 1 + tv.tv_sec * hz + tv.tv_usec * hz / 1000000; timer->k_header.dh_inserted = TRUE; if (timer->k_handle == NULL) { - timer->k_handle = malloc(sizeof(struct callout), M_NDIS, + timer->k_handle = kmalloc(sizeof(struct callout), M_NDIS, M_INTWAIT); callout_init(timer->k_handle); } @@ -1655,7 +1655,7 @@ ntoskrnl_cancel_timer(ktimer *timer) if (timer->k_header.dh_inserted == TRUE) { if (timer->k_handle != NULL) { callout_stop(timer->k_handle); - free(timer->k_handle, M_NDIS); + kfree(timer->k_handle, M_NDIS); timer->k_handle = NULL; } if (timer->k_dpc != NULL) diff --git a/sys/i386/i386/autoconf.c b/sys/i386/i386/autoconf.c index 9bd14e6fe5..22fc71c608 100644 --- a/sys/i386/i386/autoconf.c +++ b/sys/i386/i386/autoconf.c @@ -35,7 +35,7 @@ * * from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91 * $FreeBSD: src/sys/i386/i386/autoconf.c,v 1.146.2.2 2001/06/07 06:05:58 dd Exp $ - * $DragonFly: src/sys/i386/i386/Attic/autoconf.c,v 1.24 2006/09/03 17:43:59 dillon Exp $ + * $DragonFly: src/sys/i386/i386/Attic/autoconf.c,v 1.25 2006/09/05 00:55:45 dillon Exp $ */ /* @@ -313,7 +313,7 @@ setroot() if (!dev_is_good(newrootdev)) return; sname = dsname(newrootdev, unit, slice, part, partname); - rootdevnames[0] = malloc(strlen(sname) + 6, M_DEVBUF, M_WAITOK); + rootdevnames[0] = kmalloc(strlen(sname) + 6, M_DEVBUF, M_WAITOK); sprintf(rootdevnames[0], "ufs:%s%s", sname, partname); /* @@ -329,7 +329,7 @@ setroot() return; slice = COMPATIBILITY_SLICE; sname = dsname(newrootdev, unit, slice, part, partname); - rootdevnames[1] = malloc(strlen(sname) + 6, M_DEVBUF, M_WAITOK); + rootdevnames[1] = kmalloc(strlen(sname) + 6, M_DEVBUF, M_WAITOK); sprintf(rootdevnames[1], "ufs:%s%s", sname, partname); } #endif diff --git a/sys/i386/i386/bios.c b/sys/i386/i386/bios.c index 95dd269a6a..83359af79b 100644 --- a/sys/i386/i386/bios.c +++ b/sys/i386/i386/bios.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/i386/bios.c,v 1.29.2.3 2001/07/19 18:07:35 imp Exp $ - * $DragonFly: src/sys/i386/i386/Attic/bios.c,v 1.11 2006/09/03 17:43:59 dillon Exp $ + * $DragonFly: src/sys/i386/i386/Attic/bios.c,v 1.12 2006/09/05 00:55:45 dillon Exp $ */ /* @@ -373,7 +373,7 @@ bios16(struct bios_args *args, char *fmt, ...) /* * no page table, so create one and install it. */ - pte = malloc(PAGE_SIZE, M_TEMP, M_WAITOK|M_ZERO); + pte = kmalloc(PAGE_SIZE, M_TEMP, M_WAITOK|M_ZERO); ptd = (pd_entry_t *)((vm_offset_t)ptd + KERNBASE); *ptd = vtophys(pte) | PG_RW | PG_V; } else { @@ -442,7 +442,7 @@ bios16(struct bios_args *args, char *fmt, ...) *pte = 0; /* remove entry */ } else { *ptd = 0; /* remove page table */ - free(pte, M_TEMP); /* ... and free it */ + kfree(pte, M_TEMP); /* ... and free it */ } /* * XXX only needs to be invlpg(0) but that doesn't work on the 386 diff --git a/sys/i386/i386/busdma_machdep.c b/sys/i386/i386/busdma_machdep.c index debd9b02d4..e1e99ddf99 100644 --- a/sys/i386/i386/busdma_machdep.c +++ b/sys/i386/i386/busdma_machdep.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/i386/busdma_machdep.c,v 1.16.2.2 2003/01/23 00:55:27 scottl Exp $ - * $DragonFly: src/sys/i386/i386/Attic/busdma_machdep.c,v 1.13 2005/06/03 17:14:48 dillon Exp $ + * $DragonFly: src/sys/i386/i386/Attic/busdma_machdep.c,v 1.14 2006/09/05 00:55:45 dillon Exp $ */ #include @@ -139,7 +139,7 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, /* Return a NULL tag on failure */ *dmat = NULL; - newtag = malloc(sizeof(*newtag), M_DEVBUF, M_INTWAIT); + newtag = kmalloc(sizeof(*newtag), M_DEVBUF, M_INTWAIT); newtag->parent = parent; newtag->alignment = alignment; @@ -205,7 +205,7 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, } if (error != 0) { - free(newtag, M_DEVBUF); + kfree(newtag, M_DEVBUF); } else { *dmat = newtag; } @@ -227,8 +227,8 @@ bus_dma_tag_destroy(bus_dma_tag_t dmat) dmat->ref_count--; if (dmat->ref_count == 0) { if (dmat->segments != NULL) - free(dmat->segments, M_DEVBUF); - free(dmat, M_DEVBUF); + kfree(dmat->segments, M_DEVBUF); + kfree(dmat, M_DEVBUF); /* * Last reference count, so * release our reference @@ -263,7 +263,7 @@ bus_dmamap_create(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp) /* Must bounce */ int maxpages; - *mapp = malloc(sizeof(**mapp), M_DEVBUF, M_INTWAIT); + *mapp = kmalloc(sizeof(**mapp), M_DEVBUF, M_INTWAIT); if (*mapp == NULL) { return (ENOMEM); } else { @@ -318,7 +318,7 @@ bus_dmamap_destroy(bus_dma_tag_t dmat, bus_dmamap_t map) if (map != NULL) { if (STAILQ_FIRST(&map->bpages) != NULL) return (EBUSY); - free(map, M_DEVBUF); + kfree(map, M_DEVBUF); } dmat->map_count--; return (0); @@ -355,7 +355,7 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags, if ((dmat->maxsize <= PAGE_SIZE) && dmat->lowaddr >= ptoa(Maxmem)) { - *vaddr = malloc(dmat->maxsize, M_DEVBUF, mflags); + *vaddr = kmalloc(dmat->maxsize, M_DEVBUF, mflags); /* * XXX Check whether the allocation crossed a page boundary * and retry with power-of-2 alignment in that case. @@ -363,11 +363,11 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags, if ((((intptr_t)*vaddr) & PAGE_MASK) != (((intptr_t)*vaddr + dmat->maxsize) & PAGE_MASK)) { size_t size; - free(*vaddr, M_DEVBUF); + kfree(*vaddr, M_DEVBUF); /* XXX check for overflow? */ for (size = 1; size <= dmat->maxsize; size <<= 1) ; - *vaddr = malloc(size, M_DEVBUF, mflags); + *vaddr = kmalloc(size, M_DEVBUF, mflags); } } else { /* @@ -399,7 +399,7 @@ bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map) panic("bus_dmamem_free: Invalid map freed\n"); if ((dmat->maxsize <= PAGE_SIZE) && dmat->lowaddr >= ptoa(Maxmem)) - free(vaddr, M_DEVBUF); + kfree(vaddr, M_DEVBUF); else contigfree(vaddr, dmat->maxsize, M_DEVBUF); } @@ -780,7 +780,7 @@ alloc_bounce_pages(bus_dma_tag_t dmat, u_int numpages) while (numpages > 0) { struct bounce_page *bpage; - bpage = (struct bounce_page *)malloc(sizeof(*bpage), M_DEVBUF, + bpage = (struct bounce_page *)kmalloc(sizeof(*bpage), M_DEVBUF, M_INTWAIT); if (bpage == NULL) @@ -792,7 +792,7 @@ alloc_bounce_pages(bus_dma_tag_t dmat, u_int numpages) PAGE_SIZE, 0); if (bpage->vaddr == NULL) { - free(bpage, M_DEVBUF); + kfree(bpage, M_DEVBUF); break; } bpage->busaddr = pmap_kextract(bpage->vaddr); diff --git a/sys/i386/i386/mem.c b/sys/i386/i386/mem.c index 260c446d2c..c5677a2a72 100644 --- a/sys/i386/i386/mem.c +++ b/sys/i386/i386/mem.c @@ -39,7 +39,7 @@ * from: Utah $Hdr: mem.c 1.13 89/10/08$ * from: @(#)mem.c 7.2 (Berkeley) 5/9/91 * $FreeBSD: src/sys/i386/i386/mem.c,v 1.79.2.9 2003/01/04 22:58:01 njl Exp $ - * $DragonFly: src/sys/i386/i386/Attic/mem.c,v 1.17 2006/07/28 02:17:39 dillon Exp $ + * $DragonFly: src/sys/i386/i386/Attic/mem.c,v 1.18 2006/09/05 00:55:45 dillon Exp $ */ /* @@ -223,7 +223,7 @@ mmrw(dev_t dev, struct uio *uio, int flags) * on read, seeder on write */ if (buf == NULL) - buf = malloc(PAGE_SIZE, M_TEMP, M_WAITOK); + buf = kmalloc(PAGE_SIZE, M_TEMP, M_WAITOK); c = min(iov->iov_len, PAGE_SIZE); if (uio->uio_rw == UIO_WRITE) { error = uiomove(buf, (int)c, uio); @@ -233,7 +233,7 @@ mmrw(dev_t dev, struct uio *uio, int flags) poolsize = read_random(buf, c); if (poolsize == 0) { if (buf) - free(buf, M_TEMP); + kfree(buf, M_TEMP); if ((flags & IO_NDELAY) != 0) return (EWOULDBLOCK); return (0); @@ -262,7 +262,7 @@ mmrw(dev_t dev, struct uio *uio, int flags) continue; } if (buf == NULL) - buf = malloc(PAGE_SIZE, M_TEMP, M_WAITOK); + buf = kmalloc(PAGE_SIZE, M_TEMP, M_WAITOK); poolsize = read_random_unlimited(buf, c); c = min(c, poolsize); error = uiomove(buf, (int)c, uio); @@ -278,7 +278,7 @@ mmrw(dev_t dev, struct uio *uio, int flags) } if (zbuf == NULL) { zbuf = (caddr_t) - malloc(PAGE_SIZE, M_TEMP, M_WAITOK); + kmalloc(PAGE_SIZE, M_TEMP, M_WAITOK); bzero(zbuf, PAGE_SIZE); } c = min(iov->iov_len, PAGE_SIZE); @@ -295,7 +295,7 @@ mmrw(dev_t dev, struct uio *uio, int flags) uio->uio_resid -= c; } if (buf) - free(buf, M_TEMP); + kfree(buf, M_TEMP); return (error); } @@ -398,7 +398,7 @@ mem_ioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct ucred *cred) if (!error) error = copyout(md, mo->mo_desc, nd * sizeof(struct mem_range_desc)); - free(md, M_MEMDESC); + kfree(md, M_MEMDESC); } else { nd = mem_range_softc.mr_ndesc; } @@ -413,7 +413,7 @@ mem_ioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct ucred *cred) md->mr_owner[sizeof(md->mr_owner) - 1] = 0; if (error == 0) error = mem_range_attr_set(md, &mo->mo_arg[0]); - free(md, M_MEMDESC); + kfree(md, M_MEMDESC); break; } return (error); diff --git a/sys/i386/i386/nexus.c b/sys/i386/i386/nexus.c index 528bffd712..5f3d4224f8 100644 --- a/sys/i386/i386/nexus.c +++ b/sys/i386/i386/nexus.c @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/i386/nexus.c,v 1.26.2.10 2003/02/22 13:16:45 imp Exp $ - * $DragonFly: src/sys/i386/i386/Attic/nexus.c,v 1.23 2005/11/21 18:02:40 dillon Exp $ + * $DragonFly: src/sys/i386/i386/Attic/nexus.c,v 1.24 2006/09/05 00:55:45 dillon Exp $ */ /* @@ -283,7 +283,7 @@ nexus_add_child(device_t bus, device_t parent, int order, device_t child; struct nexus_device *ndev; - ndev = malloc(sizeof(struct nexus_device), M_NEXUSDEV, M_INTWAIT|M_ZERO); + ndev = kmalloc(sizeof(struct nexus_device), M_NEXUSDEV, M_INTWAIT|M_ZERO); if (!ndev) return(0); resource_list_init(&ndev->nx_resources); diff --git a/sys/i386/i386/pnpbios.c b/sys/i386/i386/pnpbios.c index ec4e080272..2551c0531f 100644 --- a/sys/i386/i386/pnpbios.c +++ b/sys/i386/i386/pnpbios.c @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/i386/i386/Attic/pnpbios.c,v 1.4 2005/10/30 04:41:15 dillon Exp $ + * $DragonFly: src/sys/i386/i386/Attic/pnpbios.c,v 1.5 2006/09/05 00:55:45 dillon Exp $ */ /* @@ -138,7 +138,7 @@ pnpbios_identify(driver_t *driver, device_t parent) if (bootverbose) printf("pnpbios: %d devices, largest %d bytes\n", ndevs, bigdev); - devnodebuf = malloc(bigdev + (sizeof(struct pnp_sysdevargs) - sizeof(struct pnp_sysdev)), M_DEVBUF, M_INTWAIT); + devnodebuf = kmalloc(bigdev + (sizeof(struct pnp_sysdevargs) - sizeof(struct pnp_sysdev)), M_DEVBUF, M_INTWAIT); pda = (struct pnp_sysdevargs *)devnodebuf; pd = &pda->node; diff --git a/sys/i386/i386/userconfig.c b/sys/i386/i386/userconfig.c index b7d51abcb9..7d62c6b05e 100644 --- a/sys/i386/i386/userconfig.c +++ b/sys/i386/i386/userconfig.c @@ -47,7 +47,7 @@ ** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ** ** $FreeBSD: src/sys/i386/i386/userconfig.c,v 1.175.2.10 2002/10/05 18:31:48 scottl Exp $ - ** $DragonFly: src/sys/i386/i386/Attic/userconfig.c,v 1.6 2006/09/03 17:31:54 dillon Exp $ + ** $DragonFly: src/sys/i386/i386/Attic/userconfig.c,v 1.7 2006/09/05 00:55:45 dillon Exp $ **/ /** @@ -576,7 +576,7 @@ addev(DEV_LIST *dev, DEV_LIST **list) DEV_LIST *lp,*ap; - lp = (DEV_LIST *)malloc(sizeof(DEV_LIST),M_DEVL,M_WAITOK); + lp = (DEV_LIST *)kmalloc(sizeof(DEV_LIST),M_DEVL,M_WAITOK); bcopy(dev,lp,sizeof(DEV_LIST)); /* create copied record */ if (*list) /* list exists */ @@ -675,7 +675,7 @@ insdev(DEV_LIST *dev, DEV_LIST *list) { DEV_LIST *lp,*ap; - lp = (DEV_LIST *)malloc(sizeof(DEV_LIST),M_DEVL,M_WAITOK); + lp = (DEV_LIST *)kmalloc(sizeof(DEV_LIST),M_DEVL,M_WAITOK); bcopy(dev,lp,sizeof(DEV_LIST)); /* create copied record */ ap = findspot(lp,list); /* find appropriate spot */ @@ -764,10 +764,10 @@ savelist(DEV_LIST *list, int active) name = list->device->id_name; id_pn = id_p->id_next; if (id_p->id_name) - free(id_p->id_name, M_DEVL); + kfree(id_p->id_name, M_DEVL); bcopy(list->device,id_p,sizeof(struct uc_device)); save_resource(list->device); - id_p->id_name = malloc(strlen(name) + 1, M_DEVL,M_WAITOK); + id_p->id_name = kmalloc(strlen(name) + 1, M_DEVL,M_WAITOK); strcpy(id_p->id_name, name); id_pn->id_next = uc_devlist; id_p->id_next = id_pn; @@ -777,10 +777,10 @@ savelist(DEV_LIST *list, int active) if (!id_pn) /* not already on the list */ { name = list->device->id_name; - id_pn = malloc(sizeof(struct uc_device),M_DEVL,M_WAITOK); + id_pn = kmalloc(sizeof(struct uc_device),M_DEVL,M_WAITOK); bcopy(list->device,id_pn,sizeof(struct uc_device)); save_resource(list->device); - id_pn->id_name = malloc(strlen(name) + 1, M_DEVL,M_WAITOK); + id_pn->id_name = kmalloc(strlen(name) + 1, M_DEVL,M_WAITOK); strcpy(id_pn->id_name, name); id_pn->id_next = uc_devlist; uc_devlist = id_pn; /* park at top of list */ @@ -810,7 +810,7 @@ nukelist(DEV_LIST *list) { dp = list; list = list->next; - free(dp,M_DEVL); + kfree(dp,M_DEVL); } } @@ -3222,7 +3222,7 @@ load_devtab(void) char *name; int unit; - uc_devtab = malloc(sizeof(struct uc_device)*(count + 1),M_DEVL,M_WAITOK); + uc_devtab = kmalloc(sizeof(struct uc_device)*(count + 1),M_DEVL,M_WAITOK); bzero(uc_devtab, sizeof(struct uc_device) * (count + 1)); dt = 0; for (i = 0; i < count; i++) { @@ -3243,7 +3243,7 @@ load_devtab(void) val = 0; resource_int_value(name, unit, "disabled", &val); uc_devtab[dt].id_enabled = !val; - uc_devtab[dt].id_name = malloc(strlen(name) + 1, M_DEVL,M_WAITOK); + uc_devtab[dt].id_name = kmalloc(strlen(name) + 1, M_DEVL,M_WAITOK); strcpy(uc_devtab[dt].id_name, name); dt++; } @@ -3257,8 +3257,8 @@ free_devtab(void) for (i = 0; i < count; i++) if (uc_devtab[i].id_name) - free(uc_devtab[i].id_name, M_DEVL); - free(uc_devtab, M_DEVL); + kfree(uc_devtab[i].id_name, M_DEVL); + kfree(uc_devtab, M_DEVL); } static struct uc_device * @@ -3419,19 +3419,19 @@ struct uc_device *idev; if (id_p->id_id == idev->id_id) { id_pn = id_p->id_next; if (id_p->id_name) - free(id_p->id_name, M_DEVL); + kfree(id_p->id_name, M_DEVL); bcopy(idev,id_p,sizeof(struct uc_device)); save_resource(idev); - id_p->id_name = malloc(strlen(name)+1, M_DEVL,M_WAITOK); + id_p->id_name = kmalloc(strlen(name)+1, M_DEVL,M_WAITOK); strcpy(id_p->id_name, name); id_p->id_next = id_pn; return 1; } } - id_pn = malloc(sizeof(struct uc_device),M_DEVL,M_WAITOK); + id_pn = kmalloc(sizeof(struct uc_device),M_DEVL,M_WAITOK); bcopy(idev,id_pn,sizeof(struct uc_device)); save_resource(idev); - id_pn->id_name = malloc(strlen(name) + 1, M_DEVL,M_WAITOK); + id_pn->id_name = kmalloc(strlen(name) + 1, M_DEVL,M_WAITOK); strcpy(id_pn->id_name, name); id_pn->id_next = uc_devlist; uc_devlist = id_pn; diff --git a/sys/i386/i386/vm86.c b/sys/i386/i386/vm86.c index 3650c5f27f..c5915868ea 100644 --- a/sys/i386/i386/vm86.c +++ b/sys/i386/i386/vm86.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/i386/vm86.c,v 1.31.2.2 2001/10/05 06:18:55 peter Exp $ - * $DragonFly: src/sys/i386/i386/Attic/vm86.c,v 1.18 2005/11/22 08:41:00 dillon Exp $ + * $DragonFly: src/sys/i386/i386/Attic/vm86.c,v 1.19 2006/09/05 00:55:45 dillon Exp $ */ #include @@ -536,7 +536,7 @@ vm86_addpage(struct vm86context *vmc, int pagenum, vm_offset_t kva) goto bad; /* XXX grow map? */ if (kva == 0) { - kva = (vm_offset_t)malloc(PAGE_SIZE, M_TEMP, M_WAITOK); + kva = (vm_offset_t)kmalloc(PAGE_SIZE, M_TEMP, M_WAITOK); flags = VMAP_MALLOC; } diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c index b9238a6fec..cac662e667 100644 --- a/sys/i386/i386/vm_machdep.c +++ b/sys/i386/i386/vm_machdep.c @@ -39,7 +39,7 @@ * from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91 * Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$ * $FreeBSD: src/sys/i386/i386/vm_machdep.c,v 1.132.2.9 2003/01/25 19:02:23 dillon Exp $ - * $DragonFly: src/sys/i386/i386/Attic/vm_machdep.c,v 1.43 2006/06/01 05:38:43 dillon Exp $ + * $DragonFly: src/sys/i386/i386/Attic/vm_machdep.c,v 1.44 2006/09/05 00:55:45 dillon Exp $ */ #include "use_npx.h" @@ -325,7 +325,7 @@ cpu_coredump(struct thread *td, struct vnode *vp, struct ucred *cred) caddr_t tempuser; KKASSERT(p); - tempuser = malloc(ctob(UPAGES), M_TEMP, M_WAITOK); + tempuser = kmalloc(ctob(UPAGES), M_TEMP, M_WAITOK); if (!tempuser) return EINVAL; @@ -339,7 +339,7 @@ cpu_coredump(struct thread *td, struct vnode *vp, struct ucred *cred) error = vn_rdwr(UIO_WRITE, vp, (caddr_t) tempuser, ctob(UPAGES), (off_t)0, UIO_SYSSPACE, IO_UNIT, cred, (int *)NULL); - free(tempuser, M_TEMP); + kfree(tempuser, M_TEMP); return error; } diff --git a/sys/i386/isa/ccbque.h b/sys/i386/isa/ccbque.h index 9c4d5b22ad..805b24fab6 100644 --- a/sys/i386/isa/ccbque.h +++ b/sys/i386/isa/ccbque.h @@ -28,7 +28,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/i386/isa/ccbque.h,v 1.3.6.2 2000/10/21 07:44:24 nyan Exp $ - * $DragonFly: src/sys/i386/isa/Attic/ccbque.h,v 1.8 2005/12/24 20:34:04 swildner Exp $ + * $DragonFly: src/sys/i386/isa/Attic/ccbque.h,v 1.9 2006/09/05 00:55:45 dillon Exp $ */ /* * Common command control queue funcs. @@ -87,7 +87,7 @@ DEV##_get_ccb(void) \ } \ else \ { \ - cb = malloc(sizeof(*cb), M_DEVBUF, M_INTWAIT); \ + cb = kmalloc(sizeof(*cb), M_DEVBUF, M_INTWAIT); \ if (cb != NULL) \ { \ bzero(cb, sizeof(*cb)); \ diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c index 02d65c6610..961b24bda9 100644 --- a/sys/kern/imgact_elf.c +++ b/sys/kern/imgact_elf.c @@ -27,7 +27,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/kern/imgact_elf.c,v 1.73.2.13 2002/12/28 19:49:41 dillon Exp $ - * $DragonFly: src/sys/kern/imgact_elf.c,v 1.40 2006/08/12 00:26:20 dillon Exp $ + * $DragonFly: src/sys/kern/imgact_elf.c,v 1.41 2006/09/05 00:55:45 dillon Exp $ */ #include @@ -413,7 +413,7 @@ elf_load_file(struct proc *p, const char *file, u_long *addr, u_long *entry) u_long base_addr = 0; int error, i, numsegs; - tempdata = malloc(sizeof(*tempdata), M_TEMP, M_WAITOK); + tempdata = kmalloc(sizeof(*tempdata), M_TEMP, M_WAITOK); nd = &tempdata->nd; attr = &tempdata->attr; imgp = &tempdata->image_params; @@ -516,7 +516,7 @@ fail: vrele(imgp->vp); imgp->vp = NULL; } - free(tempdata, M_TEMP); + kfree(tempdata, M_TEMP); return error; } @@ -792,7 +792,7 @@ exec_elf_imgact(struct image_params *imgp) imgp->proc->p_sysent = brand_info->sysvec; if (interp != NULL) { - path = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); + path = kmalloc(MAXPATHLEN, M_TEMP, M_WAITOK); snprintf(path, MAXPATHLEN, "%s%s", brand_info->emul_path, interp); if ((error = elf_load_file(imgp->proc, path, &addr, @@ -800,17 +800,17 @@ exec_elf_imgact(struct image_params *imgp) if ((error = elf_load_file(imgp->proc, interp, &addr, &imgp->entry_addr)) != 0) { uprintf("ELF interpreter %s not found\n", path); - free(path, M_TEMP); + kfree(path, M_TEMP); goto fail; } } - free(path, M_TEMP); + kfree(path, M_TEMP); } /* * Construct auxargs table (used by the fixup routine) */ - elf_auxargs = malloc(sizeof(Elf_Auxargs), M_TEMP, M_WAITOK); + elf_auxargs = kmalloc(sizeof(Elf_Auxargs), M_TEMP, M_WAITOK); elf_auxargs->execfd = -1; elf_auxargs->phdr = proghdr; elf_auxargs->phent = hdr->e_phentsize; @@ -851,7 +851,7 @@ elf_freebsd_fixup(register_t **stack_base, struct image_params *imgp) AUXARGS_ENTRY(pos, AT_BASE, args->base); AUXARGS_ENTRY(pos, AT_NULL, 0); - free(imgp->auxargs, M_TEMP); + kfree(imgp->auxargs, M_TEMP); imgp->auxargs = NULL; (*stack_base)--; @@ -977,7 +977,7 @@ generic_elf_coredump(struct proc *p, struct file *fp, off_t limit) */ target.off_max = target.off; target.off = 0; - target.buf = malloc(target.off_max, M_TEMP, M_WAITOK|M_ZERO); + target.buf = kmalloc(target.off_max, M_TEMP, M_WAITOK|M_ZERO); if (target.buf == NULL) return EINVAL; @@ -998,7 +998,7 @@ generic_elf_coredump(struct proc *p, struct file *fp, off_t limit) php++; } } - free(target.buf, M_TEMP); + kfree(target.buf, M_TEMP); return error; } @@ -1114,7 +1114,7 @@ cb_put_fp(vm_map_entry_t entry, void *closure) printf("Warning: coredump, error %d: cannot store file handle for vnode %p\n", error, vp); } else { printf("Warning: coredump, error %d: cannot store file handle for %s\n", error, fullpath); - free(freepath, M_TEMP); + kfree(freepath, M_TEMP); } error = 0; } @@ -1231,7 +1231,7 @@ elf_corehdr(struct proc *p, struct file *fp, struct ucred *cred, int numsegs, prfpregset_t *fpregset; prpsinfo_t *psinfo; int nbytes; - tempdata = malloc(sizeof(*tempdata), M_TEMP, M_ZERO | M_WAITOK); + tempdata = kmalloc(sizeof(*tempdata), M_TEMP, M_ZERO | M_WAITOK); status = &tempdata->status; fpregset = &tempdata->fpregset; psinfo = &tempdata->psinfo; @@ -1258,7 +1258,7 @@ elf_corehdr(struct proc *p, struct file *fp, struct ucred *cred, int numsegs, /* Fill in the header. */ error = elf_puthdr(p, target, status, fpregset, psinfo, numsegs); - free(tempdata, M_TEMP); + kfree(tempdata, M_TEMP); /* Write it to the core file. */ if (error == 0) diff --git a/sys/kern/imgact_resident.c b/sys/kern/imgact_resident.c index 81b24da28b..9bcd8e4ffa 100644 --- a/sys/kern/imgact_resident.c +++ b/sys/kern/imgact_resident.c @@ -31,7 +31,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/kern/imgact_resident.c,v 1.12 2006/06/05 07:26:10 dillon Exp $ + * $DragonFly: src/sys/kern/imgact_resident.c,v 1.13 2006/09/05 00:55:45 dillon Exp $ */ #include @@ -97,7 +97,7 @@ fill_xresident(struct vmresident *vr, struct xresident *in, struct thread *td) error = 0; } else { strlcpy(in->res_file, fullpath, sizeof(in->res_file)); - free(freepath, M_TEMP); + kfree(freepath, M_TEMP); } /* indicate that we are using the vnode */ @@ -202,7 +202,7 @@ sys_exec_sys_register(struct exec_sys_register_args *uap) if (vp->v_resident) return(EEXIST); vhold(vp); - vmres = malloc(sizeof(*vmres), M_EXEC_RES, M_WAITOK); + vmres = kmalloc(sizeof(*vmres), M_EXEC_RES, M_WAITOK); vp->v_resident = vmres; vmres->vr_vnode = vp; vmres->vr_sysent = p->p_sysent; @@ -263,7 +263,7 @@ restart: vmspace_free(vmres->vr_vmspace); vmres->vr_vmspace = NULL; } - free(vmres, M_EXEC_RES); + kfree(vmres, M_EXEC_RES); exec_res_id--; error = 0; ++count; diff --git a/sys/kern/inflate.c b/sys/kern/inflate.c index efb88413c4..434047cd92 100644 --- a/sys/kern/inflate.c +++ b/sys/kern/inflate.c @@ -8,7 +8,7 @@ * ---------------------------------------------------------------------------- * * $FreeBSD: src/sys/kern/inflate.c,v 1.14 1999/12/29 04:54:39 peter Exp $ - * $DragonFly: src/sys/kern/inflate.c,v 1.4 2003/08/26 21:09:02 rob Exp $ + * $DragonFly: src/sys/kern/inflate.c,v 1.5 2006/09/05 00:55:45 dillon Exp $ * * */ @@ -53,8 +53,8 @@ static const int qflag = 0; #ifndef _KERNEL /* want to use this file in kzip also */ extern unsigned char *kzipmalloc (int); extern void kzipfree (void*); -#define malloc(x, y, z) kzipmalloc((x)) -#define free(x, y) kzipfree((x)) +#define kmalloc(x, y, z) kzipmalloc((x)) +#define kfree(x, y) kzipfree((x)) #endif /* @@ -552,7 +552,7 @@ huft_build(glbl, b, n, s, d, e, t, m) l[h] = j; /* set table size in stack */ /* allocate and link in new table */ - if ((q = (struct huft *) malloc((z + 1) * sizeof(struct huft), M_GZIP, M_WAITOK)) == + if ((q = (struct huft *) kmalloc((z + 1) * sizeof(struct huft), M_GZIP, M_WAITOK)) == (struct huft *) NULL) { if (h) huft_free(glbl, u[0]); @@ -630,7 +630,7 @@ huft_free(glbl, t) p = t; while (p != (struct huft *) NULL) { q = (--p)->v.t; - free(p, M_GZIP); + kfree(p, M_GZIP); p = q; } return 0; @@ -1050,7 +1050,7 @@ inflate(glbl) u_char *p = NULL; if (!glbl->gz_slide) - p = glbl->gz_slide = malloc(GZ_WSIZE, M_GZIP, M_WAITOK); + p = glbl->gz_slide = kmalloc(GZ_WSIZE, M_GZIP, M_WAITOK); #endif if (!glbl->gz_slide) #ifdef _KERNEL @@ -1070,7 +1070,7 @@ inflate(glbl) } #ifdef _KERNEL if (p == glbl->gz_slide) { - free(glbl->gz_slide, M_GZIP); + kfree(glbl->gz_slide, M_GZIP); glbl->gz_slide = NULL; } #endif diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index 41f5193682..011eb9afd2 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -40,7 +40,7 @@ * * @(#)init_main.c 8.9 (Berkeley) 1/21/94 * $FreeBSD: src/sys/kern/init_main.c,v 1.134.2.8 2003/06/06 20:21:32 tegge Exp $ - * $DragonFly: src/sys/kern/init_main.c,v 1.61 2006/09/03 18:52:28 dillon Exp $ + * $DragonFly: src/sys/kern/init_main.c,v 1.62 2006/09/05 00:55:45 dillon Exp $ */ #include "opt_init_path.h" @@ -128,7 +128,7 @@ sysinit_add(struct sysinit **set, struct sysinit **set_end) count += newsysinit_end - newsysinit; else count += sysinit_end - sysinit; - newset = malloc(count * sizeof(*sipp), M_TEMP, M_WAITOK); + newset = kmalloc(count * sizeof(*sipp), M_TEMP, M_WAITOK); if (newset == NULL) panic("cannot malloc for sysinit"); xipp = newset; @@ -142,7 +142,7 @@ sysinit_add(struct sysinit **set, struct sysinit **set_end) for (sipp = set; sipp < set_end; sipp++) *xipp++ = *sipp; if (newsysinit) - free(newsysinit, M_TEMP); + kfree(newsysinit, M_TEMP); newsysinit = newset; newsysinit_end = newset + count; } @@ -212,7 +212,7 @@ restart: /* Check if we've installed more sysinit items via KLD */ if (newsysinit != NULL) { if (sysinit != SET_BEGIN(sysinit_set)) - free(sysinit, M_TEMP); + kfree(sysinit, M_TEMP); sysinit = newsysinit; sysinit_end = newsysinit_end; newsysinit = NULL; diff --git a/sys/kern/kern_checkpoint.c b/sys/kern/kern_checkpoint.c index 8efbaf2e64..b223e12b9e 100644 --- a/sys/kern/kern_checkpoint.c +++ b/sys/kern/kern_checkpoint.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/kern/kern_checkpoint.c,v 1.9 2006/06/05 07:26:10 dillon Exp $ + * $DragonFly: src/sys/kern/kern_checkpoint.c,v 1.10 2006/09/05 00:55:45 dillon Exp $ */ #include @@ -191,10 +191,10 @@ elf_getnotes(struct proc *p, struct file *fp, size_t notesz) if (nthreads <= 0 || nthreads > CKPT_MAXTHREADS) return EINVAL; - psinfo = malloc(sizeof(prpsinfo_t), M_TEMP, M_ZERO | M_WAITOK); - status = malloc(nthreads*sizeof(prstatus_t), M_TEMP, M_WAITOK); - fpregset = malloc(nthreads*sizeof(prfpregset_t), M_TEMP, M_WAITOK); - note = malloc(notesz, M_TEMP, M_WAITOK); + psinfo = kmalloc(sizeof(prpsinfo_t), M_TEMP, M_ZERO | M_WAITOK); + status = kmalloc(nthreads*sizeof(prstatus_t), M_TEMP, M_WAITOK); + fpregset = kmalloc(nthreads*sizeof(prfpregset_t), M_TEMP, M_WAITOK); + note = kmalloc(notesz, M_TEMP, M_WAITOK); PRINTF(("reading notes section\n")); @@ -207,13 +207,13 @@ elf_getnotes(struct proc *p, struct file *fp, size_t notesz) error = elf_loadnotes(p, psinfo, status, fpregset); done: if (psinfo) - free(psinfo, M_TEMP); + kfree(psinfo, M_TEMP); if (status) - free(status, M_TEMP); + kfree(status, M_TEMP); if (fpregset) - free(fpregset, M_TEMP); + kfree(fpregset, M_TEMP); if (note) - free(note, M_TEMP); + kfree(note, M_TEMP); return error; } @@ -228,12 +228,12 @@ ckpt_thaw_proc(struct proc *p, struct file *fp) TRACE_ENTER; - ehdr = malloc(sizeof(Elf_Ehdr), M_TEMP, M_ZERO | M_WAITOK); + ehdr = kmalloc(sizeof(Elf_Ehdr), M_TEMP, M_ZERO | M_WAITOK); if ((error = elf_gethdr(fp, ehdr)) != 0) goto done; nbyte = sizeof(Elf_Phdr) * ehdr->e_phnum; - phdr = malloc(nbyte, M_TEMP, M_WAITOK); + phdr = kmalloc(nbyte, M_TEMP, M_WAITOK); /* fetch description of program writable mappings */ if ((error = elf_getphdrs(fp, phdr, nbyte)) != 0) @@ -276,9 +276,9 @@ ckpt_thaw_proc(struct proc *p, struct file *fp) } done: if (ehdr) - free(ehdr, M_TEMP); + kfree(ehdr, M_TEMP); if (phdr) - free(phdr, M_TEMP); + kfree(phdr, M_TEMP); TRACE_EXIT; return error; } @@ -451,7 +451,7 @@ elf_getsigs(struct proc *p, struct file *fp) struct sigacts *tmpsigacts; TRACE_ENTER; - csi = malloc(sizeof(struct ckpt_siginfo), M_TEMP, M_ZERO | M_WAITOK); + csi = kmalloc(sizeof(struct ckpt_siginfo), M_TEMP, M_ZERO | M_WAITOK); if ((error = read_check(fp, csi, sizeof(struct ckpt_siginfo))) != 0) goto done; @@ -470,7 +470,7 @@ elf_getsigs(struct proc *p, struct file *fp) p->p_sigparent = csi->csi_sigparent; done: if (csi) - free(csi, M_TEMP); + kfree(csi, M_TEMP); TRACE_EXIT; return error; } @@ -561,7 +561,7 @@ elf_gettextvp(struct proc *p, struct file *fp) p->p_vmspace->vm_tsize = vminfo.cvm_tsize; if ((error = read_check(fp, &vpcount, sizeof(int))) != 0) goto done; - vnh = malloc(sizeof(struct vn_hdr) * vpcount, M_TEMP, M_WAITOK); + vnh = kmalloc(sizeof(struct vn_hdr) * vpcount, M_TEMP, M_WAITOK); if ((error = read_check(fp, vnh, sizeof(struct vn_hdr)*vpcount)) != 0) goto done; for (i = 0; i < vpcount; i++) { @@ -571,7 +571,7 @@ elf_gettextvp(struct proc *p, struct file *fp) done: if (vnh) - free(vnh, M_TEMP); + kfree(vnh, M_TEMP); TRACE_EXIT; return error; } @@ -596,7 +596,7 @@ elf_getfiles(struct proc *p, struct file *fp) if ((error = read_check(fp, &filehdr, sizeof(filehdr))) != 0) goto done; filecount = filehdr.cfh_nfiles; - cfi_base = malloc(filecount*sizeof(struct ckpt_fileinfo), M_TEMP, M_WAITOK); + cfi_base = kmalloc(filecount*sizeof(struct ckpt_fileinfo), M_TEMP, M_WAITOK); error = read_check(fp, cfi_base, filecount*sizeof(struct ckpt_fileinfo)); if (error) goto done; @@ -660,7 +660,7 @@ elf_getfiles(struct proc *p, struct file *fp) done: if (cfi_base) - free(cfi_base, M_TEMP); + kfree(cfi_base, M_TEMP); TRACE_EXIT; return error; } @@ -780,7 +780,7 @@ checkpoint_signal_handler(struct proc *p) } else { printf("checkpoint failed with open - error: %d\n", error); } - free(buf, M_TEMP); + kfree(buf, M_TEMP); chptinuse--; return (error); } @@ -816,14 +816,14 @@ ckpt_expand_name(const char *name, uid_t uid, pid_t pid) char *format = ckptfilename; size_t namelen; - temp = malloc(MAXPATHLEN + 1, M_TEMP, M_NOWAIT); + temp = kmalloc(MAXPATHLEN + 1, M_TEMP, M_NOWAIT); if (temp == NULL) return NULL; namelen = strlen(name); n = 0; if (ckptfilename[0] != '/') { if ((bp = kern_getcwd(temp, MAXPATHLEN - 1, &error)) == NULL) { - free(temp, M_TEMP); + kfree(temp, M_TEMP); return NULL; } n = strlen(bp); @@ -844,7 +844,7 @@ ckpt_expand_name(const char *name, uid_t uid, pid_t pid) if ((n + namelen) > MAXPATHLEN) { log(LOG_ERR, "pid %d (%s), uid (%u): Path `%s%s' is too long\n", pid, name, uid, temp, name); - free(temp, M_TEMP); + kfree(temp, M_TEMP); return NULL; } memcpy(temp+n, name, namelen); @@ -855,7 +855,7 @@ ckpt_expand_name(const char *name, uid_t uid, pid_t pid) if ((n + l) > MAXPATHLEN) { log(LOG_ERR, "pid %d (%s), uid (%u): Path `%s%s' is too long\n", pid, name, uid, temp, name); - free(temp, M_TEMP); + kfree(temp, M_TEMP); return NULL; } memcpy(temp+n, buf, l); @@ -866,7 +866,7 @@ ckpt_expand_name(const char *name, uid_t uid, pid_t pid) if ((n + l) > MAXPATHLEN) { log(LOG_ERR, "pid %d (%s), uid (%u): Path `%s%s' is too long\n", pid, name, uid, temp, name); - free(temp, M_TEMP); + kfree(temp, M_TEMP); return NULL; } memcpy(temp+n, buf, l); diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 3200417ac0..722c8337ab 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -70,7 +70,7 @@ * * @(#)kern_descrip.c 8.6 (Berkeley) 4/19/94 * $FreeBSD: src/sys/kern/kern_descrip.c,v 1.81.2.19 2004/02/28 00:43:31 tegge Exp $ - * $DragonFly: src/sys/kern/kern_descrip.c,v 1.71 2006/08/02 01:25:25 dillon Exp $ + * $DragonFly: src/sys/kern/kern_descrip.c,v 1.72 2006/09/05 00:55:45 dillon Exp $ */ #include "opt_compat.h" @@ -634,7 +634,7 @@ funsetown(struct sigio *sigio) sigio, sio_pgsigio); } crfree(sigio->sio_ucred); - free(sigio, M_SIGIO); + kfree(sigio, M_SIGIO); } /* Free a list of sigio structures. */ @@ -700,7 +700,7 @@ fsetown(pid_t pgid, struct sigio **sigiop) proc = NULL; } funsetown(*sigiop); - sigio = malloc(sizeof(struct sigio), M_SIGIO, M_WAITOK); + sigio = kmalloc(sizeof(struct sigio), M_SIGIO, M_WAITOK); if (pgid > 0) { SLIST_INSERT_HEAD(&proc->p_sigiolst, sigio, sio_pgsigio); sigio->sio_proc = proc; @@ -977,7 +977,7 @@ fdgrow_locked(struct filedesc *fdp, int want) } while (nf <= want); spin_unlock_wr(&fdp->fd_spin); - newfiles = malloc(nf * sizeof(struct fdnode), M_FILEDESC, M_WAITOK); + newfiles = kmalloc(nf * sizeof(struct fdnode), M_FILEDESC, M_WAITOK); spin_lock_wr(&fdp->fd_spin); /* @@ -986,7 +986,7 @@ fdgrow_locked(struct filedesc *fdp, int want) */ if (fdp->fd_nfiles >= nf) { spin_unlock_wr(&fdp->fd_spin); - free(newfiles, M_FILEDESC); + kfree(newfiles, M_FILEDESC); spin_lock_wr(&fdp->fd_spin); return; } @@ -1004,7 +1004,7 @@ fdgrow_locked(struct filedesc *fdp, int want) if (oldfiles != fdp->fd_builtin_files) { spin_unlock_wr(&fdp->fd_spin); - free(oldfiles, M_FILEDESC); + kfree(oldfiles, M_FILEDESC); spin_lock_wr(&fdp->fd_spin); } fdexpand++; @@ -1221,7 +1221,7 @@ falloc(struct proc *p, struct file **resultfp, int *resultfd) /* * Allocate a new file descriptor. */ - fp = malloc(sizeof(struct file), M_FILE, M_WAITOK | M_ZERO); + fp = kmalloc(sizeof(struct file), M_FILE, M_WAITOK | M_ZERO); spin_init(&fp->f_spin); fp->f_count = 1; fp->f_ops = &badfileops; @@ -1417,7 +1417,7 @@ ffree(struct file *fp) cache_drop(fp->f_ncp); fp->f_ncp = NULL; } - free(fp, M_FILE); + kfree(fp, M_FILE); } /* @@ -1447,7 +1447,7 @@ fdinit(struct proc *p) struct filedesc *newfdp; struct filedesc *fdp = p->p_fd; - newfdp = malloc(sizeof(struct filedesc), M_FILEDESC, M_WAITOK|M_ZERO); + newfdp = kmalloc(sizeof(struct filedesc), M_FILEDESC, M_WAITOK|M_ZERO); spin_lock_rd(&fdp->fd_spin); if (fdp->fd_cdir) { newfdp->fd_cdir = fdp->fd_cdir; @@ -1525,7 +1525,7 @@ fdcopy(struct proc *p) * with operations by other threads on the fdp so we have to be * careful. */ - newfdp = malloc(sizeof(struct filedesc), M_FILEDESC, M_WAITOK | M_ZERO); + newfdp = kmalloc(sizeof(struct filedesc), M_FILEDESC, M_WAITOK | M_ZERO); again: spin_lock_rd(&fdp->fd_spin); if (fdp->fd_lastfile < NDFILE) { @@ -1552,7 +1552,7 @@ again: spin_lock_rd(&fdp->fd_spin); if (i <= fdp->fd_lastfile) { spin_unlock_rd(&fdp->fd_spin); - free(newfdp->fd_files, M_FILEDESC); + kfree(newfdp->fd_files, M_FILEDESC); goto again; } } @@ -1716,7 +1716,7 @@ fdfree(struct proc *p) p->p_fdtol = NULL; if (fdtol != NULL) { spin_unlock_wr(&fdp->fd_spin); - free(fdtol, M_FILEDESC_TO_LEADER); + kfree(fdtol, M_FILEDESC_TO_LEADER); spin_lock_wr(&fdp->fd_spin); } } @@ -1735,7 +1735,7 @@ fdfree(struct proc *p) closef(fdp->fd_files[i].fp, td); } if (fdp->fd_files != fdp->fd_builtin_files) - free(fdp->fd_files, M_FILEDESC); + kfree(fdp->fd_files, M_FILEDESC); if (fdp->fd_cdir) { cache_drop(fdp->fd_ncdir); vrele(fdp->fd_cdir); @@ -1749,10 +1749,10 @@ fdfree(struct proc *p) vrele(fdp->fd_jdir); } if (fdp->fd_knlist) - free(fdp->fd_knlist, M_KQUEUE); + kfree(fdp->fd_knlist, M_KQUEUE); if (fdp->fd_knhash) - free(fdp->fd_knhash, M_KQUEUE); - free(fdp, M_FILEDESC); + kfree(fdp->fd_knhash, M_KQUEUE); + kfree(fdp, M_FILEDESC); } /* diff --git a/sys/kern/kern_device.c b/sys/kern/kern_device.c index c74b6fe7c2..53b287e9b1 100644 --- a/sys/kern/kern_device.c +++ b/sys/kern/kern_device.c @@ -27,7 +27,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/kern/kern_device.c,v 1.18 2006/07/28 02:17:40 dillon Exp $ + * $DragonFly: src/sys/kern/kern_device.c,v 1.19 2006/09/05 00:55:45 dillon Exp $ */ #include #include @@ -431,7 +431,7 @@ dev_ops_add(struct dev_ops *ops, u_int mask, u_int match) */ } - link = malloc(sizeof(struct dev_ops_link), M_DEVBUF, M_INTWAIT|M_ZERO); + link = kmalloc(sizeof(struct dev_ops_link), M_DEVBUF, M_INTWAIT|M_ZERO); link->mask = mask; link->match = match; link->ops = ops; @@ -480,7 +480,7 @@ dev_ops_add_override(dev_t backing_dev, struct dev_ops *template, struct dev_ops *ops; struct dev_ops *backing_ops = backing_dev->si_ops; - ops = malloc(sizeof(struct dev_ops), M_DEVBUF, M_INTWAIT); + ops = kmalloc(sizeof(struct dev_ops), M_DEVBUF, M_INTWAIT); *ops = *template; ops->head.name = backing_ops->head.name; ops->head.maj = backing_ops->head.maj; @@ -532,7 +532,7 @@ dev_ops_remove(struct dev_ops *ops, u_int mask, u_int match) } else { *plink = link->next; --ops->head.refs; /* XXX ops_release() / record refs */ - free(link, M_DEVBUF); + kfree(link, M_DEVBUF); } if (dev_ops_array[maj] == NULL && ops->head.refs != 0) { printf("%s(%d)[%08x/%08x]: Warning: dev_ops_remove() called " diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index c78dcc789b..6af0d9e3ab 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/kern/kern_event.c,v 1.2.2.10 2004/04/04 07:03:14 cperciva Exp $ - * $DragonFly: src/sys/kern/kern_event.c,v 1.28 2006/08/02 01:25:25 dillon Exp $ + * $DragonFly: src/sys/kern/kern_event.c,v 1.29 2006/09/05 00:55:45 dillon Exp $ */ #include @@ -384,7 +384,7 @@ sys_kqueue(struct kqueue_args *uap) fp->f_type = DTYPE_KQUEUE; fp->f_ops = &kqueueops; - kq = malloc(sizeof(struct kqueue), M_KQUEUE, M_WAITOK | M_ZERO); + kq = kmalloc(sizeof(struct kqueue), M_KQUEUE, M_WAITOK | M_ZERO); TAILQ_INIT(&kq->kq_head); kq->kq_fdp = fdp; fp->f_data = kq; @@ -846,7 +846,7 @@ kqueue_close(struct file *fp) fp->f_data = NULL; rel_mplock(); - free(kq, M_KQUEUE); + kfree(kq, M_KQUEUE); return (0); } diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index b7c3216569..8a9fb2b6a6 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/kern/kern_exec.c,v 1.107.2.15 2002/07/30 15:40:46 nectar Exp $ - * $DragonFly: src/sys/kern/kern_exec.c,v 1.43 2006/09/03 18:29:16 dillon Exp $ + * $DragonFly: src/sys/kern/kern_exec.c,v 1.44 2006/09/05 00:55:45 dillon Exp $ */ #include @@ -959,7 +959,7 @@ exec_register(const struct execsw *execsw_arg) if (execsw) for (es = execsw; *es; es++) count++; - newexecsw = malloc(count * sizeof(*es), M_TEMP, M_WAITOK); + newexecsw = kmalloc(count * sizeof(*es), M_TEMP, M_WAITOK); if (newexecsw == NULL) return ENOMEM; xs = newexecsw; @@ -969,7 +969,7 @@ exec_register(const struct execsw *execsw_arg) *xs++ = execsw_arg; *xs = NULL; if (execsw) - free(execsw, M_TEMP); + kfree(execsw, M_TEMP); execsw = newexecsw; return 0; } @@ -992,7 +992,7 @@ exec_unregister(const struct execsw *execsw_arg) for (es = execsw; *es; es++) if (*es != execsw_arg) count++; - newexecsw = malloc(count * sizeof(*es), M_TEMP, M_WAITOK); + newexecsw = kmalloc(count * sizeof(*es), M_TEMP, M_WAITOK); if (newexecsw == NULL) return ENOMEM; xs = newexecsw; @@ -1001,7 +1001,7 @@ exec_unregister(const struct execsw *execsw_arg) *xs++ = *es; *xs = NULL; if (execsw) - free(execsw, M_TEMP); + kfree(execsw, M_TEMP); execsw = newexecsw; return 0; } diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index f615af14d4..ab1c83c707 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -37,7 +37,7 @@ * * @(#)kern_exit.c 8.7 (Berkeley) 2/12/94 * $FreeBSD: src/sys/kern/kern_exit.c,v 1.92.2.11 2003/01/13 22:51:16 dillon Exp $ - * $DragonFly: src/sys/kern/kern_exit.c,v 1.60 2006/09/03 18:29:16 dillon Exp $ + * $DragonFly: src/sys/kern/kern_exit.c,v 1.61 2006/09/05 00:55:45 dillon Exp $ */ #include "opt_compat.h" @@ -618,7 +618,7 @@ at_exit(exitlist_fn function) printf("WARNING: exit callout entry (%p) already present\n", function); #endif - ep = malloc(sizeof(*ep), M_ATEXIT, M_NOWAIT); + ep = kmalloc(sizeof(*ep), M_ATEXIT, M_NOWAIT); if (ep == NULL) return (ENOMEM); ep->function = function; @@ -638,7 +638,7 @@ rm_at_exit(exitlist_fn function) TAILQ_FOREACH(ep, &exit_list, next) { if (ep->function == function) { TAILQ_REMOVE(&exit_list, ep, next); - free(ep, M_ATEXIT); + kfree(ep, M_ATEXIT); return(1); } } diff --git a/sys/kern/kern_firmware.c b/sys/kern/kern_firmware.c index f224e571c1..85d55652be 100644 --- a/sys/kern/kern_firmware.c +++ b/sys/kern/kern_firmware.c @@ -30,7 +30,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/kern/kern_firmware.c,v 1.4 2006/09/04 07:00:58 dillon Exp $ + * $DragonFly: src/sys/kern/kern_firmware.c,v 1.5 2006/09/05 00:55:45 dillon Exp $ */ #include @@ -84,8 +84,8 @@ firmware_destroy_image(struct fw_image *img) bus_dmamap_unload(img->fw_dma_tag, img->fw_dma_map); bus_dmamem_free(img->fw_dma_tag, img->fw_image, img->fw_dma_map); bus_dma_tag_destroy(img->fw_dma_tag); - free(__DECONST(char *, img->fw_name), M_DEVBUF); - free(img, M_DEVBUF); + kfree(__DECONST(char *, img->fw_name), M_DEVBUF); + kfree(img, M_DEVBUF); } static void @@ -105,7 +105,7 @@ firmware_prepare_image(const char *imgname, size_t imglen) struct fw_image *img; int error; - img = malloc(sizeof(*img), M_DEVBUF, M_WAITOK | M_ZERO); + img = kmalloc(sizeof(*img), M_DEVBUF, M_WAITOK | M_ZERO); img->fw_name = kstrdup(imgname, M_DEVBUF); /* XXX necessary? */ img->fw_refcnt = 1; img->fw_imglen = imglen; @@ -135,8 +135,8 @@ fail_dma_load: fail_dma_alloc: bus_dma_tag_destroy(img->fw_dma_tag); fail_tag_create: - free(__DECONST(char *, img->fw_name), M_DEVBUF); - free(img, M_DEVBUF); + kfree(__DECONST(char *, img->fw_name), M_DEVBUF); + kfree(img, M_DEVBUF); return(NULL); } @@ -152,7 +152,7 @@ firmware_image_load_file(const char *image_name) char *fw_path; int error; - fw_path = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); + fw_path = kmalloc(MAXPATHLEN, M_TEMP, M_WAITOK); snprintf(fw_path, MAXPATHLEN, "%s/%s", firmware_root, image_name); /* XXX: access? */ @@ -192,6 +192,6 @@ fail_read: fail_stat: fp_close(fp); fail_open: - free(fw_path, M_TEMP); + kfree(fw_path, M_TEMP); return(NULL); } diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 5d23b82712..6ad3cb37ff 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -37,7 +37,7 @@ * * @(#)kern_fork.c 8.6 (Berkeley) 4/8/94 * $FreeBSD: src/sys/kern/kern_fork.c,v 1.72.2.14 2003/06/26 04:15:10 silby Exp $ - * $DragonFly: src/sys/kern/kern_fork.c,v 1.54 2006/06/07 03:02:10 dillon Exp $ + * $DragonFly: src/sys/kern/kern_fork.c,v 1.55 2006/09/05 00:55:45 dillon Exp $ */ #include "opt_ktrace.h" @@ -520,7 +520,7 @@ at_fork(forklist_fn function) function); } #endif - ep = malloc(sizeof(*ep), M_ATFORK, M_WAITOK|M_ZERO); + ep = kmalloc(sizeof(*ep), M_ATFORK, M_WAITOK|M_ZERO); ep->function = function; TAILQ_INSERT_TAIL(&fork_list, ep, next); return (0); @@ -538,7 +538,7 @@ rm_at_fork(forklist_fn function) TAILQ_FOREACH(ep, &fork_list, next) { if (ep->function == function) { TAILQ_REMOVE(&fork_list, ep, next); - free(ep, M_ATFORK); + kfree(ep, M_ATFORK); return(1); } } diff --git a/sys/kern/kern_intr.c b/sys/kern/kern_intr.c index eff6398866..2de006b1fa 100644 --- a/sys/kern/kern_intr.c +++ b/sys/kern/kern_intr.c @@ -24,7 +24,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/kern/kern_intr.c,v 1.24.2.1 2001/10/14 20:05:50 luigi Exp $ - * $DragonFly: src/sys/kern/kern_intr.c,v 1.41 2006/01/25 19:56:21 dillon Exp $ + * $DragonFly: src/sys/kern/kern_intr.c,v 1.42 2006/09/05 00:55:45 dillon Exp $ * */ @@ -189,8 +189,8 @@ register_int(int intr, inthand2_t *handler, void *arg, const char *name, /* * Construct an interrupt handler record */ - rec = malloc(sizeof(struct intrec), M_DEVBUF, M_INTWAIT); - rec->name = malloc(strlen(name) + 1, M_DEVBUF, M_INTWAIT); + rec = kmalloc(sizeof(struct intrec), M_DEVBUF, M_INTWAIT); + rec->name = kmalloc(strlen(name) + 1, M_DEVBUF, M_INTWAIT); strcpy(rec->name, name); rec->info = info; @@ -353,8 +353,8 @@ unregister_int(void *id) * Free the record. */ if (rec != NULL) { - free(rec->name, M_DEVBUF); - free(rec, M_DEVBUF); + kfree(rec->name, M_DEVBUF); + kfree(rec, M_DEVBUF); } else { printf("warning: unregister_int: int %d handler for %s not found\n", intr, ((intrec_t)id)->name); diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c index 198f5b3da2..1575901f42 100644 --- a/sys/kern/kern_jail.c +++ b/sys/kern/kern_jail.c @@ -7,7 +7,7 @@ * ---------------------------------------------------------------------------- * * $FreeBSD: src/sys/kern/kern_jail.c,v 1.6.2.3 2001/08/17 01:00:26 rwatson Exp $ - * $DragonFly: src/sys/kern/kern_jail.c,v 1.11 2006/06/05 07:26:10 dillon Exp $ + * $DragonFly: src/sys/kern/kern_jail.c,v 1.12 2006/09/05 00:55:45 dillon Exp $ * */ @@ -284,9 +284,9 @@ retry: if (count == 0) return(0); - sxp = xp = malloc(sizeof(*xp) * count, M_TEMP, M_WAITOK | M_ZERO); + sxp = xp = kmalloc(sizeof(*xp) * count, M_TEMP, M_WAITOK | M_ZERO); if (count < prisoncount) { - free(sxp, M_TEMP); + kfree(sxp, M_TEMP); goto retry; } count = prisoncount; @@ -298,7 +298,7 @@ retry: error = cache_fullpath(p, pr->pr_root, &fullpath, &freepath); if (error == 0) { strlcpy(xp->pr_path, fullpath, sizeof(xp->pr_path)); - free(freepath, M_TEMP); + kfree(freepath, M_TEMP); } else { bzero(xp->pr_path, sizeof(xp->pr_path)); } @@ -308,7 +308,7 @@ retry: } error = SYSCTL_OUT(req, sxp, sizeof(*sxp) * count); - free(sxp, M_TEMP); + kfree(sxp, M_TEMP); return(error); } @@ -333,8 +333,8 @@ prison_free(struct prison *pr) prisoncount--; if (pr->pr_linux != NULL) - free(pr->pr_linux, M_PRISON); + kfree(pr->pr_linux, M_PRISON); varsymset_clean(&pr->pr_varsymset); cache_drop(pr->pr_root); - free(pr, M_PRISON); + kfree(pr, M_PRISON); } diff --git a/sys/kern/kern_linker.c b/sys/kern/kern_linker.c index 40399c429e..e8874b6c62 100644 --- a/sys/kern/kern_linker.c +++ b/sys/kern/kern_linker.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/kern/kern_linker.c,v 1.41.2.3 2001/11/21 17:50:35 luigi Exp $ - * $DragonFly: src/sys/kern/kern_linker.c,v 1.28 2006/06/05 07:26:10 dillon Exp $ + * $DragonFly: src/sys/kern/kern_linker.c,v 1.29 2006/09/05 00:55:45 dillon Exp $ */ #include "opt_ddb.h" @@ -79,7 +79,7 @@ linker_add_class(const char* desc, void* priv, { linker_class_t lc; - lc = malloc(sizeof(struct linker_class), M_LINKER, M_NOWAIT); + lc = kmalloc(sizeof(struct linker_class), M_LINKER, M_NOWAIT); if (!lc) return ENOMEM; bzero(lc, sizeof(*lc)); @@ -256,7 +256,7 @@ linker_load_file(const char* filename, linker_file_t* result) goto out; } - koname = malloc(strlen(filename) + 4, M_LINKER, M_WAITOK); + koname = kmalloc(strlen(filename) + 4, M_LINKER, M_WAITOK); if (koname == NULL) { error = ENOMEM; goto out; @@ -306,7 +306,7 @@ linker_load_file(const char* filename, linker_file_t* result) out: if (koname) - free(koname, M_LINKER); + kfree(koname, M_LINKER); return error; } @@ -321,7 +321,7 @@ linker_find_file_by_name(const char* filename) ; filename += i; - koname = malloc(strlen(filename) + 4, M_LINKER, M_WAITOK); + koname = kmalloc(strlen(filename) + 4, M_LINKER, M_WAITOK); if (koname == NULL) goto out; sprintf(koname, "%s.ko", filename); @@ -337,7 +337,7 @@ linker_find_file_by_name(const char* filename) out: if (koname) - free(koname, M_LINKER); + kfree(koname, M_LINKER); return lf; } @@ -371,7 +371,7 @@ linker_make_file(const char* pathname, void* priv, struct linker_file_ops* ops) KLD_DPF(FILE, ("linker_make_file: new file, filename=%s\n", filename)); lockmgr(&lock, LK_EXCLUSIVE); namelen = strlen(filename) + 1; - lf = malloc(sizeof(struct linker_file) + namelen, M_LINKER, M_WAITOK); + lf = kmalloc(sizeof(struct linker_file) + namelen, M_LINKER, M_WAITOK); if (!lf) goto out; bzero(lf, sizeof(*lf)); @@ -475,16 +475,16 @@ linker_file_unload(linker_file_t file) for (i = 0; i < file->ndeps; i++) linker_file_unload(file->deps[i]); - free(file->deps, M_LINKER); + kfree(file->deps, M_LINKER); for (cp = STAILQ_FIRST(&file->common); cp; cp = STAILQ_FIRST(&file->common)) { STAILQ_REMOVE(&file->common, cp, common_symbol, link); - free(cp, M_LINKER); + kfree(cp, M_LINKER); } file->ops->unload(file); - free(file, M_LINKER); + kfree(file, M_LINKER); out: return error; @@ -503,7 +503,7 @@ linker_file_add_dependancy(linker_file_t file, linker_file_t dep) if (file->deps) { bcopy(file->deps, newdeps, file->ndeps * sizeof(linker_file_t*)); - free(file->deps, M_LINKER); + kfree(file->deps, M_LINKER); } file->deps = newdeps; file->deps[file->ndeps] = dep; @@ -714,7 +714,7 @@ sys_kldload(struct kldload_args *uap) if ((error = suser(td)) != 0) return error; - filename = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); + filename = kmalloc(MAXPATHLEN, M_TEMP, M_WAITOK); if ((error = copyinstr(uap->file, filename, MAXPATHLEN, NULL)) != 0) goto out; @@ -737,7 +737,7 @@ sys_kldload(struct kldload_args *uap) out: if (filename) - free(filename, M_TEMP); + kfree(filename, M_TEMP); return error; } @@ -782,7 +782,7 @@ sys_kldfind(struct kldfind_args *uap) uap->sysmsg_result = -1; - filename = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); + filename = kmalloc(MAXPATHLEN, M_TEMP, M_WAITOK); if ((error = copyinstr(uap->file, filename, MAXPATHLEN, NULL)) != 0) goto out; @@ -798,7 +798,7 @@ sys_kldfind(struct kldfind_args *uap) out: if (filename) - free(filename, M_TEMP); + kfree(filename, M_TEMP); return error; } @@ -910,7 +910,7 @@ sys_kldsym(struct kldsym_args *uap) goto out; } - symstr = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); + symstr = kmalloc(MAXPATHLEN, M_TEMP, M_WAITOK); if ((error = copyinstr(lookup.symname, symstr, MAXPATHLEN, NULL)) != 0) goto out; @@ -942,7 +942,7 @@ sys_kldsym(struct kldsym_args *uap) } out: if (symstr) - free(symstr, M_TEMP); + kfree(symstr, M_TEMP); return error; } @@ -1089,7 +1089,7 @@ linker_strdup(const char *str) { char *result; - if ((result = malloc((strlen(str) + 1), M_LINKER, M_WAITOK)) != NULL) + if ((result = kmalloc((strlen(str) + 1), M_LINKER, M_WAITOK)) != NULL) strcpy(result, str); return(result); } @@ -1113,7 +1113,7 @@ linker_search_path(const char *name) /* find the end of this component */ for (ep = cp; (*ep != 0) && (*ep != ';'); ep++) ; - result = malloc((strlen(name) + (ep - cp) + 1), M_LINKER, M_WAITOK); + result = kmalloc((strlen(name) + (ep - cp) + 1), M_LINKER, M_WAITOK); if (result == NULL) /* actually ENOMEM */ return(NULL); @@ -1135,7 +1135,7 @@ linker_search_path(const char *name) } } nlookup_done(&nd); - free(result, M_LINKER); + kfree(result, M_LINKER); if (*ep == 0) break; diff --git a/sys/kern/kern_lockf.c b/sys/kern/kern_lockf.c index 7d0949b051..9ff72c5cf7 100644 --- a/sys/kern/kern_lockf.c +++ b/sys/kern/kern_lockf.c @@ -38,7 +38,7 @@ * * @(#)ufs_lockf.c 8.3 (Berkeley) 1/6/94 * $FreeBSD: src/sys/kern/kern_lockf.c,v 1.25 1999/11/16 16:28:56 phk Exp $ - * $DragonFly: src/sys/kern/kern_lockf.c,v 1.33 2006/08/03 16:06:15 dillon Exp $ + * $DragonFly: src/sys/kern/kern_lockf.c,v 1.34 2006/09/05 00:55:45 dillon Exp $ */ #include @@ -792,7 +792,7 @@ lf_alloc_range(void) #ifdef INVARIANTS lf_global_counter++; #endif - range = malloc(sizeof(struct lockf_range), M_LOCKF, M_WAITOK); + range = kmalloc(sizeof(struct lockf_range), M_LOCKF, M_WAITOK); range->lf_owner = NULL; return(range); } @@ -829,7 +829,7 @@ lf_destroy_range(struct lockf_range *range) { lf_printf("lf_destroy_range: %lld..%lld\n", range->lf_start, range->lf_end); - free(range, M_LOCKF); + kfree(range, M_LOCKF); #ifdef INVARIANTS lf_global_counter--; KKASSERT(lf_global_counter>=0); diff --git a/sys/kern/kern_memio.c b/sys/kern/kern_memio.c index 7ba9f8ebe2..fa9d0600d6 100644 --- a/sys/kern/kern_memio.c +++ b/sys/kern/kern_memio.c @@ -39,7 +39,7 @@ * from: Utah $Hdr: mem.c 1.13 89/10/08$ * from: @(#)mem.c 7.2 (Berkeley) 5/9/91 * $FreeBSD: src/sys/i386/i386/mem.c,v 1.79.2.9 2003/01/04 22:58:01 njl Exp $ - * $DragonFly: src/sys/kern/kern_memio.c,v 1.17 2006/07/28 02:17:39 dillon Exp $ + * $DragonFly: src/sys/kern/kern_memio.c,v 1.18 2006/09/05 00:55:45 dillon Exp $ */ /* @@ -223,7 +223,7 @@ mmrw(dev_t dev, struct uio *uio, int flags) * on read, seeder on write */ if (buf == NULL) - buf = malloc(PAGE_SIZE, M_TEMP, M_WAITOK); + buf = kmalloc(PAGE_SIZE, M_TEMP, M_WAITOK); c = min(iov->iov_len, PAGE_SIZE); if (uio->uio_rw == UIO_WRITE) { error = uiomove(buf, (int)c, uio); @@ -233,7 +233,7 @@ mmrw(dev_t dev, struct uio *uio, int flags) poolsize = read_random(buf, c); if (poolsize == 0) { if (buf) - free(buf, M_TEMP); + kfree(buf, M_TEMP); if ((flags & IO_NDELAY) != 0) return (EWOULDBLOCK); return (0); @@ -262,7 +262,7 @@ mmrw(dev_t dev, struct uio *uio, int flags) continue; } if (buf == NULL) - buf = malloc(PAGE_SIZE, M_TEMP, M_WAITOK); + buf = kmalloc(PAGE_SIZE, M_TEMP, M_WAITOK); poolsize = read_random_unlimited(buf, c); c = min(c, poolsize); error = uiomove(buf, (int)c, uio); @@ -278,7 +278,7 @@ mmrw(dev_t dev, struct uio *uio, int flags) } if (zbuf == NULL) { zbuf = (caddr_t) - malloc(PAGE_SIZE, M_TEMP, M_WAITOK); + kmalloc(PAGE_SIZE, M_TEMP, M_WAITOK); bzero(zbuf, PAGE_SIZE); } c = min(iov->iov_len, PAGE_SIZE); @@ -295,7 +295,7 @@ mmrw(dev_t dev, struct uio *uio, int flags) uio->uio_resid -= c; } if (buf) - free(buf, M_TEMP); + kfree(buf, M_TEMP); return (error); } @@ -398,7 +398,7 @@ mem_ioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct ucred *cred) if (!error) error = copyout(md, mo->mo_desc, nd * sizeof(struct mem_range_desc)); - free(md, M_MEMDESC); + kfree(md, M_MEMDESC); } else { nd = mem_range_softc.mr_ndesc; } @@ -413,7 +413,7 @@ mem_ioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct ucred *cred) md->mr_owner[sizeof(md->mr_owner) - 1] = 0; if (error == 0) error = mem_range_attr_set(md, &mo->mo_arg[0]); - free(md, M_MEMDESC); + kfree(md, M_MEMDESC); break; } return (error); diff --git a/sys/kern/kern_module.c b/sys/kern/kern_module.c index c1d23ba8ac..45e716faf8 100644 --- a/sys/kern/kern_module.c +++ b/sys/kern/kern_module.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/kern/kern_module.c,v 1.21 1999/11/08 06:53:30 peter Exp $ - * $DragonFly: src/sys/kern/kern_module.c,v 1.10 2006/06/05 07:26:10 dillon Exp $ + * $DragonFly: src/sys/kern/kern_module.c,v 1.11 2006/09/05 00:55:45 dillon Exp $ */ #include @@ -181,7 +181,7 @@ module_release(module_t mod) if (mod->file) { TAILQ_REMOVE(&mod->file->modules, mod, flink); } - free(mod, M_MODULE); + kfree(mod, M_MODULE); } return(rc); } diff --git a/sys/kern/kern_mpipe.c b/sys/kern/kern_mpipe.c index 6a8f83e348..b83776d620 100644 --- a/sys/kern/kern_mpipe.c +++ b/sys/kern/kern_mpipe.c @@ -31,7 +31,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/kern/kern_mpipe.c,v 1.8 2004/07/16 05:51:10 dillon Exp $ + * $DragonFly: src/sys/kern/kern_mpipe.c,v 1.9 2006/09/05 00:55:45 dillon Exp $ */ #include @@ -80,12 +80,12 @@ mpipe_init(malloc_pipe_t mpipe, malloc_type_t type, int bytes, mpipe->mflags |= M_USE_RESERVE | M_USE_INTERRUPT_RESERVE; mpipe->ary_count = nnom; mpipe->max_count = nmax; - mpipe->array = malloc(nnom * sizeof(mpipe->array[0]), M_MPIPEARY, + mpipe->array = kmalloc(nnom * sizeof(mpipe->array[0]), M_MPIPEARY, M_WAITOK | M_ZERO); while (mpipe->free_count < nnom) { n = mpipe->free_count; - mpipe->array[n] = malloc(bytes, mpipe->type, M_WAITOK | mpipe->mflags); + mpipe->array[n] = kmalloc(bytes, mpipe->type, M_WAITOK | mpipe->mflags); ++mpipe->free_count; ++mpipe->total_count; } @@ -109,12 +109,12 @@ mpipe_done(malloc_pipe_t mpipe) KKASSERT(buf != NULL); if (mpipe->deconstruct) mpipe->deconstruct(mpipe, buf); - free(buf, mpipe->type); + kfree(buf, mpipe->type); } mpipe->free_count = 0; mpipe->total_count = 0; if (mpipe->array) { - free(mpipe->array, M_MPIPEARY); + kfree(mpipe->array, M_MPIPEARY); mpipe->array = NULL; } } @@ -149,7 +149,7 @@ mpipe_alloc_nowait(malloc_pipe_t mpipe) /* * Otherwise try to malloc() non-blocking. */ - buf = malloc(mpipe->bytes, mpipe->type, M_NOWAIT | mpipe->mflags); + buf = kmalloc(mpipe->bytes, mpipe->type, M_NOWAIT | mpipe->mflags); if (buf) ++mpipe->total_count; } @@ -193,7 +193,7 @@ mpipe_alloc_waitok(malloc_pipe_t mpipe) * Otherwise try to malloc() non-blocking. If that fails loop to * recheck, and block instead of trying to malloc() again. */ - buf = malloc(mpipe->bytes, mpipe->type, M_NOWAIT | mpipe->mflags); + buf = kmalloc(mpipe->bytes, mpipe->type, M_NOWAIT | mpipe->mflags); if (buf) { ++mpipe->total_count; break; @@ -242,7 +242,7 @@ mpipe_free(malloc_pipe_t mpipe, void *buf) if (mpipe->deconstruct) mpipe->deconstruct(mpipe, buf); crit_exit(); - free(buf, mpipe->type); + kfree(buf, mpipe->type); } } diff --git a/sys/kern/kern_msfbuf.c b/sys/kern/kern_msfbuf.c index cf64916ec4..58814adbed 100644 --- a/sys/kern/kern_msfbuf.c +++ b/sys/kern/kern_msfbuf.c @@ -36,7 +36,7 @@ * Copyright (c) 1998 David Greenman. All rights reserved. * src/sys/kern/kern_sfbuf.c,v 1.7 2004/05/13 19:46:18 dillon * - * $DragonFly: src/sys/kern/kern_msfbuf.c,v 1.17 2006/05/07 00:22:37 dillon Exp $ + * $DragonFly: src/sys/kern/kern_msfbuf.c,v 1.18 2006/09/05 00:55:45 dillon Exp $ */ /* * MSFBUFs cache linear multi-page ephermal mappings and operate similar @@ -121,7 +121,7 @@ msf_buf_init(void *__dummy) msf_base = kmem_alloc_nofault(kernel_map, msf_buf_count * XIO_INTERNAL_SIZE); - msf_bufs = malloc(msf_buf_count * sizeof(struct msf_buf), M_MSFBUF, + msf_bufs = kmalloc(msf_buf_count * sizeof(struct msf_buf), M_MSFBUF, M_WAITOK|M_ZERO); /* Initialize the free list with necessary information. */ diff --git a/sys/kern/kern_objcache.c b/sys/kern/kern_objcache.c index 10c39f1a39..55a8e5a2d2 100644 --- a/sys/kern/kern_objcache.c +++ b/sys/kern/kern_objcache.c @@ -29,7 +29,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/kern/kern_objcache.c,v 1.9 2006/09/04 07:00:58 dillon Exp $ + * $DragonFly: src/sys/kern/kern_objcache.c,v 1.10 2006/09/05 00:55:45 dillon Exp $ */ #include @@ -217,7 +217,7 @@ objcache_create_simple(malloc_type_t mtype, size_t objsize) struct objcache_malloc_args *margs; struct objcache *oc; - margs = malloc(sizeof(*margs), M_OBJCACHE, M_WAITOK|M_ZERO); + margs = kmalloc(sizeof(*margs), M_OBJCACHE, M_WAITOK|M_ZERO); margs->objsize = objsize; margs->mtype = mtype; oc = objcache_create(mtype->ks_shortdesc, 0, 0, @@ -381,7 +381,7 @@ objcache_malloc_alloc(void *allocator_args, int ocflags) { struct objcache_malloc_args *alloc_args = allocator_args; - return (malloc(alloc_args->objsize, alloc_args->mtype, + return (kmalloc(alloc_args->objsize, alloc_args->mtype, ocflags & OC_MFLAGS)); } @@ -390,7 +390,7 @@ objcache_malloc_free(void *obj, void *allocator_args) { struct objcache_malloc_args *alloc_args = allocator_args; - free(obj, alloc_args->mtype); + kfree(obj, alloc_args->mtype); } /* @@ -588,7 +588,7 @@ maglist_purge(struct objcache *oc, struct magazinelist *maglist, while ((mag = SLIST_FIRST(maglist))) { SLIST_REMOVE_HEAD(maglist, nextmagazine); ndeleted += mag_purge(oc, mag); /* could block! */ - free(mag, M_OBJMAG); /* could block! */ + kfree(mag, M_OBJMAG); /* could block! */ if (!purgeall && ndeleted > 0) break; } @@ -687,14 +687,14 @@ objcache_destroy(struct objcache *oc) cache_percpu = &oc->cache_percpu[cpuid]; mag_purge(oc, cache_percpu->loaded_magazine); - free(cache_percpu->loaded_magazine, M_OBJMAG); + kfree(cache_percpu->loaded_magazine, M_OBJMAG); mag_purge(oc, cache_percpu->previous_magazine); - free(cache_percpu->previous_magazine, M_OBJMAG); + kfree(cache_percpu->previous_magazine, M_OBJMAG); } - free(oc->name, M_TEMP); - free(oc, M_OBJCACHE); + kfree(oc->name, M_TEMP); + kfree(oc, M_OBJCACHE); } #if 0 diff --git a/sys/kern/kern_plimit.c b/sys/kern/kern_plimit.c index 9a8b9d39fd..009e144176 100644 --- a/sys/kern/kern_plimit.c +++ b/sys/kern/kern_plimit.c @@ -66,7 +66,7 @@ * * @(#)kern_resource.c 8.5 (Berkeley) 1/21/94 * $FreeBSD: src/sys/kern/kern_resource.c,v 1.55.2.5 2001/11/03 01:41:08 ps Exp $ - * $DragonFly: src/sys/kern/kern_plimit.c,v 1.1 2006/05/23 20:35:10 dillon Exp $ + * $DragonFly: src/sys/kern/kern_plimit.c,v 1.2 2006/09/05 00:55:45 dillon Exp $ */ #include @@ -162,7 +162,7 @@ plimit_exclusive(struct plimit **limitp) spin_lock_wr(&olimit->p_spin); if (--olimit->p_refcnt == 0) { spin_unlock_wr(&olimit->p_spin); - free(olimit, M_SUBPROC); + kfree(olimit, M_SUBPROC); } else { spin_unlock_wr(&olimit->p_spin); } @@ -181,7 +181,7 @@ plimit_copy(struct plimit *olimit) { struct plimit *nlimit; - nlimit = malloc(sizeof(struct plimit), M_SUBPROC, M_WAITOK); + nlimit = kmalloc(sizeof(struct plimit), M_SUBPROC, M_WAITOK); spin_lock_rd(&olimit->p_spin); *nlimit = *olimit; @@ -242,7 +242,7 @@ plimit_free(struct plimit **limitp) spin_lock_wr(&limit->p_spin); if (--limit->p_refcnt == 0) { spin_unlock_wr(&limit->p_spin); - free(limit, M_SUBPROC); + kfree(limit, M_SUBPROC); } else { spin_unlock_wr(&limit->p_spin); } diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index 006622a6aa..56b6a05000 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -32,7 +32,7 @@ * * @(#)kern_proc.c 8.7 (Berkeley) 2/14/95 * $FreeBSD: src/sys/kern/kern_proc.c,v 1.63.2.9 2003/05/08 07:47:16 kbyanc Exp $ - * $DragonFly: src/sys/kern/kern_proc.c,v 1.27 2006/09/03 18:29:16 dillon Exp $ + * $DragonFly: src/sys/kern/kern_proc.c,v 1.28 2006/09/05 00:55:45 dillon Exp $ */ #include @@ -279,7 +279,7 @@ pgdelete(struct pgrp *pgrp) pgrp->pg_session->s_ttyp->t_pgrp = NULL; LIST_REMOVE(pgrp, pg_hash); sess_rele(pgrp->pg_session); - free(pgrp, M_PGRP); + kfree(pgrp, M_PGRP); } /* @@ -309,7 +309,7 @@ sess_rele(struct session *sp) sp->s_ttyp->t_session = NULL; #endif } - free(sp, M_SESSION); + kfree(sp, M_SESSION); } } diff --git a/sys/kern/kern_sfbuf.c b/sys/kern/kern_sfbuf.c index 76d553095c..7d8f993d17 100644 --- a/sys/kern/kern_sfbuf.c +++ b/sys/kern/kern_sfbuf.c @@ -22,7 +22,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/kern/kern_sfbuf.c,v 1.12 2005/03/02 18:42:08 hmp Exp $ + * $DragonFly: src/sys/kern/kern_sfbuf.c,v 1.13 2006/09/05 00:55:45 dillon Exp $ */ #include @@ -89,7 +89,7 @@ sf_buf_init(void *arg) sf_buf_hashtable = hashinit(nsfbufs, M_TEMP, &sf_buf_hashmask); TAILQ_INIT(&sf_buf_freelist); sf_base = kmem_alloc_nofault(kernel_map, nsfbufs * PAGE_SIZE); - sf_bufs = malloc(nsfbufs * sizeof(struct sf_buf), M_TEMP, + sf_bufs = kmalloc(nsfbufs * sizeof(struct sf_buf), M_TEMP, M_WAITOK | M_ZERO); for (i = 0; i < nsfbufs; i++) { sf_bufs[i].kva = sf_base + i * PAGE_SIZE; diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c index b843b34dcd..40113ffee3 100644 --- a/sys/kern/kern_shutdown.c +++ b/sys/kern/kern_shutdown.c @@ -37,7 +37,7 @@ * * @(#)kern_shutdown.c 8.3 (Berkeley) 1/21/94 * $FreeBSD: src/sys/kern/kern_shutdown.c,v 1.72.2.12 2002/02/21 19:15:10 dillon Exp $ - * $DragonFly: src/sys/kern/kern_shutdown.c,v 1.33 2006/09/03 18:29:16 dillon Exp $ + * $DragonFly: src/sys/kern/kern_shutdown.c,v 1.34 2006/09/05 00:55:45 dillon Exp $ */ #include "opt_ddb.h" @@ -494,13 +494,13 @@ dump_conf(dummy) char *path; dev_t dev; - path = malloc(MNAMELEN, M_TEMP, M_WAITOK); + path = kmalloc(MNAMELEN, M_TEMP, M_WAITOK); if (TUNABLE_STR_FETCH("dumpdev", path, MNAMELEN) != 0) { dev = kgetdiskbyname(path); if (dev != NODEV) dumpdev = dev; } - free(path, M_TEMP); + kfree(path, M_TEMP); if (setdumpdev(dumpdev) != 0) dumpdev = NODEV; } diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index bcc7b976df..bee286138d 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -37,7 +37,7 @@ * * @(#)kern_sig.c 8.7 (Berkeley) 4/18/94 * $FreeBSD: src/sys/kern/kern_sig.c,v 1.72.2.17 2003/05/16 16:34:34 obrien Exp $ - * $DragonFly: src/sys/kern/kern_sig.c,v 1.52 2006/09/03 18:29:16 dillon Exp $ + * $DragonFly: src/sys/kern/kern_sig.c,v 1.53 2006/09/05 00:55:45 dillon Exp $ */ #include "opt_ktrace.h" @@ -1576,7 +1576,7 @@ expand_name(const char *name, uid_t uid, pid_t pid) char *format = corefilename; size_t namelen; - temp = malloc(MAXPATHLEN + 1, M_TEMP, M_NOWAIT); + temp = kmalloc(MAXPATHLEN + 1, M_TEMP, M_NOWAIT); if (temp == NULL) return NULL; namelen = strlen(name); @@ -1593,7 +1593,7 @@ expand_name(const char *name, uid_t uid, pid_t pid) if ((n + namelen) > MAXPATHLEN) { log(LOG_ERR, "pid %d (%s), uid (%u): Path `%s%s' is too long\n", pid, name, uid, temp, name); - free(temp, M_TEMP); + kfree(temp, M_TEMP); return NULL; } memcpy(temp+n, name, namelen); @@ -1604,7 +1604,7 @@ expand_name(const char *name, uid_t uid, pid_t pid) if ((n + l) > MAXPATHLEN) { log(LOG_ERR, "pid %d (%s), uid (%u): Path `%s%s' is too long\n", pid, name, uid, temp, name); - free(temp, M_TEMP); + kfree(temp, M_TEMP); return NULL; } memcpy(temp+n, buf, l); @@ -1615,7 +1615,7 @@ expand_name(const char *name, uid_t uid, pid_t pid) if ((n + l) > MAXPATHLEN) { log(LOG_ERR, "pid %d (%s), uid (%u): Path `%s%s' is too long\n", pid, name, uid, temp, name); - free(temp, M_TEMP); + kfree(temp, M_TEMP); return NULL; } memcpy(temp+n, buf, l); @@ -1676,7 +1676,7 @@ coredump(struct proc *p) error = nlookup_init(&nd, name, UIO_SYSSPACE, NLC_LOCKVP); if (error == 0) error = vn_open(&nd, NULL, O_CREAT | FWRITE | O_NOFOLLOW, S_IRUSR | S_IWUSR); - free(name, M_TEMP); + kfree(name, M_TEMP); if (error) { nlookup_done(&nd); return (error); diff --git a/sys/kern/kern_slaballoc.c b/sys/kern/kern_slaballoc.c index 82df2afaa1..753f9c6c57 100644 --- a/sys/kern/kern_slaballoc.c +++ b/sys/kern/kern_slaballoc.c @@ -33,7 +33,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/kern/kern_slaballoc.c,v 1.40 2006/09/04 23:03:36 dillon Exp $ + * $DragonFly: src/sys/kern/kern_slaballoc.c,v 1.41 2006/09/05 00:55:45 dillon Exp $ * * This module implements a slab allocator drop-in replacement for the * kernel malloc(). @@ -695,9 +695,9 @@ krealloc(void *ptr, unsigned long size, struct malloc_type *type, int flags) KKASSERT((flags & M_ZERO) == 0); /* not supported */ if (ptr == NULL || ptr == ZERO_LENGTH_PTR) - return(malloc(size, type, flags)); + return(kmalloc(size, type, flags)); if (size == 0) { - free(ptr, type); + kfree(ptr, type); return(NULL); } @@ -713,10 +713,10 @@ krealloc(void *ptr, unsigned long size, struct malloc_type *type, int flags) osize = kup->ku_pagecnt << PAGE_SHIFT; if (osize == round_page(size)) return(ptr); - if ((nptr = malloc(size, type, flags)) == NULL) + if ((nptr = kmalloc(size, type, flags)) == NULL) return(NULL); bcopy(ptr, nptr, min(size, osize)); - free(ptr, type); + kfree(ptr, type); return(nptr); } } @@ -737,10 +737,10 @@ krealloc(void *ptr, unsigned long size, struct malloc_type *type, int flags) * already adjusted the request size to the appropriate chunk size, which * should optimize our bcopy(). Then copy and return the new pointer. */ - if ((nptr = malloc(size, type, flags)) == NULL) + if ((nptr = kmalloc(size, type, flags)) == NULL) return(NULL); bcopy(ptr, nptr, min(size, z->z_ChunkSize)); - free(ptr, type); + kfree(ptr, type); return(nptr); } @@ -758,7 +758,7 @@ kstrdup(const char *str, struct malloc_type *type) if (str == NULL) return(NULL); zlen = strlen(str) + 1; - nstr = malloc(zlen, type, M_WAITOK); + nstr = kmalloc(zlen, type, M_WAITOK); bcopy(str, nstr, zlen); return(nstr); } @@ -774,7 +774,7 @@ void free_remote(void *ptr) { logmemory(free_remote, ptr, *(struct malloc_type **)ptr, -1, 0); - free(ptr, *(struct malloc_type **)ptr); + kfree(ptr, *(struct malloc_type **)ptr); } #endif diff --git a/sys/kern/kern_subr.c b/sys/kern/kern_subr.c index f1401a4d6c..0054a33baf 100644 --- a/sys/kern/kern_subr.c +++ b/sys/kern/kern_subr.c @@ -37,7 +37,7 @@ * * @(#)kern_subr.c 8.3 (Berkeley) 1/21/94 * $FreeBSD: src/sys/kern/kern_subr.c,v 1.31.2.2 2002/04/21 08:09:37 bde Exp $ - * $DragonFly: src/sys/kern/kern_subr.c,v 1.23 2006/05/27 20:17:16 dillon Exp $ + * $DragonFly: src/sys/kern/kern_subr.c,v 1.24 2006/09/05 00:55:45 dillon Exp $ */ #include "opt_ddb.h" @@ -277,7 +277,7 @@ hashinit(elements, type, hashmask) panic("hashinit: bad elements"); for (hashsize = 2; hashsize < elements; hashsize <<= 1) continue; - hashtbl = malloc((u_long)hashsize * sizeof(*hashtbl), type, M_WAITOK); + hashtbl = kmalloc((u_long)hashsize * sizeof(*hashtbl), type, M_WAITOK); for (i = 0; i < hashsize; i++) LIST_INIT(&hashtbl[i]); *hashmask = hashsize - 1; @@ -311,7 +311,7 @@ phashinit(elements, type, nentries) hashsize = primes[i]; } hashsize = primes[i - 1]; - hashtbl = malloc((u_long)hashsize * sizeof(*hashtbl), type, M_WAITOK); + hashtbl = kmalloc((u_long)hashsize * sizeof(*hashtbl), type, M_WAITOK); for (i = 0; i < hashsize; i++) LIST_INIT(&hashtbl[i]); *nentries = hashsize; diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index 952098209d..8f4470a4cb 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -38,7 +38,7 @@ * * @(#)kern_sysctl.c 8.4 (Berkeley) 4/14/94 * $FreeBSD: src/sys/kern/kern_sysctl.c,v 1.92.2.9 2003/05/01 22:48:09 trhodes Exp $ - * $DragonFly: src/sys/kern/kern_sysctl.c,v 1.22 2006/06/05 07:26:10 dillon Exp $ + * $DragonFly: src/sys/kern/kern_sysctl.c,v 1.23 2006/09/05 00:55:45 dillon Exp $ */ #include @@ -238,7 +238,7 @@ sysctl_ctx_free(struct sysctl_ctx_list *clist) if (error) panic("sysctl_remove_oid: corrupt tree, entry: %s", e->entry->oid_name); - free(e, M_SYSCTLOID); + kfree(e, M_SYSCTLOID); e = e1; } sysctl_ctx_unlock(); @@ -253,7 +253,7 @@ sysctl_ctx_entry_add(struct sysctl_ctx_list *clist, struct sysctl_oid *oidp) if (clist == NULL || oidp == NULL) return(NULL); - e = malloc(sizeof(struct sysctl_ctx_entry), M_SYSCTLOID, M_WAITOK); + e = kmalloc(sizeof(struct sysctl_ctx_entry), M_SYSCTLOID, M_WAITOK); e->entry = oidp; sysctl_ctx_lock(LK_EXCLUSIVE); TAILQ_INSERT_HEAD(clist, e, link); @@ -312,7 +312,7 @@ sysctl_ctx_entry_del(struct sysctl_ctx_list *clist, struct sysctl_oid *oidp) return (ENOENT); } TAILQ_REMOVE(clist, e, link); - free(e, M_SYSCTLOID); + kfree(e, M_SYSCTLOID); sysctl_ctx_unlock(); return(0); @@ -358,7 +358,7 @@ sysctl_remove_oid(struct sysctl_oid *oidp, int del, int recurse) } } if (del) - free(SYSCTL_CHILDREN(oidp), M_SYSCTLOID); + kfree(SYSCTL_CHILDREN(oidp), M_SYSCTLOID); } } if (oidp->oid_refcnt > 1 ) { @@ -373,10 +373,10 @@ sysctl_remove_oid(struct sysctl_oid *oidp, int del, int recurse) sysctl_unregister_oid_int(oidp); if (del) { if (oidp->oid_descr) - free(__DECONST(char *,oidp->oid_descr), + kfree(__DECONST(char *,oidp->oid_descr), M_SYSCTLOID); - free(__DECONST(char *, oidp->oid_name), M_SYSCTLOID); - free(oidp, M_SYSCTLOID); + kfree(__DECONST(char *, oidp->oid_name), M_SYSCTLOID); + kfree(oidp, M_SYSCTLOID); } } sysctl_unlock(); @@ -416,13 +416,13 @@ sysctl_add_oid(struct sysctl_ctx_list *clist, struct sysctl_oid_list *parent, return (NULL); } } - oidp = malloc(sizeof(struct sysctl_oid), M_SYSCTLOID, M_WAITOK | M_ZERO); + oidp = kmalloc(sizeof(struct sysctl_oid), M_SYSCTLOID, M_WAITOK | M_ZERO); oidp->oid_parent = parent; SLIST_NEXT(oidp, oid_link) = NULL; oidp->oid_number = number; oidp->oid_refcnt = 1; len = strlen(name); - newname = malloc(len + 1, M_SYSCTLOID, M_WAITOK); + newname = kmalloc(len + 1, M_SYSCTLOID, M_WAITOK); bcopy(name, newname, len + 1); newname[len] = '\0'; oidp->oid_name = newname; @@ -432,7 +432,7 @@ sysctl_add_oid(struct sysctl_ctx_list *clist, struct sysctl_oid_list *parent, struct sysctl_oid_list *children; /* Allocate space for children */ - children = malloc(sizeof(*children), M_SYSCTLOID, M_WAITOK); + children = kmalloc(sizeof(*children), M_SYSCTLOID, M_WAITOK); SYSCTL_SET_CHILDREN(oidp, children); SLIST_INIT(children); } else { @@ -442,7 +442,7 @@ sysctl_add_oid(struct sysctl_ctx_list *clist, struct sysctl_oid_list *parent, oidp->oid_fmt = fmt; if (descr) { int len = strlen(descr) + 1; - oidp->oid_descr = malloc(len, M_SYSCTLOID, M_WAITOK); + oidp->oid_descr = kmalloc(len, M_SYSCTLOID, M_WAITOK); if (oidp->oid_descr) strcpy((char *)(uintptr_t)(const void *)oidp->oid_descr, descr); }; @@ -770,11 +770,11 @@ sysctl_sysctl_name2oid(SYSCTL_HANDLER_ARGS) if (req->newlen >= MAXPATHLEN) /* XXX arbitrary, undocumented */ return (ENAMETOOLONG); - p = malloc(req->newlen+1, M_SYSCTL, M_WAITOK); + p = kmalloc(req->newlen+1, M_SYSCTL, M_WAITOK); error = SYSCTL_IN(req, p, req->newlen); if (error) { - free(p, M_SYSCTL); + kfree(p, M_SYSCTL); return (error); } @@ -782,7 +782,7 @@ sysctl_sysctl_name2oid(SYSCTL_HANDLER_ARGS) error = name2oid(p, oid, &len, &op); - free(p, M_SYSCTL); + kfree(p, M_SYSCTL); if (error) return (error); diff --git a/sys/kern/kern_syslink.c b/sys/kern/kern_syslink.c index 2c1cbc4095..6439bc8769 100644 --- a/sys/kern/kern_syslink.c +++ b/sys/kern/kern_syslink.c @@ -31,7 +31,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/kern/kern_syslink.c,v 1.2 2006/08/08 01:27:13 dillon Exp $ + * $DragonFly: src/sys/kern/kern_syslink.c,v 1.3 2006/09/05 00:55:45 dillon Exp $ */ /* * This module implements the syslink() system call and protocol which @@ -160,7 +160,7 @@ sys_syslink(struct syslink_args *uap) error = suser(curthread); if (error) break; - sldata = malloc(sizeof(struct sldata), M_SYSLINK, M_WAITOK|M_ZERO); + sldata = kmalloc(sizeof(struct sldata), M_SYSLINK, M_WAITOK|M_ZERO); lockinit(&sldata->rlock, "slread", 0, 0); lockinit(&sldata->wlock, "slwrite", 0, 0); @@ -203,7 +203,7 @@ sys_syslink(struct syslink_args *uap) } } if (error) - free(sldata, M_SYSLINK); + kfree(sldata, M_SYSLINK); break; case SYSLINK_GETSYSMASK: error = copyout(&sl_mask, uap->mask, sizeof(sl_mask)); @@ -408,7 +408,7 @@ void slbuf_alloc(struct slbuf *slbuf, int bytes) { bzero(slbuf, sizeof(*slbuf)); - slbuf->buf = malloc(bytes, M_SYSLINK, M_WAITOK); + slbuf->buf = kmalloc(bytes, M_SYSLINK, M_WAITOK); slbuf->bufsize = bytes; slbuf->bufmask = bytes - 1; } @@ -417,7 +417,7 @@ static void slbuf_free(struct slbuf *slbuf) { - free(slbuf->buf, M_SYSLINK); + kfree(slbuf->buf, M_SYSLINK); slbuf->buf = NULL; } @@ -428,7 +428,7 @@ sldata_rels(struct sldata *sldata) if (--sldata->refs == 0) { slbuf_free(&sldata->rbuf); slbuf_free(&sldata->wbuf); - free(sldata, M_SYSLINK); + kfree(sldata, M_SYSLINK); } } diff --git a/sys/kern/kern_upcall.c b/sys/kern/kern_upcall.c index 3c32d4dc84..d8a111ea82 100644 --- a/sys/kern/kern_upcall.c +++ b/sys/kern/kern_upcall.c @@ -31,7 +31,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/kern/kern_upcall.c,v 1.9 2006/06/05 07:26:10 dillon Exp $ + * $DragonFly: src/sys/kern/kern_upcall.c,v 1.10 2006/09/05 00:55:45 dillon Exp $ */ /* @@ -90,7 +90,7 @@ sys_upc_register(struct upc_register_args *uap) if (vm->vm_upccount >= UPCALL_MAXCOUNT) return(EFBIG); - vu = malloc(sizeof(struct vmupcall), M_UPCALL, M_WAITOK|M_ZERO); + vu = kmalloc(sizeof(struct vmupcall), M_UPCALL, M_WAITOK|M_ZERO); vu->vu_ctx = uap->ctxfunc; vu->vu_func = uap->func; vu->vu_data = uap->data; @@ -207,7 +207,7 @@ sys_upc_control(struct upc_control_args *uap) ) { *vupp = vu->vu_next; error = 0; - free(vu, M_UPCALL); + kfree(vu, M_UPCALL); } else { vupp = &vu->vu_next; } @@ -263,7 +263,7 @@ upc_release(struct vmspace *vm, struct lwp *lp) while ((vu = *vupp) != NULL) { if (vu->vu_lwp == lp) { *vupp = vu->vu_next; - free(vu, M_UPCALL); + kfree(vu, M_UPCALL); --vm->vm_upccount; } else { vupp = &vu->vu_next; diff --git a/sys/kern/kern_varsym.c b/sys/kern/kern_varsym.c index 8a96c77f3b..4ca0acb35e 100644 --- a/sys/kern/kern_varsym.c +++ b/sys/kern/kern_varsym.c @@ -31,7 +31,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/kern/kern_varsym.c,v 1.7 2006/06/05 07:26:10 dillon Exp $ + * $DragonFly: src/sys/kern/kern_varsym.c,v 1.8 2006/09/05 00:55:45 dillon Exp $ */ /* @@ -137,7 +137,7 @@ sys_varsym_set(struct varsym_set_args *uap) if ((error = copyinstr(uap->name, name, sizeof(name), NULL)) != 0) goto done2; - buf = malloc(MAXVARSYM_DATA, M_TEMP, M_WAITOK); + buf = kmalloc(MAXVARSYM_DATA, M_TEMP, M_WAITOK); if (uap->data && (error = copyinstr(uap->data, buf, MAXVARSYM_DATA, NULL)) != 0) { @@ -165,7 +165,7 @@ sys_varsym_set(struct varsym_set_args *uap) break; } done1: - free(buf, M_TEMP); + kfree(buf, M_TEMP); done2: return(error); } @@ -401,8 +401,8 @@ varsymmake(int level, const char *name, const char *data) error = E2BIG; } else if (data) { datalen = strlen(data); - ve = malloc(sizeof(struct varsyment), M_VARSYM, M_WAITOK|M_ZERO); - sym = malloc(sizeof(struct varsym) + namelen + datalen + 2, M_VARSYM, M_WAITOK); + ve = kmalloc(sizeof(struct varsyment), M_VARSYM, M_WAITOK|M_ZERO); + sym = kmalloc(sizeof(struct varsym) + namelen + datalen + 2, M_VARSYM, M_WAITOK); ve->ve_sym = sym; sym->vs_refs = 1; sym->vs_namelen = namelen; @@ -418,7 +418,7 @@ varsymmake(int level, const char *name, const char *data) TAILQ_REMOVE(&vss->vx_queue, ve, ve_entry); vss->vx_setsize -= sizeof(struct varsyment) + sizeof(struct varsym) + namelen + strlen(ve->ve_sym->vs_data) + 8; varsymdrop(ve->ve_sym); - free(ve, M_VARSYM); + kfree(ve, M_VARSYM); error = 0; } else { error = ENOENT; @@ -432,7 +432,7 @@ varsymdrop(varsym_t sym) { KKASSERT(sym->vs_refs > 0); if (--sym->vs_refs == 0) { - free(sym, M_VARSYM); + kfree(sym, M_VARSYM); } } @@ -441,7 +441,7 @@ varsymdup(struct varsymset *vss, struct varsyment *ve) { struct varsyment *nve; - nve = malloc(sizeof(struct varsyment), M_VARSYM, M_WAITOK|M_ZERO); + nve = kmalloc(sizeof(struct varsyment), M_VARSYM, M_WAITOK|M_ZERO); nve->ve_sym = ve->ve_sym; ++nve->ve_sym->vs_refs; TAILQ_INSERT_TAIL(&vss->vx_queue, nve, ve_entry); @@ -469,7 +469,7 @@ varsymset_clean(struct varsymset *vss) while ((ve = TAILQ_FIRST(&vss->vx_queue)) != NULL) { TAILQ_REMOVE(&vss->vx_queue, ve, ve_entry); varsymdrop(ve->ve_sym); - free(ve, M_VARSYM); + kfree(ve, M_VARSYM); } vss->vx_setsize = 0; } diff --git a/sys/kern/link_aout.c b/sys/kern/link_aout.c index a29816bfa5..6ccb9a0650 100644 --- a/sys/kern/link_aout.c +++ b/sys/kern/link_aout.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/kern/link_aout.c,v 1.26 1999/12/24 15:33:36 bde Exp $ - * $DragonFly: src/sys/kern/link_aout.c,v 1.18 2006/08/12 00:26:20 dillon Exp $ + * $DragonFly: src/sys/kern/link_aout.c,v 1.19 2006/09/05 00:55:45 dillon Exp $ */ #define FREEBSD_AOUT 1 @@ -115,7 +115,7 @@ link_aout_init(void* arg) if (dp) { aout_file_t af; - af = malloc(sizeof(struct aout_file), M_LINKER, M_NOWAIT); + af = kmalloc(sizeof(struct aout_file), M_LINKER, M_NOWAIT); if (af == NULL) panic("link_aout_init: Can't create linker structures for kernel"); bzero(af, sizeof(*af)); @@ -158,14 +158,14 @@ link_aout_load_module(const char* filename, linker_file_t* result) return(0); /* we can't handle this */ /* Looks like we can handle this one */ - af = malloc(sizeof(struct aout_file), M_LINKER, M_WAITOK); + af = kmalloc(sizeof(struct aout_file), M_LINKER, M_WAITOK); bzero(af, sizeof(*af)); af->address = baseptr; /* Assume _DYNAMIC is the first data item. */ af->dynamic = (struct _dynamic*)(af->address + ehdr->a_text); if (af->dynamic->d_version != LD_VERSION_BSD) { - free(af, M_LINKER); + kfree(af, M_LINKER); return(0); /* we can't handle this */ } af->dynamic->d_un.d_sdt = (struct section_dispatch_table *) @@ -174,7 +174,7 @@ link_aout_load_module(const char* filename, linker_file_t* result) /* Register with kld */ lf = linker_make_file(filename, af, &link_aout_module_ops); if (lf == NULL) { - free(af, M_LINKER); + kfree(af, M_LINKER); return(ENOMEM); } lf->address = af->address; @@ -219,7 +219,7 @@ link_aout_load_file(const char* filename, linker_file_t* result) error = nlookup_init(&nd, pathname, UIO_SYSSPACE, NLC_FOLLOW|NLC_LOCKVP); if (error == 0) error = vn_open(&nd, NULL, FREAD, 0); - free(pathname, M_LINKER); + kfree(pathname, M_LINKER); if (error) { nlookup_done(&nd); return error; @@ -242,7 +242,7 @@ link_aout_load_file(const char* filename, linker_file_t* result) /* * We have an a.out file, so make some space to read it in. */ - af = malloc(sizeof(struct aout_file), M_LINKER, M_WAITOK); + af = kmalloc(sizeof(struct aout_file), M_LINKER, M_WAITOK); bzero(af, sizeof(*af)); af->address = malloc(header.a_text + header.a_data + header.a_bss, M_LINKER, M_WAITOK); @@ -262,8 +262,8 @@ link_aout_load_file(const char* filename, linker_file_t* result) */ af->dynamic = (struct _dynamic*) (af->address + header.a_text); if (af->dynamic->d_version != LD_VERSION_BSD) { - free(af->address, M_LINKER); - free(af, M_LINKER); + kfree(af->address, M_LINKER); + kfree(af, M_LINKER); goto out; } af->dynamic->d_un.d_sdt = (struct section_dispatch_table *) @@ -271,8 +271,8 @@ link_aout_load_file(const char* filename, linker_file_t* result) lf = linker_make_file(filename, af, &link_aout_file_ops); if (lf == NULL) { - free(af->address, M_LINKER); - free(af, M_LINKER); + kfree(af->address, M_LINKER); + kfree(af, M_LINKER); error = ENOMEM; goto out; } @@ -302,8 +302,8 @@ link_aout_unload_file(linker_file_t file) if (af) { if (af->address) - free(af->address, M_LINKER); - free(af, M_LINKER); + kfree(af->address, M_LINKER); + kfree(af, M_LINKER); } } @@ -313,7 +313,7 @@ link_aout_unload_module(linker_file_t file) aout_file_t af = file->priv; if (af) - free(af, M_LINKER); + kfree(af, M_LINKER); if (file->filename) preload_delete_name(file->filename); } @@ -359,7 +359,7 @@ load_dependancies(linker_file_t lf) out: if (filename) - free(filename, M_TEMP); + kfree(filename, M_TEMP); return error; } diff --git a/sys/kern/link_elf.c b/sys/kern/link_elf.c index 3c32bc3c78..b3ab82ed5e 100644 --- a/sys/kern/link_elf.c +++ b/sys/kern/link_elf.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/kern/link_elf.c,v 1.24 1999/12/24 15:33:36 bde Exp $ - * $DragonFly: src/sys/kern/link_elf.c,v 1.20 2006/08/12 00:26:20 dillon Exp $ + * $DragonFly: src/sys/kern/link_elf.c,v 1.21 2006/09/05 00:55:45 dillon Exp $ */ #include @@ -141,7 +141,7 @@ link_elf_init(void* arg) dp = (Elf_Dyn*) &_DYNAMIC; if (dp) { - ef = malloc(sizeof(struct elf_file), M_LINKER, M_INTWAIT | M_ZERO); + ef = kmalloc(sizeof(struct elf_file), M_LINKER, M_INTWAIT | M_ZERO); ef->address = 0; #ifdef SPARSE_MAPPING ef->object = 0; @@ -347,7 +347,7 @@ link_elf_load_module(const char *filename, linker_file_t *result) if (baseptr == NULL || sizeptr == NULL || dynptr == NULL) return (EINVAL); - ef = malloc(sizeof(struct elf_file), M_LINKER, M_WAITOK | M_ZERO); + ef = kmalloc(sizeof(struct elf_file), M_LINKER, M_WAITOK | M_ZERO); if (ef == NULL) return (ENOMEM); ef->modptr = modptr; @@ -359,7 +359,7 @@ link_elf_load_module(const char *filename, linker_file_t *result) ef->dynamic = (Elf_Dyn *)dp; lf = linker_make_file(filename, ef, &link_elf_module_ops); if (lf == NULL) { - free(ef, M_LINKER); + kfree(ef, M_LINKER); return ENOMEM; } lf->address = ef->address; @@ -433,7 +433,7 @@ link_elf_load_file(const char* filename, linker_file_t* result) error = nlookup_init(&nd, pathname, UIO_SYSSPACE, NLC_FOLLOW|NLC_LOCKVP); if (error == 0) error = vn_open(&nd, NULL, FREAD, 0); - free(pathname, M_LINKER); + kfree(pathname, M_LINKER); if (error) { nlookup_done(&nd); return error; @@ -445,7 +445,7 @@ link_elf_load_file(const char* filename, linker_file_t* result) /* * Read the elf header from the file. */ - firstpage = malloc(PAGE_SIZE, M_LINKER, M_WAITOK); + firstpage = kmalloc(PAGE_SIZE, M_LINKER, M_WAITOK); if (firstpage == NULL) { error = ENOMEM; goto out; @@ -545,11 +545,11 @@ link_elf_load_file(const char* filename, linker_file_t* result) base_vlimit = round_page(segs[1]->p_vaddr + segs[1]->p_memsz); mapsize = base_vlimit - base_vaddr; - ef = malloc(sizeof(struct elf_file), M_LINKER, M_WAITOK | M_ZERO); + ef = kmalloc(sizeof(struct elf_file), M_LINKER, M_WAITOK | M_ZERO); #ifdef SPARSE_MAPPING ef->object = vm_object_allocate(OBJT_DEFAULT, mapsize >> PAGE_SHIFT); if (ef->object == NULL) { - free(ef, M_LINKER); + kfree(ef, M_LINKER); error = ENOMEM; goto out; } @@ -561,11 +561,11 @@ link_elf_load_file(const char* filename, linker_file_t* result) VM_PROT_ALL, VM_PROT_ALL, 0); if (error) { vm_object_deallocate(ef->object); - free(ef, M_LINKER); + kfree(ef, M_LINKER); goto out; } #else - ef->address = malloc(mapsize, M_LINKER, M_WAITOK); + ef->address = kmalloc(mapsize, M_LINKER, M_WAITOK); #endif mapbase = ef->address; @@ -584,9 +584,9 @@ link_elf_load_file(const char* filename, linker_file_t* result) + (ef->object->size << PAGE_SHIFT)); vm_object_deallocate(ef->object); #else - free(ef->address, M_LINKER); + kfree(ef->address, M_LINKER); #endif - free(ef, M_LINKER); + kfree(ef, M_LINKER); goto out; } bzero(segbase + segs[i]->p_filesz, @@ -613,9 +613,9 @@ link_elf_load_file(const char* filename, linker_file_t* result) + (ef->object->size << PAGE_SHIFT)); vm_object_deallocate(ef->object); #else - free(ef->address, M_LINKER); + kfree(ef->address, M_LINKER); #endif - free(ef, M_LINKER); + kfree(ef, M_LINKER); error = ENOMEM; goto out; } @@ -636,7 +636,7 @@ link_elf_load_file(const char* filename, linker_file_t* result) nbytes = hdr->e_shnum * hdr->e_shentsize; if (nbytes == 0 || hdr->e_shoff == 0) goto nosyms; - shdr = malloc(nbytes, M_LINKER, M_WAITOK | M_ZERO); + shdr = kmalloc(nbytes, M_LINKER, M_WAITOK | M_ZERO); if (shdr == NULL) { error = ENOMEM; goto out; @@ -658,9 +658,9 @@ link_elf_load_file(const char* filename, linker_file_t* result) goto nosyms; symcnt = shdr[symtabindex].sh_size; - ef->symbase = malloc(symcnt, M_LINKER, M_WAITOK); + ef->symbase = kmalloc(symcnt, M_LINKER, M_WAITOK); strcnt = shdr[symstrindex].sh_size; - ef->strbase = malloc(strcnt, M_LINKER, M_WAITOK); + ef->strbase = kmalloc(strcnt, M_LINKER, M_WAITOK); if (ef->symbase == NULL || ef->strbase == NULL) { error = ENOMEM; @@ -692,9 +692,9 @@ out: if (error && lf) linker_file_unload(lf); if (shdr) - free(shdr, M_LINKER); + kfree(shdr, M_LINKER); if (firstpage) - free(firstpage, M_LINKER); + kfree(firstpage, M_LINKER); vn_unlock(vp); vn_close(vp, FREAD); @@ -716,13 +716,13 @@ link_elf_unload_file(linker_file_t file) } #else if (ef->address) - free(ef->address, M_LINKER); + kfree(ef->address, M_LINKER); #endif if (ef->symbase) - free(ef->symbase, M_LINKER); + kfree(ef->symbase, M_LINKER); if (ef->strbase) - free(ef->strbase, M_LINKER); - free(ef, M_LINKER); + kfree(ef->strbase, M_LINKER); + kfree(ef, M_LINKER); } } @@ -732,7 +732,7 @@ link_elf_unload_module(linker_file_t file) elf_file_t ef = file->priv; if (ef) - free(ef, M_LINKER); + kfree(ef, M_LINKER); if (file->filename) preload_delete_name(file->filename); } @@ -1009,7 +1009,7 @@ link_elf_lookup_set(linker_file_t lf, const char *name, int len, error = 0, count; len = strlen(name) + sizeof("__start_set_"); /* sizeof includes \0 */ - setsym = malloc(len, M_LINKER, M_WAITOK); + setsym = kmalloc(len, M_LINKER, M_WAITOK); if (setsym == NULL) return ENOMEM; @@ -1049,7 +1049,7 @@ link_elf_lookup_set(linker_file_t lf, const char *name, *countp = count; out: - free(setsym, M_LINKER); + kfree(setsym, M_LINKER); return error; } diff --git a/sys/kern/lwkt_caps.c b/sys/kern/lwkt_caps.c index 1bed8a9922..65c9a90422 100644 --- a/sys/kern/lwkt_caps.c +++ b/sys/kern/lwkt_caps.c @@ -31,7 +31,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/kern/lwkt_caps.c,v 1.7 2006/06/05 07:26:10 dillon Exp $ + * $DragonFly: src/sys/kern/lwkt_caps.c,v 1.8 2006/09/05 00:55:45 dillon Exp $ */ /* @@ -212,7 +212,7 @@ caps_alloc_msg(caps_kinfo_t caps) { caps_kmsg_t msg; - msg = malloc(sizeof(struct caps_kmsg), M_CAPS, M_WAITOK|M_ZERO); + msg = kmalloc(sizeof(struct caps_kmsg), M_CAPS, M_WAITOK|M_ZERO); msg->km_msgid.c_id = (off_t)(uintptr_t)msg; return(msg); } @@ -322,7 +322,7 @@ caps_free_msg(caps_kmsg_t msg) if ((rcaps = caps_free_msg_mcaps(msg)) != NULL) caps_drop(rcaps); - free(msg, M_CAPS); + kfree(msg, M_CAPS); } /* @@ -495,7 +495,7 @@ caps_free(caps_kinfo_t caps) KKASSERT(TAILQ_EMPTY(&caps->ci_msgpendq)); KKASSERT(TAILQ_EMPTY(&caps->ci_msguserq)); KKASSERT((caps->ci_flags & (CAPKF_HLIST|CAPKF_TDLIST)) == 0); - free(caps, M_CAPS); + kfree(caps, M_CAPS); } /************************************************************************ diff --git a/sys/kern/subr_blist.c b/sys/kern/subr_blist.c index cbfd39f53e..725f4c3992 100644 --- a/sys/kern/subr_blist.c +++ b/sys/kern/subr_blist.c @@ -90,7 +90,7 @@ * This code can be compiled stand-alone for debugging. * * $FreeBSD: src/sys/kern/subr_blist.c,v 1.5.2.2 2003/01/12 09:23:12 dillon Exp $ - * $DragonFly: src/sys/kern/subr_blist.c,v 1.5 2004/07/16 05:51:10 dillon Exp $ + * $DragonFly: src/sys/kern/subr_blist.c,v 1.6 2006/09/05 00:55:45 dillon Exp $ */ #ifdef _KERNEL @@ -121,8 +121,8 @@ #include #include -#define malloc(a,b,c) malloc(a) -#define free(a,b) free(a) +#define kmalloc(a,b,c) malloc(a) +#define kfree(a,b) free(a) typedef unsigned int u_daddr_t; @@ -182,7 +182,7 @@ blist_create(daddr_t blocks) skip = (skip + 1) * BLIST_META_RADIX; } - bl = malloc(sizeof(struct blist), M_SWAP, M_WAITOK); + bl = kmalloc(sizeof(struct blist), M_SWAP, M_WAITOK); bzero(bl, sizeof(*bl)); @@ -191,7 +191,7 @@ blist_create(daddr_t blocks) bl->bl_skip = skip; bl->bl_rootblks = 1 + blst_radix_init(NULL, bl->bl_radix, bl->bl_skip, blocks); - bl->bl_root = malloc(sizeof(blmeta_t) * bl->bl_rootblks, M_SWAP, M_WAITOK); + bl->bl_root = kmalloc(sizeof(blmeta_t) * bl->bl_rootblks, M_SWAP, M_WAITOK); #if defined(BLIST_DEBUG) printf( @@ -211,8 +211,8 @@ blist_create(daddr_t blocks) void blist_destroy(blist_t bl) { - free(bl->bl_root, M_SWAP); - free(bl, M_SWAP); + kfree(bl->bl_root, M_SWAP); + kfree(bl, M_SWAP); } /* diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index b9e0adb4a1..e5ae8dd853 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/kern/subr_bus.c,v 1.54.2.9 2002/10/10 15:13:32 jhb Exp $ - * $DragonFly: src/sys/kern/subr_bus.c,v 1.29 2005/10/30 04:41:15 dillon Exp $ + * $DragonFly: src/sys/kern/subr_bus.c,v 1.30 2006/09/05 00:55:45 dillon Exp $ */ #include "opt_bus.h" @@ -171,7 +171,7 @@ devclass_add_driver(devclass_t dc, driver_t *driver) PDEBUG(("%s", DRIVERNAME(driver))); - dl = malloc(sizeof *dl, M_BUS, M_INTWAIT | M_ZERO); + dl = kmalloc(sizeof *dl, M_BUS, M_INTWAIT | M_ZERO); if (!dl) return(ENOMEM); @@ -258,7 +258,7 @@ devclass_delete_driver(devclass_t busclass, driver_t *driver) } TAILQ_REMOVE(&busclass->drivers, dl, link); - free(dl, M_BUS); + kfree(dl, M_BUS); kobj_class_uninstantiate(driver); @@ -330,7 +330,7 @@ devclass_get_devices(devclass_t dc, device_t **devlistp, int *devcountp) if (dc->devices[i]) count++; - list = malloc(count * sizeof(device_t), M_TEMP, M_INTWAIT | M_ZERO); + list = kmalloc(count * sizeof(device_t), M_TEMP, M_INTWAIT | M_ZERO); if (list == NULL) return(ENOMEM); @@ -400,13 +400,13 @@ devclass_alloc_unit(devclass_t dc, int *unitp) int newsize; newsize = roundup((unit + 1), MINALLOCSIZE / sizeof(device_t)); - newlist = malloc(sizeof(device_t) * newsize, M_BUS, + newlist = kmalloc(sizeof(device_t) * newsize, M_BUS, M_INTWAIT | M_ZERO); if (newlist == NULL) return(ENOMEM); bcopy(dc->devices, newlist, sizeof(device_t) * dc->maxunit); if (dc->devices) - free(dc->devices, M_BUS); + kfree(dc->devices, M_BUS); dc->devices = newlist; dc->maxunit = newsize; } @@ -424,12 +424,12 @@ devclass_add_device(devclass_t dc, device_t dev) PDEBUG(("%s in devclass %s", DEVICENAME(dev), DEVCLANAME(dc))); buflen = strlen(dc->name) + 5; - dev->nameunit = malloc(buflen, M_BUS, M_INTWAIT | M_ZERO); + dev->nameunit = kmalloc(buflen, M_BUS, M_INTWAIT | M_ZERO); if (!dev->nameunit) return(ENOMEM); if ((error = devclass_alloc_unit(dc, &dev->unit)) != 0) { - free(dev->nameunit, M_BUS); + kfree(dev->nameunit, M_BUS); dev->nameunit = NULL; return(error); } @@ -458,7 +458,7 @@ devclass_delete_device(devclass_t dc, device_t dev) if (dev->flags & DF_WILDCARD) dev->unit = -1; dev->devclass = NULL; - free(dev->nameunit, M_BUS); + kfree(dev->nameunit, M_BUS); dev->nameunit = NULL; #ifdef DEVICE_SYSCTLS @@ -485,7 +485,7 @@ make_device(device_t parent, const char *name, int unit) } else dc = NULL; - dev = malloc(sizeof(struct device), M_BUS, M_INTWAIT | M_ZERO); + dev = kmalloc(sizeof(struct device), M_BUS, M_INTWAIT | M_ZERO); if (!dev) return(0); @@ -742,7 +742,7 @@ device_get_children(device_t dev, device_t **devlistp, int *devcountp) TAILQ_FOREACH(child, &dev->children, link) count++; - list = malloc(count * sizeof(device_t), M_TEMP, M_INTWAIT | M_ZERO); + list = kmalloc(count * sizeof(device_t), M_TEMP, M_INTWAIT | M_ZERO); if (!list) return(ENOMEM); @@ -830,13 +830,13 @@ static void device_set_desc_internal(device_t dev, const char* desc, int copy) { if (dev->desc && (dev->flags & DF_DESCMALLOCED)) { - free(dev->desc, M_BUS); + kfree(dev->desc, M_BUS); dev->flags &= ~DF_DESCMALLOCED; dev->desc = NULL; } if (copy && desc) { - dev->desc = malloc(strlen(desc) + 1, M_BUS, M_INTWAIT); + dev->desc = kmalloc(strlen(desc) + 1, M_BUS, M_INTWAIT); if (dev->desc) { strcpy(dev->desc, desc); dev->flags |= DF_DESCMALLOCED; @@ -882,7 +882,7 @@ void device_set_softc(device_t dev, void *softc) { if (dev->softc && !(dev->flags & DF_EXTERNALSOFTC)) - free(dev->softc, M_BUS); + kfree(dev->softc, M_BUS); dev->softc = softc; if (dev->softc) dev->flags |= DF_EXTERNALSOFTC; @@ -1022,7 +1022,7 @@ device_set_driver(device_t dev, driver_t *driver) return(0); if (dev->softc && !(dev->flags & DF_EXTERNALSOFTC)) { - free(dev->softc, M_BUS); + kfree(dev->softc, M_BUS); dev->softc = NULL; } kobj_delete((kobj_t) dev, 0); @@ -1030,7 +1030,7 @@ device_set_driver(device_t dev, driver_t *driver) if (driver) { kobj_init((kobj_t) dev, (kobj_class_t) driver); if (!(dev->flags & DF_EXTERNALSOFTC)) { - dev->softc = malloc(driver->size, M_BUS, + dev->softc = kmalloc(driver->size, M_BUS, M_INTWAIT | M_ZERO); if (!dev->softc) { kobj_delete((kobj_t)dev, 0); @@ -1291,15 +1291,15 @@ resource_new_name(const char *name, int unit) { struct config_device *new; - new = malloc((devtab_count + 1) * sizeof(*new), M_TEMP, + new = kmalloc((devtab_count + 1) * sizeof(*new), M_TEMP, M_INTWAIT | M_ZERO); if (new == NULL) return(-1); if (devtab && devtab_count > 0) bcopy(devtab, new, devtab_count * sizeof(*new)); - new[devtab_count].name = malloc(strlen(name) + 1, M_TEMP, M_INTWAIT); + new[devtab_count].name = kmalloc(strlen(name) + 1, M_TEMP, M_INTWAIT); if (new[devtab_count].name == NULL) { - free(new, M_TEMP); + kfree(new, M_TEMP); return(-1); } strcpy(new[devtab_count].name, name); @@ -1307,7 +1307,7 @@ resource_new_name(const char *name, int unit) new[devtab_count].resource_count = 0; new[devtab_count].resources = NULL; if (devtab && devtab != config_devtab) - free(devtab, M_TEMP); + kfree(devtab, M_TEMP); devtab = new; return devtab_count++; } @@ -1319,20 +1319,20 @@ resource_new_resname(int j, const char *resname, resource_type type) int i; i = devtab[j].resource_count; - new = malloc((i + 1) * sizeof(*new), M_TEMP, M_INTWAIT | M_ZERO); + new = kmalloc((i + 1) * sizeof(*new), M_TEMP, M_INTWAIT | M_ZERO); if (new == NULL) return(-1); if (devtab[j].resources && i > 0) bcopy(devtab[j].resources, new, i * sizeof(*new)); - new[i].name = malloc(strlen(resname) + 1, M_TEMP, M_INTWAIT); + new[i].name = kmalloc(strlen(resname) + 1, M_TEMP, M_INTWAIT); if (new[i].name == NULL) { - free(new, M_TEMP); + kfree(new, M_TEMP); return(-1); } strcpy(new[i].name, resname); new[i].type = type; if (devtab[j].resources) - free(devtab[j].resources, M_TEMP); + kfree(devtab[j].resources, M_TEMP); devtab[j].resources = new; devtab[j].resource_count = i + 1; return(i); @@ -1554,8 +1554,8 @@ resource_set_string(const char *name, int unit, const char *resname, if (res->type != RES_STRING) return(EFTYPE); if (res->u.stringval) - free(res->u.stringval, M_TEMP); - res->u.stringval = malloc(strlen(value) + 1, M_TEMP, M_INTWAIT); + kfree(res->u.stringval, M_TEMP); + res->u.stringval = kmalloc(strlen(value) + 1, M_TEMP, M_INTWAIT); if (res->u.stringval == NULL) return(ENOMEM); strcpy(res->u.stringval, value); @@ -1607,7 +1607,7 @@ resource_cfgload(void *dummy __unused) break; case RES_STRING: if (res->u.stringval) - free(res->u.stringval, M_TEMP); + kfree(res->u.stringval, M_TEMP); stringval = cfgres[j].u.stringval; res->u.stringval = malloc(strlen(stringval) + 1, M_TEMP, M_INTWAIT); @@ -1644,7 +1644,7 @@ resource_list_free(struct resource_list *rl) if (rle->res) panic("resource_list_free: resource entry is busy"); SLIST_REMOVE_HEAD(rl, link); - free(rle, M_BUS); + kfree(rle, M_BUS); } } @@ -1657,7 +1657,7 @@ resource_list_add(struct resource_list *rl, rle = resource_list_find(rl, type, rid); if (rle == NULL) { - rle = malloc(sizeof(struct resource_list_entry), M_BUS, + rle = kmalloc(sizeof(struct resource_list_entry), M_BUS, M_INTWAIT); if (!rle) panic("resource_list_add: can't record entry"); @@ -1695,7 +1695,7 @@ resource_list_delete(struct resource_list *rl, if (rle) { SLIST_REMOVE(rl, rle, resource_list_entry, link); - free(rle, M_BUS); + kfree(rle, M_BUS); } } diff --git a/sys/kern/subr_diskmbr.c b/sys/kern/subr_diskmbr.c index 8c144f6f96..5b5ce59941 100644 --- a/sys/kern/subr_diskmbr.c +++ b/sys/kern/subr_diskmbr.c @@ -36,7 +36,7 @@ * from: @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91 * from: ufs_disksubr.c,v 1.8 1994/06/07 01:21:39 phk Exp $ * $FreeBSD: src/sys/kern/subr_diskmbr.c,v 1.45 2000/01/28 10:22:07 bde Exp $ - * $DragonFly: src/sys/kern/subr_diskmbr.c,v 1.13 2006/04/30 17:22:17 dillon Exp $ + * $DragonFly: src/sys/kern/subr_diskmbr.c,v 1.14 2006/09/05 00:55:45 dillon Exp $ */ #include @@ -320,7 +320,7 @@ reread_mbr: * enlarging it while searching for logical drives would be * inconvenient. */ - free(*sspp, M_DEVBUF); + kfree(*sspp, M_DEVBUF); ssp = dsmakeslicestruct(MAX_SLICES, lp); *sspp = ssp; diff --git a/sys/kern/subr_diskslice.c b/sys/kern/subr_diskslice.c index a2ef98ed4b..af8edf3a8a 100644 --- a/sys/kern/subr_diskslice.c +++ b/sys/kern/subr_diskslice.c @@ -44,7 +44,7 @@ * from: @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91 * from: ufs_disksubr.c,v 1.8 1994/06/07 01:21:39 phk Exp $ * $FreeBSD: src/sys/kern/subr_diskslice.c,v 1.82.2.6 2001/07/24 09:49:41 dd Exp $ - * $DragonFly: src/sys/kern/subr_diskslice.c,v 1.21 2006/07/28 02:17:40 dillon Exp $ + * $DragonFly: src/sys/kern/subr_diskslice.c,v 1.22 2006/09/05 00:55:45 dillon Exp $ */ #include @@ -94,7 +94,7 @@ clone_label(struct disklabel *lp) { struct disklabel *lp1; - lp1 = malloc(sizeof *lp1, M_DEVBUF, M_WAITOK); + lp1 = kmalloc(sizeof *lp1, M_DEVBUF, M_WAITOK); *lp1 = *lp; lp = NULL; if (lp1->d_typename[0] == '\0') @@ -342,7 +342,7 @@ dsgone(struct diskslices **sspp) sp = &ssp->dss_slices[slice]; free_ds_label(ssp, slice); } - free(ssp, M_DEVBUF); + kfree(ssp, M_DEVBUF); *sspp = NULL; } @@ -435,7 +435,7 @@ dsioctl(dev_t dev, u_long cmd, caddr_t data, return (ENODEV); if (!(flags & FWRITE)) return (EBADF); - lp = malloc(sizeof *lp, M_DEVBUF, M_WAITOK); + lp = kmalloc(sizeof *lp, M_DEVBUF, M_WAITOK); if (sp->ds_label == NULL) bzero(lp, sizeof *lp); else @@ -464,7 +464,7 @@ dsioctl(dev_t dev, u_long cmd, caddr_t data, error = ENOSPC; } if (error != 0) { - free(lp, M_DEVBUF); + kfree(lp, M_DEVBUF); return (error); } free_ds_label(ssp, slice); @@ -490,11 +490,11 @@ dsioctl(dev_t dev, u_long cmd, caddr_t data, * complete, then lock out future accesses and opens. */ *sspp = NULL; - lp = malloc(sizeof *lp, M_DEVBUF, M_WAITOK); + lp = kmalloc(sizeof *lp, M_DEVBUF, M_WAITOK); *lp = *ssp->dss_slices[WHOLE_DISK_SLICE].ds_label; error = dsopen(dev, S_IFCHR, ssp->dss_oflags, sspp, lp); if (error != 0) { - free(lp, M_DEVBUF); + kfree(lp, M_DEVBUF); *sspp = ssp; return (error); } @@ -514,14 +514,14 @@ dsioctl(dev_t dev, u_long cmd, caddr_t data, S_IFCHR, ssp->dss_oflags, sspp, lp); if (error != 0) { - free(lp, M_DEVBUF); + kfree(lp, M_DEVBUF); *sspp = ssp; return (EBUSY); } } } - free(lp, M_DEVBUF); + kfree(lp, M_DEVBUF); dsgone(&ssp); return (0); @@ -770,7 +770,7 @@ dsopen(dev_t dev, int mode, u_int flags, */ if (msg != NULL && (flags & DSO_COMPATLABEL)) { msg = NULL; - free(lp1, M_DEVBUF); + kfree(lp1, M_DEVBUF); lp1 = clone_label(lp); } } @@ -782,13 +782,13 @@ dsopen(dev_t dev, int mode, u_int flags, if (sp->ds_type == DOSPTYP_386BSD /* XXX */) log(LOG_WARNING, "%s: cannot find label (%s)\n", sname, msg); - free(lp1, M_DEVBUF); + kfree(lp1, M_DEVBUF); continue; } if (lp1->d_flags & D_BADSECT) { log(LOG_ERR, "%s: bad sector table not supported\n", sname); - free(lp1, M_DEVBUF); + kfree(lp1, M_DEVBUF); continue; } set_ds_label(ssp, slice, lp1); @@ -842,7 +842,7 @@ free_ds_label(struct diskslices *ssp, int slice) lp = sp->ds_label; if (lp == NULL) return; - free(lp, M_DEVBUF); + kfree(lp, M_DEVBUF); set_ds_label(ssp, slice, (struct disklabel *)NULL); } diff --git a/sys/kern/subr_eventhandler.c b/sys/kern/subr_eventhandler.c index b0be979fd3..dfa3aa5675 100644 --- a/sys/kern/subr_eventhandler.c +++ b/sys/kern/subr_eventhandler.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/kern/subr_eventhandler.c,v 1.3 1999/11/16 16:28:57 phk Exp $ - * $DragonFly: src/sys/kern/subr_eventhandler.c,v 1.3 2004/08/06 22:32:07 dillon Exp $ + * $DragonFly: src/sys/kern/subr_eventhandler.c,v 1.4 2006/09/05 00:55:45 dillon Exp $ */ #include @@ -112,13 +112,13 @@ eventhandler_deregister(struct eventhandler_list *list, eventhandler_tag tag) if (ep != NULL) { /* remove just this entry */ TAILQ_REMOVE(&list->el_entries, ep, ee_link); - free(ep, M_EVENTHANDLER); + kfree(ep, M_EVENTHANDLER); } else { /* remove entire list */ while (!TAILQ_EMPTY(&list->el_entries)) { ep = TAILQ_FIRST(&list->el_entries); TAILQ_REMOVE(&list->el_entries, ep, ee_link); - free(ep, M_EVENTHANDLER); + kfree(ep, M_EVENTHANDLER); } } } diff --git a/sys/kern/subr_kobj.c b/sys/kern/subr_kobj.c index 31dbc1fd83..8c2cd9cc33 100644 --- a/sys/kern/subr_kobj.c +++ b/sys/kern/subr_kobj.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/kern/subr_kobj.c,v 1.4.2.1 2001/02/02 19:49:13 cg Exp $ - * $DragonFly: src/sys/kern/subr_kobj.c,v 1.7 2004/04/14 18:28:29 joerg Exp $ + * $DragonFly: src/sys/kern/subr_kobj.c,v 1.8 2006/09/05 00:55:45 dillon Exp $ */ #include @@ -114,7 +114,7 @@ kobj_class_compile(kobj_class_t cls) /* * Allocate space for the compiled ops table. */ - ops = malloc(sizeof(struct kobj_ops), M_KOBJ, M_INTWAIT); + ops = kmalloc(sizeof(struct kobj_ops), M_KOBJ, M_INTWAIT); for (i = 0; i < KOBJ_CACHE_SIZE; i++) ops->cache[i] = &null_method; if (cls->ops) { @@ -123,7 +123,7 @@ kobj_class_compile(kobj_class_t cls) * but that's fine for us. */ if (ops) - free(ops, M_KOBJ); + kfree(ops, M_KOBJ); return; } @@ -213,7 +213,7 @@ kobj_class_free(kobj_class_t cls) /* * Free memory and clean up. */ - free(cls->ops, M_KOBJ); + kfree(cls->ops, M_KOBJ); cls->ops = 0; } @@ -259,7 +259,7 @@ kobj_create(kobj_class_t cls, /* * Allocate and initialise the new object. */ - obj = malloc(cls->size, mtype, mflags | M_ZERO); + obj = kmalloc(cls->size, mtype, mflags | M_ZERO); if (!obj) return 0; kobj_init(obj, cls); @@ -283,5 +283,5 @@ kobj_delete(kobj_t obj, struct malloc_type *mtype) obj->ops = 0; if (mtype) - free(obj, mtype); + kfree(obj, mtype); } diff --git a/sys/kern/subr_rman.c b/sys/kern/subr_rman.c index e9081e362c..a038a3dfd8 100644 --- a/sys/kern/subr_rman.c +++ b/sys/kern/subr_rman.c @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/kern/subr_rman.c,v 1.10.2.1 2001/06/05 08:06:08 imp Exp $ - * $DragonFly: src/sys/kern/subr_rman.c,v 1.7 2005/06/06 15:02:28 dillon Exp $ + * $DragonFly: src/sys/kern/subr_rman.c,v 1.8 2006/09/05 00:55:45 dillon Exp $ */ /* @@ -96,7 +96,7 @@ rman_init(struct rman *rm) panic("implement RMAN_GAUGE"); CIRCLEQ_INIT(&rm->rm_list); - rm->rm_slock = malloc(sizeof *rm->rm_slock, M_RMAN, M_NOWAIT); + rm->rm_slock = kmalloc(sizeof *rm->rm_slock, M_RMAN, M_NOWAIT); if (rm->rm_slock == NULL) return ENOMEM; lwkt_token_init(rm->rm_slock); @@ -117,7 +117,7 @@ rman_manage_region(struct rman *rm, u_long start, u_long end) struct resource *r, *s; lwkt_tokref ilock; - r = malloc(sizeof *r, M_RMAN, M_NOWAIT); + r = kmalloc(sizeof *r, M_RMAN, M_NOWAIT); if (r == 0) return ENOMEM; bzero(r, sizeof *r); @@ -165,14 +165,14 @@ rman_fini(struct rman *rm) while (!CIRCLEQ_EMPTY(&rm->rm_list)) { r = CIRCLEQ_FIRST(&rm->rm_list); CIRCLEQ_REMOVE(&rm->rm_list, r, r_link); - free(r, M_RMAN); + kfree(r, M_RMAN); } lwkt_reltoken(&ilock); /* XXX what's the point of this if we are going to free the struct? */ lwkt_gettoken(&ilock, &rman_tok); TAILQ_REMOVE(&rman_head, rm, rm_link); lwkt_reltoken(&ilock); - free(rm->rm_slock, M_RMAN); + kfree(rm->rm_slock, M_RMAN); return 0; } @@ -264,7 +264,7 @@ rman_reserve_resource(struct rman *rm, u_long start, u_long end, u_long count, * split it in two. The first case requires * two new allocations; the second requires but one. */ - rv = malloc(sizeof *rv, M_RMAN, M_NOWAIT); + rv = kmalloc(sizeof *rv, M_RMAN, M_NOWAIT); if (rv == 0) goto out; bzero(rv, sizeof *rv); @@ -286,9 +286,9 @@ rman_reserve_resource(struct rman *rm, u_long start, u_long end, u_long count, /* * We are allocating in the middle. */ - r = malloc(sizeof *r, M_RMAN, M_NOWAIT); + r = kmalloc(sizeof *r, M_RMAN, M_NOWAIT); if (r == 0) { - free(rv, M_RMAN); + kfree(rv, M_RMAN); rv = 0; goto out; } @@ -353,7 +353,7 @@ rman_reserve_resource(struct rman *rm, u_long start, u_long end, u_long count, rend = min(s->r_end, max(start + count, end)); if (s->r_start >= start && s->r_end <= end && (s->r_end - s->r_start + 1) == count) { - rv = malloc(sizeof *rv, M_RMAN, M_NOWAIT); + rv = kmalloc(sizeof *rv, M_RMAN, M_NOWAIT); if (rv == 0) goto out; bzero(rv, sizeof *rv); @@ -367,7 +367,7 @@ rman_reserve_resource(struct rman *rm, u_long start, u_long end, u_long count, s->r_sharehead = malloc(sizeof *s->r_sharehead, M_RMAN, M_NOWAIT); if (s->r_sharehead == 0) { - free(rv, M_RMAN); + kfree(rv, M_RMAN); rv = 0; goto out; } @@ -553,7 +553,7 @@ int_rman_release_resource(struct rman *rm, struct resource *r) * if the resource is no longer being shared at all. */ if (LIST_NEXT(s, r_sharelink) == 0) { - free(s->r_sharehead, M_RMAN); + kfree(s->r_sharehead, M_RMAN); s->r_sharehead = 0; s->r_flags &= ~RF_FIRSTSHARE; } @@ -575,7 +575,7 @@ int_rman_release_resource(struct rman *rm, struct resource *r) s->r_end = t->r_end; CIRCLEQ_REMOVE(&rm->rm_list, r, r_link); CIRCLEQ_REMOVE(&rm->rm_list, t, r_link); - free(t, M_RMAN); + kfree(t, M_RMAN); } else if (s != (void *)&rm->rm_list && (s->r_flags & RF_ALLOCATED) == 0) { /* @@ -605,7 +605,7 @@ int_rman_release_resource(struct rman *rm, struct resource *r) } out: - free(r, M_RMAN); + kfree(r, M_RMAN); return 0; } diff --git a/sys/kern/subr_sbuf.c b/sys/kern/subr_sbuf.c index 6bc449ea18..98ddac6a1e 100644 --- a/sys/kern/subr_sbuf.c +++ b/sys/kern/subr_sbuf.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/kern/subr_sbuf.c,v 1.11.2.2 2002/03/12 01:01:07 archie Exp $ - * $DragonFly: src/sys/kern/subr_sbuf.c,v 1.6 2005/02/17 13:59:36 joerg Exp $ + * $DragonFly: src/sys/kern/subr_sbuf.c,v 1.7 2006/09/05 00:55:45 dillon Exp $ */ #include @@ -50,8 +50,8 @@ #ifdef _KERNEL MALLOC_DEFINE(M_SBUF, "sbuf", "string buffers"); -#define SBMALLOC(size) malloc(size, M_SBUF, M_WAITOK) -#define SBFREE(buf) free(buf, M_SBUF) +#define SBMALLOC(size) kmalloc(size, M_SBUF, M_WAITOK) +#define SBFREE(buf) kfree(buf, M_SBUF) #else /* _KERNEL */ #define KASSERT(e, m) #define SBMALLOC(size) malloc(size) diff --git a/sys/kern/subr_taskqueue.c b/sys/kern/subr_taskqueue.c index a49aab195f..0f38947325 100644 --- a/sys/kern/subr_taskqueue.c +++ b/sys/kern/subr_taskqueue.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/kern/subr_taskqueue.c,v 1.1.2.3 2003/09/10 00:40:39 ken Exp $ - * $DragonFly: src/sys/kern/subr_taskqueue.c,v 1.9 2005/10/13 00:02:22 dillon Exp $ + * $DragonFly: src/sys/kern/subr_taskqueue.c,v 1.10 2006/09/05 00:55:45 dillon Exp $ */ #include @@ -60,7 +60,7 @@ taskqueue_create(const char *name, int mflags, struct taskqueue *queue; static int once = 1; - queue = malloc(sizeof(struct taskqueue), M_TASKQUEUE, mflags); + queue = kmalloc(sizeof(struct taskqueue), M_TASKQUEUE, mflags); if (!queue) return 0; STAILQ_INIT(&queue->tq_queue); @@ -93,7 +93,7 @@ taskqueue_free(struct taskqueue *queue) STAILQ_REMOVE(&taskqueue_queues, queue, taskqueue, tq_link); crit_exit(); - free(queue, M_TASKQUEUE); + kfree(queue, M_TASKQUEUE); } struct taskqueue * diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index d3daabdacb..7b784830ed 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -37,7 +37,7 @@ * * @(#)sys_generic.c 8.5 (Berkeley) 1/21/94 * $FreeBSD: src/sys/kern/sys_generic.c,v 1.55.2.10 2001/03/17 10:39:32 peter Exp $ - * $DragonFly: src/sys/kern/sys_generic.c,v 1.35 2006/09/03 18:29:16 dillon Exp $ + * $DragonFly: src/sys/kern/sys_generic.c,v 1.36 2006/09/05 00:55:45 dillon Exp $ */ #include "opt_ktrace.h" @@ -647,7 +647,7 @@ mapped_ioctl(int fd, u_long com, caddr_t uspc_data, struct ioctl_map *map) memp = NULL; if (size > sizeof (ubuf.stkbuf)) { - memp = malloc(size, M_IOCTLOPS, M_WAITOK); + memp = kmalloc(size, M_IOCTLOPS, M_WAITOK); data = memp; } else { data = ubuf.stkbuf; @@ -657,7 +657,7 @@ mapped_ioctl(int fd, u_long com, caddr_t uspc_data, struct ioctl_map *map) error = copyin(uspc_data, data, (u_int)size); if (error) { if (memp != NULL) - free(memp, M_IOCTLOPS); + kfree(memp, M_IOCTLOPS); goto done; } } else { @@ -708,7 +708,7 @@ mapped_ioctl(int fd, u_long com, caddr_t uspc_data, struct ioctl_map *map) break; } if (memp != NULL) - free(memp, M_IOCTLOPS); + kfree(memp, M_IOCTLOPS); done: fdrop(fp); return(error); @@ -722,7 +722,7 @@ mapped_ioctl_register_handler(struct ioctl_map_handler *he) KKASSERT(he != NULL && he->map != NULL && he->cmd_ranges != NULL && he->subsys != NULL && *he->subsys != '\0'); - ne = malloc(sizeof(struct ioctl_map_entry), M_IOCTLMAP, M_WAITOK); + ne = kmalloc(sizeof(struct ioctl_map_entry), M_IOCTLMAP, M_WAITOK); ne->subsys = he->subsys; ne->cmd_ranges = he->cmd_ranges; @@ -743,7 +743,7 @@ mapped_ioctl_unregister_handler(struct ioctl_map_handler *he) if (ne->cmd_ranges != he->cmd_ranges) continue; LIST_REMOVE(ne, entries); - free(ne, M_IOCTLMAP); + kfree(ne, M_IOCTLMAP); return(0); } return(EINVAL); @@ -794,7 +794,7 @@ sys_select(struct select_args *uap) if (nbufbytes <= sizeof s_selbits) selbits = &s_selbits[0]; else - selbits = malloc(nbufbytes, M_SELECT, M_WAITOK); + selbits = kmalloc(nbufbytes, M_SELECT, M_WAITOK); /* * Assign pointers into the bit buffers and fetch the input bits. @@ -884,7 +884,7 @@ done: #undef putbits } if (selbits != &s_selbits[0]) - free(selbits, M_SELECT); + kfree(selbits, M_SELECT); return (error); } @@ -949,7 +949,7 @@ sys_poll(struct poll_args *uap) return (EINVAL); ni = nfds * sizeof(struct pollfd); if (ni > sizeof(smallbits)) - bits = malloc(ni, M_TEMP, M_WAITOK); + bits = kmalloc(ni, M_TEMP, M_WAITOK); else bits = smallbits; error = copyin(uap->fds, bits, ni); @@ -1008,7 +1008,7 @@ done: } out: if (ni > sizeof(smallbits)) - free(bits, M_TEMP); + kfree(bits, M_TEMP); return (error); } diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c index 9d458bd4e1..28ed88d8b4 100644 --- a/sys/kern/sys_pipe.c +++ b/sys/kern/sys_pipe.c @@ -17,7 +17,7 @@ * are met. * * $FreeBSD: src/sys/kern/sys_pipe.c,v 1.60.2.13 2002/08/05 15:05:15 des Exp $ - * $DragonFly: src/sys/kern/sys_pipe.c,v 1.40 2006/08/02 01:25:25 dillon Exp $ + * $DragonFly: src/sys/kern/sys_pipe.c,v 1.41 2006/09/05 00:55:45 dillon Exp $ */ /* @@ -357,7 +357,7 @@ pipe_create(cpipep) --gd->gd_pipeqcount; cpipe->pipe_peer = NULL; } else { - cpipe = malloc(sizeof(struct pipe), M_PIPE, M_WAITOK|M_ZERO); + cpipe = kmalloc(sizeof(struct pipe), M_PIPE, M_WAITOK|M_ZERO); } *cpipep = cpipe; if ((error = pipespace(cpipe, PIPE_SIZE)) != 0) @@ -1418,7 +1418,7 @@ pipeclose(struct pipe *cpipe) cpipe->pipe_buffer.size != PIPE_SIZE ) { pipe_free_kmem(cpipe); - free(cpipe, M_PIPE); + kfree(cpipe, M_PIPE); } else { KKASSERT(cpipe->pipe_map.xio_npages == 0 && cpipe->pipe_map.xio_bytes == 0 && diff --git a/sys/kern/sysv_msg.c b/sys/kern/sysv_msg.c index 7b22edd07b..1e8c1cc5ad 100644 --- a/sys/kern/sysv_msg.c +++ b/sys/kern/sysv_msg.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/kern/sysv_msg.c,v 1.23.2.5 2002/12/31 08:54:53 maxim Exp $ */ -/* $DragonFly: src/sys/kern/sysv_msg.c,v 1.14 2006/06/05 07:26:10 dillon Exp $ */ +/* $DragonFly: src/sys/kern/sysv_msg.c,v 1.15 2006/09/05 00:55:45 dillon Exp $ */ /* * Implementation of SVID messages @@ -130,16 +130,16 @@ msginit(dummy) int i; msginfo.msgmax = msginfo.msgseg * msginfo.msgssz; - msgpool = malloc(msginfo.msgmax, M_MSG, M_WAITOK); + msgpool = kmalloc(msginfo.msgmax, M_MSG, M_WAITOK); if (msgpool == NULL) panic("msgpool is NULL"); - msgmaps = malloc(sizeof(struct msgmap) * msginfo.msgseg, M_MSG, M_WAITOK); + msgmaps = kmalloc(sizeof(struct msgmap) * msginfo.msgseg, M_MSG, M_WAITOK); if (msgmaps == NULL) panic("msgmaps is NULL"); - msghdrs = malloc(sizeof(struct msg) * msginfo.msgtql, M_MSG, M_WAITOK); + msghdrs = kmalloc(sizeof(struct msg) * msginfo.msgtql, M_MSG, M_WAITOK); if (msghdrs == NULL) panic("msghdrs is NULL"); - msqids = malloc(sizeof(struct msqid_ds) * msginfo.msgmni, M_MSG, M_WAITOK); + msqids = kmalloc(sizeof(struct msqid_ds) * msginfo.msgmni, M_MSG, M_WAITOK); if (msqids == NULL) panic("msqids is NULL"); diff --git a/sys/kern/sysv_sem.c b/sys/kern/sysv_sem.c index 7b5bd0cb2b..49f8c39df2 100644 --- a/sys/kern/sysv_sem.c +++ b/sys/kern/sysv_sem.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/kern/sysv_sem.c,v 1.69 2004/03/17 09:37:13 cperciva Exp $ */ -/* $DragonFly: src/sys/kern/sysv_sem.c,v 1.15 2006/06/05 07:26:10 dillon Exp $ */ +/* $DragonFly: src/sys/kern/sysv_sem.c,v 1.16 2006/09/05 00:55:45 dillon Exp $ */ /* * Implementation of SVID semaphores @@ -166,13 +166,13 @@ seminit(dummy) { int i; - sem = malloc(sizeof(struct sem) * seminfo.semmns, M_SEM, M_WAITOK); + sem = kmalloc(sizeof(struct sem) * seminfo.semmns, M_SEM, M_WAITOK); if (sem == NULL) panic("sem is NULL"); - sema = malloc(sizeof(struct semid_ds) * seminfo.semmni, M_SEM, M_WAITOK); + sema = kmalloc(sizeof(struct semid_ds) * seminfo.semmni, M_SEM, M_WAITOK); if (sema == NULL) panic("sema is NULL"); - semu = malloc(seminfo.semmnu * seminfo.semusz, M_SEM, M_WAITOK); + semu = kmalloc(seminfo.semmnu * seminfo.semusz, M_SEM, M_WAITOK); if (semu == NULL) panic("semu is NULL"); diff --git a/sys/kern/sysv_shm.c b/sys/kern/sysv_shm.c index 460190698a..cd0d3177be 100644 --- a/sys/kern/sysv_shm.c +++ b/sys/kern/sysv_shm.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/kern/sysv_shm.c,v 1.45.2.6 2002/10/22 20:45:03 fjoe Exp $ */ -/* $DragonFly: src/sys/kern/sysv_shm.c,v 1.17 2006/06/05 07:26:10 dillon Exp $ */ +/* $DragonFly: src/sys/kern/sysv_shm.c,v 1.18 2006/09/05 00:55:45 dillon Exp $ */ /* $NetBSD: sysv_shm.c,v 1.23 1994/07/04 23:25:12 glass Exp $ */ /* @@ -182,7 +182,7 @@ shm_deallocate_segment(shmseg) shm_handle = shmseg->shm_internal; vm_object_deallocate(shm_handle->shm_object); - free((caddr_t)shm_handle, M_SHM); + kfree((caddr_t)shm_handle, M_SHM); shmseg->shm_internal = NULL; size = round_page(shmseg->shm_segsz); shm_committed -= btoc(size); @@ -254,7 +254,7 @@ sys_shmat(struct shmat_args *uap) shmmap_s = (struct shmmap_state *)p->p_vmspace->vm_shm; if (shmmap_s == NULL) { size = shminfo.shmseg * sizeof(struct shmmap_state); - shmmap_s = malloc(size, M_SHM, M_WAITOK); + shmmap_s = kmalloc(size, M_SHM, M_WAITOK); for (i = 0; i < shminfo.shmseg; i++) shmmap_s[i].shmid = -1; p->p_vmspace->vm_shm = (caddr_t)shmmap_s; @@ -508,7 +508,7 @@ shmget_allocate_segment(p, uap, mode) shmseg->shm_perm.mode = SHMSEG_ALLOCATED | SHMSEG_REMOVED; shmseg->shm_perm.key = uap->key; shmseg->shm_perm.seq = (shmseg->shm_perm.seq + 1) & 0x7fff; - shm_handle = malloc(sizeof(struct shm_handle), M_SHM, M_WAITOK); + shm_handle = kmalloc(sizeof(struct shm_handle), M_SHM, M_WAITOK); shmid = IXSEQ_TO_IPCID(segnum, shmseg->shm_perm); /* @@ -604,7 +604,7 @@ shmfork(p1, p2) int i; size = shminfo.shmseg * sizeof(struct shmmap_state); - shmmap_s = malloc(size, M_SHM, M_WAITOK); + shmmap_s = kmalloc(size, M_SHM, M_WAITOK); bcopy((caddr_t)p1->p_vmspace->vm_shm, (caddr_t)shmmap_s, size); p2->p_vmspace->vm_shm = (caddr_t)shmmap_s; for (i = 0; i < shminfo.shmseg; i++, shmmap_s++) @@ -624,7 +624,7 @@ shmexit(struct vmspace *vm) if (shm->shmid != -1) shm_delete_mapping(vm, shm); } - free(base, M_SHM); + kfree(base, M_SHM); } } @@ -637,7 +637,7 @@ shmrealloc(void) if (shmalloced >= shminfo.shmmni) return; - newsegs = malloc(shminfo.shmmni * sizeof(*newsegs), M_SHM, M_WAITOK); + newsegs = kmalloc(shminfo.shmmni * sizeof(*newsegs), M_SHM, M_WAITOK); if (newsegs == NULL) return; for (i = 0; i < shmalloced; i++) @@ -646,7 +646,7 @@ shmrealloc(void) shmsegs[i].shm_perm.mode = SHMSEG_FREE; shmsegs[i].shm_perm.seq = 0; } - free(shmsegs, M_SHM); + kfree(shmsegs, M_SHM); shmsegs = newsegs; shmalloced = shminfo.shmmni; } @@ -659,7 +659,7 @@ shminit(dummy) shminfo.shmmax = shminfo.shmall * PAGE_SIZE; shmalloced = shminfo.shmmni; - shmsegs = malloc(shmalloced * sizeof(shmsegs[0]), M_SHM, M_WAITOK); + shmsegs = kmalloc(shmalloced * sizeof(shmsegs[0]), M_SHM, M_WAITOK); if (shmsegs == NULL) panic("cannot allocate initial memory for sysvshm"); for (i = 0; i < shmalloced; i++) { diff --git a/sys/kern/tty.c b/sys/kern/tty.c index 7e70c7cc46..b02f91a05b 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -37,7 +37,7 @@ * * @(#)tty.c 8.8 (Berkeley) 1/21/94 * $FreeBSD: src/sys/kern/tty.c,v 1.129.2.5 2002/03/11 01:32:31 dd Exp $ - * $DragonFly: src/sys/kern/tty.c,v 1.28 2006/09/03 18:29:16 dillon Exp $ + * $DragonFly: src/sys/kern/tty.c,v 1.29 2006/09/05 00:55:45 dillon Exp $ */ /*- @@ -2576,7 +2576,7 @@ ttymalloc(tp) if (tp) return(tp); - tp = malloc(sizeof *tp, M_TTYS, M_WAITOK|M_ZERO); + tp = kmalloc(sizeof *tp, M_TTYS, M_WAITOK|M_ZERO); ttyregister(tp); return (tp); } @@ -2594,7 +2594,7 @@ void ttyfree(tp) struct tty *tp; { - free(tp, M_TTYS); + kfree(tp, M_TTYS); } #endif /* 0 */ diff --git a/sys/kern/tty_pty.c b/sys/kern/tty_pty.c index 6a81e7c3af..8cff0fc9ab 100644 --- a/sys/kern/tty_pty.c +++ b/sys/kern/tty_pty.c @@ -32,7 +32,7 @@ * * @(#)tty_pty.c 8.4 (Berkeley) 2/20/95 * $FreeBSD: src/sys/kern/tty_pty.c,v 1.74.2.4 2002/02/20 19:58:13 dillon Exp $ - * $DragonFly: src/sys/kern/tty_pty.c,v 1.15 2006/09/03 17:31:55 dillon Exp $ + * $DragonFly: src/sys/kern/tty_pty.c,v 1.16 2006/09/05 00:55:45 dillon Exp $ */ /* @@ -140,7 +140,7 @@ ptyinit(n) if (n & ~0xff) return; - pt = malloc(sizeof(*pt), M_PTY, M_WAITOK); + pt = kmalloc(sizeof(*pt), M_PTY, M_WAITOK); bzero(pt, sizeof(*pt)); pt->devs = devs = make_dev(&pts_ops, n, 0, 0, 0666, "tty%c%r", names[n / 32], n % 32); diff --git a/sys/kern/tty_subr.c b/sys/kern/tty_subr.c index acc7c37495..6ae430f667 100644 --- a/sys/kern/tty_subr.c +++ b/sys/kern/tty_subr.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/kern/tty_subr.c,v 1.32 1999/08/28 00:46:21 peter Exp $ - * $DragonFly: src/sys/kern/tty_subr.c,v 1.7 2006/09/03 17:31:55 dillon Exp $ + * $DragonFly: src/sys/kern/tty_subr.c,v 1.8 2006/09/05 00:55:45 dillon Exp $ */ /* @@ -152,11 +152,11 @@ cblock_alloc_cblocks(int number) struct cblock *cbp; for (i = 0; i < number; ++i) { - cbp = malloc(sizeof *cbp, M_TTYS, M_NOWAIT); + cbp = kmalloc(sizeof *cbp, M_TTYS, M_NOWAIT); if (cbp == NULL) { printf( "clist_alloc_cblocks: M_NOWAIT malloc failed, trying M_WAITOK\n"); - cbp = malloc(sizeof *cbp, M_TTYS, M_WAITOK); + cbp = kmalloc(sizeof *cbp, M_TTYS, M_WAITOK); } KKASSERT(((intptr_t)cbp & CROUND) == 0); /* @@ -215,7 +215,7 @@ cblock_free_cblocks(int number) int i; for (i = 0; i < number; ++i) - free(cblock_alloc(), M_TTYS); + kfree(cblock_alloc(), M_TTYS); ctotcount -= number; } diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index c44ea04f39..ef3bd35fb3 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -82,7 +82,7 @@ * * @(#)uipc_mbuf.c 8.2 (Berkeley) 1/4/94 * $FreeBSD: src/sys/kern/uipc_mbuf.c,v 1.51.2.24 2003/04/15 06:59:29 silby Exp $ - * $DragonFly: src/sys/kern/uipc_mbuf.c,v 1.56 2006/09/03 17:31:55 dillon Exp $ + * $DragonFly: src/sys/kern/uipc_mbuf.c,v 1.57 2006/09/05 00:55:45 dillon Exp $ */ #include "opt_param.h" @@ -268,9 +268,9 @@ mclmeta_ctor(void *obj, void *private, int ocflags) void *buf; if (ocflags & M_NOWAIT) - buf = malloc(MCLBYTES, M_MBUFCL, M_NOWAIT | M_ZERO); + buf = kmalloc(MCLBYTES, M_MBUFCL, M_NOWAIT | M_ZERO); else - buf = malloc(MCLBYTES, M_MBUFCL, M_INTWAIT | M_ZERO); + buf = kmalloc(MCLBYTES, M_MBUFCL, M_INTWAIT | M_ZERO); if (buf == NULL) return (FALSE); cl->mcl_refs = 0; @@ -285,7 +285,7 @@ mclmeta_dtor(void *obj, void *private) struct mbcluster *mcl = obj; KKASSERT(mcl->mcl_refs == 0); - free(mcl->mcl_data, M_MBUFCL); + kfree(mcl->mcl_data, M_MBUFCL); } static void diff --git a/sys/kern/uipc_mbuf2.c b/sys/kern/uipc_mbuf2.c index ee7c3ddf0c..0b62c6b422 100644 --- a/sys/kern/uipc_mbuf2.c +++ b/sys/kern/uipc_mbuf2.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/kern/uipc_mbuf2.c,v 1.2.2.5 2003/01/23 21:06:44 sam Exp $ */ -/* $DragonFly: src/sys/kern/uipc_mbuf2.c,v 1.11 2005/06/17 19:12:16 dillon Exp $ */ +/* $DragonFly: src/sys/kern/uipc_mbuf2.c,v 1.12 2006/09/05 00:55:45 dillon Exp $ */ /* $KAME: uipc_mbuf2.c,v 1.31 2001/11/28 11:08:53 itojun Exp $ */ /* $NetBSD: uipc_mbuf.c,v 1.40 1999/04/01 00:23:25 thorpej Exp $ */ @@ -271,7 +271,7 @@ m_tag_alloc(u_int32_t cookie, int type, int len, int wait) if (len < 0) return NULL; - t = malloc(len + sizeof(struct m_tag), M_PACKET_TAGS, + t = kmalloc(len + sizeof(struct m_tag), M_PACKET_TAGS, wait != MB_WAIT ? M_NOWAIT : M_WAITOK); if (t == NULL) return NULL; @@ -286,7 +286,7 @@ m_tag_alloc(u_int32_t cookie, int type, int len, int wait) void m_tag_free(struct m_tag *t) { - free(t, M_PACKET_TAGS); + kfree(t, M_PACKET_TAGS); } /* Prepend a packet tag. */ diff --git a/sys/kern/uipc_socket2.c b/sys/kern/uipc_socket2.c index 8c37ad6aa2..694c674c5e 100644 --- a/sys/kern/uipc_socket2.c +++ b/sys/kern/uipc_socket2.c @@ -33,7 +33,7 @@ * * @(#)uipc_socket2.c 8.1 (Berkeley) 6/10/93 * $FreeBSD: src/sys/kern/uipc_socket2.c,v 1.55.2.17 2002/08/31 19:04:55 dwmalone Exp $ - * $DragonFly: src/sys/kern/uipc_socket2.c,v 1.23 2006/05/06 02:43:12 dillon Exp $ + * $DragonFly: src/sys/kern/uipc_socket2.c,v 1.24 2006/09/05 00:55:45 dillon Exp $ */ #include "opt_param.h" @@ -1075,7 +1075,7 @@ dup_sockaddr(const struct sockaddr *sa) { struct sockaddr *sa2; - sa2 = malloc(sa->sa_len, M_SONAME, M_INTWAIT); + sa2 = kmalloc(sa->sa_len, M_SONAME, M_INTWAIT); bcopy(sa, sa2, sa->sa_len); return (sa2); } diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index 29e09eccab..6631a73ac7 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -35,7 +35,7 @@ * * @(#)uipc_syscalls.c 8.4 (Berkeley) 2/21/94 * $FreeBSD: src/sys/kern/uipc_syscalls.c,v 1.65.2.17 2003/04/04 17:11:16 tegge Exp $ - * $DragonFly: src/sys/kern/uipc_syscalls.c,v 1.74 2006/09/03 18:29:16 dillon Exp $ + * $DragonFly: src/sys/kern/uipc_syscalls.c,v 1.75 2006/09/05 00:55:45 dillon Exp $ */ #include "opt_ktrace.h" @@ -1348,7 +1348,7 @@ freeit: vm_page_try_to_free(m); crit_exit(); rel_mplock(); - free(sfm, M_SENDFILE); + kfree(sfm, M_SENDFILE); } else { lwkt_serialize_exit(&sfm->serializer); } @@ -1658,7 +1658,7 @@ retry_lookup: /* * sfm is a temporary hack, use a per-cpu cache for this. */ - sfm = malloc(sizeof(struct sfbuf_mref), M_SENDFILE, M_WAITOK); + sfm = kmalloc(sizeof(struct sfbuf_mref), M_SENDFILE, M_WAITOK); sfm->sf = sf; sfm->mref_count = 1; lwkt_serialize_init(&sfm->serializer); diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index 58c2e2fe94..ff56ea9cd8 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -32,7 +32,7 @@ * * From: @(#)uipc_usrreq.c 8.3 (Berkeley) 1/4/94 * $FreeBSD: src/sys/kern/uipc_usrreq.c,v 1.54.2.10 2003/03/04 17:28:09 nectar Exp $ - * $DragonFly: src/sys/kern/uipc_usrreq.c,v 1.28 2006/09/02 16:51:44 dillon Exp $ + * $DragonFly: src/sys/kern/uipc_usrreq.c,v 1.29 2006/09/05 00:55:45 dillon Exp $ */ #include @@ -581,7 +581,7 @@ unp_detach(struct unpcb *unp) unp_gc(); } if (unp->unp_addr) - free(unp->unp_addr, M_SONAME); + kfree(unp->unp_addr, M_SONAME); zfree(unp_zone, unp); } @@ -823,7 +823,7 @@ unp_pcblist(SYSCTL_HANDLER_ARGS) gencnt = unp_gencnt; n = unp_count; - unp_list = malloc(n * sizeof *unp_list, M_TEMP, M_WAITOK); + unp_list = kmalloc(n * sizeof *unp_list, M_TEMP, M_WAITOK); if (unp_list == NULL) return ENOMEM; @@ -857,7 +857,7 @@ unp_pcblist(SYSCTL_HANDLER_ARGS) error = SYSCTL_OUT(req, &xu, sizeof xu); } } - free(unp_list, M_TEMP); + kfree(unp_list, M_TEMP); return error; } @@ -1180,7 +1180,7 @@ unp_gc() * * 91/09/19, bsy@cs.cmu.edu */ - info.extra_ref = malloc(256 * sizeof(struct file *), M_FILE, M_WAITOK); + info.extra_ref = kmalloc(256 * sizeof(struct file *), M_FILE, M_WAITOK); info.maxindex = 256; do { @@ -1201,7 +1201,7 @@ unp_gc() for (i = info.index, fpp = info.extra_ref; --i >= 0; ++fpp) closef(*fpp, NULL); } while (info.index == info.maxindex); - free((caddr_t)info.extra_ref, M_FILE); + kfree((caddr_t)info.extra_ref, M_FILE); unp_gcing = FALSE; } diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 4171d69e67..5341eede5a 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -12,7 +12,7 @@ * John S. Dyson. * * $FreeBSD: src/sys/kern/vfs_bio.c,v 1.242.2.20 2003/05/28 18:38:10 alc Exp $ - * $DragonFly: src/sys/kern/vfs_bio.c,v 1.78 2006/07/07 13:00:37 corecode Exp $ + * $DragonFly: src/sys/kern/vfs_bio.c,v 1.79 2006/09/05 00:55:45 dillon Exp $ */ /* @@ -2457,7 +2457,7 @@ allocbuf(struct buf *bp, int size) if (newbsize) { bp->b_bcount = size; } else { - free(bp->b_data, M_BIOBUF); + kfree(bp->b_data, M_BIOBUF); if (bp->b_bufsize) { bufmallocspace -= bp->b_bufsize; bufspacewakeup(); @@ -2483,7 +2483,7 @@ allocbuf(struct buf *bp, int size) (bp->b_bufsize == 0) && (mbsize <= PAGE_SIZE/2)) { - bp->b_data = malloc(mbsize, M_BIOBUF, M_WAITOK); + bp->b_data = kmalloc(mbsize, M_BIOBUF, M_WAITOK); bp->b_bufsize = mbsize; bp->b_bcount = size; bp->b_flags |= B_MALLOC; @@ -2515,7 +2515,7 @@ allocbuf(struct buf *bp, int size) (vm_offset_t) bp->b_data + newbsize); if (origbuf) { bcopy(origbuf, bp->b_data, origbufsize); - free(origbuf, M_BIOBUF); + kfree(origbuf, M_BIOBUF); } } } else { diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 68cda72d3c..8fa6ae125f 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -67,7 +67,7 @@ * * @(#)vfs_cache.c 8.5 (Berkeley) 3/22/95 * $FreeBSD: src/sys/kern/vfs_cache.c,v 1.42.2.6 2001/10/05 20:07:03 dillon Exp $ - * $DragonFly: src/sys/kern/vfs_cache.c,v 1.75 2006/08/19 17:27:23 dillon Exp $ + * $DragonFly: src/sys/kern/vfs_cache.c,v 1.76 2006/09/05 00:55:45 dillon Exp $ */ #include @@ -290,9 +290,9 @@ cache_alloc(int nlen) { struct namecache *ncp; - ncp = malloc(sizeof(*ncp), M_VFSCACHE, M_WAITOK|M_ZERO); + ncp = kmalloc(sizeof(*ncp), M_VFSCACHE, M_WAITOK|M_ZERO); if (nlen) - ncp->nc_name = malloc(nlen + 1, M_VFSCACHE, M_WAITOK); + ncp->nc_name = kmalloc(nlen + 1, M_VFSCACHE, M_WAITOK); ncp->nc_nlen = nlen; ncp->nc_flag = NCF_UNRESOLVED; ncp->nc_error = ENOTCONN; /* needs to be resolved */ @@ -314,8 +314,8 @@ cache_free(struct namecache *ncp) { KKASSERT(ncp->nc_refs == 1 && ncp->nc_exlocks == 1); if (ncp->nc_name) - free(ncp->nc_name, M_VFSCACHE); - free(ncp, M_VFSCACHE); + kfree(ncp->nc_name, M_VFSCACHE); + kfree(ncp, M_VFSCACHE); } /* @@ -1244,7 +1244,7 @@ cache_inefficient_scan(struct namecache *ncp, struct ucred *cred, printf("inefficient_scan: directory iosize %ld vattr fileid = %ld\n", vat.va_blocksize, (long)vat.va_fileid); if ((blksize = vat.va_blocksize) == 0) blksize = DEV_BSIZE; - rbuf = malloc(blksize, M_TEMP, M_WAITOK); + rbuf = kmalloc(blksize, M_TEMP, M_WAITOK); rncp = NULL; eofflag = 0; @@ -1316,7 +1316,7 @@ again: dvp, ncp->nc_name); error = ENOENT; } - free(rbuf, M_TEMP); + kfree(rbuf, M_TEMP); return (error); } @@ -1388,8 +1388,8 @@ cache_zap(struct namecache *ncp) /* cache_unlock(ncp) not required */ ncp->nc_refs = -1; /* safety */ if (ncp->nc_name) - free(ncp->nc_name, M_VFSCACHE); - free(ncp, M_VFSCACHE); + kfree(ncp->nc_name, M_VFSCACHE); + kfree(ncp, M_VFSCACHE); /* * Loop on the parent (it may be NULL). Only bother looping @@ -2001,11 +2001,11 @@ sys___getcwd(struct __getcwd_args *uap) if (buflen > MAXPATHLEN) buflen = MAXPATHLEN; - buf = malloc(buflen, M_TEMP, M_WAITOK); + buf = kmalloc(buflen, M_TEMP, M_WAITOK); bp = kern_getcwd(buf, buflen, &error); if (error == 0) error = copyout(bp, uap->buf, strlen(bp) + 1); - free(buf, M_TEMP); + kfree(buf, M_TEMP); return (error); } @@ -2099,7 +2099,7 @@ cache_fullpath(struct proc *p, struct namecache *ncp, char **retbuf, char **free numfullpathcalls--; - buf = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); + buf = kmalloc(MAXPATHLEN, M_TEMP, M_WAITOK); bp = buf + MAXPATHLEN - 1; *bp = '\0'; if (p != NULL) @@ -2110,7 +2110,7 @@ cache_fullpath(struct proc *p, struct namecache *ncp, char **retbuf, char **free while (ncp && ncp != fd_nrdir && (ncp->nc_flag & NCF_ROOT) == 0) { if (ncp->nc_flag & NCF_MOUNTPT) { if (ncp->nc_mount == NULL) { - free(buf, M_TEMP); + kfree(buf, M_TEMP); return(EBADF); } ncp = ncp->nc_parent; @@ -2119,14 +2119,14 @@ cache_fullpath(struct proc *p, struct namecache *ncp, char **retbuf, char **free for (i = ncp->nc_nlen - 1; i >= 0; i--) { if (bp == buf) { numfullpathfail4++; - free(buf, M_TEMP); + kfree(buf, M_TEMP); return(ENOMEM); } *--bp = ncp->nc_name[i]; } if (bp == buf) { numfullpathfail4++; - free(buf, M_TEMP); + kfree(buf, M_TEMP); return(ENOMEM); } *--bp = '/'; @@ -2135,7 +2135,7 @@ cache_fullpath(struct proc *p, struct namecache *ncp, char **retbuf, char **free } if (ncp == NULL) { numfullpathfail2++; - free(buf, M_TEMP); + kfree(buf, M_TEMP); return(ENOENT); } if (p != NULL && (ncp->nc_flag & NCF_ROOT) && ncp != fd_nrdir) { @@ -2146,7 +2146,7 @@ cache_fullpath(struct proc *p, struct namecache *ncp, char **retbuf, char **free if (!slash_prefixed) { if (bp == buf) { numfullpathfail4++; - free(buf, M_TEMP); + kfree(buf, M_TEMP); return(ENOMEM); } *--bp = '/'; diff --git a/sys/kern/vfs_cluster.c b/sys/kern/vfs_cluster.c index 5ed0741e08..c508687cd6 100644 --- a/sys/kern/vfs_cluster.c +++ b/sys/kern/vfs_cluster.c @@ -34,7 +34,7 @@ * * @(#)vfs_cluster.c 8.7 (Berkeley) 2/13/94 * $FreeBSD: src/sys/kern/vfs_cluster.c,v 1.92.2.9 2001/11/18 07:10:59 dillon Exp $ - * $DragonFly: src/sys/kern/vfs_cluster.c,v 1.26 2006/07/14 19:23:39 corecode Exp $ + * $DragonFly: src/sys/kern/vfs_cluster.c,v 1.27 2006/09/05 00:55:45 dillon Exp $ */ #include "opt_debug_cluster.h" @@ -655,7 +655,7 @@ cluster_write(struct buf *bp, off_t filesize, int seqcount) for (bpp = buflist->bs_children; bpp < endbp; bpp++) brelse(*bpp); - free(buflist, M_SEGMENT); + kfree(buflist, M_SEGMENT); if (seqcount > 1) { cluster_wbuild_wb(vp, lblocksize, vp->v_cstart, @@ -668,7 +668,7 @@ cluster_write(struct buf *bp, off_t filesize, int seqcount) for (bpp = buflist->bs_children; bpp <= endbp; bpp++) bdwrite(*bpp); - free(buflist, M_SEGMENT); + kfree(buflist, M_SEGMENT); vp->v_lastw = loffset; vp->v_lasta = bp->b_bio2.bio_offset; return; diff --git a/sys/kern/vfs_conf.c b/sys/kern/vfs_conf.c index 0481523979..a5840ffb9a 100644 --- a/sys/kern/vfs_conf.c +++ b/sys/kern/vfs_conf.c @@ -26,7 +26,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/kern/vfs_conf.c,v 1.49.2.5 2003/01/07 11:56:53 joerg Exp $ - * $DragonFly: src/sys/kern/vfs_conf.c,v 1.17 2006/09/03 17:43:59 dillon Exp $ + * $DragonFly: src/sys/kern/vfs_conf.c,v 1.18 2006/09/05 00:55:45 dillon Exp $ */ /* @@ -206,8 +206,8 @@ vfs_mountroot_try(const char *mountfrom) crit_exit(); /* parse vfs name and devname */ - vfsname = malloc(MFSNAMELEN, M_MOUNT, M_WAITOK); - devname = malloc(MNAMELEN, M_MOUNT, M_WAITOK); + vfsname = kmalloc(MFSNAMELEN, M_MOUNT, M_WAITOK); + devname = kmalloc(MNAMELEN, M_MOUNT, M_WAITOK); vfsname[0] = devname[0] = 0; sprintf(patt, "%%%d[a-z0-9]:%%%ds", MFSNAMELEN, MNAMELEN); if (sscanf(mountfrom, patt, vfsname, devname) < 1) @@ -237,13 +237,13 @@ vfs_mountroot_try(const char *mountfrom) done: if (vfsname != NULL) - free(vfsname, M_MOUNT); + kfree(vfsname, M_MOUNT); if (devname != NULL) - free(devname, M_MOUNT); + kfree(devname, M_MOUNT); if (error != 0) { if (mp != NULL) { vfs_unbusy(mp); - free(mp, M_MOUNT); + kfree(mp, M_MOUNT); } printf("Root mount failed: %d\n", error); } else { diff --git a/sys/kern/vfs_init.c b/sys/kern/vfs_init.c index abac3551bd..e85c58638d 100644 --- a/sys/kern/vfs_init.c +++ b/sys/kern/vfs_init.c @@ -70,7 +70,7 @@ * * @(#)vfs_init.c 8.3 (Berkeley) 1/4/94 * $FreeBSD: src/sys/kern/vfs_init.c,v 1.59 2002/04/30 18:44:32 dillon Exp $ - * $DragonFly: src/sys/kern/vfs_init.c,v 1.13 2006/07/18 22:22:12 dillon Exp $ + * $DragonFly: src/sys/kern/vfs_init.c,v 1.14 2006/09/05 00:55:45 dillon Exp $ */ /* * Manage vnode VOP operations vectors @@ -132,7 +132,7 @@ vfs_add_vnodeops(struct mount *mp, struct vop_ops *template, if (ops_pp) { KKASSERT(*ops_pp == NULL); - *ops_pp = malloc(sizeof(*ops), M_VNODEOP, M_WAITOK); + *ops_pp = kmalloc(sizeof(*ops), M_VNODEOP, M_WAITOK); ops = *ops_pp; bcopy(template, ops, sizeof(*ops)); } else { @@ -181,7 +181,7 @@ vfs_rm_vnodeops(struct mount *mp, struct vop_ops *template, mp->mnt_vn_use_ops = mp->mnt_vn_norm_ops; } if (ops_pp) - free(ops, M_VNODEOP); + kfree(ops, M_VNODEOP); } /* diff --git a/sys/kern/vfs_jops.c b/sys/kern/vfs_jops.c index f64da9504e..ddd3d33990 100644 --- a/sys/kern/vfs_jops.c +++ b/sys/kern/vfs_jops.c @@ -31,7 +31,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/kern/vfs_jops.c,v 1.28 2006/07/18 22:22:12 dillon Exp $ + * $DragonFly: src/sys/kern/vfs_jops.c,v 1.29 2006/09/05 00:55:45 dillon Exp $ */ /* * Each mount point may have zero or more independantly configured journals @@ -244,7 +244,7 @@ journal_attach(struct mount *mp) { KKASSERT(mp->mnt_jbitmap == NULL); vfs_add_vnodeops(mp, &journal_vnode_vops, &mp->mnt_vn_journal_ops); - mp->mnt_jbitmap = malloc(JREC_STREAMID_JMAX/8, M_JOURNAL, M_WAITOK|M_ZERO); + mp->mnt_jbitmap = kmalloc(JREC_STREAMID_JMAX/8, M_JOURNAL, M_WAITOK|M_ZERO); mp->mnt_streamid = JREC_STREAMID_JMIN; return(0); } @@ -255,7 +255,7 @@ journal_detach(struct mount *mp) KKASSERT(mp->mnt_jbitmap != NULL); if (mp->mnt_vn_journal_ops) vfs_rm_vnodeops(mp, &journal_vnode_vops, &mp->mnt_vn_journal_ops); - free(mp->mnt_jbitmap, M_JOURNAL); + kfree(mp->mnt_jbitmap, M_JOURNAL); mp->mnt_jbitmap = NULL; } @@ -274,7 +274,7 @@ journal_install_vfs_journal(struct mount *mp, struct file *fp, int error = 0; int size; - jo = malloc(sizeof(struct journal), M_JOURNAL, M_WAITOK|M_ZERO); + jo = kmalloc(sizeof(struct journal), M_JOURNAL, M_WAITOK|M_ZERO); bcopy(info->id, jo->id, sizeof(jo->id)); jo->flags = info->flags & ~(MC_JOURNAL_WACTIVE | MC_JOURNAL_RACTIVE | MC_JOURNAL_STOP_REQ); @@ -314,7 +314,7 @@ journal_install_vfs_journal(struct mount *mp, struct file *fp, * Allocate the memory FIFO */ jo->fifo.mask = jo->fifo.size - 1; - jo->fifo.membase = malloc(jo->fifo.size, M_JFIFO, M_WAITOK|M_ZERO|M_NULLOK); + jo->fifo.membase = kmalloc(jo->fifo.size, M_JFIFO, M_WAITOK|M_ZERO|M_NULLOK); if (jo->fifo.membase == NULL) error = ENOMEM; @@ -322,7 +322,7 @@ journal_install_vfs_journal(struct mount *mp, struct file *fp, * Create the worker threads and generate the association record. */ if (error) { - free(jo, M_JOURNAL); + kfree(jo, M_JOURNAL); } else { fhold(fp); journal_create_threads(jo); @@ -452,8 +452,8 @@ journal_destroy(struct mount *mp, struct journal *jo, int flags) if (jo->fp) fdrop(jo->fp); if (jo->fifo.membase) - free(jo->fifo.membase, M_JFIFO); - free(jo, M_JOURNAL); + kfree(jo->fifo.membase, M_JFIFO); + kfree(jo, M_JOURNAL); return(0); } @@ -573,7 +573,7 @@ jreclist_init(struct mount *mp, struct jrecord_list *jreclist, if (count == 0) jrec = jreccache; else - jrec = malloc(sizeof(*jrec), M_JOURNAL, M_WAITOK); + jrec = kmalloc(sizeof(*jrec), M_JOURNAL, M_WAITOK); jrecord_init(jo, jrec, streamid); jrec->user_save = jrecord_push(jrec, rectype); TAILQ_INSERT_TAIL(&jreclist->list, jrec, user_entry); @@ -610,7 +610,7 @@ jreclist_done(struct mount *mp, struct jrecord_list *jreclist, int error) while ((jrec = TAILQ_FIRST(&jreclist->list)) != NULL) { TAILQ_REMOVE(&jreclist->list, jrec, user_entry); if (count) - free(jrec, M_JOURNAL); + kfree(jrec, M_JOURNAL); ++count; } @@ -737,7 +737,7 @@ jrecord_undo_file(struct jrecord *jrec, struct vnode *vp, int jrflags, struct uio auio; char *buf; - buf = malloc(PATH_MAX, M_JOURNAL, M_WAITOK); + buf = kmalloc(PATH_MAX, M_JOURNAL, M_WAITOK); aiov.iov_base = buf; aiov.iov_len = PATH_MAX; auio.uio_iov = &aiov; @@ -752,7 +752,7 @@ jrecord_undo_file(struct jrecord *jrec, struct vnode *vp, int jrflags, jrecord_leaf(jrec, JLEAF_SYMLINKDATA, buf, PATH_MAX - auio.uio_resid); } - free(buf, M_JOURNAL); + kfree(buf, M_JOURNAL); } done: if (error) @@ -900,7 +900,7 @@ journal_write(struct vop_write_args *ap) jreclist_done(mp, &jreclist, error); if (uio_copy.uio_iov != &uio_one_iovec) - free(uio_copy.uio_iov, M_JOURNAL); + kfree(uio_copy.uio_iov, M_JOURNAL); return (error); } diff --git a/sys/kern/vfs_journal.c b/sys/kern/vfs_journal.c index 0c6f159737..61095cdc99 100644 --- a/sys/kern/vfs_journal.c +++ b/sys/kern/vfs_journal.c @@ -31,7 +31,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/kern/vfs_journal.c,v 1.27 2006/05/08 18:45:51 dillon Exp $ + * $DragonFly: src/sys/kern/vfs_journal.c,v 1.28 2006/09/05 00:55:45 dillon Exp $ */ /* * The journaling protocol is intended to evolve into a two-way stream @@ -1164,7 +1164,7 @@ again: if (pathlen <= sizeof(buf)) base = buf; else - base = malloc(pathlen, M_TEMP, M_INTWAIT); + base = kmalloc(pathlen, M_TEMP, M_INTWAIT); /* * Pass 2 - generate the path buffer @@ -1176,7 +1176,7 @@ again: ) { if (scan->nc_nlen >= index) { if (base != buf) - free(base, M_TEMP); + kfree(base, M_TEMP); goto again; } if (index == pathlen) @@ -1188,7 +1188,7 @@ again: } jrecord_leaf(jrec, rectype, base + index, pathlen - index); if (base != buf) - free(base, M_TEMP); + kfree(base, M_TEMP); } /* @@ -1393,7 +1393,7 @@ jrecord_file_data(struct jrecord *jrec, struct vnode *vp, int error; int n; - buf = malloc(bufsize, M_JOURNAL, M_WAITOK); + buf = kmalloc(bufsize, M_JOURNAL, M_WAITOK); jrecord_leaf(jrec, JLEAF_SEEKPOS, &off, sizeof(off)); while (bytes) { n = (bytes > bufsize) ? bufsize : (int)bytes; @@ -1407,6 +1407,6 @@ jrecord_file_data(struct jrecord *jrec, struct vnode *vp, bytes -= n; off += n; } - free(buf, M_JOURNAL); + kfree(buf, M_JOURNAL); } diff --git a/sys/kern/vfs_lock.c b/sys/kern/vfs_lock.c index 6e2ebbae17..e0e359cc8a 100644 --- a/sys/kern/vfs_lock.c +++ b/sys/kern/vfs_lock.c @@ -31,7 +31,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/kern/vfs_lock.c,v 1.23 2006/08/23 06:45:39 dillon Exp $ + * $DragonFly: src/sys/kern/vfs_lock.c,v 1.24 2006/09/05 00:55:45 dillon Exp $ */ /* @@ -519,7 +519,7 @@ allocvnode(int lktimeout, int lkflags) /* * A brand-new vnode (we could use malloc() here I think) XXX */ - vp = malloc(sizeof(struct vnode), M_VNODE, M_WAITOK|M_ZERO); + vp = kmalloc(sizeof(struct vnode), M_VNODE, M_WAITOK|M_ZERO); lwkt_token_init(&vp->v_pollinfo.vpi_token); lockinit(&vp->v_lock, "vnode", lktimeout, lkflags); ccms_dataspace_init(&vp->v_ccms); diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index e152073cec..c3f521da6b 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -67,7 +67,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/kern/vfs_mount.c,v 1.21 2006/08/11 01:54:59 dillon Exp $ + * $DragonFly: src/sys/kern/vfs_mount.c,v 1.22 2006/09/05 00:55:45 dillon Exp $ */ /* @@ -295,7 +295,7 @@ vfs_rootmountalloc(char *fstypename, char *devname, struct mount **mpp) } if (vfsp == NULL) return (ENODEV); - mp = malloc(sizeof(struct mount), M_MOUNT, M_WAITOK); + mp = kmalloc(sizeof(struct mount), M_MOUNT, M_WAITOK); bzero((char *)mp, (u_long)sizeof(struct mount)); lockinit(&mp->mnt_lock, "vfslock", VLKTIMEOUT, 0); vfs_busy(mp, LK_NOWAIT); diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 2a19d08de2..4ee32a170f 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -37,7 +37,7 @@ * * @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95 * $FreeBSD: src/sys/kern/vfs_subr.c,v 1.249.2.30 2003/04/04 20:35:57 tegge Exp $ - * $DragonFly: src/sys/kern/vfs_subr.c,v 1.94 2006/08/12 00:26:20 dillon Exp $ + * $DragonFly: src/sys/kern/vfs_subr.c,v 1.95 2006/09/05 00:55:45 dillon Exp $ */ /* @@ -1614,7 +1614,7 @@ vfs_hang_addrlist(struct mount *mp, struct netexport *nep, return (EINVAL); i = sizeof(struct netcred) + argp->ex_addrlen + argp->ex_masklen; - np = (struct netcred *) malloc(i, M_NETADDR, M_WAITOK); + np = (struct netcred *) kmalloc(i, M_NETADDR, M_WAITOK); bzero((caddr_t) np, i); saddr = (struct sockaddr *) (np + 1); if ((error = copyin(argp->ex_addr, (caddr_t) saddr, argp->ex_addrlen))) @@ -1657,7 +1657,7 @@ vfs_hang_addrlist(struct mount *mp, struct netexport *nep, np->netc_anon.cr_ref = 1; return (0); out: - free(np, M_NETADDR); + kfree(np, M_NETADDR); return (error); } @@ -1668,7 +1668,7 @@ vfs_free_netcred(struct radix_node *rn, void *w) struct radix_node_head *rnh = (struct radix_node_head *) w; (*rnh->rnh_deladdr) (rn->rn_key, rn->rn_mask, rnh); - free((caddr_t) rn, M_NETADDR); + kfree((caddr_t) rn, M_NETADDR); return (0); } @@ -1685,7 +1685,7 @@ vfs_free_addrlist(struct netexport *nep) if ((rnh = nep->ne_rtable[i])) { (*rnh->rnh_walktree) (rnh, vfs_free_netcred, (caddr_t) rnh); - free((caddr_t) rnh, M_RTABLE); + kfree((caddr_t) rnh, M_RTABLE); nep->ne_rtable[i] = 0; } } @@ -2066,7 +2066,7 @@ vop_write_dirent(int *error, struct uio *uio, ino_t d_ino, uint8_t d_type, if (len > uio->uio_resid) return(1); - dp = malloc(len, M_TEMP, M_WAITOK | M_ZERO); + dp = kmalloc(len, M_TEMP, M_WAITOK | M_ZERO); dp->d_ino = d_ino; dp->d_namlen = d_namlen; @@ -2075,7 +2075,7 @@ vop_write_dirent(int *error, struct uio *uio, ino_t d_ino, uint8_t d_type, *error = uiomove((caddr_t)dp, len, uio); - free(dp, M_TEMP); + kfree(dp, M_TEMP); return(0); } diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 24bf88d434..004a3dca4a 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -37,7 +37,7 @@ * * @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94 * $FreeBSD: src/sys/kern/vfs_syscalls.c,v 1.151.2.18 2003/04/04 20:35:58 tegge Exp $ - * $DragonFly: src/sys/kern/vfs_syscalls.c,v 1.101 2006/08/19 17:27:23 dillon Exp $ + * $DragonFly: src/sys/kern/vfs_syscalls.c,v 1.102 2006/09/05 00:55:45 dillon Exp $ */ #include @@ -290,7 +290,7 @@ sys_mount(struct mount_args *uap) /* * Allocate and initialize the filesystem. */ - mp = malloc(sizeof(struct mount), M_MOUNT, M_ZERO|M_WAITOK); + mp = kmalloc(sizeof(struct mount), M_MOUNT, M_ZERO|M_WAITOK); TAILQ_INIT(&mp->mnt_nvnodelist); TAILQ_INIT(&mp->mnt_reservedvnlist); TAILQ_INIT(&mp->mnt_jlist); @@ -384,7 +384,7 @@ update: vp->v_flag &= ~VMOUNT; mp->mnt_vfc->vfc_refcount--; vfs_unbusy(mp); - free(mp, M_MOUNT); + kfree(mp, M_MOUNT); cache_drop(ncp); vput(vp); } @@ -647,7 +647,7 @@ dounmount(struct mount *mp, int flags) lockmgr(&mp->mnt_lock, LK_RELEASE); if (mp->mnt_kern_flag & MNTK_MWAIT) wakeup(mp); - free(mp, M_MOUNT); + kfree(mp, M_MOUNT); return (0); } @@ -781,13 +781,13 @@ sys_mountctl(struct mountctl_args *uap) goto done; if (uap->ctllen) { - ctl = malloc(uap->ctllen + 1, M_TEMP, M_WAITOK|M_ZERO); + ctl = kmalloc(uap->ctllen + 1, M_TEMP, M_WAITOK|M_ZERO); error = copyin(uap->ctl, ctl, uap->ctllen); if (error) goto done; } if (uap->buflen) - buf = malloc(uap->buflen + 1, M_TEMP, M_WAITOK|M_ZERO); + buf = kmalloc(uap->buflen + 1, M_TEMP, M_WAITOK|M_ZERO); /* * Validate the descriptor @@ -810,9 +810,9 @@ done: if (path) objcache_put(namei_oc, path); if (ctl) - free(ctl, M_TEMP); + kfree(ctl, M_TEMP); if (buf) - free(buf, M_TEMP); + kfree(buf, M_TEMP); return (error); } @@ -878,7 +878,7 @@ kern_statfs(struct nlookupdata *nd, struct statfs *buf) return(error); bzero(sp->f_mntonname, sizeof(sp->f_mntonname)); strlcpy(sp->f_mntonname, fullpath, sizeof(sp->f_mntonname)); - free(freepath, M_TEMP); + kfree(freepath, M_TEMP); sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; bcopy(sp, buf, sizeof(*buf)); @@ -940,7 +940,7 @@ kern_fstatfs(int fd, struct statfs *buf) goto done; bzero(sp->f_mntonname, sizeof(sp->f_mntonname)); strlcpy(sp->f_mntonname, fullpath, sizeof(sp->f_mntonname)); - free(freepath, M_TEMP); + kfree(freepath, M_TEMP); sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; bcopy(sp, buf, sizeof(*buf)); @@ -1052,7 +1052,7 @@ getfsstat_callback(struct mount *mp, void *data) } bzero(sp->f_mntonname, sizeof(sp->f_mntonname)); strlcpy(sp->f_mntonname, fullpath, sizeof(sp->f_mntonname)); - free(freepath, M_TEMP); + kfree(freepath, M_TEMP); error = copyout(sp, info->sfsp, sizeof(*sp)); if (error) { @@ -3373,7 +3373,7 @@ sys_fhstatfs(struct fhstatfs_args *uap) return(error); bzero(sp->f_mntonname, sizeof(sp->f_mntonname)); strlcpy(sp->f_mntonname, fullpath, sizeof(sp->f_mntonname)); - free(freepath, M_TEMP); + kfree(freepath, M_TEMP); sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; if (suser(td)) { diff --git a/sys/libiconv/iconv.c b/sys/libiconv/iconv.c index 6c320ed007..703c91feae 100644 --- a/sys/libiconv/iconv.c +++ b/sys/libiconv/iconv.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/libkern/iconv.c,v 1.1.2.1 2001/05/21 08:28:07 bp Exp $ - * $DragonFly: src/sys/libiconv/iconv.c,v 1.4 2004/04/01 08:41:24 joerg Exp $ + * $DragonFly: src/sys/libiconv/iconv.c,v 1.5 2006/09/05 00:55:46 dillon Exp $ */ #include #include @@ -186,7 +186,7 @@ iconv_register_cspair(const char *to, const char *from, ucsfrom = strcmp(from, iconv_unicode_string) == 0; if (!ucsfrom) csize += strlen(from) + 1; - csp = malloc(csize, M_ICONV, M_WAITOK); + csp = kmalloc(csize, M_ICONV, M_WAITOK); bzero(csp, csize); csp->cp_id = iconv_csid++; csp->cp_dcp = dcp; @@ -214,8 +214,8 @@ iconv_unregister_cspair(struct iconv_cspair *csp) { TAILQ_REMOVE(&iconv_cslist, csp, cp_link); if (csp->cp_data) - free(csp->cp_data, M_ICONVDATA); - free(csp, M_ICONV); + kfree(csp->cp_data, M_ICONVDATA); + kfree(csp, M_ICONV); } /* @@ -360,7 +360,7 @@ iconv_sysctl_add(SYSCTL_HANDLER_ARGS) if (error) return error; if (din.ia_datalen) { - csp->cp_data = malloc(din.ia_datalen, M_ICONVDATA, M_WAITOK); + csp->cp_data = kmalloc(din.ia_datalen, M_ICONVDATA, M_WAITOK); error = copyin(din.ia_data, csp->cp_data, din.ia_datalen); if (error) goto bad; diff --git a/sys/net/altq/altq_cbq.c b/sys/net/altq/altq_cbq.c index 2e2f554c5c..9ff18f5b58 100644 --- a/sys/net/altq/altq_cbq.c +++ b/sys/net/altq/altq_cbq.c @@ -1,5 +1,5 @@ /* $KAME: altq_cbq.c,v 1.20 2004/04/17 10:54:48 kjc Exp $ */ -/* $DragonFly: src/sys/net/altq/altq_cbq.c,v 1.3 2005/11/22 00:24:35 dillon Exp $ */ +/* $DragonFly: src/sys/net/altq/altq_cbq.c,v 1.4 2006/09/05 00:55:47 dillon Exp $ */ /* * Copyright (c) Sun Microsystems, Inc. 1993-1998 All rights reserved. @@ -227,7 +227,7 @@ cbq_add_altq(struct pf_altq *a) return (ENODEV); /* allocate and initialize cbq_state_t */ - cbqp = malloc(sizeof(*cbqp), M_ALTQ, M_WAITOK | M_ZERO); + cbqp = kmalloc(sizeof(*cbqp), M_ALTQ, M_WAITOK | M_ZERO); callout_init(&cbqp->cbq_callout); cbqp->cbq_qlen = 0; cbqp->ifnp.ifq_ = &ifp->if_snd; /* keep the ifq */ @@ -255,7 +255,7 @@ cbq_remove_altq(struct pf_altq *a) cbq_class_destroy(cbqp, cbqp->ifnp.root_); /* deallocate cbq_state_t */ - free(cbqp, M_ALTQ); + kfree(cbqp, M_ALTQ); return (0); } diff --git a/sys/net/altq/altq_hfsc.c b/sys/net/altq/altq_hfsc.c index 2b06d4bca3..fdb58bd25a 100644 --- a/sys/net/altq/altq_hfsc.c +++ b/sys/net/altq/altq_hfsc.c @@ -1,5 +1,5 @@ /* $KAME: altq_hfsc.c,v 1.25 2004/04/17 10:54:48 kjc Exp $ */ -/* $DragonFly: src/sys/net/altq/altq_hfsc.c,v 1.5 2005/11/22 00:24:35 dillon Exp $ */ +/* $DragonFly: src/sys/net/altq/altq_hfsc.c,v 1.6 2006/09/05 00:55:47 dillon Exp $ */ /* * Copyright (c) 1997-1999 Carnegie Mellon University. All Rights Reserved. @@ -164,7 +164,7 @@ hfsc_add_altq(struct pf_altq *a) if (!ifq_is_ready(&ifp->if_snd)) return (ENODEV); - hif = malloc(sizeof(struct hfsc_if), M_ALTQ, M_WAITOK | M_ZERO); + hif = kmalloc(sizeof(struct hfsc_if), M_ALTQ, M_WAITOK | M_ZERO); hif->hif_eligible = ellist_alloc(); hif->hif_ifq = &ifp->if_snd; @@ -189,7 +189,7 @@ hfsc_remove_altq(struct pf_altq *a) ellist_destroy(hif->hif_eligible); - free(hif, M_ALTQ); + kfree(hif, M_ALTQ); return (0); } @@ -355,8 +355,8 @@ hfsc_class_create(struct hfsc_if *hif, struct service_curve *rsc, } #endif - cl = malloc(sizeof(*cl), M_ALTQ, M_WAITOK | M_ZERO); - cl->cl_q = malloc(sizeof(*cl->cl_q), M_ALTQ, M_WAITOK | M_ZERO); + cl = kmalloc(sizeof(*cl), M_ALTQ, M_WAITOK | M_ZERO); + cl->cl_q = kmalloc(sizeof(*cl->cl_q), M_ALTQ, M_WAITOK | M_ZERO); cl->cl_actc = actlist_alloc(); if (qlimit == 0) @@ -410,20 +410,20 @@ hfsc_class_create(struct hfsc_if *hif, struct service_curve *rsc, #endif /* ALTQ_RED */ if (rsc != NULL && (rsc->m1 != 0 || rsc->m2 != 0)) { - cl->cl_rsc = malloc(sizeof(*cl->cl_rsc), M_ALTQ, M_WAITOK); + cl->cl_rsc = kmalloc(sizeof(*cl->cl_rsc), M_ALTQ, M_WAITOK); sc2isc(rsc, cl->cl_rsc); rtsc_init(&cl->cl_deadline, cl->cl_rsc, 0, 0); rtsc_init(&cl->cl_eligible, cl->cl_rsc, 0, 0); } if (fsc != NULL && (fsc->m1 != 0 || fsc->m2 != 0)) { - cl->cl_fsc = malloc(sizeof(*cl->cl_fsc), M_ALTQ, M_WAITOK); + cl->cl_fsc = kmalloc(sizeof(*cl->cl_fsc), M_ALTQ, M_WAITOK); if (cl->cl_fsc == NULL) goto err_ret; sc2isc(fsc, cl->cl_fsc); rtsc_init(&cl->cl_virtual, cl->cl_fsc, 0, 0); } if (usc != NULL && (usc->m1 != 0 || usc->m2 != 0)) { - cl->cl_usc = malloc(sizeof(*cl->cl_usc), M_ALTQ, M_WAITOK); + cl->cl_usc = kmalloc(sizeof(*cl->cl_usc), M_ALTQ, M_WAITOK); if (cl->cl_usc == NULL) goto err_ret; sc2isc(usc, cl->cl_usc); @@ -492,14 +492,14 @@ hfsc_class_create(struct hfsc_if *hif, struct service_curve *rsc, #endif } if (cl->cl_fsc != NULL) - free(cl->cl_fsc, M_ALTQ); + kfree(cl->cl_fsc, M_ALTQ); if (cl->cl_rsc != NULL) - free(cl->cl_rsc, M_ALTQ); + kfree(cl->cl_rsc, M_ALTQ); if (cl->cl_usc != NULL) - free(cl->cl_usc, M_ALTQ); + kfree(cl->cl_usc, M_ALTQ); if (cl->cl_q != NULL) - free(cl->cl_q, M_ALTQ); - free(cl, M_ALTQ); + kfree(cl->cl_q, M_ALTQ); + kfree(cl, M_ALTQ); return (NULL); } @@ -566,13 +566,13 @@ hfsc_class_destroy(struct hfsc_class *cl) cl->cl_hif->hif_defaultclass = NULL; if (cl->cl_usc != NULL) - free(cl->cl_usc, M_ALTQ); + kfree(cl->cl_usc, M_ALTQ); if (cl->cl_fsc != NULL) - free(cl->cl_fsc, M_ALTQ); + kfree(cl->cl_fsc, M_ALTQ); if (cl->cl_rsc != NULL) - free(cl->cl_rsc, M_ALTQ); - free(cl->cl_q, M_ALTQ); - free(cl, M_ALTQ); + kfree(cl->cl_rsc, M_ALTQ); + kfree(cl->cl_q, M_ALTQ); + kfree(cl, M_ALTQ); return (0); } @@ -1105,7 +1105,7 @@ ellist_alloc(void) { ellist_t *head; - head = malloc(sizeof(ellist_t *), M_ALTQ, M_WAITOK); + head = kmalloc(sizeof(ellist_t *), M_ALTQ, M_WAITOK); TAILQ_INIT(head); return (head); } @@ -1113,7 +1113,7 @@ ellist_alloc(void) static void ellist_destroy(ellist_t *head) { - free(head, M_ALTQ); + kfree(head, M_ALTQ); } static void @@ -1208,7 +1208,7 @@ actlist_alloc(void) { actlist_t *head; - head = malloc(sizeof(*head), M_ALTQ, M_WAITOK); + head = kmalloc(sizeof(*head), M_ALTQ, M_WAITOK); TAILQ_INIT(head); return (head); } @@ -1216,7 +1216,7 @@ actlist_alloc(void) static void actlist_destroy(actlist_t *head) { - free(head, M_ALTQ); + kfree(head, M_ALTQ); } static void actlist_insert(struct hfsc_class *cl) diff --git a/sys/net/altq/altq_priq.c b/sys/net/altq/altq_priq.c index 1a62e11296..a6a57d91f2 100644 --- a/sys/net/altq/altq_priq.c +++ b/sys/net/altq/altq_priq.c @@ -1,5 +1,5 @@ /* $KAME: altq_priq.c,v 1.12 2004/04/17 10:54:48 kjc Exp $ */ -/* $DragonFly: src/sys/net/altq/altq_priq.c,v 1.5 2005/11/22 00:24:35 dillon Exp $ */ +/* $DragonFly: src/sys/net/altq/altq_priq.c,v 1.6 2006/09/05 00:55:47 dillon Exp $ */ /* * Copyright (C) 2000-2003 @@ -103,7 +103,7 @@ priq_add_altq(struct pf_altq *a) if (!ifq_is_ready(&ifp->if_snd)) return (ENODEV); - pif = malloc(sizeof(*pif), M_ALTQ, M_WAITOK | M_ZERO); + pif = kmalloc(sizeof(*pif), M_ALTQ, M_WAITOK | M_ZERO); pif->pif_bandwidth = a->ifbandwidth; pif->pif_maxpri = -1; pif->pif_ifq = &ifp->if_snd; @@ -125,7 +125,7 @@ priq_remove_altq(struct pf_altq *a) priq_clear_interface(pif); - free(pif, M_ALTQ); + kfree(pif, M_ALTQ); return (0); } @@ -274,8 +274,8 @@ priq_class_create(struct priq_if *pif, int pri, int qlimit, int flags, int qid) red_destroy(cl->cl_red); #endif } else { - cl = malloc(sizeof(*cl), M_ALTQ, M_WAITOK | M_ZERO); - cl->cl_q = malloc(sizeof(*cl->cl_q), M_ALTQ, M_WAITOK | M_ZERO); + cl = kmalloc(sizeof(*cl), M_ALTQ, M_WAITOK | M_ZERO); + cl->cl_q = kmalloc(sizeof(*cl->cl_q), M_ALTQ, M_WAITOK | M_ZERO); } pif->pif_classes[pri] = cl; @@ -365,8 +365,8 @@ priq_class_destroy(struct priq_class *cl) red_destroy(cl->cl_red); #endif } - free(cl->cl_q, M_ALTQ); - free(cl, M_ALTQ); + kfree(cl->cl_q, M_ALTQ); + kfree(cl, M_ALTQ); return (0); } diff --git a/sys/net/altq/altq_red.c b/sys/net/altq/altq_red.c index 4d9f0320ab..a3354833b6 100644 --- a/sys/net/altq/altq_red.c +++ b/sys/net/altq/altq_red.c @@ -1,5 +1,5 @@ /* $KAME: altq_red.c,v 1.19 2004/04/17 10:54:49 kjc Exp $ */ -/* $DragonFly: src/sys/net/altq/altq_red.c,v 1.2 2006/09/03 17:31:55 dillon Exp $ */ +/* $DragonFly: src/sys/net/altq/altq_red.c,v 1.3 2006/09/05 00:55:47 dillon Exp $ */ /* * Copyright (C) 1997-2003 @@ -166,7 +166,7 @@ red_alloc(int weight, int inv_pmax, int th_min, int th_max, int flags, int pktti int w, i; int npkts_per_sec; - rp = malloc(sizeof(*rp), M_ALTQ, M_WAITOK | M_ZERO); + rp = kmalloc(sizeof(*rp), M_ALTQ, M_WAITOK | M_ZERO); rp->red_avg = 0; rp->red_idle = 1; @@ -244,7 +244,7 @@ void red_destroy(red_t *rp) { wtab_destroy(rp->red_wtab); - free(rp, M_ALTQ); + kfree(rp, M_ALTQ); } void @@ -544,7 +544,7 @@ wtab_alloc(int weight) } } - w = malloc(sizeof(*w), M_ALTQ, M_WAITOK | M_ZERO); + w = kmalloc(sizeof(*w), M_ALTQ, M_WAITOK | M_ZERO); w->w_weight = weight; w->w_refcount = 1; SLIST_INSERT_HEAD(&wtab_list, w, w_link); @@ -567,7 +567,7 @@ wtab_destroy(struct wtab *w) return (0); SLIST_REMOVE(&wtab_list, w, wtab, w_link); - free(w, M_ALTQ); + kfree(w, M_ALTQ); return (0); } diff --git a/sys/net/altq/altq_rio.c b/sys/net/altq/altq_rio.c index 5f98b3f5a2..963f80ad97 100644 --- a/sys/net/altq/altq_rio.c +++ b/sys/net/altq/altq_rio.c @@ -1,5 +1,5 @@ /* $KAME: altq_rio.c,v 1.17 2003/07/10 12:07:49 kjc Exp $ */ -/* $DragonFly: src/sys/net/altq/altq_rio.c,v 1.1 2005/02/11 22:25:57 joerg Exp $ */ +/* $DragonFly: src/sys/net/altq/altq_rio.c,v 1.2 2006/09/05 00:55:47 dillon Exp $ */ /* * Copyright (C) 1998-2003 @@ -160,7 +160,7 @@ rio_alloc(int weight, struct redparams *params, int flags, int pkttime) int w, i; int npkts_per_sec; - rp = malloc(sizeof(*rp), M_ALTQ, M_WAITOK | M_ZERO); + rp = kmalloc(sizeof(*rp), M_ALTQ, M_WAITOK | M_ZERO); rp->rio_flags = flags; if (pkttime == 0) @@ -244,7 +244,7 @@ void rio_destroy(rio_t *rp) { wtab_destroy(rp->rio_wtab); - free(rp, M_ALTQ); + kfree(rp, M_ALTQ); } void diff --git a/sys/net/altq/altq_rmclass.c b/sys/net/altq/altq_rmclass.c index c5e5439b72..a8a910edb4 100644 --- a/sys/net/altq/altq_rmclass.c +++ b/sys/net/altq/altq_rmclass.c @@ -1,5 +1,5 @@ /* $KAME: altq_rmclass.c,v 1.18 2003/11/06 06:32:53 kjc Exp $ */ -/* $DragonFly: src/sys/net/altq/altq_rmclass.c,v 1.6 2006/01/14 11:05:17 swildner Exp $ */ +/* $DragonFly: src/sys/net/altq/altq_rmclass.c,v 1.7 2006/09/05 00:55:47 dillon Exp $ */ /* * Copyright (c) 1991-1997 Regents of the University of California. @@ -216,9 +216,9 @@ rmc_newclass(int pri, struct rm_ifdat *ifd, u_int nsecPerByte, } #endif - cl = malloc(sizeof(*cl), M_ALTQ, M_WAITOK | M_ZERO); + cl = kmalloc(sizeof(*cl), M_ALTQ, M_WAITOK | M_ZERO); callout_init(&cl->callout_); - cl->q_ = malloc(sizeof(*cl->q_), M_ALTQ, M_WAITOK | M_ZERO); + cl->q_ = kmalloc(sizeof(*cl->q_), M_ALTQ, M_WAITOK | M_ZERO); /* * Class initialization. @@ -622,8 +622,8 @@ rmc_delete_class(struct rm_ifdat *ifd, struct rm_class *cl) red_destroy(cl->red_); #endif } - free(cl->q_, M_ALTQ); - free(cl, M_ALTQ); + kfree(cl->q_, M_ALTQ); + kfree(cl, M_ALTQ); } /* diff --git a/sys/net/altq/altq_subr.c b/sys/net/altq/altq_subr.c index ce049737ee..606fd4b9fc 100644 --- a/sys/net/altq/altq_subr.c +++ b/sys/net/altq/altq_subr.c @@ -1,5 +1,5 @@ /* $KAME: altq_subr.c,v 1.23 2004/04/20 16:10:06 itojun Exp $ */ -/* $DragonFly: src/sys/net/altq/altq_subr.c,v 1.7 2005/11/28 17:13:45 dillon Exp $ */ +/* $DragonFly: src/sys/net/altq/altq_subr.c,v 1.8 2006/09/05 00:55:47 dillon Exp $ */ /* * Copyright (C) 1997-2003 @@ -256,11 +256,11 @@ tbr_set(struct ifaltq *ifq, struct tb_profile *profile) if ((tbr = ifq->altq_tbr) == NULL) return (ENOENT); ifq->altq_tbr = NULL; - free(tbr, M_ALTQ); + kfree(tbr, M_ALTQ); return (0); } - tbr = malloc(sizeof(*tbr), M_ALTQ, M_WAITOK | M_ZERO); + tbr = kmalloc(sizeof(*tbr), M_ALTQ, M_WAITOK | M_ZERO); tbr->tbr_rate = TBR_SCALE(profile->rate / 8) / machclk_freq; tbr->tbr_depth = TBR_SCALE(profile->depth); if (tbr->tbr_rate > 0) @@ -275,7 +275,7 @@ tbr_set(struct ifaltq *ifq, struct tb_profile *profile) ifq->altq_tbr = tbr; /* set the new tbr */ if (otbr != NULL) - free(otbr, M_ALTQ); + kfree(otbr, M_ALTQ); else if (tbr_timer == 0) { callout_reset(&tbr_callout, 1, tbr_timeout, NULL); tbr_timer = 1; diff --git a/sys/net/bpf.c b/sys/net/bpf.c index 5457498031..91413c793a 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -38,7 +38,7 @@ * @(#)bpf.c 8.2 (Berkeley) 3/28/94 * * $FreeBSD: src/sys/net/bpf.c,v 1.59.2.12 2002/04/14 21:41:48 luigi Exp $ - * $DragonFly: src/sys/net/bpf.c,v 1.32 2006/07/30 09:39:27 sephe Exp $ + * $DragonFly: src/sys/net/bpf.c,v 1.33 2006/09/05 00:55:46 dillon Exp $ */ #include "use_bpf.h" @@ -340,7 +340,7 @@ bpfclose(struct dev_close_args *ap) crit_exit(); bpf_freed(d); dev->si_drv1 = NULL; - free(d, M_BPF); + kfree(d, M_BPF); return(0); } @@ -883,7 +883,7 @@ bpf_setf(struct bpf_d *d, struct bpf_program *fp) reset_d(d); crit_exit(); if (old != 0) - free(old, M_BPF); + kfree(old, M_BPF); return(0); } flen = fp->bf_len; @@ -891,7 +891,7 @@ bpf_setf(struct bpf_d *d, struct bpf_program *fp) return(EINVAL); size = flen * sizeof *fp->bf_insns; - fcode = (struct bpf_insn *)malloc(size, M_BPF, M_WAITOK); + fcode = (struct bpf_insn *)kmalloc(size, M_BPF, M_WAITOK); if (copyin(fp->bf_insns, fcode, size) == 0 && bpf_validate(fcode, (int)flen)) { crit_enter(); @@ -899,11 +899,11 @@ bpf_setf(struct bpf_d *d, struct bpf_program *fp) reset_d(d); crit_exit(); if (old != 0) - free(old, M_BPF); + kfree(old, M_BPF); return(0); } - free(fcode, M_BPF); + kfree(fcode, M_BPF); return(EINVAL); } @@ -1216,13 +1216,13 @@ catchpacket(struct bpf_d *d, u_char *pkt, u_int pktlen, u_int snaplen, static int bpf_allocbufs(struct bpf_d *d) { - d->bd_fbuf = malloc(d->bd_bufsize, M_BPF, M_WAITOK); + d->bd_fbuf = kmalloc(d->bd_bufsize, M_BPF, M_WAITOK); if (d->bd_fbuf == NULL) return(ENOBUFS); - d->bd_sbuf = malloc(d->bd_bufsize, M_BPF, M_WAITOK); + d->bd_sbuf = kmalloc(d->bd_bufsize, M_BPF, M_WAITOK); if (d->bd_sbuf == NULL) { - free(d->bd_fbuf, M_BPF); + kfree(d->bd_fbuf, M_BPF); return(ENOBUFS); } d->bd_slen = 0; @@ -1243,14 +1243,14 @@ bpf_freed(struct bpf_d *d) * free. */ if (d->bd_sbuf != NULL) { - free(d->bd_sbuf, M_BPF); + kfree(d->bd_sbuf, M_BPF); if (d->bd_hbuf != NULL) - free(d->bd_hbuf, M_BPF); + kfree(d->bd_hbuf, M_BPF); if (d->bd_fbuf != NULL) - free(d->bd_fbuf, M_BPF); + kfree(d->bd_fbuf, M_BPF); } if (d->bd_filter) - free(d->bd_filter, M_BPF); + kfree(d->bd_filter, M_BPF); } /* @@ -1270,7 +1270,7 @@ bpfattach_dlt(struct ifnet *ifp, u_int dlt, u_int hdrlen, struct bpf_if **driver { struct bpf_if *bp; - bp = malloc(sizeof *bp, M_BPF, M_WAITOK | M_ZERO); + bp = kmalloc(sizeof *bp, M_BPF, M_WAITOK | M_ZERO); SLIST_INIT(&bp->bif_dlist); bp->bif_ifp = ifp; @@ -1332,7 +1332,7 @@ bpfdetach(struct ifnet *ifp) else bpf_iflist = bp->bif_next; - free(bp, M_BPF); + kfree(bp, M_BPF); crit_exit(); } diff --git a/sys/net/bridge/if_bridge.c b/sys/net/bridge/if_bridge.c index dd7e33135a..f73879ab1d 100644 --- a/sys/net/bridge/if_bridge.c +++ b/sys/net/bridge/if_bridge.c @@ -66,7 +66,7 @@ * $OpenBSD: if_bridge.c,v 1.60 2001/06/15 03:38:33 itojun Exp $ * $NetBSD: if_bridge.c,v 1.31 2005/06/01 19:45:34 jdc Exp $ * $FreeBSD: src/sys/net/if_bridge.c,v 1.26 2005/10/13 23:05:55 thompsa Exp $ - * $DragonFly: src/sys/net/bridge/if_bridge.c,v 1.8 2006/09/03 17:31:55 dillon Exp $ + * $DragonFly: src/sys/net/bridge/if_bridge.c,v 1.9 2006/09/05 00:55:47 dillon Exp $ */ /* @@ -423,7 +423,7 @@ bridge_clone_create(struct if_clone *ifc, int unit) struct ifnet *ifp; u_char eaddr[6]; - sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK|M_ZERO); + sc = kmalloc(sizeof(*sc), M_DEVBUF, M_WAITOK|M_ZERO); ifp = sc->sc_ifp = &sc->sc_if; sc->sc_brtmax = BRIDGE_RTABLE_MAX; @@ -518,7 +518,7 @@ bridge_clone_destroy(struct ifnet *ifp) /* Tear down the routing table. */ bridge_rtable_fini(sc); - free(sc, M_DEVBUF); + kfree(sc, M_DEVBUF); } /* @@ -740,7 +740,7 @@ bridge_delete_member(struct bridge_softc *sc, struct bridge_iflist *bif, bridge_rtdelete(sc, ifs, IFBF_FLUSHALL); - free(bif, M_DEVBUF); + kfree(bif, M_DEVBUF); if (sc->sc_ifp->if_flags & IFF_RUNNING) bstp_initialization(sc); @@ -758,7 +758,7 @@ bridge_delete_span(struct bridge_softc *sc, struct bridge_iflist *bif) ("%s: not a span interface", __func__)); LIST_REMOVE(bif, bif_next); - free(bif, M_DEVBUF); + kfree(bif, M_DEVBUF); } static int @@ -795,7 +795,7 @@ bridge_ioctl_add(struct bridge_softc *sc, void *arg) if (ifs->if_bridge != NULL) return (EBUSY); - bif = malloc(sizeof(*bif), M_DEVBUF, M_RNOWAIT|M_ZERO); + bif = kmalloc(sizeof(*bif), M_DEVBUF, M_RNOWAIT|M_ZERO); if (bif == NULL) return (ENOMEM); @@ -837,7 +837,7 @@ bridge_ioctl_add(struct bridge_softc *sc, void *arg) out: if (error) { if (bif != NULL) - free(bif, M_DEVBUF); + kfree(bif, M_DEVBUF); } return (error); } @@ -1245,7 +1245,7 @@ bridge_ioctl_addspan(struct bridge_softc *sc, void *arg) return (EINVAL); } - bif = malloc(sizeof(*bif), M_DEVBUF, M_RNOWAIT|M_ZERO); + bif = kmalloc(sizeof(*bif), M_DEVBUF, M_RNOWAIT|M_ZERO); if (bif == NULL) return (ENOMEM); @@ -2012,7 +2012,7 @@ bridge_rtupdate(struct bridge_softc *sc, const uint8_t *dst, * initialize the expiration time and Ethernet * address. */ - brt = malloc(sizeof(struct bridge_rtnode), M_DEVBUF, M_RNOWAIT|M_ZERO); + brt = kmalloc(sizeof(struct bridge_rtnode), M_DEVBUF, M_RNOWAIT|M_ZERO); if (brt == NULL) return (ENOMEM); @@ -2020,7 +2020,7 @@ bridge_rtupdate(struct bridge_softc *sc, const uint8_t *dst, memcpy(brt->brt_addr, dst, ETHER_ADDR_LEN); if ((error = bridge_rtnode_insert(sc, brt)) != 0) { - free(brt, M_DEVBUF); + kfree(brt, M_DEVBUF); return (error); } } @@ -2206,7 +2206,7 @@ static void bridge_rtable_fini(struct bridge_softc *sc) { - free(sc->sc_rthash, M_DEVBUF); + kfree(sc->sc_rthash, M_DEVBUF); } /* @@ -2341,7 +2341,7 @@ bridge_rtnode_destroy(struct bridge_softc *sc, struct bridge_rtnode *brt) LIST_REMOVE(brt, brt_list); sc->sc_brtcnt--; - free(brt, M_DEVBUF); + kfree(brt, M_DEVBUF); } /* diff --git a/sys/net/bsd_comp.c b/sys/net/bsd_comp.c index 5967f1bbba..f8e6232631 100644 --- a/sys/net/bsd_comp.c +++ b/sys/net/bsd_comp.c @@ -41,7 +41,7 @@ * This version is for use with mbufs on BSD-derived systems. * * $FreeBSD: src/sys/net/bsd_comp.c,v 1.11.2.1 2002/04/14 21:41:48 luigi Exp $ - * $DragonFly: src/sys/net/bsd_comp.c,v 1.9 2006/01/14 11:05:17 swildner Exp $ + * $DragonFly: src/sys/net/bsd_comp.c,v 1.10 2006/09/05 00:55:46 dillon Exp $ */ #include @@ -365,8 +365,8 @@ bsd_free(void *state) struct bsd_db *db = (struct bsd_db *) state; if (db->lens) - free(db->lens, M_DEVBUF); - free(db, M_DEVBUF); + kfree(db->lens, M_DEVBUF); + kfree(db, M_DEVBUF); } static void * diff --git a/sys/net/dummynet/ip_dummynet.c b/sys/net/dummynet/ip_dummynet.c index 435644153f..97eb7b6d4a 100644 --- a/sys/net/dummynet/ip_dummynet.c +++ b/sys/net/dummynet/ip_dummynet.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netinet/ip_dummynet.c,v 1.24.2.22 2003/05/13 09:31:06 maxim Exp $ - * $DragonFly: src/sys/net/dummynet/ip_dummynet.c,v 1.19 2006/09/03 18:52:29 dillon Exp $ + * $DragonFly: src/sys/net/dummynet/ip_dummynet.c,v 1.20 2006/09/05 00:55:47 dillon Exp $ */ #if !defined(KLD_MODULE) @@ -210,10 +210,10 @@ heap_init(struct dn_heap *h, int new_size) return 0 ; } new_size = (new_size + HEAP_INCREMENT ) & ~HEAP_INCREMENT ; - p = malloc(new_size * sizeof(*p), M_DUMMYNET, M_WAITOK | M_ZERO); + p = kmalloc(new_size * sizeof(*p), M_DUMMYNET, M_WAITOK | M_ZERO); if (h->size > 0) { bcopy(h->p, p, h->size * sizeof(*p) ); - free(h->p, M_DUMMYNET); + kfree(h->p, M_DUMMYNET); } h->p = p ; h->size = new_size ; @@ -374,7 +374,7 @@ static void heap_free(struct dn_heap *h) { if (h->size >0 ) - free(h->p, M_DUMMYNET); + kfree(h->p, M_DUMMYNET); bzero(h, sizeof(*h) ); } @@ -459,7 +459,7 @@ transmit_event(struct dn_pipe *pipe) m_freem(pkt->dn_m); break ; } - free(pkt, M_DUMMYNET); + kfree(pkt, M_DUMMYNET); } /* if there are leftover packets, put into the heap for next event */ if ( (pkt = pipe->head) ) @@ -792,7 +792,7 @@ expire_queues(struct dn_flow_set *fs) else fs->rq[i] = q = q->next ; fs->rq_elements-- ; - free(old_q, M_DUMMYNET); + kfree(old_q, M_DUMMYNET); } return initial_elements - fs->rq_elements ; } @@ -815,7 +815,7 @@ create_queue(struct dn_flow_set *fs, int i) if ( fs->rq[i] != NULL ) return fs->rq[i] ; } - q = malloc(sizeof(*q), M_DUMMYNET, M_WAITOK | M_ZERO); + q = kmalloc(sizeof(*q), M_DUMMYNET, M_WAITOK | M_ZERO); q->fs = fs ; q->hash_slot = i ; q->next = fs->rq[i] ; @@ -874,7 +874,7 @@ find_queue(struct dn_flow_set *fs, struct ipfw_flow_id *id) else fs->rq[i] = q = q->next ; fs->rq_elements-- ; - free(old_q, M_DUMMYNET); + kfree(old_q, M_DUMMYNET); continue ; } prev = q ; @@ -1114,7 +1114,7 @@ dummynet_io(struct mbuf *m, int pipe_nr, int dir, struct ip_fw_args *fwa) goto dropit ; /* XXX expensive to zero, see if we can remove it*/ - pkt = malloc(sizeof (*pkt), M_DUMMYNET, M_INTWAIT | M_ZERO | M_NULLOK); + pkt = kmalloc(sizeof (*pkt), M_DUMMYNET, M_INTWAIT | M_ZERO | M_NULLOK); if (pkt == NULL) goto dropit; /* cannot allocate packet header */ @@ -1243,7 +1243,7 @@ dropit: rt_unref ( n->ro.ro_rt ) ; \ m_freem(n->dn_m); \ pkt = DN_NEXT(n) ; \ - free(n, M_DUMMYNET) ; } + kfree(n, M_DUMMYNET) ; } /* * Dispose all packets and flow_queues on a flow_set. @@ -1263,7 +1263,7 @@ purge_flow_set(struct dn_flow_set *fs, int all) for (pkt = q->head ; pkt ; ) DN_FREE_PKT(pkt) ; qn = q->next ; - free(q, M_DUMMYNET); + kfree(q, M_DUMMYNET); } fs->rq[i] = NULL ; } @@ -1271,12 +1271,12 @@ purge_flow_set(struct dn_flow_set *fs, int all) if (all) { /* RED - free lookup table */ if (fs->w_q_lookup) - free(fs->w_q_lookup, M_DUMMYNET); + kfree(fs->w_q_lookup, M_DUMMYNET); if (fs->rq) - free(fs->rq, M_DUMMYNET); + kfree(fs->rq, M_DUMMYNET); /* if this fs is not part of a pipe, free it */ if (fs->pipe && fs != &(fs->pipe->fs) ) - free(fs, M_DUMMYNET); + kfree(fs, M_DUMMYNET); } } @@ -1337,7 +1337,7 @@ dummynet_flush(void) purge_pipe(p); curr_p = p ; p = p->next ; - free(curr_p, M_DUMMYNET); + kfree(curr_p, M_DUMMYNET); } } @@ -1405,12 +1405,12 @@ config_red(struct dn_flow_set *p, struct dn_flow_set * x) /* if the lookup table already exist, free and create it again */ if (x->w_q_lookup) { - free(x->w_q_lookup, M_DUMMYNET); + kfree(x->w_q_lookup, M_DUMMYNET); x->w_q_lookup = NULL ; } if (red_lookup_depth == 0) { printf("\nnet.inet.ip.dummynet.red_lookup_depth must be > 0"); - free(x, M_DUMMYNET); + kfree(x, M_DUMMYNET); return EINVAL; } x->lookup_depth = red_lookup_depth; @@ -1504,7 +1504,7 @@ config_pipe(struct dn_pipe *p) a = b , b = b->next) ; if (b == NULL || b->pipe_nr != p->pipe_nr) { /* new pipe */ - x = malloc(sizeof(struct dn_pipe), M_DUMMYNET, M_WAITOK | M_ZERO); + x = kmalloc(sizeof(struct dn_pipe), M_DUMMYNET, M_WAITOK | M_ZERO); x->pipe_nr = p->pipe_nr; x->fs.pipe = x ; /* idle_heap is the only one from which we extract from the middle. @@ -1533,7 +1533,7 @@ config_pipe(struct dn_pipe *p) if ( x->fs.rq == NULL ) { /* a new pipe */ s = alloc_hash(&(x->fs), pfs) ; if (s) { - free(x, M_DUMMYNET); + kfree(x, M_DUMMYNET); return s ; } x->next = b ; @@ -1553,7 +1553,7 @@ config_pipe(struct dn_pipe *p) if (b == NULL || b->fs_nr != pfs->fs_nr) { /* new */ if (pfs->parent_nr == 0) /* need link to a pipe */ return EINVAL ; - x = malloc(sizeof(struct dn_flow_set), M_DUMMYNET, M_WAITOK|M_ZERO); + x = kmalloc(sizeof(struct dn_flow_set), M_DUMMYNET, M_WAITOK|M_ZERO); x->fs_nr = pfs->fs_nr; x->parent_nr = pfs->parent_nr; x->weight = pfs->weight ; @@ -1573,7 +1573,7 @@ config_pipe(struct dn_pipe *p) if ( x->rq == NULL ) { /* a new flow_set */ s = alloc_hash(x, pfs) ; if (s) { - free(x, M_DUMMYNET); + kfree(x, M_DUMMYNET); return s ; } x->next = b; @@ -1694,7 +1694,7 @@ delete_pipe(struct dn_pipe *p) pipe_remove_from_heap(&extract_heap, b); pipe_remove_from_heap(&wfq_ready_heap, b); crit_exit(); - free(b, M_DUMMYNET); + kfree(b, M_DUMMYNET); } else { /* this is a WF2Q queue (dn_flow_set) */ struct dn_flow_set *a, *b; @@ -1776,7 +1776,7 @@ dummynet_get(struct sockopt *sopt) for (set = all_flow_sets ; set ; set = set->next ) size += sizeof ( *set ) + set->rq_elements * sizeof(struct dn_flow_queue); - buf = malloc(size, M_TEMP, M_WAITOK); + buf = kmalloc(size, M_TEMP, M_WAITOK); for (p = all_pipes, bp = buf ; p ; p = p->next ) { struct dn_pipe *pipe_bp = (struct dn_pipe *)bp ; @@ -1815,7 +1815,7 @@ dummynet_get(struct sockopt *sopt) } crit_exit(); error = sooptcopyout(sopt, buf, size); - free(buf, M_TEMP); + kfree(buf, M_TEMP); return error ; } diff --git a/sys/net/ef/if_ef.c b/sys/net/ef/if_ef.c index 0b282454f4..498fe24648 100644 --- a/sys/net/ef/if_ef.c +++ b/sys/net/ef/if_ef.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/net/if_ef.c,v 1.2.2.4 2001/02/22 09:27:04 bp Exp $ - * $DragonFly: src/sys/net/ef/if_ef.c,v 1.18 2005/11/28 17:13:45 dillon Exp $ + * $DragonFly: src/sys/net/ef/if_ef.c,v 1.19 2006/09/05 00:55:47 dillon Exp $ */ #include "opt_inet.h" @@ -478,7 +478,7 @@ ef_clone(struct ef_link *efl, int ft) struct ifnet *eifp; struct ifnet *ifp = efl->el_ifp; - efp = (struct efnet*)malloc(sizeof(struct efnet), M_IFADDR, + efp = (struct efnet*)kmalloc(sizeof(struct efnet), M_IFADDR, M_WAITOK | M_ZERO); if (efp == NULL) return ENOMEM; @@ -541,8 +541,8 @@ ef_load(void) SLIST_FOREACH(efl, &efdev, el_next) { for (d = 0; d < EF_NFT; d++) if (efl->el_units[d]) - free(efl->el_units[d], M_IFADDR); - free(efl, M_IFADDR); + kfree(efl->el_units[d], M_IFADDR); + kfree(efl, M_IFADDR); } return error; } diff --git a/sys/net/faith/if_faith.c b/sys/net/faith/if_faith.c index a7997060a2..ab1038b1d7 100644 --- a/sys/net/faith/if_faith.c +++ b/sys/net/faith/if_faith.c @@ -33,7 +33,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/net/if_faith.c,v 1.3.2.6 2002/04/28 05:40:25 suz Exp $ - * $DragonFly: src/sys/net/faith/if_faith.c,v 1.14 2005/12/11 13:00:16 swildner Exp $ + * $DragonFly: src/sys/net/faith/if_faith.c,v 1.15 2006/09/05 00:55:47 dillon Exp $ */ /* * derived from @@ -157,7 +157,7 @@ faith_clone_create(struct if_clone *ifc, int unit) { struct faith_softc *sc; - sc = malloc(sizeof(struct faith_softc), M_FAITH, M_WAITOK); + sc = kmalloc(sizeof(struct faith_softc), M_FAITH, M_WAITOK); bzero(sc, sizeof(struct faith_softc)); sc->sc_if.if_softc = sc; @@ -187,7 +187,7 @@ faith_clone_destroy(struct ifnet *ifp) bpfdetach(ifp); if_detach(ifp); - free(sc, M_FAITH); + kfree(sc, M_FAITH); } int diff --git a/sys/net/gif/if_gif.c b/sys/net/gif/if_gif.c index 24b868af0a..813c3a992a 100644 --- a/sys/net/gif/if_gif.c +++ b/sys/net/gif/if_gif.c @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/net/if_gif.c,v 1.4.2.15 2002/11/08 16:57:13 ume Exp $ - * $DragonFly: src/sys/net/gif/if_gif.c,v 1.16 2006/01/14 11:05:17 swildner Exp $ + * $DragonFly: src/sys/net/gif/if_gif.c,v 1.17 2006/09/05 00:55:47 dillon Exp $ * $KAME: if_gif.c,v 1.87 2001/10/19 08:50:27 itojun Exp $ */ @@ -131,7 +131,7 @@ gif_clone_create(struct if_clone *ifc, int unit) { struct gif_softc *sc; - sc = malloc (sizeof(struct gif_softc), M_GIF, M_WAITOK); + sc = kmalloc (sizeof(struct gif_softc), M_GIF, M_WAITOK); bzero(sc, sizeof(struct gif_softc)); sc->gif_if.if_softc = sc; @@ -188,7 +188,7 @@ gif_clone_destroy(struct ifnet *ifp) bpfdetach(ifp); if_detach(ifp); - free(sc, M_GIF); + kfree(sc, M_GIF); } static int @@ -705,12 +705,12 @@ gif_set_tunnel(struct ifnet *ifp, struct sockaddr *src, struct sockaddr *dst) } osrc = sc->gif_psrc; - sa = (struct sockaddr *)malloc(src->sa_len, M_IFADDR, M_WAITOK); + sa = (struct sockaddr *)kmalloc(src->sa_len, M_IFADDR, M_WAITOK); bcopy((caddr_t)src, (caddr_t)sa, src->sa_len); sc->gif_psrc = sa; odst = sc->gif_pdst; - sa = (struct sockaddr *)malloc(dst->sa_len, M_IFADDR, M_WAITOK); + sa = (struct sockaddr *)kmalloc(dst->sa_len, M_IFADDR, M_WAITOK); bcopy((caddr_t)dst, (caddr_t)sa, dst->sa_len); sc->gif_pdst = sa; @@ -728,17 +728,17 @@ gif_set_tunnel(struct ifnet *ifp, struct sockaddr *src, struct sockaddr *dst) } if (error) { /* rollback */ - free((caddr_t)sc->gif_psrc, M_IFADDR); - free((caddr_t)sc->gif_pdst, M_IFADDR); + kfree((caddr_t)sc->gif_psrc, M_IFADDR); + kfree((caddr_t)sc->gif_pdst, M_IFADDR); sc->gif_psrc = osrc; sc->gif_pdst = odst; goto bad; } if (osrc) - free((caddr_t)osrc, M_IFADDR); + kfree((caddr_t)osrc, M_IFADDR); if (odst) - free((caddr_t)odst, M_IFADDR); + kfree((caddr_t)odst, M_IFADDR); if (sc->gif_psrc && sc->gif_pdst) ifp->if_flags |= IFF_RUNNING; @@ -766,11 +766,11 @@ gif_delete_tunnel(struct ifnet *ifp) crit_enter(); if (sc->gif_psrc) { - free((caddr_t)sc->gif_psrc, M_IFADDR); + kfree((caddr_t)sc->gif_psrc, M_IFADDR); sc->gif_psrc = NULL; } if (sc->gif_pdst) { - free((caddr_t)sc->gif_pdst, M_IFADDR); + kfree((caddr_t)sc->gif_pdst, M_IFADDR); sc->gif_pdst = NULL; } /* it is safe to detach from both */ diff --git a/sys/net/gre/if_gre.c b/sys/net/gre/if_gre.c index 79cb83349c..2a9936c28d 100644 --- a/sys/net/gre/if_gre.c +++ b/sys/net/gre/if_gre.c @@ -1,6 +1,6 @@ /* $NetBSD: if_gre.c,v 1.42 2002/08/14 00:23:27 itojun Exp $ */ /* $FreeBSD: src/sys/net/if_gre.c,v 1.9.2.3 2003/01/23 21:06:44 sam Exp $ */ -/* $DragonFly: src/sys/net/gre/if_gre.c,v 1.16 2006/05/11 00:52:03 hsu Exp $ */ +/* $DragonFly: src/sys/net/gre/if_gre.c,v 1.17 2006/09/05 00:55:47 dillon Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -162,7 +162,7 @@ gre_clone_create(struct if_clone *ifc, int unit) { struct gre_softc *sc; - sc = malloc(sizeof(struct gre_softc), M_GRE, M_WAITOK); + sc = kmalloc(sizeof(struct gre_softc), M_GRE, M_WAITOK); memset(sc, 0, sizeof(struct gre_softc)); sc->sc_if.if_softc = sc; @@ -199,7 +199,7 @@ gre_clone_destroy(struct ifnet *ifp) bpfdetach(ifp); if_detach(ifp); - free(sc, M_GRE); + kfree(sc, M_GRE); } /* diff --git a/sys/net/hostcache.c b/sys/net/hostcache.c index 1cae193502..a49a46e8c8 100644 --- a/sys/net/hostcache.c +++ b/sys/net/hostcache.c @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/net/hostcache.c,v 1.6.2.1 2002/04/14 21:41:48 luigi Exp $ - * $DragonFly: src/sys/net/Attic/hostcache.c,v 1.7 2005/06/03 18:19:51 swildner Exp $ + * $DragonFly: src/sys/net/Attic/hostcache.c,v 1.8 2006/09/05 00:55:46 dillon Exp $ */ #include @@ -198,7 +198,7 @@ hc_delete(struct hcentry *hc) LIST_REMOVE(hc, hc_link); hc->hc_hct->hct_idle--; crit_exit(); - free(hc, M_HOSTCACHE); + kfree(hc, M_HOSTCACHE); return 0; } diff --git a/sys/net/i4b/driver/i4b_ipr.c b/sys/net/i4b/driver/i4b_ipr.c index 663686839d..3deeb31298 100644 --- a/sys/net/i4b/driver/i4b_ipr.c +++ b/sys/net/i4b/driver/i4b_ipr.c @@ -28,7 +28,7 @@ * --------------------------------------------------------- * * $FreeBSD: src/sys/i4b/driver/i4b_ipr.c,v 1.8.2.3 2001/10/27 15:48:17 hm Exp $ - * $DragonFly: src/sys/net/i4b/driver/i4b_ipr.c,v 1.18 2005/11/28 17:13:45 dillon Exp $ + * $DragonFly: src/sys/net/i4b/driver/i4b_ipr.c,v 1.19 2006/09/05 00:55:47 dillon Exp $ * * last edit-date: [Fri Oct 26 19:32:38 2001] * @@ -276,7 +276,7 @@ i4biprattach(void *dummy) #ifdef IPR_VJ_USEBUFFER if(!((sc->sc_cbuf = - (u_char *)malloc(I4BIPRMAXMTU+128, M_DEVBUF, M_WAITOK)))) + (u_char *)kmalloc(I4BIPRMAXMTU+128, M_DEVBUF, M_WAITOK)))) { panic("if_ipr.c, ipr_attach: VJ malloc failed"); } diff --git a/sys/net/i4b/layer4/i4b_i4bdrv.c b/sys/net/i4b/layer4/i4b_i4bdrv.c index 8c757f4d72..477f111c25 100644 --- a/sys/net/i4b/layer4/i4b_i4bdrv.c +++ b/sys/net/i4b/layer4/i4b_i4bdrv.c @@ -28,7 +28,7 @@ * -------------------------------------------- * * $FreeBSD: src/sys/i4b/layer4/i4b_i4bdrv.c,v 1.11.2.5 2001/12/16 15:12:59 hm Exp $ - * $DragonFly: src/sys/net/i4b/layer4/i4b_i4bdrv.c,v 1.15 2006/07/28 02:17:40 dillon Exp $ + * $DragonFly: src/sys/net/i4b/layer4/i4b_i4bdrv.c,v 1.16 2006/09/05 00:55:47 dillon Exp $ * * last edit-date: [Sat Aug 11 18:08:10 2001] * @@ -652,7 +652,7 @@ i4bioctl(struct dev_ioctl_args *ap) for(i = 0; i < r->numprotos; i++) { - prots2[i].microcode = malloc(prots[i].bytecount, M_DEVBUF, M_WAITOK); + prots2[i].microcode = kmalloc(prots[i].bytecount, M_DEVBUF, M_WAITOK); copyin(prots[i].microcode, prots2[i].microcode, prots[i].bytecount); prots2[i].bytecount = prots[i].bytecount; } @@ -668,15 +668,15 @@ download_done: { if(prots2[i].microcode) { - free(prots2[i].microcode, M_DEVBUF); + kfree(prots2[i].microcode, M_DEVBUF); } } - free(prots2, M_DEVBUF); + kfree(prots2, M_DEVBUF); } if(prots) { - free(prots, M_DEVBUF); + kfree(prots, M_DEVBUF); } break; } @@ -712,7 +712,7 @@ download_done: goto diag_done; } - req.in_param = malloc(r->in_param_len, M_DEVBUF, M_WAITOK); + req.in_param = kmalloc(r->in_param_len, M_DEVBUF, M_WAITOK); if(!req.in_param) { @@ -726,7 +726,7 @@ download_done: if(req.out_param_len) { - req.out_param = malloc(r->out_param_len, M_DEVBUF, M_WAITOK); + req.out_param = kmalloc(r->out_param_len, M_DEVBUF, M_WAITOK); if(!req.out_param) { @@ -742,10 +742,10 @@ download_done: diag_done: if(req.in_param) - free(req.in_param, M_DEVBUF); + kfree(req.in_param, M_DEVBUF); if(req.out_param) - free(req.out_param, M_DEVBUF); + kfree(req.out_param, M_DEVBUF); break; } diff --git a/sys/net/if.c b/sys/net/if.c index 3f253f467e..1aeb8cc65e 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -32,7 +32,7 @@ * * @(#)if.c 8.3 (Berkeley) 1/4/94 * $FreeBSD: src/sys/net/if.c,v 1.185 2004/03/13 02:35:03 brooks Exp $ - * $DragonFly: src/sys/net/if.c,v 1.45 2006/05/06 02:43:12 dillon Exp $ + * $DragonFly: src/sys/net/if.c,v 1.46 2006/09/05 00:55:46 dillon Exp $ */ #include "opt_compat.h" @@ -217,10 +217,10 @@ if_attach(struct ifnet *ifp, lwkt_serialize_t serializer) /* grow ifindex2ifnet */ n = if_indexlim * sizeof(*q); - q = malloc(n, M_IFADDR, M_WAITOK | M_ZERO); + q = kmalloc(n, M_IFADDR, M_WAITOK | M_ZERO); if (ifindex2ifnet) { bcopy(ifindex2ifnet, q, n/2); - free(ifindex2ifnet, M_IFADDR); + kfree(ifindex2ifnet, M_IFADDR); } ifindex2ifnet = q; } @@ -239,7 +239,7 @@ if_attach(struct ifnet *ifp, lwkt_serialize_t serializer) socksize = sizeof(*sdl); socksize = ROUNDUP(socksize); ifasize = sizeof(struct ifaddr) + 2 * socksize; - ifa = malloc(ifasize, M_IFADDR, M_WAITOK | M_ZERO); + ifa = kmalloc(ifasize, M_IFADDR, M_WAITOK | M_ZERO); sdl = (struct sockaddr_dl *)(ifa + 1); sdl->sdl_len = socksize; sdl->sdl_family = AF_LINK; @@ -636,7 +636,7 @@ if_clone_attach(struct if_clone *ifc) len = maxclone >> 3; if ((len << 3) < maxclone) len++; - ifc->ifc_units = malloc(len, M_CLONE, M_WAITOK | M_ZERO); + ifc->ifc_units = kmalloc(len, M_CLONE, M_WAITOK | M_ZERO); ifc->ifc_bmlen = len; LIST_INSERT_HEAD(&if_cloners, ifc, ifc_list); @@ -663,7 +663,7 @@ if_clone_detach(struct if_clone *ifc) { LIST_REMOVE(ifc, ifc_list); - free(ifc->ifc_units, M_CLONE); + kfree(ifc->ifc_units, M_CLONE); if_cloners_count--; } @@ -1726,8 +1726,8 @@ if_delmulti(struct ifnet *ifp, struct sockaddr *sa) lwkt_serialize_exit(ifp->if_serializer); } crit_exit(); - free(ifma->ifma_addr, M_IFMADDR); - free(ifma, M_IFMADDR); + kfree(ifma->ifma_addr, M_IFMADDR); + kfree(ifma, M_IFMADDR); if (sa == 0) return 0; @@ -1759,9 +1759,9 @@ if_delmulti(struct ifnet *ifp, struct sockaddr *sa) ifp->if_ioctl(ifp, SIOCDELMULTI, 0, (struct ucred *)NULL); lwkt_serialize_exit(ifp->if_serializer); crit_exit(); - free(ifma->ifma_addr, M_IFMADDR); - free(sa, M_IFMADDR); - free(ifma, M_IFMADDR); + kfree(ifma->ifma_addr, M_IFMADDR); + kfree(sa, M_IFMADDR); + kfree(ifma, M_IFMADDR); return 0; } diff --git a/sys/net/if_media.c b/sys/net/if_media.c index af273eda2b..3287fd925b 100644 --- a/sys/net/if_media.c +++ b/sys/net/if_media.c @@ -1,6 +1,6 @@ /* $NetBSD: if_media.c,v 1.1 1997/03/17 02:55:15 thorpej Exp $ */ /* $FreeBSD: src/sys/net/if_media.c,v 1.9.2.4 2001/07/04 00:12:38 brooks Exp $ */ -/* $DragonFly: src/sys/net/if_media.c,v 1.9 2006/01/14 11:05:17 swildner Exp $ */ +/* $DragonFly: src/sys/net/if_media.c,v 1.10 2006/09/05 00:55:46 dillon Exp $ */ /* * Copyright (c) 1997 @@ -95,7 +95,7 @@ ifmedia_removeall(struct ifmedia *ifm) for (entry = LIST_FIRST(&ifm->ifm_list); entry; entry = LIST_FIRST(&ifm->ifm_list)) { LIST_REMOVE(entry, ifm_list); - free(entry, M_IFADDR); + kfree(entry, M_IFADDR); } } @@ -119,7 +119,7 @@ ifmedia_add(struct ifmedia *ifm, int mword, int data, void *aux) } #endif - entry = malloc(sizeof(*entry), M_IFADDR, M_INTWAIT); + entry = kmalloc(sizeof(*entry), M_IFADDR, M_INTWAIT); entry->ifm_media = mword; entry->ifm_data = data; entry->ifm_aux = aux; @@ -320,7 +320,7 @@ ifmedia_ioctl(struct ifnet *ifp, struct ifreq *ifr, error = sticky; if (ifmr->ifm_count != 0) - free(kptr, M_TEMP); + kfree(kptr, M_TEMP); ifmr->ifm_count = count; break; diff --git a/sys/net/if_var.h b/sys/net/if_var.h index 1a9526e0bf..ab940931e2 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -32,7 +32,7 @@ * * From: @(#)if.h 8.1 (Berkeley) 6/10/93 * $FreeBSD: src/sys/net/if_var.h,v 1.18.2.16 2003/04/15 18:11:19 fjoe Exp $ - * $DragonFly: src/sys/net/if_var.h,v 1.35 2006/05/20 02:42:08 dillon Exp $ + * $DragonFly: src/sys/net/if_var.h,v 1.36 2006/09/05 00:55:46 dillon Exp $ */ #ifndef _NET_IF_VAR_H_ @@ -434,7 +434,7 @@ static __inline void IFAFREE(struct ifaddr *_ifa) { if (_ifa->ifa_refcnt <= 0) - free(_ifa, M_IFADDR); + kfree(_ifa, M_IFADDR); else _ifa->ifa_refcnt--; } diff --git a/sys/net/ip6fw/ip6_fw.c b/sys/net/ip6fw/ip6_fw.c index 40c0ce18f6..675043e01c 100644 --- a/sys/net/ip6fw/ip6_fw.c +++ b/sys/net/ip6fw/ip6_fw.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netinet6/ip6_fw.c,v 1.2.2.10 2003/08/03 17:52:54 ume Exp $ */ -/* $DragonFly: src/sys/net/ip6fw/ip6_fw.c,v 1.14 2006/01/14 11:05:18 swildner Exp $ */ +/* $DragonFly: src/sys/net/ip6fw/ip6_fw.c,v 1.15 2006/09/05 00:55:47 dillon Exp $ */ /* $KAME: ip6_fw.c,v 1.21 2001/01/24 01:25:32 itojun Exp $ */ /* @@ -843,8 +843,8 @@ add_entry6(struct ip6_fw_head *chainptr, struct ip6_fw *frwl) struct ip6_fw_chain *fwc = 0, *fcp, *fcpl = 0; u_short nbr = 0; - fwc = malloc(sizeof *fwc, M_IP6FW, M_INTWAIT); - ftmp = malloc(sizeof *ftmp, M_IP6FW, M_INTWAIT); + fwc = kmalloc(sizeof *fwc, M_IP6FW, M_INTWAIT); + ftmp = kmalloc(sizeof *ftmp, M_IP6FW, M_INTWAIT); bcopy(frwl, ftmp, sizeof(struct ip6_fw)); ftmp->fw_in_if.fu_via_if.name[IP6FW_IFNLEN - 1] = '\0'; @@ -859,8 +859,8 @@ add_entry6(struct ip6_fw_head *chainptr, struct ip6_fw *frwl) crit_exit(); return(0); } else if (ftmp->fw_number == (u_short)-1) { - if (fwc) free(fwc, M_IP6FW); - if (ftmp) free(ftmp, M_IP6FW); + if (fwc) kfree(fwc, M_IP6FW); + if (ftmp) kfree(ftmp, M_IP6FW); crit_exit(); dprintf(("%s bad rule number\n", err_prefix)); return (EINVAL); @@ -910,8 +910,8 @@ del_entry6(struct ip6_fw_head *chainptr, u_short number) if (fcp->rule->fw_number == number) { LIST_REMOVE(fcp, chain); crit_exit(); - free(fcp->rule, M_IP6FW); - free(fcp, M_IP6FW); + kfree(fcp->rule, M_IP6FW); + kfree(fcp, M_IP6FW); return 0; } } @@ -1145,8 +1145,8 @@ ip6_fw_ctl(int stage, struct mbuf **mm) crit_enter(); LIST_REMOVE(ip6_fw_chain.lh_first, chain); crit_exit(); - free(fcp->rule, M_IP6FW); - free(fcp, M_IP6FW); + kfree(fcp->rule, M_IP6FW); + kfree(fcp, M_IP6FW); } if (m) { m_freem(m); @@ -1266,8 +1266,8 @@ ip6fw_modevent(module_t mod, int type, void *unused) while (LIST_FIRST(&ip6_fw_chain) != NULL) { struct ip6_fw_chain *fcp = LIST_FIRST(&ip6_fw_chain); LIST_REMOVE(LIST_FIRST(&ip6_fw_chain), chain); - free(fcp->rule, M_IP6FW); - free(fcp, M_IP6FW); + kfree(fcp->rule, M_IP6FW); + kfree(fcp, M_IP6FW); } crit_exit(); diff --git a/sys/net/ip_mroute/ip_mroute.c b/sys/net/ip_mroute/ip_mroute.c index 445ed8f045..ca6c636359 100644 --- a/sys/net/ip_mroute/ip_mroute.c +++ b/sys/net/ip_mroute/ip_mroute.c @@ -18,7 +18,7 @@ * bandwidth metering and signaling * * $FreeBSD: src/sys/netinet/ip_mroute.c,v 1.56.2.10 2003/08/24 21:37:34 hsu Exp $ - * $DragonFly: src/sys/net/ip_mroute/ip_mroute.c,v 1.19 2005/12/11 13:00:16 swildner Exp $ + * $DragonFly: src/sys/net/ip_mroute/ip_mroute.c,v 1.20 2006/09/05 00:55:47 dillon Exp $ */ #include "opt_mrouting.h" @@ -652,11 +652,11 @@ X_ip_mrouter_done(void) struct rtdetq *n = rte->next; m_freem(rte->m); - free(rte, M_MRTABLE); + kfree(rte, M_MRTABLE); rte = n; } free_bw_list(rt->mfc_bw_meter); - free(rt, M_MRTABLE); + kfree(rt, M_MRTABLE); rt = nr; } } @@ -1021,7 +1021,7 @@ add_mfc(struct mfcctl2 *mfccp) ip_mdq(rte->m, rte->ifp, rt, -1); m_freem(rte->m); - free(rte, M_MRTABLE); + kfree(rte, M_MRTABLE); rte = n; } rt->mfc_stall = NULL; @@ -1049,7 +1049,7 @@ add_mfc(struct mfcctl2 *mfccp) } } if (rt == NULL) { /* no upcall, so make a new entry */ - rt = malloc(sizeof(*rt), M_MRTABLE, M_INTWAIT | M_NULLOK); + rt = kmalloc(sizeof(*rt), M_MRTABLE, M_INTWAIT | M_NULLOK); if (rt == NULL) { crit_exit(); return ENOBUFS; @@ -1110,7 +1110,7 @@ del_mfc(struct mfcctl2 *mfccp) list = rt->mfc_bw_meter; rt->mfc_bw_meter = NULL; - free(rt, M_MRTABLE); + kfree(rt, M_MRTABLE); crit_exit(); @@ -1244,7 +1244,7 @@ X_ip_mforward(struct ip *ip, struct ifnet *ifp, struct mbuf *m, * just going to fail anyway. Make sure to pullup the header so * that other people can't step on it. */ - rte = malloc((sizeof *rte), M_MRTABLE, M_INTWAIT | M_NULLOK); + rte = kmalloc((sizeof *rte), M_MRTABLE, M_INTWAIT | M_NULLOK); if (rte == NULL) { crit_exit(); return ENOBUFS; @@ -1254,7 +1254,7 @@ X_ip_mforward(struct ip *ip, struct ifnet *ifp, struct mbuf *m, if (mb0 && (M_HASCL(mb0) || mb0->m_len < hlen)) mb0 = m_pullup(mb0, hlen); if (mb0 == NULL) { - free(rte, M_MRTABLE); + kfree(rte, M_MRTABLE); crit_exit(); return ENOBUFS; } @@ -1284,7 +1284,7 @@ X_ip_mforward(struct ip *ip, struct ifnet *ifp, struct mbuf *m, goto non_fatal; /* no upcall, so make a new entry */ - rt = malloc(sizeof(*rt), M_MRTABLE, M_INTWAIT | M_NULLOK); + rt = kmalloc(sizeof(*rt), M_MRTABLE, M_INTWAIT | M_NULLOK); if (rt == NULL) goto fail; @@ -1310,9 +1310,9 @@ X_ip_mforward(struct ip *ip, struct ifnet *ifp, struct mbuf *m, log(LOG_WARNING, "ip_mforward: ip_mrouter socket queue full\n"); ++mrtstat.mrts_upq_sockfull; fail1: - free(rt, M_MRTABLE); + kfree(rt, M_MRTABLE); fail: - free(rte, M_MRTABLE); + kfree(rte, M_MRTABLE); m_freem(mb0); crit_exit(); return ENOBUFS; @@ -1354,7 +1354,7 @@ fail: if (npkts > MAX_UPQ) { mrtstat.mrts_upq_ovflw++; non_fatal: - free(rte, M_MRTABLE); + kfree(rte, M_MRTABLE); m_freem(mb0); crit_exit(); return 0; @@ -1408,7 +1408,7 @@ expire_upcalls(void *unused) struct rtdetq *n = rte->next; m_freem(rte->m); - free(rte, M_MRTABLE); + kfree(rte, M_MRTABLE); rte = n; } ++mrtstat.mrts_cache_cleanups; @@ -1421,11 +1421,11 @@ expire_upcalls(void *unused) struct bw_meter *x = mfc->mfc_bw_meter; mfc->mfc_bw_meter = x->bm_mfc_next; - free(x, M_BWMETER); + kfree(x, M_BWMETER); } *nptr = mfc->mfc_next; - free(mfc, M_MRTABLE); + kfree(mfc, M_MRTABLE); } else { nptr = &mfc->mfc_next; } @@ -2296,7 +2296,7 @@ add_bw_upcall(struct bw_upcall *req) crit_exit(); /* Allocate the new bw_meter entry */ - x = malloc(sizeof(*x), M_BWMETER, M_INTWAIT); + x = kmalloc(sizeof(*x), M_BWMETER, M_INTWAIT); /* Set the new bw_meter entry */ x->bm_threshold.b_time = req->bu_threshold.b_time; @@ -2329,7 +2329,7 @@ free_bw_list(struct bw_meter *list) list = list->bm_mfc_next; unschedule_bw_meter(x); - free(x, M_BWMETER); + kfree(x, M_BWMETER); } } @@ -2387,7 +2387,7 @@ del_bw_upcall(struct bw_upcall *req) unschedule_bw_meter(x); /* Free the bw_meter entry */ - free(x, M_BWMETER); + kfree(x, M_BWMETER); return 0; } else { crit_exit(); diff --git a/sys/net/ipfw/ip_fw.c b/sys/net/ipfw/ip_fw.c index 6cec721745..8a885edb83 100644 --- a/sys/net/ipfw/ip_fw.c +++ b/sys/net/ipfw/ip_fw.c @@ -14,7 +14,7 @@ * This software is provided ``AS IS'' without any warranties of any kind. * * $FreeBSD: src/sys/netinet/ip_fw.c,v 1.131.2.39 2003/01/20 02:23:07 iedowse Exp $ - * $DragonFly: src/sys/net/ipfw/Attic/ip_fw.c,v 1.17 2006/09/03 18:52:29 dillon Exp $ + * $DragonFly: src/sys/net/ipfw/Attic/ip_fw.c,v 1.18 2006/09/05 00:55:47 dillon Exp $ */ #define DEB(x) @@ -660,7 +660,7 @@ hash_packet(struct ipfw_flow_id *id) else \ ipfw_dyn_v[i] = q = q->next ; \ dyn_count-- ; \ - free(old_q, M_IPFW); } + kfree(old_q, M_IPFW); } #define TIME_LEQ(a,b) ((int)((a)-(b)) <= 0) /** @@ -849,7 +849,7 @@ add_dyn_rule(struct ipfw_flow_id *id, u_int8_t dyn_type, struct ip_fw *rule) else { curr_dyn_buckets = dyn_buckets ; if (ipfw_dyn_v != NULL) - free(ipfw_dyn_v, M_IPFW); + kfree(ipfw_dyn_v, M_IPFW); ipfw_dyn_v = malloc(curr_dyn_buckets * sizeof r, M_IPFW, M_WAITOK | M_ZERO); if (ipfw_dyn_v == NULL) @@ -858,7 +858,7 @@ add_dyn_rule(struct ipfw_flow_id *id, u_int8_t dyn_type, struct ip_fw *rule) } i = hash_packet(id); - r = malloc(sizeof *r, M_IPFW, M_WAITOK | M_ZERO); + r = kmalloc(sizeof *r, M_IPFW, M_WAITOK | M_ZERO); if (r == NULL) { printf ("sorry cannot allocate state\n"); return NULL ; @@ -1620,7 +1620,7 @@ add_entry(struct ip_fw_head *head, struct ip_fw *rule) struct ip_fw *ftmp, *fcp, *fcpl; u_short nbr = 0; - ftmp = malloc(sizeof *ftmp, M_IPFW, M_WAITOK | M_ZERO); + ftmp = kmalloc(sizeof *ftmp, M_IPFW, M_WAITOK | M_ZERO); if (!ftmp) return (ENOSPC); bcopy(rule, ftmp, sizeof(*ftmp)); @@ -1693,7 +1693,7 @@ free_chain(struct ip_fw *fcp) if (DUMMYNET_LOADED) ip_dn_ruledel_ptr(fcp) ; flush_rule_ptrs(); /* more efficient to do outside the loop */ - free(fcp, M_IPFW); + kfree(fcp, M_IPFW); return n; } @@ -1939,7 +1939,7 @@ ip_fw_ctl(struct sockopt *sopt) * bother filling up the buffer, just jump to the * sooptcopyout. */ - buf = malloc(size, M_TEMP, M_WAITOK); + buf = kmalloc(size, M_TEMP, M_WAITOK); bp = buf ; LIST_FOREACH(fcp, &ip_fw_chain_head, next) { @@ -1973,7 +1973,7 @@ ip_fw_ctl(struct sockopt *sopt) crit_exit(); error = sooptcopyout(sopt, buf, size); - free(buf, M_TEMP); + kfree(buf, M_TEMP); break; case IP_FW_FLUSH: diff --git a/sys/net/ipfw/ip_fw2.c b/sys/net/ipfw/ip_fw2.c index 82e5e5902b..b7f845b244 100644 --- a/sys/net/ipfw/ip_fw2.c +++ b/sys/net/ipfw/ip_fw2.c @@ -23,7 +23,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netinet/ip_fw2.c,v 1.6.2.12 2003/04/08 10:42:32 maxim Exp $ - * $DragonFly: src/sys/net/ipfw/ip_fw2.c,v 1.20 2006/09/03 18:52:29 dillon Exp $ + * $DragonFly: src/sys/net/ipfw/ip_fw2.c,v 1.21 2006/09/05 00:55:47 dillon Exp $ */ #define DEB(x) @@ -620,7 +620,7 @@ hash_packet(struct ipfw_flow_id *id) else \ head = q = q->next; \ dyn_count--; \ - free(old_q, M_IPFW); } + kfree(old_q, M_IPFW); } #define TIME_LEQ(a,b) ((int)((a)-(b)) <= 0) @@ -837,7 +837,7 @@ realloc_dynamic_table(void) } curr_dyn_buckets = dyn_buckets; if (ipfw_dyn_v != NULL) - free(ipfw_dyn_v, M_IPFW); + kfree(ipfw_dyn_v, M_IPFW); for (;;) { ipfw_dyn_v = malloc(curr_dyn_buckets * sizeof(ipfw_dyn_rule *), M_IPFW, M_WAITOK | M_ZERO); @@ -871,7 +871,7 @@ add_dyn_rule(struct ipfw_flow_id *id, u_int8_t dyn_type, struct ip_fw *rule) } i = hash_packet(id); - r = malloc(sizeof *r, M_IPFW, M_WAITOK | M_ZERO); + r = kmalloc(sizeof *r, M_IPFW, M_WAITOK | M_ZERO); if (r == NULL) { printf ("sorry cannot allocate state\n"); return NULL; @@ -1990,7 +1990,7 @@ add_rule(struct ip_fw **head, struct ip_fw *input_rule) if (*head == NULL && input_rule->rulenum != IPFW_DEFAULT_RULE) return (EINVAL); - rule = malloc(l, M_IPFW, M_WAITOK | M_ZERO); + rule = kmalloc(l, M_IPFW, M_WAITOK | M_ZERO); if (rule == NULL) return (ENOSPC); @@ -2083,7 +2083,7 @@ delete_rule(struct ip_fw **head, struct ip_fw *prev, struct ip_fw *rule) if (DUMMYNET_LOADED) ip_dn_ruledel_ptr(rule); - free(rule, M_IPFW); + kfree(rule, M_IPFW); return n; } @@ -2498,7 +2498,7 @@ ipfw_ctl(struct sockopt *sopt) * how much room is needed, do not bother filling up the * buffer, just jump to the sooptcopyout. */ - buf = malloc(size, M_TEMP, M_WAITOK); + buf = kmalloc(size, M_TEMP, M_WAITOK); bp = buf; for (rule = layer3_chain; rule ; rule = rule->next) { @@ -2539,7 +2539,7 @@ ipfw_ctl(struct sockopt *sopt) crit_exit(); error = sooptcopyout(sopt, buf, size); - free(buf, M_TEMP); + kfree(buf, M_TEMP); break; case IP_FW_FLUSH: diff --git a/sys/net/netisr.c b/sys/net/netisr.c index b1d2fc5c96..d7ff020745 100644 --- a/sys/net/netisr.c +++ b/sys/net/netisr.c @@ -35,7 +35,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/net/netisr.c,v 1.26 2006/05/20 06:32:37 dillon Exp $ + * $DragonFly: src/sys/net/netisr.c,v 1.27 2006/09/05 00:55:46 dillon Exp $ */ /* @@ -97,7 +97,7 @@ lwkt_port netisr_sync_port; static void netisr_autofree_reply(lwkt_port_t port, lwkt_msg_t msg) { - free(msg, M_LWKTMSG); + kfree(msg, M_LWKTMSG); } static void @@ -232,7 +232,7 @@ netmsg_service_port_init(lwkt_port_t port) * certain operations (such as freeing an ifnet structure) across all * consumers. */ - reg = malloc(sizeof(*reg), M_TEMP, M_WAITOK|M_ZERO); + reg = kmalloc(sizeof(*reg), M_TEMP, M_WAITOK|M_ZERO); reg->npr_port = port; TAILQ_INSERT_TAIL(&netreglist, reg, npr_entry); } diff --git a/sys/net/pf/if_pflog.c b/sys/net/pf/if_pflog.c index 4363513bd2..53f20b07a1 100644 --- a/sys/net/pf/if_pflog.c +++ b/sys/net/pf/if_pflog.c @@ -1,6 +1,6 @@ /* $FreeBSD: src/sys/contrib/pf/net/if_pflog.c,v 1.9 2004/06/22 20:13:24 brooks Exp $ */ /* $OpenBSD: if_pflog.c,v 1.11 2003/12/31 11:18:25 cedric Exp $ */ -/* $DragonFly: src/sys/net/pf/if_pflog.c,v 1.4 2005/11/28 17:13:45 dillon Exp $ */ +/* $DragonFly: src/sys/net/pf/if_pflog.c,v 1.5 2006/09/05 00:55:47 dillon Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), @@ -114,7 +114,7 @@ pflog_clone_destroy(struct ifnet *ifp) bpfdetach(ifp); if_detach(ifp); LIST_REMOVE(sc, sc_next); - free(sc, M_PFLOG); + kfree(sc, M_PFLOG); } static int diff --git a/sys/net/pf/if_pfsync.c b/sys/net/pf/if_pfsync.c index f8760d7782..ba4c36a335 100644 --- a/sys/net/pf/if_pfsync.c +++ b/sys/net/pf/if_pfsync.c @@ -1,6 +1,6 @@ /* $FreeBSD: src/sys/contrib/pf/net/if_pfsync.c,v 1.11 2004/08/14 15:32:40 dwmalone Exp $ */ /* $OpenBSD: if_pfsync.c,v 1.26 2004/03/28 18:14:20 mcbride Exp $ */ -/* $DragonFly: src/sys/net/pf/if_pfsync.c,v 1.4 2006/01/14 11:05:18 swildner Exp $ */ +/* $DragonFly: src/sys/net/pf/if_pfsync.c,v 1.5 2006/09/05 00:55:47 dillon Exp $ */ /* * Copyright (c) 2004 The DragonFly Project. All rights reserved. @@ -121,7 +121,7 @@ pfsync_clone_destroy(struct ifnet *ifp) bpfdetach(ifp); if_detach(ifp); LIST_REMOVE(sc, sc_next); - free(sc, M_PFSYNC); + kfree(sc, M_PFSYNC); } static int diff --git a/sys/net/pf/pf.c b/sys/net/pf/pf.c index 3d107a14b9..b3e7646542 100644 --- a/sys/net/pf/pf.c +++ b/sys/net/pf/pf.c @@ -1,7 +1,7 @@ /* $FreeBSD: src/sys/contrib/pf/net/pf.c,v 1.19 2004/09/11 11:18:25 mlaier Exp $ */ /* $OpenBSD: pf.c,v 1.433.2.2 2004/07/17 03:22:34 brad Exp $ */ /* add $OpenBSD: pf.c,v 1.448 2004/05/11 07:34:11 dhartmei Exp $ */ -/* $DragonFly: src/sys/net/pf/pf.c,v 1.10 2006/09/03 17:31:55 dillon Exp $ */ +/* $DragonFly: src/sys/net/pf/pf.c,v 1.11 2006/09/05 00:55:47 dillon Exp $ */ /* * Copyright (c) 2004 The DragonFly Project. All rights reserved. @@ -2227,7 +2227,7 @@ pf_socket_lookup(uid_t *uid, gid_t *gid, int direction, struct pf_pdesc *pd) * Prepare a msg iff data belongs to another CPU. */ if (pi_cpu != mycpu->gd_cpuid) { - msg = malloc(sizeof(*msg), M_LWKTMSG, M_INTWAIT); + msg = kmalloc(sizeof(*msg), M_LWKTMSG, M_INTWAIT); lwkt_initmsg(&msg->nm_lmsg, &netisr_afree_rport, 0, lwkt_cmd_func(in_pcblookup_hash_handler), lwkt_cmd_op_none); diff --git a/sys/net/pf/pf_if.c b/sys/net/pf/pf_if.c index c2826097c2..173bb744d2 100644 --- a/sys/net/pf/pf_if.c +++ b/sys/net/pf/pf_if.c @@ -1,7 +1,7 @@ /* $FreeBSD: src/sys/contrib/pf/net/pf_if.c,v 1.6 2004/09/14 15:20:24 mlaier Exp $ */ /* $OpenBSD: pf_if.c,v 1.11 2004/03/15 11:38:23 cedric Exp $ */ /* add $OpenBSD: pf_if.c,v 1.19 2004/08/11 12:06:44 henning Exp $ */ -/* $DragonFly: src/sys/net/pf/pf_if.c,v 1.4 2005/06/15 16:32:58 joerg Exp $ */ +/* $DragonFly: src/sys/net/pf/pf_if.c,v 1.5 2006/09/05 00:55:47 dillon Exp $ */ /* * Copyright (c) 2004 The DragonFly Project. All rights reserved. @@ -173,11 +173,11 @@ pfi_cleanup(void) while ((p = RB_MIN(pfi_ifhead, &pfi_ifs))) { RB_REMOVE(pfi_ifhead, &pfi_ifs, p); - free(p->pfik_ah_head, PFI_MTYPE); - free(p, PFI_MTYPE); + kfree(p->pfik_ah_head, PFI_MTYPE); + kfree(p, PFI_MTYPE); } - free(pfi_index2kif, PFI_MTYPE); - free(pfi_buffer, PFI_MTYPE); + kfree(pfi_index2kif, PFI_MTYPE); + kfree(pfi_buffer, PFI_MTYPE); pfi_index2kif = NULL; pfi_buffer = NULL; pfi_self = NULL; @@ -250,7 +250,7 @@ pfi_attach_ifnet(struct ifnet *ifp) m = oldlim * sizeof(struct pfi_kif *); mp = pfi_index2kif; n = pfi_indexlim * sizeof(struct pfi_kif *); - np = malloc(n, PFI_MTYPE, M_NOWAIT); + np = kmalloc(n, PFI_MTYPE, M_NOWAIT); if (np == NULL) panic("pfi_attach_ifnet: " "cannot allocate translation table"); @@ -259,7 +259,7 @@ pfi_attach_ifnet(struct ifnet *ifp) bcopy(mp, np, m); pfi_index2kif = np; if (mp != NULL) - free(mp, PFI_MTYPE); + kfree(mp, PFI_MTYPE); } strlcpy(key.pfik_name, ifp->if_xname, sizeof(key.pfik_name)); @@ -611,7 +611,7 @@ pfi_address_add(struct sockaddr *sa, int af, int net) pfi_buffer_cnt, PFI_BUFFER_MAX); return; } - p = malloc(new_max * sizeof(*pfi_buffer), PFI_MTYPE, + p = kmalloc(new_max * sizeof(*pfi_buffer), PFI_MTYPE, M_NOWAIT); if (p == NULL) { printf("pfi_address_add: no memory to grow buffer " @@ -620,7 +620,7 @@ pfi_address_add(struct sockaddr *sa, int af, int net) } memcpy(pfi_buffer, p, pfi_buffer_cnt * sizeof(*pfi_buffer)); /* no need to zero buffer */ - free(pfi_buffer, PFI_MTYPE); + kfree(pfi_buffer, PFI_MTYPE); pfi_buffer = p; pfi_buffer_max = new_max; } @@ -692,14 +692,14 @@ pfi_if_create(const char *name, struct pfi_kif *q, int flags) { struct pfi_kif *p; - p = malloc(sizeof(*p), PFI_MTYPE, M_NOWAIT); + p = kmalloc(sizeof(*p), PFI_MTYPE, M_NOWAIT); if (p == NULL) return (NULL); bzero(p, sizeof(*p)); - p->pfik_ah_head = malloc(sizeof(*p->pfik_ah_head), PFI_MTYPE, + p->pfik_ah_head = kmalloc(sizeof(*p->pfik_ah_head), PFI_MTYPE, M_NOWAIT); if (p->pfik_ah_head == NULL) { - free(p, PFI_MTYPE); + kfree(p, PFI_MTYPE); return (NULL); } bzero(p->pfik_ah_head, sizeof(*p->pfik_ah_head)); @@ -761,8 +761,8 @@ pfi_maybe_destroy(struct pfi_kif *p) RB_REMOVE(pfi_ifhead, &pfi_ifs, p); crit_exit(); - free(p->pfik_ah_head, PFI_MTYPE); - free(p, PFI_MTYPE); + kfree(p->pfik_ah_head, PFI_MTYPE); + kfree(p, PFI_MTYPE); return (1); } diff --git a/sys/net/pf/pf_ioctl.c b/sys/net/pf/pf_ioctl.c index c4a8f91880..8826b7e742 100644 --- a/sys/net/pf/pf_ioctl.c +++ b/sys/net/pf/pf_ioctl.c @@ -1,6 +1,6 @@ /* $FreeBSD: src/sys/contrib/pf/net/pf_ioctl.c,v 1.12 2004/08/12 14:15:42 mlaier Exp $ */ /* $OpenBSD: pf_ioctl.c,v 1.112.2.2 2004/07/24 18:28:12 brad Exp $ */ -/* $DragonFly: src/sys/net/pf/pf_ioctl.c,v 1.7 2006/09/03 17:31:55 dillon Exp $ */ +/* $DragonFly: src/sys/net/pf/pf_ioctl.c,v 1.8 2006/09/05 00:55:47 dillon Exp $ */ /* * Copyright (c) 2004 The DragonFly Project. All rights reserved. @@ -499,11 +499,11 @@ pf_remove_if_empty_ruleset(struct pf_ruleset *ruleset) anchor = ruleset->anchor; TAILQ_REMOVE(&anchor->rulesets, ruleset, entries); - free(ruleset, M_TEMP); + kfree(ruleset, M_TEMP); if (TAILQ_EMPTY(&anchor->rulesets)) { TAILQ_REMOVE(&pf_anchors, anchor, entries); - free(anchor, M_TEMP); + kfree(anchor, M_TEMP); pf_update_anchor_rules(); } } @@ -642,7 +642,7 @@ tag_unref(struct pf_tags *head, u_int16_t tag) if (tag == p->tag) { if (--p->ref == 0) { TAILQ_REMOVE(head, p, entries); - free(p, M_TEMP); + kfree(p, M_TEMP); } break; } diff --git a/sys/net/pf/pf_subr.c b/sys/net/pf/pf_subr.c index 344c9a03fc..4a21bd7c05 100644 --- a/sys/net/pf/pf_subr.c +++ b/sys/net/pf/pf_subr.c @@ -1,7 +1,7 @@ /* $FreeBSD: src/sys/contrib/pf/net/pf_subr.c,v 1.1 2004/06/16 23:24:00 mlaier Exp $ */ /* from $OpenBSD: kern_subr.c,v 1.26 2003/10/31 11:10:41 markus Exp $ */ /* $NetBSD: kern_subr.c,v 1.15 1996/04/09 17:21:56 ragge Exp $ */ -/* $DragonFly: src/sys/net/pf/pf_subr.c,v 1.1 2004/09/19 22:32:47 joerg Exp $ */ +/* $DragonFly: src/sys/net/pf/pf_subr.c,v 1.2 2006/09/05 00:55:47 dillon Exp $ */ /* * Copyright (c) 2004 The DragonFly Project. All rights reserved. @@ -73,7 +73,7 @@ hook_establish(struct hook_desc_head *head, int tail, void (*fn)(void *), { struct hook_desc *hdp; - hdp = (struct hook_desc *)malloc(sizeof (*hdp), M_DEVBUF, M_NOWAIT); + hdp = (struct hook_desc *)kmalloc(sizeof (*hdp), M_DEVBUF, M_NOWAIT); if (hdp == NULL) return (NULL); @@ -102,7 +102,7 @@ hook_disestablish(struct hook_desc_head *head, void *vhook) #endif hdp = vhook; TAILQ_REMOVE(head, hdp, hd_list); - free(hdp, M_DEVBUF); + kfree(hdp, M_DEVBUF); } /* @@ -125,7 +125,7 @@ dohooks(struct hook_desc_head *head, int flags) TAILQ_REMOVE(head, hdp, hd_list); (*hdp->hd_fn)(hdp->hd_arg); if ((flags & HOOK_FREE) != 0) - free(hdp, M_DEVBUF); + kfree(hdp, M_DEVBUF); } } } diff --git a/sys/net/pf/pf_table.c b/sys/net/pf/pf_table.c index 8eaee24433..624f486d71 100644 --- a/sys/net/pf/pf_table.c +++ b/sys/net/pf/pf_table.c @@ -1,6 +1,6 @@ /* $FreeBSD: src/sys/contrib/pf/net/pf_table.c,v 1.5 2004/07/28 06:14:44 kan Exp $ */ /* $OpenBSD: pf_table.c,v 1.47 2004/03/09 21:44:41 mcbride Exp $ */ -/* $DragonFly: src/sys/net/pf/pf_table.c,v 1.3 2005/06/15 16:32:58 joerg Exp $ */ +/* $DragonFly: src/sys/net/pf/pf_table.c,v 1.4 2006/09/05 00:55:47 dillon Exp $ */ /* * Copyright (c) 2004 The DragonFly Project. All rights reserved. @@ -1837,9 +1837,9 @@ pfr_destroy_ktable(struct pfr_ktable *kt, int flushaddr) pfr_destroy_kentries(&addrq); } if (kt->pfrkt_ip4 != NULL) - free((caddr_t)kt->pfrkt_ip4, M_RTABLE); + kfree((caddr_t)kt->pfrkt_ip4, M_RTABLE); if (kt->pfrkt_ip6 != NULL) - free((caddr_t)kt->pfrkt_ip6, M_RTABLE); + kfree((caddr_t)kt->pfrkt_ip6, M_RTABLE); if (kt->pfrkt_shadow != NULL) pfr_destroy_ktable(kt->pfrkt_shadow, flushaddr); if (kt->pfrkt_rs != NULL) { diff --git a/sys/net/pfil.c b/sys/net/pfil.c index 8f6d0978a8..2b361af703 100644 --- a/sys/net/pfil.c +++ b/sys/net/pfil.c @@ -1,5 +1,5 @@ /* $NetBSD: pfil.c,v 1.20 2001/11/12 23:49:46 lukem Exp $ */ -/* $DragonFly: src/sys/net/pfil.c,v 1.3 2004/07/14 08:01:16 asmodai Exp $ */ +/* $DragonFly: src/sys/net/pfil.c,v 1.4 2006/09/05 00:55:46 dillon Exp $ */ /* * Copyright (c) 1996 Matthew R. Green @@ -179,7 +179,7 @@ pfil_list_add(struct pfil_head *ph, return EEXIST; } - pfh = (struct packet_filter_hook *)malloc(sizeof(*pfh), M_IFADDR, + pfh = (struct packet_filter_hook *)kmalloc(sizeof(*pfh), M_IFADDR, (flags & PFIL_WAITOK) ? M_WAITOK : M_NOWAIT); if (pfh == NULL) return ENOMEM; @@ -234,7 +234,7 @@ pfil_list_remove(struct pfil_head *ph, pfh = TAILQ_NEXT(pfh, pfil_link)) { if (pfh->pfil_func == func && pfh->pfil_arg == arg) { TAILQ_REMOVE(list, pfh, pfil_link); - free(pfh, M_IFADDR); + kfree(pfh, M_IFADDR); if (TAILQ_EMPTY(&ph->ph_in) && TAILQ_EMPTY(&ph->ph_out)) ph->ph_hashooks = 0; return 0; diff --git a/sys/net/ppp/if_ppp.c b/sys/net/ppp/if_ppp.c index bde644ff28..e63ceb4891 100644 --- a/sys/net/ppp/if_ppp.c +++ b/sys/net/ppp/if_ppp.c @@ -70,7 +70,7 @@ */ /* $FreeBSD: src/sys/net/if_ppp.c,v 1.67.2.4 2002/04/14 21:41:48 luigi Exp $ */ -/* $DragonFly: src/sys/net/ppp/if_ppp.c,v 1.32 2006/07/28 02:17:40 dillon Exp $ */ +/* $DragonFly: src/sys/net/ppp/if_ppp.c,v 1.33 2006/09/05 00:55:47 dillon Exp $ */ /* from if_sl.c,v 1.11 84/10/04 12:54:47 rick Exp */ /* from NetBSD: if_ppp.c,v 1.15.2.2 1994/07/28 05:17:58 cgd Exp */ @@ -348,19 +348,19 @@ pppdealloc(struct ppp_softc *sc) #endif /* PPP_COMPRESS */ #ifdef PPP_FILTER if (sc->sc_pass_filt.bf_insns != 0) { - free(sc->sc_pass_filt.bf_insns, M_DEVBUF); + kfree(sc->sc_pass_filt.bf_insns, M_DEVBUF); sc->sc_pass_filt.bf_insns = 0; sc->sc_pass_filt.bf_len = 0; } if (sc->sc_active_filt.bf_insns != 0) { - free(sc->sc_active_filt.bf_insns, M_DEVBUF); + kfree(sc->sc_active_filt.bf_insns, M_DEVBUF); sc->sc_active_filt.bf_insns = 0; sc->sc_active_filt.bf_len = 0; } #endif /* PPP_FILTER */ #ifdef VJC if (sc->sc_comp != 0) { - free(sc->sc_comp, M_DEVBUF); + kfree(sc->sc_comp, M_DEVBUF); sc->sc_comp = 0; } #endif @@ -550,11 +550,11 @@ pppioctl(struct ppp_softc *sc, u_long cmd, caddr_t data, } if ((error = copyin((caddr_t)nbp->bf_insns, (caddr_t)newcode, newcodelen)) != 0) { - free(newcode, M_DEVBUF); + kfree(newcode, M_DEVBUF); return error; } if (!bpf_validate(newcode, nbp->bf_len)) { - free(newcode, M_DEVBUF); + kfree(newcode, M_DEVBUF); return EINVAL; } } else @@ -566,7 +566,7 @@ pppioctl(struct ppp_softc *sc, u_long cmd, caddr_t data, bp->bf_insns = newcode; crit_exit(); if (oldcode != 0) - free(oldcode, M_DEVBUF); + kfree(oldcode, M_DEVBUF); break; #endif diff --git a/sys/net/ppp_layer/ppp_deflate.c b/sys/net/ppp_layer/ppp_deflate.c index 6c29333407..d3a68e422d 100644 --- a/sys/net/ppp_layer/ppp_deflate.c +++ b/sys/net/ppp_layer/ppp_deflate.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/net/ppp_deflate.c,v 1.12.2.1 2002/04/14 21:41:48 luigi Exp $ */ -/* $DragonFly: src/sys/net/ppp_layer/ppp_deflate.c,v 1.7 2005/12/11 13:00:17 swildner Exp $ */ +/* $DragonFly: src/sys/net/ppp_layer/ppp_deflate.c,v 1.8 2006/09/05 00:55:47 dillon Exp $ */ /* * ppp_deflate.c - interface the zlib procedures for Deflate compression @@ -131,7 +131,7 @@ z_alloc(void *notused, u_int items, u_int size) void z_free(void *notused, void *ptr) { - free(ptr, M_DEVBUF); + kfree(ptr, M_DEVBUF); } /* @@ -161,7 +161,7 @@ z_comp_alloc(u_char *options, int opt_len) state->strm.zfree = z_free; if (deflateInit2(&state->strm, Z_DEFAULT_COMPRESSION, DEFLATE_METHOD_VAL, -w_size, 8, Z_DEFAULT_STRATEGY) != Z_OK) { - free(state, M_DEVBUF); + kfree(state, M_DEVBUF); return NULL; } @@ -176,7 +176,7 @@ z_comp_free(void *arg) struct deflate_state *state = (struct deflate_state *) arg; deflateEnd(&state->strm); - free(state, M_DEVBUF); + kfree(state, M_DEVBUF); } static int @@ -382,7 +382,7 @@ z_decomp_alloc(u_char *options, int opt_len) state->strm.zalloc = z_alloc; state->strm.zfree = z_free; if (inflateInit2(&state->strm, -w_size) != Z_OK) { - free(state, M_DEVBUF); + kfree(state, M_DEVBUF); return NULL; } @@ -397,7 +397,7 @@ z_decomp_free(void *arg) struct deflate_state *state = (struct deflate_state *) arg; inflateEnd(&state->strm); - free(state, M_DEVBUF); + kfree(state, M_DEVBUF); } static int diff --git a/sys/net/raw_cb.c b/sys/net/raw_cb.c index 614a82925c..0046d2a6e3 100644 --- a/sys/net/raw_cb.c +++ b/sys/net/raw_cb.c @@ -32,7 +32,7 @@ * * @(#)raw_cb.c 8.1 (Berkeley) 6/10/93 * $FreeBSD: src/sys/net/raw_cb.c,v 1.16 1999/08/28 00:48:27 peter Exp $ - * $DragonFly: src/sys/net/raw_cb.c,v 1.10 2005/01/26 23:09:57 hsu Exp $ + * $DragonFly: src/sys/net/raw_cb.c,v 1.11 2006/09/05 00:55:46 dillon Exp $ */ #include @@ -97,7 +97,7 @@ raw_detach(struct rawcb *rp) so->so_pcb = NULL; sofree(so); LIST_REMOVE(rp, list); - free(rp, M_PCB); + kfree(rp, M_PCB); } /* diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 4b31edfec4..86401569e2 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -82,7 +82,7 @@ * * @(#)rtsock.c 8.7 (Berkeley) 10/12/95 * $FreeBSD: src/sys/net/rtsock.c,v 1.44.2.11 2002/12/04 14:05:41 ru Exp $ - * $DragonFly: src/sys/net/rtsock.c,v 1.32 2006/05/18 13:51:45 sephe Exp $ + * $DragonFly: src/sys/net/rtsock.c,v 1.33 2006/09/05 00:55:46 dillon Exp $ */ #include "opt_sctp.h" @@ -165,7 +165,7 @@ rts_attach(struct socket *so, int proto, struct pru_attach_info *ai) if (sotorawcb(so) != NULL) return EISCONN; /* XXX panic? */ - rp = malloc(sizeof *rp, M_PCB, M_WAITOK | M_ZERO); + rp = kmalloc(sizeof *rp, M_PCB, M_WAITOK | M_ZERO); if (rp == NULL) return ENOBUFS; @@ -182,7 +182,7 @@ rts_attach(struct socket *so, int proto, struct pru_attach_info *ai) rp = sotorawcb(so); if (error) { crit_exit(); - free(rp, M_PCB); + kfree(rp, M_PCB); return error; } switch(rp->rcb_proto.sp_protocol) { @@ -352,11 +352,11 @@ reallocbuf(void *ptr, size_t len, size_t olen) { void *newptr; - newptr = malloc(len, M_RTABLE, M_INTWAIT | M_NULLOK); + newptr = kmalloc(len, M_RTABLE, M_INTWAIT | M_NULLOK); if (newptr == NULL) return NULL; bcopy(ptr, newptr, olen); - free(ptr, M_RTABLE); + kfree(ptr, M_RTABLE); return (newptr); } @@ -445,7 +445,7 @@ route_output(struct mbuf *m, struct socket *so, ...) rtinfo.rti_dst = NULL; gotoerr(EINVAL); } - rtm = malloc(len, M_RTABLE, M_INTWAIT | M_NULLOK); + rtm = kmalloc(len, M_RTABLE, M_INTWAIT | M_NULLOK); if (rtm == NULL) { rtinfo.rti_dst = NULL; gotoerr(ENOBUFS); @@ -549,7 +549,7 @@ flush: if (!(so->so_options & SO_USELOOPBACK)) { if (route_cb.any_count <= 1) { if (rtm != NULL) - free(rtm, M_RTABLE); + kfree(rtm, M_RTABLE); m_freem(m); return (error); } @@ -563,7 +563,7 @@ flush: m = NULL; } else if (m->m_pkthdr.len > rtm->rtm_msglen) m_adj(m, rtm->rtm_msglen - m->m_pkthdr.len); - free(rtm, M_RTABLE); + kfree(rtm, M_RTABLE); } if (rp != NULL) rp->rcb_proto.sp_family = 0; /* Avoid us */ @@ -1138,11 +1138,11 @@ resizewalkarg(struct walkarg *w, int len) { void *newptr; - newptr = malloc(len, M_RTABLE, M_INTWAIT | M_NULLOK); + newptr = kmalloc(len, M_RTABLE, M_INTWAIT | M_NULLOK); if (newptr == NULL) return (ENOMEM); if (w->w_tmem != NULL) - free(w->w_tmem, M_RTABLE); + kfree(w->w_tmem, M_RTABLE); w->w_tmem = newptr; w->w_tmemsize = len; return (0); @@ -1308,7 +1308,7 @@ sysctl_rtsock(SYSCTL_HANDLER_ARGS) } crit_exit(); if (w.w_tmem != NULL) - free(w.w_tmem, M_RTABLE); + kfree(w.w_tmem, M_RTABLE); if (origcpu >= 0) lwkt_migratecpu(origcpu); return (error); diff --git a/sys/net/sl/if_sl.c b/sys/net/sl/if_sl.c index af74f031b3..7d656e6c3b 100644 --- a/sys/net/sl/if_sl.c +++ b/sys/net/sl/if_sl.c @@ -32,7 +32,7 @@ * * @(#)if_sl.c 8.6 (Berkeley) 2/1/94 * $FreeBSD: src/sys/net/if_sl.c,v 1.84.2.2 2002/02/13 00:43:10 dillon Exp $ - * $DragonFly: src/sys/net/sl/if_sl.c,v 1.26 2006/09/03 17:31:55 dillon Exp $ + * $DragonFly: src/sys/net/sl/if_sl.c,v 1.27 2006/09/05 00:55:48 dillon Exp $ */ /* @@ -237,7 +237,7 @@ static int slinit(struct sl_softc *sc) { if (sc->sc_ep == NULL) - sc->sc_ep = malloc(SLBUFSIZE, M_DEVBUF, M_WAITOK); + sc->sc_ep = kmalloc(SLBUFSIZE, M_DEVBUF, M_WAITOK); sc->sc_buf = sc->sc_ep + SLBUFSIZE - SLRMAX; sc->sc_mp = sc->sc_buf; sl_compress_init(&sc->sc_comp, -1); @@ -327,7 +327,7 @@ slclose(struct tty *tp, int flag) sc->sc_ttyp = NULL; tp->t_sc = NULL; if (sc->sc_ep) { - free(sc->sc_ep, M_DEVBUF); + kfree(sc->sc_ep, M_DEVBUF); sc->sc_ep = NULL; } sc->sc_mp = 0; @@ -361,14 +361,14 @@ sltioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, struct ucred *cred) if ( nc->sc_if.if_dunit == *(u_int *)data && nc->sc_ttyp == NULL ) { - tmpnc = malloc(sizeof *tmpnc, M_TEMP, + tmpnc = kmalloc(sizeof *tmpnc, M_TEMP, M_WAITOK); *tmpnc = *nc; *nc = *sc; nc->sc_if = tmpnc->sc_if; tmpnc->sc_if = sc->sc_if; *sc = *tmpnc; - free(tmpnc, M_TEMP); + kfree(tmpnc, M_TEMP); if (sc->sc_if.if_flags & IFF_UP) { if_down(&sc->sc_if); if (!(nc->sc_if.if_flags & IFF_UP)) diff --git a/sys/net/sppp/if_spppsubr.c b/sys/net/sppp/if_spppsubr.c index 8f418958ab..1b498e2f58 100644 --- a/sys/net/sppp/if_spppsubr.c +++ b/sys/net/sppp/if_spppsubr.c @@ -18,7 +18,7 @@ * From: Version 2.4, Thu Apr 30 17:17:21 MSD 1997 * * $FreeBSD: src/sys/net/if_spppsubr.c,v 1.59.2.13 2002/07/03 15:44:41 joerg Exp $ - * $DragonFly: src/sys/net/sppp/if_spppsubr.c,v 1.25 2006/09/03 18:52:29 dillon Exp $ + * $DragonFly: src/sys/net/sppp/if_spppsubr.c,v 1.26 2006/09/05 00:55:48 dillon Exp $ */ #include @@ -1038,7 +1038,7 @@ sppp_attach(struct ifnet *ifp) #ifdef INET6 sp->confflags |= CONF_ENABLE_IPV6; #endif - sp->pp_comp = malloc(sizeof(struct slcompress), M_TEMP, M_WAITOK); + sp->pp_comp = kmalloc(sizeof(struct slcompress), M_TEMP, M_WAITOK); sl_compress_init(sp->pp_comp, -1); sppp_lcp_init(sp); sppp_ipcp_init(sp); @@ -2269,7 +2269,7 @@ sppp_lcp_RCR(struct sppp *sp, struct lcp_header *h, int len) len -= 4; origlen = len; - buf = r = malloc (len, M_TEMP, M_INTWAIT); + buf = r = kmalloc (len, M_TEMP, M_INTWAIT); if (debug) log(LOG_DEBUG, SPP_FMT "lcp parse opts: ", @@ -2483,11 +2483,11 @@ sppp_lcp_RCR(struct sppp *sp, struct lcp_header *h, int len) h->ident, origlen, h+1); } - free (buf, M_TEMP); + kfree (buf, M_TEMP); return (rlen == 0); drop: - free(buf, M_TEMP); + kfree(buf, M_TEMP); return (-1); } @@ -2502,7 +2502,7 @@ sppp_lcp_RCN_rej(struct sppp *sp, struct lcp_header *h, int len) u_char *buf, *p; len -= 4; - buf = malloc (len, M_TEMP, M_INTWAIT); + buf = kmalloc (len, M_TEMP, M_INTWAIT); if (debug) log(LOG_DEBUG, SPP_FMT "lcp rej opts: ", @@ -2559,7 +2559,7 @@ sppp_lcp_RCN_rej(struct sppp *sp, struct lcp_header *h, int len) if (debug) addlog("\n"); drop: - free (buf, M_TEMP); + kfree (buf, M_TEMP); return; } @@ -2575,7 +2575,7 @@ sppp_lcp_RCN_nak(struct sppp *sp, struct lcp_header *h, int len) u_long magic; len -= 4; - buf = malloc (len, M_TEMP, M_INTWAIT); + buf = kmalloc (len, M_TEMP, M_INTWAIT); if (debug) log(LOG_DEBUG, SPP_FMT "lcp nak opts: ", @@ -2652,7 +2652,7 @@ sppp_lcp_RCN_nak(struct sppp *sp, struct lcp_header *h, int len) if (debug) addlog("\n"); drop: - free (buf, M_TEMP); + kfree (buf, M_TEMP); return; } @@ -2976,7 +2976,7 @@ sppp_ipcp_RCR(struct sppp *sp, struct lcp_header *h, int len) * Make sure to allocate a buf that can at least hold a * conf-nak with an `address' option. We might need it below. */ - buf = r = malloc ((len < 6? 6: len), M_TEMP, M_INTWAIT); + buf = r = kmalloc ((len < 6? 6: len), M_TEMP, M_INTWAIT); /* pass 1: see if we can recognize them */ if (debug) @@ -3163,11 +3163,11 @@ sppp_ipcp_RCR(struct sppp *sp, struct lcp_header *h, int len) h->ident, origlen, h+1); } - free (buf, M_TEMP); + kfree (buf, M_TEMP); return (rlen == 0); drop: - free(buf, M_TEMP); + kfree(buf, M_TEMP); return (-1); } @@ -3183,7 +3183,7 @@ sppp_ipcp_RCN_rej(struct sppp *sp, struct lcp_header *h, int len) int debug = ifp->if_flags & IFF_DEBUG; len -= 4; - buf = malloc (len, M_TEMP, M_INTWAIT); + buf = kmalloc (len, M_TEMP, M_INTWAIT); if (debug) log(LOG_DEBUG, SPP_FMT "ipcp rej opts: ", @@ -3217,7 +3217,7 @@ sppp_ipcp_RCN_rej(struct sppp *sp, struct lcp_header *h, int len) if (debug) addlog("\n"); drop: - free (buf, M_TEMP); + kfree (buf, M_TEMP); return; } @@ -3235,7 +3235,7 @@ sppp_ipcp_RCN_nak(struct sppp *sp, struct lcp_header *h, int len) u_long wantaddr; len -= 4; - buf = malloc (len, M_TEMP, M_INTWAIT); + buf = kmalloc (len, M_TEMP, M_INTWAIT); if (debug) log(LOG_DEBUG, SPP_FMT "ipcp nak opts: ", @@ -3303,7 +3303,7 @@ sppp_ipcp_RCN_nak(struct sppp *sp, struct lcp_header *h, int len) } if (debug) addlog("\n"); - free (buf, M_TEMP); + kfree (buf, M_TEMP); return; } @@ -3469,7 +3469,7 @@ sppp_ipv6cp_RCR(struct sppp *sp, struct lcp_header *h, int len) * Make sure to allocate a buf that can at least hold a * conf-nak with an `address' option. We might need it below. */ - buf = r = malloc ((len < 6? 6: len), M_TEMP, M_INTWAIT); + buf = r = kmalloc ((len < 6? 6: len), M_TEMP, M_INTWAIT); /* pass 1: see if we can recognize them */ if (debug) @@ -3608,11 +3608,11 @@ sppp_ipv6cp_RCR(struct sppp *sp, struct lcp_header *h, int len) } end: - free (buf, M_TEMP); + kfree (buf, M_TEMP); return (rlen == 0); drop: - free(buf, M_TEMP); + kfree(buf, M_TEMP); return (-1); } @@ -3628,7 +3628,7 @@ sppp_ipv6cp_RCN_rej(struct sppp *sp, struct lcp_header *h, int len) int debug = ifp->if_flags & IFF_DEBUG; len -= 4; - buf = malloc (len, M_TEMP, M_INTWAIT); + buf = kmalloc (len, M_TEMP, M_INTWAIT); if (debug) log(LOG_DEBUG, SPP_FMT "ipv6cp rej opts:", @@ -3662,7 +3662,7 @@ sppp_ipv6cp_RCN_rej(struct sppp *sp, struct lcp_header *h, int len) if (debug) addlog("\n"); drop: - free (buf, M_TEMP); + kfree (buf, M_TEMP); return; } @@ -3679,7 +3679,7 @@ sppp_ipv6cp_RCN_nak(struct sppp *sp, struct lcp_header *h, int len) struct in6_addr suggestaddr; len -= 4; - buf = malloc (len, M_TEMP, M_INTWAIT); + buf = kmalloc (len, M_TEMP, M_INTWAIT); if (debug) log(LOG_DEBUG, SPP_FMT "ipv6cp nak opts:", @@ -3764,7 +3764,7 @@ sppp_ipv6cp_RCN_nak(struct sppp *sp, struct lcp_header *h, int len) if (debug) addlog("\n"); drop: - free (buf, M_TEMP); + kfree (buf, M_TEMP); return; } static void @@ -5130,7 +5130,7 @@ sppp_params(struct sppp *sp, u_long cmd, void *data) struct spppreq *spr; int rv = 0; - spr = malloc(sizeof(struct spppreq), M_TEMP, M_INTWAIT); + spr = kmalloc(sizeof(struct spppreq), M_TEMP, M_INTWAIT); /* * ifr->ifr_data is supposed to point to a struct spppreq. @@ -5272,7 +5272,7 @@ sppp_params(struct sppp *sp, u_long cmd, void *data) } quit: - free(spr, M_TEMP); + kfree(spr, M_TEMP); return (rv); } diff --git a/sys/net/stf/if_stf.c b/sys/net/stf/if_stf.c index 3aff1c6d84..0e3d39f405 100644 --- a/sys/net/stf/if_stf.c +++ b/sys/net/stf/if_stf.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/net/if_stf.c,v 1.1.2.11 2003/01/23 21:06:44 sam Exp $ */ -/* $DragonFly: src/sys/net/stf/if_stf.c,v 1.16 2005/12/11 13:00:17 swildner Exp $ */ +/* $DragonFly: src/sys/net/stf/if_stf.c,v 1.17 2006/09/05 00:55:48 dillon Exp $ */ /* $KAME: if_stf.c,v 1.73 2001/12/03 11:08:30 keiichi Exp $ */ /* @@ -163,7 +163,7 @@ stfmodevent(module_t mod, int type, void *data) switch (type) { case MOD_LOAD: - stf = malloc(sizeof(struct stf_softc), M_STF, M_WAITOK); + stf = kmalloc(sizeof(struct stf_softc), M_STF, M_WAITOK); bzero(stf, sizeof(struct stf_softc)); sc = stf; @@ -197,7 +197,7 @@ stfmodevent(module_t mod, int type, void *data) if_detach(&sc->sc_if); err = encap_detach(sc->encap_cookie); KASSERT(err == 0, ("Unexpected error detaching encap_cookie")); - free(sc, M_STF); + kfree(sc, M_STF); break; } diff --git a/sys/net/tap/if_tap.c b/sys/net/tap/if_tap.c index 4db619c117..0a0a0bf0be 100644 --- a/sys/net/tap/if_tap.c +++ b/sys/net/tap/if_tap.c @@ -32,7 +32,7 @@ /* * $FreeBSD: src/sys/net/if_tap.c,v 1.3.2.3 2002/04/14 21:41:48 luigi Exp $ - * $DragonFly: src/sys/net/tap/if_tap.c,v 1.27 2006/07/28 02:17:40 dillon Exp $ + * $DragonFly: src/sys/net/tap/if_tap.c,v 1.28 2006/09/05 00:55:48 dillon Exp $ * $Id: if_tap.c,v 0.21 2000/07/23 21:46:02 max Exp $ */ @@ -166,7 +166,7 @@ tapmodevent(module_t mod, int type, void *data) ether_ifdetach(ifp); destroy_dev(tp->tap_dev); - free(tp, M_TAP); + kfree(tp, M_TAP); } else unit ++; diff --git a/sys/net/vlan/if_vlan.c b/sys/net/vlan/if_vlan.c index 1a88cfd8e1..745240ed8d 100644 --- a/sys/net/vlan/if_vlan.c +++ b/sys/net/vlan/if_vlan.c @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/net/if_vlan.c,v 1.15.2.13 2003/02/14 22:25:58 fenner Exp $ - * $DragonFly: src/sys/net/vlan/if_vlan.c,v 1.20 2006/01/14 11:05:18 swildner Exp $ + * $DragonFly: src/sys/net/vlan/if_vlan.c,v 1.21 2006/09/05 00:55:48 dillon Exp $ */ /* @@ -155,14 +155,14 @@ vlan_setmulti(struct ifnet *ifp) if (error) return(error); SLIST_REMOVE_HEAD(&sc->vlan_mc_listhead, mc_entries); - free(mc, M_VLAN); + kfree(mc, M_VLAN); } /* Now program new ones. */ LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; - mc = malloc(sizeof(struct vlan_mc_entry), M_VLAN, M_WAITOK); + mc = kmalloc(sizeof(struct vlan_mc_entry), M_VLAN, M_WAITOK); bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr), (char *)&mc->mc_addr, ETHER_ADDR_LEN); SLIST_INSERT_HEAD(&sc->vlan_mc_listhead, mc, mc_entries); @@ -212,7 +212,7 @@ vlan_clone_create(struct if_clone *ifc, int unit) struct ifvlan *ifv; struct ifnet *ifp; - ifv = malloc(sizeof(struct ifvlan), M_VLAN, M_WAITOK | M_ZERO); + ifv = kmalloc(sizeof(struct ifvlan), M_VLAN, M_WAITOK | M_ZERO); ifp = &ifv->ifv_if; SLIST_INIT(&ifv->vlan_mc_listhead); @@ -253,7 +253,7 @@ vlan_clone_destroy(struct ifnet *ifp) crit_exit(); - free(ifv, M_VLAN); + kfree(ifv, M_VLAN); } static void @@ -553,7 +553,7 @@ vlan_unconfig(struct ifnet *ifp) if (error) return(error); SLIST_REMOVE_HEAD(&ifv->vlan_mc_listhead, mc_entries); - free(mc, M_VLAN); + kfree(mc, M_VLAN); } } diff --git a/sys/netgraph/ng_device.c b/sys/netgraph/ng_device.c index c612bde719..29efd6fea5 100644 --- a/sys/netgraph/ng_device.c +++ b/sys/netgraph/ng_device.c @@ -29,7 +29,7 @@ * netgraph node. * * $FreeBSD: src/sys/netgraph/ng_device.c,v 1.1.2.1 2002/08/23 07:15:44 julian Exp $ - * $DragonFly: src/sys/netgraph/ng_device.c,v 1.6 2006/01/14 11:10:47 swildner Exp $ + * $DragonFly: src/sys/netgraph/ng_device.c,v 1.7 2006/09/05 00:55:48 dillon Exp $ * */ @@ -272,7 +272,7 @@ ng_device_newhook(node_p node, hook_p hook, const char *name) printf("%s()\n", __func__); #endif /* NGD_DEBUG */ - new_connection = malloc(sizeof(struct ngd_connection), M_DEVBUF, M_NOWAIT); + new_connection = kmalloc(sizeof(struct ngd_connection), M_DEVBUF, M_NOWAIT); if(new_connection == NULL) { printf("%s(): ERROR: new_connection == NULL\n", __func__); return(-1); @@ -282,7 +282,7 @@ ng_device_newhook(node_p node, hook_p hook, const char *name) if(new_connection->unit<0) { printf("%s: No free unit found by get_free_unit(), " "increas MAX_NGD\n", __func__); - free(new_connection, M_DEVBUF); + kfree(new_connection, M_DEVBUF); return(-1); } new_connection->ngddev = make_dev(&ngd_cdevsw, @@ -290,17 +290,17 @@ ng_device_newhook(node_p node, hook_p hook, const char *name) if(new_connection->ngddev == NULL) { printf("%s(): make_dev failed\n", __func__); SLIST_REMOVE(&sc->head, new_connection, ngd_connection, links); - free(new_connection, M_DEVBUF); + kfree(new_connection, M_DEVBUF); return(-1); } new_connection->readq = - malloc(sizeof(char)*NGD_QUEUE_SIZE, M_DEVBUF, M_NOWAIT | M_ZERO); + kmalloc(sizeof(char)*NGD_QUEUE_SIZE, M_DEVBUF, M_NOWAIT | M_ZERO); if(new_connection->readq == NULL) { printf("%s(): readq malloc failed\n", __func__); destroy_dev(new_connection->ngddev); SLIST_REMOVE(&sc->head, new_connection, ngd_connection, links); - free(new_connection, M_DEVBUF); + kfree(new_connection, M_DEVBUF); return(-1); } @@ -362,7 +362,7 @@ ng_device_rcvdata(hook_p hook, struct mbuf *m, meta_p meta) return(-1); } - buffer = malloc(sizeof(char)*m->m_len, M_DEVBUF, M_NOWAIT | M_ZERO); + buffer = kmalloc(sizeof(char)*m->m_len, M_DEVBUF, M_NOWAIT | M_ZERO); if(buffer == NULL) { printf("%s(): ERROR: buffer malloc failed\n", __func__); return(-1); @@ -376,7 +376,7 @@ ng_device_rcvdata(hook_p hook, struct mbuf *m, meta_p meta) } else printf("%s(): queue full, first read out a bit\n", __func__); - free(buffer, M_DEVBUF); + kfree(buffer, M_DEVBUF); return(0); } @@ -406,7 +406,7 @@ ng_device_disconnect(hook_p hook) return(-1); } - free(connection->readq, M_DEVBUF); + kfree(connection->readq, M_DEVBUF); destroy_dev(connection->ngddev); diff --git a/sys/netinet/in.c b/sys/netinet/in.c index 77f207aa1e..45efc982cb 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -32,7 +32,7 @@ * * @(#)in.c 8.4 (Berkeley) 1/9/95 * $FreeBSD: src/sys/netinet/in.c,v 1.44.2.14 2002/11/08 00:45:50 suz Exp $ - * $DragonFly: src/sys/netinet/in.c,v 1.18 2006/01/14 11:33:50 swildner Exp $ + * $DragonFly: src/sys/netinet/in.c,v 1.19 2006/09/05 00:55:48 dillon Exp $ */ #include "opt_bootp.h" @@ -267,7 +267,7 @@ in_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp, return (EADDRNOTAVAIL); if (ia == (struct in_ifaddr *)0) { ia = (struct in_ifaddr *) - malloc(sizeof *ia, M_IFADDR, M_WAITOK); + kmalloc(sizeof *ia, M_IFADDR, M_WAITOK); if (ia == (struct in_ifaddr *)NULL) return (ENOBUFS); bzero(ia, sizeof *ia); @@ -833,7 +833,7 @@ in_addmulti(struct in_addr *ap, struct ifnet *ifp) /* XXX - if_addmulti uses M_WAITOK. Can this really be called at interrupt time? If so, need to fix if_addmulti. XXX */ - inm = malloc(sizeof *inm, M_IPMADDR, M_WAITOK | M_ZERO); + inm = kmalloc(sizeof *inm, M_IPMADDR, M_WAITOK | M_ZERO); inm->inm_addr = *ap; inm->inm_ifp = ifp; inm->inm_ifma = ifma; @@ -870,7 +870,7 @@ in_delmulti(struct in_multi *inm) my_inm = *inm ; ifma->ifma_protospec = 0; LIST_REMOVE(inm, inm_link); - free(inm, M_IPMADDR); + kfree(inm, M_IPMADDR); } /* XXX - should be separate API for when we have an ifma? */ if_delmulti(ifma->ifma_ifp, ifma->ifma_addr); diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 8d17350acb..23014f11f3 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -82,7 +82,7 @@ * * @(#)in_pcb.c 8.4 (Berkeley) 5/24/95 * $FreeBSD: src/sys/netinet/in_pcb.c,v 1.59.2.27 2004/01/02 04:06:42 ambrisko Exp $ - * $DragonFly: src/sys/netinet/in_pcb.c,v 1.38 2006/01/31 19:05:40 dillon Exp $ + * $DragonFly: src/sys/netinet/in_pcb.c,v 1.39 2006/09/05 00:55:48 dillon Exp $ */ #include "opt_ipsec.h" @@ -660,7 +660,7 @@ in_setsockaddr(struct socket *so, struct sockaddr **nam) inp = so->so_pcb; if (!inp) { crit_exit(); - free(sin, M_SONAME); + kfree(sin, M_SONAME); return (ECONNRESET); } sin->sin_port = inp->inp_lport; @@ -689,7 +689,7 @@ in_setpeeraddr(struct socket *so, struct sockaddr **nam) inp = so->so_pcb; if (!inp) { crit_exit(); - free(sin, M_SONAME); + kfree(sin, M_SONAME); return (ECONNRESET); } sin->sin_port = inp->inp_fport; @@ -1040,7 +1040,7 @@ in_pcbinswildcardhash_oncpu(struct inpcb *inp, struct inpcbinfo *pcbinfo) bucket = &pcbinfo->wildcardhashbase[ INP_PCBWILDCARDHASH(inp->inp_lport, pcbinfo->wildcardhashmask)]; - ic = malloc(sizeof(struct inpcontainer), M_TEMP, M_INTWAIT); + ic = kmalloc(sizeof(struct inpcontainer), M_TEMP, M_INTWAIT); ic->ic_inp = inp; LIST_INSERT_HEAD(bucket, ic, ic_list); } @@ -1077,7 +1077,7 @@ in_pcbremwildcardhash_oncpu(struct inpcb *inp, struct inpcbinfo *pcbinfo) found: LIST_REMOVE(ic, ic_list); /* remove container from bucket chain */ - free(ic, M_TEMP); /* deallocate container */ + kfree(ic, M_TEMP); /* deallocate container */ } /* @@ -1105,7 +1105,7 @@ in_pcbremlists(struct inpcb *inp) LIST_REMOVE(inp, inp_portlist); if (LIST_FIRST(&phd->phd_pcblist) == NULL) { LIST_REMOVE(phd, phd_hash); - free(phd, M_PCB); + kfree(phd, M_PCB); } } if (inp->inp_flags & INP_WILDCARD) { @@ -1161,7 +1161,7 @@ in_pcblist_global(SYSCTL_HANDLER_ARGS) gencnt = pcbinfo->ipi_gencnt; n = pcbinfo->ipi_count; - marker = malloc(sizeof(struct inpcb), M_TEMP, M_WAITOK|M_ZERO); + marker = kmalloc(sizeof(struct inpcb), M_TEMP, M_WAITOK|M_ZERO); marker->inp_flags |= INP_PLACEMARKER; LIST_INSERT_HEAD(&pcbinfo->pcblisthead, marker, inp_list); @@ -1196,6 +1196,6 @@ in_pcblist_global(SYSCTL_HANDLER_ARGS) ++i; } } - free(marker, M_TEMP); + kfree(marker, M_TEMP); return(error); } diff --git a/sys/netinet/ip_encap.c b/sys/netinet/ip_encap.c index b11bef3639..9f8e06301d 100644 --- a/sys/netinet/ip_encap.c +++ b/sys/netinet/ip_encap.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netinet/ip_encap.c,v 1.1.2.5 2003/01/23 21:06:45 sam Exp $ */ -/* $DragonFly: src/sys/netinet/ip_encap.c,v 1.14 2006/01/14 11:33:50 swildner Exp $ */ +/* $DragonFly: src/sys/netinet/ip_encap.c,v 1.15 2006/09/05 00:55:48 dillon Exp $ */ /* $KAME: ip_encap.c,v 1.41 2001/03/15 08:35:08 itojun Exp $ */ /* @@ -342,7 +342,7 @@ encap_attach(int af, int proto, const struct sockaddr *sp, goto fail; } - ep = malloc(sizeof *ep, M_NETADDR, M_INTWAIT | M_ZERO | M_NULLOK); + ep = kmalloc(sizeof *ep, M_NETADDR, M_INTWAIT | M_ZERO | M_NULLOK); if (ep == NULL) { error = ENOBUFS; goto fail; @@ -383,7 +383,7 @@ encap_attach_func(int af, int proto, goto fail; } - ep = malloc(sizeof *ep, M_NETADDR, M_INTWAIT | M_ZERO | M_NULLOK); + ep = kmalloc(sizeof *ep, M_NETADDR, M_INTWAIT | M_ZERO | M_NULLOK); if (ep == NULL) { error = ENOBUFS; goto fail; @@ -415,7 +415,7 @@ encap_detach(const struct encaptab *cookie) for (p = LIST_FIRST(&encaptab); p; p = LIST_NEXT(p, chain)) { if (p == ep) { LIST_REMOVE(p, chain); - free(p, M_NETADDR); /*XXX*/ + kfree(p, M_NETADDR); /*XXX*/ return 0; } } diff --git a/sys/netinet/ip_flow.c b/sys/netinet/ip_flow.c index 0a9313d894..11954b4f47 100644 --- a/sys/netinet/ip_flow.c +++ b/sys/netinet/ip_flow.c @@ -34,7 +34,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/netinet/ip_flow.c,v 1.9.2.2 2001/11/04 17:35:31 luigi Exp $ - * $DragonFly: src/sys/netinet/ip_flow.c,v 1.9 2005/11/28 17:13:46 dillon Exp $ + * $DragonFly: src/sys/netinet/ip_flow.c,v 1.10 2006/09/05 00:55:48 dillon Exp $ */ #include @@ -201,7 +201,7 @@ ipflow_free(struct ipflow *ipf) ipflow_addstats(ipf); RTFREE(ipf->ipf_ro.ro_rt); ipflow_inuse--; - free(ipf, M_IPFLOW); + kfree(ipf, M_IPFLOW); } static struct ipflow * @@ -292,7 +292,7 @@ ipflow_create(const struct route *ro, struct mbuf *m) if (ipflow_inuse == IPFLOW_MAX) { ipf = ipflow_reap(); } else { - ipf = malloc(sizeof *ipf, M_IPFLOW, + ipf = kmalloc(sizeof *ipf, M_IPFLOW, M_INTWAIT | M_NULLOK); if (ipf == NULL) return; diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index 0f63478eb1..86cc20269c 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -82,7 +82,7 @@ * * @(#)ip_input.c 8.2 (Berkeley) 1/4/94 * $FreeBSD: src/sys/netinet/ip_input.c,v 1.130.2.52 2003/03/07 07:01:28 silby Exp $ - * $DragonFly: src/sys/netinet/ip_input.c,v 1.62 2006/05/20 06:32:40 dillon Exp $ + * $DragonFly: src/sys/netinet/ip_input.c,v 1.63 2006/09/05 00:55:48 dillon Exp $ */ #define _IP_VHL @@ -1099,7 +1099,7 @@ DPRINTF(("ip_input: no SP, packet discarded\n"));/*XXX*/ if (port == NULL) return; - msg = malloc(sizeof(struct netmsg_transport_packet), M_LWKTMSG, + msg = kmalloc(sizeof(struct netmsg_transport_packet), M_LWKTMSG, M_INTWAIT | M_NULLOK); if (msg == NULL) goto bad; diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 00efd84d66..9eb2249be2 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -28,7 +28,7 @@ * * @(#)ip_output.c 8.3 (Berkeley) 1/21/94 * $FreeBSD: src/sys/netinet/ip_output.c,v 1.99.2.37 2003/04/15 06:44:45 silby Exp $ - * $DragonFly: src/sys/netinet/ip_output.c,v 1.34 2005/12/27 18:42:31 dillon Exp $ + * $DragonFly: src/sys/netinet/ip_output.c,v 1.35 2006/09/05 00:55:48 dillon Exp $ */ #define _IP_VHL @@ -1776,7 +1776,7 @@ ip_setmoptions(struct sockopt *sopt, struct ip_moptions **imop) * No multicast option buffer attached to the pcb; * allocate one and initialize to default values. */ - imo = malloc(sizeof *imo, M_IPMOPTS, M_WAITOK); + imo = kmalloc(sizeof *imo, M_IPMOPTS, M_WAITOK); if (imo == NULL) return (ENOBUFS); @@ -2044,7 +2044,7 @@ ip_setmoptions(struct sockopt *sopt, struct ip_moptions **imop) imo->imo_multicast_ttl == IP_DEFAULT_MULTICAST_TTL && imo->imo_multicast_loop == IP_DEFAULT_MULTICAST_LOOP && imo->imo_num_memberships == 0) { - free(*imop, M_IPMOPTS); + kfree(*imop, M_IPMOPTS); *imop = NULL; } @@ -2126,7 +2126,7 @@ ip_freemoptions(struct ip_moptions *imo) if (imo != NULL) { for (i = 0; i < imo->imo_num_memberships; ++i) in_delmulti(imo->imo_membership[i]); - free(imo, M_IPMOPTS); + kfree(imo, M_IPMOPTS); } } diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 2197de32bb..ab043d7d69 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -82,7 +82,7 @@ * * @(#)tcp_input.c 8.12 (Berkeley) 5/24/95 * $FreeBSD: src/sys/netinet/tcp_input.c,v 1.107.2.38 2003/05/21 04:46:41 cjc Exp $ - * $DragonFly: src/sys/netinet/tcp_input.c,v 1.62 2005/08/29 10:24:10 demizu Exp $ + * $DragonFly: src/sys/netinet/tcp_input.c,v 1.63 2006/09/05 00:55:48 dillon Exp $ */ #include "opt_ipfw.h" /* for ipfw_fwd */ @@ -342,7 +342,7 @@ tcp_reass(struct tcpcb *tp, struct tcphdr *th, int *tlenp, struct mbuf *m) tcpstat.tcps_rcvduppack++; tcpstat.tcps_rcvdupbyte += *tlenp; m_freem(m); - free(te, M_TSEGQ); + kfree(te, M_TSEGQ); tcp_reass_qsize--; /* * Try to present any queued data @@ -397,7 +397,7 @@ tcp_reass(struct tcpcb *tp, struct tcphdr *th, int *tlenp, struct mbuf *m) nq = LIST_NEXT(q, tqe_q); LIST_REMOVE(q, tqe_q); m_freem(q->tqe_m); - free(q, M_TSEGQ); + kfree(q, M_TSEGQ); tcp_reass_qsize--; q = nq; } @@ -423,7 +423,7 @@ tcp_reass(struct tcpcb *tp, struct tcphdr *th, int *tlenp, struct mbuf *m) if (!(tp->t_flags & TF_DUPSEG)) tp->reportblk.rblk_end = tend; LIST_REMOVE(q, tqe_q); - free(q, M_TSEGQ); + kfree(q, M_TSEGQ); tcp_reass_qsize--; } @@ -441,7 +441,7 @@ tcp_reass(struct tcpcb *tp, struct tcphdr *th, int *tlenp, struct mbuf *m) */ if (!(tp->t_flags & TF_DUPSEG)) tp->reportblk.rblk_start = p->tqe_th->th_seq; - free(te, M_TSEGQ); + kfree(te, M_TSEGQ); tcp_reass_qsize--; } else LIST_INSERT_AFTER(p, te, tqe_q); @@ -473,7 +473,7 @@ present: m_freem(q->tqe_m); else sbappendstream(&so->so_rcv, q->tqe_m); - free(q, M_TSEGQ); + kfree(q, M_TSEGQ); tcp_reass_qsize--; ND6_HINT(tp); sorwakeup(so); diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 9bcfb4c246..58cf4476ea 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -82,7 +82,7 @@ * * @(#)tcp_subr.c 8.2 (Berkeley) 5/24/95 * $FreeBSD: src/sys/netinet/tcp_subr.c,v 1.73.2.31 2003/01/24 05:11:34 sam Exp $ - * $DragonFly: src/sys/netinet/tcp_subr.c,v 1.51 2006/01/14 11:33:50 swildner Exp $ + * $DragonFly: src/sys/netinet/tcp_subr.c,v 1.52 2006/09/05 00:55:48 dillon Exp $ */ #include "opt_compat.h" @@ -1128,7 +1128,7 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS) if (req->newptr != NULL) return (EPERM); - marker = malloc(sizeof(struct inpcb), M_TEMP, M_WAITOK|M_ZERO); + marker = kmalloc(sizeof(struct inpcb), M_TEMP, M_WAITOK|M_ZERO); marker->inp_flags |= INP_PLACEMARKER; /* @@ -1204,7 +1204,7 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS) * on a different cpu. */ lwkt_setcpu_self(globaldata_find(origcpu)); - free(marker, M_TEMP); + kfree(marker, M_TEMP); return (error); } diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index 68f437f534..3237ad4691 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -82,7 +82,7 @@ * * From: @(#)tcp_usrreq.c 8.2 (Berkeley) 1/3/94 * $FreeBSD: src/sys/netinet/tcp_usrreq.c,v 1.51.2.17 2002/10/11 11:46:44 ume Exp $ - * $DragonFly: src/sys/netinet/tcp_usrreq.c,v 1.37 2006/01/14 11:33:50 swildner Exp $ + * $DragonFly: src/sys/netinet/tcp_usrreq.c,v 1.38 2006/09/05 00:55:48 dillon Exp $ */ #include "opt_ipsec.h" @@ -380,7 +380,7 @@ tcp_usr_listen(struct socket *so, struct thread *td) continue; } - msg = malloc(sizeof(struct netmsg_inswildcard), M_LWKTMSG, + msg = kmalloc(sizeof(struct netmsg_inswildcard), M_LWKTMSG, M_INTWAIT); lwkt_initmsg(&msg->nm_lmsg, &netisr_afree_rport, 0, lwkt_cmd_func(in_pcbinswildcardhash_handler), @@ -430,7 +430,7 @@ tcp6_usr_listen(struct socket *so, struct thread *td) continue; } - msg = malloc(sizeof(struct netmsg_inswildcard), M_LWKTMSG, + msg = kmalloc(sizeof(struct netmsg_inswildcard), M_LWKTMSG, M_INTWAIT); lwkt_initmsg(&msg->nm_lmsg, &netisr_afree_rport, 0, lwkt_cmd_func(in_pcbinswildcardhash_handler), diff --git a/sys/netinet6/ah_core.c b/sys/netinet6/ah_core.c index f0c421c6cf..62c4572257 100644 --- a/sys/netinet6/ah_core.c +++ b/sys/netinet6/ah_core.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netinet6/ah_core.c,v 1.2.2.5 2002/04/28 05:40:26 suz Exp $ */ -/* $DragonFly: src/sys/netinet6/ah_core.c,v 1.6 2004/06/02 14:43:01 eirikn Exp $ */ +/* $DragonFly: src/sys/netinet6/ah_core.c,v 1.7 2006/09/05 00:55:48 dillon Exp $ */ /* $KAME: ah_core.c,v 1.44 2001/03/12 11:24:39 itojun Exp $ */ /* @@ -264,7 +264,7 @@ ah_keyed_md5_init(struct ah_algorithm_state *state, struct secasvar *sav) panic("ah_keyed_md5_init: what?"); state->sav = sav; - state->foo = (void *)malloc(sizeof(MD5_CTX), M_TEMP, M_NOWAIT); + state->foo = (void *)kmalloc(sizeof(MD5_CTX), M_TEMP, M_NOWAIT); if (state->foo == NULL) return ENOBUFS; @@ -332,7 +332,7 @@ ah_keyed_md5_result(struct ah_algorithm_state *state, caddr_t addr) (u_int)_KEYLEN(state->sav->key_auth)); } MD5Final(&digest[0], (MD5_CTX *)state->foo); - free(state->foo, M_TEMP); + kfree(state->foo, M_TEMP); bcopy(&digest[0], (void *)addr, sizeof(digest)); } @@ -375,7 +375,7 @@ ah_keyed_sha1_init(struct ah_algorithm_state *state, struct secasvar *sav) panic("ah_keyed_sha1_init: what?"); state->sav = sav; - state->foo = (void *)malloc(sizeof(SHA1_CTX), M_TEMP, M_NOWAIT); + state->foo = (void *)kmalloc(sizeof(SHA1_CTX), M_TEMP, M_NOWAIT); if (!state->foo) return ENOBUFS; @@ -448,7 +448,7 @@ ah_keyed_sha1_result(struct ah_algorithm_state *state, caddr_t addr) SHA1Final((caddr_t)&digest[0], ctxt); bcopy(&digest[0], (void *)addr, HMACSIZE); - free(state->foo, M_TEMP); + kfree(state->foo, M_TEMP); } static int @@ -493,7 +493,7 @@ ah_hmac_md5_init(struct ah_algorithm_state *state, struct secasvar *sav) panic("ah_hmac_md5_init: what?"); state->sav = sav; - state->foo = (void *)malloc(64 + 64 + sizeof(MD5_CTX), M_TEMP, M_NOWAIT); + state->foo = (void *)kmalloc(64 + 64 + sizeof(MD5_CTX), M_TEMP, M_NOWAIT); if (!state->foo) return ENOBUFS; @@ -564,7 +564,7 @@ ah_hmac_md5_result(struct ah_algorithm_state *state, caddr_t addr) bcopy(&digest[0], (void *)addr, HMACSIZE); - free(state->foo, M_TEMP); + kfree(state->foo, M_TEMP); } static int @@ -682,7 +682,7 @@ ah_hmac_sha1_result(struct ah_algorithm_state *state, caddr_t addr) bcopy(&digest[0], (void *)addr, HMACSIZE); - free(state->foo, M_TEMP); + kfree(state->foo, M_TEMP); } static int @@ -807,7 +807,7 @@ ah_hmac_sha2_256_result(struct ah_algorithm_state *state, caddr_t addr) bcopy(&digest[0], (void *)addr, HMACSIZE); - free(state->foo, M_TEMP); + kfree(state->foo, M_TEMP); } static int @@ -933,7 +933,7 @@ ah_hmac_sha2_384_result(struct ah_algorithm_state *state, caddr_t addr) bcopy(&digest[0], (void *)addr, HMACSIZE); - free(state->foo, M_TEMP); + kfree(state->foo, M_TEMP); } static int @@ -1059,7 +1059,7 @@ ah_hmac_sha2_512_result(struct ah_algorithm_state *state, caddr_t addr) bcopy(&digest[0], (void *)addr, HMACSIZE); - free(state->foo, M_TEMP); + kfree(state->foo, M_TEMP); } /*------------------------------------------------------------*/ diff --git a/sys/netinet6/ah_input.c b/sys/netinet6/ah_input.c index 6efe8bdf4d..ec7f987c01 100644 --- a/sys/netinet6/ah_input.c +++ b/sys/netinet6/ah_input.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netinet6/ah_input.c,v 1.1.2.6 2002/04/28 05:40:26 suz Exp $ */ -/* $DragonFly: src/sys/netinet6/ah_input.c,v 1.11 2006/05/01 16:25:41 dillon Exp $ */ +/* $DragonFly: src/sys/netinet6/ah_input.c,v 1.12 2006/09/05 00:55:48 dillon Exp $ */ /* $KAME: ah_input.c,v 1.67 2002/01/07 11:39:56 kjc Exp $ */ /* @@ -273,7 +273,7 @@ ah4_input(struct mbuf *m, ...) * alright, it seems sane. now we are going to check the * cryptographic checksum. */ - cksum = malloc(siz1, M_TEMP, M_NOWAIT); + cksum = kmalloc(siz1, M_TEMP, M_NOWAIT); if (!cksum) { ipseclog((LOG_DEBUG, "IPv4 AH input: " "couldn't alloc temporary region for cksum\n")); @@ -288,7 +288,7 @@ ah4_input(struct mbuf *m, ...) ip->ip_len = htons(ip->ip_len + hlen); ip->ip_off = htons(ip->ip_off); if (ah4_calccksum(m, (caddr_t)cksum, siz1, algo, sav)) { - free(cksum, M_TEMP); + kfree(cksum, M_TEMP); ipsecstat.in_inval++; goto fail; } @@ -314,13 +314,13 @@ ah4_input(struct mbuf *m, ...) ipseclog((LOG_WARNING, "checksum mismatch in IPv4 AH input: %s %s\n", ipsec4_logpacketstr(ip, spi), ipsec_logsastr(sav))); - free(cksum, M_TEMP); + kfree(cksum, M_TEMP); ipsecstat.in_ahauthfail++; goto fail; } } - free(cksum, M_TEMP); + kfree(cksum, M_TEMP); m->m_flags |= M_AUTHIPHDR; m->m_flags |= M_AUTHIPDGM; @@ -701,7 +701,7 @@ ah6_input(struct mbuf **mp, int *offp, int proto) * alright, it seems sane. now we are going to check the * cryptographic checksum. */ - cksum = malloc(siz1, M_TEMP, M_NOWAIT); + cksum = kmalloc(siz1, M_TEMP, M_NOWAIT); if (!cksum) { ipseclog((LOG_DEBUG, "IPv6 AH input: " "couldn't alloc temporary region for cksum\n")); @@ -710,7 +710,7 @@ ah6_input(struct mbuf **mp, int *offp, int proto) } if (ah6_calccksum(m, (caddr_t)cksum, siz1, algo, sav)) { - free(cksum, M_TEMP); + kfree(cksum, M_TEMP); ipsec6stat.in_inval++; goto fail; } @@ -731,13 +731,13 @@ ah6_input(struct mbuf **mp, int *offp, int proto) ipseclog((LOG_WARNING, "checksum mismatch in IPv6 AH input: %s %s\n", ipsec6_logpacketstr(ip6, spi), ipsec_logsastr(sav))); - free(cksum, M_TEMP); + kfree(cksum, M_TEMP); ipsec6stat.in_ahauthfail++; goto fail; } } - free(cksum, M_TEMP); + kfree(cksum, M_TEMP); m->m_flags |= M_AUTHIPHDR; m->m_flags |= M_AUTHIPDGM; diff --git a/sys/netinet6/esp_core.c b/sys/netinet6/esp_core.c index 916ce1bd7f..032cdf5821 100644 --- a/sys/netinet6/esp_core.c +++ b/sys/netinet6/esp_core.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netinet6/esp_core.c,v 1.1.2.4 2002/03/26 10:12:29 ume Exp $ */ -/* $DragonFly: src/sys/netinet6/esp_core.c,v 1.8 2006/05/01 16:26:29 dillon Exp $ */ +/* $DragonFly: src/sys/netinet6/esp_core.c,v 1.9 2006/09/05 00:55:48 dillon Exp $ */ /* $KAME: esp_core.c,v 1.50 2000/11/02 12:27:38 itojun Exp $ */ /* @@ -217,7 +217,7 @@ esp_schedule(const struct esp_algorithm *algo, struct secasvar *sav) sav->schedlen = (*algo->schedlen)(algo); if (sav->schedlen < 0) return EINVAL; - sav->sched = malloc(sav->schedlen, M_SECA, M_NOWAIT); + sav->sched = kmalloc(sav->schedlen, M_SECA, M_NOWAIT); if (!sav->sched) { sav->schedlen = 0; return ENOBUFS; @@ -227,7 +227,7 @@ esp_schedule(const struct esp_algorithm *algo, struct secasvar *sav) if (error) { ipseclog((LOG_ERR, "esp_schedule %s: error %d\n", algo->name, error)); - free(sav->sched, M_SECA); + kfree(sav->sched, M_SECA); sav->sched = NULL; sav->schedlen = 0; } diff --git a/sys/netinet6/frag6.c b/sys/netinet6/frag6.c index 955406ca1d..280ccfc310 100644 --- a/sys/netinet6/frag6.c +++ b/sys/netinet6/frag6.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netinet6/frag6.c,v 1.2.2.6 2002/04/28 05:40:26 suz Exp $ */ -/* $DragonFly: src/sys/netinet6/frag6.c,v 1.9 2006/09/03 18:52:29 dillon Exp $ */ +/* $DragonFly: src/sys/netinet6/frag6.c,v 1.10 2006/09/05 00:55:48 dillon Exp $ */ /* $KAME: frag6.c,v 1.33 2002/01/07 11:34:48 kjc Exp $ */ /* @@ -232,7 +232,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) else if (frag6_nfragpackets >= (u_int)ip6_maxfragpackets) goto dropfrag; frag6_nfragpackets++; - q6 = (struct ip6q *)malloc(sizeof(struct ip6q), M_FTABLE, + q6 = (struct ip6q *)kmalloc(sizeof(struct ip6q), M_FTABLE, M_NOWAIT); if (q6 == NULL) goto dropfrag; @@ -304,7 +304,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) /* dequeue the fragment. */ frag6_deq(af6); - free(af6, M_FTABLE); + kfree(af6, M_FTABLE); /* adjust pointer. */ ip6err = mtod(merr, struct ip6_hdr *); @@ -324,7 +324,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) } } - ip6af = (struct ip6asfrag *)malloc(sizeof(struct ip6asfrag), M_FTABLE, + ip6af = (struct ip6asfrag *)kmalloc(sizeof(struct ip6asfrag), M_FTABLE, M_NOWAIT); if (ip6af == NULL) goto dropfrag; @@ -402,7 +402,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) "overlaps the previous fragment\n", i, ip6_sprintf(&q6->ip6q_src)); #endif - free(ip6af, M_FTABLE); + kfree(ip6af, M_FTABLE); goto dropfrag; } } @@ -414,7 +414,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) "overlaps the succeeding fragment", i, ip6_sprintf(&q6->ip6q_src)); #endif - free(ip6af, M_FTABLE); + kfree(ip6af, M_FTABLE); goto dropfrag; } } @@ -463,13 +463,13 @@ insert: t = t->m_next; t->m_next = IP6_REASS_MBUF(af6); m_adj(t->m_next, af6->ip6af_offset); - free(af6, M_FTABLE); + kfree(af6, M_FTABLE); af6 = af6dwn; } /* adjust offset to point where the original next header starts */ offset = ip6af->ip6af_offset - sizeof(struct ip6_frag); - free(ip6af, M_FTABLE); + kfree(ip6af, M_FTABLE); ip6 = mtod(m, struct ip6_hdr *); ip6->ip6_plen = htons((u_short)next + offset - sizeof(struct ip6_hdr)); ip6->ip6_src = q6->ip6q_src; @@ -491,7 +491,7 @@ insert: /* this comes with no copy if the boundary is on cluster */ if ((t = m_split(m, offset, MB_DONTWAIT)) == NULL) { frag6_remque(q6); - free(q6, M_FTABLE); + kfree(q6, M_FTABLE); frag6_nfragpackets--; goto dropfrag; } @@ -508,7 +508,7 @@ insert: } frag6_remque(q6); - free(q6, M_FTABLE); + kfree(q6, M_FTABLE); frag6_nfragpackets--; if (m->m_flags & M_PKTHDR) { /* Isn't it always true? */ @@ -573,10 +573,10 @@ frag6_freef(struct ip6q *q6) ICMP6_TIME_EXCEED_REASSEMBLY, 0); } else m_freem(m); - free(af6, M_FTABLE); + kfree(af6, M_FTABLE); } frag6_remque(q6); - free(q6, M_FTABLE); + kfree(q6, M_FTABLE); frag6_nfragpackets--; } diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index c01820664e..ac4c8a8aea 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netinet6/in6.c,v 1.7.2.9 2002/04/28 05:40:26 suz Exp $ */ -/* $DragonFly: src/sys/netinet6/in6.c,v 1.19 2006/09/03 18:29:17 dillon Exp $ */ +/* $DragonFly: src/sys/netinet6/in6.c,v 1.20 2006/09/05 00:55:48 dillon Exp $ */ /* $KAME: in6.c,v 1.259 2002/01/21 11:37:50 keiichi Exp $ */ /* @@ -905,7 +905,7 @@ in6_update_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra, * with M_NOWAIT. */ ia = (struct in6_ifaddr *) - malloc(sizeof(*ia), M_IFADDR, M_NOWAIT); + kmalloc(sizeof(*ia), M_IFADDR, M_NOWAIT); if (ia == NULL) return (ENOBUFS); bzero((caddr_t)ia, sizeof(*ia)); @@ -1657,7 +1657,7 @@ in6_addmulti(struct in6_addr *maddr6, struct ifnet *ifp, int *errorp) /* XXX - if_addmulti uses M_WAITOK. Can this really be called at interrupt time? If so, need to fix if_addmulti. XXX */ - in6m = (struct in6_multi *)malloc(sizeof(*in6m), M_IPMADDR, M_NOWAIT); + in6m = (struct in6_multi *)kmalloc(sizeof(*in6m), M_IPMADDR, M_NOWAIT); if (in6m == NULL) { crit_exit(); return (NULL); @@ -1697,7 +1697,7 @@ in6_delmulti(struct in6_multi *in6m) mld6_stop_listening(in6m); ifma->ifma_protospec = 0; LIST_REMOVE(in6m, in6m_entry); - free(in6m, M_IPMADDR); + kfree(in6m, M_IPMADDR); } /* XXX - should be separate API for when we have an ifma? */ if_delmulti(ifma->ifma_ifp, ifma->ifma_addr); @@ -2354,7 +2354,7 @@ in6_domifattach(struct ifnet *ifp) { struct in6_ifextra *ext; - ext = (struct in6_ifextra *)malloc(sizeof(*ext), M_IFADDR, M_WAITOK); + ext = (struct in6_ifextra *)kmalloc(sizeof(*ext), M_IFADDR, M_WAITOK); bzero(ext, sizeof(*ext)); ext->in6_ifstat = (struct in6_ifstat *)malloc(sizeof(struct in6_ifstat), @@ -2377,9 +2377,9 @@ in6_domifdetach(struct ifnet *ifp, void *aux) struct in6_ifextra *ext = (struct in6_ifextra *)aux; scope6_ifdetach(ext->scope6_id); nd6_ifdetach(ext->nd_ifinfo); - free(ext->in6_ifstat, M_IFADDR); - free(ext->icmp6_ifstat, M_IFADDR); - free(ext, M_IFADDR); + kfree(ext->in6_ifstat, M_IFADDR); + kfree(ext->icmp6_ifstat, M_IFADDR); + kfree(ext, M_IFADDR); } /* diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c index 34daaceb8a..ba4cd48de4 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netinet6/in6_pcb.c,v 1.10.2.9 2003/01/24 05:11:35 sam Exp $ */ -/* $DragonFly: src/sys/netinet6/in6_pcb.c,v 1.29 2006/09/03 18:29:17 dillon Exp $ */ +/* $DragonFly: src/sys/netinet6/in6_pcb.c,v 1.30 2006/09/05 00:55:48 dillon Exp $ */ /* $KAME: in6_pcb.c,v 1.31 2001/05/21 05:45:10 jinmei Exp $ */ /* @@ -646,7 +646,7 @@ in6_setsockaddr(struct socket *so, struct sockaddr **nam) inp = so->so_pcb; if (!inp) { crit_exit(); - free(sin6, M_SONAME); + kfree(sin6, M_SONAME); return EINVAL; } sin6->sin6_port = inp->inp_lport; @@ -681,7 +681,7 @@ in6_setpeeraddr(struct socket *so, struct sockaddr **nam) inp = so->so_pcb; if (!inp) { crit_exit(); - free(sin6, M_SONAME); + kfree(sin6, M_SONAME); return EINVAL; } sin6->sin6_port = inp->inp_fport; @@ -920,7 +920,7 @@ in6_pcbpurgeif0(struct in6pcb *head, struct ifnet *ifp) if (imm->i6mm_maddr->in6m_ifp == ifp) { LIST_REMOVE(imm, i6mm_chain); in6_delmulti(imm->i6mm_maddr); - free(imm, M_IPMADDR); + kfree(imm, M_IPMADDR); } } } diff --git a/sys/netinet6/in6_prefix.c b/sys/netinet6/in6_prefix.c index 12f2750c9d..5963ed5607 100644 --- a/sys/netinet6/in6_prefix.c +++ b/sys/netinet6/in6_prefix.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netinet6/in6_prefix.c,v 1.4.2.3 2001/07/03 11:01:52 ume Exp $ */ -/* $DragonFly: src/sys/netinet6/in6_prefix.c,v 1.8 2006/01/14 11:44:25 swildner Exp $ */ +/* $DragonFly: src/sys/netinet6/in6_prefix.c,v 1.9 2006/09/05 00:55:48 dillon Exp $ */ /* $KAME: in6_prefix.c,v 1.47 2001/03/25 08:41:39 itojun Exp $ */ /* @@ -550,7 +550,7 @@ in6_prefix_remove_ifid(int iilen, struct in6_ifaddr *ia) crit_exit(); if (rap->ra_addr) IFAFREE(&rap->ra_addr->ia_ifa); - free(rap, M_RR_ADDR); + kfree(rap, M_RR_ADDR); } if (LIST_EMPTY(&ifpr2rp(ia->ia6_ifpr)->rp_addrhead)) @@ -717,7 +717,7 @@ rrpr_update(struct socket *so, struct rr_prefix *new) != NULL) { if (rap->ra_addr) IFAFREE(&rap->ra_addr->ia_ifa); - free(rap, M_RR_ADDR); + kfree(rap, M_RR_ADDR); continue; } crit_enter(); @@ -729,7 +729,7 @@ rrpr_update(struct socket *so, struct rr_prefix *new) * We got a fresh prefix. */ /* create new prefix */ - rpp = (struct rr_prefix *)malloc(sizeof(*rpp), M_IP6RR, + rpp = (struct rr_prefix *)kmalloc(sizeof(*rpp), M_IP6RR, M_NOWAIT); if (rpp == NULL) { log(LOG_ERR, "in6_prefix.c: rrpr_update:%d" @@ -824,13 +824,13 @@ rp_remove(struct rr_prefix *rpp) /* unlink rp_entry from rr_prefix list */ LIST_REMOVE(rpp, rp_entry); crit_exit(); - free(rpp, M_IP6RR); + kfree(rpp, M_IP6RR); } static int create_ra_entry(struct rp_addr **rapp) { - *rapp = (struct rp_addr *)malloc(sizeof(struct rp_addr), M_RR_ADDR, + *rapp = (struct rp_addr *)kmalloc(sizeof(struct rp_addr), M_RR_ADDR, M_NOWAIT); if (*rapp == NULL) { log(LOG_ERR, "in6_prefix.c: init_newprefix:%d: ENOBUFS" @@ -907,7 +907,7 @@ free_rp_entries(struct rr_prefix *rpp) LIST_REMOVE(rap, ra_entry); if (rap->ra_addr) IFAFREE(&rap->ra_addr->ia_ifa); - free(rap, M_RR_ADDR); + kfree(rap, M_RR_ADDR); } } @@ -972,14 +972,14 @@ delete_each_prefix(struct rr_prefix *rpp, u_char origin) LIST_REMOVE(rap, ra_entry); crit_exit(); if (rap->ra_addr == NULL) { - free(rap, M_RR_ADDR); + kfree(rap, M_RR_ADDR); continue; } rap->ra_addr->ia6_ifpr = NULL; in6_purgeaddr(&rap->ra_addr->ia_ifa); IFAFREE(&rap->ra_addr->ia_ifa); - free(rap, M_RR_ADDR); + kfree(rap, M_RR_ADDR); } rp_remove(rpp); diff --git a/sys/netinet6/ip6_mroute.c b/sys/netinet6/ip6_mroute.c index e7bd9e0518..0d23613788 100644 --- a/sys/netinet6/ip6_mroute.c +++ b/sys/netinet6/ip6_mroute.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netinet6/ip6_mroute.c,v 1.2.2.9 2003/01/23 21:06:47 sam Exp $ */ -/* $DragonFly: src/sys/netinet6/ip6_mroute.c,v 1.12 2006/09/03 18:29:17 dillon Exp $ */ +/* $DragonFly: src/sys/netinet6/ip6_mroute.c,v 1.13 2006/09/05 00:55:48 dillon Exp $ */ /* $KAME: ip6_mroute.c,v 1.58 2001/12/18 02:36:31 itojun Exp $ */ /* @@ -477,12 +477,12 @@ ip6_mrouter_done(void) struct rtdetq *n = rte->next; m_free(rte->m); - free(rte, M_MRTABLE); + kfree(rte, M_MRTABLE); rte = n; } frt = rt; rt = rt->mf6c_next; - free(frt, M_MRTABLE); + kfree(frt, M_MRTABLE); } } @@ -712,7 +712,7 @@ add_m6fc(struct mf6cctl *mfccp) #ifdef UPCALL_TIMING collate(&(rte->t)); #endif /* UPCALL_TIMING */ - free(rte, M_MRTABLE); + kfree(rte, M_MRTABLE); rte = n; } rt->mf6c_stall = NULL; @@ -755,7 +755,7 @@ add_m6fc(struct mf6cctl *mfccp) } if (rt == NULL) { /* no upcall, so make a new entry */ - rt = (struct mf6c *)malloc(sizeof(*rt), M_MRTABLE, + rt = (struct mf6c *)kmalloc(sizeof(*rt), M_MRTABLE, M_NOWAIT); if (rt == NULL) { crit_exit(); @@ -851,7 +851,7 @@ del_m6fc(struct mf6cctl *mfccp) } *nptr = rt->mf6c_next; - free(rt, M_MRTABLE); + kfree(rt, M_MRTABLE); crit_exit(); @@ -969,7 +969,7 @@ ip6_mforward(struct ip6_hdr *ip6, struct ifnet *ifp, struct mbuf *m) * Allocate mbufs early so that we don't do extra work if we * are just going to fail anyway. */ - rte = (struct rtdetq *)malloc(sizeof(*rte), M_MRTABLE, + rte = (struct rtdetq *)kmalloc(sizeof(*rte), M_MRTABLE, M_NOWAIT); if (rte == NULL) { crit_exit(); @@ -984,7 +984,7 @@ ip6_mforward(struct ip6_hdr *ip6, struct ifnet *ifp, struct mbuf *m) (M_HASCL(mb0) || mb0->m_len < sizeof(struct ip6_hdr))) mb0 = m_pullup(mb0, sizeof(struct ip6_hdr)); if (mb0 == NULL) { - free(rte, M_MRTABLE); + kfree(rte, M_MRTABLE); crit_exit(); return ENOBUFS; } @@ -1007,10 +1007,10 @@ ip6_mforward(struct ip6_hdr *ip6, struct ifnet *ifp, struct mbuf *m) #endif /* no upcall, so make a new entry */ - rt = (struct mf6c *)malloc(sizeof(*rt), M_MRTABLE, + rt = (struct mf6c *)kmalloc(sizeof(*rt), M_MRTABLE, M_NOWAIT); if (rt == NULL) { - free(rte, M_MRTABLE); + kfree(rte, M_MRTABLE); m_freem(mb0); crit_exit(); return ENOBUFS; @@ -1022,9 +1022,9 @@ ip6_mforward(struct ip6_hdr *ip6, struct ifnet *ifp, struct mbuf *m) mm = m_copy(mb0, 0, sizeof(struct ip6_hdr)); if (mm == NULL) { - free(rte, M_MRTABLE); + kfree(rte, M_MRTABLE); m_freem(mb0); - free(rt, M_MRTABLE); + kfree(rt, M_MRTABLE); crit_exit(); return ENOBUFS; } @@ -1052,9 +1052,9 @@ ip6_mforward(struct ip6_hdr *ip6, struct ifnet *ifp, struct mbuf *m) im->im6_mbz = 0; break; default: - free(rte, M_MRTABLE); + kfree(rte, M_MRTABLE); m_freem(mb0); - free(rt, M_MRTABLE); + kfree(rt, M_MRTABLE); crit_exit(); return EINVAL; } @@ -1085,9 +1085,9 @@ ip6_mforward(struct ip6_hdr *ip6, struct ifnet *ifp, struct mbuf *m) log(LOG_WARNING, "ip6_mforward: ip6_mrouter " "socket queue full\n"); mrt6stat.mrt6s_upq_sockfull++; - free(rte, M_MRTABLE); + kfree(rte, M_MRTABLE); m_freem(mb0); - free(rt, M_MRTABLE); + kfree(rt, M_MRTABLE); crit_exit(); return ENOBUFS; } @@ -1119,7 +1119,7 @@ ip6_mforward(struct ip6_hdr *ip6, struct ifnet *ifp, struct mbuf *m) for (p = &rt->mf6c_stall; *p != NULL; p = &(*p)->next) if (++npkts > MAX_UPQ6) { mrt6stat.mrt6s_upq_ovflw++; - free(rte, M_MRTABLE); + kfree(rte, M_MRTABLE); m_freem(mb0); crit_exit(); return 0; @@ -1181,14 +1181,14 @@ expire_upcalls(void *unused) do { struct rtdetq *n = rte->next; m_freem(rte->m); - free(rte, M_MRTABLE); + kfree(rte, M_MRTABLE); rte = n; } while (rte != NULL); mrt6stat.mrt6s_cache_cleanups++; n6expire[i]--; *nptr = mfc->mf6c_next; - free(mfc, M_MRTABLE); + kfree(mfc, M_MRTABLE); } else { nptr = &mfc->mf6c_next; } diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index ae679c94af..fe7d03f229 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netinet6/ip6_output.c,v 1.13.2.18 2003/01/24 05:11:35 sam Exp $ */ -/* $DragonFly: src/sys/netinet6/ip6_output.c,v 1.19 2006/01/14 11:44:25 swildner Exp $ */ +/* $DragonFly: src/sys/netinet6/ip6_output.c,v 1.20 2006/09/05 00:55:48 dillon Exp $ */ /* $KAME: ip6_output.c,v 1.279 2002/01/26 06:12:30 jinmei Exp $ */ /* @@ -1738,7 +1738,7 @@ ip6_pcbopts(struct ip6_pktopts **pktopt, struct mbuf *m, struct socket *so, #endif ip6_clearpktopts(opt, 1, -1); } else - opt = malloc(sizeof(*opt), M_IP6OPT, M_WAITOK); + opt = kmalloc(sizeof(*opt), M_IP6OPT, M_WAITOK); *pktopt = NULL; if (!m || m->m_len == 0) { @@ -1746,7 +1746,7 @@ ip6_pcbopts(struct ip6_pktopts **pktopt, struct mbuf *m, struct socket *so, * Only turning off any previous options, regardless of * whether the opt is just created or given. */ - free(opt, M_IP6OPT); + kfree(opt, M_IP6OPT); return(0); } @@ -1755,7 +1755,7 @@ ip6_pcbopts(struct ip6_pktopts **pktopt, struct mbuf *m, struct socket *so, priv = 1; if ((error = ip6_setpktoptions(m, opt, priv, 1)) != 0) { ip6_clearpktopts(opt, 1, -1); /* XXX: discard all options */ - free(opt, M_IP6OPT); + kfree(opt, M_IP6OPT); return(error); } *pktopt = opt; @@ -1782,29 +1782,29 @@ ip6_clearpktopts(struct ip6_pktopts *pktopt, int needfree, int optname) if (optname == -1) { if (needfree && pktopt->ip6po_pktinfo) - free(pktopt->ip6po_pktinfo, M_IP6OPT); + kfree(pktopt->ip6po_pktinfo, M_IP6OPT); pktopt->ip6po_pktinfo = NULL; } if (optname == -1) pktopt->ip6po_hlim = -1; if (optname == -1) { if (needfree && pktopt->ip6po_nexthop) - free(pktopt->ip6po_nexthop, M_IP6OPT); + kfree(pktopt->ip6po_nexthop, M_IP6OPT); pktopt->ip6po_nexthop = NULL; } if (optname == -1) { if (needfree && pktopt->ip6po_hbh) - free(pktopt->ip6po_hbh, M_IP6OPT); + kfree(pktopt->ip6po_hbh, M_IP6OPT); pktopt->ip6po_hbh = NULL; } if (optname == -1) { if (needfree && pktopt->ip6po_dest1) - free(pktopt->ip6po_dest1, M_IP6OPT); + kfree(pktopt->ip6po_dest1, M_IP6OPT); pktopt->ip6po_dest1 = NULL; } if (optname == -1) { if (needfree && pktopt->ip6po_rhinfo.ip6po_rhi_rthdr) - free(pktopt->ip6po_rhinfo.ip6po_rhi_rthdr, M_IP6OPT); + kfree(pktopt->ip6po_rhinfo.ip6po_rhi_rthdr, M_IP6OPT); pktopt->ip6po_rhinfo.ip6po_rhi_rthdr = NULL; if (pktopt->ip6po_route.ro_rt) { RTFREE(pktopt->ip6po_route.ro_rt); @@ -1813,7 +1813,7 @@ ip6_clearpktopts(struct ip6_pktopts *pktopt, int needfree, int optname) } if (optname == -1) { if (needfree && pktopt->ip6po_dest2) - free(pktopt->ip6po_dest2, M_IP6OPT); + kfree(pktopt->ip6po_dest2, M_IP6OPT); pktopt->ip6po_dest2 = NULL; } } @@ -1823,7 +1823,7 @@ do {\ if (src->type) {\ int hlen =\ (((struct ip6_ext *)src->type)->ip6e_len + 1) << 3;\ - dst->type = malloc(hlen, M_IP6OPT, canwait);\ + dst->type = kmalloc(hlen, M_IP6OPT, canwait);\ if (dst->type == NULL && canwait == M_NOWAIT)\ goto bad;\ bcopy(src->type, dst->type, hlen);\ @@ -1840,7 +1840,7 @@ ip6_copypktopts(struct ip6_pktopts *src, int canwait) return(NULL); } - dst = malloc(sizeof(*dst), M_IP6OPT, canwait); + dst = kmalloc(sizeof(*dst), M_IP6OPT, canwait); if (dst == NULL && canwait == M_NOWAIT) return (NULL); bzero(dst, sizeof(*dst)); @@ -1868,13 +1868,13 @@ ip6_copypktopts(struct ip6_pktopts *src, int canwait) return(dst); bad: - if (dst->ip6po_pktinfo) free(dst->ip6po_pktinfo, M_IP6OPT); - if (dst->ip6po_nexthop) free(dst->ip6po_nexthop, M_IP6OPT); - if (dst->ip6po_hbh) free(dst->ip6po_hbh, M_IP6OPT); - if (dst->ip6po_dest1) free(dst->ip6po_dest1, M_IP6OPT); - if (dst->ip6po_dest2) free(dst->ip6po_dest2, M_IP6OPT); - if (dst->ip6po_rthdr) free(dst->ip6po_rthdr, M_IP6OPT); - free(dst, M_IP6OPT); + if (dst->ip6po_pktinfo) kfree(dst->ip6po_pktinfo, M_IP6OPT); + if (dst->ip6po_nexthop) kfree(dst->ip6po_nexthop, M_IP6OPT); + if (dst->ip6po_hbh) kfree(dst->ip6po_hbh, M_IP6OPT); + if (dst->ip6po_dest1) kfree(dst->ip6po_dest1, M_IP6OPT); + if (dst->ip6po_dest2) kfree(dst->ip6po_dest2, M_IP6OPT); + if (dst->ip6po_rthdr) kfree(dst->ip6po_rthdr, M_IP6OPT); + kfree(dst, M_IP6OPT); return(NULL); } #undef PKTOPT_EXTHDRCPY @@ -1887,7 +1887,7 @@ ip6_freepcbopts(struct ip6_pktopts *pktopt) ip6_clearpktopts(pktopt, 1, -1); - free(pktopt, M_IP6OPT); + kfree(pktopt, M_IP6OPT); } /* @@ -1912,7 +1912,7 @@ ip6_setmoptions(int optname, struct ip6_moptions **im6op, struct mbuf *m) * allocate one and initialize to default values. */ im6o = (struct ip6_moptions *) - malloc(sizeof(*im6o), M_IPMOPTS, M_WAITOK); + kmalloc(sizeof(*im6o), M_IPMOPTS, M_WAITOK); if (im6o == NULL) return(ENOBUFS); @@ -2082,14 +2082,14 @@ ip6_setmoptions(int optname, struct ip6_moptions **im6op, struct mbuf *m) * Everything looks good; add a new record to the multicast * address list for the given interface. */ - imm = malloc(sizeof(*imm), M_IPMADDR, M_WAITOK); + imm = kmalloc(sizeof(*imm), M_IPMADDR, M_WAITOK); if (imm == NULL) { error = ENOBUFS; break; } if ((imm->i6mm_maddr = in6_addmulti(&mreq->ipv6mr_multiaddr, ifp, &error)) == NULL) { - free(imm, M_IPMADDR); + kfree(imm, M_IPMADDR); break; } LIST_INSERT_HEAD(&im6o->im6o_memberships, imm, i6mm_chain); @@ -2154,7 +2154,7 @@ ip6_setmoptions(int optname, struct ip6_moptions **im6op, struct mbuf *m) */ LIST_REMOVE(imm, i6mm_chain); in6_delmulti(imm->i6mm_maddr); - free(imm, M_IPMADDR); + kfree(imm, M_IPMADDR); break; default: @@ -2169,7 +2169,7 @@ ip6_setmoptions(int optname, struct ip6_moptions **im6op, struct mbuf *m) im6o->im6o_multicast_hlim == ip6_defmcasthlim && im6o->im6o_multicast_loop == IPV6_DEFAULT_MULTICAST_LOOP && im6o->im6o_memberships.lh_first == NULL) { - free(*im6op, M_IPMOPTS); + kfree(*im6op, M_IPMOPTS); *im6op = NULL; } @@ -2235,9 +2235,9 @@ ip6_freemoptions(struct ip6_moptions *im6o) LIST_REMOVE(imm, i6mm_chain); if (imm->i6mm_maddr) in6_delmulti(imm->i6mm_maddr); - free(imm, M_IPMADDR); + kfree(imm, M_IPMADDR); } - free(im6o, M_IPMOPTS); + kfree(im6o, M_IPMOPTS); } /* @@ -2362,7 +2362,7 @@ ip6_setpktoptions(struct mbuf *control, struct ip6_pktopts *opt, int priv, if (needcopy) { opt->ip6po_hbh = - malloc(hbhlen, M_IP6OPT, M_WAITOK); + kmalloc(hbhlen, M_IP6OPT, M_WAITOK); bcopy(hbh, opt->ip6po_hbh, hbhlen); } else opt->ip6po_hbh = hbh; @@ -2400,7 +2400,7 @@ ip6_setpktoptions(struct mbuf *control, struct ip6_pktopts *opt, int priv, newdest = &opt->ip6po_dest2; if (needcopy) { - *newdest = malloc(destlen, M_IP6OPT, M_WAITOK); + *newdest = kmalloc(destlen, M_IP6OPT, M_WAITOK); bcopy(dest, *newdest, destlen); } else *newdest = dest; @@ -2436,7 +2436,7 @@ ip6_setpktoptions(struct mbuf *control, struct ip6_pktopts *opt, int priv, } if (needcopy) { - opt->ip6po_rthdr = malloc(rthlen, M_IP6OPT, + opt->ip6po_rthdr = kmalloc(rthlen, M_IP6OPT, M_WAITOK); bcopy(rth, opt->ip6po_rthdr, rthlen); } else diff --git a/sys/netinet6/ipcomp_core.c b/sys/netinet6/ipcomp_core.c index 0c5ca91006..c6729f99eb 100644 --- a/sys/netinet6/ipcomp_core.c +++ b/sys/netinet6/ipcomp_core.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netinet6/ipcomp_core.c,v 1.1.2.5 2003/01/11 19:10:59 ume Exp $ */ -/* $DragonFly: src/sys/netinet6/ipcomp_core.c,v 1.5 2004/06/02 14:43:01 eirikn Exp $ */ +/* $DragonFly: src/sys/netinet6/ipcomp_core.c,v 1.6 2006/09/05 00:55:48 dillon Exp $ */ /* $KAME: ipcomp_core.c,v 1.25 2001/07/26 06:53:17 jinmei Exp $ */ /* @@ -104,14 +104,14 @@ static void * deflate_alloc(void *aux, u_int items, u_int siz) { void *ptr; - ptr = malloc(items * siz, M_TEMP, M_NOWAIT); + ptr = kmalloc(items * siz, M_TEMP, M_NOWAIT); return ptr; } static void deflate_free(void *aux, void *ptr) { - free(ptr, M_TEMP); + kfree(ptr, M_TEMP); } static int diff --git a/sys/netinet6/ipsec.c b/sys/netinet6/ipsec.c index 35e3d3543b..9deb62840c 100644 --- a/sys/netinet6/ipsec.c +++ b/sys/netinet6/ipsec.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netinet6/ipsec.c,v 1.3.2.12 2003/05/06 06:46:58 suz Exp $ */ -/* $DragonFly: src/sys/netinet6/ipsec.c,v 1.14 2005/11/25 17:16:23 dillon Exp $ */ +/* $DragonFly: src/sys/netinet6/ipsec.c,v 1.15 2006/09/05 00:55:48 dillon Exp $ */ /* $KAME: ipsec.c,v 1.103 2001/05/24 07:14:18 sakane Exp $ */ /* @@ -1052,14 +1052,14 @@ ipsec_newpcbpolicy(void) { struct inpcbpolicy *p; - p = (struct inpcbpolicy *)malloc(sizeof(*p), M_SECA, M_NOWAIT); + p = (struct inpcbpolicy *)kmalloc(sizeof(*p), M_SECA, M_NOWAIT); return p; } static void ipsec_delpcbpolicy(struct inpcbpolicy *p) { - free(p, M_SECA); + kfree(p, M_SECA); } /* initialize policy in PCB */ @@ -1180,7 +1180,7 @@ ipsec_deepcopy_policy(struct secpolicy *src) fail: for (p = newchain; p; p = r) { r = p->next; - free(p, M_SECA); + kfree(p, M_SECA); p = NULL; } return NULL; diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index 1693f17d51..c30c447d94 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netinet6/nd6.c,v 1.2.2.15 2003/05/06 06:46:58 suz Exp $ */ -/* $DragonFly: src/sys/netinet6/nd6.c,v 1.18 2006/01/14 11:44:25 swildner Exp $ */ +/* $DragonFly: src/sys/netinet6/nd6.c,v 1.19 2006/09/05 00:55:48 dillon Exp $ */ /* $KAME: nd6.c,v 1.144 2001/05/24 07:44:00 itojun Exp $ */ /* @@ -153,7 +153,7 @@ nd6_ifattach(struct ifnet *ifp) { struct nd_ifinfo *nd; - nd = (struct nd_ifinfo *)malloc(sizeof(*nd), M_IP6NDP, M_WAITOK); + nd = (struct nd_ifinfo *)kmalloc(sizeof(*nd), M_IP6NDP, M_WAITOK); bzero(nd, sizeof(*nd)); nd->initialized = 1; @@ -180,7 +180,7 @@ nd6_ifattach(struct ifnet *ifp) void nd6_ifdetach(struct nd_ifinfo *nd) { - free(nd, M_IP6NDP); + kfree(nd, M_IP6NDP); } /* diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c index 96a0c627aa..c40587764b 100644 --- a/sys/netinet6/nd6_nbr.c +++ b/sys/netinet6/nd6_nbr.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netinet6/nd6_nbr.c,v 1.4.2.6 2003/01/23 21:06:47 sam Exp $ */ -/* $DragonFly: src/sys/netinet6/nd6_nbr.c,v 1.14 2006/09/03 18:52:29 dillon Exp $ */ +/* $DragonFly: src/sys/netinet6/nd6_nbr.c,v 1.15 2006/09/05 00:55:48 dillon Exp $ */ /* $KAME: nd6_nbr.c,v 1.86 2002/01/21 02:33:04 jinmei Exp $ */ /* @@ -1060,7 +1060,7 @@ nd6_dad_start(struct ifaddr *ifa, return; } - dp = malloc(sizeof(*dp), M_IP6NDP, M_NOWAIT); + dp = kmalloc(sizeof(*dp), M_IP6NDP, M_NOWAIT); if (dp == NULL) { log(LOG_ERR, "nd6_dad_start: memory allocation failed for " "%s(%s)\n", @@ -1121,7 +1121,7 @@ nd6_dad_stop(struct ifaddr *ifa) nd6_dad_stoptimer(dp); TAILQ_REMOVE(&dadq, (struct dadq *)dp, dad_list); - free(dp, M_IP6NDP); + kfree(dp, M_IP6NDP); dp = NULL; IFAFREE(ifa); } @@ -1165,7 +1165,7 @@ nd6_dad_timer(struct ifaddr *ifa) if_name(ifa->ifa_ifp))); TAILQ_REMOVE(&dadq, (struct dadq *)dp, dad_list); - free(dp, M_IP6NDP); + kfree(dp, M_IP6NDP); dp = NULL; IFAFREE(ifa); goto done; @@ -1243,7 +1243,7 @@ nd6_dad_timer(struct ifaddr *ifa) ip6_sprintf(&ia->ia_addr.sin6_addr))); TAILQ_REMOVE(&dadq, (struct dadq *)dp, dad_list); - free(dp, M_IP6NDP); + kfree(dp, M_IP6NDP); dp = NULL; IFAFREE(ifa); } @@ -1282,7 +1282,7 @@ nd6_dad_duplicated(struct ifaddr *ifa) if_name(ifa->ifa_ifp)); TAILQ_REMOVE(&dadq, (struct dadq *)dp, dad_list); - free(dp, M_IP6NDP); + kfree(dp, M_IP6NDP); dp = NULL; IFAFREE(ifa); } diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c index fcb8d96f8f..2c8b61f800 100644 --- a/sys/netinet6/nd6_rtr.c +++ b/sys/netinet6/nd6_rtr.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netinet6/nd6_rtr.c,v 1.2.2.5 2003/04/05 10:28:53 ume Exp $ */ -/* $DragonFly: src/sys/netinet6/nd6_rtr.c,v 1.12 2006/01/31 19:05:42 dillon Exp $ */ +/* $DragonFly: src/sys/netinet6/nd6_rtr.c,v 1.13 2006/09/05 00:55:48 dillon Exp $ */ /* $KAME: nd6_rtr.c,v 1.111 2001/04/27 01:37:15 jinmei Exp $ */ /* @@ -581,7 +581,7 @@ defrouter_delreq(struct nd_defrouter *dr, int dofree) } if (dofree) /* XXX: necessary? */ - free(dr, M_IP6NDP); + kfree(dr, M_IP6NDP); } void @@ -622,7 +622,7 @@ defrtrlist_del(struct nd_defrouter *dr) if (deldr) defrouter_select(); - free(dr, M_IP6NDP); + kfree(dr, M_IP6NDP); } /* @@ -736,7 +736,7 @@ defrtrlist_update(struct nd_defrouter *new) return(NULL); } - n = (struct nd_defrouter *)malloc(sizeof(*n), M_IP6NDP, M_NOWAIT); + n = (struct nd_defrouter *)kmalloc(sizeof(*n), M_IP6NDP, M_NOWAIT); if (n == NULL) { crit_exit(); return(NULL); @@ -774,7 +774,7 @@ pfxrtr_add(struct nd_prefix *pr, struct nd_defrouter *dr) { struct nd_pfxrouter *new; - new = (struct nd_pfxrouter *)malloc(sizeof(*new), M_IP6NDP, M_NOWAIT); + new = (struct nd_pfxrouter *)kmalloc(sizeof(*new), M_IP6NDP, M_NOWAIT); if (new == NULL) return; bzero(new, sizeof(*new)); @@ -789,7 +789,7 @@ static void pfxrtr_del(struct nd_pfxrouter *pfr) { LIST_REMOVE(pfr, pfr_entry); - free(pfr, M_IP6NDP); + kfree(pfr, M_IP6NDP); } struct nd_prefix * @@ -818,7 +818,7 @@ nd6_prelist_add(struct nd_prefix *pr, struct nd_defrouter *dr, struct nd_prefix *new = NULL; int i; - new = (struct nd_prefix *)malloc(sizeof(*new), M_IP6NDP, M_NOWAIT); + new = (struct nd_prefix *)kmalloc(sizeof(*new), M_IP6NDP, M_NOWAIT); if (new == NULL) return ENOMEM; bzero(new, sizeof(*new)); @@ -897,11 +897,11 @@ prelist_remove(struct nd_prefix *pr) for (pfr = pr->ndpr_advrtrs.lh_first; pfr; pfr = next) { next = pfr->pfr_next; - free(pfr, M_IP6NDP); + kfree(pfr, M_IP6NDP); } crit_exit(); - free(pr, M_IP6NDP); + kfree(pr, M_IP6NDP); pfxlist_onlink_check(); } diff --git a/sys/netinet6/scope6.c b/sys/netinet6/scope6.c index 8858b2c2e5..0b63277085 100644 --- a/sys/netinet6/scope6.c +++ b/sys/netinet6/scope6.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netinet6/scope6.c,v 1.1.2.3 2002/04/01 15:29:04 ume Exp $ */ -/* $DragonFly: src/sys/netinet6/scope6.c,v 1.7 2006/09/03 18:29:17 dillon Exp $ */ +/* $DragonFly: src/sys/netinet6/scope6.c,v 1.8 2006/09/05 00:55:48 dillon Exp $ */ /* $KAME: scope6.c,v 1.10 2000/07/24 13:29:31 itojun Exp $ */ /* @@ -62,7 +62,7 @@ scope6_ifattach(struct ifnet *ifp) { struct scope6_id *sid; - sid = (struct scope6_id *)malloc(sizeof(*sid), M_IFADDR, M_WAITOK); + sid = (struct scope6_id *)kmalloc(sizeof(*sid), M_IFADDR, M_WAITOK); bzero(sid, sizeof(*sid)); crit_enter(); @@ -86,7 +86,7 @@ scope6_ifattach(struct ifnet *ifp) void scope6_ifdetach(struct scope6_id *sid) { - free(sid, M_IFADDR); + kfree(sid, M_IFADDR); } int diff --git a/sys/netproto/802_11/wlan/ieee80211_dragonfly.c b/sys/netproto/802_11/wlan/ieee80211_dragonfly.c index fd13773154..b50076345d 100644 --- a/sys/netproto/802_11/wlan/ieee80211_dragonfly.c +++ b/sys/netproto/802_11/wlan/ieee80211_dragonfly.c @@ -25,7 +25,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/net80211/ieee80211_freebsd.c,v 1.7.2.2 2005/12/22 19:22:51 sam Exp $ - * $DragonFly: src/sys/netproto/802_11/wlan/ieee80211_dragonfly.c,v 1.3 2006/09/03 17:31:55 dillon Exp $ + * $DragonFly: src/sys/netproto/802_11/wlan/ieee80211_dragonfly.c,v 1.4 2006/09/05 00:55:48 dillon Exp $ */ /* @@ -89,7 +89,7 @@ ieee80211_sysctl_attach(struct ieee80211com *ic) struct sysctl_oid *oid; char num[14]; /* sufficient for 32 bits */ - ctx = malloc(sizeof(struct sysctl_ctx_list), M_DEVBUF, + ctx = kmalloc(sizeof(struct sysctl_ctx_list), M_DEVBUF, M_WAITOK | M_ZERO); sysctl_ctx_init(ctx); @@ -98,7 +98,7 @@ ieee80211_sysctl_attach(struct ieee80211com *ic) OID_AUTO, num, CTLFLAG_RD, NULL, ""); if (oid == NULL) { printf("add sysctl node net.wlan.%s failed\n", num); - free(ctx, M_DEVBUF); + kfree(ctx, M_DEVBUF); return; } @@ -144,7 +144,7 @@ ieee80211_sysctl_detach(struct ieee80211com *ic) { if (ic->ic_sysctl != NULL) { sysctl_ctx_free(ic->ic_sysctl); - free(ic->ic_sysctl, M_DEVBUF); + kfree(ic->ic_sysctl, M_DEVBUF); ic->ic_sysctl = NULL; } } diff --git a/sys/netproto/802_11/wlan/ieee80211_ioctl.c b/sys/netproto/802_11/wlan/ieee80211_ioctl.c index a2212856a4..805b776ba3 100644 --- a/sys/netproto/802_11/wlan/ieee80211_ioctl.c +++ b/sys/netproto/802_11/wlan/ieee80211_ioctl.c @@ -30,7 +30,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/net80211/ieee80211_ioctl.c,v 1.25.2.11 2006/02/28 02:02:43 sam Exp $ - * $DragonFly: src/sys/netproto/802_11/wlan/ieee80211_ioctl.c,v 1.3 2006/09/01 15:12:11 sephe Exp $ + * $DragonFly: src/sys/netproto/802_11/wlan/ieee80211_ioctl.c,v 1.4 2006/09/05 00:55:48 dillon Exp $ */ /* @@ -1182,14 +1182,14 @@ ieee80211_ioctl_getstainfo(struct ieee80211com *ic, struct ieee80211req *ireq) space = req.space; /* XXX M_WAITOK after driver lock released */ - p = malloc(space, M_TEMP, M_NOWAIT); + p = kmalloc(space, M_TEMP, M_NOWAIT); if (p == NULL) return ENOMEM; req.si = p; ieee80211_iterate_nodes(&ic->ic_sta, get_sta_info, &req); ireq->i_len = space - req.space; error = copyout(p, ireq->i_data, ireq->i_len); - free(p, M_TEMP); + kfree(p, M_TEMP); } else ireq->i_len = 0; @@ -1537,12 +1537,12 @@ ieee80211_ioctl_setoptie(struct ieee80211com *ic, struct ieee80211req *ireq) if (ireq->i_len > IEEE80211_MAX_OPT_IE) return EINVAL; if (ireq->i_len > 0) { - ie = malloc(ireq->i_len, M_DEVBUF, M_NOWAIT); + ie = kmalloc(ireq->i_len, M_DEVBUF, M_NOWAIT); if (ie == NULL) return ENOMEM; error = copyin(ireq->i_data, ie, ireq->i_len); if (error) { - free(ie, M_DEVBUF); + kfree(ie, M_DEVBUF); return error; } } else { @@ -1554,7 +1554,7 @@ ieee80211_ioctl_setoptie(struct ieee80211com *ic, struct ieee80211req *ireq) ic->ic_opt_ie = ie; ic->ic_opt_ie_len = ireq->i_len; if (oie != NULL) - free(oie, M_DEVBUF); + kfree(oie, M_DEVBUF); return 0; } diff --git a/sys/netproto/802_11/wlan/ieee80211_node.c b/sys/netproto/802_11/wlan/ieee80211_node.c index 44a372e5c2..84b81deeb1 100644 --- a/sys/netproto/802_11/wlan/ieee80211_node.c +++ b/sys/netproto/802_11/wlan/ieee80211_node.c @@ -30,7 +30,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/net80211/ieee80211_node.c,v 1.48.2.10 2006/03/13 03:05:47 sam Exp $ - * $DragonFly: src/sys/netproto/802_11/wlan/ieee80211_node.c,v 1.4 2006/09/01 15:12:11 sephe Exp $ + * $DragonFly: src/sys/netproto/802_11/wlan/ieee80211_node.c,v 1.5 2006/09/05 00:55:48 dillon Exp $ */ #include @@ -116,7 +116,7 @@ ieee80211_node_lateattach(struct ieee80211com *ic) /* XXX defer until using hostap/ibss mode */ ic->ic_tim_len = howmany(ic->ic_max_aid, 8) * sizeof(uint8_t); - ic->ic_tim_bitmap = malloc(ic->ic_tim_len, M_DEVBUF, + ic->ic_tim_bitmap = kmalloc(ic->ic_tim_len, M_DEVBUF, M_WAITOK | M_ZERO); ieee80211_node_table_init(ic, &ic->ic_sta, "station", @@ -176,11 +176,11 @@ ieee80211_node_detach(struct ieee80211com *ic) ieee80211_node_table_cleanup(&ic->ic_scan); ieee80211_node_table_cleanup(&ic->ic_sta); if (ic->ic_aid_bitmap != NULL) { - free(ic->ic_aid_bitmap, M_DEVBUF); + kfree(ic->ic_aid_bitmap, M_DEVBUF); ic->ic_aid_bitmap = NULL; } if (ic->ic_tim_bitmap != NULL) { - free(ic->ic_tim_bitmap, M_DEVBUF); + kfree(ic->ic_tim_bitmap, M_DEVBUF); ic->ic_tim_bitmap = NULL; } } @@ -846,7 +846,7 @@ node_alloc(struct ieee80211_node_table *nt) { struct ieee80211_node *ni; - ni = malloc(sizeof(struct ieee80211_node), M_80211_NODE, + ni = kmalloc(sizeof(struct ieee80211_node), M_80211_NODE, M_NOWAIT | M_ZERO); return ni; } @@ -891,7 +891,7 @@ node_cleanup(struct ieee80211_node *ni) ni->ni_associd = 0; if (ni->ni_challenge != NULL) { - free(ni->ni_challenge, M_DEVBUF); + kfree(ni->ni_challenge, M_DEVBUF); ni->ni_challenge = NULL; } /* @@ -925,11 +925,11 @@ node_free(struct ieee80211_node *ni) ic->ic_node_cleanup(ni); if (ni->ni_wpa_ie != NULL) - free(ni->ni_wpa_ie, M_DEVBUF); + kfree(ni->ni_wpa_ie, M_DEVBUF); if (ni->ni_wme_ie != NULL) - free(ni->ni_wme_ie, M_DEVBUF); + kfree(ni->ni_wme_ie, M_DEVBUF); IEEE80211_NODE_SAVEQ_DESTROY(ni); - free(ni, M_80211_NODE); + kfree(ni, M_80211_NODE); } static uint8_t @@ -2327,7 +2327,7 @@ ieee80211_node_table_cleanup(struct ieee80211_node_table *nt) printf("%s: %s[%u] still active\n", __func__, nt->nt_name, i); } - free(nt->nt_keyixmap, M_80211_NODE); + kfree(nt->nt_keyixmap, M_80211_NODE); nt->nt_keyixmap = NULL; } } diff --git a/sys/netproto/802_11/wlan_acl/ieee80211_acl.c b/sys/netproto/802_11/wlan_acl/ieee80211_acl.c index 6f2d0fe283..3ffb4b7b2c 100644 --- a/sys/netproto/802_11/wlan_acl/ieee80211_acl.c +++ b/sys/netproto/802_11/wlan_acl/ieee80211_acl.c @@ -29,7 +29,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/net80211/ieee80211_acl.c,v 1.3.2.1 2005/09/03 22:40:02 sam Exp $ - * $DragonFly: src/sys/netproto/802_11/wlan_acl/ieee80211_acl.c,v 1.1 2006/05/18 13:51:46 sephe Exp $ + * $DragonFly: src/sys/netproto/802_11/wlan_acl/ieee80211_acl.c,v 1.2 2006/09/05 00:55:48 dillon Exp $ */ /* @@ -98,7 +98,7 @@ acl_attach(struct ieee80211com *ic) { struct aclstate *as; - as = malloc(sizeof(struct aclstate), M_80211_ACL, M_NOWAIT | M_ZERO); + as = kmalloc(sizeof(struct aclstate), M_80211_ACL, M_NOWAIT | M_ZERO); if (as == NULL) return 0; TAILQ_INIT(&as->as_list); @@ -115,7 +115,7 @@ acl_detach(struct ieee80211com *ic) acl_free_all(ic); ic->ic_as = NULL; - free(as, M_DEVBUF); + kfree(as, M_DEVBUF); } static __inline struct acl * @@ -139,7 +139,7 @@ _acl_free(struct aclstate *as, struct acl *acl) TAILQ_REMOVE(&as->as_list, acl, acl_list); LIST_REMOVE(acl, acl_hash); - free(acl, M_80211_ACL); + kfree(acl, M_80211_ACL); as->as_nacls--; } @@ -168,7 +168,7 @@ acl_add(struct ieee80211com *ic, const uint8_t mac[IEEE80211_ADDR_LEN]) ASSERT_SERIALIZED(ic->ic_ifp->if_serializer); - new = malloc(sizeof(struct acl), M_80211_ACL, M_NOWAIT | M_ZERO); + new = kmalloc(sizeof(struct acl), M_80211_ACL, M_NOWAIT | M_ZERO); if (new == NULL) { IEEE80211_DPRINTF(ic, IEEE80211_MSG_ACL, "ACL: add %6D failed, no memory\n", mac, ":"); @@ -287,7 +287,7 @@ acl_getioctl(struct ieee80211com *ic, struct ieee80211req *ireq) ireq->i_len = space; /* return required space */ return 0; /* NB: must not error */ } - ap = malloc(space, M_TEMP, M_NOWAIT); + ap = kmalloc(space, M_TEMP, M_NOWAIT); if (ap == NULL) return ENOMEM; i = 0; @@ -300,7 +300,7 @@ acl_getioctl(struct ieee80211com *ic, struct ieee80211req *ireq) ireq->i_len = space; } else error = copyout(ap, ireq->i_data, ireq->i_len); - free(ap, M_TEMP); + kfree(ap, M_TEMP); return error; } return EINVAL; diff --git a/sys/netproto/802_11/wlan_ccmp/ieee80211_crypto_ccmp.c b/sys/netproto/802_11/wlan_ccmp/ieee80211_crypto_ccmp.c index 255940e251..bb29ec2991 100644 --- a/sys/netproto/802_11/wlan_ccmp/ieee80211_crypto_ccmp.c +++ b/sys/netproto/802_11/wlan_ccmp/ieee80211_crypto_ccmp.c @@ -29,7 +29,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/net80211/ieee80211_crypto_ccmp.c,v 1.7.2.1 2005/12/22 19:02:08 sam Exp $ - * $DragonFly: src/sys/netproto/802_11/wlan_ccmp/ieee80211_crypto_ccmp.c,v 1.1 2006/05/18 13:51:46 sephe Exp $ + * $DragonFly: src/sys/netproto/802_11/wlan_ccmp/ieee80211_crypto_ccmp.c,v 1.2 2006/09/05 00:55:48 dillon Exp $ */ /* @@ -100,7 +100,7 @@ ccmp_attach(struct ieee80211com *ic, struct ieee80211_key *k) { struct ccmp_ctx *ctx; - ctx = malloc(sizeof(struct ccmp_ctx), M_DEVBUF, M_NOWAIT | M_ZERO); + ctx = kmalloc(sizeof(struct ccmp_ctx), M_DEVBUF, M_NOWAIT | M_ZERO); if (ctx == NULL) { ic->ic_stats.is_crypto_nomem++; return NULL; @@ -115,7 +115,7 @@ ccmp_detach(struct ieee80211_key *k) { struct ccmp_ctx *ctx = k->wk_private; - free(ctx, M_DEVBUF); + kfree(ctx, M_DEVBUF); KASSERT(nrefs > 0, ("imbalanced attach/detach")); nrefs--; /* NB: we assume caller locking */ } diff --git a/sys/netproto/802_11/wlan_ratectl/amrr/ieee80211_ratectl_amrr.c b/sys/netproto/802_11/wlan_ratectl/amrr/ieee80211_ratectl_amrr.c index 393fa66f9f..aad1f52190 100644 --- a/sys/netproto/802_11/wlan_ratectl/amrr/ieee80211_ratectl_amrr.c +++ b/sys/netproto/802_11/wlan_ratectl/amrr/ieee80211_ratectl_amrr.c @@ -35,7 +35,7 @@ * THE POSSIBILITY OF SUCH DAMAGES. * * $FreeBSD: src/sys/dev/ath/ath_rate/amrr/amrr.c,v 1.8.2.3 2006/02/24 19:51:11 sam Exp $ - * $DragonFly: src/sys/netproto/802_11/wlan_ratectl/amrr/ieee80211_ratectl_amrr.c,v 1.1 2006/09/01 15:12:12 sephe Exp $ + * $DragonFly: src/sys/netproto/802_11/wlan_ratectl/amrr/ieee80211_ratectl_amrr.c,v 1.2 2006/09/05 00:55:48 dillon Exp $ */ /* @@ -454,7 +454,7 @@ amrr_attach(struct ieee80211com *ic) amrr_nrefs++; - asc = malloc(sizeof(struct amrr_softc), M_DEVBUF, M_WAITOK | M_ZERO); + asc = kmalloc(sizeof(struct amrr_softc), M_DEVBUF, M_WAITOK | M_ZERO); asc->ic = ic; callout_init(&asc->timer); @@ -484,7 +484,7 @@ amrr_detach(void *arg) if (asc->sysctl_oid != NULL) sysctl_ctx_free(&asc->sysctl_ctx); - free(asc, M_DEVBUF); + kfree(asc, M_DEVBUF); amrr_nrefs--; } @@ -493,7 +493,7 @@ static void amrr_data_free(struct ieee80211_node *ni) { if (ni->ni_rate_data != NULL) { - free(ni->ni_rate_data, M_AMRR_RATECTL_DATA); + kfree(ni->ni_rate_data, M_AMRR_RATECTL_DATA); ni->ni_rate_data = NULL; } } diff --git a/sys/netproto/802_11/wlan_ratectl/onoe/ieee80211_ratectl_onoe.c b/sys/netproto/802_11/wlan_ratectl/onoe/ieee80211_ratectl_onoe.c index fe26761ad2..d3f7850a7f 100644 --- a/sys/netproto/802_11/wlan_ratectl/onoe/ieee80211_ratectl_onoe.c +++ b/sys/netproto/802_11/wlan_ratectl/onoe/ieee80211_ratectl_onoe.c @@ -34,7 +34,7 @@ * THE POSSIBILITY OF SUCH DAMAGES. * * $FreeBSD: src/sys/dev/ath/ath_rate/onoe/onoe.c,v 1.8.2.3 2006/02/24 19:51:11 sam Exp $ - * $DragonFly: src/sys/netproto/802_11/wlan_ratectl/onoe/ieee80211_ratectl_onoe.c,v 1.1 2006/09/01 15:12:12 sephe Exp $ + * $DragonFly: src/sys/netproto/802_11/wlan_ratectl/onoe/ieee80211_ratectl_onoe.c,v 1.2 2006/09/05 00:55:49 dillon Exp $ */ /* @@ -445,7 +445,7 @@ onoe_attach(struct ieee80211com *ic) onoe_nrefs++; - osc = malloc(sizeof(struct onoe_softc), M_DEVBUF, M_WAITOK | M_ZERO); + osc = kmalloc(sizeof(struct onoe_softc), M_DEVBUF, M_WAITOK | M_ZERO); osc->ic = ic; callout_init(&osc->timer); @@ -475,7 +475,7 @@ onoe_detach(void *arg) if (osc->sysctl_oid != NULL) sysctl_ctx_free(&osc->sysctl_ctx); - free(osc, M_DEVBUF); + kfree(osc, M_DEVBUF); onoe_nrefs--; } @@ -484,7 +484,7 @@ static void onoe_data_free(struct ieee80211_node *ni) { if (ni->ni_rate_data != NULL) { - free(ni->ni_rate_data, M_ONOE_RATECTL_DATA); + kfree(ni->ni_rate_data, M_ONOE_RATECTL_DATA); ni->ni_rate_data = NULL; } } diff --git a/sys/netproto/802_11/wlan_tkip/ieee80211_crypto_tkip.c b/sys/netproto/802_11/wlan_tkip/ieee80211_crypto_tkip.c index 61e9954140..b493a5516f 100644 --- a/sys/netproto/802_11/wlan_tkip/ieee80211_crypto_tkip.c +++ b/sys/netproto/802_11/wlan_tkip/ieee80211_crypto_tkip.c @@ -29,7 +29,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/net80211/ieee80211_crypto_tkip.c,v 1.9.2.2 2005/12/22 19:02:08 sam Exp $ - * $DragonFly: src/sys/netproto/802_11/wlan_tkip/ieee80211_crypto_tkip.c,v 1.1 2006/05/18 13:51:46 sephe Exp $ + * $DragonFly: src/sys/netproto/802_11/wlan_tkip/ieee80211_crypto_tkip.c,v 1.2 2006/09/05 00:55:49 dillon Exp $ */ /* @@ -111,7 +111,7 @@ tkip_attach(struct ieee80211com *ic, struct ieee80211_key *k) { struct tkip_ctx *ctx; - ctx = malloc(sizeof(struct tkip_ctx), M_DEVBUF, M_NOWAIT | M_ZERO); + ctx = kmalloc(sizeof(struct tkip_ctx), M_DEVBUF, M_NOWAIT | M_ZERO); if (ctx == NULL) { ic->ic_stats.is_crypto_nomem++; return NULL; @@ -127,7 +127,7 @@ tkip_detach(struct ieee80211_key *k) { struct tkip_ctx *ctx = k->wk_private; - free(ctx, M_DEVBUF); + kfree(ctx, M_DEVBUF); KASSERT(nrefs > 0, ("imbalanced attach/detach")); nrefs--; /* NB: we assume caller locking */ } diff --git a/sys/netproto/802_11/wlan_wep/ieee80211_crypto_wep.c b/sys/netproto/802_11/wlan_wep/ieee80211_crypto_wep.c index 35fb13a372..303523ae04 100644 --- a/sys/netproto/802_11/wlan_wep/ieee80211_crypto_wep.c +++ b/sys/netproto/802_11/wlan_wep/ieee80211_crypto_wep.c @@ -29,7 +29,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/net80211/ieee80211_crypto_wep.c,v 1.7.2.1 2005/12/22 19:02:08 sam Exp $ - * $DragonFly: src/sys/netproto/802_11/wlan_wep/ieee80211_crypto_wep.c,v 1.1 2006/05/18 13:51:46 sephe Exp $ + * $DragonFly: src/sys/netproto/802_11/wlan_wep/ieee80211_crypto_wep.c,v 1.2 2006/09/05 00:55:49 dillon Exp $ */ /* @@ -91,7 +91,7 @@ wep_attach(struct ieee80211com *ic, struct ieee80211_key *k) { struct wep_ctx *ctx; - ctx = malloc(sizeof(struct wep_ctx), M_DEVBUF, M_NOWAIT | M_ZERO); + ctx = kmalloc(sizeof(struct wep_ctx), M_DEVBUF, M_NOWAIT | M_ZERO); if (ctx == NULL) { ic->ic_stats.is_crypto_nomem++; return NULL; diff --git a/sys/netproto/atalk/at_control.c b/sys/netproto/atalk/at_control.c index 3ea68ffcb9..1df13cc93a 100644 --- a/sys/netproto/atalk/at_control.c +++ b/sys/netproto/atalk/at_control.c @@ -2,7 +2,7 @@ * Copyright (c) 1990,1991 Regents of The University of Michigan. * All Rights Reserved. * - * $DragonFly: src/sys/netproto/atalk/at_control.c,v 1.10 2006/01/14 13:36:39 swildner Exp $ + * $DragonFly: src/sys/netproto/atalk/at_control.c,v 1.11 2006/09/05 00:55:49 dillon Exp $ */ #include @@ -140,7 +140,7 @@ at_control(struct socket *so, u_long cmd, caddr_t data, * allocate a fresh one. */ if ( aa == (struct at_ifaddr *) 0 ) { - aa0 = malloc(sizeof(struct at_ifaddr), M_IFADDR, M_WAITOK | M_ZERO); + aa0 = kmalloc(sizeof(struct at_ifaddr), M_IFADDR, M_WAITOK | M_ZERO); callout_init(&aa0->aa_ch); if (( aa = at_ifaddr ) != NULL ) { /* diff --git a/sys/netproto/ipsec/ipsec.c b/sys/netproto/ipsec/ipsec.c index 6d27c70d33..cce561c5e5 100644 --- a/sys/netproto/ipsec/ipsec.c +++ b/sys/netproto/ipsec/ipsec.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netipsec/ipsec.c,v 1.2.2.1 2003/01/24 05:11:35 sam Exp $ */ -/* $DragonFly: src/sys/netproto/ipsec/ipsec.c,v 1.15 2006/05/01 16:24:43 dillon Exp $ */ +/* $DragonFly: src/sys/netproto/ipsec/ipsec.c,v 1.16 2006/09/05 00:55:49 dillon Exp $ */ /* $KAME: ipsec.c,v 1.103 2001/05/24 07:14:18 sakane Exp $ */ /* @@ -823,7 +823,7 @@ ipsec6_setspidx_ipaddr(struct mbuf *m, struct secpolicyindex *spidx) static void ipsec_delpcbpolicy(struct inpcbpolicy *p) { - free(p, M_SECA); + kfree(p, M_SECA); } /* initialize policy in PCB */ @@ -945,7 +945,7 @@ ipsec_deepcopy_policy(struct secpolicy *src) fail: for (p = newchain; p; p = r) { r = p->next; - free(p, M_SECA); + kfree(p, M_SECA); p = NULL; } return NULL; diff --git a/sys/netproto/ipsec/key.c b/sys/netproto/ipsec/key.c index 416bb2ac7d..9fd7e7a951 100644 --- a/sys/netproto/ipsec/key.c +++ b/sys/netproto/ipsec/key.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netipsec/key.c,v 1.3.2.1 2003/01/24 05:11:35 sam Exp $ */ -/* $DragonFly: src/sys/netproto/ipsec/key.c,v 1.15 2006/09/03 18:52:29 dillon Exp $ */ +/* $DragonFly: src/sys/netproto/ipsec/key.c,v 1.16 2006/09/05 00:55:49 dillon Exp $ */ /* $KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $ */ /* @@ -294,13 +294,13 @@ MALLOC_DEFINE(M_SECA, "key mgmt", "security associations, key management"); #if 1 #define KMALLOC(p, t, n) \ - ((p) = (t) malloc((unsigned long)(n), M_SECA, M_INTWAIT | M_NULLOK)) + ((p) = (t) kmalloc((unsigned long)(n), M_SECA, M_INTWAIT | M_NULLOK)) #define KFREE(p) \ - free((caddr_t)(p), M_SECA) + kfree((caddr_t)(p), M_SECA) #else #define KMALLOC(p, t, n) \ do { \ - ((p) = (t)malloc((unsigned long)(n), M_SECA, M_INTWAIT | M_NULLOK)); \ + ((p) = (t)kmalloc((unsigned long)(n), M_SECA, M_INTWAIT | M_NULLOK)); \ printf("%s %d: %p <- KMALLOC(%s, %d)\n", \ __FILE__, __LINE__, (p), #t, n); \ } while (0) @@ -308,7 +308,7 @@ do { \ #define KFREE(p) \ do { \ printf("%s %d: %p -> KFREE()\n", __FILE__, __LINE__, (p)); \ - free((caddr_t)(p), M_SECA); \ + kfree((caddr_t)(p), M_SECA); \ } while (0) #endif @@ -1270,7 +1270,7 @@ key_newsp(const char* where, int tag) { struct secpolicy *newsp = NULL; - newsp = malloc(sizeof(struct secpolicy), M_SECA, + newsp = kmalloc(sizeof(struct secpolicy), M_SECA, M_INTWAIT | M_ZERO | M_NULLOK); if (newsp) { newsp->refcnt = 1; @@ -2529,7 +2529,7 @@ key_newsah(struct secasindex *saidx) KASSERT(saidx != NULL, ("key_newsaidx: null saidx")); - newsah = malloc(sizeof(struct secashead), M_SECA, + newsah = kmalloc(sizeof(struct secashead), M_SECA, M_INTWAIT | M_ZERO | M_NULLOK); if (newsah != NULL) { int i; diff --git a/sys/netproto/ipsec/keysock.c b/sys/netproto/ipsec/keysock.c index be5480029b..9df2962409 100644 --- a/sys/netproto/ipsec/keysock.c +++ b/sys/netproto/ipsec/keysock.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netipsec/keysock.c,v 1.3.2.1 2003/01/24 05:11:36 sam Exp $ */ -/* $DragonFly: src/sys/netproto/ipsec/keysock.c,v 1.12 2006/04/23 17:56:36 dillon Exp $ */ +/* $DragonFly: src/sys/netproto/ipsec/keysock.c,v 1.13 2006/09/05 00:55:49 dillon Exp $ */ /* $KAME: keysock.c,v 1.25 2001/08/13 20:07:41 itojun Exp $ */ /* @@ -389,7 +389,7 @@ key_attach(struct socket *so, int proto, struct pru_attach_info *ai) if (sotorawcb(so) != 0) return EISCONN; /* XXX panic? */ - kp = (struct keycb *)malloc(sizeof *kp, M_PCB, M_WAITOK|M_ZERO); /* XXX */ + kp = (struct keycb *)kmalloc(sizeof *kp, M_PCB, M_WAITOK|M_ZERO); /* XXX */ if (kp == 0) return ENOBUFS; @@ -405,7 +405,7 @@ key_attach(struct socket *so, int proto, struct pru_attach_info *ai) error = raw_usrreqs.pru_attach(so, proto, ai); kp = (struct keycb *)sotorawcb(so); if (error) { - free(kp, M_PCB); + kfree(kp, M_PCB); so->so_pcb = (caddr_t) 0; crit_exit(); return error; diff --git a/sys/netproto/ipsec/xform_ah.c b/sys/netproto/ipsec/xform_ah.c index 106fa736a0..433aa1d4f5 100644 --- a/sys/netproto/ipsec/xform_ah.c +++ b/sys/netproto/ipsec/xform_ah.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netipsec/xform_ah.c,v 1.1.4.2 2003/02/26 00:14:05 sam Exp $ */ -/* $DragonFly: src/sys/netproto/ipsec/xform_ah.c,v 1.8 2005/06/17 19:12:23 dillon Exp $ */ +/* $DragonFly: src/sys/netproto/ipsec/xform_ah.c,v 1.9 2006/09/05 00:55:49 dillon Exp $ */ /* $OpenBSD: ip_ah.c,v 1.63 2001/06/26 06:18:58 angelos Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), @@ -536,7 +536,7 @@ ah_massage_headers(struct mbuf **m0, int proto, int skip, int alg, int out) if (alloc) { m_copyback(m, sizeof(struct ip6_hdr), skip - sizeof(struct ip6_hdr), ptr); - free(ptr, M_XDATA); + kfree(ptr, M_XDATA); } break; @@ -676,7 +676,7 @@ ah_input(struct mbuf *m, struct secasvar *sav, int skip, int protoff) if (error != 0) { /* NB: mbuf is free'd by ah_massage_headers */ ahstat.ahs_hdrops++; - free(tc, M_XDATA); + kfree(tc, M_XDATA); crypto_freereq(crp); return error; } @@ -826,7 +826,7 @@ ah_input_cb(struct cryptop *crp) m_copyback(m, protoff, sizeof(u_int8_t), &nxt); } - free(tc, M_XDATA), tc = NULL; /* No longer needed */ + kfree(tc, M_XDATA), tc = NULL; /* No longer needed */ /* * Header is now authenticated. @@ -872,7 +872,7 @@ bad: if (m != NULL) m_freem(m); if (tc != NULL) - free(tc, M_XDATA); + kfree(tc, M_XDATA); if (crp != NULL) crypto_freereq(crp); return error; @@ -1022,7 +1022,7 @@ ah_output( crda->crd_klen = _KEYBITS(sav->key_auth); /* Allocate IPsec-specific opaque crypto info. */ - tc = malloc(sizeof(struct tdb_crypto) + skip, M_XDATA, + tc = kmalloc(sizeof(struct tdb_crypto) + skip, M_XDATA, M_INTWAIT | M_ZERO | M_NULLOK); if (tc == NULL) { crypto_freereq(crp); @@ -1076,7 +1076,7 @@ ah_output( skip, ahx->type, 1); if (error != 0) { m = NULL; /* mbuf was free'd by ah_massage_headers. */ - free(tc, M_XDATA); + kfree(tc, M_XDATA); crypto_freereq(crp); goto bad; } @@ -1170,7 +1170,7 @@ ah_output_cb(struct cryptop *crp) m_copyback(m, 0, skip, ptr); /* No longer needed. */ - free(tc, M_XDATA); + kfree(tc, M_XDATA); crypto_freereq(crp); /* NB: m is reclaimed by ipsec_process_done. */ @@ -1184,7 +1184,7 @@ bad: crit_exit(); if (m) m_freem(m); - free(tc, M_XDATA); + kfree(tc, M_XDATA); crypto_freereq(crp); return error; } diff --git a/sys/netproto/ipsec/xform_esp.c b/sys/netproto/ipsec/xform_esp.c index 453b817e7e..2b029b88c6 100644 --- a/sys/netproto/ipsec/xform_esp.c +++ b/sys/netproto/ipsec/xform_esp.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netipsec/xform_esp.c,v 1.2.2.2 2003/02/26 00:14:05 sam Exp $ */ -/* $DragonFly: src/sys/netproto/ipsec/xform_esp.c,v 1.10 2006/03/22 19:57:32 drhodus Exp $ */ +/* $DragonFly: src/sys/netproto/ipsec/xform_esp.c,v 1.11 2006/09/05 00:55:49 dillon Exp $ */ /* $OpenBSD: ip_esp.c,v 1.69 2001/06/26 06:18:59 angelos Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), @@ -191,7 +191,7 @@ esp_init(struct secasvar *sav, struct xformsw *xsp) * compromise is to force it to zero here. */ sav->ivlen = (txform == &enc_xform_null ? 0 : txform->blocksize); - sav->iv = (caddr_t) malloc(sav->ivlen, M_XDATA, M_WAITOK); + sav->iv = (caddr_t) kmalloc(sav->ivlen, M_XDATA, M_WAITOK); if (sav->iv == NULL) { DPRINTF(("esp_init: no memory for IV\n")); return EINVAL; @@ -545,7 +545,7 @@ esp_input_cb(struct cryptop *crp) } /* Release the crypto descriptors */ - free(tc, M_XDATA), tc = NULL; + kfree(tc, M_XDATA), tc = NULL; crypto_freereq(crp), crp = NULL; /* @@ -633,7 +633,7 @@ bad: if (m != NULL) m_freem(m); if (tc != NULL) - free(tc, M_XDATA); + kfree(tc, M_XDATA); if (crp != NULL) crypto_freereq(crp); return error; @@ -929,7 +929,7 @@ esp_output_cb(struct cryptop *crp) ahstat.ahs_hist[sav->alg_auth]++; /* Release crypto descriptors. */ - free(tc, M_XDATA); + kfree(tc, M_XDATA); crypto_freereq(crp); /* NB: m is reclaimed by ipsec_process_done. */ @@ -943,7 +943,7 @@ bad: crit_exit(); if (m) m_freem(m); - free(tc, M_XDATA); + kfree(tc, M_XDATA); crypto_freereq(crp); return error; } diff --git a/sys/netproto/ipsec/xform_ipcomp.c b/sys/netproto/ipsec/xform_ipcomp.c index b51496942e..fac2ea25ee 100644 --- a/sys/netproto/ipsec/xform_ipcomp.c +++ b/sys/netproto/ipsec/xform_ipcomp.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netipsec/xform_ipcomp.c,v 1.1.4.2 2003/02/26 00:14:06 sam Exp $ */ -/* $DragonFly: src/sys/netproto/ipsec/xform_ipcomp.c,v 1.8 2006/04/23 17:56:36 dillon Exp $ */ +/* $DragonFly: src/sys/netproto/ipsec/xform_ipcomp.c,v 1.9 2006/09/05 00:55:49 dillon Exp $ */ /* $OpenBSD: ip_ipcomp.c,v 1.1 2001/07/05 12:08:52 jjbg Exp $ */ /* @@ -150,7 +150,7 @@ ipcomp_input(struct mbuf *m, struct secasvar *sav, int skip, int protoff) return ENOBUFS; } /* Get IPsec-specific opaque pointer */ - tc = malloc(sizeof (*tc), M_XDATA, + tc = kmalloc(sizeof (*tc), M_XDATA, M_INTWAIT | M_ZERO | M_NULLOK); if (tc == NULL) { m_freem(m); @@ -272,7 +272,7 @@ ipcomp_input_cb(struct cryptop *crp) clen = crp->crp_olen; /* Length of data after processing */ /* Release the crypto descriptors */ - free(tc, M_XDATA), tc = NULL; + kfree(tc, M_XDATA), tc = NULL; crypto_freereq(crp), crp = NULL; /* In case it's not done already, adjust the size of the mbuf chain */ @@ -314,7 +314,7 @@ bad: if (m) m_freem(m); if (tc != NULL) - free(tc, M_XDATA); + kfree(tc, M_XDATA); if (crp) crypto_freereq(crp); return error; @@ -570,7 +570,7 @@ ipcomp_output_cb(struct cryptop *crp) } /* Release the crypto descriptor */ - free(tc, M_XDATA); + kfree(tc, M_XDATA); crypto_freereq(crp); /* NB: m is reclaimed by ipsec_process_done. */ @@ -584,7 +584,7 @@ bad: crit_exit(); if (m) m_freem(m); - free(tc, M_XDATA); + kfree(tc, M_XDATA); crypto_freereq(crp); return error; } diff --git a/sys/netproto/ipx/ipx.c b/sys/netproto/ipx/ipx.c index 257490ba14..512108be55 100644 --- a/sys/netproto/ipx/ipx.c +++ b/sys/netproto/ipx/ipx.c @@ -34,7 +34,7 @@ * @(#)ipx.c * * $FreeBSD: src/sys/netipx/ipx.c,v 1.17.2.3 2003/04/04 09:35:43 tjr Exp $ - * $DragonFly: src/sys/netproto/ipx/ipx.c,v 1.10 2006/01/14 13:36:40 swildner Exp $ + * $DragonFly: src/sys/netproto/ipx/ipx.c,v 1.11 2006/09/05 00:55:49 dillon Exp $ */ #include @@ -128,7 +128,7 @@ ipx_control(struct socket *so, u_long cmd, caddr_t data, case SIOCSIFDSTADDR: if (ia == NULL) { oia = (struct ipx_ifaddr *) - malloc(sizeof(*ia), M_IFADDR, + kmalloc(sizeof(*ia), M_IFADDR, M_WAITOK | M_ZERO); if (oia == NULL) return (ENOBUFS); diff --git a/sys/netproto/ipx/spx_usrreq.c b/sys/netproto/ipx/spx_usrreq.c index eb4341f702..50bb4c592c 100644 --- a/sys/netproto/ipx/spx_usrreq.c +++ b/sys/netproto/ipx/spx_usrreq.c @@ -34,7 +34,7 @@ * @(#)spx_usrreq.h * * $FreeBSD: src/sys/netipx/spx_usrreq.c,v 1.27.2.1 2001/02/22 09:44:18 bp Exp $ - * $DragonFly: src/sys/netproto/ipx/spx_usrreq.c,v 1.16 2005/06/10 22:34:49 dillon Exp $ + * $DragonFly: src/sys/netproto/ipx/spx_usrreq.c,v 1.17 2006/09/05 00:55:49 dillon Exp $ */ #include @@ -542,7 +542,7 @@ update_window: break; } } - nq = malloc(sizeof(struct spx_q), M_SPX_Q, M_INTNOWAIT); + nq = kmalloc(sizeof(struct spx_q), M_SPX_Q, M_INTNOWAIT); if (nq == NULL) { m_freem(si_m); return (0); @@ -578,7 +578,7 @@ present: nq = q; q = q->si_prev; remque(nq); - free(nq, M_SPX_Q); + kfree(nq, M_SPX_Q); wakeup = 1; spxstat.spxs_rcvpack++; #ifdef SF_NEWCALL @@ -1639,7 +1639,7 @@ spx_close(struct spxpcb *cb) m = oq->si_mbuf; remque(oq); m_freem(m); - free(oq, M_SPX_Q); + kfree(oq, M_SPX_Q); } m_free(cb->s_ipx_m); FREE(cb, M_PCB); diff --git a/sys/netproto/key/key.c b/sys/netproto/key/key.c index a720b77180..ba62f14469 100644 --- a/sys/netproto/key/key.c +++ b/sys/netproto/key/key.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netkey/key.c,v 1.16.2.13 2002/07/24 18:17:40 ume Exp $ */ -/* $DragonFly: src/sys/netproto/key/key.c,v 1.17 2006/09/03 18:52:29 dillon Exp $ */ +/* $DragonFly: src/sys/netproto/key/key.c,v 1.18 2006/09/05 00:55:49 dillon Exp $ */ /* $KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $ */ /* @@ -309,13 +309,13 @@ do { \ #if 1 #define KMALLOC(p, t, n) \ - ((p) = (t) malloc((unsigned long)(n), M_SECA, M_INTWAIT | M_NULLOK)) + ((p) = (t) kmalloc((unsigned long)(n), M_SECA, M_INTWAIT | M_NULLOK)) #define KFREE(p) \ - free((caddr_t)(p), M_SECA); + kfree((caddr_t)(p), M_SECA); #else #define KMALLOC(p, t, n) \ do { \ - ((p) = (t)malloc((unsigned long)(n), M_SECA, M_INTWAIT | M_NULLOK)); \ + ((p) = (t)kmalloc((unsigned long)(n), M_SECA, M_INTWAIT | M_NULLOK)); \ printf("%s %d: %p <- KMALLOC(%s, %d)\n", \ __FILE__, __LINE__, (p), #t, n); \ } while (0) @@ -323,7 +323,7 @@ do { \ #define KFREE(p) \ do { \ printf("%s %d: %p -> KFREE()\n", __FILE__, __LINE__, (p)); \ - free((caddr_t)(p), M_SECA); \ + kfree((caddr_t)(p), M_SECA); \ } while (0) #endif diff --git a/sys/netproto/key/keydb.c b/sys/netproto/key/keydb.c index 9f20fcf399..9ac35d697a 100644 --- a/sys/netproto/key/keydb.c +++ b/sys/netproto/key/keydb.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netkey/keydb.c,v 1.1.2.1 2000/07/15 07:14:42 kris Exp $ */ -/* $DragonFly: src/sys/netproto/key/keydb.c,v 1.8 2006/01/14 13:36:40 swildner Exp $ */ +/* $DragonFly: src/sys/netproto/key/keydb.c,v 1.9 2006/09/05 00:55:49 dillon Exp $ */ /* $KAME: keydb.c,v 1.64 2000/05/11 17:02:30 itojun Exp $ */ /* @@ -68,7 +68,7 @@ keydb_newsecpolicy(void) { struct secpolicy *p; - p = malloc(sizeof(*p), M_SECA, M_INTWAIT | M_NULLOK); + p = kmalloc(sizeof(*p), M_SECA, M_INTWAIT | M_NULLOK); if (!p) return p; bzero(p, sizeof(*p)); @@ -79,7 +79,7 @@ void keydb_delsecpolicy(struct secpolicy *p) { - free(p, M_SECA); + kfree(p, M_SECA); } /* @@ -91,7 +91,7 @@ keydb_newsecashead(void) struct secashead *p; int i; - p = malloc(sizeof(*p), M_SECA, M_INTWAIT | M_NULLOK); + p = kmalloc(sizeof(*p), M_SECA, M_INTWAIT | M_NULLOK); if (!p) return p; bzero(p, sizeof(*p)); @@ -104,7 +104,7 @@ void keydb_delsecashead(struct secashead *p) { - free(p, M_SECA); + kfree(p, M_SECA); } /* @@ -115,7 +115,7 @@ keydb_newsecasvar(void) { struct secasvar *p; - p = malloc(sizeof(*p), M_SECA, M_INTWAIT | M_NULLOK); + p = kmalloc(sizeof(*p), M_SECA, M_INTWAIT | M_NULLOK); if (!p) return p; bzero(p, sizeof(*p)); @@ -149,7 +149,7 @@ keydb_delsecasvar(struct secasvar *p) if (p->refcnt) panic("keydb_delsecasvar called with refcnt != 0"); - free(p, M_SECA); + kfree(p, M_SECA); } /* @@ -160,15 +160,15 @@ keydb_newsecreplay(size_t wsize) { struct secreplay *p; - p = malloc(sizeof(*p), M_SECA, M_INTWAIT | M_NULLOK); + p = kmalloc(sizeof(*p), M_SECA, M_INTWAIT | M_NULLOK); if (!p) return p; bzero(p, sizeof(*p)); if (wsize != 0) { - p->bitmap = (caddr_t)malloc(wsize, M_SECA, M_INTWAIT | M_NULLOK); + p->bitmap = (caddr_t)kmalloc(wsize, M_SECA, M_INTWAIT | M_NULLOK); if (!p->bitmap) { - free(p, M_SECA); + kfree(p, M_SECA); return NULL; } bzero(p->bitmap, wsize); @@ -182,8 +182,8 @@ keydb_delsecreplay(struct secreplay *p) { if (p->bitmap) - free(p->bitmap, M_SECA); - free(p, M_SECA); + kfree(p->bitmap, M_SECA); + kfree(p, M_SECA); } /* @@ -194,7 +194,7 @@ keydb_newsecreg(void) { struct secreg *p; - p = malloc(sizeof(*p), M_SECA, M_INTWAIT | M_ZERO | M_NULLOK); + p = kmalloc(sizeof(*p), M_SECA, M_INTWAIT | M_ZERO | M_NULLOK); return p; } @@ -202,5 +202,5 @@ void keydb_delsecreg(struct secreg *p) { - free(p, M_SECA); + kfree(p, M_SECA); } diff --git a/sys/netproto/key/keysock.c b/sys/netproto/key/keysock.c index dff6f14c71..2a474b3d54 100644 --- a/sys/netproto/key/keysock.c +++ b/sys/netproto/key/keysock.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netkey/keysock.c,v 1.1.2.4 2003/01/11 19:10:59 ume Exp $ */ -/* $DragonFly: src/sys/netproto/key/keysock.c,v 1.14 2006/01/14 13:36:40 swildner Exp $ */ +/* $DragonFly: src/sys/netproto/key/keysock.c,v 1.15 2006/09/05 00:55:49 dillon Exp $ */ /* $KAME: keysock.c,v 1.25 2001/08/13 20:07:41 itojun Exp $ */ /* @@ -385,7 +385,7 @@ key_attach(struct socket *so, int proto, struct pru_attach_info *ai) if (sotorawcb(so) != 0) return EISCONN; /* XXX panic? */ - kp = (struct keycb *)malloc(sizeof *kp, M_PCB, M_WAITOK); /* XXX */ + kp = (struct keycb *)kmalloc(sizeof *kp, M_PCB, M_WAITOK); /* XXX */ if (kp == 0) return ENOBUFS; bzero(kp, sizeof *kp); @@ -402,7 +402,7 @@ key_attach(struct socket *so, int proto, struct pru_attach_info *ai) error = raw_usrreqs.pru_attach(so, proto, ai); kp = (struct keycb *)sotorawcb(so); if (error) { - free(kp, M_PCB); + kfree(kp, M_PCB); so->so_pcb = (caddr_t) 0; crit_exit(); return error; diff --git a/sys/netproto/ncp/ncp_conn.c b/sys/netproto/ncp/ncp_conn.c index 0bc660472f..962a58d43e 100644 --- a/sys/netproto/ncp/ncp_conn.c +++ b/sys/netproto/ncp/ncp_conn.c @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * $FreeBSD: src/sys/netncp/ncp_conn.c,v 1.3.2.5 2001/02/22 08:54:11 bp Exp $ - * $DragonFly: src/sys/netproto/ncp/ncp_conn.c,v 1.12 2006/05/05 20:15:01 dillon Exp $ + * $DragonFly: src/sys/netproto/ncp/ncp_conn.c,v 1.13 2006/09/05 00:55:49 dillon Exp $ * * Connection tables */ @@ -262,8 +262,8 @@ ncp_conn_free(struct ncp_conn *ncp) SLIST_REMOVE(&conn_list, ncp, ncp_conn, nc_next); ncp_conn_cnt--; ncp_conn_unlocklist(ncp->td); - if (ncp->li.user) free(ncp->li.user, M_NCPDATA); - if (ncp->li.password) free(ncp->li.password, M_NCPDATA); + if (ncp->li.user) kfree(ncp->li.user, M_NCPDATA); + if (ncp->li.password) kfree(ncp->li.password, M_NCPDATA); crfree(ncp->nc_owner); FREE(ncp, M_NCPDATA); return (0); diff --git a/sys/netproto/ncp/ncp_login.c b/sys/netproto/ncp/ncp_login.c index e757d768ec..399ed85837 100644 --- a/sys/netproto/ncp/ncp_login.c +++ b/sys/netproto/ncp/ncp_login.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netncp/ncp_login.c,v 1.2 1999/10/12 10:36:59 bp Exp $ - * $DragonFly: src/sys/netproto/ncp/ncp_login.c,v 1.6 2005/02/28 16:23:00 joerg Exp $ + * $DragonFly: src/sys/netproto/ncp/ncp_login.c,v 1.7 2006/09/05 00:55:49 dillon Exp $ */ #include #include @@ -193,8 +193,8 @@ ncp_login(struct ncp_conn *conn, const char *user, int objtype, conn->flags |= NCPFL_LOGGED; return 0; bad: - if (conn->li.user) free(conn->li.user, M_NCPDATA); - if (conn->li.password) free(conn->li.password, M_NCPDATA); + if (conn->li.user) kfree(conn->li.user, M_NCPDATA); + if (conn->li.password) kfree(conn->li.password, M_NCPDATA); conn->li.user = conn->li.password = NULL; return error; } diff --git a/sys/netproto/ncp/ncp_mod.c b/sys/netproto/ncp/ncp_mod.c index fe3dab34d2..d8dae6aeee 100644 --- a/sys/netproto/ncp/ncp_mod.c +++ b/sys/netproto/ncp/ncp_mod.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netncp/ncp_mod.c,v 1.2 1999/10/12 10:36:59 bp Exp $ - * $DragonFly: src/sys/netproto/ncp/ncp_mod.c,v 1.9 2006/06/05 07:26:11 dillon Exp $ + * $DragonFly: src/sys/netproto/ncp/ncp_mod.c,v 1.10 2006/09/05 00:55:49 dillon Exp $ */ #include #include @@ -350,7 +350,7 @@ sncp_conn_scan(struct thread *td, struct sncp_conn_scan_args *uap) password = ncp_str_dup(lip->password); if (password == NULL) { if (user) - free(user, M_NCPDATA); + kfree(user, M_NCPDATA); return EINVAL; } ncp_str_upper(password); @@ -365,8 +365,8 @@ sncp_conn_scan(struct thread *td, struct sncp_conn_scan_args *uap) ncp_conn_unlock(conn,td); copyout(&connHandle,uap->connHandle,sizeof(connHandle)); } - if (user) free(user, M_NCPDATA); - if (password) free(password, M_NCPDATA); + if (user) kfree(user, M_NCPDATA); + if (password) kfree(password, M_NCPDATA); uap->sysmsg_result = error; return error; diff --git a/sys/netproto/ncp/ncp_subr.c b/sys/netproto/ncp/ncp_subr.c index 54965e4ada..0749bc7463 100644 --- a/sys/netproto/ncp/ncp_subr.c +++ b/sys/netproto/ncp/ncp_subr.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netncp/ncp_subr.c,v 1.2.2.1 2001/02/22 08:54:11 bp Exp $ - * $DragonFly: src/sys/netproto/ncp/ncp_subr.c,v 1.8 2005/02/28 16:23:00 joerg Exp $ + * $DragonFly: src/sys/netproto/ncp/ncp_subr.c,v 1.9 2006/09/05 00:55:49 dillon Exp $ */ #include #include @@ -73,7 +73,7 @@ ncp_str_dup(const char *s) len++; if (bt == 0) break; } - dst = malloc(len, M_NCPDATA, M_WAITOK); + dst = kmalloc(len, M_NCPDATA, M_WAITOK); copyin(s, dst, len); return(dst); } diff --git a/sys/netproto/ns/ns.c b/sys/netproto/ns/ns.c index 8f29378b1b..c096d41b72 100644 --- a/sys/netproto/ns/ns.c +++ b/sys/netproto/ns/ns.c @@ -32,7 +32,7 @@ * * @(#)ns.c 8.2 (Berkeley) 11/15/93 * $FreeBSD: src/sys/netns/ns.c,v 1.9 1999/08/28 00:49:47 peter Exp $ - * $DragonFly: src/sys/netproto/ns/ns.c,v 1.12 2006/01/14 13:36:40 swildner Exp $ + * $DragonFly: src/sys/netproto/ns/ns.c,v 1.13 2006/09/05 00:55:49 dillon Exp $ */ #include @@ -135,7 +135,7 @@ ns_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp, case SIOCSIFDSTADDR: if (ia == (struct ns_ifaddr *)0) { oia = (struct ns_ifaddr *) - malloc(sizeof *ia, M_IFADDR, M_WAITOK); + kmalloc(sizeof *ia, M_IFADDR, M_WAITOK); if (oia == (struct ns_ifaddr *)NULL) return (ENOBUFS); bzero((caddr_t)oia, sizeof(*oia)); diff --git a/sys/netproto/ns/ns_pcb.c b/sys/netproto/ns/ns_pcb.c index 49ae3d16a9..f4fca20589 100644 --- a/sys/netproto/ns/ns_pcb.c +++ b/sys/netproto/ns/ns_pcb.c @@ -32,7 +32,7 @@ * * @(#)ns_pcb.c 8.1 (Berkeley) 6/10/93 * $FreeBSD: src/sys/netns/ns_pcb.c,v 1.9 1999/08/28 00:49:51 peter Exp $ - * $DragonFly: src/sys/netproto/ns/ns_pcb.c,v 1.14 2006/01/14 13:36:40 swildner Exp $ + * $DragonFly: src/sys/netproto/ns/ns_pcb.c,v 1.15 2006/09/05 00:55:49 dillon Exp $ */ #include @@ -64,7 +64,7 @@ ns_pcballoc(struct socket *so, struct nspcb *head) { struct nspcb *nsp; - nsp = malloc(sizeof(struct nspcb), M_NSPCB, M_WAITOK|M_ZERO); + nsp = kmalloc(sizeof(struct nspcb), M_NSPCB, M_WAITOK|M_ZERO); nsp->nsp_socket = so; insque(nsp, head); so->so_pcb = (caddr_t)nsp; @@ -239,7 +239,7 @@ ns_pcbdetach(struct nspcb *nsp) if (nsp->nsp_route.ro_rt) rtfree(nsp->nsp_route.ro_rt); remque(nsp); - free(nsp, M_NSPCB); + kfree(nsp, M_NSPCB); } void diff --git a/sys/netproto/ns/spp_usrreq.c b/sys/netproto/ns/spp_usrreq.c index 702cc79324..28040470ac 100644 --- a/sys/netproto/ns/spp_usrreq.c +++ b/sys/netproto/ns/spp_usrreq.c @@ -32,7 +32,7 @@ * * @(#)spp_usrreq.c 8.1 (Berkeley) 6/10/93 * $FreeBSD: src/sys/netns/spp_usrreq.c,v 1.11 1999/08/28 00:49:53 peter Exp $ - * $DragonFly: src/sys/netproto/ns/spp_usrreq.c,v 1.17 2006/01/14 13:36:40 swildner Exp $ + * $DragonFly: src/sys/netproto/ns/spp_usrreq.c,v 1.18 2006/09/05 00:55:49 dillon Exp $ */ #include @@ -509,7 +509,7 @@ update_window: break; } } - nq = malloc(sizeof(struct spidp_q), M_SPIDP_Q, M_INTNOWAIT); + nq = kmalloc(sizeof(struct spidp_q), M_SPIDP_Q, M_INTNOWAIT); if (nq == NULL) { m_freem(si_m); return(0); @@ -545,7 +545,7 @@ present: nq = q; q = q->si_prev; remque(nq); - free(nq, M_SPIDP_Q); + kfree(nq, M_SPIDP_Q); wakeup = 1; sppstat.spps_rcvpack++; #ifdef SF_NEWCALL @@ -1332,8 +1332,8 @@ spp_attach(struct socket *so, int proto, struct pru_attach_info *ai) nsp = sotonspcb(so); sb = &so->so_snd; - cb = malloc(sizeof(struct sppcb), M_SPPCB, M_WAITOK|M_ZERO); - cb->s_idp = malloc(sizeof(struct idp), M_IDP, M_WAITOK|M_ZERO); + cb = kmalloc(sizeof(struct sppcb), M_SPPCB, M_WAITOK|M_ZERO); + cb->s_idp = kmalloc(sizeof(struct idp), M_IDP, M_WAITOK|M_ZERO); cb->s_state = TCPS_LISTEN; cb->s_smax = -1; cb->s_swl1 = -1; @@ -1687,10 +1687,10 @@ spp_close(struct sppcb *cb) m = oq->si_mbuf; remque(oq); m_freem(m); - free(oq, M_SPIDP_Q); + kfree(oq, M_SPIDP_Q); } - free(cb->s_idp, M_IDP); - free(cb, M_SPPCB); + kfree(cb->s_idp, M_IDP); + kfree(cb, M_SPPCB); nsp->nsp_pcb = 0; soisdisconnected(so); ns_pcbdetach(nsp); diff --git a/sys/netproto/smb/smb_conn.c b/sys/netproto/smb/smb_conn.c index 20549040e6..9743a3b4fb 100644 --- a/sys/netproto/smb/smb_conn.c +++ b/sys/netproto/smb/smb_conn.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netsmb/smb_conn.c,v 1.1.2.1 2001/05/22 08:32:33 bp Exp $ - * $DragonFly: src/sys/netproto/smb/smb_conn.c,v 1.17 2006/07/28 02:17:41 dillon Exp $ + * $DragonFly: src/sys/netproto/smb/smb_conn.c,v 1.18 2006/09/05 00:55:49 dillon Exp $ */ /* @@ -497,9 +497,9 @@ smb_vc_free(struct smb_connobj *cp) SMB_STRFREE(vcp->vc_pass); SMB_STRFREE(vcp->vc_domain); if (vcp->vc_paddr) - free(vcp->vc_paddr, M_SONAME); + kfree(vcp->vc_paddr, M_SONAME); if (vcp->vc_laddr) - free(vcp->vc_laddr, M_SONAME); + kfree(vcp->vc_laddr, M_SONAME); if (vcp->vc_tolower) iconv_close(vcp->vc_tolower); if (vcp->vc_toupper) @@ -510,7 +510,7 @@ smb_vc_free(struct smb_connobj *cp) iconv_close(vcp->vc_toserver); smb_co_done(VCTOCP(vcp)); smb_sl_destroy(&vcp->vc_stlock); - free(vcp, M_SMBCONN); + kfree(vcp, M_SMBCONN); } /* @@ -752,7 +752,7 @@ smb_share_free(struct smb_connobj *cp) SMB_STRFREE(ssp->ss_pass); smb_sl_destroy(&ssp->ss_stlock); smb_co_done(SSTOCP(ssp)); - free(ssp, M_SMBCONN); + kfree(ssp, M_SMBCONN); } static void diff --git a/sys/netproto/smb/smb_crypt.c b/sys/netproto/smb/smb_crypt.c index 5542de9837..3922eefb60 100644 --- a/sys/netproto/smb/smb_crypt.c +++ b/sys/netproto/smb/smb_crypt.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netsmb/smb_crypt.c,v 1.1.2.3 2001/09/03 08:55:11 bp Exp $ - * $DragonFly: src/sys/netproto/smb/smb_crypt.c,v 1.3 2003/08/07 21:17:38 dillon Exp $ + * $DragonFly: src/sys/netproto/smb/smb_crypt.c,v 1.4 2006/09/05 00:55:49 dillon Exp $ */ #include #include @@ -74,10 +74,10 @@ smb_E(const u_char *key, u_char *data, u_char *dest) kk[5] = key[4] << 3 | (key[5] >> 5 & 0xfe); kk[6] = key[5] << 2 | (key[6] >> 6 & 0xfe); kk[7] = key[6] << 1; - ksp = malloc(sizeof(des_key_schedule), M_SMBTEMP, M_WAITOK); + ksp = kmalloc(sizeof(des_key_schedule), M_SMBTEMP, M_WAITOK); des_set_key((des_cblock *)kk, *ksp); des_ecb_encrypt((des_cblock *)data, (des_cblock *)dest, *ksp, 1); - free(ksp, M_SMBTEMP); + kfree(ksp, M_SMBTEMP); } #endif @@ -88,7 +88,7 @@ smb_encrypt(const u_char *apwd, u_char *C8, u_char *RN) #ifdef NETSMBCRYPTO u_char *p, *P14, *S21; - p = malloc(14 + 21, M_SMBTEMP, M_WAITOK); + p = kmalloc(14 + 21, M_SMBTEMP, M_WAITOK); bzero(p, 14 + 21); P14 = p; S21 = p + 14; @@ -102,7 +102,7 @@ smb_encrypt(const u_char *apwd, u_char *C8, u_char *RN) smb_E(S21, C8, RN); smb_E(S21 + 7, C8, RN + 8); smb_E(S21 + 14, C8, RN + 16); - free(p, M_SMBTEMP); + kfree(p, M_SMBTEMP); return 0; #else SMBERROR("password encryption is not available\n"); @@ -121,18 +121,18 @@ smb_ntencrypt(const u_char *apwd, u_char *C8, u_char *RN) int len; len = strlen(apwd); - unipwd = malloc((len + 1) * sizeof(u_int16_t), M_SMBTEMP, M_WAITOK); + unipwd = kmalloc((len + 1) * sizeof(u_int16_t), M_SMBTEMP, M_WAITOK); /* * S21 = concat(MD4(U(apwd)), zeros(5)); */ smb_strtouni(unipwd, apwd); - ctxp = malloc(sizeof(MD4_CTX), M_SMBTEMP, M_WAITOK); + ctxp = kmalloc(sizeof(MD4_CTX), M_SMBTEMP, M_WAITOK); MD4Init(ctxp); MD4Update(ctxp, (u_char*)unipwd, len * sizeof(u_int16_t)); - free(unipwd, M_SMBTEMP); + kfree(unipwd, M_SMBTEMP); bzero(S21, 21); MD4Final(S21, ctxp); - free(ctxp, M_SMBTEMP); + kfree(ctxp, M_SMBTEMP); smb_E(S21, C8, RN); smb_E(S21 + 7, C8, RN + 8); diff --git a/sys/netproto/smb/smb_dev.c b/sys/netproto/smb/smb_dev.c index e4fe23952a..5e44f77d59 100644 --- a/sys/netproto/smb/smb_dev.c +++ b/sys/netproto/smb/smb_dev.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netsmb/smb_dev.c,v 1.2.2.1 2001/05/22 08:32:33 bp Exp $ - * $DragonFly: src/sys/netproto/smb/smb_dev.c,v 1.13 2006/07/28 02:17:41 dillon Exp $ + * $DragonFly: src/sys/netproto/smb/smb_dev.c,v 1.14 2006/09/05 00:55:49 dillon Exp $ */ #include #include @@ -109,7 +109,7 @@ nsmb_dev_open(struct dev_open_args *ap) if (sdp && (sdp->sd_flags & NSMBFL_OPEN)) return EBUSY; if (sdp == NULL) { - sdp = malloc(sizeof(*sdp), M_NSMBDEV, M_WAITOK); + sdp = kmalloc(sizeof(*sdp), M_NSMBDEV, M_WAITOK); dev->si_drv1 = (void*)sdp; } /* @@ -161,7 +161,7 @@ nsmb_dev_close(struct dev_close_args *ap) smb_flushq(&sdp->sd_rplist); */ dev->si_drv1 = NULL; - free(sdp, M_NSMBDEV); + kfree(sdp, M_NSMBDEV); crit_exit(); return 0; } diff --git a/sys/netproto/smb/smb_iod.c b/sys/netproto/smb/smb_iod.c index c4bd5fbef1..f667dfd5fd 100644 --- a/sys/netproto/smb/smb_iod.c +++ b/sys/netproto/smb/smb_iod.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netsmb/smb_iod.c,v 1.1.2.2 2002/04/23 03:45:01 bp Exp $ - * $DragonFly: src/sys/netproto/smb/smb_iod.c,v 1.13 2005/12/08 19:15:12 dillon Exp $ + * $DragonFly: src/sys/netproto/smb/smb_iod.c,v 1.14 2006/09/05 00:55:49 dillon Exp $ */ #include @@ -389,7 +389,7 @@ smb_iod_request(struct smbiod *iod, int event, void *ident) smb_iod_wakeup(iod); smb_sleep(evp, SMB_IOD_EVINTERLOCK(iod), PDROP, "90evw", 0); error = evp->ev_error; - free(evp, M_SMBIOD); + kfree(evp, M_SMBIOD); return error; } @@ -621,7 +621,7 @@ smb_iod_main(struct smbiod *iod) wakeup(evp); SMB_IOD_EVUNLOCK(iod); } else - free(evp, M_SMBIOD); + kfree(evp, M_SMBIOD); } #if 0 if (iod->iod_state == SMBIOD_ST_VCACTIVE) { @@ -679,7 +679,7 @@ smb_iod_create(struct smb_vc *vcp) RFNOWAIT, "smbiod%d", iod->iod_id); if (error) { SMBERROR("can't start smbiod: %d", error); - free(iod, M_SMBIOD); + kfree(iod, M_SMBIOD); return error; } iod->iod_td = newp->p_thread; @@ -692,7 +692,7 @@ smb_iod_destroy(struct smbiod *iod) smb_iod_request(iod, SMBIOD_EV_SHUTDOWN | SMBIOD_EV_SYNC, NULL); smb_sl_destroy(&iod->iod_rqlock); smb_sl_destroy(&iod->iod_evlock); - free(iod, M_SMBIOD); + kfree(iod, M_SMBIOD); return 0; } diff --git a/sys/netproto/smb/smb_rq.c b/sys/netproto/smb/smb_rq.c index b5d93a58f5..c90ccdaf2e 100644 --- a/sys/netproto/smb/smb_rq.c +++ b/sys/netproto/smb/smb_rq.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netsmb/smb_rq.c,v 1.1.2.2 2002/04/23 03:45:01 bp Exp $ - * $DragonFly: src/sys/netproto/smb/smb_rq.c,v 1.9 2005/12/06 04:03:56 dillon Exp $ + * $DragonFly: src/sys/netproto/smb/smb_rq.c,v 1.10 2006/09/05 00:55:49 dillon Exp $ */ #include #include @@ -139,7 +139,7 @@ smb_rq_done(struct smb_rq *rqp) md_done(&rqp->sr_rp); smb_sl_destroy(&rqp->sr_slock); if (rqp->sr_flags & SMBR_ALLOCED) - free(rqp, M_SMBRQ); + kfree(rqp, M_SMBRQ); } /* @@ -405,7 +405,7 @@ smb_t2_done(struct smb_t2rq *t2p) md_done(&t2p->t2_rparam); md_done(&t2p->t2_rdata); if (t2p->t2_flags & SMBT2_ALLOCED) - free(t2p, M_SMBRQ); + kfree(t2p, M_SMBRQ); } static int diff --git a/sys/netproto/smb/smb_smb.c b/sys/netproto/smb/smb_smb.c index 6946686903..52bd0bbb87 100644 --- a/sys/netproto/smb/smb_smb.c +++ b/sys/netproto/smb/smb_smb.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netsmb/smb_smb.c,v 1.1.2.3 2002/12/14 14:44:19 fjoe Exp $ - * $DragonFly: src/sys/netproto/smb/smb_smb.c,v 1.5 2005/02/17 14:00:09 joerg Exp $ + * $DragonFly: src/sys/netproto/smb/smb_smb.c,v 1.6 2006/09/05 00:55:49 dillon Exp $ */ /* * various SMB requests. Most of the routines merely packs data into mbufs. @@ -245,15 +245,15 @@ smb_smb_ssnsetup(struct smb_vc *vcp, struct smb_cred *scred) error = smb_rq_alloc(VCTOCP(vcp), SMB_COM_SESSION_SETUP_ANDX, scred, &rqp); if (error) return error; - pbuf = malloc(SMB_MAXPASSWORDLEN + 1, M_SMBTEMP, M_WAITOK); - encpass = malloc(24, M_SMBTEMP, M_WAITOK); + pbuf = kmalloc(SMB_MAXPASSWORDLEN + 1, M_SMBTEMP, M_WAITOK); + encpass = kmalloc(24, M_SMBTEMP, M_WAITOK); if (vcp->vc_sopt.sv_sm & SMB_SM_USER) { iconv_convstr(vcp->vc_toupper, pbuf, smb_vc_getpass(vcp)); iconv_convstr(vcp->vc_toserver, pbuf, pbuf); if (vcp->vc_sopt.sv_sm & SMB_SM_ENCRYPT) { uniplen = plen = 24; smb_encrypt(pbuf, vcp->vc_ch, encpass); - ntencpass = malloc(uniplen, M_SMBTEMP, M_WAITOK); + ntencpass = kmalloc(uniplen, M_SMBTEMP, M_WAITOK); iconv_convstr(vcp->vc_toserver, pbuf, smb_vc_getpass(vcp)); smb_ntencrypt(pbuf, vcp->vc_ch, (u_char*)ntencpass); pp = encpass; @@ -262,7 +262,7 @@ smb_smb_ssnsetup(struct smb_vc *vcp, struct smb_cred *scred) plen = strlen(pbuf) + 1; pp = pbuf; uniplen = plen * 2; - ntencpass = malloc(uniplen, M_SMBTEMP, M_WAITOK); + ntencpass = kmalloc(uniplen, M_SMBTEMP, M_WAITOK); smb_strtouni(ntencpass, smb_vc_getpass(vcp)); plen--; @@ -319,7 +319,7 @@ smb_smb_ssnsetup(struct smb_vc *vcp, struct smb_cred *scred) } smb_rq_bend(rqp); if (ntencpass) - free(ntencpass, M_SMBTEMP); + kfree(ntencpass, M_SMBTEMP); error = smb_rq_simple(rqp); SMBSDEBUG("%d\n", error); if (error) { @@ -329,8 +329,8 @@ smb_smb_ssnsetup(struct smb_vc *vcp, struct smb_cred *scred) } vcp->vc_smbuid = rqp->sr_rpuid; bad: - free(encpass, M_SMBTEMP); - free(pbuf, M_SMBTEMP); + kfree(encpass, M_SMBTEMP); + kfree(pbuf, M_SMBTEMP); smb_rq_done(rqp); return error; } @@ -414,8 +414,8 @@ smb_smb_treeconnect(struct smb_share *ssp, struct smb_cred *scred) pbuf = NULL; encpass = NULL; } else { - pbuf = malloc(SMB_MAXPASSWORDLEN + 1, M_SMBTEMP, M_WAITOK); - encpass = malloc(24, M_SMBTEMP, M_WAITOK); + pbuf = kmalloc(SMB_MAXPASSWORDLEN + 1, M_SMBTEMP, M_WAITOK); + encpass = kmalloc(24, M_SMBTEMP, M_WAITOK); iconv_convstr(vcp->vc_toupper, pbuf, smb_share_getpass(ssp)); iconv_convstr(vcp->vc_toserver, pbuf, pbuf); if (vcp->vc_sopt.sv_sm & SMB_SM_ENCRYPT) { @@ -455,9 +455,9 @@ smb_smb_treeconnect(struct smb_share *ssp, struct smb_cred *scred) ssp->ss_flags |= SMBS_CONNECTED; bad: if (encpass) - free(encpass, M_SMBTEMP); + kfree(encpass, M_SMBTEMP); if (pbuf) - free(pbuf, M_SMBTEMP); + kfree(pbuf, M_SMBTEMP); smb_rq_done(rqp); return error; } diff --git a/sys/netproto/smb/smb_subr.c b/sys/netproto/smb/smb_subr.c index bb3cabf037..e5b919fe78 100644 --- a/sys/netproto/smb/smb_subr.c +++ b/sys/netproto/smb/smb_subr.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netsmb/smb_subr.c,v 1.1.2.2 2001/09/03 08:55:11 bp Exp $ - * $DragonFly: src/sys/netproto/smb/smb_subr.c,v 1.19 2005/12/08 19:15:12 dillon Exp $ + * $DragonFly: src/sys/netproto/smb/smb_subr.c,v 1.20 2006/09/05 00:55:49 dillon Exp $ */ #include #include @@ -96,7 +96,7 @@ smb_strdup(const char *s) int len; len = s ? strlen(s) + 1 : 1; - p = malloc(len, M_SMBSTR, M_WAITOK); + p = kmalloc(len, M_SMBSTR, M_WAITOK); if (s) bcopy(s, p, len); else @@ -122,7 +122,7 @@ smb_strdupin(char *s, int maxlen) if (bt == 0) break; } - p = malloc(len, M_SMBSTR, M_WAITOK); + p = kmalloc(len, M_SMBSTR, M_WAITOK); copyin(s, p, len); return p; } @@ -137,10 +137,10 @@ smb_memdupin(void *umem, int len) if (len > 8 * 1024) return NULL; - p = malloc(len, M_SMBSTR, M_WAITOK); + p = kmalloc(len, M_SMBSTR, M_WAITOK); if (copyin(umem, p, len) == 0) return p; - free(p, M_SMBSTR); + kfree(p, M_SMBSTR); return NULL; } @@ -154,7 +154,7 @@ smb_memdup(const void *umem, int len) if (len > 8 * 1024) return NULL; - p = malloc(len, M_SMBSTR, M_WAITOK); + p = kmalloc(len, M_SMBSTR, M_WAITOK); if (p == NULL) return NULL; bcopy(umem, p, len); @@ -164,20 +164,20 @@ smb_memdup(const void *umem, int len) void smb_strfree(char *s) { - free(s, M_SMBSTR); + kfree(s, M_SMBSTR); } void smb_memfree(void *s) { - free(s, M_SMBSTR); + kfree(s, M_SMBSTR); } void * smb_zmalloc(unsigned long size, struct malloc_type *type, int flags) { - return malloc(size, type, flags | M_ZERO); + return kmalloc(size, type, flags | M_ZERO); } void diff --git a/sys/netproto/smb/smb_trantcp.c b/sys/netproto/smb/smb_trantcp.c index 1a8a78dcf4..0c540b62ad 100644 --- a/sys/netproto/smb/smb_trantcp.c +++ b/sys/netproto/smb/smb_trantcp.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netsmb/smb_trantcp.c,v 1.3.2.1 2001/05/22 08:32:34 bp Exp $ - * $DragonFly: src/sys/netproto/smb/smb_trantcp.c,v 1.15 2006/06/13 08:12:04 dillon Exp $ + * $DragonFly: src/sys/netproto/smb/smb_trantcp.c,v 1.16 2006/09/05 00:55:49 dillon Exp $ */ #include #include @@ -462,10 +462,10 @@ smb_nbst_done(struct smb_vc *vcp, struct thread *td) return ENOTCONN; smb_nbst_disconnect(vcp, td); if (nbp->nbp_laddr) - free(nbp->nbp_laddr, M_SONAME); + kfree(nbp->nbp_laddr, M_SONAME); if (nbp->nbp_paddr) - free(nbp->nbp_paddr, M_SONAME); - free(nbp, M_NBDATA); + kfree(nbp->nbp_paddr, M_SONAME); + kfree(nbp, M_NBDATA); return 0; } @@ -520,7 +520,7 @@ smb_nbst_connect(struct smb_vc *vcp, struct sockaddr *sap, struct thread *td) if (slen < NB_MINSALEN) return EINVAL; if (nbp->nbp_paddr) { - free(nbp->nbp_paddr, M_SONAME); + kfree(nbp->nbp_paddr, M_SONAME); nbp->nbp_paddr = NULL; } snb = (struct sockaddr_nb*)dup_sockaddr(sap); diff --git a/sys/opencrypto/crypto.c b/sys/opencrypto/crypto.c index bfaf8dcd68..dbf6a3e3f2 100644 --- a/sys/opencrypto/crypto.c +++ b/sys/opencrypto/crypto.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/opencrypto/crypto.c,v 1.4.2.7 2003/06/03 00:09:02 sam Exp $ */ -/* $DragonFly: src/sys/opencrypto/crypto.c,v 1.10 2005/10/13 00:02:48 dillon Exp $ */ +/* $DragonFly: src/sys/opencrypto/crypto.c,v 1.11 2006/09/05 00:55:49 dillon Exp $ */ /* $OpenBSD: crypto.c,v 1.38 2002/06/11 11:14:29 beck Exp $ */ /* * The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu) @@ -175,7 +175,7 @@ crypto_destroy(void) { /* XXX no wait to reclaim zones */ if (crypto_drivers != NULL) - free(crypto_drivers, M_CRYPTO_DATA); + kfree(crypto_drivers, M_CRYPTO_DATA); unregister_swi(crypto_int_id); } @@ -371,7 +371,7 @@ crypto_get_driverid(u_int32_t flags) crypto_drivers_num *= 2; - free(crypto_drivers, M_CRYPTO_DATA); + kfree(crypto_drivers, M_CRYPTO_DATA); crypto_drivers = newdrv; } @@ -721,7 +721,7 @@ crypto_kinvoke(struct cryptkop *krp, int hint) if (krp == NULL) return EINVAL; if (krp->krp_callback == NULL) { - free(krp, M_XDATA); /* XXX allocated in cryptodev */ + kfree(krp, M_XDATA); /* XXX allocated in cryptodev */ return EINVAL; } diff --git a/sys/opencrypto/cryptodev.c b/sys/opencrypto/cryptodev.c index d82dc12efc..10a5ec998e 100644 --- a/sys/opencrypto/cryptodev.c +++ b/sys/opencrypto/cryptodev.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/opencrypto/cryptodev.c,v 1.4.2.4 2003/06/03 00:09:02 sam Exp $ */ -/* $DragonFly: src/sys/opencrypto/cryptodev.c,v 1.19 2006/08/02 01:25:26 dillon Exp $ */ +/* $DragonFly: src/sys/opencrypto/cryptodev.c,v 1.20 2006/09/05 00:55:49 dillon Exp $ */ /* $OpenBSD: cryptodev.c,v 1.52 2002/06/19 07:22:46 deraadt Exp $ */ /* @@ -349,7 +349,7 @@ cryptodev_op(struct csession *cse, struct crypt_op *cop) cse->uio.uio_iov = cse->iovec; bzero(&cse->iovec, sizeof(cse->iovec)); cse->uio.uio_iov[0].iov_len = cop->len; - cse->uio.uio_iov[0].iov_base = malloc(cop->len, M_XDATA, M_WAITOK); + cse->uio.uio_iov[0].iov_base = kmalloc(cop->len, M_XDATA, M_WAITOK); for (i = 0; i < cse->uio.uio_iovcnt; i++) cse->uio.uio_resid += cse->uio.uio_iov[0].iov_len; @@ -466,7 +466,7 @@ bail: if (crp) crypto_freereq(crp); if (cse->uio.uio_iov[0].iov_base) - free(cse->uio.uio_iov[0].iov_base, M_XDATA); + kfree(cse->uio.uio_iov[0].iov_base, M_XDATA); return (error); } @@ -531,7 +531,7 @@ cryptodev_key(struct crypt_kop *kop) return (EINVAL); } - krp = (struct cryptkop *)malloc(sizeof *krp, M_XDATA, M_WAITOK); + krp = (struct cryptkop *)kmalloc(sizeof *krp, M_XDATA, M_WAITOK); if (!krp) return (ENOMEM); bzero(krp, sizeof *krp); @@ -583,7 +583,7 @@ fail: if (krp->krp_param[i].crp_p) FREE(krp->krp_param[i].crp_p, M_XDATA); } - free(krp, M_XDATA); + kfree(krp, M_XDATA); } return (error); } diff --git a/sys/opencrypto/cryptosoft.c b/sys/opencrypto/cryptosoft.c index 5451392ec2..7ff49f69f8 100644 --- a/sys/opencrypto/cryptosoft.c +++ b/sys/opencrypto/cryptosoft.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/opencrypto/cryptosoft.c,v 1.2.2.1 2002/11/21 23:34:23 sam Exp $ */ -/* $DragonFly: src/sys/opencrypto/cryptosoft.c,v 1.3 2006/09/03 17:31:55 dillon Exp $ */ +/* $DragonFly: src/sys/opencrypto/cryptosoft.c,v 1.4 2006/09/05 00:55:49 dillon Exp $ */ /* $OpenBSD: cryptosoft.c,v 1.35 2002/04/26 08:43:50 deraadt Exp $ */ /* @@ -627,7 +627,7 @@ swcr_newsession(void *arg, u_int32_t *sid, struct cryptoini *cri) if (swcr_sessions) { bcopy(swcr_sessions, swd, (swcr_sesnum / 2) * sizeof(struct swcr_data *)); - free(swcr_sessions, M_CRYPTO_DATA); + kfree(swcr_sessions, M_CRYPTO_DATA); } swcr_sessions = swd; @@ -700,14 +700,14 @@ swcr_newsession(void *arg, u_int32_t *sid, struct cryptoini *cri) case CRYPTO_RIPEMD160_HMAC: axf = &auth_hash_hmac_ripemd_160_96; authcommon: - (*swd)->sw_ictx = malloc(axf->ctxsize, M_CRYPTO_DATA, + (*swd)->sw_ictx = kmalloc(axf->ctxsize, M_CRYPTO_DATA, M_NOWAIT); if ((*swd)->sw_ictx == NULL) { swcr_freesession(NULL, i); return ENOBUFS; } - (*swd)->sw_octx = malloc(axf->ctxsize, M_CRYPTO_DATA, + (*swd)->sw_octx = kmalloc(axf->ctxsize, M_CRYPTO_DATA, M_NOWAIT); if ((*swd)->sw_octx == NULL) { swcr_freesession(NULL, i); @@ -744,7 +744,7 @@ swcr_newsession(void *arg, u_int32_t *sid, struct cryptoini *cri) case CRYPTO_SHA1_KPDK: axf = &auth_hash_key_sha1; auth2common: - (*swd)->sw_ictx = malloc(axf->ctxsize, M_CRYPTO_DATA, + (*swd)->sw_ictx = kmalloc(axf->ctxsize, M_CRYPTO_DATA, M_NOWAIT); if ((*swd)->sw_ictx == NULL) { swcr_freesession(NULL, i); @@ -752,7 +752,7 @@ swcr_newsession(void *arg, u_int32_t *sid, struct cryptoini *cri) } /* Store the key so we can "append" it to the payload */ - (*swd)->sw_octx = malloc(cri->cri_klen / 8, M_CRYPTO_DATA, + (*swd)->sw_octx = kmalloc(cri->cri_klen / 8, M_CRYPTO_DATA, M_NOWAIT); if ((*swd)->sw_octx == NULL) { swcr_freesession(NULL, i); @@ -775,7 +775,7 @@ swcr_newsession(void *arg, u_int32_t *sid, struct cryptoini *cri) case CRYPTO_SHA1: axf = &auth_hash_sha1; auth3common: - (*swd)->sw_ictx = malloc(axf->ctxsize, M_CRYPTO_DATA, + (*swd)->sw_ictx = kmalloc(axf->ctxsize, M_CRYPTO_DATA, M_NOWAIT); if ((*swd)->sw_ictx == NULL) { swcr_freesession(NULL, i); @@ -848,11 +848,11 @@ swcr_freesession(void *arg, u_int64_t tid) if (swd->sw_ictx) { bzero(swd->sw_ictx, axf->ctxsize); - free(swd->sw_ictx, M_CRYPTO_DATA); + kfree(swd->sw_ictx, M_CRYPTO_DATA); } if (swd->sw_octx) { bzero(swd->sw_octx, axf->ctxsize); - free(swd->sw_octx, M_CRYPTO_DATA); + kfree(swd->sw_octx, M_CRYPTO_DATA); } break; @@ -862,11 +862,11 @@ swcr_freesession(void *arg, u_int64_t tid) if (swd->sw_ictx) { bzero(swd->sw_ictx, axf->ctxsize); - free(swd->sw_ictx, M_CRYPTO_DATA); + kfree(swd->sw_ictx, M_CRYPTO_DATA); } if (swd->sw_octx) { bzero(swd->sw_octx, swd->sw_klen); - free(swd->sw_octx, M_CRYPTO_DATA); + kfree(swd->sw_octx, M_CRYPTO_DATA); } break; @@ -875,7 +875,7 @@ swcr_freesession(void *arg, u_int64_t tid) axf = swd->sw_axf; if (swd->sw_ictx) - free(swd->sw_ictx, M_CRYPTO_DATA); + kfree(swd->sw_ictx, M_CRYPTO_DATA); break; case CRYPTO_DEFLATE_COMP: diff --git a/sys/opencrypto/deflate.c b/sys/opencrypto/deflate.c index fde1288547..de3a239d9b 100644 --- a/sys/opencrypto/deflate.c +++ b/sys/opencrypto/deflate.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/opencrypto/deflate.c,v 1.1.2.1 2002/11/21 23:34:23 sam Exp $ */ -/* $DragonFly: src/sys/opencrypto/deflate.c,v 1.2 2003/06/17 04:28:54 dillon Exp $ */ +/* $DragonFly: src/sys/opencrypto/deflate.c,v 1.3 2006/09/05 00:55:49 dillon Exp $ */ /* $OpenBSD: deflate.c,v 1.3 2001/08/20 02:45:22 hugh Exp $ */ /* @@ -178,7 +178,7 @@ z_alloc(nil, type, size) { void *ptr; - ptr = malloc(type *size, M_CRYPTO_DATA, M_NOWAIT); + ptr = kmalloc(type *size, M_CRYPTO_DATA, M_NOWAIT); return ptr; } @@ -186,5 +186,5 @@ void z_free(nil, ptr) void *nil, *ptr; { - free(ptr, M_CRYPTO_DATA); + kfree(ptr, M_CRYPTO_DATA); } diff --git a/sys/platform/pc32/i386/autoconf.c b/sys/platform/pc32/i386/autoconf.c index 647aae435f..91e865e024 100644 --- a/sys/platform/pc32/i386/autoconf.c +++ b/sys/platform/pc32/i386/autoconf.c @@ -35,7 +35,7 @@ * * from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91 * $FreeBSD: src/sys/i386/i386/autoconf.c,v 1.146.2.2 2001/06/07 06:05:58 dd Exp $ - * $DragonFly: src/sys/platform/pc32/i386/autoconf.c,v 1.24 2006/09/03 17:43:59 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/i386/autoconf.c,v 1.25 2006/09/05 00:55:45 dillon Exp $ */ /* @@ -313,7 +313,7 @@ setroot() if (!dev_is_good(newrootdev)) return; sname = dsname(newrootdev, unit, slice, part, partname); - rootdevnames[0] = malloc(strlen(sname) + 6, M_DEVBUF, M_WAITOK); + rootdevnames[0] = kmalloc(strlen(sname) + 6, M_DEVBUF, M_WAITOK); sprintf(rootdevnames[0], "ufs:%s%s", sname, partname); /* @@ -329,7 +329,7 @@ setroot() return; slice = COMPATIBILITY_SLICE; sname = dsname(newrootdev, unit, slice, part, partname); - rootdevnames[1] = malloc(strlen(sname) + 6, M_DEVBUF, M_WAITOK); + rootdevnames[1] = kmalloc(strlen(sname) + 6, M_DEVBUF, M_WAITOK); sprintf(rootdevnames[1], "ufs:%s%s", sname, partname); } #endif diff --git a/sys/platform/pc32/i386/bios.c b/sys/platform/pc32/i386/bios.c index 57c0c24c68..543d09caf2 100644 --- a/sys/platform/pc32/i386/bios.c +++ b/sys/platform/pc32/i386/bios.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/i386/bios.c,v 1.29.2.3 2001/07/19 18:07:35 imp Exp $ - * $DragonFly: src/sys/platform/pc32/i386/bios.c,v 1.11 2006/09/03 17:43:59 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/i386/bios.c,v 1.12 2006/09/05 00:55:45 dillon Exp $ */ /* @@ -373,7 +373,7 @@ bios16(struct bios_args *args, char *fmt, ...) /* * no page table, so create one and install it. */ - pte = malloc(PAGE_SIZE, M_TEMP, M_WAITOK|M_ZERO); + pte = kmalloc(PAGE_SIZE, M_TEMP, M_WAITOK|M_ZERO); ptd = (pd_entry_t *)((vm_offset_t)ptd + KERNBASE); *ptd = vtophys(pte) | PG_RW | PG_V; } else { @@ -442,7 +442,7 @@ bios16(struct bios_args *args, char *fmt, ...) *pte = 0; /* remove entry */ } else { *ptd = 0; /* remove page table */ - free(pte, M_TEMP); /* ... and free it */ + kfree(pte, M_TEMP); /* ... and free it */ } /* * XXX only needs to be invlpg(0) but that doesn't work on the 386 diff --git a/sys/platform/pc32/i386/busdma_machdep.c b/sys/platform/pc32/i386/busdma_machdep.c index 93f5c2088b..c9d9724d4a 100644 --- a/sys/platform/pc32/i386/busdma_machdep.c +++ b/sys/platform/pc32/i386/busdma_machdep.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/i386/busdma_machdep.c,v 1.16.2.2 2003/01/23 00:55:27 scottl Exp $ - * $DragonFly: src/sys/platform/pc32/i386/busdma_machdep.c,v 1.13 2005/06/03 17:14:48 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/i386/busdma_machdep.c,v 1.14 2006/09/05 00:55:45 dillon Exp $ */ #include @@ -139,7 +139,7 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, /* Return a NULL tag on failure */ *dmat = NULL; - newtag = malloc(sizeof(*newtag), M_DEVBUF, M_INTWAIT); + newtag = kmalloc(sizeof(*newtag), M_DEVBUF, M_INTWAIT); newtag->parent = parent; newtag->alignment = alignment; @@ -205,7 +205,7 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, } if (error != 0) { - free(newtag, M_DEVBUF); + kfree(newtag, M_DEVBUF); } else { *dmat = newtag; } @@ -227,8 +227,8 @@ bus_dma_tag_destroy(bus_dma_tag_t dmat) dmat->ref_count--; if (dmat->ref_count == 0) { if (dmat->segments != NULL) - free(dmat->segments, M_DEVBUF); - free(dmat, M_DEVBUF); + kfree(dmat->segments, M_DEVBUF); + kfree(dmat, M_DEVBUF); /* * Last reference count, so * release our reference @@ -263,7 +263,7 @@ bus_dmamap_create(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp) /* Must bounce */ int maxpages; - *mapp = malloc(sizeof(**mapp), M_DEVBUF, M_INTWAIT); + *mapp = kmalloc(sizeof(**mapp), M_DEVBUF, M_INTWAIT); if (*mapp == NULL) { return (ENOMEM); } else { @@ -318,7 +318,7 @@ bus_dmamap_destroy(bus_dma_tag_t dmat, bus_dmamap_t map) if (map != NULL) { if (STAILQ_FIRST(&map->bpages) != NULL) return (EBUSY); - free(map, M_DEVBUF); + kfree(map, M_DEVBUF); } dmat->map_count--; return (0); @@ -355,7 +355,7 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags, if ((dmat->maxsize <= PAGE_SIZE) && dmat->lowaddr >= ptoa(Maxmem)) { - *vaddr = malloc(dmat->maxsize, M_DEVBUF, mflags); + *vaddr = kmalloc(dmat->maxsize, M_DEVBUF, mflags); /* * XXX Check whether the allocation crossed a page boundary * and retry with power-of-2 alignment in that case. @@ -363,11 +363,11 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags, if ((((intptr_t)*vaddr) & PAGE_MASK) != (((intptr_t)*vaddr + dmat->maxsize) & PAGE_MASK)) { size_t size; - free(*vaddr, M_DEVBUF); + kfree(*vaddr, M_DEVBUF); /* XXX check for overflow? */ for (size = 1; size <= dmat->maxsize; size <<= 1) ; - *vaddr = malloc(size, M_DEVBUF, mflags); + *vaddr = kmalloc(size, M_DEVBUF, mflags); } } else { /* @@ -399,7 +399,7 @@ bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map) panic("bus_dmamem_free: Invalid map freed\n"); if ((dmat->maxsize <= PAGE_SIZE) && dmat->lowaddr >= ptoa(Maxmem)) - free(vaddr, M_DEVBUF); + kfree(vaddr, M_DEVBUF); else contigfree(vaddr, dmat->maxsize, M_DEVBUF); } @@ -780,7 +780,7 @@ alloc_bounce_pages(bus_dma_tag_t dmat, u_int numpages) while (numpages > 0) { struct bounce_page *bpage; - bpage = (struct bounce_page *)malloc(sizeof(*bpage), M_DEVBUF, + bpage = (struct bounce_page *)kmalloc(sizeof(*bpage), M_DEVBUF, M_INTWAIT); if (bpage == NULL) @@ -792,7 +792,7 @@ alloc_bounce_pages(bus_dma_tag_t dmat, u_int numpages) PAGE_SIZE, 0); if (bpage->vaddr == NULL) { - free(bpage, M_DEVBUF); + kfree(bpage, M_DEVBUF); break; } bpage->busaddr = pmap_kextract(bpage->vaddr); diff --git a/sys/platform/pc32/i386/mem.c b/sys/platform/pc32/i386/mem.c index a4e9e60b4b..06281d1cfa 100644 --- a/sys/platform/pc32/i386/mem.c +++ b/sys/platform/pc32/i386/mem.c @@ -39,7 +39,7 @@ * from: Utah $Hdr: mem.c 1.13 89/10/08$ * from: @(#)mem.c 7.2 (Berkeley) 5/9/91 * $FreeBSD: src/sys/i386/i386/mem.c,v 1.79.2.9 2003/01/04 22:58:01 njl Exp $ - * $DragonFly: src/sys/platform/pc32/i386/Attic/mem.c,v 1.17 2006/07/28 02:17:39 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/i386/Attic/mem.c,v 1.18 2006/09/05 00:55:45 dillon Exp $ */ /* @@ -223,7 +223,7 @@ mmrw(dev_t dev, struct uio *uio, int flags) * on read, seeder on write */ if (buf == NULL) - buf = malloc(PAGE_SIZE, M_TEMP, M_WAITOK); + buf = kmalloc(PAGE_SIZE, M_TEMP, M_WAITOK); c = min(iov->iov_len, PAGE_SIZE); if (uio->uio_rw == UIO_WRITE) { error = uiomove(buf, (int)c, uio); @@ -233,7 +233,7 @@ mmrw(dev_t dev, struct uio *uio, int flags) poolsize = read_random(buf, c); if (poolsize == 0) { if (buf) - free(buf, M_TEMP); + kfree(buf, M_TEMP); if ((flags & IO_NDELAY) != 0) return (EWOULDBLOCK); return (0); @@ -262,7 +262,7 @@ mmrw(dev_t dev, struct uio *uio, int flags) continue; } if (buf == NULL) - buf = malloc(PAGE_SIZE, M_TEMP, M_WAITOK); + buf = kmalloc(PAGE_SIZE, M_TEMP, M_WAITOK); poolsize = read_random_unlimited(buf, c); c = min(c, poolsize); error = uiomove(buf, (int)c, uio); @@ -278,7 +278,7 @@ mmrw(dev_t dev, struct uio *uio, int flags) } if (zbuf == NULL) { zbuf = (caddr_t) - malloc(PAGE_SIZE, M_TEMP, M_WAITOK); + kmalloc(PAGE_SIZE, M_TEMP, M_WAITOK); bzero(zbuf, PAGE_SIZE); } c = min(iov->iov_len, PAGE_SIZE); @@ -295,7 +295,7 @@ mmrw(dev_t dev, struct uio *uio, int flags) uio->uio_resid -= c; } if (buf) - free(buf, M_TEMP); + kfree(buf, M_TEMP); return (error); } @@ -398,7 +398,7 @@ mem_ioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct ucred *cred) if (!error) error = copyout(md, mo->mo_desc, nd * sizeof(struct mem_range_desc)); - free(md, M_MEMDESC); + kfree(md, M_MEMDESC); } else { nd = mem_range_softc.mr_ndesc; } @@ -413,7 +413,7 @@ mem_ioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct ucred *cred) md->mr_owner[sizeof(md->mr_owner) - 1] = 0; if (error == 0) error = mem_range_attr_set(md, &mo->mo_arg[0]); - free(md, M_MEMDESC); + kfree(md, M_MEMDESC); break; } return (error); diff --git a/sys/platform/pc32/i386/nexus.c b/sys/platform/pc32/i386/nexus.c index f7fbcb519a..698e7b5eb7 100644 --- a/sys/platform/pc32/i386/nexus.c +++ b/sys/platform/pc32/i386/nexus.c @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/i386/nexus.c,v 1.26.2.10 2003/02/22 13:16:45 imp Exp $ - * $DragonFly: src/sys/platform/pc32/i386/nexus.c,v 1.23 2005/11/21 18:02:40 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/i386/nexus.c,v 1.24 2006/09/05 00:55:45 dillon Exp $ */ /* @@ -283,7 +283,7 @@ nexus_add_child(device_t bus, device_t parent, int order, device_t child; struct nexus_device *ndev; - ndev = malloc(sizeof(struct nexus_device), M_NEXUSDEV, M_INTWAIT|M_ZERO); + ndev = kmalloc(sizeof(struct nexus_device), M_NEXUSDEV, M_INTWAIT|M_ZERO); if (!ndev) return(0); resource_list_init(&ndev->nx_resources); diff --git a/sys/platform/pc32/i386/pnpbios.c b/sys/platform/pc32/i386/pnpbios.c index a7e53b2d4b..e4d168102d 100644 --- a/sys/platform/pc32/i386/pnpbios.c +++ b/sys/platform/pc32/i386/pnpbios.c @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/platform/pc32/i386/pnpbios.c,v 1.4 2005/10/30 04:41:15 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/i386/pnpbios.c,v 1.5 2006/09/05 00:55:45 dillon Exp $ */ /* @@ -138,7 +138,7 @@ pnpbios_identify(driver_t *driver, device_t parent) if (bootverbose) printf("pnpbios: %d devices, largest %d bytes\n", ndevs, bigdev); - devnodebuf = malloc(bigdev + (sizeof(struct pnp_sysdevargs) - sizeof(struct pnp_sysdev)), M_DEVBUF, M_INTWAIT); + devnodebuf = kmalloc(bigdev + (sizeof(struct pnp_sysdevargs) - sizeof(struct pnp_sysdev)), M_DEVBUF, M_INTWAIT); pda = (struct pnp_sysdevargs *)devnodebuf; pd = &pda->node; diff --git a/sys/platform/pc32/i386/userconfig.c b/sys/platform/pc32/i386/userconfig.c index e092fa3f49..8f673fd31e 100644 --- a/sys/platform/pc32/i386/userconfig.c +++ b/sys/platform/pc32/i386/userconfig.c @@ -47,7 +47,7 @@ ** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ** ** $FreeBSD: src/sys/i386/i386/userconfig.c,v 1.175.2.10 2002/10/05 18:31:48 scottl Exp $ - ** $DragonFly: src/sys/platform/pc32/i386/userconfig.c,v 1.6 2006/09/03 17:31:54 dillon Exp $ + ** $DragonFly: src/sys/platform/pc32/i386/userconfig.c,v 1.7 2006/09/05 00:55:45 dillon Exp $ **/ /** @@ -576,7 +576,7 @@ addev(DEV_LIST *dev, DEV_LIST **list) DEV_LIST *lp,*ap; - lp = (DEV_LIST *)malloc(sizeof(DEV_LIST),M_DEVL,M_WAITOK); + lp = (DEV_LIST *)kmalloc(sizeof(DEV_LIST),M_DEVL,M_WAITOK); bcopy(dev,lp,sizeof(DEV_LIST)); /* create copied record */ if (*list) /* list exists */ @@ -675,7 +675,7 @@ insdev(DEV_LIST *dev, DEV_LIST *list) { DEV_LIST *lp,*ap; - lp = (DEV_LIST *)malloc(sizeof(DEV_LIST),M_DEVL,M_WAITOK); + lp = (DEV_LIST *)kmalloc(sizeof(DEV_LIST),M_DEVL,M_WAITOK); bcopy(dev,lp,sizeof(DEV_LIST)); /* create copied record */ ap = findspot(lp,list); /* find appropriate spot */ @@ -764,10 +764,10 @@ savelist(DEV_LIST *list, int active) name = list->device->id_name; id_pn = id_p->id_next; if (id_p->id_name) - free(id_p->id_name, M_DEVL); + kfree(id_p->id_name, M_DEVL); bcopy(list->device,id_p,sizeof(struct uc_device)); save_resource(list->device); - id_p->id_name = malloc(strlen(name) + 1, M_DEVL,M_WAITOK); + id_p->id_name = kmalloc(strlen(name) + 1, M_DEVL,M_WAITOK); strcpy(id_p->id_name, name); id_pn->id_next = uc_devlist; id_p->id_next = id_pn; @@ -777,10 +777,10 @@ savelist(DEV_LIST *list, int active) if (!id_pn) /* not already on the list */ { name = list->device->id_name; - id_pn = malloc(sizeof(struct uc_device),M_DEVL,M_WAITOK); + id_pn = kmalloc(sizeof(struct uc_device),M_DEVL,M_WAITOK); bcopy(list->device,id_pn,sizeof(struct uc_device)); save_resource(list->device); - id_pn->id_name = malloc(strlen(name) + 1, M_DEVL,M_WAITOK); + id_pn->id_name = kmalloc(strlen(name) + 1, M_DEVL,M_WAITOK); strcpy(id_pn->id_name, name); id_pn->id_next = uc_devlist; uc_devlist = id_pn; /* park at top of list */ @@ -810,7 +810,7 @@ nukelist(DEV_LIST *list) { dp = list; list = list->next; - free(dp,M_DEVL); + kfree(dp,M_DEVL); } } @@ -3222,7 +3222,7 @@ load_devtab(void) char *name; int unit; - uc_devtab = malloc(sizeof(struct uc_device)*(count + 1),M_DEVL,M_WAITOK); + uc_devtab = kmalloc(sizeof(struct uc_device)*(count + 1),M_DEVL,M_WAITOK); bzero(uc_devtab, sizeof(struct uc_device) * (count + 1)); dt = 0; for (i = 0; i < count; i++) { @@ -3243,7 +3243,7 @@ load_devtab(void) val = 0; resource_int_value(name, unit, "disabled", &val); uc_devtab[dt].id_enabled = !val; - uc_devtab[dt].id_name = malloc(strlen(name) + 1, M_DEVL,M_WAITOK); + uc_devtab[dt].id_name = kmalloc(strlen(name) + 1, M_DEVL,M_WAITOK); strcpy(uc_devtab[dt].id_name, name); dt++; } @@ -3257,8 +3257,8 @@ free_devtab(void) for (i = 0; i < count; i++) if (uc_devtab[i].id_name) - free(uc_devtab[i].id_name, M_DEVL); - free(uc_devtab, M_DEVL); + kfree(uc_devtab[i].id_name, M_DEVL); + kfree(uc_devtab, M_DEVL); } static struct uc_device * @@ -3419,19 +3419,19 @@ struct uc_device *idev; if (id_p->id_id == idev->id_id) { id_pn = id_p->id_next; if (id_p->id_name) - free(id_p->id_name, M_DEVL); + kfree(id_p->id_name, M_DEVL); bcopy(idev,id_p,sizeof(struct uc_device)); save_resource(idev); - id_p->id_name = malloc(strlen(name)+1, M_DEVL,M_WAITOK); + id_p->id_name = kmalloc(strlen(name)+1, M_DEVL,M_WAITOK); strcpy(id_p->id_name, name); id_p->id_next = id_pn; return 1; } } - id_pn = malloc(sizeof(struct uc_device),M_DEVL,M_WAITOK); + id_pn = kmalloc(sizeof(struct uc_device),M_DEVL,M_WAITOK); bcopy(idev,id_pn,sizeof(struct uc_device)); save_resource(idev); - id_pn->id_name = malloc(strlen(name) + 1, M_DEVL,M_WAITOK); + id_pn->id_name = kmalloc(strlen(name) + 1, M_DEVL,M_WAITOK); strcpy(id_pn->id_name, name); id_pn->id_next = uc_devlist; uc_devlist = id_pn; diff --git a/sys/platform/pc32/i386/vm86.c b/sys/platform/pc32/i386/vm86.c index 9bab14f29e..eec3099600 100644 --- a/sys/platform/pc32/i386/vm86.c +++ b/sys/platform/pc32/i386/vm86.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/i386/vm86.c,v 1.31.2.2 2001/10/05 06:18:55 peter Exp $ - * $DragonFly: src/sys/platform/pc32/i386/vm86.c,v 1.18 2005/11/22 08:41:00 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/i386/vm86.c,v 1.19 2006/09/05 00:55:45 dillon Exp $ */ #include @@ -536,7 +536,7 @@ vm86_addpage(struct vm86context *vmc, int pagenum, vm_offset_t kva) goto bad; /* XXX grow map? */ if (kva == 0) { - kva = (vm_offset_t)malloc(PAGE_SIZE, M_TEMP, M_WAITOK); + kva = (vm_offset_t)kmalloc(PAGE_SIZE, M_TEMP, M_WAITOK); flags = VMAP_MALLOC; } diff --git a/sys/platform/pc32/i386/vm_machdep.c b/sys/platform/pc32/i386/vm_machdep.c index 0f4c2746f3..0aa2eb3cba 100644 --- a/sys/platform/pc32/i386/vm_machdep.c +++ b/sys/platform/pc32/i386/vm_machdep.c @@ -39,7 +39,7 @@ * from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91 * Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$ * $FreeBSD: src/sys/i386/i386/vm_machdep.c,v 1.132.2.9 2003/01/25 19:02:23 dillon Exp $ - * $DragonFly: src/sys/platform/pc32/i386/vm_machdep.c,v 1.43 2006/06/01 05:38:43 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/i386/vm_machdep.c,v 1.44 2006/09/05 00:55:45 dillon Exp $ */ #include "use_npx.h" @@ -325,7 +325,7 @@ cpu_coredump(struct thread *td, struct vnode *vp, struct ucred *cred) caddr_t tempuser; KKASSERT(p); - tempuser = malloc(ctob(UPAGES), M_TEMP, M_WAITOK); + tempuser = kmalloc(ctob(UPAGES), M_TEMP, M_WAITOK); if (!tempuser) return EINVAL; @@ -339,7 +339,7 @@ cpu_coredump(struct thread *td, struct vnode *vp, struct ucred *cred) error = vn_rdwr(UIO_WRITE, vp, (caddr_t) tempuser, ctob(UPAGES), (off_t)0, UIO_SYSSPACE, IO_UNIT, cred, (int *)NULL); - free(tempuser, M_TEMP); + kfree(tempuser, M_TEMP); return error; } diff --git a/sys/sys/ccbque.h b/sys/sys/ccbque.h index ea193a73e4..29396cce6a 100644 --- a/sys/sys/ccbque.h +++ b/sys/sys/ccbque.h @@ -28,7 +28,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/i386/isa/ccbque.h,v 1.3.6.2 2000/10/21 07:44:24 nyan Exp $ - * $DragonFly: src/sys/sys/ccbque.h,v 1.8 2005/12/24 20:34:04 swildner Exp $ + * $DragonFly: src/sys/sys/ccbque.h,v 1.9 2006/09/05 00:55:45 dillon Exp $ */ /* * Common command control queue funcs. @@ -87,7 +87,7 @@ DEV##_get_ccb(void) \ } \ else \ { \ - cb = malloc(sizeof(*cb), M_DEVBUF, M_INTWAIT); \ + cb = kmalloc(sizeof(*cb), M_DEVBUF, M_INTWAIT); \ if (cb != NULL) \ { \ bzero(cb, sizeof(*cb)); \ diff --git a/sys/sys/malloc.h b/sys/sys/malloc.h index f13b2a5422..9a370f65cb 100644 --- a/sys/sys/malloc.h +++ b/sys/sys/malloc.h @@ -32,7 +32,7 @@ * * @(#)malloc.h 8.5 (Berkeley) 5/3/95 * $FreeBSD: src/sys/sys/malloc.h,v 1.48.2.2 2002/03/16 02:19:16 archie Exp $ - * $DragonFly: src/sys/sys/malloc.h,v 1.24 2006/09/04 23:03:38 dillon Exp $ + * $DragonFly: src/sys/sys/malloc.h,v 1.25 2006/09/05 00:55:50 dillon Exp $ */ #ifndef _SYS_MALLOC_H_ @@ -185,8 +185,8 @@ struct kmemusage { * Deprecated macro versions of not-quite-malloc() and free(). */ #define MALLOC(space, cast, size, type, flags) \ - (space) = (cast)malloc((u_long)(size), (type), (flags)) -#define FREE(addr, type) free((addr), (type)) + (space) = (cast)kmalloc((u_long)(size), (type), (flags)) +#define FREE(addr, type) kfree((addr), (type)) /* * XXX this should be declared in , but that tends to fail diff --git a/sys/vfs/fdesc/fdesc_vfsops.c b/sys/vfs/fdesc/fdesc_vfsops.c index 875887f3b3..85cba431df 100644 --- a/sys/vfs/fdesc/fdesc_vfsops.c +++ b/sys/vfs/fdesc/fdesc_vfsops.c @@ -36,7 +36,7 @@ * @(#)fdesc_vfsops.c 8.4 (Berkeley) 1/21/94 * * $FreeBSD: src/sys/miscfs/fdesc/fdesc_vfsops.c,v 1.22.2.3 2002/08/23 17:42:39 njl Exp $ - * $DragonFly: src/sys/vfs/fdesc/fdesc_vfsops.c,v 1.21 2006/08/09 22:47:34 dillon Exp $ + * $DragonFly: src/sys/vfs/fdesc/fdesc_vfsops.c,v 1.22 2006/09/05 00:55:50 dillon Exp $ */ /* @@ -131,7 +131,7 @@ fdesc_unmount(struct mount *mp, int mntflags) /* * Finally, throw away the fdescmount structure */ - free(mp->mnt_data, M_FDESCMNT); /* XXX */ + kfree(mp->mnt_data, M_FDESCMNT); /* XXX */ mp->mnt_data = 0; return (0); diff --git a/sys/vfs/fdesc/fdesc_vnops.c b/sys/vfs/fdesc/fdesc_vnops.c index 9df9063395..b5fbf39d46 100644 --- a/sys/vfs/fdesc/fdesc_vnops.c +++ b/sys/vfs/fdesc/fdesc_vnops.c @@ -36,7 +36,7 @@ * @(#)fdesc_vnops.c 8.9 (Berkeley) 1/21/94 * * $FreeBSD: src/sys/miscfs/fdesc/fdesc_vnops.c,v 1.47.2.1 2001/10/22 22:49:26 chris Exp $ - * $DragonFly: src/sys/vfs/fdesc/fdesc_vnops.c,v 1.33 2006/08/12 00:26:20 dillon Exp $ + * $DragonFly: src/sys/vfs/fdesc/fdesc_vnops.c,v 1.34 2006/09/05 00:55:50 dillon Exp $ */ /* @@ -99,7 +99,7 @@ int fdesc_uninit(struct vfsconf *vfsp) { if (fdhashtbl) - free(fdhashtbl, M_CACHE); + kfree(fdhashtbl, M_CACHE); return (0); } int diff --git a/sys/vfs/fifofs/fifo_vnops.c b/sys/vfs/fifofs/fifo_vnops.c index 6788ff3eb4..24778a5b63 100644 --- a/sys/vfs/fifofs/fifo_vnops.c +++ b/sys/vfs/fifofs/fifo_vnops.c @@ -32,7 +32,7 @@ * * @(#)fifo_vnops.c 8.10 (Berkeley) 5/27/95 * $FreeBSD: src/sys/miscfs/fifofs/fifo_vnops.c,v 1.45.2.4 2003/04/22 10:11:24 bde Exp $ - * $DragonFly: src/sys/vfs/fifofs/fifo_vnops.c,v 1.33 2006/08/12 00:26:20 dillon Exp $ + * $DragonFly: src/sys/vfs/fifofs/fifo_vnops.c,v 1.34 2006/09/05 00:55:50 dillon Exp $ */ #include @@ -173,7 +173,7 @@ fifo_open(struct vop_open_args *ap) vp->v_fifoinfo = fip; error = socreate(AF_LOCAL, &rso, SOCK_STREAM, 0, td); if (error) { - free(fip, M_FIFOINFO); + kfree(fip, M_FIFOINFO); vp->v_fifoinfo = NULL; return (error); } @@ -181,7 +181,7 @@ fifo_open(struct vop_open_args *ap) error = socreate(AF_LOCAL, &wso, SOCK_STREAM, 0, td); if (error) { soclose(rso, FNONBLOCK); - free(fip, M_FIFOINFO); + kfree(fip, M_FIFOINFO); vp->v_fifoinfo = NULL; return (error); } @@ -190,7 +190,7 @@ fifo_open(struct vop_open_args *ap) if (error) { soclose(wso, FNONBLOCK); soclose(rso, FNONBLOCK); - free(fip, M_FIFOINFO); + kfree(fip, M_FIFOINFO); vp->v_fifoinfo = NULL; return (error); } diff --git a/sys/vfs/gnu/ext2fs/ext2_ihash.c b/sys/vfs/gnu/ext2fs/ext2_ihash.c index 2a405fceab..ee761e9db7 100644 --- a/sys/vfs/gnu/ext2fs/ext2_ihash.c +++ b/sys/vfs/gnu/ext2fs/ext2_ihash.c @@ -32,7 +32,7 @@ * * @(#)ufs_ihash.c 8.7 (Berkeley) 5/17/95 * $FreeBSD: src/sys/ufs/ufs/ufs_ihash.c,v 1.20 1999/08/28 00:52:29 peter Exp $ - * $DragonFly: src/sys/vfs/gnu/ext2fs/ext2_ihash.c,v 1.2 2006/05/06 02:43:13 dillon Exp $ + * $DragonFly: src/sys/vfs/gnu/ext2fs/ext2_ihash.c,v 1.3 2006/09/05 00:55:50 dillon Exp $ */ #include @@ -67,7 +67,7 @@ ext2_ihashinit(void) ext2_ihash = 16; while (ext2_ihash < desiredvnodes) ext2_ihash <<= 1; - ext2_ihashtbl = malloc(sizeof(void *) * ext2_ihash, M_EXT2IHASH, M_WAITOK|M_ZERO); + ext2_ihashtbl = kmalloc(sizeof(void *) * ext2_ihash, M_EXT2IHASH, M_WAITOK|M_ZERO); --ext2_ihash; lwkt_token_init(&ext2_ihash_token); } @@ -79,7 +79,7 @@ ext2_uninit(struct vfsconf *vfc) lwkt_gettoken(&ilock, &ext2_ihash_token); if (ext2_ihashtbl) - free(ext2_ihashtbl, M_EXT2IHASH); + kfree(ext2_ihashtbl, M_EXT2IHASH); lwkt_reltoken(&ilock); return (0); diff --git a/sys/vfs/gnu/ext2fs/ext2_inode.c b/sys/vfs/gnu/ext2fs/ext2_inode.c index bfe6236ca3..d1a3258413 100644 --- a/sys/vfs/gnu/ext2fs/ext2_inode.c +++ b/sys/vfs/gnu/ext2fs/ext2_inode.c @@ -38,7 +38,7 @@ * * @(#)ext2_inode.c 8.5 (Berkeley) 12/30/93 * $FreeBSD: src/sys/gnu/ext2fs/ext2_inode.c,v 1.24.2.1 2000/08/03 00:52:57 peter Exp $ - * $DragonFly: src/sys/vfs/gnu/ext2fs/ext2_inode.c,v 1.18 2006/05/06 02:43:13 dillon Exp $ + * $DragonFly: src/sys/vfs/gnu/ext2fs/ext2_inode.c,v 1.19 2006/09/05 00:55:50 dillon Exp $ */ #include "opt_quota.h" @@ -566,7 +566,7 @@ ext2_reclaim(struct vop_reclaim_args *ap) if (ip->i_dirhash != NULL) ext2dirhash_free(ip); #endif - free(ip, VFSTOEXT2(vp->v_mount)->um_malloctype); + kfree(ip, VFSTOEXT2(vp->v_mount)->um_malloctype); } return (0); } diff --git a/sys/vfs/gnu/ext2fs/ext2_quota.c b/sys/vfs/gnu/ext2fs/ext2_quota.c index ee3f379df3..c6407eb72a 100644 --- a/sys/vfs/gnu/ext2fs/ext2_quota.c +++ b/sys/vfs/gnu/ext2fs/ext2_quota.c @@ -35,7 +35,7 @@ * * @(#)ufs_quota.c 8.5 (Berkeley) 5/20/95 * $FreeBSD: src/sys/ufs/ufs/ufs_quota.c,v 1.27.2.3 2002/01/15 10:33:32 phk Exp $ - * $DragonFly: src/sys/vfs/gnu/ext2fs/ext2_quota.c,v 1.6 2006/08/12 00:26:20 dillon Exp $ + * $DragonFly: src/sys/vfs/gnu/ext2fs/ext2_quota.c,v 1.7 2006/09/05 00:55:50 dillon Exp $ */ #include @@ -748,7 +748,7 @@ ext2_dqget(struct vnode *vp, u_long id, struct ext2mount *ump, int type, if (TAILQ_EMPTY(&ext2_dqfreelist) && ext2_numdquot < MAXQUOTAS * desiredvnodes) ext2_desireddquot += DQUOTINC; if (ext2_numdquot < ext2_desireddquot) { - dq = (struct ext2_dquot *)malloc(sizeof *dq, M_EXT2DQUOT, M_WAITOK); + dq = (struct ext2_dquot *)kmalloc(sizeof *dq, M_EXT2DQUOT, M_WAITOK); bzero((char *)dq, sizeof *dq); ext2_numdquot++; } else { diff --git a/sys/vfs/hpfs/hpfs_hash.c b/sys/vfs/hpfs/hpfs_hash.c index 7734c2019d..330cb5f4b8 100644 --- a/sys/vfs/hpfs/hpfs_hash.c +++ b/sys/vfs/hpfs/hpfs_hash.c @@ -32,7 +32,7 @@ * * @(#)ufs_ihash.c 8.7 (Berkeley) 5/17/95 * $FreeBSD: src/sys/fs/hpfs/hpfs_hash.c,v 1.1 1999/12/09 19:09:58 semenu Exp $ - * $DragonFly: src/sys/vfs/hpfs/hpfs_hash.c,v 1.14 2006/05/06 02:43:13 dillon Exp $ + * $DragonFly: src/sys/vfs/hpfs/hpfs_hash.c,v 1.15 2006/09/05 00:55:50 dillon Exp $ */ #include @@ -82,7 +82,7 @@ hpfs_hphash_uninit(struct vfsconf *vfc) lwkt_gettoken(&ilock, &hpfs_hphash_token); if (hpfs_hphashtbl) - free(hpfs_hphashtbl, M_HPFSHASH); + kfree(hpfs_hphashtbl, M_HPFSHASH); lwkt_reltoken(&ilock); return 0; diff --git a/sys/vfs/hpfs/hpfs_vfsops.c b/sys/vfs/hpfs/hpfs_vfsops.c index 593366fe47..6bccad0fb3 100644 --- a/sys/vfs/hpfs/hpfs_vfsops.c +++ b/sys/vfs/hpfs/hpfs_vfsops.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/fs/hpfs/hpfs_vfsops.c,v 1.3.2.2 2001/12/25 01:44:45 dillon Exp $ - * $DragonFly: src/sys/vfs/hpfs/hpfs_vfsops.c,v 1.36 2006/07/18 22:22:15 dillon Exp $ + * $DragonFly: src/sys/vfs/hpfs/hpfs_vfsops.c,v 1.37 2006/09/05 00:55:50 dillon Exp $ */ @@ -261,7 +261,7 @@ hpfs_mountfs(struct vnode *devvp, struct mount *mp, struct hpfs_args *argsp) /* * Do actual mount */ - hpmp = malloc(sizeof(struct hpfsmount), M_HPFSMNT, M_WAITOK); + hpmp = kmalloc(sizeof(struct hpfsmount), M_HPFSMNT, M_WAITOK); bzero(hpmp, sizeof(struct hpfsmount)); /* Read in SuperBlock */ diff --git a/sys/vfs/isofs/cd9660/cd9660_node.c b/sys/vfs/isofs/cd9660/cd9660_node.c index 4f3e1fa7ac..d78b54431c 100644 --- a/sys/vfs/isofs/cd9660/cd9660_node.c +++ b/sys/vfs/isofs/cd9660/cd9660_node.c @@ -37,7 +37,7 @@ * * @(#)cd9660_node.c 8.2 (Berkeley) 1/23/94 * $FreeBSD: src/sys/isofs/cd9660/cd9660_node.c,v 1.29.2.1 2000/07/08 14:35:56 bp Exp $ - * $DragonFly: src/sys/vfs/isofs/cd9660/cd9660_node.c,v 1.17 2006/05/06 02:43:13 dillon Exp $ + * $DragonFly: src/sys/vfs/isofs/cd9660/cd9660_node.c,v 1.18 2006/09/05 00:55:50 dillon Exp $ */ #include @@ -96,7 +96,7 @@ cd9660_uninit(struct vfsconf *vfsp) { if (isohashtbl != NULL) - free(isohashtbl, M_ISOFSMNT); + kfree(isohashtbl, M_ISOFSMNT); return (0); } @@ -235,7 +235,7 @@ cd9660_reclaim(struct vop_reclaim_args *ap) vrele(ip->i_devvp); ip->i_devvp = 0; } - free(ip, M_ISOFSNODE); + kfree(ip, M_ISOFSNODE); } return (0); } diff --git a/sys/vfs/isofs/cd9660/cd9660_rrip.c b/sys/vfs/isofs/cd9660/cd9660_rrip.c index 2d208924d5..e698c6003f 100644 --- a/sys/vfs/isofs/cd9660/cd9660_rrip.c +++ b/sys/vfs/isofs/cd9660/cd9660_rrip.c @@ -37,7 +37,7 @@ * * @(#)cd9660_rrip.c 8.6 (Berkeley) 12/5/94 * $FreeBSD: src/sys/isofs/cd9660/cd9660_rrip.c,v 1.17 1999/08/28 00:46:06 peter Exp $ - * $DragonFly: src/sys/vfs/isofs/cd9660/cd9660_rrip.c,v 1.10 2006/03/24 18:35:33 dillon Exp $ + * $DragonFly: src/sys/vfs/isofs/cd9660/cd9660_rrip.c,v 1.11 2006/09/05 00:55:50 dillon Exp $ */ #include @@ -209,7 +209,7 @@ cd9660_rrip_slink(ISO_RRIP_SLINK *p, ISO_RRIP_ANALYZE *ana) len += wlen; if (freebuf != NULL) { - free(freebuf, M_TEMP); + kfree(freebuf, M_TEMP); freebuf = NULL; } } @@ -225,7 +225,7 @@ cd9660_rrip_slink(ISO_RRIP_SLINK *p, ISO_RRIP_ANALYZE *ana) bad: if (freebuf != NULL) - free(freebuf, M_TEMP); + kfree(freebuf, M_TEMP); ana->cont = 1; ana->fields = 0; ana->outbuf -= *ana->outlen; diff --git a/sys/vfs/isofs/cd9660/cd9660_vfsops.c b/sys/vfs/isofs/cd9660/cd9660_vfsops.c index da4112d13a..6d09f206d5 100644 --- a/sys/vfs/isofs/cd9660/cd9660_vfsops.c +++ b/sys/vfs/isofs/cd9660/cd9660_vfsops.c @@ -37,7 +37,7 @@ * * @(#)cd9660_vfsops.c 8.18 (Berkeley) 5/22/95 * $FreeBSD: src/sys/isofs/cd9660/cd9660_vfsops.c,v 1.74.2.7 2002/04/08 09:39:29 bde Exp $ - * $DragonFly: src/sys/vfs/isofs/cd9660/cd9660_vfsops.c,v 1.39 2006/08/12 00:26:21 dillon Exp $ + * $DragonFly: src/sys/vfs/isofs/cd9660/cd9660_vfsops.c,v 1.40 2006/09/05 00:55:50 dillon Exp $ */ #include @@ -401,7 +401,7 @@ iso_mountfs(struct vnode *devvp, struct mount *mp, struct iso_args *argp) pri_sierra->root_directory_record: pri->root_directory_record); - isomp = malloc(sizeof *isomp, M_ISOFSMNT, M_WAITOK | M_ZERO); + isomp = kmalloc(sizeof *isomp, M_ISOFSMNT, M_WAITOK | M_ZERO); isomp->logical_block_size = logical_block_size; isomp->volume_space_size = isonum_733 (high_sierra? @@ -518,7 +518,7 @@ out: if (needclose) VOP_CLOSE(devvp, FREAD); if (isomp) { - free((caddr_t)isomp, M_ISOFSMNT); + kfree((caddr_t)isomp, M_ISOFSMNT); mp->mnt_data = (qaddr_t)0; } return error; @@ -548,7 +548,7 @@ cd9660_unmount(struct mount *mp, int mntflags) isomp->im_devvp->v_rdev->si_mountpoint = NULL; error = VOP_CLOSE(isomp->im_devvp, FREAD); vrele(isomp->im_devvp); - free((caddr_t)isomp, M_ISOFSMNT); + kfree((caddr_t)isomp, M_ISOFSMNT); mp->mnt_data = (qaddr_t)0; mp->mnt_flag &= ~MNT_LOCAL; return (error); @@ -719,7 +719,7 @@ again: if (cd9660_ihashins(ip) != 0) { printf("debug: cd9660 ihashins collision, retrying\n"); vx_put(vp); - free(ip, M_ISOFSNODE); + kfree(ip, M_ISOFSNODE); goto again; } vp->v_data = ip; diff --git a/sys/vfs/isofs/cd9660/cd9660_vnops.c b/sys/vfs/isofs/cd9660/cd9660_vnops.c index 14087f141d..977d61f666 100644 --- a/sys/vfs/isofs/cd9660/cd9660_vnops.c +++ b/sys/vfs/isofs/cd9660/cd9660_vnops.c @@ -37,7 +37,7 @@ * * @(#)cd9660_vnops.c 8.19 (Berkeley) 5/27/95 * $FreeBSD: src/sys/isofs/cd9660/cd9660_vnops.c,v 1.62 1999/12/15 23:01:51 eivind Exp $ - * $DragonFly: src/sys/vfs/isofs/cd9660/cd9660_vnops.c,v 1.31 2006/08/19 17:27:24 dillon Exp $ + * $DragonFly: src/sys/vfs/isofs/cd9660/cd9660_vnops.c,v 1.32 2006/09/05 00:55:50 dillon Exp $ */ #include @@ -624,7 +624,7 @@ cd9660_readdir(struct vop_readdir_args *ap) if (ap->a_ncookies != NULL) { if (error) - free(cookies, M_TEMP); + kfree(cookies, M_TEMP); else { /* * Work out the number of cookies actually used. diff --git a/sys/vfs/msdosfs/msdosfs_denode.c b/sys/vfs/msdosfs/msdosfs_denode.c index 1cb7bc072a..18a9de5566 100644 --- a/sys/vfs/msdosfs/msdosfs_denode.c +++ b/sys/vfs/msdosfs/msdosfs_denode.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/msdosfs/msdosfs_denode.c,v 1.47.2.3 2002/08/22 16:20:15 trhodes Exp $ */ -/* $DragonFly: src/sys/vfs/msdosfs/msdosfs_denode.c,v 1.24 2006/05/06 02:43:14 dillon Exp $ */ +/* $DragonFly: src/sys/vfs/msdosfs/msdosfs_denode.c,v 1.25 2006/09/05 00:55:50 dillon Exp $ */ /* $NetBSD: msdosfs_denode.c,v 1.28 1998/02/10 14:10:00 mrg Exp $ */ /*- @@ -105,7 +105,7 @@ msdosfs_init(struct vfsconf *vfsp) dehash = 16; while (dehash < desiredvnodes) dehash <<= 1; - dehashtbl = malloc(sizeof(void *) * dehash, M_MSDOSFSMNT, + dehashtbl = kmalloc(sizeof(void *) * dehash, M_MSDOSFSMNT, M_WAITOK|M_ZERO); --dehash; lwkt_token_init(&dehash_token); @@ -117,7 +117,7 @@ msdosfs_uninit(struct vfsconf *vfsp) { if (dehashtbl) - free(dehashtbl, M_MSDOSFSMNT); + kfree(dehashtbl, M_MSDOSFSMNT); return (0); } @@ -315,7 +315,7 @@ again: if (msdosfs_hashins(ldep) != 0) { printf("debug: msdosfs: hashins collision, retrying\n"); vx_put(nvp); - free(ldep, M_MSDOSFSNODE); + kfree(ldep, M_MSDOSFSNODE); goto again; } nvp->v_data = ldep; @@ -671,7 +671,7 @@ msdosfs_reclaim(struct vop_reclaim_args *ap) vrele(dep->de_devvp); dep->de_devvp = 0; } - free(dep, M_MSDOSFSNODE); + kfree(dep, M_MSDOSFSNODE); } return (0); } diff --git a/sys/vfs/msdosfs/msdosfs_vfsops.c b/sys/vfs/msdosfs/msdosfs_vfsops.c index cead15133c..e8286575ca 100644 --- a/sys/vfs/msdosfs/msdosfs_vfsops.c +++ b/sys/vfs/msdosfs/msdosfs_vfsops.c @@ -1,5 +1,5 @@ /* $FreeBSD: /usr/local/www/cvsroot/FreeBSD/src/sys/msdosfs/Attic/msdosfs_vfsops.c,v 1.60.2.8 2004/03/02 09:43:04 tjr Exp $ */ -/* $DragonFly: src/sys/vfs/msdosfs/msdosfs_vfsops.c,v 1.37 2006/08/12 00:26:21 dillon Exp $ */ +/* $DragonFly: src/sys/vfs/msdosfs/msdosfs_vfsops.c,v 1.38 2006/09/05 00:55:50 dillon Exp $ */ /* $NetBSD: msdosfs_vfsops.c,v 1.51 1997/11/17 15:36:58 ws Exp $ */ /*- @@ -390,7 +390,7 @@ mountmsdosfs(struct vnode *devvp, struct mount *mp, struct msdosfs_args *argp) } #endif - pmp = malloc(sizeof *pmp, M_MSDOSFSMNT, M_WAITOK); + pmp = kmalloc(sizeof *pmp, M_MSDOSFSMNT, M_WAITOK); bzero((caddr_t)pmp, sizeof *pmp); pmp->pm_mountp = mp; @@ -666,8 +666,8 @@ error_exit: VOP_CLOSE(devvp, ronly ? FREAD : FREAD | FWRITE); if (pmp) { if (pmp->pm_inusemap) - free(pmp->pm_inusemap, M_MSDOSFSFAT); - free(pmp, M_MSDOSFSMNT); + kfree(pmp->pm_inusemap, M_MSDOSFSFAT); + kfree(pmp, M_MSDOSFSMNT); mp->mnt_data = (qaddr_t)0; } return (error); @@ -714,8 +714,8 @@ msdosfs_unmount(struct mount *mp, int mntflags) error = VOP_CLOSE(pmp->pm_devvp, (pmp->pm_flags&MSDOSFSMNT_RONLY) ? FREAD : FREAD | FWRITE); vrele(pmp->pm_devvp); - free(pmp->pm_inusemap, M_MSDOSFSFAT); - free(pmp, M_MSDOSFSMNT); + kfree(pmp->pm_inusemap, M_MSDOSFSFAT); + kfree(pmp, M_MSDOSFSMNT); mp->mnt_data = (qaddr_t)0; mp->mnt_flag &= ~MNT_LOCAL; return (error); diff --git a/sys/vfs/msdosfs/msdosfs_vnops.c b/sys/vfs/msdosfs/msdosfs_vnops.c index 3759c29e07..785616748c 100644 --- a/sys/vfs/msdosfs/msdosfs_vnops.c +++ b/sys/vfs/msdosfs/msdosfs_vnops.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/msdosfs/msdosfs_vnops.c,v 1.95.2.4 2003/06/13 15:05:47 trhodes Exp $ */ -/* $DragonFly: src/sys/vfs/msdosfs/msdosfs_vnops.c,v 1.42 2006/09/03 18:29:17 dillon Exp $ */ +/* $DragonFly: src/sys/vfs/msdosfs/msdosfs_vnops.c,v 1.43 2006/09/05 00:55:50 dillon Exp $ */ /* $NetBSD: msdosfs_vnops.c,v 1.68 1998/02/10 14:10:04 mrg Exp $ */ /*- @@ -1663,7 +1663,7 @@ msdosfs_readdir(struct vop_readdir_args *ap) } } - d_name_storage = malloc(WIN_MAXLEN, M_TEMP, M_WAITOK); + d_name_storage = kmalloc(WIN_MAXLEN, M_TEMP, M_WAITOK); off = offset; while (uio->uio_resid > 0) { @@ -1680,7 +1680,7 @@ msdosfs_readdir(struct vop_readdir_args *ap) error = bread(pmp->pm_devvp, de_bntodoff(pmp, bn), blsize, &bp); if (error) { brelse(bp); - free(d_name_storage, M_TEMP); + kfree(d_name_storage, M_TEMP); goto done; } n = min(n, blsize - bp->b_resid); @@ -1789,7 +1789,7 @@ msdosfs_readdir(struct vop_readdir_args *ap) } out: if (d_name_storage != NULL) - free(d_name_storage, M_TEMP); + kfree(d_name_storage, M_TEMP); /* Subtract unused cookies */ if (ap->a_ncookies) diff --git a/sys/vfs/nfs/bootp_subr.c b/sys/vfs/nfs/bootp_subr.c index 57fb0fa1f0..39046db4bf 100644 --- a/sys/vfs/nfs/bootp_subr.c +++ b/sys/vfs/nfs/bootp_subr.c @@ -38,7 +38,7 @@ * nfs/krpc_subr.c * $NetBSD: krpc_subr.c,v 1.10 1995/08/08 20:43:43 gwr Exp $ * $FreeBSD: src/sys/nfs/bootp_subr.c,v 1.20.2.9 2003/04/24 16:51:08 ambrisko Exp $ - * $DragonFly: src/sys/vfs/nfs/bootp_subr.c,v 1.17 2006/08/03 16:40:48 swildner Exp $ + * $DragonFly: src/sys/vfs/nfs/bootp_subr.c,v 1.18 2006/09/05 00:55:50 dillon Exp $ */ #include "opt_bootp.h" @@ -1541,7 +1541,7 @@ bootpc_init(void) while (time_second == 0) tsleep(&time_second, 0, "arpkludge", 10); - gctx = malloc(sizeof(*gctx), M_TEMP, M_WAITOK); + gctx = kmalloc(sizeof(*gctx), M_TEMP, M_WAITOK); if (gctx == NULL) panic("Failed to allocate bootp global context structure"); @@ -1580,7 +1580,7 @@ bootpc_init(void) gctx->lastinterface = ifctx; ifctx = allocifctx(gctx); } - free(ifctx, M_TEMP); + kfree(ifctx, M_TEMP); if (gctx->interfaces == NULL) { #ifdef BOOTP_WIRED_TO @@ -1687,8 +1687,8 @@ bootpc_init(void) out: for (ifctx = gctx->interfaces; ifctx != NULL; ifctx = nctx) { nctx = ifctx->next; - free(ifctx, M_TEMP); + kfree(ifctx, M_TEMP); } - free(gctx, M_TEMP); + kfree(gctx, M_TEMP); } diff --git a/sys/vfs/nfs/krpc_subr.c b/sys/vfs/nfs/krpc_subr.c index 9e30bbffaf..f0b8302524 100644 --- a/sys/vfs/nfs/krpc_subr.c +++ b/sys/vfs/nfs/krpc_subr.c @@ -1,6 +1,6 @@ /* $NetBSD: krpc_subr.c,v 1.12.4.1 1996/06/07 00:52:26 cgd Exp $ */ /* $FreeBSD: src/sys/nfs/krpc_subr.c,v 1.13.2.1 2000/11/20 21:17:14 tegge Exp $ */ -/* $DragonFly: src/sys/vfs/nfs/krpc_subr.c,v 1.8 2006/06/13 08:12:04 dillon Exp $ */ +/* $DragonFly: src/sys/vfs/nfs/krpc_subr.c,v 1.9 2006/09/05 00:55:50 dillon Exp $ */ /* * Copyright (c) 1995 Gordon Ross, Adam Glass @@ -435,7 +435,7 @@ krpc_call(struct sockaddr_in *sa, u_int prog, u_int vers, u_int func, out: if (mhead) m_freem(mhead); - if (from) free(from, M_SONAME); + if (from) kfree(from, M_SONAME); soclose(so, FNONBLOCK); return error; } diff --git a/sys/vfs/nfs/nfs_kerb.c b/sys/vfs/nfs/nfs_kerb.c index 76316ab176..2ac745ff54 100644 --- a/sys/vfs/nfs/nfs_kerb.c +++ b/sys/vfs/nfs/nfs_kerb.c @@ -35,7 +35,7 @@ * * @(#)nfs_nqlease.c 8.9 (Berkeley) 5/20/95 * $FreeBSD: src/sys/nfs/nfs_nqlease.c,v 1.50 2000/02/13 03:32:05 peter Exp $ - * $DragonFly: src/sys/vfs/nfs/nfs_kerb.c,v 1.2 2006/05/06 18:48:53 dillon Exp $ + * $DragonFly: src/sys/vfs/nfs/nfs_kerb.c,v 1.3 2006/09/05 00:55:50 dillon Exp $ */ #include @@ -142,7 +142,7 @@ nfs_clientd(struct nfsmount *nmp, struct ucred *cred, struct nfsd_cargs *ncd, TAILQ_FOREACH_MUTABLE(nuidp, &nmp->nm_uidlruhead, nu_lru, nnuidp) { LIST_REMOVE(nuidp, nu_hash); TAILQ_REMOVE(&nmp->nm_uidlruhead, nuidp, nu_lru); - free((caddr_t)nuidp, M_NFSUID); + kfree((caddr_t)nuidp, M_NFSUID); } nfs_free_mount(nmp); if (error == EWOULDBLOCK) diff --git a/sys/vfs/nfs/nfs_serv.c b/sys/vfs/nfs/nfs_serv.c index 7fad6875ad..0542d8d527 100644 --- a/sys/vfs/nfs/nfs_serv.c +++ b/sys/vfs/nfs/nfs_serv.c @@ -35,7 +35,7 @@ * * @(#)nfs_serv.c 8.8 (Berkeley) 7/31/95 * $FreeBSD: src/sys/nfs/nfs_serv.c,v 1.93.2.6 2002/12/29 18:19:53 dillon Exp $ - * $DragonFly: src/sys/vfs/nfs/nfs_serv.c,v 1.38 2006/08/19 17:27:24 dillon Exp $ + * $DragonFly: src/sys/vfs/nfs/nfs_serv.c,v 1.39 2006/09/05 00:55:50 dillon Exp $ */ /* @@ -2870,7 +2870,7 @@ again: io.uio_td = NULL; eofflag = 0; if (cookies) { - free((caddr_t)cookies, M_TEMP); + kfree((caddr_t)cookies, M_TEMP); cookies = NULL; } error = VOP_READDIR(vp, &io, cred, &eofflag, &ncookies, &cookies); @@ -2885,9 +2885,9 @@ again: if (error) { vrele(vp); vp = NULL; - free((caddr_t)rbuf, M_TEMP); + kfree((caddr_t)rbuf, M_TEMP); if (cookies) - free((caddr_t)cookies, M_TEMP); + kfree((caddr_t)cookies, M_TEMP); nfsm_reply(NFSX_POSTOPATTR(v3)); nfsm_srvpostop_attr(getret, &at); error = 0; @@ -3145,7 +3145,7 @@ again: io.uio_td = NULL; eofflag = 0; if (cookies) { - free((caddr_t)cookies, M_TEMP); + kfree((caddr_t)cookies, M_TEMP); cookies = NULL; } error = VOP_READDIR(vp, &io, cred, &eofflag, &ncookies, &cookies); @@ -3159,8 +3159,8 @@ again: vrele(vp); vp = NULL; if (cookies) - free((caddr_t)cookies, M_TEMP); - free((caddr_t)rbuf, M_TEMP); + kfree((caddr_t)cookies, M_TEMP); + kfree((caddr_t)rbuf, M_TEMP); nfsm_reply(NFSX_V3POSTOPATTR); nfsm_srvpostop_attr(getret, &at); error = 0; @@ -3228,8 +3228,8 @@ again: error = NFSERR_NOTSUPP; vrele(vp); vp = NULL; - free((caddr_t)cookies, M_TEMP); - free((caddr_t)rbuf, M_TEMP); + kfree((caddr_t)cookies, M_TEMP); + kfree((caddr_t)rbuf, M_TEMP); nfsm_reply(NFSX_V3POSTOPATTR); nfsm_srvpostop_attr(getret, &at); error = 0; diff --git a/sys/vfs/nfs/nfs_socket.c b/sys/vfs/nfs/nfs_socket.c index 34fd73eedf..c1f75d040c 100644 --- a/sys/vfs/nfs/nfs_socket.c +++ b/sys/vfs/nfs/nfs_socket.c @@ -35,7 +35,7 @@ * * @(#)nfs_socket.c 8.5 (Berkeley) 3/30/95 * $FreeBSD: src/sys/nfs/nfs_socket.c,v 1.60.2.6 2003/03/26 01:44:46 alfred Exp $ - * $DragonFly: src/sys/vfs/nfs/nfs_socket.c,v 1.35 2006/06/13 08:12:04 dillon Exp $ + * $DragonFly: src/sys/vfs/nfs/nfs_socket.c,v 1.36 2006/09/05 00:55:50 dillon Exp $ */ /* @@ -977,7 +977,7 @@ kerbauth: error = nfs_getauth(nmp, rep, cred, &auth_str, &auth_len, verf_str, &verf_len, key); if (error) { - free((caddr_t)rep, M_NFSREQ); + kfree((caddr_t)rep, M_NFSREQ); m_freem(mrest); return (error); } @@ -993,7 +993,7 @@ kerbauth: m = nfsm_rpchead(cred, nmp->nm_flag, procnum, auth_type, auth_len, auth_str, verf_len, verf_str, mrest, mrest_len, &mheadend, &xid); if (auth_str) - free(auth_str, M_TEMP); + kfree(auth_str, M_TEMP); /* * For stream protocols, insert a Sun RPC Record Mark. @@ -1001,7 +1001,7 @@ kerbauth: if (nmp->nm_sotype == SOCK_STREAM) { M_PREPEND(m, NFSX_UNSIGNED, MB_WAIT); if (m == NULL) { - free(rep, M_NFSREQ); + kfree(rep, M_NFSREQ); return (ENOBUFS); } *mtod(m, u_int32_t *) = htonl(0x80000000 | @@ -1112,7 +1112,7 @@ tryagain: dpos = rep->r_dpos; if (error) { m_freem(rep->r_mreq); - free((caddr_t)rep, M_NFSREQ); + kfree((caddr_t)rep, M_NFSREQ); return (error); } @@ -1136,7 +1136,7 @@ tryagain: error = EACCES; m_freem(mrep); m_freem(rep->r_mreq); - free((caddr_t)rep, M_NFSREQ); + kfree((caddr_t)rep, M_NFSREQ); return (error); } @@ -1186,7 +1186,7 @@ tryagain: } else m_freem(mrep); m_freem(rep->r_mreq); - free((caddr_t)rep, M_NFSREQ); + kfree((caddr_t)rep, M_NFSREQ); return (error); } @@ -1201,7 +1201,7 @@ tryagain: error = EPROTONOSUPPORT; nfsmout: m_freem(rep->r_mreq); - free((caddr_t)rep, M_NFSREQ); + kfree((caddr_t)rep, M_NFSREQ); return (error); } @@ -2267,7 +2267,7 @@ nfsrv_getstream(struct nfssvc_sock *slp, int waitflag, int *countp) if (slp->ns_flag & SLP_LASTFRAG) { struct nfsrv_rec *rec; int mf = (waitflag & MB_DONTWAIT) ? M_NOWAIT : M_WAITOK; - rec = malloc(sizeof(struct nfsrv_rec), M_NFSRVDESC, mf); + rec = kmalloc(sizeof(struct nfsrv_rec), M_NFSRVDESC, mf); if (!rec) { m_freem(slp->ns_frag); } else { @@ -2305,7 +2305,7 @@ nfsrv_dorec(struct nfssvc_sock *slp, struct nfsd *nfsd, --slp->ns_numrec; nam = rec->nr_address; m = rec->nr_packet; - free(rec, M_NFSRVDESC); + kfree(rec, M_NFSRVDESC); MALLOC(nd, struct nfsrv_descript *, sizeof (struct nfsrv_descript), M_NFSRVDESC, M_WAITOK); nd->nd_md = nd->nd_mrep = m; @@ -2316,7 +2316,7 @@ nfsrv_dorec(struct nfssvc_sock *slp, struct nfsd *nfsd, if (nam) { FREE(nam, M_SONAME); } - free((caddr_t)nd, M_NFSRVDESC); + kfree((caddr_t)nd, M_NFSRVDESC); return (error); } *ndp = nd; diff --git a/sys/vfs/nfs/nfs_srvcache.c b/sys/vfs/nfs/nfs_srvcache.c index 0c90f22460..0d46981cd2 100644 --- a/sys/vfs/nfs/nfs_srvcache.c +++ b/sys/vfs/nfs/nfs_srvcache.c @@ -35,7 +35,7 @@ * * @(#)nfs_srvcache.c 8.3 (Berkeley) 3/30/95 * $FreeBSD: src/sys/nfs/nfs_srvcache.c,v 1.21 2000/02/13 03:32:06 peter Exp $ - * $DragonFly: src/sys/vfs/nfs/nfs_srvcache.c,v 1.10 2006/03/27 16:18:39 dillon Exp $ + * $DragonFly: src/sys/vfs/nfs/nfs_srvcache.c,v 1.11 2006/09/05 00:55:50 dillon Exp $ */ /* @@ -339,8 +339,8 @@ nfsrv_cleancache(void) if (rp->rc_flag & RC_REPMBUF) m_freem(rp->rc_reply); if (rp->rc_flag & RC_NAM) - free(rp->rc_nam, M_SONAME); - free(rp, M_NFSD); + kfree(rp->rc_nam, M_SONAME); + kfree(rp, M_NFSD); } numnfsrvcache = 0; } diff --git a/sys/vfs/nfs/nfs_syscalls.c b/sys/vfs/nfs/nfs_syscalls.c index 607ab3c8c5..11bed1f2f7 100644 --- a/sys/vfs/nfs/nfs_syscalls.c +++ b/sys/vfs/nfs/nfs_syscalls.c @@ -35,7 +35,7 @@ * * @(#)nfs_syscalls.c 8.5 (Berkeley) 3/30/95 * $FreeBSD: src/sys/nfs/nfs_syscalls.c,v 1.58.2.1 2000/11/26 02:30:06 dillon Exp $ - * $DragonFly: src/sys/vfs/nfs/nfs_syscalls.c,v 1.25 2006/06/05 07:26:11 dillon Exp $ + * $DragonFly: src/sys/vfs/nfs/nfs_syscalls.c,v 1.26 2006/09/05 00:55:50 dillon Exp $ */ #include @@ -246,13 +246,13 @@ sys_nfssvc(struct nfssvc_args *uap) if (slp->ns_numuids < nuidhash_max) { slp->ns_numuids++; nuidp = (struct nfsuid *) - malloc(sizeof (struct nfsuid), M_NFSUID, + kmalloc(sizeof (struct nfsuid), M_NFSUID, M_WAITOK); } else nuidp = (struct nfsuid *)0; if ((slp->ns_flag & SLP_VALID) == 0) { if (nuidp) - free((caddr_t)nuidp, M_NFSUID); + kfree((caddr_t)nuidp, M_NFSUID); } else { if (nuidp == (struct nfsuid *)0) { nuidp = TAILQ_FIRST(&slp->ns_uidlruhead); @@ -401,7 +401,7 @@ nfssvc_addsock(struct file *fp, struct sockaddr *mynam, struct thread *td) so->so_snd.sb_timeo = 0; slp = (struct nfssvc_sock *) - malloc(sizeof (struct nfssvc_sock), M_NFSSVC, M_WAITOK); + kmalloc(sizeof (struct nfssvc_sock), M_NFSSVC, M_WAITOK); bzero((caddr_t)slp, sizeof (struct nfssvc_sock)); STAILQ_INIT(&slp->ns_rec); TAILQ_INIT(&slp->ns_uidlruhead); @@ -443,7 +443,7 @@ nfssvc_nfsd(struct nfsd_srvargs *nsd, caddr_t argp, struct thread *td) #endif if (nfsd == (struct nfsd *)0) { nsd->nsd_nfsd = nfsd = (struct nfsd *) - malloc(sizeof (struct nfsd), M_NFSD, M_WAITOK); + kmalloc(sizeof (struct nfsd), M_NFSD, M_WAITOK); bzero((caddr_t)nfsd, sizeof (struct nfsd)); crit_enter(); nfsd->nfsd_td = td; @@ -509,7 +509,7 @@ nfssvc_nfsd(struct nfsd_srvargs *nsd, caddr_t argp, struct thread *td) } if (error || (slp->ns_flag & SLP_VALID) == 0) { if (nd) { - free((caddr_t)nd, M_NFSRVDESC); + kfree((caddr_t)nd, M_NFSRVDESC); nd = NULL; } nfsd->nfsd_slp = (struct nfssvc_sock *)0; @@ -648,7 +648,7 @@ nfssvc_nfsd(struct nfsd_srvargs *nsd, caddr_t argp, struct thread *td) if (slp->ns_so->so_proto->pr_flags & PR_CONNREQUIRED) nfs_slpunlock(slp); if (error == EINTR || error == ERESTART) { - free((caddr_t)nd, M_NFSRVDESC); + kfree((caddr_t)nd, M_NFSRVDESC); nfsrv_slpderef(slp); crit_enter(); goto done; @@ -691,7 +691,7 @@ nfssvc_nfsd(struct nfsd_srvargs *nsd, caddr_t argp, struct thread *td) done: TAILQ_REMOVE(&nfsd_head, nfsd, nfsd_chain); crit_exit(); - free((caddr_t)nfsd, M_NFSD); + kfree((caddr_t)nfsd, M_NFSD); nsd->nsd_nfsd = (struct nfsd *)0; if (--nfs_numnfsd == 0) nfsrv_init(TRUE); /* Reinitialize everything */ @@ -733,7 +733,7 @@ nfsrv_zapsock(struct nfssvc_sock *slp) if (rec->nr_address) FREE(rec->nr_address, M_SONAME); m_freem(rec->nr_packet); - free(rec, M_NFSRVDESC); + kfree(rec, M_NFSRVDESC); } TAILQ_FOREACH_MUTABLE(nuidp, &slp->ns_uidlruhead, nu_lru, nnuidp) { @@ -741,13 +741,13 @@ nfsrv_zapsock(struct nfssvc_sock *slp) TAILQ_REMOVE(&slp->ns_uidlruhead, nuidp, nu_lru); if (nuidp->nu_flag & NU_NAM) FREE(nuidp->nu_nam, M_SONAME); - free((caddr_t)nuidp, M_NFSUID); + kfree((caddr_t)nuidp, M_NFSUID); } crit_enter(); for (nwp = slp->ns_tq.lh_first; nwp; nwp = nnwp) { nnwp = nwp->nd_tq.le_next; LIST_REMOVE(nwp, nd_tq); - free((caddr_t)nwp, M_NFSRVDESC); + kfree((caddr_t)nwp, M_NFSRVDESC); } LIST_INIT(&slp->ns_tq); crit_exit(); @@ -763,7 +763,7 @@ nfsrv_slpderef(struct nfssvc_sock *slp) { if (--(slp->ns_sref) == 0 && (slp->ns_flag & SLP_VALID) == 0) { TAILQ_REMOVE(&nfssvc_sockhead, slp, ns_chain); - free((caddr_t)slp, M_NFSSVC); + kfree((caddr_t)slp, M_NFSSVC); } } @@ -820,7 +820,7 @@ nfsrv_init(int terminating) if (slp->ns_flag & SLP_VALID) nfsrv_zapsock(slp); TAILQ_REMOVE(&nfssvc_sockhead, slp, ns_chain); - free((caddr_t)slp, M_NFSSVC); + kfree((caddr_t)slp, M_NFSSVC); } nfsrv_cleancache(); /* And clear out server cache */ } else @@ -838,14 +838,14 @@ nfsrv_init(int terminating) #if 0 nfs_udpsock = (struct nfssvc_sock *) - malloc(sizeof (struct nfssvc_sock), M_NFSSVC, M_WAITOK); + kmalloc(sizeof (struct nfssvc_sock), M_NFSSVC, M_WAITOK); bzero((caddr_t)nfs_udpsock, sizeof (struct nfssvc_sock)); STAILQ_INIT(&nfs_udpsock->ns_rec); TAILQ_INIT(&nfs_udpsock->ns_uidlruhead); TAILQ_INSERT_HEAD(&nfssvc_sockhead, nfs_udpsock, ns_chain); nfs_cltpsock = (struct nfssvc_sock *) - malloc(sizeof (struct nfssvc_sock), M_NFSSVC, M_WAITOK); + kmalloc(sizeof (struct nfssvc_sock), M_NFSSVC, M_WAITOK); bzero((caddr_t)nfs_cltpsock, sizeof (struct nfssvc_sock)); STAILQ_INIT(&nfs_cltpsock->ns_rec); TAILQ_INIT(&nfs_cltpsock->ns_uidlruhead); @@ -986,7 +986,7 @@ nfs_getauth(struct nfsmount *nmp, struct nfsreq *rep, } } nmp->nm_state &= ~(NFSSTA_WAITAUTH | NFSSTA_WANTAUTH); - nmp->nm_authstr = *auth_str = (char *)malloc(RPCAUTH_MAXSIZ, M_TEMP, M_WAITOK); + nmp->nm_authstr = *auth_str = (char *)kmalloc(RPCAUTH_MAXSIZ, M_TEMP, M_WAITOK); nmp->nm_authlen = RPCAUTH_MAXSIZ; nmp->nm_verfstr = verf_str; nmp->nm_verflen = *verf_len; @@ -1006,7 +1006,7 @@ nfs_getauth(struct nfsmount *nmp, struct nfsreq *rep, error = EAUTH; } if (error) - free((caddr_t)*auth_str, M_TEMP); + kfree((caddr_t)*auth_str, M_TEMP); else { *auth_len = nmp->nm_authlen; *verf_len = nmp->nm_verflen; @@ -1050,7 +1050,7 @@ nfs_getnickauth(struct nfsmount *nmp, struct ucred *cred, char **auth_str, TAILQ_REMOVE(&nmp->nm_uidlruhead, nuidp, nu_lru); TAILQ_INSERT_TAIL(&nmp->nm_uidlruhead, nuidp, nu_lru); - nickp = (u_int32_t *)malloc(2 * NFSX_UNSIGNED, M_TEMP, M_WAITOK); + nickp = (u_int32_t *)kmalloc(2 * NFSX_UNSIGNED, M_TEMP, M_WAITOK); *nickp++ = txdr_unsigned(RPCAKN_NICKNAME); *nickp = txdr_unsigned(nuidp->nu_nickname); *auth_str = (char *)nickp; @@ -1125,7 +1125,7 @@ nfs_savenickauth(struct nfsmount *nmp, struct ucred *cred, int len, if (nmp->nm_numuids < nuidhash_max) { nmp->nm_numuids++; nuidp = (struct nfsuid *) - malloc(sizeof (struct nfsuid), M_NFSUID, + kmalloc(sizeof (struct nfsuid), M_NFSUID, M_WAITOK); } else { nuidp = TAILQ_FIRST(&nmp->nm_uidlruhead); diff --git a/sys/vfs/nfs/nfs_vfsops.c b/sys/vfs/nfs/nfs_vfsops.c index e10bf30b9c..d117d29dfc 100644 --- a/sys/vfs/nfs/nfs_vfsops.c +++ b/sys/vfs/nfs/nfs_vfsops.c @@ -35,7 +35,7 @@ * * @(#)nfs_vfsops.c 8.12 (Berkeley) 5/20/95 * $FreeBSD: src/sys/nfs/nfs_vfsops.c,v 1.91.2.7 2003/01/27 20:04:08 dillon Exp $ - * $DragonFly: src/sys/vfs/nfs/nfs_vfsops.c,v 1.45 2006/08/12 00:26:21 dillon Exp $ + * $DragonFly: src/sys/vfs/nfs/nfs_vfsops.c,v 1.46 2006/09/05 00:55:50 dillon Exp $ */ #include "opt_bootp.h" @@ -536,7 +536,7 @@ nfs_mountroot(struct mount *mp) &nd->root_saddr, &nd->root_args, td, &vp, &mp)) != 0) { if (swap_mp) { mp->mnt_vfc->vfc_refcount--; - free(swap_mp, M_MOUNT); + kfree(swap_mp, M_MOUNT); } crit_exit(); return (error); @@ -645,7 +645,7 @@ haderror: mp->mnt_vfc->vfc_refcount--; vfs_unbusy(mp); if (didalloc) - free(mp, M_MOUNT); + kfree(mp, M_MOUNT); FREE(nam, M_SONAME); return (error); } diff --git a/sys/vfs/nfs/nfs_vnops.c b/sys/vfs/nfs/nfs_vnops.c index 197391f506..c73809da0b 100644 --- a/sys/vfs/nfs/nfs_vnops.c +++ b/sys/vfs/nfs/nfs_vnops.c @@ -35,7 +35,7 @@ * * @(#)nfs_vnops.c 8.16 (Berkeley) 5/27/95 * $FreeBSD: src/sys/nfs/nfs_vnops.c,v 1.150.2.5 2001/12/20 19:56:28 dillon Exp $ - * $DragonFly: src/sys/vfs/nfs/nfs_vnops.c,v 1.65 2006/08/19 17:27:24 dillon Exp $ + * $DragonFly: src/sys/vfs/nfs/nfs_vnops.c,v 1.66 2006/09/05 00:55:50 dillon Exp $ */ @@ -402,11 +402,11 @@ nfs_access(struct vop_access_args *ap) error = nfs_readrpc(vp, &auio); } else if (vp->v_type == VDIR) { char* bp; - bp = malloc(NFS_DIRBLKSIZ, M_TEMP, M_WAITOK); + bp = kmalloc(NFS_DIRBLKSIZ, M_TEMP, M_WAITOK); aiov.iov_base = bp; aiov.iov_len = auio.uio_resid = NFS_DIRBLKSIZ; error = nfs_readdirrpc(vp, &auio); - free(bp, M_TEMP); + kfree(bp, M_TEMP); } else if (vp->v_type == VLNK) { error = nfs_readlinkrpc(vp, &auio); } else { @@ -2656,7 +2656,7 @@ nfs_sillyrename(struct vnode *dvp, struct vnode *vp, struct componentname *cnp) bad: vrele(sp->s_dvp); crfree(sp->s_cred); - free((caddr_t)sp, M_NFSREQ); + kfree((caddr_t)sp, M_NFSREQ); return (error); } @@ -2694,10 +2694,10 @@ nfs_lookitup(struct vnode *dvp, const char *name, int len, struct ucred *cred, if (*npp) { np = *npp; if (np->n_fhsize > NFS_SMALLFH && fhlen <= NFS_SMALLFH) { - free((caddr_t)np->n_fhp, M_NFSBIGFH); + kfree((caddr_t)np->n_fhp, M_NFSBIGFH); np->n_fhp = &np->n_fh; } else if (np->n_fhsize <= NFS_SMALLFH && fhlen>NFS_SMALLFH) - np->n_fhp =(nfsfh_t *)malloc(fhlen,M_NFSBIGFH,M_WAITOK); + np->n_fhp =(nfsfh_t *)kmalloc(fhlen,M_NFSBIGFH,M_WAITOK); bcopy((caddr_t)nfhp, (caddr_t)np->n_fhp, fhlen); np->n_fhsize = fhlen; newvp = NFSTOV(np); diff --git a/sys/vfs/ntfs/ntfs_ihash.c b/sys/vfs/ntfs/ntfs_ihash.c index 7d43c8f2dd..9eddcdd1a9 100644 --- a/sys/vfs/ntfs/ntfs_ihash.c +++ b/sys/vfs/ntfs/ntfs_ihash.c @@ -34,7 +34,7 @@ * * @(#)ufs_ihash.c 8.7 (Berkeley) 5/17/95 * $FreeBSD: src/sys/ntfs/ntfs_ihash.c,v 1.7 1999/12/03 20:37:39 semenu Exp $ - * $DragonFly: src/sys/vfs/ntfs/ntfs_ihash.c,v 1.10 2006/03/02 19:08:00 dillon Exp $ + * $DragonFly: src/sys/vfs/ntfs/ntfs_ihash.c,v 1.11 2006/09/05 00:55:50 dillon Exp $ */ #include @@ -83,7 +83,7 @@ ntfs_nthash_uninit(struct vfsconf *vfc) lwkt_gettoken(&ilock, &ntfs_nthash_slock); if (ntfs_nthashtbl) - free(ntfs_nthashtbl, M_NTFSNTHASH); + kfree(ntfs_nthashtbl, M_NTFSNTHASH); lwkt_reltoken(&ilock); return 0; diff --git a/sys/vfs/ntfs/ntfs_vfsops.c b/sys/vfs/ntfs/ntfs_vfsops.c index 33bf34df9e..6d6c90dfae 100644 --- a/sys/vfs/ntfs/ntfs_vfsops.c +++ b/sys/vfs/ntfs/ntfs_vfsops.c @@ -26,7 +26,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/ntfs/ntfs_vfsops.c,v 1.20.2.5 2001/12/25 01:44:45 dillon Exp $ - * $DragonFly: src/sys/vfs/ntfs/ntfs_vfsops.c,v 1.39 2006/08/12 00:26:21 dillon Exp $ + * $DragonFly: src/sys/vfs/ntfs/ntfs_vfsops.c,v 1.40 2006/09/05 00:55:50 dillon Exp $ */ @@ -183,7 +183,7 @@ ntfs_mountroot(void) if ((error = ntfs_mountfs(rootvp, mp, &args, proc0.p_ucred)) != 0) { mp->mnt_op->vfs_refcount--; vfs_unbusy(mp); - free(mp, M_MOUNT); + kfree(mp, M_MOUNT); vrele(rootvp); return (error); } @@ -436,7 +436,7 @@ ntfs_mountfs(struct vnode *devvp, struct mount *mp, struct ntfs_args *argsp, error = bread(devvp, ntfs_bntodoff(BBLOCK), BBSIZE, &bp); if (error) goto out; - ntmp = malloc( sizeof *ntmp, M_NTFSMNT, M_WAITOK ); + ntmp = kmalloc( sizeof *ntmp, M_NTFSMNT, M_WAITOK ); bzero( ntmp, sizeof *ntmp ); bcopy( bp->b_data, &ntmp->ntm_bootfile, sizeof(struct bootfile) ); brelse( bp ); diff --git a/sys/vfs/nullfs/null_vfsops.c b/sys/vfs/nullfs/null_vfsops.c index fba9ec0807..98327d53b7 100644 --- a/sys/vfs/nullfs/null_vfsops.c +++ b/sys/vfs/nullfs/null_vfsops.c @@ -37,7 +37,7 @@ * * @(#)lofs_vfsops.c 1.2 (Berkeley) 6/18/92 * $FreeBSD: src/sys/miscfs/nullfs/null_vfsops.c,v 1.35.2.3 2001/07/26 20:37:11 iedowse Exp $ - * $DragonFly: src/sys/vfs/nullfs/null_vfsops.c,v 1.24 2006/08/12 00:26:21 dillon Exp $ + * $DragonFly: src/sys/vfs/nullfs/null_vfsops.c,v 1.25 2006/09/05 00:55:50 dillon Exp $ */ /* @@ -164,7 +164,7 @@ nullfs_unmount(struct mount *mp, int mntflags) */ mntdata = mp->mnt_data; mp->mnt_data = 0; - free(mntdata, M_NULLFSMNT); + kfree(mntdata, M_NULLFSMNT); return 0; } diff --git a/sys/vfs/nwfs/nwfs_node.c b/sys/vfs/nwfs/nwfs_node.c index 345ee79cc5..de986ccbdd 100644 --- a/sys/vfs/nwfs/nwfs_node.c +++ b/sys/vfs/nwfs/nwfs_node.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/nwfs/nwfs_node.c,v 1.3.2.8 2001/12/25 01:44:45 dillon Exp $ - * $DragonFly: src/sys/vfs/nwfs/nwfs_node.c,v 1.22 2006/05/06 02:43:14 dillon Exp $ + * $DragonFly: src/sys/vfs/nwfs/nwfs_node.c,v 1.23 2006/09/05 00:55:50 dillon Exp $ */ #include #include @@ -82,7 +82,7 @@ nwfs_hash_init(void) void nwfs_hash_free(void) { - free(nwhashtbl, M_NWFSHASH); + kfree(nwhashtbl, M_NWFSHASH); } int @@ -182,7 +182,7 @@ rescan: if (nwfs_hashlookup(nmp, fid, NULL) == 0) { np->n_vnode = NULL; vx_put(vp); - free(np, M_NWNODE); + kfree(np, M_NWNODE); goto rescan; } *vpp = vp; @@ -239,7 +239,7 @@ nwfs_reclaim(struct vop_reclaim_args *ap) nmp->n_root = NULL; vp->v_data = NULL; if (np) - free(np, M_NWNODE); + kfree(np, M_NWNODE); if (dvp) vrele(dvp); return (0); diff --git a/sys/vfs/nwfs/nwfs_vfsops.c b/sys/vfs/nwfs/nwfs_vfsops.c index 3acbc30c02..bf6ccfed26 100644 --- a/sys/vfs/nwfs/nwfs_vfsops.c +++ b/sys/vfs/nwfs/nwfs_vfsops.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/nwfs/nwfs_vfsops.c,v 1.6.2.6 2001/10/25 19:18:54 dillon Exp $ - * $DragonFly: src/sys/vfs/nwfs/nwfs_vfsops.c,v 1.25 2006/08/12 00:26:21 dillon Exp $ + * $DragonFly: src/sys/vfs/nwfs/nwfs_vfsops.c,v 1.26 2006/09/05 00:55:50 dillon Exp $ */ #include "opt_ncp.h" #ifndef NCP @@ -123,7 +123,7 @@ nwfs_initnls(struct nwmount *nmp) { COPY_TABLE(nmp->m.nls.u2n, ncp_defnls.u2n); } while(0); if (error) { - free(pe, M_NWFSDATA); + kfree(pe, M_NWFSDATA); return error; } return 0; @@ -217,7 +217,7 @@ nwfs_mount(struct mount *mp, char *path, caddr_t data, struct ucred *cred) return error; bad: if (nmp) - free(nmp, M_NWFSDATA); + kfree(nmp, M_NWFSDATA); if (handle) ncp_conn_puthandle(handle, NULL, 0); return error; @@ -247,8 +247,8 @@ nwfs_unmount(struct mount *mp, int mntflags) } mp->mnt_data = (qaddr_t)0; if (nmp->m.flags & NWFS_MOUNT_HAVE_NLS) - free(nmp->m.nls.to_lower, M_NWFSDATA); - free(nmp, M_NWFSDATA); + kfree(nmp->m.nls.to_lower, M_NWFSDATA); + kfree(nmp, M_NWFSDATA); mp->mnt_flag &= ~MNT_LOCAL; return (error); } diff --git a/sys/vfs/portal/portal_vfsops.c b/sys/vfs/portal/portal_vfsops.c index a18acd2f78..72f057e1ef 100644 --- a/sys/vfs/portal/portal_vfsops.c +++ b/sys/vfs/portal/portal_vfsops.c @@ -36,7 +36,7 @@ * @(#)portal_vfsops.c 8.11 (Berkeley) 5/14/95 * * $FreeBSD: src/sys/miscfs/portal/portal_vfsops.c,v 1.26.2.2 2001/07/26 20:37:16 iedowse Exp $ - * $DragonFly: src/sys/vfs/portal/portal_vfsops.c,v 1.22 2006/08/09 22:47:36 dillon Exp $ + * $DragonFly: src/sys/vfs/portal/portal_vfsops.c,v 1.23 2006/09/05 00:55:50 dillon Exp $ */ /* @@ -187,7 +187,7 @@ portal_unmount(struct mount *mp, int mntflags) /* * Finally, throw away the portalmount structure */ - free(mp->mnt_data, M_PORTALFSMNT); /* XXX */ + kfree(mp->mnt_data, M_PORTALFSMNT); /* XXX */ mp->mnt_data = 0; return (0); } diff --git a/sys/vfs/portal/portal_vnops.c b/sys/vfs/portal/portal_vnops.c index 90f08d6be5..75782114c7 100644 --- a/sys/vfs/portal/portal_vnops.c +++ b/sys/vfs/portal/portal_vnops.c @@ -36,7 +36,7 @@ * @(#)portal_vnops.c 8.14 (Berkeley) 5/21/95 * * $FreeBSD: src/sys/miscfs/portal/portal_vnops.c,v 1.38 1999/12/21 06:29:00 chris Exp $ - * $DragonFly: src/sys/vfs/portal/portal_vnops.c,v 1.31 2006/08/12 00:26:21 dillon Exp $ + * $DragonFly: src/sys/vfs/portal/portal_vnops.c,v 1.32 2006/09/05 00:55:50 dillon Exp $ */ /* @@ -153,7 +153,7 @@ portal_lookup(struct vop_old_lookup_args *ap) size++; cnp->cn_consume = size - cnp->cn_namelen; - pt->pt_arg = malloc(size+1, M_TEMP, M_WAITOK); + pt->pt_arg = kmalloc(size+1, M_TEMP, M_WAITOK); pt->pt_size = size+1; bcopy(pname, pt->pt_arg, pt->pt_size); pt->pt_fileid = portal_fileid++; @@ -532,7 +532,7 @@ portal_reclaim(struct vop_reclaim_args *ap) struct portalnode *pt = VTOPORTAL(ap->a_vp); if (pt->pt_arg) { - free((caddr_t) pt->pt_arg, M_TEMP); + kfree((caddr_t) pt->pt_arg, M_TEMP); pt->pt_arg = 0; } FREE(ap->a_vp->v_data, M_TEMP); diff --git a/sys/vfs/procfs/procfs_subr.c b/sys/vfs/procfs/procfs_subr.c index 19bbe90f61..355cf08c0d 100644 --- a/sys/vfs/procfs/procfs_subr.c +++ b/sys/vfs/procfs/procfs_subr.c @@ -37,7 +37,7 @@ * @(#)procfs_subr.c 8.6 (Berkeley) 5/14/95 * * $FreeBSD: src/sys/miscfs/procfs/procfs_subr.c,v 1.26.2.3 2002/02/18 21:28:04 des Exp $ - * $DragonFly: src/sys/vfs/procfs/procfs_subr.c,v 1.14 2006/08/11 01:55:01 dillon Exp $ + * $DragonFly: src/sys/vfs/procfs/procfs_subr.c,v 1.15 2006/09/05 00:55:50 dillon Exp $ */ #include @@ -142,7 +142,7 @@ loop: error = getnewvnode(VT_PROCFS, mp, vpp, 0, 0); if (error) { - free(pfs, M_TEMP); + kfree(pfs, M_TEMP); goto out; } vp = *vpp; @@ -251,7 +251,7 @@ procfs_freevp(struct vnode *vp) KKASSERT(*pfspp); *pfspp = pfs->pfs_next; pfs->pfs_next = NULL; - free(pfs, M_TEMP); + kfree(pfs, M_TEMP); return (0); } diff --git a/sys/vfs/procfs/procfs_vnops.c b/sys/vfs/procfs/procfs_vnops.c index 29971dc7e1..2c81d078fa 100644 --- a/sys/vfs/procfs/procfs_vnops.c +++ b/sys/vfs/procfs/procfs_vnops.c @@ -37,7 +37,7 @@ * @(#)procfs_vnops.c 8.18 (Berkeley) 5/21/95 * * $FreeBSD: src/sys/miscfs/procfs/procfs_vnops.c,v 1.76.2.7 2002/01/22 17:22:59 nectar Exp $ - * $DragonFly: src/sys/vfs/procfs/procfs_vnops.c,v 1.37 2006/09/03 18:29:17 dillon Exp $ + * $DragonFly: src/sys/vfs/procfs/procfs_vnops.c,v 1.38 2006/09/05 00:55:50 dillon Exp $ */ /* @@ -558,7 +558,7 @@ procfs_getattr(struct vop_getattr_args *ap) error = vn_fullpath(procp, NULL, &fullpath, &freepath); if (error == 0) { vap->va_size = strlen(fullpath); - free(freepath, M_TEMP); + kfree(freepath, M_TEMP); } else { vap->va_size = sizeof("unknown") - 1; error = 0; @@ -1057,7 +1057,7 @@ procfs_readlink(struct vop_readlink_args *ap) return (uiomove("unknown", sizeof("unknown") - 1, ap->a_uio)); error = uiomove(fullpath, strlen(fullpath), ap->a_uio); - free(freepath, M_TEMP); + kfree(freepath, M_TEMP); return (error); default: return (EINVAL); diff --git a/sys/vfs/smbfs/smbfs_node.c b/sys/vfs/smbfs/smbfs_node.c index f2bf160661..5c7b129df5 100644 --- a/sys/vfs/smbfs/smbfs_node.c +++ b/sys/vfs/smbfs/smbfs_node.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/fs/smbfs/smbfs_node.c,v 1.2.2.3 2003/01/17 08:20:26 tjr Exp $ - * $DragonFly: src/sys/vfs/smbfs/smbfs_node.c,v 1.20 2006/05/06 02:43:14 dillon Exp $ + * $DragonFly: src/sys/vfs/smbfs/smbfs_node.c,v 1.21 2006/09/05 00:55:51 dillon Exp $ */ #include #include @@ -111,7 +111,7 @@ smbfs_name_alloc(const u_char *name, int nmlen) nmlen++; #ifdef SMBFS_NAME_DEBUG - cp = malloc(nmlen + 2 + sizeof(int), M_SMBNODENAME, M_WAITOK); + cp = kmalloc(nmlen + 2 + sizeof(int), M_SMBNODENAME, M_WAITOK); *(int*)cp = nmlen; cp += sizeof(int); cp[0] = 0xfc; @@ -119,7 +119,7 @@ smbfs_name_alloc(const u_char *name, int nmlen) bcopy(name, cp, nmlen - 1); cp[nmlen] = 0xfe; #else - cp = malloc(nmlen, M_SMBNODENAME, M_WAITOK); + cp = kmalloc(nmlen, M_SMBNODENAME, M_WAITOK); bcopy(name, cp, nmlen - 1); #endif cp[nmlen - 1] = 0; @@ -151,9 +151,9 @@ smbfs_name_free(u_char *name) printf("Last byte of name entry '%s' corrupted\n", name); Debugger("ditto"); } - free(cp, M_SMBNODENAME); + kfree(cp, M_SMBNODENAME); #else - free(name, M_SMBNODENAME); + kfree(name, M_SMBNODENAME); #endif } diff --git a/sys/vfs/smbfs/smbfs_smb.c b/sys/vfs/smbfs/smbfs_smb.c index 6b3618aa29..23fa0a2ebb 100644 --- a/sys/vfs/smbfs/smbfs_smb.c +++ b/sys/vfs/smbfs/smbfs_smb.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/fs/smbfs/smbfs_smb.c,v 1.1.2.2 2003/01/17 08:20:26 tjr Exp $ - * $DragonFly: src/sys/vfs/smbfs/smbfs_smb.c,v 1.7 2005/02/17 14:00:10 joerg Exp $ + * $DragonFly: src/sys/vfs/smbfs/smbfs_smb.c,v 1.8 2006/09/05 00:55:51 dillon Exp $ */ #include #include @@ -1033,7 +1033,7 @@ static int smbfs_findopenLM2(struct smbfs_fctx *ctx, struct smbnode *dnp, const char *wildcard, int wclen, int attr, struct smb_cred *scred) { - ctx->f_name = malloc(SMB_MAXFNAMELEN, M_SMBFSDATA, M_WAITOK); + ctx->f_name = kmalloc(SMB_MAXFNAMELEN, M_SMBFSDATA, M_WAITOK); if (ctx->f_name == NULL) return ENOMEM; ctx->f_infolevel = SMB_DIALECT(SSTOVC(ctx->f_ssp)) < SMB_DIALECT_NTLM0_12 ? @@ -1139,8 +1139,8 @@ smbfs_findnextLM2(struct smbfs_fctx *ctx, int limit) */ if (ctx->f_rnamelen <= nmlen) { if (ctx->f_rname) - free(ctx->f_rname, M_SMBFSDATA); - ctx->f_rname = malloc(nmlen + 1, M_SMBFSDATA, M_WAITOK); + kfree(ctx->f_rname, M_SMBFSDATA); + ctx->f_rname = kmalloc(nmlen + 1, M_SMBFSDATA, M_WAITOK); ctx->f_rnamelen = nmlen; } bcopy(ctx->f_name, ctx->f_rname, nmlen); @@ -1158,7 +1158,7 @@ static int smbfs_findcloseLM2(struct smbfs_fctx *ctx) { if (ctx->f_name) - free(ctx->f_name, M_SMBFSDATA); + kfree(ctx->f_name, M_SMBFSDATA); if (ctx->f_t2) smb_t2_done(ctx->f_t2); if ((ctx->f_flags & SMBFS_RDD_NOCLOSE) == 0) @@ -1173,7 +1173,7 @@ smbfs_findopen(struct smbnode *dnp, const char *wildcard, int wclen, int attr, struct smbfs_fctx *ctx; int error; - ctx = malloc(sizeof(*ctx), M_SMBFSDATA, M_WAITOK); + ctx = kmalloc(sizeof(*ctx), M_SMBFSDATA, M_WAITOK); if (ctx == NULL) return ENOMEM; bzero(ctx, sizeof(*ctx)); @@ -1232,8 +1232,8 @@ smbfs_findclose(struct smbfs_fctx *ctx, struct smb_cred *scred) } else smbfs_findcloseLM2(ctx); if (ctx->f_rname) - free(ctx->f_rname, M_SMBFSDATA); - free(ctx, M_SMBFSDATA); + kfree(ctx->f_rname, M_SMBFSDATA); + kfree(ctx, M_SMBFSDATA); return 0; } diff --git a/sys/vfs/smbfs/smbfs_vfsops.c b/sys/vfs/smbfs/smbfs_vfsops.c index c03f81f074..9f881fdefd 100644 --- a/sys/vfs/smbfs/smbfs_vfsops.c +++ b/sys/vfs/smbfs/smbfs_vfsops.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/fs/smbfs/smbfs_vfsops.c,v 1.2.2.5 2003/01/17 08:20:26 tjr Exp $ - * $DragonFly: src/sys/vfs/smbfs/smbfs_vfsops.c,v 1.30 2006/08/12 00:26:21 dillon Exp $ + * $DragonFly: src/sys/vfs/smbfs/smbfs_vfsops.c,v 1.31 2006/09/05 00:55:51 dillon Exp $ */ #include "opt_netsmb.h" #ifndef NETSMB @@ -216,12 +216,12 @@ bad: if (smp->sm_cred) crfree(smp->sm_cred); if (smp->sm_hash) - free(smp->sm_hash, M_SMBFSHASH); + kfree(smp->sm_hash, M_SMBFSHASH); lockdestroy(&smp->sm_hashlock); #ifdef SMBFS_USEZONE zfree(smbfsmount_zone, smp); #else - free(smp, M_SMBFSDATA); + kfree(smp, M_SMBFSDATA); #endif } if (ssp) @@ -263,12 +263,12 @@ smbfs_unmount(struct mount *mp, int mntflags) if (smp->sm_cred) crfree(smp->sm_cred); if (smp->sm_hash) - free(smp->sm_hash, M_SMBFSHASH); + kfree(smp->sm_hash, M_SMBFSHASH); lockdestroy(&smp->sm_hashlock); #ifdef SMBFS_USEZONE zfree(smbfsmount_zone, smp); #else - free(smp, M_SMBFSDATA); + kfree(smp, M_SMBFSDATA); #endif mp->mnt_flag &= ~MNT_LOCAL; return error; diff --git a/sys/vfs/udf/udf_vfsops.c b/sys/vfs/udf/udf_vfsops.c index 4821090caf..2951e69a92 100644 --- a/sys/vfs/udf/udf_vfsops.c +++ b/sys/vfs/udf/udf_vfsops.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/fs/udf/udf_vfsops.c,v 1.16 2003/11/05 06:56:08 scottl Exp $ - * $DragonFly: src/sys/vfs/udf/udf_vfsops.c,v 1.21 2006/08/12 00:26:21 dillon Exp $ + * $DragonFly: src/sys/vfs/udf/udf_vfsops.c,v 1.22 2006/09/05 00:55:51 dillon Exp $ */ /* udf_vfsops.c */ @@ -257,7 +257,7 @@ udf_mountfs(struct vnode *devvp, struct mount *mp) needclose = 1; dev = devvp->v_rdev; - udfmp = malloc(sizeof(*udfmp), M_UDFMOUNT, M_WAITOK | M_ZERO); + udfmp = kmalloc(sizeof(*udfmp), M_UDFMOUNT, M_WAITOK | M_ZERO); mp->mnt_data = (qaddr_t)udfmp; mp->mnt_stat.f_fsid.val[0] = dev2udev(dev); @@ -389,7 +389,7 @@ udf_mountfs(struct vnode *devvp, struct mount *mp) bail: if (udfmp != NULL) - free(udfmp, M_UDFMOUNT); + kfree(udfmp, M_UDFMOUNT); if (bp != NULL) brelse(bp); if (needclose) @@ -416,10 +416,10 @@ udf_unmount(struct mount *mp, int mntflags) vrele(udfmp->im_devvp); if (udfmp->s_table) - free(udfmp->s_table, M_UDFMOUNT); + kfree(udfmp->s_table, M_UDFMOUNT); if (udfmp->hashtbl) - free(udfmp->hashtbl, M_UDFMOUNT); - free(udfmp, M_UDFMOUNT); + kfree(udfmp->hashtbl, M_UDFMOUNT); + kfree(udfmp, M_UDFMOUNT); mp->mnt_data = (qaddr_t)0; mp->mnt_flag &= ~MNT_LOCAL; @@ -498,7 +498,7 @@ udf_vget(struct mount *mp, ino_t ino, struct vnode **vpp) * Allocate memory and check the tag id's before grabbing a new * vnode, since it's hard to roll back if there is a problem. */ - unode = malloc(sizeof(*unode), M_UDFNODE, M_WAITOK | M_ZERO); + unode = kmalloc(sizeof(*unode), M_UDFNODE, M_WAITOK | M_ZERO); /* * Copy in the file entry. Per the spec, the size can only be 1 block. @@ -507,19 +507,19 @@ udf_vget(struct mount *mp, ino_t ino, struct vnode **vpp) devvp = udfmp->im_devvp; if ((error = RDSECTOR(devvp, sector, udfmp->bsize, &bp)) != 0) { printf("Cannot read sector %d\n", sector); - free(unode, M_UDFNODE); + kfree(unode, M_UDFNODE); return(error); } fe = (struct file_entry *)bp->b_data; if (udf_checktag(&fe->tag, TAGID_FENTRY)) { printf("Invalid file entry!\n"); - free(unode, M_UDFNODE); + kfree(unode, M_UDFNODE); brelse(bp); return(ENOMEM); } size = UDF_FENTRY_SIZE + fe->l_ea + fe->l_ad; - unode->fentry = malloc(size, M_UDFFENTRY, M_WAITOK | M_ZERO); + unode->fentry = kmalloc(size, M_UDFFENTRY, M_WAITOK | M_ZERO); bcopy(bp->b_data, unode->fentry, size); @@ -528,7 +528,7 @@ udf_vget(struct mount *mp, ino_t ino, struct vnode **vpp) if ((error = udf_allocv(mp, &vp))) { printf("Error from udf_allocv\n"); - free(unode, M_UDFNODE); + kfree(unode, M_UDFNODE); return(error); } @@ -652,7 +652,7 @@ udf_find_partmaps(struct udf_mnt *udfmp, struct logvol_desc *lvd) } pms = &pmap->pms; - udfmp->s_table = malloc(pms->st_size, M_UDFMOUNT, + udfmp->s_table = kmalloc(pms->st_size, M_UDFMOUNT, M_WAITOK | M_ZERO); if (udfmp->s_table == NULL) return(ENOMEM); diff --git a/sys/vfs/udf/udf_vnops.c b/sys/vfs/udf/udf_vnops.c index c3ccef6de2..71eb07c764 100644 --- a/sys/vfs/udf/udf_vnops.c +++ b/sys/vfs/udf/udf_vnops.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/fs/udf/udf_vnops.c,v 1.33 2003/12/07 05:04:49 scottl Exp $ - * $DragonFly: src/sys/vfs/udf/udf_vnops.c,v 1.25 2006/08/19 17:27:25 dillon Exp $ + * $DragonFly: src/sys/vfs/udf/udf_vnops.c,v 1.26 2006/09/05 00:55:51 dillon Exp $ */ /* udf_vnops.c */ @@ -482,11 +482,11 @@ udf_transname(char *cs0string, char *destname, int len, struct udf_mnt *udfmp) /* Convert 16-bit Unicode to destname */ /* allocate a buffer big enough to hold an 8->16 bit expansion */ - transname = malloc(NAME_MAX * sizeof(unicode_t), M_TEMP, M_WAITOK | M_ZERO); + transname = kmalloc(NAME_MAX * sizeof(unicode_t), M_TEMP, M_WAITOK | M_ZERO); if ((unilen = udf_UncompressUnicode(len, cs0string, transname)) == -1) { printf("udf: Unicode translation failed\n"); - free(transname, M_TEMP); + kfree(transname, M_TEMP); return(0); } @@ -495,7 +495,7 @@ udf_transname(char *cs0string, char *destname, int len, struct udf_mnt *udfmp) destname[i] = '.'; /* Fudge the 16bit chars */ else destname[i] = transname[i] & 0xff; - free(transname, M_TEMP); + kfree(transname, M_TEMP); destname[unilen] = 0; destlen = unilen; @@ -515,7 +515,7 @@ udf_cmpname(char *cs0string, char *cmpname, int cs0len, int cmplen, struct udf_m /* This is overkill, but not worth creating a new zone */ - transname = malloc(NAME_MAX * sizeof(unicode_t), M_TEMP, + transname = kmalloc(NAME_MAX * sizeof(unicode_t), M_TEMP, M_WAITOK | M_ZERO); cs0len = udf_transname(cs0string, transname, cs0len, udfmp); @@ -526,7 +526,7 @@ udf_cmpname(char *cs0string, char *cmpname, int cs0len, int cmplen, struct udf_m else error = bcmp(transname, cmpname, cmplen); - free(transname, M_TEMP); + kfree(transname, M_TEMP); return(error); } @@ -543,7 +543,7 @@ udf_opendir(struct udf_node *node, int offset, int fsize, struct udf_mnt *udfmp) { struct udf_dirstream *ds; - ds = malloc(sizeof(*ds), M_UDFDS, M_WAITOK | M_ZERO); + ds = kmalloc(sizeof(*ds), M_UDFDS, M_WAITOK | M_ZERO); ds->node = node; ds->offset = offset; @@ -584,7 +584,7 @@ udf_getfid(struct udf_dirstream *ds) */ if (ds->fid_fragment && ds->buf != NULL) { ds->fid_fragment = 0; - free(ds->buf, M_UDFFID); + kfree(ds->buf, M_UDFFID); } fid = (struct fileid_desc*)&ds->data[ds->off]; @@ -609,7 +609,7 @@ udf_getfid(struct udf_dirstream *ds) * File ID descriptors can only be at most one * logical sector in size. */ - ds->buf = malloc(ds->udfmp->bsize, M_UDFFID, M_WAITOK | M_ZERO); + ds->buf = kmalloc(ds->udfmp->bsize, M_UDFFID, M_WAITOK | M_ZERO); bcopy(fid, ds->buf, frag_size); /* Reduce all of the casting magic */ @@ -675,9 +675,9 @@ udf_closedir(struct udf_dirstream *ds) brelse(ds->bp); if (ds->fid_fragment && ds->buf != NULL) - free(ds->buf, M_UDFFID); + kfree(ds->buf, M_UDFFID); - free(ds, M_UDFDS); + kfree(ds, M_UDFDS); } static int @@ -714,7 +714,7 @@ udf_readdir(struct vop_readdir_args *a) ncookies = uio->uio_resid / 8 + 1; if (ncookies > 1024) ncookies = 1024; - cookies = malloc(sizeof(u_long) * ncookies, M_TEMP, M_WAITOK); + cookies = kmalloc(sizeof(u_long) * ncookies, M_TEMP, M_WAITOK); uiodir.ncookies = ncookies; uiodir.cookies = cookies; uiodir.acookies = 0; @@ -728,7 +728,7 @@ udf_readdir(struct vop_readdir_args *a) ds = udf_opendir(node, uio->uio_offset, node->fentry->inf_len, node->udfmp); - name = malloc(NAME_MAX, M_TEMP, M_WAITOK); + name = kmalloc(NAME_MAX, M_TEMP, M_WAITOK); while ((fid = udf_getfid(ds)) != NULL) { @@ -810,7 +810,7 @@ udf_readdir(struct vop_readdir_args *a) } - free(name, M_TEMP); + kfree(name, M_TEMP); /* tell the calling layer whether we need to be called again */ *a->a_eofflag = uiodir.eofflag; @@ -823,7 +823,7 @@ udf_readdir(struct vop_readdir_args *a) if (a->a_ncookies != NULL) { if (error) - free(cookies, M_TEMP); + kfree(cookies, M_TEMP); else { *a->a_ncookies = uiodir.acookies; *a->a_cookies = cookies; @@ -1056,8 +1056,8 @@ udf_reclaim(struct vop_reclaim_args *a) } if (unode->fentry != NULL) - free(unode->fentry, M_UDFFENTRY); - free(unode, M_UDFNODE); + kfree(unode->fentry, M_UDFFENTRY); + kfree(unode, M_UDFNODE); vp->v_data = NULL; } diff --git a/sys/vfs/ufs/ffs_softdep.c b/sys/vfs/ufs/ffs_softdep.c index 6df9007f51..6cc424fb95 100644 --- a/sys/vfs/ufs/ffs_softdep.c +++ b/sys/vfs/ufs/ffs_softdep.c @@ -37,7 +37,7 @@ * * from: @(#)ffs_softdep.c 9.59 (McKusick) 6/21/00 * $FreeBSD: src/sys/ufs/ffs/ffs_softdep.c,v 1.57.2.11 2002/02/05 18:46:53 dillon Exp $ - * $DragonFly: src/sys/vfs/ufs/ffs_softdep.c,v 1.48 2006/08/12 00:26:21 dillon Exp $ + * $DragonFly: src/sys/vfs/ufs/ffs_softdep.c,v 1.49 2006/09/05 00:55:51 dillon Exp $ */ /* @@ -940,7 +940,7 @@ top: printf("pagedep_lookup: blocking race avoided\n"); ACQUIRE_LOCK(&lk); sema_release(&pagedep_in_progress); - free(pagedep, M_PAGEDEP); + kfree(pagedep, M_PAGEDEP); goto top; } @@ -1033,7 +1033,7 @@ top: printf("inodedep_lookup: blocking race avoided\n"); ACQUIRE_LOCK(&lk); sema_release(&inodedep_in_progress); - free(inodedep, M_INODEDEP); + kfree(inodedep, M_INODEDEP); goto top; } inodedep->id_list.wk_type = D_INODEDEP; @@ -1113,7 +1113,7 @@ top: if (newblk_find(newblkhd, fs, newblkno)) { printf("newblk_lookup: blocking race avoided\n"); sema_release(&pagedep_in_progress); - free(newblk, M_NEWBLK); + kfree(newblk, M_NEWBLK); goto top; } newblk->nb_state = 0; diff --git a/sys/vfs/ufs/ffs_vfsops.c b/sys/vfs/ufs/ffs_vfsops.c index 15537260c6..3da3ccb1ef 100644 --- a/sys/vfs/ufs/ffs_vfsops.c +++ b/sys/vfs/ufs/ffs_vfsops.c @@ -32,7 +32,7 @@ * * @(#)ffs_vfsops.c 8.31 (Berkeley) 5/20/95 * $FreeBSD: src/sys/ufs/ffs/ffs_vfsops.c,v 1.117.2.10 2002/06/23 22:34:52 iedowse Exp $ - * $DragonFly: src/sys/vfs/ufs/ffs_vfsops.c,v 1.48 2006/09/03 18:52:30 dillon Exp $ + * $DragonFly: src/sys/vfs/ufs/ffs_vfsops.c,v 1.49 2006/09/05 00:55:51 dillon Exp $ */ #include "opt_quota.h" @@ -673,11 +673,11 @@ ffs_mountfs(struct vnode *devvp, struct mount *mp, struct malloc_type *mtype) error = EROFS; /* needs translation */ goto out; } - ump = malloc(sizeof *ump, M_UFSMNT, M_WAITOK); + ump = kmalloc(sizeof *ump, M_UFSMNT, M_WAITOK); bzero((caddr_t)ump, sizeof *ump); ump->um_malloctype = mtype; ump->um_i_effnlink_valid = 1; - ump->um_fs = malloc((u_long)fs->fs_sbsize, M_UFSMNT, + ump->um_fs = kmalloc((u_long)fs->fs_sbsize, M_UFSMNT, M_WAITOK); bcopy(bp->b_data, ump->um_fs, (uint)fs->fs_sbsize); if (fs->fs_sbsize < SBSIZE) @@ -691,7 +691,7 @@ ffs_mountfs(struct vnode *devvp, struct mount *mp, struct malloc_type *mtype) if (fs->fs_contigsumsize > 0) size += fs->fs_ncg * sizeof(int32_t); size += fs->fs_ncg * sizeof(uint8_t); - space = malloc((u_long)size, M_UFSMNT, M_WAITOK); + space = kmalloc((u_long)size, M_UFSMNT, M_WAITOK); fs->fs_csp = space; for (i = 0; i < blks; i += fs->fs_frag) { size = fs->fs_bsize; @@ -699,7 +699,7 @@ ffs_mountfs(struct vnode *devvp, struct mount *mp, struct malloc_type *mtype) size = (blks - i) * fs->fs_fsize; if ((error = bread(devvp, fsbtodoff(fs, fs->fs_csaddr + i), size, &bp)) != 0) { - free(fs->fs_csp, M_UFSMNT); + kfree(fs->fs_csp, M_UFSMNT); goto out; } bcopy(bp->b_data, space, (uint)size); @@ -759,7 +759,7 @@ ffs_mountfs(struct vnode *devvp, struct mount *mp, struct malloc_type *mtype) if (ronly == 0) { if ((fs->fs_flags & FS_DOSOFTDEP) && (error = softdep_mount(devvp, mp, fs)) != 0) { - free(fs->fs_csp, M_UFSMNT); + kfree(fs->fs_csp, M_UFSMNT); goto out; } fs->fs_fmod = 1; @@ -777,8 +777,8 @@ out: brelse(bp); VOP_CLOSE(devvp, ronly ? FREAD : FREAD|FWRITE); if (ump) { - free(ump->um_fs, M_UFSMNT); - free(ump, M_UFSMNT); + kfree(ump->um_fs, M_UFSMNT); + kfree(ump, M_UFSMNT); mp->mnt_data = (qaddr_t)0; } return (error); @@ -852,9 +852,9 @@ ffs_unmount(struct mount *mp, int mntflags) vrele(ump->um_devvp); - free(fs->fs_csp, M_UFSMNT); - free(fs, M_UFSMNT); - free(ump, M_UFSMNT); + kfree(fs->fs_csp, M_UFSMNT); + kfree(fs, M_UFSMNT); + kfree(ump, M_UFSMNT); mp->mnt_data = (qaddr_t)0; mp->mnt_flag &= ~MNT_LOCAL; return (error); @@ -1087,7 +1087,7 @@ restart: error = getnewvnode(VT_UFS, mp, &vp, VLKTIMEOUT, LK_CANRECURSE); if (error) { *vpp = NULL; - free(ip, ump->um_malloctype); + kfree(ip, ump->um_malloctype); return (error); } bzero((caddr_t)ip, sizeof(struct inode)); @@ -1111,7 +1111,7 @@ restart: printf("debug: ufs ihashins collision, retrying inode %ld\n", (long)ip->i_number); vx_put(vp); - free(ip, ump->um_malloctype); + kfree(ip, ump->um_malloctype); goto restart; } vp->v_data = ip; diff --git a/sys/vfs/ufs/ufs_ihash.c b/sys/vfs/ufs/ufs_ihash.c index cd4fe3c1c9..2ac0205f58 100644 --- a/sys/vfs/ufs/ufs_ihash.c +++ b/sys/vfs/ufs/ufs_ihash.c @@ -32,7 +32,7 @@ * * @(#)ufs_ihash.c 8.7 (Berkeley) 5/17/95 * $FreeBSD: src/sys/ufs/ufs/ufs_ihash.c,v 1.20 1999/08/28 00:52:29 peter Exp $ - * $DragonFly: src/sys/vfs/ufs/ufs_ihash.c,v 1.17 2006/05/06 02:43:14 dillon Exp $ + * $DragonFly: src/sys/vfs/ufs/ufs_ihash.c,v 1.18 2006/09/05 00:55:51 dillon Exp $ */ #include @@ -66,7 +66,7 @@ ufs_ihashinit(void) ihash = 16; while (ihash < desiredvnodes) ihash <<= 1; - ihashtbl = malloc(sizeof(void *) * ihash, M_UFSIHASH, M_WAITOK|M_ZERO); + ihashtbl = kmalloc(sizeof(void *) * ihash, M_UFSIHASH, M_WAITOK|M_ZERO); --ihash; lwkt_token_init(&ufs_ihash_token); } @@ -78,7 +78,7 @@ ufs_uninit(struct vfsconf *vfc) lwkt_gettoken(&ilock, &ufs_ihash_token); if (ihashtbl) - free(ihashtbl, M_UFSIHASH); + kfree(ihashtbl, M_UFSIHASH); lwkt_reltoken(&ilock); return (0); diff --git a/sys/vfs/ufs/ufs_inode.c b/sys/vfs/ufs/ufs_inode.c index 0d31924d9c..b4eacc72a3 100644 --- a/sys/vfs/ufs/ufs_inode.c +++ b/sys/vfs/ufs/ufs_inode.c @@ -37,7 +37,7 @@ * * @(#)ufs_inode.c 8.9 (Berkeley) 5/14/95 * $FreeBSD: src/sys/ufs/ufs/ufs_inode.c,v 1.25.2.3 2002/07/05 22:42:31 dillon Exp $ - * $DragonFly: src/sys/vfs/ufs/ufs_inode.c,v 1.19 2006/05/26 17:07:48 dillon Exp $ + * $DragonFly: src/sys/vfs/ufs/ufs_inode.c,v 1.20 2006/09/05 00:55:51 dillon Exp $ */ #include "opt_quota.h" @@ -167,7 +167,7 @@ ufs_reclaim(struct vop_reclaim_args *ap) if (ip->i_dirhash != NULL) ufsdirhash_free(ip); #endif - free(ip, VFSTOUFS(vp->v_mount)->um_malloctype); + kfree(ip, VFSTOUFS(vp->v_mount)->um_malloctype); } return (0); } diff --git a/sys/vfs/ufs/ufs_quota.c b/sys/vfs/ufs/ufs_quota.c index fafdfa4fae..daf8852962 100644 --- a/sys/vfs/ufs/ufs_quota.c +++ b/sys/vfs/ufs/ufs_quota.c @@ -35,7 +35,7 @@ * * @(#)ufs_quota.c 8.5 (Berkeley) 5/20/95 * $FreeBSD: src/sys/ufs/ufs/ufs_quota.c,v 1.27.2.3 2002/01/15 10:33:32 phk Exp $ - * $DragonFly: src/sys/vfs/ufs/ufs_quota.c,v 1.23 2006/08/12 00:26:22 dillon Exp $ + * $DragonFly: src/sys/vfs/ufs/ufs_quota.c,v 1.24 2006/09/05 00:55:51 dillon Exp $ */ #include @@ -746,7 +746,7 @@ ufs_dqget(struct vnode *vp, u_long id, struct ufsmount *ump, int type, if (TAILQ_EMPTY(&ufs_dqfreelist) && ufs_numdquot < MAXQUOTAS * desiredvnodes) ufs_desireddquot += DQUOTINC; if (ufs_numdquot < ufs_desireddquot) { - dq = (struct ufs_dquot *)malloc(sizeof *dq, M_DQUOT, M_WAITOK); + dq = (struct ufs_dquot *)kmalloc(sizeof *dq, M_DQUOT, M_WAITOK); bzero((char *)dq, sizeof *dq); ufs_numdquot++; } else { diff --git a/sys/vfs/ufs/ufs_vnops.c b/sys/vfs/ufs/ufs_vnops.c index c25033060b..b9cae6d406 100644 --- a/sys/vfs/ufs/ufs_vnops.c +++ b/sys/vfs/ufs/ufs_vnops.c @@ -37,7 +37,7 @@ * * @(#)ufs_vnops.c 8.27 (Berkeley) 5/27/95 * $FreeBSD: src/sys/ufs/ufs/ufs_vnops.c,v 1.131.2.8 2003/01/02 17:26:19 bde Exp $ - * $DragonFly: src/sys/vfs/ufs/ufs_vnops.c,v 1.55 2006/08/19 17:27:25 dillon Exp $ + * $DragonFly: src/sys/vfs/ufs/ufs_vnops.c,v 1.56 2006/09/05 00:55:51 dillon Exp $ */ #include "opt_quota.h" @@ -1667,7 +1667,7 @@ ufs_readdir(struct vop_readdir_args *ap) ncookies = uio->uio_resid / 16 + 1; if (ncookies > 1024) ncookies = 1024; - cookies = malloc(ncookies * sizeof(u_long), M_TEMP, M_WAITOK); + cookies = kmalloc(ncookies * sizeof(u_long), M_TEMP, M_WAITOK); } else { ncookies = -1; /* force conditionals below */ cookies = NULL; @@ -1765,7 +1765,7 @@ ufs_readdir(struct vop_readdir_args *ap) */ if (error && cookie_index == 0) { if (cookies) { - free(cookies, M_TEMP); + kfree(cookies, M_TEMP); *ap->a_ncookies = 0; *ap->a_cookies = NULL; } diff --git a/sys/vfs/union/union_subr.c b/sys/vfs/union/union_subr.c index 3146a9c283..59d053a349 100644 --- a/sys/vfs/union/union_subr.c +++ b/sys/vfs/union/union_subr.c @@ -36,7 +36,7 @@ * * @(#)union_subr.c 8.20 (Berkeley) 5/20/95 * $FreeBSD: src/sys/miscfs/union/union_subr.c,v 1.43.2.2 2001/12/25 01:44:45 dillon Exp $ - * $DragonFly: src/sys/vfs/union/union_subr.c,v 1.26 2006/08/12 00:26:22 dillon Exp $ + * $DragonFly: src/sys/vfs/union/union_subr.c,v 1.27 2006/09/05 00:55:51 dillon Exp $ */ #include @@ -178,7 +178,7 @@ union_updatevp(struct union_node *un, struct vnode *uppervp, if (un->un_lowervp) { vrele(un->un_lowervp); if (un->un_path) { - free(un->un_path, M_TEMP); + kfree(un->un_path, M_TEMP); un->un_path = 0; } } @@ -566,7 +566,7 @@ loop: un->un_openl = 0; if (cnp && (lowervp != NULLVP)) { - un->un_path = malloc(cnp->cn_namelen+1, M_TEMP, M_WAITOK); + un->un_path = kmalloc(cnp->cn_namelen+1, M_TEMP, M_WAITOK); bcopy(cnp->cn_nameptr, un->un_path, cnp->cn_namelen); un->un_path[cnp->cn_namelen] = '\0'; } else { @@ -617,10 +617,10 @@ union_freevp(struct vnode *vp) un->un_dirvp = NULL; } if (un->un_path) { - free(un->un_path, M_TEMP); + kfree(un->un_path, M_TEMP); un->un_path = NULL; } - free(un, M_TEMP); + kfree(un, M_TEMP); return (0); } @@ -655,7 +655,7 @@ union_copyfile(struct vnode *fvp, struct vnode *tvp, struct ucred *cred, uio.uio_segflg = UIO_SYSSPACE; uio.uio_offset = 0; - buf = malloc(MAXBSIZE, M_TEMP, M_WAITOK); + buf = kmalloc(MAXBSIZE, M_TEMP, M_WAITOK); /* ugly loop follows... */ do { @@ -704,7 +704,7 @@ union_copyfile(struct vnode *fvp, struct vnode *tvp, struct ucred *cred, uio.uio_offset = offset + bufoffset; } while (error == 0); - free(buf, M_TEMP); + kfree(buf, M_TEMP); return (error); } @@ -1068,7 +1068,7 @@ union_removed_upper(struct union_node *un) if (un->un_dircache != 0) { for (vpp = un->un_dircache; *vpp != NULLVP; vpp++) vrele(*vpp); - free(un->un_dircache, M_TEMP); + kfree(un->un_dircache, M_TEMP); un->un_dircache = 0; } diff --git a/sys/vfs/union/union_vfsops.c b/sys/vfs/union/union_vfsops.c index 4cb7b5b14b..5d264b4097 100644 --- a/sys/vfs/union/union_vfsops.c +++ b/sys/vfs/union/union_vfsops.c @@ -36,7 +36,7 @@ * * @(#)union_vfsops.c 8.20 (Berkeley) 5/20/95 * $FreeBSD: src/sys/miscfs/union/union_vfsops.c,v 1.39.2.2 2001/10/25 19:18:53 dillon Exp $ - * $DragonFly: src/sys/vfs/union/union_vfsops.c,v 1.25 2006/08/12 00:26:22 dillon Exp $ + * $DragonFly: src/sys/vfs/union/union_vfsops.c,v 1.26 2006/09/05 00:55:51 dillon Exp $ */ /* @@ -285,7 +285,7 @@ bad: if (um->um_lowervp) vrele(um->um_lowervp); /* XXX other fields */ - free(um, M_UNIONFSMNT); + kfree(um, M_UNIONFSMNT); } if (cred) crfree(cred); @@ -346,7 +346,7 @@ union_unmount(struct mount *mp, int mntflags) /* * Finally, throw away the union_mount structure */ - free(mp->mnt_data, M_UNIONFSMNT); /* XXX */ + kfree(mp->mnt_data, M_UNIONFSMNT); /* XXX */ mp->mnt_data = 0; return (0); } diff --git a/sys/vfs/union/union_vnops.c b/sys/vfs/union/union_vnops.c index 502d7aab95..79efbc9b91 100644 --- a/sys/vfs/union/union_vnops.c +++ b/sys/vfs/union/union_vnops.c @@ -36,7 +36,7 @@ * * @(#)union_vnops.c 8.32 (Berkeley) 6/23/95 * $FreeBSD: src/sys/miscfs/union/union_vnops.c,v 1.72 1999/12/15 23:02:14 eivind Exp $ - * $DragonFly: src/sys/vfs/union/union_vnops.c,v 1.34 2006/08/19 17:27:25 dillon Exp $ + * $DragonFly: src/sys/vfs/union/union_vnops.c,v 1.35 2006/09/05 00:55:51 dillon Exp $ */ #include @@ -1646,7 +1646,7 @@ union_inactive(struct vop_inactive_args *ap) if (un->un_dircache != 0) { for (vpp = un->un_dircache; *vpp != NULLVP; vpp++) vrele(*vpp); - free (un->un_dircache, M_TEMP); + kfree (un->un_dircache, M_TEMP); un->un_dircache = 0; } diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index 7ef4a9242f..d33e9e8b60 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -96,7 +96,7 @@ * @(#)swap_pager.c 8.9 (Berkeley) 3/21/94 * * $FreeBSD: src/sys/vm/swap_pager.c,v 1.130.2.12 2002/08/31 21:15:55 dillon Exp $ - * $DragonFly: src/sys/vm/swap_pager.c,v 1.24 2006/05/03 20:44:49 dillon Exp $ + * $DragonFly: src/sys/vm/swap_pager.c,v 1.25 2006/09/05 00:55:51 dillon Exp $ */ #include @@ -380,7 +380,7 @@ swap_pager_swap_init(void) for (n = 1; n < n2 / 8; n *= 2) ; - swhash = malloc(sizeof(struct swblock *) * n, M_VMPGDATA, M_WAITOK); + swhash = kmalloc(sizeof(struct swblock *) * n, M_VMPGDATA, M_WAITOK); bzero(swhash, sizeof(struct swblock *) * n); swhash_mask = n - 1; diff --git a/sys/vm/vm_zone.c b/sys/vm/vm_zone.c index 80129c73dc..9d4e048610 100644 --- a/sys/vm/vm_zone.c +++ b/sys/vm/vm_zone.c @@ -12,7 +12,7 @@ * John S. Dyson. * * $FreeBSD: src/sys/vm/vm_zone.c,v 1.30.2.6 2002/10/10 19:50:16 dillon Exp $ - * $DragonFly: src/sys/vm/vm_zone.c,v 1.20 2006/05/21 20:23:29 dillon Exp $ + * $DragonFly: src/sys/vm/vm_zone.c,v 1.21 2006/09/05 00:55:51 dillon Exp $ */ #include @@ -237,13 +237,13 @@ zinit(char *name, int size, int nentries, int flags, int zalloc) { vm_zone_t z; - z = (vm_zone_t) malloc(sizeof (struct vm_zone), M_ZONE, M_NOWAIT); + z = (vm_zone_t) kmalloc(sizeof (struct vm_zone), M_ZONE, M_NOWAIT); if (z == NULL) return NULL; z->zflags = 0; if (zinitna(z, NULL, name, size, nentries, flags, zalloc) == 0) { - free(z, M_ZONE); + kfree(z, M_ZONE); return NULL; } -- 2.41.0