您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ xtrace函数代码示例

51自学网 2021-06-03 11:53:18
  C++
这篇教程C++ xtrace函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中xtrace函数的典型用法代码示例。如果您正苦于以下问题:C++ xtrace函数的具体用法?C++ xtrace怎么用?C++ xtrace使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了xtrace函数的22个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: mcdx_exit

static void __exit mcdx_exit(void){	int i;	xinfo("cleanup_module called/n");	for (i = 0; i < MCDX_NDRIVES; i++) {		struct s_drive_stuff *stuffp = mcdx_stuffp[i];		if (!stuffp)			continue;		del_gendisk(stuffp->disk);		if (unregister_cdrom(&stuffp->info)) {			printk(KERN_WARNING "Can't unregister cdrom mcdx/n");			continue;		}		put_disk(stuffp->disk);		release_region(stuffp->wreg_data, MCDX_IO_SIZE);		free_irq(stuffp->irq, NULL);		if (stuffp->toc) {			xtrace(MALLOC, "cleanup_module() free toc @ %p/n",			       stuffp->toc);			kfree(stuffp->toc);		}		xtrace(MALLOC, "cleanup_module() free stuffp @ %p/n",		       stuffp);		mcdx_stuffp[i] = NULL;		kfree(stuffp);	}	if (unregister_blkdev(MAJOR_NR, "mcdx") != 0) {		xwarn("cleanup() unregister_blkdev() failed/n");	}	blk_cleanup_queue(mcdx_queue);#if !MCDX_QUIET	else
开发者ID:jameshilliard,项目名称:actiontec_opensrc_mi424wr-rev-ef_fw-20-19-8,代码行数:35,


示例2: __xpath_expression_eval_print_input

static void__xpath_expression_eval_print_input(const xpath_enode_t *enode,			const xpath_result_t *left,			const xpath_result_t *right){	char *leftval = NULL, *rightval = NULL;	const char *name;	char namebuf[256];	if (enode->ops->print) {		name = enode->ops->print(enode);	} else if (enode->identifier == NULL) {		name = enode->ops->name;	} else {		snprintf(namebuf, sizeof(namebuf), "%s %s",				enode->ops->name,				enode->identifier);		name = namebuf;	}	if (left)		leftval = __xpath_node_array_print_short(left);	if (right)		rightval = __xpath_node_array_print_short(right);	if (leftval == NULL)		xtrace("  EVAL %s []", name);	else if (rightval == NULL)		xtrace("  EVAL %s %s", name, leftval);	else		xtrace("  EVAL %s %s %s", name, leftval, rightval);	ni_string_free(&leftval);	ni_string_free(&rightval);}
开发者ID:openSUSE,项目名称:wicked,代码行数:34,


示例3: mcdx_exit

void __exit mcdx_exit(void){    int i;	xinfo("cleanup_module called/n");    for (i = 0; i < MCDX_NDRIVES; i++) {		struct s_drive_stuff *stuffp;        	if (unregister_cdrom(&mcdx_info)) {			printk(KERN_WARNING "Can't unregister cdrom mcdx/n");			return;		}		stuffp = mcdx_stuffp[i];		if (!stuffp) continue;		release_region((unsigned long) stuffp->wreg_data, MCDX_IO_SIZE);		free_irq(stuffp->irq, NULL);		if (stuffp->toc) {			xtrace(MALLOC, "cleanup_module() free toc @ %p/n", stuffp->toc);			kfree(stuffp->toc);		}		xtrace(MALLOC, "cleanup_module() free stuffp @ %p/n", stuffp);		mcdx_stuffp[i] = NULL;		kfree(stuffp);    }    if (devfs_unregister_blkdev(MAJOR_NR, "mcdx") != 0) {        xwarn("cleanup() unregister_blkdev() failed/n");    }	blk_cleanup_queue(BLK_DEFAULT_QUEUE(MAJOR_NR));#if !MCDX_QUIET	else xinfo("cleanup() succeeded/n");
开发者ID:dmgerman,项目名称:linux-pre-history,代码行数:31,


示例4: __xpath_expression_eval_print_output

static void__xpath_expression_eval_print_output(const xpath_enode_t *enode,			const xpath_result_t *result){	char *rval = NULL;	if (result == NULL) {		xtrace("  ERROR");	} else {		rval = __xpath_node_array_print_short(result);		xtrace("   => %s", rval);		ni_string_free(&rval);	}}
开发者ID:openSUSE,项目名称:wicked,代码行数:14,


示例5: mcdx_setdrivemode

static int mcdx_setdrivemode(struct s_drive_stuff *stuffp, enum drivemodes mode,		  int tries){	char cmd[2];	int ans;	xtrace(HW, "setdrivemode() %d/n", mode);	if (-1 == (ans = mcdx_talk(stuffp, "/xc2", 1, cmd, sizeof(cmd), 5 * HZ, tries)))		return -1;	switch (mode) {	case TOC:		cmd[1] |= 0x04;		break;	case DATA:		cmd[1] &= ~0x04;		break;	case RAW:		cmd[1] |= 0x40;		break;	case COOKED:		cmd[1] &= ~0x40;		break;	default:		break;	}	cmd[0] = 0x50;	return mcdx_talk(stuffp, cmd, 2, NULL, 1, 5 * HZ, tries);}
开发者ID:Einheri,项目名称:wl500g,代码行数:30,


示例6: mcdx_playmsf

static intmcdx_playmsf(struct s_drive_stuff *stuffp, const struct cdrom_msf *msf){	unsigned char cmd[7] = {		0, 0, 0, 0, 0, 0, 0	};	if (!stuffp->readcmd) {		xinfo("Can't play from missing disk./n");		return -1;	}	cmd[0] = stuffp->playcmd;	cmd[1] = msf->cdmsf_min0;	cmd[2] = msf->cdmsf_sec0;	cmd[3] = msf->cdmsf_frame0;	cmd[4] = msf->cdmsf_min1;	cmd[5] = msf->cdmsf_sec1;	cmd[6] = msf->cdmsf_frame1;	xtrace(PLAYMSF, "ioctl(): play %x "	       "%02x:%02x:%02x -- %02x:%02x:%02x/n",	       cmd[0], cmd[1], cmd[2], cmd[3], cmd[4], cmd[5], cmd[6]);	outsb(stuffp->wreg_data, cmd, sizeof cmd);	if (-1 == mcdx_getval(stuffp, 3 * HZ, 0, NULL)) {		xwarn("playmsf() timeout/n");		return -1;	}	stuffp->audiostatus = CDROM_AUDIO_PLAY;	return 0;}
开发者ID:Einheri,项目名称:wl500g,代码行数:35,


示例7: mcdx_delay

static void mcdx_delay(struct s_drive_stuff *stuff, long jifs)/* This routine is used for sleeping. * A jifs value <0 means NO sleeping, *              =0 means minimal sleeping (let the kernel *                 run for other processes) *              >0 means at least sleep for that amount. *	May be we could use a simple count loop w/ jumps to itself, but *	I wanna make this independent of cpu speed. [1 jiffy is 1/HZ] sec */{	if (jifs < 0) return;	xtrace(SLEEP, "*** delay: sleepq/n");	interruptible_sleep_on_timeout(&stuff->sleepq, jifs);	xtrace(SLEEP, "delay awoken/n");	if (signal_pending(current)) {		xtrace(SLEEP, "got signal/n");	}}
开发者ID:dmgerman,项目名称:linux-pre-history,代码行数:18,


示例8: mcdx_intr

static voidmcdx_intr(int irq, void *dev_id, struct pt_regs* regs){    struct s_drive_stuff *stuffp;	unsigned char b;    stuffp = mcdx_irq_map[irq];    if (stuffp == NULL ) {		xwarn("mcdx: no device for intr %d/n", irq);		return;    }#ifdef AK2	if ( !stuffp->busy && stuffp->pending )		stuffp->int_err = 1;#endif /* AK2 */	/* get the interrupt status */	b = inb((unsigned int) stuffp->rreg_status);	stuffp->introk = ~b & MCDX_RBIT_DTEN;	/* NOTE: We only should get interrupts if the data we	 * requested are ready to transfer.	 * But the drive seems to generate ``asynchronous'' interrupts	 * on several error conditions too.  (Despite the err int enable	 * setting during initialisation) */	/* if not ok, read the next byte as the drives status */	if (!stuffp->introk) {		xtrace(IRQ, "intr() irq %d hw status 0x%02x/n", irq, b);		if (~b & MCDX_RBIT_STEN) {			xinfo(  "intr() irq %d    status 0x%02x/n",					irq, inb((unsigned int) stuffp->rreg_data));		} else {			xinfo(  "intr() irq %d ambiguous hw status/n", irq);		}	} else {		xtrace(IRQ, "irq() irq %d ok, status %02x/n", irq, b);    }    stuffp->busy = 0;    wake_up_interruptible(&stuffp->busyq);}
开发者ID:dmgerman,项目名称:linux-pre-history,代码行数:44,


示例9: mcdx_close

static void mcdx_close(struct cdrom_device_info *cdi){	struct s_drive_stuff *stuffp;	xtrace(OPENCLOSE, "close()/n");	stuffp = cdi->handle;	--stuffp->users;}
开发者ID:jameshilliard,项目名称:actiontec_opensrc_mi424wr-rev-ef_fw-20-19-8,代码行数:10,


示例10: xpath_expr_free

/* * Free a parsed XPATH expression */static inline voidxpath_expr_free(xpath_enode_t *enode, unsigned int depth, const char *info){	if (!enode)		return;	xtrace("xpath_expression_free(%*.s%s %s %s)", depth, " ", info,		enode->ops ? enode->ops->name : NULL, enode->identifier);	xpath_expr_free(enode->left,  depth + 2, "left ");	xpath_expr_free(enode->right, depth + 2, "right");	xpath_enode_free(enode);}
开发者ID:openSUSE,项目名称:wicked,代码行数:14,


示例11: mcdx_close

static void mcdx_close(struct cdrom_device_info * cdi){    struct s_drive_stuff *stuffp;    xtrace(OPENCLOSE, "close()/n");    stuffp = mcdx_stuffp[MINOR(cdi->dev)];    --stuffp->users;    MOD_DEC_USE_COUNT;}
开发者ID:dmgerman,项目名称:linux-pre-history,代码行数:12,


示例12: __mcdx_init

int __mcdx_init(void){	int i;	int drives = 0;	mcdx_init();	for (i = 0; i < MCDX_NDRIVES; i++) {		if (mcdx_stuffp[i]) {			xtrace(INIT, "init_module() drive %d stuff @ %p/n",			       i, mcdx_stuffp[i]);			drives++;		}	}	if (!drives)		return -EIO;	return 0;}
开发者ID:jameshilliard,项目名称:actiontec_opensrc_mi424wr-rev-ef_fw-20-19-8,代码行数:19,


示例13: mcdx_config

static int mcdx_config(struct s_drive_stuff *stuffp, int tries){	char cmd[4];	xtrace(HW, "config()/n");	cmd[0] = 0x90;	cmd[1] = 0x10;		/* irq enable */	cmd[2] = 0x05;		/* pre, err irq enable */	if (-1 == mcdx_talk(stuffp, cmd, 3, NULL, 1, 1 * HZ, tries))		return -1;	cmd[1] = 0x02;		/* dma select */	cmd[2] = 0x00;		/* no dma */	return mcdx_talk(stuffp, cmd, 3, NULL, 1, 1 * HZ, tries);}
开发者ID:Einheri,项目名称:wl500g,代码行数:19,


示例14: mcdx_setdatamode

static int mcdx_setdatamode(struct s_drive_stuff *stuffp, enum datamodes mode,		 int tries){	unsigned char cmd[2] = { 0xa0 };	xtrace(HW, "setdatamode() %d/n", mode);	switch (mode) {	case MODE0:		cmd[1] = 0x00;		break;	case MODE1:		cmd[1] = 0x01;		break;	case MODE2:		cmd[1] = 0x02;		break;	default:		return -EINVAL;	}	return mcdx_talk(stuffp, cmd, 2, NULL, 1, 5 * HZ, tries);}
开发者ID:Einheri,项目名称:wl500g,代码行数:20,


示例15: mcdx_open

static int mcdx_open(struct cdrom_device_info *cdi, int purpose){	struct s_drive_stuff *stuffp;	xtrace(OPENCLOSE, "open()/n");	stuffp = cdi->handle;	if (!stuffp->present)		return -ENXIO;	/* Make the modules looking used ... (thanx bjorn).	 * But we shouldn't forget to decrement the module counter	 * on error return */	/* this is only done to test if the drive talks with us */	if (-1 == mcdx_getstatus(stuffp, 1))		return -EIO;	if (stuffp->xxx) {		xtrace(OPENCLOSE, "open() media changed/n");		stuffp->audiostatus = CDROM_AUDIO_INVALID;		stuffp->readcmd = 0;		xtrace(OPENCLOSE, "open() Request multisession info/n");		if (-1 ==		    mcdx_requestmultidiskinfo(stuffp, &stuffp->multi, 6))			xinfo("No multidiskinfo/n");	} else {		/* multisession ? */		if (!stuffp->multi.multi)			stuffp->multi.msf_last.second = 2;		xtrace(OPENCLOSE, "open() MS: %d, last @ %02x:%02x.%02x/n",		       stuffp->multi.multi,		       stuffp->multi.msf_last.minute,		       stuffp->multi.msf_last.second,		       stuffp->multi.msf_last.frame);		{;		}		/* got multisession information */		/* request the disks table of contents (aka diskinfo) */		if (-1 == mcdx_requesttocdata(stuffp, &stuffp->di, 1)) {			stuffp->lastsector = -1;		} else {			stuffp->lastsector = (CD_FRAMESIZE / 512)			    * msf2log(&stuffp->di.msf_leadout) - 1;			xtrace(OPENCLOSE,			       "open() start %d (%02x:%02x.%02x) %d/n",			       stuffp->di.n_first,			       stuffp->di.msf_first.minute,			       stuffp->di.msf_first.second,			       stuffp->di.msf_first.frame,			       msf2log(&stuffp->di.msf_first));			xtrace(OPENCLOSE,			       "open() last %d (%02x:%02x.%02x) %d/n",			       stuffp->di.n_last,			       stuffp->di.msf_leadout.minute,			       stuffp->di.msf_leadout.second,			       stuffp->di.msf_leadout.frame,			       msf2log(&stuffp->di.msf_leadout));		}		if (stuffp->toc) {			xtrace(MALLOC, "open() free old toc @ %p/n",			       stuffp->toc);			kfree(stuffp->toc);			stuffp->toc = NULL;		}		xtrace(OPENCLOSE, "open() init irq generation/n");		if (-1 == mcdx_config(stuffp, 1))			return -EIO;#ifdef FALLBACK		/* Set the read speed */		xwarn("AAA %x AAA/n", stuffp->readcmd);		if (stuffp->readerrs)			stuffp->readcmd = READ1X;		else			stuffp->readcmd =			    stuffp->present | SINGLE ? READ1X : READ2X;		xwarn("XXX %x XXX/n", stuffp->readcmd);#else		stuffp->readcmd =		    stuffp->present | SINGLE ? READ1X : READ2X;#endif		/* try to get the first sector, iff any ... */		if (stuffp->lastsector >= 0) {			char buf[512];			int ans;			int tries;			stuffp->xa = 0;			stuffp->audio = 0;			for (tries = 6; tries; tries--) {//.........这里部分代码省略.........
开发者ID:jameshilliard,项目名称:actiontec_opensrc_mi424wr-rev-ef_fw-20-19-8,代码行数:101,


示例16: do_mcdx_request

static void do_mcdx_request(request_queue_t * q){	struct s_drive_stuff *stuffp;	struct request *req;      again:	req = elv_next_request(q);	if (!req)		return;	stuffp = req->rq_disk->private_data;	if (!stuffp->present) {		xwarn("do_request(): bad device: %s/n",req->rq_disk->disk_name);		xtrace(REQUEST, "end_request(0): bad device/n");		end_request(req, 0);		return;	}	if (stuffp->audio) {		xwarn("do_request() attempt to read from audio cd/n");		xtrace(REQUEST, "end_request(0): read from audio/n");		end_request(req, 0);		return;	}	xtrace(REQUEST, "do_request() (%lu + %lu)/n",	       req->sector, req->nr_sectors);	if (req->cmd != READ) {		xwarn("do_request(): non-read command to cd!!/n");		xtrace(REQUEST, "end_request(0): write/n");		end_request(req, 0);		return;	}	else {		stuffp->status = 0;		while (req->nr_sectors) {			int i;			i = mcdx_transfer(stuffp,					  req->buffer,					  req->sector,					  req->nr_sectors);			if (i == -1) {				end_request(req, 0);				goto again;			}			req->sector += i;			req->nr_sectors -= i;			req->buffer += (i * 512);		}		end_request(req, 1);		goto again;		xtrace(REQUEST, "end_request(1)/n");		end_request(req, 1);	}	goto again;}
开发者ID:jameshilliard,项目名称:actiontec_opensrc_mi424wr-rev-ef_fw-20-19-8,代码行数:63,


示例17: mcdx_audio_ioctl

static int mcdx_audio_ioctl(struct cdrom_device_info *cdi,			    unsigned int cmd, void *arg){	struct s_drive_stuff *stuffp = cdi->handle;	if (!stuffp->present)		return -ENXIO;	if (stuffp->xxx) {		if (-1 == mcdx_requesttocdata(stuffp, &stuffp->di, 1)) {			stuffp->lastsector = -1;		} else {			stuffp->lastsector = (CD_FRAMESIZE / 512)			    * msf2log(&stuffp->di.msf_leadout) - 1;		}		if (stuffp->toc) {			kfree(stuffp->toc);			stuffp->toc = NULL;			if (-1 == mcdx_readtoc(stuffp))				return -1;		}		stuffp->xxx = 0;	}	switch (cmd) {	case CDROMSTART:{			xtrace(IOCTL, "ioctl() START/n");			/* Spin up the drive.  Don't think we can do this.			   * For now, ignore it.			 */			return 0;		}	case CDROMSTOP:{			xtrace(IOCTL, "ioctl() STOP/n");			stuffp->audiostatus = CDROM_AUDIO_INVALID;			if (-1 == mcdx_stop(stuffp, 1))				return -EIO;			return 0;		}	case CDROMPLAYTRKIND:{			struct cdrom_ti *ti = (struct cdrom_ti *) arg;			xtrace(IOCTL, "ioctl() PLAYTRKIND/n");			if ((ti->cdti_trk0 < stuffp->di.n_first)			    || (ti->cdti_trk0 > stuffp->di.n_last)			    || (ti->cdti_trk1 < stuffp->di.n_first))				return -EINVAL;			if (ti->cdti_trk1 > stuffp->di.n_last)				ti->cdti_trk1 = stuffp->di.n_last;			xtrace(PLAYTRK, "ioctl() track %d to %d/n",			       ti->cdti_trk0, ti->cdti_trk1);			return mcdx_playtrk(stuffp, ti);		}	case CDROMPLAYMSF:{			struct cdrom_msf *msf = (struct cdrom_msf *) arg;			xtrace(IOCTL, "ioctl() PLAYMSF/n");			if ((stuffp->audiostatus == CDROM_AUDIO_PLAY)			    && (-1 == mcdx_hold(stuffp, 1)))				return -EIO;			msf->cdmsf_min0 = uint2bcd(msf->cdmsf_min0);			msf->cdmsf_sec0 = uint2bcd(msf->cdmsf_sec0);			msf->cdmsf_frame0 = uint2bcd(msf->cdmsf_frame0);			msf->cdmsf_min1 = uint2bcd(msf->cdmsf_min1);			msf->cdmsf_sec1 = uint2bcd(msf->cdmsf_sec1);			msf->cdmsf_frame1 = uint2bcd(msf->cdmsf_frame1);			stuffp->stop.dt.minute = msf->cdmsf_min1;			stuffp->stop.dt.second = msf->cdmsf_sec1;			stuffp->stop.dt.frame = msf->cdmsf_frame1;			return mcdx_playmsf(stuffp, msf);		}	case CDROMRESUME:{			xtrace(IOCTL, "ioctl() RESUME/n");			return mcdx_playtrk(stuffp, NULL);		}	case CDROMREADTOCENTRY:{			struct cdrom_tocentry *entry =			    (struct cdrom_tocentry *) arg;			struct s_subqcode *tp = NULL;			xtrace(IOCTL, "ioctl() READTOCENTRY/n");			if (-1 == mcdx_readtoc(stuffp))				return -1;			if (entry->cdte_track == CDROM_LEADOUT)				tp = &stuffp->toc[stuffp->di.n_last -						  stuffp->di.n_first + 1];			else if (entry->cdte_track > stuffp->di.n_last				 || entry->cdte_track < stuffp->di.n_first)//.........这里部分代码省略.........
开发者ID:jameshilliard,项目名称:actiontec_opensrc_mi424wr-rev-ef_fw-20-19-8,代码行数:101,


示例18: mcdx_readtoc

int mcdx_readtoc(struct s_drive_stuff *stuffp)/*  Read the toc entries from the CD, *  Return: -1 on failure, else 0 */{	if (stuffp->toc) {		xtrace(READTOC, "ioctl() toc already read/n");		return 0;	}	xtrace(READTOC, "ioctl() readtoc for %d tracks/n",	       stuffp->di.n_last - stuffp->di.n_first + 1);	if (-1 == mcdx_hold(stuffp, 1))		return -1;	xtrace(READTOC, "ioctl() tocmode/n");	if (-1 == mcdx_setdrivemode(stuffp, TOC, 1))		return -EIO;	/* all seems to be ok so far ... malloc */	{		int size;		size =		    sizeof(struct s_subqcode) * (stuffp->di.n_last -						 stuffp->di.n_first + 2);		xtrace(MALLOC, "ioctl() malloc %d bytes/n", size);		stuffp->toc = kmalloc(size, GFP_KERNEL);		if (!stuffp->toc) {			xwarn("Cannot malloc %d bytes for toc/n", size);			mcdx_setdrivemode(stuffp, DATA, 1);			return -EIO;		}	}	/* now read actually the index */	{		int trk;		int retries;		for (trk = 0;		     trk < (stuffp->di.n_last - stuffp->di.n_first + 1);		     trk++)			stuffp->toc[trk].index = 0;		for (retries = 300; retries; retries--) {	/* why 300? */			struct s_subqcode q;			unsigned int idx;			if (-1 == mcdx_requestsubqcode(stuffp, &q, 1)) {				mcdx_setdrivemode(stuffp, DATA, 1);				return -EIO;			}			idx = bcd2uint(q.index);			if ((idx > 0)			    && (idx <= stuffp->di.n_last)			    && (q.tno == 0)			    && (stuffp->toc[idx - stuffp->di.n_first].				index == 0)) {				stuffp->toc[idx - stuffp->di.n_first] = q;				xtrace(READTOC,				       "ioctl() toc idx %d (trk %d)/n",				       idx, trk);				trk--;			}			if (trk == 0)				break;		}		memset(&stuffp->		       toc[stuffp->di.n_last - stuffp->di.n_first + 1], 0,		       sizeof(stuffp->toc[0]));		stuffp->toc[stuffp->di.n_last - stuffp->di.n_first +			    1].dt = stuffp->di.msf_leadout;	}	/* unset toc mode */	xtrace(READTOC, "ioctl() undo toc mode/n");	if (-1 == mcdx_setdrivemode(stuffp, DATA, 2))		return -EIO;#if MCDX_DEBUG && READTOC	{		int trk;		for (trk = 0;		     trk < (stuffp->di.n_last - stuffp->di.n_first + 2);		     trk++)			xtrace(READTOC, "ioctl() %d readtoc %02x %02x %02x"			       "  %02x:%02x.%02x  %02x:%02x.%02x/n",			       trk + stuffp->di.n_first,			       stuffp->toc[trk].control,			       stuffp->toc[trk].tno,			       stuffp->toc[trk].index,			       stuffp->toc[trk].tt.minute,			       stuffp->toc[trk].tt.second,			       stuffp->toc[trk].tt.frame,			       stuffp->toc[trk].dt.minute,			       stuffp->toc[trk].dt.second,//.........这里部分代码省略.........
开发者ID:Einheri,项目名称:wl500g,代码行数:101,


示例19: __xpath_build_expr

/* * Parse an XPATH expression. * Sorry this is such a spaghetti code implementation :-( */static xpath_enode_t *__xpath_build_expr(const char **pp, char terminator, int infixprio){	xpath_enode_t *current = NULL;	const char *pos = *pp;	xtrace("__xpath_build_expr(/"%s/", '%c', %d)", pos, terminator?: '^', infixprio);	while (*pos != terminator) {		xpath_enode_t *newnode;		xpath_operator_t *ops = NULL;		const char *ident;		const char *token_begin;		__xpath_skipws(&pos);		xtrace("     current %p - /"%s/"", current, pos);		if (*pos == '/0')			return NULL;		token_begin = pos;		if (pos[0] == '/') {			char *colons;			/* Skip over first slash */			++pos;			if (pos[0] == '/') {				/* "//" is shorthand for "descendant::" */				ops = &__xpath_operator_descendant;				++pos;			} else if (pos[0] == '@') {handle_atsign:				/* "@" is shorthand for "attribute::" */				ops = &__xpath_operator_getattr;				++pos;			} else {				/* FIXME handle "." and ".." */				ops = NULL;			}			/* path/Name */			if (!(ident = __xpath_next_identifier(&pos))) {				ni_error("XPATH: expected identifier at /"%s/"", pos);				goto failed;			}handle_name_or_axis:			if (!__xpath_enode_assert_element(&current))				goto failed;			if (ops != NULL) {				/* Okay, we've been using a shorthand identifier */;			} else if ((colons = strstr(ident, "::")) != NULL) {				*colons = '/0';				ops = xpath_get_axis_ops(ident);				if (!ops) {					ni_error("XPATH: unknown operator %s::", ident);					goto failed;				}				ident = NULL;				if (colons[2] != '/0') {					/* This one has form "axis::Name" */					ident = colons + 2;				} else if (*pos == '*') {					/* This one has form "axis::*" */					++pos;				} else {					ni_error("operator %s:: must be followed by Name or *", ident);					goto failed;				}			} else if (*pos == '(') {				goto handle_function;			} else {				/* "path/Name" really means "path/child::Name" */				ops = &__xpath_operator_child;			}			newnode = xpath_enode_new(ops);			if (ident)				ni_string_dup(&newnode->identifier, ident);			newnode->left = current;			current = newnode;		} else		if (pos[0] == '@') {			goto handle_atsign;		} else		if (pos[0] == '[') {			if (!__xpath_enode_assert_element(&current))				goto failed;			newnode = xpath_enode_new(&__xpath_operator_predicate);			newnode->left = current;			current = newnode;//.........这里部分代码省略.........
开发者ID:openSUSE,项目名称:wicked,代码行数:101,


示例20: mcdx_xfer

static int mcdx_xfer(struct s_drive_stuff *stuffp,		     char *p, int sector, int nr_sectors)/*	This does actually the transfer from the drive.	Return:	-1 on timeout or other error			else status byte (as in stuff->st) */{	int border;	int done = 0;	long timeout;	if (stuffp->audio) {		xwarn("Attempt to read from audio CD./n");		return -1;	}	if (!stuffp->readcmd) {		xinfo("Can't transfer from missing disk./n");		return -1;	}	while (stuffp->lock) {		interruptible_sleep_on(&stuffp->lockq);	}	if (stuffp->valid && (sector >= stuffp->pending)	    && (sector < stuffp->low_border)) {		/* All (or at least a part of the sectors requested) seems		   * to be already requested, so we don't need to bother the		   * drive with new requests ...		   * Wait for the drive become idle, but first		   * check for possible occurred errors --- the drive		   * seems to report them asynchronously */		border = stuffp->high_border < (border =						sector + nr_sectors)		    ? stuffp->high_border : border;		stuffp->lock = current->pid;		do {			while (stuffp->busy) {				timeout =				    interruptible_sleep_on_timeout				    (&stuffp->busyq, 5 * HZ);				if (!stuffp->introk) {					xtrace(XFER,					       "error via interrupt/n");				} else if (!timeout) {					xtrace(XFER, "timeout/n");				} else if (signal_pending(current)) {					xtrace(XFER, "signal/n");				} else					continue;				stuffp->lock = 0;				stuffp->busy = 0;				stuffp->valid = 0;				wake_up_interruptible(&stuffp->lockq);				xtrace(XFER, "transfer() done (-1)/n");				return -1;			}			/* check if we need to set the busy flag (as we			 * expect an interrupt */			stuffp->busy = (3 == (stuffp->pending & 3));			/* Test if it's the first sector of a block,			 * there we have to skip some bytes as we read raw data */			if (stuffp->xa && (0 == (stuffp->pending & 3))) {				const int HEAD =				    CD_FRAMESIZE_RAW - CD_XA_TAIL -				    CD_FRAMESIZE;				insb(stuffp->rreg_data, p, HEAD);			}			/* now actually read the data */			insb(stuffp->rreg_data, p, 512);			/* test if it's the last sector of a block,			 * if so, we have to handle XA special */			if ((3 == (stuffp->pending & 3)) && stuffp->xa) {				char dummy[CD_XA_TAIL];				insb(stuffp->rreg_data, &dummy[0], CD_XA_TAIL);			}			if (stuffp->pending == sector) {				p += 512;				done++;				sector++;			}		} while (++(stuffp->pending) < border);		stuffp->lock = 0;		wake_up_interruptible(&stuffp->lockq);//.........这里部分代码省略.........
开发者ID:Einheri,项目名称:wl500g,代码行数:101,


示例21: mcdx_talk

static int mcdx_talk(struct s_drive_stuff *stuffp,	  const unsigned char *cmd, size_t cmdlen,	  void *buffer, size_t size, unsigned int timeout, int tries)/* Send a command to the drive, wait for the result. * returns -1 on timeout, drive status otherwise * If buffer is not zero, the result (length size) is stored there. * If buffer is zero the size should be the number of bytes to read * from the drive.  These bytes are discarded. */{	int st;	char c;	int discard;	/* Somebody wants the data read? */	if ((discard = (buffer == NULL)))		buffer = &c;	while (stuffp->lock) {		xtrace(SLEEP, "*** talk: lockq/n");		interruptible_sleep_on(&stuffp->lockq);		xtrace(SLEEP, "talk: awoken/n");	}	stuffp->lock = 1;	/* An operation other then reading data destroys the	   * data already requested and remembered in stuffp->request, ... */	stuffp->valid = 0;#if MCDX_DEBUG & TALK	{		unsigned char i;		xtrace(TALK,		       "talk() %d / %d tries, res.size %d, command 0x%02x",		       tries, timeout, size, (unsigned char) cmd[0]);		for (i = 1; i < cmdlen; i++)			xtrace(TALK, " 0x%02x", cmd[i]);		xtrace(TALK, "/n");	}#endif	/*  give up if all tries are done (bad) or if the status	 *  st != -1 (good) */	for (st = -1; st == -1 && tries; tries--) {		char *bp = (char *) buffer;		size_t sz = size;		outsb(stuffp->wreg_data, cmd, cmdlen);		xtrace(TALK, "talk() command sent/n");		/* get the status byte */		if (-1 == mcdx_getval(stuffp, timeout, 0, bp)) {			xinfo("talk() %02x timed out (status), %d tr%s left/n",			     cmd[0], tries - 1, tries == 2 ? "y" : "ies");			continue;		}		st = *bp;		sz--;		if (!discard)			bp++;		xtrace(TALK, "talk() got status 0x%02x/n", st);		/* command error? */		if (e_cmderr(st)) {			xwarn("command error cmd = %02x %s /n",			      cmd[0], cmdlen > 1 ? "..." : "");			st = -1;			continue;		}		/* audio status? */		if (stuffp->audiostatus == CDROM_AUDIO_INVALID)			stuffp->audiostatus =			    e_audiobusy(st) ? CDROM_AUDIO_PLAY :			    CDROM_AUDIO_NO_STATUS;		else if (stuffp->audiostatus == CDROM_AUDIO_PLAY			 && e_audiobusy(st) == 0)			stuffp->audiostatus = CDROM_AUDIO_COMPLETED;		/* media change? */		if (e_changed(st)) {			xinfo("talk() media changed/n");			stuffp->xxx = stuffp->yyy = 1;		}		/* now actually get the data */		while (sz--) {			if (-1 == mcdx_getval(stuffp, timeout, 0, bp)) {				xinfo("talk() %02x timed out (data), %d tr%s left/n",				     cmd[0], tries - 1,				     tries == 2 ? "y" : "ies");				st = -1;				break;			}			if (!discard)				bp++;			xtrace(TALK, "talk() got 0x%02x/n", *(bp - 1));//.........这里部分代码省略.........
开发者ID:jameshilliard,项目名称:actiontec_opensrc_mi424wr-rev-ef_fw-20-19-8,代码行数:101,


示例22: mcdx_init_drive

static int __init mcdx_init_drive(int drive){	struct s_version version;	struct gendisk *disk;	struct s_drive_stuff *stuffp;	int size = sizeof(*stuffp);	char msg[80];	xtrace(INIT, "init() try drive %d/n", drive);	xtrace(INIT, "kmalloc space for stuffpt's/n");	xtrace(MALLOC, "init() malloc %d bytes/n", size);	if (!(stuffp = kzalloc(size, GFP_KERNEL))) {		xwarn("init() malloc failed/n");		return 1;	}	disk = alloc_disk(1);	if (!disk) {		xwarn("init() malloc failed/n");		kfree(stuffp);		return 1;	}	xtrace(INIT, "init() got %d bytes for drive stuff @ %p/n",	       sizeof(*stuffp), stuffp);	/* set default values */	stuffp->present = 0;	/* this should be 0 already */	stuffp->toc = NULL;	/* this should be NULL already */	/* setup our irq and i/o addresses */	stuffp->irq = irq(mcdx_drive_map[drive]);	stuffp->wreg_data = stuffp->rreg_data = port(mcdx_drive_map[drive]);	stuffp->wreg_reset = stuffp->rreg_status = stuffp->wreg_data + 1;	stuffp->wreg_hcon = stuffp->wreg_reset + 1;	stuffp->wreg_chn = stuffp->wreg_hcon + 1;	init_waitqueue_head(&stuffp->busyq);	init_waitqueue_head(&stuffp->lockq);	init_waitqueue_head(&stuffp->sleepq);	/* check if i/o addresses are available */	if (!request_region(stuffp->wreg_data, MCDX_IO_SIZE, "mcdx")) {		xwarn("0x%03x,%d: Init failed. "		      "I/O ports (0x%03x..0x%03x) already in use./n",		      stuffp->wreg_data, stuffp->irq,		      stuffp->wreg_data,		      stuffp->wreg_data + MCDX_IO_SIZE - 1);		xtrace(MALLOC, "init() free stuffp @ %p/n", stuffp);		kfree(stuffp);		put_disk(disk);		xtrace(INIT, "init() continue at next drive/n");		return 0;	/* next drive */	}	xtrace(INIT, "init() i/o port is available at 0x%03x/n"	       stuffp->wreg_data);	xtrace(INIT, "init() hardware reset/n");	mcdx_reset(stuffp, HARD, 1);	xtrace(INIT, "init() get version/n");	if (-1 == mcdx_requestversion(stuffp, &version, 4)) {		/* failed, next drive */		release_region(stuffp->wreg_data, MCDX_IO_SIZE);		xwarn("%s=0x%03x,%d: Init failed. Can't get version./n",		      MCDX, stuffp->wreg_data, stuffp->irq);		xtrace(MALLOC, "init() free stuffp @ %p/n", stuffp);		kfree(stuffp);		put_disk(disk);		xtrace(INIT, "init() continue at next drive/n");		return 0;	}	switch (version.code) {	case 'D':		stuffp->readcmd = READ2X;		stuffp->present = DOUBLE | DOOR | MULTI;		break;	case 'F':		stuffp->readcmd = READ1X;		stuffp->present = SINGLE | DOOR | MULTI;		break;	case 'M':		stuffp->readcmd = READ1X;		stuffp->present = SINGLE;		break;	default:		stuffp->present = 0;		break;	}	stuffp->playcmd = READ1X;	if (!stuffp->present) {		release_region(stuffp->wreg_data, MCDX_IO_SIZE);		xwarn("%s=0x%03x,%d: Init failed. No Mitsumi CD-ROM?./n",		      MCDX, stuffp->wreg_data, stuffp->irq);		kfree(stuffp);		put_disk(disk);//.........这里部分代码省略.........
开发者ID:Einheri,项目名称:wl500g,代码行数:101,



注:本文中的xtrace函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ xtrymalloc函数代码示例
C++ xtables_strtoui函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。