static NPError MyNPN_SetValue(NPP instance, NPPVariable variable, void *value) { NPError ret; DEB(ef, "-> NPN_SetValue( %x, %d, 0x%x)\n", instance, variable, value); ret = gNetscapeFuncs.setvalue( instance, variable, value ); DEB(ef, "<- NPN_SetValue = %d\n", ret); return ret; }
NPError NP_GetValue(void *future, NPPVariable variable, void *value) { NPError err; LoadPlugin(); if ( !gLib ) return NPERR_GENERIC_ERROR; DEB(ef, "-> NP_GetValue( %x, %d, %x )\n", future, variable, value ); err = gNP_GetValue( future, variable, value ); DEB(ef, "<- NP_GetValue = %d\n", err ); return err; }
static int32 MyNPN_Write(NPP instance, NPStream* stream, int32 len, void* buffer) { int32 ret; DEB(ef, "-> NPN_Write( %x, 0x%x, %d, 0x%x )\n", instance, stream, len, buffer); ret = gNetscapeFuncs.write( instance, stream, len, buffer ); DEB(ef, "<- NPN_Write = %d\n", ret); return ret; }
static NPError MyNPN_DestroyStream(NPP instance, NPStream* stream, NPReason reason) { NPError err; DEB(ef, "-> NPN_DestroyStream( %x, 0x%x, %d )\n", instance, stream, reason); err = gNetscapeFuncs.destroystream( instance, stream, reason ); DEB(ef, "<- NPN_DestroyStream = %d\n", err); return err; }
static int32 MyNPP_Write(NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer) { int32 ret; DEB(ef, "-> NPP_Write( %x, 0x%x, %d, %d, 0x%x )\n", instance, stream, offset, len, buffer); ret = gPluginFuncs.write( instance, stream, offset, len, buffer ); DEB(ef, "<- NPP_Write = %d\n", ret); return ret; }
static NPError MyNPN_NewStream(NPP instance, NPMIMEType type, const char* target, NPStream** stream) { NPError err; DEB(ef, "-> NPN_NewStream( %x, %s, %s, 0x%x )\n", instance, type, target, stream); err = gNetscapeFuncs.newstream( instance, type, target, stream ); DEB(ef, "<- NPN_NewStream = %d\n", err); return err; }
static NPError MyNPN_GetURL(NPP instance, const char* url, const char* target) { NPError err; DEB(ef, "-> NPN_GetURL( %x, %s, %s )\n", instance, url, target ); err = gNetscapeFuncs.geturl( instance, url, target ); DEB(ef, "<- NPN_GetURL = %d\n", err); return err; }
static NPError MyNPN_GetURLNotify(NPP instance, const char* url, const char* target, void* notifyData) { NPError err; DEB(ef, "-> NPN_GetURLNotify( %x, %s, %s, 0x%x )\n", instance, url, target, notifyData); err = gNetscapeFuncs.geturlnotify( instance, url, target, notifyData ); DEB(ef, "<- NPN_GetURLNotify = %d\n", err); return err; }
NPError NP_Shutdown(void) { NPError err; LoadPlugin(); if ( !gLib ) return NPERR_GENERIC_ERROR; DEB(ef, "-> NP_Shutdown()\n" ); err = gNP_Shutdown( ); DEB(ef, "<- NP_Shutdown = %d\n", err ); return err; }
static NPError MyNPN_PostURL(NPP instance, const char* url, const char* target, uint32 len, const char* buf, NPBool file) { NPError err; DEB(ef, "-> NPN_PostURL( %x, %s, %s, %d, 0x%x, %d )\n", instance, url, target, len, buf, file ); err = gNetscapeFuncs.posturl( instance, url, target, len, buf, file ); DEB(ef, "<- NPN_PostURL = %d\n", err); return err; }
asmlinkage int virt_readlink(const char *filename, char *buf, int bufsiz) { int ret; mm_segment_t old_fs; char *newfilename; char *locbuf; int len; if(!cwd_virtual()) { ret = (*orig_readlink)(filename, buf, bufsiz); if(ret != -ENOENT) return ret; } else ret = 0; newfilename = resolve_name(filename, 1, 0); if(!newfilename) { if(ret) return ret; else return (*orig_readlink)(filename, buf, bufsiz); } if(IS_ERR(newfilename)) return PTR_ERR(newfilename); DEB((KERN_INFO "READLINK: trying '%s'\n", newfilename)); /* bufsiz is legal (already checked by sys_readlink) */ len = bufsiz; if(bufsiz > PAGE_SIZE) len = PAGE_SIZE; locbuf = (char *) __get_free_page(GFP_USER); ret = -ENOMEM; if(locbuf) { old_fs = get_fs(); set_fs(get_ds()); ret = (*orig_readlink)(newfilename, locbuf, len); set_fs(old_fs); if(ret >= 0) if(copy_to_user(buf, locbuf, len)) ret = -EFAULT; free_page((unsigned long) locbuf); } kfree(newfilename); DEB((KERN_INFO "READLINK: result %i\n", ret)); return ret; }
char *NP_GetMIMEDescription(void) { char * ret; LoadPlugin(); if ( !gLib ) return NULL; DEB(ef, "-> NP_GetMIMEDescription()\n" ); ret = gNP_GetMIMEDescription(); DEB(ef, "<- NP_GetMIMEDescription = %s\n", ret ); return ret; }
void * /*ARGSUSED*/ event_handler(void *par) { iscsi_wait_event_parameters_t evtp; int rc; DEB(99, ("Event handler starts\n")); (void) memset(&evtp, 0x0, sizeof(evtp)); evtp.event_id = event_reg.event_id; do { if (nothreads) rc = ioctl(driver, ISCSI_POLL_EVENT, &evtp); else rc = ioctl(driver, ISCSI_WAIT_EVENT, &evtp); if (rc != 0) { perror("ioctl"); break; } DEB(1, ("Got Event: kind %d, status %d, sid %d, cid %d, reason %d\n", evtp.event_kind, evtp.status, evtp.session_id, evtp.connection_id, evtp.reason)); if (evtp.status) break; switch (evtp.event_kind) { case ISCSI_SESSION_TERMINATED: event_kill_session(evtp.session_id); break; case ISCSI_CONNECTION_TERMINATED: event_kill_connection(evtp.session_id, evtp.connection_id); break; case ISCSI_RECOVER_CONNECTION: event_recover_connection(evtp.session_id, evtp.connection_id); break; default: break; } } while (evtp.event_kind != ISCSI_DRIVER_TERMINATING); if (nothreads && evtp.event_kind == ISCSI_DRIVER_TERMINATING) exit_daemon(); return NULL; }
static int out_scan_aso(s_outbound_callback_data *callback, const s_falist *mailfor, const char *path) { DIR *dir; struct dirent *dirent; const s_falist *alst; s_faddr addr = { FALSE, 0, 0, 0, 0, "" }; #ifdef DEBUG char abuf[BF_MAXADDRSTR+1]; #endif ASSERT(callback); ASSERT(callback->dest); ASSERT(path); DEB((D_OUTBOUND, "out_scandir_aso: scan dir \"%s\"", path)); if( (dir = opendir(path)) == NULL ) { logerr("can't open outbound directory \"%s\"", path); return -1; } while( (dirent = readdir(dir)) ) { memset(&addr, '\0', sizeof(s_faddr)); if( out_parse_name_aso(&addr, dirent->d_name) == 0 ) { DEB((D_OUTBOUND, "out_scandir_aso: file \"%s\" for address %s", dirent->d_name, ftn_addrstr(abuf, addr))); for( alst = mailfor; alst && ftn_addrcomp(addr, alst->addr); alst = alst->next ); if( alst || !mailfor ) { callback->path = string_concat(path, dirent->d_name, NULL); callback->addr = addr; callback->type = OUTB_TYPE_ASO; callback->flavor = -1; callback->callback(callback); if( callback->path ) free(callback->path); } } } closedir(dir); return 0; }
void Heap::expandNew() { DEB("Expanding new from"); DEB(newSize); std::pair<Instance*,int> * newEden = new std::pair<Instance*,int>[2*newSize]; std::pair<Instance*,int> * newSurvivor = new std::pair<Instance*,int>[2*newSize]; for(int i = 0; i < newSize; ++i) newEden[i] = eden[i]; for(int i = newSize; i < 2*newSize; ++i) newEden[i].first = NULL; newSize *= 2; delete [] eden; delete [] survivor; eden = newEden; survivor = newSurvivor; }
static NPError MyNPN_PostURLNotify(NPP instance, const char* url, const char* target, uint32 len, const char* buf, NPBool file, void* notifyData) { NPError err; DEB(ef, "-> NPN_PostURLNotify( %x, %s, %s, %d, 0x%x, %d, 0x%x )\n", instance, url, target, len, buf, file, notifyData); err = gNetscapeFuncs.posturlnotify( instance, url, target, len, buf, file, notifyData ); DEB(ef, "<- NPN_PostURLNotify = %d\n", err); return err; }
void log_fsqueue(const s_fsqueue *q) { int i; DEB((D_OUTBOUND, "log_queue_long: BEGIN")); log_filelist(q->fslist); for( i = 0; i < q->flonum; i++ ) DEB((D_OUTBOUND, "log_queue_long: FLO file \"%s\"", q->flotab[i].fname)); DEB((D_OUTBOUND, "log_queue_long: END")); }
Instance * Heap::getInstance(int ref){ DEB("Address: "); DEB(ref); if(ref < 0) { if(~ref >= newSize || eden[~ref].first == NULL) { throw std::runtime_error("Heap doesn't contain that address " + ref); } return eden[~ref].first; } else { if(ref >= oldSize || old[ref] == NULL){ throw std::runtime_error("Heap doesn't contain that address " + ref); } return old[ref]; } }
int tty_write(const unsigned char *buf, size_t size) { int rc; DEB((D_TTYIO, "tty_write: want write %d byte(s)", size)); CARRIER_CHECK(); if( (tty_online && tty_hangup) || tty_abort ) { return(tty_status = TTY_HANGUP); } rc = write(1, buf, size); CARRIER_CHECK(); if( rc < 0 ) { if( errno == EINTR ) { if( (tty_online && tty_hangup) || tty_abort ) { tty_status = TTY_HANGUP; } else { tty_status = TTY_TIMEOUT; } } else if( errno == EAGAIN || errno == EWOULDBLOCK ) { tty_status = TTY_TIMEOUT; } else if( errno == EPIPE ) { tty_hangup = 1; tty_status = TTY_HANGUP; } else { tty_status = TTY_ERROR; } } else if( rc == 0 ) tty_status = TTY_TIMEOUT; else /* ( rc > 0 ) */ tty_status = TTY_SUCCESS; DEB((D_TTYIO, "tty_write: return code = %s, rc = %d", tty_errstr(tty_status), rc)); return (tty_status == TTY_SUCCESS) ? rc : tty_status; }
void smp8634_free(struct SDL_PrivateVideoData *config) { RMstatus err; int i; clear_display_options(&dcc_info, &disp_opt); for (i=0;i<BUFFER_COUNT;i++) { RUAUnMap(config->pRUA, config->descriptor->MappedAddr[i], config->descriptor->LumaSize[i]); err = RUAUnLock(config->pRUA, config->descriptor->LumaAddr[i], config->descriptor->LumaSize[i]); if (RMFAILED(err)) { printf("Error unlocking OSD buffer at 0x%08lX (0x%08lX bytes)\n", \ config->descriptor->LumaAddr[i], config->descriptor->LumaSize[i]); return; } } gfxUnInit(config->descriptor); DCCCloseVideoSource(config->descriptor->OSDSource); if (config->pDCC){ err = DCCClose(config->pDCC); if (RMFAILED(err)) fprintf(stderr, "Cannot close DCC %d\n", err); } if (config->pRUA){ err = RUADestroyInstance(config->pRUA); if (RMFAILED(err)) fprintf(stderr, "Cannot destroy RUA instance %d\n", err); } DEB(fprintf(stderr,"end freeOSD\n")); }
static int sound_release(struct inode *inode, struct file *file) { int dev = iminor(inode); lock_kernel(); DEB(printk("sound_release(dev=%d)\n", dev)); switch (dev & 0x0f) { case SND_DEV_CTL: module_put(mixer_devs[dev >> 4]->owner); break; case SND_DEV_SEQ: case SND_DEV_SEQ2: sequencer_release(dev, file); break; case SND_DEV_MIDIN: MIDIbuf_release(dev, file); break; case SND_DEV_DSP: case SND_DEV_DSP16: case SND_DEV_AUDIO: audio_release(dev, file); break; default: printk(KERN_ERR "Sound error: Releasing unknown device 0x%02x\n", dev); } unlock_kernel(); return 0; }
static ssize_t sound_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { int dev = iminor(file->f_path.dentry->d_inode); int ret = -EINVAL; lock_kernel(); DEB(printk("sound_write(dev=%d, count=%d)\n", dev, count)); switch (dev & 0x0f) { case SND_DEV_SEQ: case SND_DEV_SEQ2: ret = sequencer_write(dev, file, buf, count); break; case SND_DEV_DSP: case SND_DEV_DSP16: case SND_DEV_AUDIO: ret = audio_write(dev, file, buf, count); break; case SND_DEV_MIDIN: ret = MIDIbuf_write(dev, file, buf, count); break; } unlock_kernel(); return ret; }
static ssize_t sound_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { int dev = iminor(file->f_path.dentry->d_inode); int ret = -EINVAL; /* * The OSS drivers aren't remotely happy without this locking, * and unless someone fixes them when they are about to bite the * big one anyway, we might as well bandage here.. */ lock_kernel(); DEB(printk("sound_read(dev=%d, count=%d)\n", dev, count)); switch (dev & 0x0f) { case SND_DEV_DSP: case SND_DEV_DSP16: case SND_DEV_AUDIO: ret = audio_read(dev, file, buf, count); break; case SND_DEV_SEQ: case SND_DEV_SEQ2: ret = sequencer_read(dev, file, buf, count); break; case SND_DEV_MIDIN: ret = MIDIbuf_read(dev, file, buf, count); } unlock_kernel(); return ret; }
int i2c_detach_client(struct i2c_client *client) { struct i2c_adapter *adapter = client->adapter; int i,res; for (i = 0; i < I2C_CLIENT_MAX; i++) if (client == adapter->clients[i]) break; if (I2C_CLIENT_MAX == i) { printk(KERN_WARNING " i2c-core.o: unregister_client " "[%s] not found\n", client->name); return -ENODEV; } if( (client->flags & I2C_CLIENT_ALLOW_USE) && (client->usage_count>0)) return -EBUSY; if (adapter->client_unregister != NULL) if ((res = adapter->client_unregister(client))) { printk(KERN_ERR "i2c-core.o: client_unregister [%s] failed, " "client not detached\n", client->name); return res; } adapter->clients[i] = NULL; adapter->client_count--; DEB(printk(KERN_DEBUG "i2c-core.o: client [%s] unregistered.\n",client->name)); return 0; }
int i2c_attach_client(struct i2c_client *client) { struct i2c_adapter *adapter = client->adapter; int i; if (i2c_check_addr(client->adapter,client->addr)) return -EBUSY; for (i = 0; i < I2C_CLIENT_MAX; i++) if (NULL == adapter->clients[i]) break; if (I2C_CLIENT_MAX == i) { printk(KERN_WARNING " i2c-core.o: attach_client(%s) - enlarge I2C_CLIENT_MAX.\n", client->name); return -ENOMEM; } adapter->clients[i] = client; adapter->client_count++; if (adapter->client_register) if (adapter->client_register(client)) printk(KERN_DEBUG "i2c-core.o: warning: client_register seems " "to have failed for client %02x at adapter %s\n", client->addr,adapter->name); DEB(printk(KERN_DEBUG "i2c-core.o: client [%s] registered to adapter [%s](pos. %d).\n", client->name, adapter->name,i)); if(client->flags & I2C_CLIENT_ALLOW_USE) client->usage_count = 0; return 0; }
void AudioSourceFilePrelistener::prepareToPlay (int samplesPerBlockExpected_, double sampleRate_) { DEB("AudioSourceFilePreview: prepareToPlay called."); samplesPerBlockExpected = samplesPerBlockExpected_; sampleRate = sampleRate_; }
static ssize_t sound_write(struct file *file, const char *buf, size_t count, loff_t *ppos) { int dev = MINOR(file->f_dentry->d_inode->i_rdev); DEB(printk("sound_write(dev=%d, count=%d)\n", dev, count)); switch (dev & 0x0f) { #ifdef CONFIG_SEQUENCER case SND_DEV_SEQ: case SND_DEV_SEQ2: return sequencer_write(dev, file, buf, count); #endif #ifdef CONFIG_AUDIO case SND_DEV_DSP: case SND_DEV_DSP16: case SND_DEV_AUDIO: return audio_write(dev, file, buf, count); #endif #ifdef CONFIG_MIDI case SND_DEV_MIDIN: return MIDIbuf_write(dev, file, buf, count); #endif } return -EINVAL; }
static int nm_pci_probe(device_t dev) { char *s = NULL; u_int32_t subdev, i; subdev = (pci_get_subdevice(dev) << 16) | pci_get_subvendor(dev); switch (pci_get_devid(dev)) { case NM256AV_PCI_ID: i = 0; while ((i < NUM_BADCARDS) && (badcards[i] != subdev)) i++; if (i == NUM_BADCARDS) s = "NeoMagic 256AV"; DEB(else) DEB(device_printf(dev, "this is a non-ac97 NM256AV, not attaching\n")); break; case NM256ZX_PCI_ID: s = "NeoMagic 256ZX"; break; } if (s) device_set_desc(dev, s); return s? 0 : ENXIO; }
/***************************************************************************** * Devide full outbound path on "root" directory, there other oubound * directories created, and main outbound directory name * * Arguments: * path pointer to the null-terminated outbound path string * out_root pointer to the pointer for the resulting root directory * out_main pointer to the pointer for the resulting main outbound * name w/o path * * Return value: * Zero on success (*out_root and *out_main must be freed) */ int out_get_root(const char *path, char **out_root, char **out_main) { char *p, *outb; ASSERT(path != NULL && out_root != NULL && out_main != NULL); *out_root = NULL; *out_main = NULL; outb = (char *)xstrcpy(path); p = outb + strlen(outb) - 1; if( *p == DIRSEPCHR ) *p = '\0'; /* Ohh.. where is no full path for outbound directory */ if( (p=strrchr(outb, DIRSEPCHR)) == NULL ) { free(outb); return -1; } *p = '\0'; *out_main = xstrcpy(p+1); *out_root = xstrcat(outb, "/"); DEB((D_OUTBOUND, "out_getroot: out_root \"%s\", out_main \"%s\"", *out_root, *out_main)); return 0; }
// Implementation of the AudioSource method. void AudioSourceFilePrelistener::getNextAudioBlock (const AudioSourceChannelInfo& info) { DEB("AudioSourceFilePreview::getNextAudioBlock called."); if (info.numSamples > 0 && runPlayback) { int audioBlockEnd = nextPlayPosition + info.numSamples; if (audioBlockEnd <= endPosition) { bufferingAudioSource->getNextAudioBlock(info); nextPlayPosition = audioBlockEnd; bufferingAudioSource->setNextReadPosition(audioBlockEnd); } else // if (audioBlockEnd > endPosition) { // We don't have enough samples left to put info.numSamples // onto the buffer. AudioSourceChannelInfo infoWithSameBufferButLessUsedSamples = info; infoWithSameBufferButLessUsedSamples.numSamples = endPosition - nextPlayPosition; bufferingAudioSource->getNextAudioBlock(infoWithSameBufferButLessUsedSamples); nextPlayPosition = endPosition; runPlayback = false; } } }