本文整理汇总了C++中simple_lock_init函数的典型用法代码示例。如果您正苦于以下问题:C++ simple_lock_init函数的具体用法?C++ simple_lock_init怎么用?C++ simple_lock_init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了simple_lock_init函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: hypcninit
int hypcninit(struct consdev *cp)
{
if (console)
return 0;
simple_lock_init(&outlock);
simple_lock_init(&inlock);
console = (void*) mfn_to_kv(boot_info.console_mfn);
pmap_set_page_readwrite(console);
hyp_evt_handler(boot_info.console_evtchn, hypcnintr, 0, SPL6);
return 0;
}
示例2: ntfs_nthashinit
/*
* Initialize inode hash table.
*/
void
ntfs_nthashinit()
{
ntfs_nthashtbl = hashinit(desiredvnodes, M_NTFSNTHASH, &ntfs_nthash);
simple_lock_init(&ntfs_nthash_slock);
}
示例3: gdt_init
/*
* Initialize the GDT subsystem. Called from autoconf().
*/
void
gdt_init()
{
size_t max_len, min_len;
struct vm_page *pg;
vaddr_t va;
struct cpu_info *ci = &cpu_info_primary;
simple_lock_init(&gdt_simplelock);
lockinit(&gdt_lock_store, PZERO, "gdtlck", 0, 0);
max_len = MAXGDTSIZ * sizeof(union descriptor);
min_len = MINGDTSIZ * sizeof(union descriptor);
gdt_size = MINGDTSIZ;
gdt_count = NGDT;
gdt_next = NGDT;
gdt_free = GNULL_SEL;
gdt = (union descriptor *)uvm_km_valloc(kernel_map, max_len);
for (va = (vaddr_t)gdt; va < (vaddr_t)gdt + min_len; va += PAGE_SIZE) {
pg = uvm_pagealloc(NULL, 0, NULL, UVM_PGA_ZERO);
if (pg == NULL)
panic("gdt_init: no pages");
pmap_kenter_pa(va, VM_PAGE_TO_PHYS(pg),
VM_PROT_READ | VM_PROT_WRITE);
}
bcopy(bootstrap_gdt, gdt, NGDT * sizeof(union descriptor));
ci->ci_gdt = gdt;
setsegment(&ci->ci_gdt[GCPU_SEL].sd, ci, sizeof(struct cpu_info)-1,
SDT_MEMRWA, SEL_KPL, 0, 0);
gdt_init_cpu(ci);
}
示例4: udv_init
void
udv_init()
{
LIST_INIT(&udv_list);
simple_lock_init(&udv_lock);
}
示例5: acpitz_init_envsys
static void
acpitz_init_envsys(struct acpitz_softc *sc)
{
int i;
simple_lock_init(&sc->sc_slock);
for (i = 0; i < ATZ_NUMSENSORS; i++) {
sc->sc_data[i].sensor = sc->sc_info[i].sensor = i;
sc->sc_data[i].validflags = ENVSYS_FVALID;
sc->sc_info[i].validflags = ENVSYS_FVALID;
sc->sc_data[i].warnflags = ENVSYS_WARN_OK;
}
#define INITDATA(index, unit, string) \
sc->sc_data[index].units = unit; \
sc->sc_info[index].units = unit; \
snprintf(sc->sc_info[index].desc, sizeof(sc->sc_info[index].desc), \
"%s %s", sc->sc_dev.dv_xname, string);
INITDATA(ATZ_SENSOR_TEMP, ENVSYS_STEMP, "temperature");
/* hook into sysmon */
sc->sc_sysmon.sme_ranges = acpitz_ranges;
sc->sc_sysmon.sme_sensor_info = sc->sc_info;
sc->sc_sysmon.sme_sensor_data = sc->sc_data;
sc->sc_sysmon.sme_cookie = sc;
sc->sc_sysmon.sme_gtredata = acpitz_gtredata;
sc->sc_sysmon.sme_streinfo = acpitz_streinfo;
sc->sc_sysmon.sme_nsensors = ATZ_NUMSENSORS;
sc->sc_sysmon.sme_envsys_version = 1000;
if (sysmon_envsys_register(&sc->sc_sysmon))
printf("%s: unable to register with sysmon\n",
sc->sc_dev.dv_xname);
}
示例6: ufs_ihashinit
/*
* Initialize inode hash table.
*/
void
ufs_ihashinit()
{
ihashtbl = hashinit(desiredvnodes, M_UFSMNT, &ihash);
simple_lock_init(&ufs_ihash_slock);
}
示例7: uvm_anon_init
/*
* allocate anons
*/
void
uvm_anon_init()
{
struct vm_anon *anon;
int nanon = uvmexp.free - (uvmexp.free / 16); /* XXXCDC ??? */
int lcv;
/*
* Allocate the initial anons.
*/
anon = (struct vm_anon *)uvm_km_alloc(kernel_map,
sizeof(*anon) * nanon);
if (anon == NULL) {
printf("uvm_anon_init: can not allocate %d anons\n", nanon);
panic("uvm_anon_init");
}
memset(anon, 0, sizeof(*anon) * nanon);
uvm.afree = NULL;
uvmexp.nanon = uvmexp.nfreeanon = nanon;
for (lcv = 0 ; lcv < nanon ; lcv++) {
anon[lcv].u.an_nxt = uvm.afree;
uvm.afree = &anon[lcv];
}
simple_lock_init(&uvm.afreelock);
}
示例8: lock_init
/*
* Routine: lock_init
* Function:
* Initialize a lock; required before use.
* Note that clients declare the "struct lock"
* variables and then initialize them, rather
* than getting a new one from this module.
*/
void
lock_init(
lock_t *l,
boolean_t can_sleep,
etap_event_t event,
etap_event_t i_event)
{
(void) memset((void *) l, 0, sizeof(lock_t));
#if ETAP_LOCK_TRACE
etap_event_table_assign(&l->u.event_table_chain, event);
l->u.s.start_list = SD_ENTRY_NULL;
#endif /* ETAP_LOCK_TRACE */
simple_lock_init(&l->interlock, i_event);
l->want_write = FALSE;
l->want_upgrade = FALSE;
l->read_count = 0;
l->can_sleep = can_sleep;
#if ETAP_LOCK_ACCUMULATE
l->cbuff_write = etap_cbuff_reserve(lock_event_table(l));
if (l->cbuff_write != CBUFF_ENTRY_NULL) {
l->cbuff_write->event = event;
l->cbuff_write->instance = (unsigned long) l;
l->cbuff_write->kind = WRITE_LOCK;
}
l->cbuff_read = CBUFF_ENTRY_NULL;
#endif /* ETAP_LOCK_ACCUMULATE */
}
示例9: PE_init_kprintf
void PE_init_kprintf(boolean_t vm_initialized)
{
unsigned int boot_arg;
if (PE_state.initialized == FALSE)
panic("Platform Expert not initialized");
if (!vm_initialized) {
unsigned int new_disable_serial_output = TRUE;
simple_lock_init(&kprintf_lock, 0);
if (PE_parse_boot_argn("debug", &boot_arg, sizeof (boot_arg)))
if (boot_arg & DB_KPRT)
new_disable_serial_output = FALSE;
/* If we are newly enabling serial, make sure we only
* call pal_serial_init() if our previous state was
* not enabled */
if (!new_disable_serial_output && (!disable_serial_output || pal_serial_init()))
PE_kputc = pal_serial_putc;
else
PE_kputc = cnputc;
disable_serial_output = new_disable_serial_output;
}
}
示例10: chips_init
io_return_t
chips_init(struct vc_info * info)
{
extern Boot_Video boot_video_info;
unsigned char val;
if (kernel_map) {
regBase = (volatile unsigned char *)
io_map((unsigned int)regBasePhys, 4096);
simple_lock_init(&chips_lock, ETAP_IO_TTY);
}
strcpy(chips_info.v_name, chips_node->name);
chips_info.v_width = boot_video_info.v_width;
chips_info.v_height = boot_video_info.v_height;
chips_info.v_depth = boot_video_info.v_depth;
chips_info.v_rowbytes = boot_video_info.v_rowBytes;
chips_info.v_physaddr = boot_video_info.v_baseAddr;
chips_info.v_baseaddr = chips_info.v_physaddr;
chips_info.v_type = VC_TYPE_PCI;
memcpy(info, &chips_info, sizeof(chips_info));
return D_SUCCESS;
}
示例11: uvm_pager_init
void
uvm_pager_init()
{
int lcv;
/*
* init pager map
*/
pager_map = uvm_km_suballoc(kernel_map, &uvm.pager_sva, &uvm.pager_eva,
PAGER_MAP_SIZE, FALSE, FALSE, NULL);
simple_lock_init(&pager_map_wanted_lock);
pager_map_wanted = FALSE;
/*
* init ASYNC I/O queue
*/
TAILQ_INIT(&uvm.aio_done);
/*
* call pager init functions
*/
for (lcv = 0 ; lcv < sizeof(uvmpagerops)/sizeof(struct uvm_pagerops *);
lcv++) {
if (uvmpagerops[lcv]->pgo_init)
uvmpagerops[lcv]->pgo_init();
}
}
示例12: boot_script_exec_cmd
int
boot_script_exec_cmd (void *hook, task_t task, char *path, int argc,
char **argv, char *strings, int stringlen)
{
struct multiboot_module *mod = hook;
int err;
if (task != MACH_PORT_NULL)
{
thread_t thread;
struct user_bootstrap_info info = { mod, argv, 0, };
simple_lock_init (&info.lock);
simple_lock (&info.lock);
err = thread_create ((task_t)task, &thread);
assert(err == 0);
thread->saved.other = &info;
thread_start (thread, user_bootstrap);
thread_resume (thread);
/* We need to synchronize with the new thread and block this
main thread until it has finished referring to our local state. */
while (! info.done)
{
thread_sleep ((event_t) &info, simple_lock_addr(info.lock), FALSE);
simple_lock (&info.lock);
}
printf ("\n");
}
return 0;
}
示例13: printf_init
void printf_init(void)
{
if (!_doprnt_lock_initialized)
{
_doprnt_lock_initialized = TRUE;
simple_lock_init(&_doprnt_lock);
}
}
示例14: tunattach
void
tunattach(int unused)
{
simple_lock_init(&tun_softc_lock);
LIST_INIT(&tun_softc_list);
LIST_INIT(&tunz_softc_list);
if_clone_attach(&tun_cloner);
}
示例15: stack_init
void
stack_init(void)
{
simple_lock_init(&stack_lock_data, 0);
if (KERNEL_STACK_SIZE < round_page(KERNEL_STACK_SIZE))
panic("stack_init: stack size %d not a multiple of page size %d\n", KERNEL_STACK_SIZE, PAGE_SIZE);
stack_addr_mask = KERNEL_STACK_SIZE - 1;
}