kernel: Use NULL instead of 0 for pointers, part 1/x.
authorSascha Wildner <saw@online.de>
Mon, 10 Sep 2012 21:37:54 +0000 (23:37 +0200)
committerSascha Wildner <saw@online.de>
Mon, 10 Sep 2012 21:39:03 +0000 (23:39 +0200)
Found-with: Coccinelle (http://coccinelle.lip6.fr/)

38 files changed:
sys/bus/firewire/fwohci.c
sys/bus/isa/pnp.c
sys/ddb/db_kld.c
sys/dev/disk/mpt/mpt_pci.c
sys/dev/disk/nata/ata-pci.c
sys/dev/disk/trm/trm.c
sys/dev/netif/cs/if_cs.c
sys/dev/raid/hpt27xx/osm_bsd.c
sys/dev/raid/hptmv/array.h
sys/dev/raid/hptmv/gui_lib.c
sys/dev/raid/hptrr/hptrr_osm_bsd.c
sys/gnu/vfs/ext2fs/ext2_vfsops.c
sys/kern/init_main.c
sys/kern/kern_linker.c
sys/kern/kern_sig.c
sys/kern/link_elf.c
sys/kern/subr_bus.c
sys/kern/tty_pty.c
sys/kern/uipc_mbuf.c
sys/net/ip6fw/ip6_fw.c
sys/netinet6/in6.c
sys/netproto/ipsec/keysock.c
sys/netproto/ipx/ipx_pcb.c
sys/netproto/key/key.c
sys/netproto/key/keysock.c
sys/opencrypto/cryptosoft.c
sys/platform/pc32/i386/machdep.c
sys/platform/pc32/i386/vm_machdep.c
sys/platform/pc64/x86_64/machdep.c
sys/platform/pc64/x86_64/vm_machdep.c
sys/platform/vkernel/i386/vm_machdep.c
sys/platform/vkernel64/x86_64/vm_machdep.c
sys/vfs/fdesc/fdesc_vfsops.c
sys/vfs/hpfs/hpfs_vfsops.c
sys/vfs/msdosfs/msdosfs_vfsops.c
sys/vfs/ntfs/ntfs_vfsops.c
sys/vfs/procfs/procfs_vfsops.c
sys/vfs/ufs/ffs_softdep.c

index 894e41c..794b8a2 100644 (file)
@@ -33,7 +33,6 @@
  * 
  * $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.19 2008/07/18 03:51:28 dillon Exp $
  */
 
 #define ATRQ_CH 0
@@ -1725,7 +1724,7 @@ fwohci_stop(struct fwohci_softc *sc, device_t dev)
                        | OHCI_INT_DMA_ARRQ | OHCI_INT_DMA_ARRS 
                        | OHCI_INT_PHY_BUS_R);
 
-       if (sc->fc.arq !=0 && sc->fc.arq->maxq > 0)
+       if (sc->fc.arq != NULL && sc->fc.arq->maxq > 0)
                fw_drain_txq(&sc->fc);
 
 /* XXX Link down?  Bus reset? */
