/*
- * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
#include <netinet/ip.h>
#include <netinet/in_pcb.h>
-#include <sys/proc.h>
-#include <sys/mount.h>
-#include <sys/vnode.h>
+#include <sys/event.h>
+#include <sys/eventvar.h>
+
+#include <sys/proc_internal.h>
+#include <sys/mount_internal.h>
+#include <sys/vnode_internal.h>
+#include <sys/ubc_internal.h>
#include <sys/namei.h>
-#include <sys/file.h>
+#include <sys/file_internal.h>
#include <sys/filedesc.h>
#include <sys/tty.h>
#include <sys/quota.h>
+#include <sys/uio_internal.h>
#include <ufs/ufs/inode.h>
#include <isofs/cd9660/cd9660_node.h>
#include <miscfs/volfs/volfs.h>
+#include <miscfs/specfs/specdev.h>
#include <nfs/rpcv2.h>
#include <nfs/nfsproto.h>
#include <nfs/nfsnode.h>
#include <nfs/nfsmount.h>
-#include <nfs/nqnfs.h>
+
+#include <vfs/vfs_journal.h>
#include <mach/mach_types.h>
SOS(ucred), KMZ_CREATEZONE, /* 16 M_CRED */
SOS(pgrp), KMZ_CREATEZONE, /* 17 M_PGRP */
SOS(session), KMZ_CREATEZONE, /* 18 M_SESSION */
- SOS(iovec), KMZ_LOOKUPZONE, /* 19 M_IOV */
+ SOS(iovec_32), KMZ_LOOKUPZONE, /* 19 M_IOV32 */
SOS(mount), KMZ_CREATEZONE, /* 20 M_MOUNT */
0, KMZ_MALLOC, /* 21 M_FHANDLE */
SOS(nfsreq), KMZ_CREATEZONE, /* 22 M_NFSREQ */
0, KMZ_MALLOC, /* 35 M_VMPVENT */
0, KMZ_MALLOC, /* 36 M_VMPAGER */
0, KMZ_MALLOC, /* 37 M_VMPGDATA */
- SOS(file), KMZ_CREATEZONE, /* 38 M_FILE */
+ SOS(fileproc), KMZ_CREATEZONE, /* 38 M_FILEPROC */
SOS(filedesc), KMZ_CREATEZONE, /* 39 M_FILEDESC */
SOX(lockf), KMZ_CREATEZONE, /* 40 M_LOCKF */
SOS(proc), KMZ_CREATEZONE, /* 41 M_PROC */
- SOS(pcred), KMZ_CREATEZONE, /* 42 M_SUBPROC */
+ SOS(pstats), KMZ_CREATEZONE, /* 42 M_SUBPROC */
0, KMZ_MALLOC, /* 43 M_SEGMENT */
M_FFSNODE, KMZ_SHAREZONE, /* 44 M_LFSNODE */
SOS(inode), KMZ_CREATEZONE, /* 45 M_FFSNODE */
M_FFSNODE, KMZ_SHAREZONE, /* 46 M_MFSNODE */
- SOS(nqlease), KMZ_CREATEZONE, /* 47 M_NQLEASE */
- SOS(nqm), KMZ_CREATEZONE, /* 48 M_NQMHOST */
+ 0, KMZ_MALLOC, /* 47 M_NQLEASE */
+ 0, KMZ_MALLOC, /* 48 M_NQMHOST */
0, KMZ_MALLOC, /* 49 M_NETADDR */
SOX(nfssvc_sock),
KMZ_CREATEZONE, /* 50 M_NFSSVC */
0, KMZ_MALLOC, /* 88 M_IP6MISC */
0, KMZ_MALLOC, /* 89 M_TSEGQ */
0, KMZ_MALLOC, /* 90 M_IGMP */
-
+ SOS(journal), KMZ_CREATEZONE, /* 91 M_JNL_JNL */
+ SOS(transaction), KMZ_CREATEZONE, /* 92 M_JNL_TR */
+ SOS(specinfo), KMZ_CREATEZONE, /* 93 M_SPECINFO */
+ SOS(kqueue), KMZ_CREATEZONE, /* 94 M_KQUEUE */
+ SOS(directoryhint), KMZ_CREATEZONE, /* 95 M_HFSDIRHINT */
+ SOS(cl_readahead), KMZ_CREATEZONE, /* 96 M_CLRDAHEAD */
+ SOS(cl_writebehind),KMZ_CREATEZONE, /* 97 M_CLWRBEHIND */
+ SOS(iovec_64), KMZ_LOOKUPZONE, /* 98 M_IOV64 */
+ SOS(fileglob), KMZ_CREATEZONE, /* 99 M_FILEGLOB */
+ 0, KMZ_MALLOC, /* 100 M_KAUTH */
+ 0, KMZ_MALLOC, /* 101 M_DUMMYNET */
+ SOS(unsafe_fsnode),KMZ_CREATEZONE, /* 102 M_UNSAFEFS */
#undef SOS
#undef SOX
};
+extern zone_t kalloc_zone(vm_size_t); /* XXX */
/*
* Initialize the kernel memory allocator
{
struct kmzones *kmz;
+ if ((sizeof(kmzones)/sizeof(kmzones[0])) != (sizeof(memname)/sizeof(memname[0]))) {
+ panic("kmeminit: kmzones has %d elements but memname has %d\n",
+ (sizeof(kmzones)/sizeof(kmzones[0])), (sizeof(memname)/sizeof(memname[0])));
+ }
+
kmz = kmzones;
while (kmz < &kmzones[M_LAST]) {
/* XXX */
char dat[0];
};
-#define ZEROSIZETOKEN 0xFADEDFAD
+#define ZEROSIZETOKEN (void *)0xFADEDFAD
-void *_MALLOC(
+void *
+_MALLOC(
size_t size,
int type,
int flags)
mem->hdr.mlen = memsize;
+ if (flags & M_ZERO)
+ bzero(mem->hdr.dat, size);
+
return (mem->hdr.dat);
}
-void _FREE(
+void
+_FREE(
void *addr,
int type)
{
return; /* correct (convenient bsd kernel legacy) */
hdr = addr; hdr--;
- kfree((vm_offset_t)hdr, hdr->mlen);
+ kfree(hdr, hdr->mlen);
}
-void *_MALLOC_ZONE(
+void *
+_MALLOC_ZONE(
size_t size,
int type,
int flags)
kmz = &kmzones[type];
if (kmz->kz_zalloczone == KMZ_MALLOC)
- panic("_malloc_zone ZONE");
+ panic("_malloc_zone ZONE: type = %d", type);
/* XXX */
if (kmz->kz_elemsize == -1)
return (elem);
}
-void _FREE_ZONE(
+void
+_FREE_ZONE(
void *elem,
size_t size,
int type)
panic("FREE_SIZE XXX");
/* XXX */
if (size == kmz->kz_elemsize)
- zfree(kmz->kz_zalloczone, (vm_offset_t)elem);
+ zfree(kmz->kz_zalloczone, elem);
else
- kfree((vm_offset_t)elem, size);
+ kfree(elem, size);
}