@@ -2528,7 +2527,7 @@ fwohci_add_tx_buf(struct fwohci_dbch *dbch, struct fwohcidb_tr *db_tr,
        int err = 0;
 
        it = &dbch->xferq;
-       if(it->buf == 0){
+       if(it->buf == NULL) {
                err = EINVAL;
                return err;
        }
index 566e0af..e7a1844 100644 (file)
@@ -442,7 +442,7 @@ pnp_create_devices(device_t parent, pnp_id *p, int csn,
        u_char tag, *resp, *resinfo, *startres = NULL;
        int large_len, scanning = len, retval = FALSE;
        u_int32_t logical_id;
-       device_t dev = 0;
+       device_t dev = NULL;
        int ldn = 0;
        struct pnp_set_config_arg *csnldn;
        char buf[100];
@@ -507,7 +507,7 @@ pnp_create_devices(device_t parent, pnp_id *p, int csn,
                        if (startres) {
                                pnp_parse_resources(dev, startres,
                                            resinfo - startres - 1, ldn);
-                               dev = 0;
+                               dev = NULL;
                                startres = NULL;
                        }
 
@@ -542,7 +542,7 @@ pnp_create_devices(device_t parent, pnp_id *p, int csn,
                        }
                        pnp_parse_resources(dev, startres,
                                            resinfo - startres - 1, ldn);
-                       dev = 0;
+                       dev = NULL;
                        startres = NULL;
                        scanning = 0;
                        break;
index 7b98786..65a2659 100644 (file)
@@ -24,7 +24,6 @@
  * rights to redistribute these changes.
  *
  * $FreeBSD: src/sys/ddb/db_kld.c,v 1.9 2000/01/11 13:25:12 peter Exp $
- * $DragonFly: src/sys/ddb/db_kld.c,v 1.5 2008/07/23 16:39:32 dillon Exp $
  *     from db_aout.c,v 1.20 1998/06/07 17:09:36 dfr Exp
  */
 
@@ -88,7 +87,7 @@ X_db_symbol_values(db_symtab_t *symtab, c_db_sym_t dbsym, const char **namep,
        linker_symval_t symval;
 
        symval.name = NULL;
-       symval.value = 0;
+       symval.value = NULL;
        linker_ddb_symbol_values(sym, &symval);
        if (namep)
            *namep = (const char*) symval.name;
index ae8f8ca..fe123eb 100644 (file)
@@ -760,7 +760,7 @@ mpt_dma_mem_free(struct mpt_softc *mpt)
 {
 
         /* Make sure we aren't double destroying */
-        if (mpt->reply_dmat == 0) {
+        if (mpt->reply_dmat == NULL) {
                mpt_lprt(mpt, MPT_PRT_DEBUG, "already released dma memory\n");
                return;
         }
index 697c42a..2d79536 100644 (file)
@@ -276,15 +276,15 @@ ata_pci_detach(device_t dev)
     if (ctlr->r_irq) {
        bus_teardown_intr(dev, ctlr->r_irq, ctlr->handle);
        bus_release_resource(dev, SYS_RES_IRQ, ATA_IRQ_RID, ctlr->r_irq);
-       ctlr->r_irq = 0;
+       ctlr->r_irq = NULL;
     }
     if (ctlr->r_res2) {
        bus_release_resource(dev, ctlr->r_type2, ctlr->r_rid2, ctlr->r_res2);
-       ctlr->r_res2 = 0;
+       ctlr->r_res2 = NULL;
     }
     if (ctlr->r_res1) {
        bus_release_resource(dev, ctlr->r_type1, ctlr->r_rid1, ctlr->r_res1);
-       ctlr->r_res1 = 0;
+       ctlr->r_res1 = NULL;
     }
 
     return 0;
index d3e72e5..464df3e 100644 (file)
@@ -2351,7 +2351,7 @@ trm_Disconnect(PACB pACB)
        target_id  = pSRB->pccb->ccb_h.target_id;
        target_lun = pSRB->pccb->ccb_h.target_lun;
        TRM_DPRINTF(":pDCB->pActiveSRB= %8x \n ",(u_int) pDCB->pActiveSRB);
-       pACB->pActiveDCB = 0;
+       pACB->pActiveDCB = NULL;
        pSRB->ScsiPhase = PH_BUS_FREE; 
        /* SCSI bus free Phase */
        trm_reg_write16((DO_CLRFIFO | DO_HWRESELECT), TRMREG_SCSI_CONTROL);
@@ -2369,7 +2369,7 @@ trm_Disconnect(PACB pACB)
                        pACB->pFreeSRB = pSRB;
                        pSRB = psrb;
                }
-               pDCB->pGoingSRB = 0;
+               pDCB->pGoingSRB = NULL;
                trm_DoWaitingSRB(pACB);
        } else {
                if ((pSRB->SRBState & (SRB_START_+SRB_MSGOUT)) || 
@@ -2394,7 +2394,7 @@ disc1:
                  /*
                   * SRB_COMPLETED
                   */
-                       pDCB->pActiveSRB = 0;
+                       pDCB->pActiveSRB = NULL;
                        pSRB->SRBState = SRB_FREE;
                        trm_SRBdone(pACB, pDCB, pSRB);
                }
@@ -2885,7 +2885,7 @@ trm_initDCB(PACB pACB, PDCB pDCB, u_int16_t unit,u_int32_t i,u_int32_t j)
                bcopy(&pACB->DCBarray[target_id][0], pDCB,
                    sizeof(TRM_DCB));
        crit_enter();
-       if (pACB->pLinkDCB == 0) {
+       if (pACB->pLinkDCB == NULL) {
                pACB->pLinkDCB = pDCB;
                /* 
                 * RunRobin impersonate the role 
@@ -3547,7 +3547,7 @@ trm_attach(device_t dev)
 {
        struct  cam_devq *device_Q;
        u_long  device_id;
-       PACB    pACB = 0;
+       PACB    pACB = NULL;
        int     rid = 0;
        int unit = device_get_unit(dev);
        
index 0c94869..1a13b40 100644 (file)
@@ -569,17 +569,17 @@ cs_release_resources(device_t dev)
         if (sc->port_res) {
                 bus_release_resource(dev, SYS_RES_IOPORT,
                                      sc->port_rid, sc->port_res);
-                sc->port_res = 0;
+                sc->port_res = NULL;
         }
         if (sc->mem_res) {
                 bus_release_resource(dev, SYS_RES_MEMORY,
                                      sc->mem_rid, sc->mem_res);
-                sc->mem_res = 0;
+                sc->mem_res = NULL;
         }
         if (sc->irq_res) {
                 bus_release_resource(dev, SYS_RES_IRQ,
                                      sc->irq_rid, sc->irq_res);
-                sc->irq_res = 0;
+                sc->irq_res = NULL;
         }
 }
 
index b266ef9..a70f9ef 100644 (file)
@@ -337,7 +337,7 @@ static void hpt_shutdown_vbus(PVBUS_EXT vbus_ext, int howto)
 
        /* stop all ctl tasks and disable the worker taskqueue */
        hpt_stop_tasks(vbus_ext);
-       vbus_ext->worker.ta_context = 0;
+       vbus_ext->worker.ta_context = NULL;
 
        /* flush devices */
        for (i=0; i<osm_max_targets; i++) {
@@ -374,12 +374,12 @@ static void __hpt_do_tasks(PVBUS_EXT vbus_ext)
        OSM_TASK *tasks;
 
        tasks = vbus_ext->tasks;
-       vbus_ext->tasks = 0;
+       vbus_ext->tasks = NULL;
 
        while (tasks) {
                OSM_TASK *t = tasks;
                tasks = t->next;
-               t->next = 0;
+               t->next = NULL;
                t->func(vbus_ext->vbus, t->data);
        }
 }
@@ -864,7 +864,7 @@ static int hpt_detach(device_t dev)
 
 static void hpt_ioctl_done(struct _IOCTL_ARG *arg)
 {
-       arg->ioctl_cmnd = 0;
+       arg->ioctl_cmnd = NULL;
        wakeup(arg);
 }
 
@@ -908,7 +908,7 @@ static void hpt_do_ioctl(IOCTL_ARG *ioctl_args)
        arg.lpOutBuffer = outbuf;\
        arg.nInBufferSize = insize;\
        arg.nOutBufferSize = outsize;\
-       arg.lpBytesReturned = 0;\
+       arg.lpBytesReturned = NULL;\
        hpt_do_ioctl(&arg);\
        arg.result;\
 })
index 126e3f8..58ae56e 100644 (file)
@@ -242,7 +242,7 @@ void HPTLIBAPI fFixRAID01Stripe(_VBUS_ARG PVDevice pStripe);
 #endif
 
 #define mArGetArrayTable(pVArray) \
-       if((pVArray = _vbus_(pFreeArrayLink)) != 0) { \
+       if((pVArray = _vbus_(pFreeArrayLink)) != NULL) { \
        _vbus_(pFreeArrayLink) = (PVDevice)_vbus_(pFreeArrayLink)->pVBus; \
        ZeroMemory(pVArray, ARRAY_VDEV_SIZE); \
                _SET_ARRAY_BUS_(pVArray) \
index da1dc1f..93513fd 100644 (file)
@@ -943,7 +943,7 @@ int hpt_add_disk_to_array(_VBUS_ARG DEVICEID idArray, DEVICEID idDisk)
        if (pArray->pVBus!=_vbus_p) { HPT_ASSERT(0); return -1;}
 
        for(i = 0; i < pArray->u.array.bArnMember; i++)
-               if((pArray->u.array.pMember[i] == 0) || !pArray->u.array.pMember[i]->vf_online)
+               if((pArray->u.array.pMember[i] == NULL) || !pArray->u.array.pMember[i]->vf_online)
                {
                        if(pArray->u.array.pMember[i] != NULL)
                                pArray->u.array.pMember[i]->pParent = NULL;
@@ -1311,7 +1311,7 @@ int hpt_default_ioctl(_VBUS_ARG
 
                        if (nInBufferSize!=sizeof(DEVICEID)) return -1;
                        id = *(DEVICEID *)lpInBuffer;
-                       while(pAdapter != 0)
+                       while(pAdapter != NULL)
                        {
                                pVBus = &pAdapter->VBus;
                                for(i = 0; i < MAX_VDEVICE_PER_VBUS; i++)
index cbfb5f6..ec319c4 100644 (file)
@@ -344,7 +344,7 @@ static void hpt_shutdown_vbus(PVBUS_EXT vbus_ext, int howto)
 
        /* stop all ctl tasks and disable the worker taskqueue */
        hpt_stop_tasks(vbus_ext);
-       vbus_ext->worker.ta_context = 0;
+       vbus_ext->worker.ta_context = NULL;
 
        /* flush devices */
        for (i=0; i<osm_max_targets; i++) {
@@ -381,12 +381,12 @@ static void __hpt_do_tasks(PVBUS_EXT vbus_ext)
        OSM_TASK *tasks;
 
        tasks = vbus_ext->tasks;
-       vbus_ext->tasks = 0;
+       vbus_ext->tasks = NULL;
 
        while (tasks) {
                OSM_TASK *t = tasks;
                tasks = t->next;
-               t->next = 0;
+               t->next = NULL;
                t->func(vbus_ext->vbus, t->data);
        }
 }
@@ -866,7 +866,7 @@ static int hpt_detach(device_t dev)
 
 static void hpt_ioctl_done(struct _IOCTL_ARG *arg)
 {
-       arg->ioctl_cmnd = 0;
+       arg->ioctl_cmnd = NULL;
        wakeup(arg);
 }
 
@@ -910,7 +910,7 @@ static void hpt_do_ioctl(IOCTL_ARG *ioctl_args)
        arg.lpOutBuffer = outbuf;\
        arg.nInBufferSize = insize;\
        arg.nOutBufferSize = outsize;\
-       arg.lpBytesReturned = 0;\
+       arg.lpBytesReturned = NULL;\
        hpt_do_ioctl(&arg);\
        arg.result;\
 })
@@ -963,7 +963,7 @@ static int __hpt_stop_tasks(PVBUS_EXT vbus_ext, DEVICEID id)
 
        KdPrint(("SET_ARRAY_STATE(%x, %d)", param[0], param[1]));
        result = HPT_DO_IOCTL(HPT_IOCTL_SET_ARRAY_STATE,
-                               param, sizeof(param), 0, 0);
+                               param, sizeof(param), NULL, 0);
 
        for (i=0; i<devinfo.u.array.nDisk; i++)
                if (DEVICEID_VALID(devinfo.u.array.Members[i]))
index 5b264de..d8e1e0a 100644 (file)
@@ -355,7 +355,7 @@ ext2_mount(struct mount *mp, char *path, caddr_t data, struct ucred *cred)
                        VOP_CLOSE(devvp, FREAD);
                        vn_unlock(devvp);
                }
-               if (args.fspec == 0) {
+               if (args.fspec == NULL) {
                        /*
                         * Process export requests.
                         */
index 7b0b488..e6951bb 100644 (file)
@@ -400,7 +400,7 @@ proc0_init(void *dummy __unused)
        p->p_rtprio.prio = 0;
        lp->lwp_rtprio = p->p_rtprio;
 
-       p->p_peers = 0;
+       p->p_peers = NULL;
        p->p_leader = p;
 
        bcopy("swapper", p->p_comm, sizeof ("swapper"));
index 9fb83c8..d49d495 100644 (file)
@@ -371,7 +371,7 @@ out:
 linker_file_t
 linker_find_file_by_name(const char* filename)
 {
-    linker_file_t lf = 0;
+    linker_file_t lf = NULL;
     char *koname;
     int i;
 
@@ -399,7 +399,7 @@ linker_find_file_by_name(const char* filename)
 linker_file_t
 linker_find_file_by_id(int fileid)
 {
-    linker_file_t lf = 0;
+    linker_file_t lf = NULL;
 
     lockmgr(&lock, LK_SHARED);
     TAILQ_FOREACH(lf, &linker_files, link)
@@ -429,7 +429,7 @@ linker_file_foreach(linker_predicate_t *predicate, void *context)
 linker_file_t
 linker_make_file(const char* pathname, void* priv, struct linker_file_ops* ops)
 {
-    linker_file_t lf = 0;
+    linker_file_t lf = NULL;
     const char *filename;
 
     filename = rindex(pathname, '/');
@@ -602,7 +602,7 @@ linker_file_lookup_symbol(linker_file_t file, const char* name, int deps, caddr_
         * XXX Assume a common symbol if its value is 0 and it has a non-zero
         * size, otherwise it could be an absolute symbol with a value of 0.
         */
-       if (symval.value == 0 && symval.size != 0) {
+       if (symval.value == NULL && symval.size != 0) {
            /*
             * For commons, first look them up in the dependancies and
             * only allocate space if not found there.
@@ -718,12 +718,12 @@ linker_ddb_search_symbol(caddr_t value, c_linker_sym_t *sym, long *diffp)
     c_linker_sym_t best;
     c_linker_sym_t es;
 
-    best = 0;
+    best = NULL;
     bestdiff = off;
     TAILQ_FOREACH(lf, &linker_files, link) {
        if (lf->ops->search_symbol(lf, value, &es, &diff) != 0)
            continue;
-       if (es != 0 && diff < bestdiff) {
+       if (es != NULL && diff < bestdiff) {
            best = es;
            bestdiff = diff;
        }
@@ -735,7 +735,7 @@ linker_ddb_search_symbol(caddr_t value, c_linker_sym_t *sym, long *diffp)
        *diffp = bestdiff;
        return 0;
     } else {
-       *sym = 0;
+       *sym = NULL;
        *diffp = off;
        return ENOENT;
     }
index 042dfdd..ae88060 100644 (file)
@@ -432,7 +432,7 @@ execsigs(struct proc *p)
         */
        lp->lwp_sigstk.ss_flags = SS_DISABLE;
        lp->lwp_sigstk.ss_size = 0;
-       lp->lwp_sigstk.ss_sp = 0;
+       lp->lwp_sigstk.ss_sp = NULL;
        lp->lwp_flags &= ~LWP_ALTSTACK;
        /*
         * Reset no zombies if child dies flag as Solaris does.
index 093873c..1b52d68 100644 (file)
@@ -149,9 +149,9 @@ link_elf_init(void* arg)
     dp = (Elf_Dyn*) &_DYNAMIC;
     if (dp) {
        ef = kmalloc(sizeof(struct elf_file), M_LINKER, M_INTWAIT | M_ZERO);
-       ef->address = 0;
+       ef->address = NULL;
 #ifdef SPARSE_MAPPING
-       ef->object = 0;
+       ef->object = NULL;
 #endif
        ef->dynamic = dp;
        modname = NULL;
@@ -363,7 +363,7 @@ link_elf_preload_file(const char *filename, linker_file_t *result)
     ef->modptr = modptr;
     ef->address = *(caddr_t *)baseptr;
 #ifdef SPARSE_MAPPING
-    ef->object = 0;
+    ef->object = NULL;
 #endif
     dp = (vm_offset_t)ef->address + *(vm_offset_t *)dynptr;
     ef->dynamic = (Elf_Dyn *)dp;
@@ -1016,7 +1016,7 @@ link_elf_lookup_set(linker_file_t lf, const char *name,
     if (error)
        goto out;
     link_elf_symbol_values(lf, sym, &symval);
-    if (symval.value == 0) {
+    if (symval.value == NULL) {
        error = ESRCH;
        goto out;
     }
@@ -1028,7 +1028,7 @@ link_elf_lookup_set(linker_file_t lf, const char *name,
     if (error)
        goto out;
     link_elf_symbol_values(lf, sym, &symval);
-    if (symval.value == 0) {
+    if (symval.value == NULL) {
        error = ESRCH;
        goto out;
     }
index 3a86ccf..9f69e7e 100644 (file)
@@ -1203,10 +1203,10 @@ static int
 device_probe_child(device_t dev, device_t child)
 {
        devclass_t dc;
-       driverlink_t best = 0;
+       driverlink_t best = NULL;
        driverlink_t dl;
        int result, pri = 0;
-       int hasclass = (child->devclass != 0);
+       int hasclass = (child->devclass != NULL);
 
        dc = dev->devclass;
        if (!dc)
@@ -1250,7 +1250,7 @@ device_probe_child(device_t dev, device_t child)
                         * best matching driver. Initialise the value
                         * of pri for the first match.
                         */
-                       if (best == 0 || result > pri) {
+                       if (best == NULL || result > pri) {
                                best = dl;
                                pri = result;
                                continue;
@@ -1369,7 +1369,7 @@ device_print_prettyname(device_t dev)
 {
        const char *name = device_get_name(dev);
 
-       if (name == 0)
+       if (name == NULL)
                return kprintf("unknown: ");
        else
                return kprintf("%s%d: ", name, device_get_unit(dev));
@@ -1704,7 +1704,7 @@ static int
 device_doattach(device_t dev)
 {
        device_t bus = dev->parent;
-       int hasclass = (dev->devclass != 0);
+       int hasclass = (dev->devclass != NULL);
        int error;
 
        error = DEVICE_ATTACH(dev);
@@ -2837,7 +2837,7 @@ struct resource *
 bus_alloc_resource(device_t dev, int type, int *rid, u_long start, u_long end,
                   u_long count, u_int flags)
 {
-       if (dev->parent == 0)
+       if (dev->parent == NULL)
                return(0);
        return(BUS_ALLOC_RESOURCE(dev->parent, dev, type, rid, start, end,
                                  count, flags, -1));
@@ -2846,7 +2846,7 @@ bus_alloc_resource(device_t dev, int type, int *rid, u_long start, u_long end,
 struct resource *
 bus_alloc_legacy_irq_resource(device_t dev, int *rid, u_long irq, u_int flags)
 {
-       if (dev->parent == 0)
+       if (dev->parent == NULL)
                return(0);
        return BUS_ALLOC_RESOURCE(dev->parent, dev, SYS_RES_IRQ, rid,
            irq, irq, 1, flags, machintr_legacy_intr_cpuid(irq));
@@ -2855,7 +2855,7 @@ bus_alloc_legacy_irq_resource(device_t dev, int *rid, u_long irq, u_int flags)
 int
 bus_activate_resource(device_t dev, int type, int rid, struct resource *r)
 {
-       if (dev->parent == 0)
+       if (dev->parent == NULL)
                return(EINVAL);
        return(BUS_ACTIVATE_RESOURCE(dev->parent, dev, type, rid, r));
 }
@@ -2863,7 +2863,7 @@ bus_activate_resource(device_t dev, int type, int rid, struct resource *r)
 int
 bus_deactivate_resource(device_t dev, int type, int rid, struct resource *r)
 {
-       if (dev->parent == 0)
+       if (dev->parent == NULL)
                return(EINVAL);
        return(BUS_DEACTIVATE_RESOURCE(dev->parent, dev, type, rid, r));
 }
@@ -2871,7 +2871,7 @@ bus_deactivate_resource(device_t dev, int type, int rid, struct resource *r)
 int
 bus_release_resource(device_t dev, int type, int rid, struct resource *r)
 {
-       if (dev->parent == 0)
+       if (dev->parent == NULL)
                return(EINVAL);
        return(BUS_RELEASE_RESOURCE(dev->parent, dev, type, rid, r));
 }
@@ -2881,7 +2881,7 @@ bus_setup_intr_descr(device_t dev, struct resource *r, int flags,
     driver_intr_t handler, void *arg, void **cookiep,
     lwkt_serialize_t serializer, const char *desc)
 {
-       if (dev->parent == 0)
+       if (dev->parent == NULL)
                return EINVAL;
        return BUS_SETUP_INTR(dev->parent, dev, r, flags, handler, arg,
            cookiep, serializer, desc);
@@ -2899,7 +2899,7 @@ bus_setup_intr(device_t dev, struct resource *r, int flags,
 int
 bus_teardown_intr(device_t dev, struct resource *r, void *cookie)
 {
-       if (dev->parent == 0)
+       if (dev->parent == NULL)
                return(EINVAL);
        return(BUS_TEARDOWN_INTR(dev->parent, dev, r, cookie));
 }
index 8200e8b..b8966f8 100644 (file)
@@ -548,7 +548,7 @@ ptswrite(struct dev_write_args *ap)
 
        lwkt_gettoken(&tty_token);
        tp = dev->si_tty;
-       if (tp->t_oproc == 0) {
+       if (tp->t_oproc == NULL) {
                lwkt_reltoken(&tty_token);
                return (EIO);
        }
index bd642af..68078e6 100644 (file)
@@ -1953,7 +1953,7 @@ m_split(struct mbuf *m0, int len0, int wait)
                        MH_ALIGN(n, remain);
        } else if (remain == 0) {
                n = m->m_next;
-               m->m_next = 0;
+               m->m_next = NULL;
                return (n);
        } else {
                n = m_get(wait, m->m_type);
@@ -1974,7 +1974,7 @@ extpacket:
        n->m_len = remain;
        m->m_len = len;
        n->m_next = m->m_next;
-       m->m_next = 0;
+       m->m_next = NULL;
        return (n);
 }
 
index 7030e01..9dd63cb 100644 (file)
@@ -600,7 +600,7 @@ ip6_fw_chk(struct ip6_hdr **pip6,
 
 #define PULLUP_TO(len) do {                                            \
                            if ((*m)->m_len < (len)                     \
-                               && (*m = m_pullup(*m, (len))) == 0) {   \
+                               && (*m = m_pullup(*m, (len))) == NULL) {\
                                    goto dropit;                        \
                            }                                           \
                            *pip6 = ip6 = mtod(*m, struct ip6_hdr *);   \
index 0da3b45..2a629b5 100644 (file)
@@ -794,7 +794,7 @@ purgeaddr:
        }
 
        default:
-               if (ifp == NULL || ifp->if_ioctl == 0)
+               if (ifp == NULL || ifp->if_ioctl == NULL)
                        return (EOPNOTSUPP);
                ifnet_serialize_all(ifp);
                error = ifp->if_ioctl(ifp, cmd, data, td->td_proc->p_ucred);
@@ -1708,7 +1708,7 @@ in6_addmulti(struct in6_addr *maddr6, struct ifnet *ifp, int *errorp)
         * If ifma->ifma_protospec is null, then if_addmulti() created
         * a new record.  Otherwise, we are done.
         */
-       if (ifma->ifma_protospec != 0) {
+       if (ifma->ifma_protospec != NULL) {
                crit_exit();
                return ifma->ifma_protospec;
        }
@@ -1753,7 +1753,7 @@ in6_delmulti(struct in6_multi *in6m)
                 * that we are leaving the multicast group.
                 */
                mld6_stop_listening(in6m);
-               ifma->ifma_protospec = 0;
+               ifma->ifma_protospec = NULL;
                LIST_REMOVE(in6m, in6m_entry);
                kfree(in6m, M_IPMADDR);
        }
index b292ec9..161715b 100644 (file)
@@ -369,7 +369,7 @@ key_attach(struct socket *so, int proto, struct pru_attach_info *ai)
        struct keycb *kp;
        int error;
 
-       if (sotorawcb(so) != 0)
+       if (sotorawcb(so) != NULL)
                return EISCONN; /* XXX panic? */
        kp = (struct keycb *)kmalloc(sizeof *kp, M_PCB, M_WAITOK|M_ZERO); /* XXX */
 
index 72561fe..ba96ff9 100644 (file)
@@ -87,7 +87,7 @@ ipx_pcbbind(struct ipxpcb *ipxp, struct sockaddr *nam, struct thread *td)
                int tport = sipx->sipx_port;
 
                sipx->sipx_port = 0;            /* yech... */
-               if (ifa_ifwithaddr((struct sockaddr *)sipx) == 0)
+               if (ifa_ifwithaddr((struct sockaddr *)sipx) == NULL)
                        return (EADDRNOTAVAIL);
                sipx->sipx_port = tport;
        }
index 0df6879..e361bd6 100644 (file)
@@ -3038,7 +3038,7 @@ key_setsaval(struct secasvar *sav, struct mbuf *m,
                if (sav->ivlen == 0)
                        break;
                KMALLOC(sav->iv, caddr_t, sav->ivlen);
-               if (sav->iv == 0) {
+               if (sav->iv == NULL) {
                        ipseclog((LOG_DEBUG, "key_setsaval: No more memory.\n"));
                        error = ENOBUFS;
                        goto fail;
index c65d971..e3f21ee 100644 (file)
@@ -396,7 +396,7 @@ key_attach(netmsg_t msg)
        struct netmsg_pru_attach smsg;
        int error;
 
-       if (sotorawcb(so) != 0) {
+       if (sotorawcb(so) != NULL) {
                error = EISCONN;        /* XXX panic? */
                goto out;
        }
index 7439a7c..e274486 100644 (file)
@@ -540,7 +540,7 @@ swcr_authcompute(struct cryptodesc *crd, struct swcr_data *sw, caddr_t buf,
        union authctx ctx;
        int err;
 
-       if (sw->sw_ictx == 0)
+       if (sw->sw_ictx == NULL)
                return EINVAL;
 
        axf = sw->sw_axf;
@@ -638,7 +638,7 @@ swcr_combined(struct cryptop *crp)
                        swa = sw;
                        crda = crd;
                        axf = swa->sw_axf;
-                       if (swa->sw_ictx == 0)
+                       if (swa->sw_ictx == NULL)
                                return (EINVAL);
                        bcopy(swa->sw_ictx, &ctx, axf->ctxsize);
                        blksz = axf->blocksize;
index 1bf261c..c402678 100644 (file)
@@ -2172,7 +2172,7 @@ init386(int first)
        /* setup proc 0's pcb */
        thread0.td_pcb->pcb_flags = 0;
        thread0.td_pcb->pcb_cr3 = (int)IdlePTD; /* should already be setup */
-       thread0.td_pcb->pcb_ext = 0;
+       thread0.td_pcb->pcb_ext = NULL;
        lwp0.lwp_md.md_regs = &proc0_tf;
 }
 
index 0247441..98b3583 100644 (file)
@@ -178,10 +178,10 @@ cpu_fork(struct lwp *lp1, struct lwp *lp2, int flags)
        /*
         * XXX don't copy the i/o pages.  this should probably be fixed.
         */
-       pcb2->pcb_ext = 0;
+       pcb2->pcb_ext = NULL;
 
         /* Copy the LDT, if necessary. */
-        if (pcb2->pcb_ldt != 0) {
+        if (pcb2->pcb_ldt != NULL) {
                if (flags & RFMEM) {
                        pcb2->pcb_ldt->ldt_refcnt++;
                } else {
index 176035d..0916cd1 100644 (file)
@@ -1984,7 +1984,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree)
        /* setup proc 0's pcb */
        thread0.td_pcb->pcb_flags = 0;
        thread0.td_pcb->pcb_cr3 = KPML4phys;
-       thread0.td_pcb->pcb_ext = 0;
+       thread0.td_pcb->pcb_ext = NULL;
        lwp0.lwp_md.md_regs = &proc0_tf;        /* XXX needed? */
 
        /* Location of kernel stack for locore */
index b2109a9..c41d295 100644 (file)
@@ -164,10 +164,10 @@ cpu_fork(struct lwp *lp1, struct lwp *lp2, int flags)
        /*
         * XXX don't copy the i/o pages.  this should probably be fixed.
         */
-       pcb2->pcb_ext = 0;
+       pcb2->pcb_ext = NULL;
 
         /* Copy the LDT, if necessary. */
-        if (pcb2->pcb_ldt != 0) {
+        if (pcb2->pcb_ldt != NULL) {
                if (flags & RFMEM) {
                        pcb2->pcb_ldt->ldt_refcnt++;
                } else {
index 7526024..31776cd 100644 (file)
@@ -179,10 +179,10 @@ cpu_fork(struct lwp *lp1, struct lwp *lp2, int flags)
        /*
         * XXX don't copy the i/o pages.  this should probably be fixed.
         */
-       pcb2->pcb_ext = 0;
+       pcb2->pcb_ext = NULL;
 
         /* Copy the LDT, if necessary. */
-        if (pcb2->pcb_ldt != 0) {
+        if (pcb2->pcb_ldt != NULL) {
                if (flags & RFMEM) {
                        pcb2->pcb_ldt->ldt_refcnt++;
                } else {
index 9d83952..95929da 100644 (file)
@@ -165,10 +165,10 @@ cpu_fork(struct lwp *lp1, struct lwp *lp2, int flags)
        /*
         * XXX don't copy the i/o pages.  this should probably be fixed.
         */
-       pcb2->pcb_ext = 0;
+       pcb2->pcb_ext = NULL;
 
         /* Copy the LDT, if necessary. */
-        if (pcb2->pcb_ldt != 0) {
+        if (pcb2->pcb_ldt != NULL) {
                if (flags & RFMEM) {
                        pcb2->pcb_ldt->ldt_refcnt++;
                } else {
index c9d48b7..c496418 100644 (file)
@@ -130,7 +130,7 @@ fdesc_unmount(struct mount *mp, int mntflags)
         * Finally, throw away the fdescmount structure
         */
        kfree(mp->mnt_data, M_FDESCMNT);        /* XXX */
-       mp->mnt_data = 0;
+       mp->mnt_data = NULL;
 
        return (0);
 }
index e77e432..0c0dffc 100644 (file)
@@ -144,7 +144,7 @@ hpfs_mount(struct mount *mp, char *path, caddr_t data, struct ucred *cred)
 
                hpmp = VFSTOHPFS(mp);
 
-               if (args.fspec == 0) {
+               if (args.fspec == NULL) {
                        dprintf(("export 0x%x\n",args.export.ex_flags));
                        error = vfs_export(mp, &hpmp->hpm_export, &args.export);
                        if (error) {
index 1df2bbd..4acaf67 100644 (file)
@@ -1,5 +1,4 @@
 /* $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.52 2008/09/17 21:44:24 dillon Exp $ */
 /*     $NetBSD: msdosfs_vfsops.c,v 1.51 1997/11/17 15:36:58 ws Exp $   */
 
 /*-
@@ -226,7 +225,7 @@ msdosfs_mount(struct mount *mp, char *path, caddr_t data, struct ucred *cred)
                        vn_unlock(devvp);
                        pmp->pm_flags &= ~MSDOSFSMNT_RONLY;
                }
-               if (args.fspec == 0) {
+               if (args.fspec == NULL) {
 #ifdef __notyet__              /* doesn't work correctly with current mountd   XXX */
                        if (args.flags & MSDOSFSMNT_MNTOPT) {
                                pmp->pm_flags &= ~MSDOSFSMNT_MNTOPT;
index 5935b85..8384e8d 100644 (file)
@@ -275,7 +275,7 @@ ntfs_mount(struct mount *mp, char *path, caddr_t data, struct ucred *cred)
         */
        if (mp->mnt_flag & MNT_UPDATE) {
                /* if not updating name...*/
-               if (args.fspec == 0) {
+               if (args.fspec == NULL) {
                        /*
                         * Process export requests.  Jumping to "success"
                         * will return the vfs_export() error code.
index d0ec8f0..484c5d5 100644 (file)
@@ -37,7 +37,6 @@
  *     @(#)procfs_vfsops.c     8.7 (Berkeley) 5/10/95
  *
  * $FreeBSD: src/sys/miscfs/procfs/procfs_vfsops.c,v 1.32.2.1 2001/10/15 20:42:01 des Exp $
- * $DragonFly: src/sys/vfs/procfs/procfs_vfsops.c,v 1.17 2007/09/03 17:06:24 dillon Exp $
  */
 
 /*
@@ -82,7 +81,7 @@ procfs_mount(struct mount *mp, char *path, caddr_t data, struct ucred *cred)
 
        mp->mnt_flag |= MNT_LOCAL;
        mp->mnt_kern_flag |= MNTK_NOSTKMNT;
-       mp->mnt_data = 0;
+       mp->mnt_data = NULL;
        vfs_getnewfsid(mp);
 
        size = sizeof("procfs") - 1;
index 91c0506..b6a8cbf 100644 (file)
@@ -3360,7 +3360,7 @@ softdep_disk_write_complete(struct buf *bp)
                        }
                        bcopy(indirdep->ir_saveddata, bp->b_data, bp->b_bcount);
                        kfree(indirdep->ir_saveddata, M_INDIRDEP);
-                       indirdep->ir_saveddata = 0;
+                       indirdep->ir_saveddata = NULL;
                        indirdep->ir_state &= ~UNDONE;
                        indirdep->ir_state |= ATTACHED;
                        while ((aip = LIST_FIRST(&indirdep->ir_donehd)) != NULL) {
@@ -3651,7 +3651,7 @@ handle_written_inodeblock(struct inodedep *inodedep, struct buf *bp)
        /*
         * If no outstanding dependencies, free it.
         */
-       if (free_inodedep(inodedep) || TAILQ_FIRST(&inodedep->id_inoupdt) == 0)
+       if (free_inodedep(inodedep) || TAILQ_FIRST(&inodedep->id_inoupdt) == NULL)
                return (0);
        return (hadchanges);
 }
@@ -3783,7 +3783,7 @@ handle_written_filepage(struct pagedep *pagedep, struct buf *bp)
         * Otherwise it will remain to update the page before it
         * is written back to disk.
         */
-       if (LIST_FIRST(&pagedep->pd_pendinghd) == 0) {
+       if (LIST_FIRST(&pagedep->pd_pendinghd) == NULL) {
                for (i = 0; i < DAHASHSZ; i++)
                        if (LIST_FIRST(&pagedep->pd_diraddhd[i]) != NULL)
                                break;
@@ -4350,7 +4350,7 @@ softdep_sync_metadata_bp(struct buf *bp, void *data)
                         */
                        pagedep = WK_PAGEDEP(wk);
                        for (i = 0; i < DAHASHSZ; i++) {
-                               if (LIST_FIRST(&pagedep->pd_diraddhd[i]) == 0)
+                               if (LIST_FIRST(&pagedep->pd_diraddhd[i]) == NULL)
                                        continue;
                                if ((error =
                                    flush_pagedep_deps(info->vp,