本文整理汇总了C++中elv_next_request函数的典型用法代码示例。如果您正苦于以下问题:C++ elv_next_request函数的具体用法?C++ elv_next_request怎么用?C++ elv_next_request使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了elv_next_request函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: simpleblkdrv_do_request
static void simpleblkdrv_do_request(struct request_queue *q)
{
struct request *req;
while ((req = elv_next_request(q)) != NULL)
{
if ((req->sector + req->current_nr_sectors) << 9 > BLK_BYTES)
{
printk(KERN_ERR"request error!\n");
end_request(req, 0);/*transfer fail*/
continue;
}
switch (rq_data_dir(req))
{
case READ:
memcpy(req->buffer, blkdev_data + (req->sector << 9), req->current_nr_sectors << 9);
end_request(req, 1);/*transfer ok*/
break;
case WRITE:
memcpy(blkdev_data + (req->sector << 9), req->buffer, req->current_nr_sectors << 9);
end_request(req, 1);/*transfer ok*/
break;
default:
/* No default because rq_data_dir(req) is 1 bit */
break;
}
}
}
开发者ID:cherry-wb,项目名称:quietheart,代码行数:28,代码来源:simpleblkdrv.c
示例2: omap_mbox_read
static ssize_t
omap_mbox_read(struct device *dev, struct device_attribute *attr, char *buf)
{
unsigned long flags;
struct request *rq;
mbox_msg_t *p = (mbox_msg_t *) buf;
struct omap_mbox *mbox = dev_get_drvdata(dev);
struct request_queue *q = mbox->rxq->queue;
while (1) {
spin_lock_irqsave(q->queue_lock, flags);
rq = elv_next_request(q);
spin_unlock_irqrestore(q->queue_lock, flags);
if (!rq)
break;
*p = (mbox_msg_t) rq->data;
if (blk_end_request(rq, 0, 0))
BUG();
if (unlikely(mbox_seq_test(mbox, *p))) {
pr_info("mbox: Illegal seq bit!(%08x) ignored\n", *p);
continue;
}
p++;
}
pr_debug("%02x %02x %02x %02x\n", buf[0], buf[1], buf[2], buf[3]);
return (size_t) ((char *)p - buf);
}
开发者ID:274914765,项目名称:C,代码行数:33,代码来源:mailbox.c
示例3: do_mbd_request
static void do_mbd_request(request_queue_t * q)
{
int result = 0;
struct request *req;
while ((req = elv_next_request(q)) != NULL) {
int minor = req->rq_disk->first_minor;
switch (rq_data_dir(req)) {
case READ:
result = MamboBogusDiskRead(minor,
req->buffer, req->sector,
req->current_nr_sectors);
break;
case WRITE:
result = MamboBogusDiskWrite(minor,
req->buffer, req->sector,
req->current_nr_sectors);
};
if (result)
end_request(req, 0); /* failure */
else
end_request(req, 1); /* success */
}
}
开发者ID:BackupTheBerlios,项目名称:arp2-svn,代码行数:26,代码来源:mambo_bd.c
示例4: mtd_blktrans_thread
static int mtd_blktrans_thread(void *arg)
{
struct mtd_blktrans_ops *tr = arg;
struct request_queue *rq = tr->blkcore_priv->rq;
/* we might get involved when memory gets low, so use PF_MEMALLOC */
current->flags |= PF_MEMALLOC | PF_NOFREEZE;
daemonize("%sd", tr->name);
/* daemonize() doesn't do this for us since some kernel threads
actually want to deal with signals. We can't just call
exit_sighand() since that'll cause an oops when we finally
do exit. */
spin_lock_irq(¤t->sighand->siglock);
sigfillset(¤t->blocked);
recalc_sigpending();
spin_unlock_irq(¤t->sighand->siglock);
spin_lock_irq(rq->queue_lock);
while (!tr->blkcore_priv->exiting) {
struct request *req;
struct mtd_blktrans_dev *dev;
int res = 0;
DECLARE_WAITQUEUE(wait, current);
req = elv_next_request(rq);
if (!req) {
add_wait_queue(&tr->blkcore_priv->thread_wq, &wait);
set_current_state(TASK_INTERRUPTIBLE);
spin_unlock_irq(rq->queue_lock);
schedule();
remove_wait_queue(&tr->blkcore_priv->thread_wq, &wait);
spin_lock_irq(rq->queue_lock);
continue;
}
dev = req->rq_disk->private_data;
tr = dev->tr;
spin_unlock_irq(rq->queue_lock);
down(&dev->sem);
res = do_blktrans_request(tr, dev, req);
up(&dev->sem);
spin_lock_irq(rq->queue_lock);
end_request(req, res);
}
spin_unlock_irq(rq->queue_lock);
complete_and_exit(&tr->blkcore_priv->thread_dead, 0);
}
开发者ID:jameshilliard,项目名称:actiontec_opensrc_mi424wr-rev-e-f_fw-20-10-7-5,代码行数:60,代码来源:mtd_blkdevs.c
示例5: do_ramdisk_request
static void do_ramdisk_request (request_queue_t * q)
{
static int r_cnt = 0;
static int w_cnt = 0;
struct request *req;
// printk("do_ramdisk_request = %d \n",++cnt);
while ((req = elv_next_request(q)) != NULL)
{
/*数据传输3要素 : 源,目的,长度*/
/*源/目的*/
unsigned long offset = req->sector *512;
/*目的/源*/
//req->buffer
/*长度*/
unsigned long len = req->current_nr_sectors *512;
if (rq_data_dir(req) == READ)
{
printk("do_ramdisk_request read = %d \n",++r_cnt);
memcpy(req->buffer, ramblock_buf+offset, len);
}
else
{
printk("do_ramdisk_request wirte = %d \n",++w_cnt);
memcpy(ramblock_buf+offset,req->buffer, len);
}
end_request(req, 1); /* wrap up, 0 = fail, 1 = success */
}
}
开发者ID:wareash,项目名称:jz2440_drive_and_test,代码行数:33,代码来源:ramdisk.c
示例6: Virtual_blkdev_do_request
static void Virtual_blkdev_do_request(struct request_queue *q)
{
struct request *req;
while ((req = elv_next_request(q)) != NULL)
{
if ((req->sector + req->current_nr_sectors) << 9> VIRTUAL_BLKDEV_BYTES)
{
printk(KERN_ERR VIRTUAL_BLKDEV_DISKNAME": bad request: block=%llu, count=%u\n",
(unsigned long long)req->sector,
req->current_nr_sectors);
end_request(req, 0);
continue;
}/*endif*/
switch (rq_data_dir(req))
{
case READ:
memcpy(req->buffer,Virtual_blkdev_data + (req->sector << 9),
req->current_nr_sectors << 9);
end_request(req, 1);
break;
case WRITE:
memcpy(Virtual_blkdev_data + (req->sector << 9),
req->buffer, req->current_nr_sectors << 9);
end_request(req, 1);
break;
default:
/* No default because rq_data_dir(req) is 1 bit */
break;
}
}/*endwhile*/
}
开发者ID:gatieme,项目名称:LDD-LinuxDeviceDrivers,代码行数:31,代码来源:Virtual_blkdev.c
示例7: do_z2_request
static void do_z2_request(struct request_queue *q)
{
struct request *req;
while ((req = elv_next_request(q)) != NULL) {
unsigned long start = req->sector << 9;
unsigned long len = req->current_nr_sectors << 9;
if (start + len > z2ram_size) {
printk( KERN_ERR DEVICE_NAME ": bad access: block=%lu, count=%u\n",
req->sector, req->current_nr_sectors);
end_request(req, 0);
continue;
}
while (len) {
unsigned long addr = start & Z2RAM_CHUNKMASK;
unsigned long size = Z2RAM_CHUNKSIZE - addr;
if (len < size)
size = len;
addr += z2ram_map[ start >> Z2RAM_CHUNKSHIFT ];
if (rq_data_dir(req) == READ)
memcpy(req->buffer, (char *)addr, size);
else
memcpy((char *)addr, req->buffer, size);
start += size;
len -= size;
}
end_request(req, 1);
}
}
开发者ID:PennPanda,项目名称:linux-repo,代码行数:29,代码来源:z2ram.c
示例8: virtualblockdevice_do_request
static void virtualblockdevice_do_request(struct request_queue *q)
{
struct request *req;
// printk(KERN_ALERT "VirtualBlockDevice: Entry virtualblockdevice_do_request !\n");
while( NULL != ( req = elv_next_request( q ) ) ) {
if( ( ( req->sector + req->current_nr_sectors ) << 9 ) > VIRTUALBLOCKDEVICE_DISK_CAPACITY ) {
printk(KERN_ALERT "VirtualBlockDevice: bad request: start sector: = %llu\t sector count: = %lu \n", (unsigned long long) req->sector, (unsigned long)req->current_nr_sectors);
end_request( req, 0 );
continue;
}
printk(KERN_ALERT "VirtualBlockDevice: request: start sector: = %llu\t sector count: = %lu \n", (unsigned long long) req->sector, (unsigned long)req->current_nr_sectors);
switch( rq_data_dir( req ) ) {
case READ:
memcpy( req->buffer, (virtualblockdevice_data + (req->sector << 9)), (req->current_nr_sectors << 9) );
end_request( req, 1 );
break;
case WRITE:
memcpy( (virtualblockdevice_data + (req->sector << 9)), req->buffer, (req->current_nr_sectors << 9) );
end_request( req, 1 );
break;
default:
printk(KERN_ALERT "VirtualBlockDevice: Unknown data direction !\n");
break;
}
}
}
开发者ID:winlin,项目名称:Linux-Embeded-Class-Code,代码行数:29,代码来源:virtualblockdevice.c
示例9: do_ramblock_request
static void do_ramblock_request(request_queue_t * q)
{
static int r_cnt = 0;
static int w_cnt = 0;
struct request *req;
//printk("do_ramblock_request %d\n", ++cnt);
while ((req = elv_next_request(q)) != NULL) {
/* 数据传输三要素: 源,目的,长度 */
/* 源/目的: */
unsigned long offset = req->sector * 512;
/* 目的/源: */
// req->buffer
/* 长度: */
unsigned long len = req->current_nr_sectors * 512;
if (rq_data_dir(req) == READ)
{
//printk("do_ramblock_request read %d\n", ++r_cnt);
memcpy(req->buffer, ramblock_buf+offset, len);
}
else
{
//printk("do_ramblock_request write %d\n", ++w_cnt);
memcpy(ramblock_buf+offset, req->buffer, len);
}
end_request(req, 1);
}
}
开发者ID:commshare,项目名称:ARMDriver,代码行数:33,代码来源:ramblock.c
示例10: do_ramblock_request
static void do_ramblock_request(request_queue_t *q)
{
struct request *req;
while ((req = elv_next_request(q)) != NULL)
{
/* 数据传输三要素:源,目的,长度 */
/* 源/目的 */
unsigned long offset = req->sector << 9;
/* 目的/源 */
/* req->buffer */
/* 长度 */
unsigned long len = req->current_nr_sectors << 9;
if (rq_data_dir(req) == READ)
{
memcpy(req->buffer, ramblock_buf+offset, len);
}
else
{
memcpy(ramblock_buf+offset, req->buffer, len);
}
end_request(req, 1);
}
}
开发者ID:54shady,项目名称:mini2440_drv,代码行数:29,代码来源:ramblock.c
示例11: mmc_request
/*
* Generic MMC request handler. This is called for any queue on a
* particular host. When the host is not busy, we look for a request
* on any queue on this host, and attempt to issue it. This may
* not be the queue we were asked to process.
*/
static void mmc_request(struct request_queue *q)
{
struct mmc_queue *mq = q->queuedata;
struct request *req;
int ret, count = 0;
if (!mq) {
printk(KERN_ERR "MMC: killing requests for dead queue\n");
while ((req = elv_next_request(q)) != NULL) {
do {
ret = end_that_request_chunk(req, 0,
req->current_nr_sectors << 9);
count++;
if (count > 100) {
/* dequeue the request in the queue */
printk(KERN_ERR "dequeue req\n");
blkdev_dequeue_request(req);
break;
}
count++;
} while (ret);
}
return;
}
if (!mq->req)
wake_up_process(mq->thread);
}
开发者ID:R0-Developers,项目名称:YP-R0_Kernel,代码行数:33,代码来源:queue.c
示例12: mem_block_requeut_fn
static void mem_block_requeut_fn(struct request_queue* q)
{
struct request* req = NULL;
while(NULL != (req = elv_next_request(q)))
{
if(req -> sector + req -> current_nr_sectors > get_capacity(req->rq_disk))
{
end_request(req,0);
// return 0;
LogPath();
continue;
}
// Log("sector:%d,current_nr_sectors:%d",req->sector,req->current_nr_sectors);
switch(rq_data_dir(req))
{
case READ:
{
memcpy(req->buffer,g_mem_buf + (req->sector << 9),req->current_nr_sectors << 9);
end_request(req,1);
break;
}
case WRITE:
{
memcpy(g_mem_buf + (req->sector << 9), req->buffer,req->current_nr_sectors << 9);
end_request(req,1);
break;
}
default:
Log("[Error] Unknown request...");
break;
// return 0;
}
}
}
开发者ID:laitianli,项目名称:loongson-linux-2.6.36-3_mips,代码行数:34,代码来源:block_demo.c
示例13: mbox_tx_work
static void mbox_tx_work(struct work_struct *work)
{
int ret;
struct request *rq;
struct omap_mbox_queue *mq = container_of(work,
struct omap_mbox_queue, work);
struct omap_mbox *mbox = mq->queue->queuedata;
struct request_queue *q = mbox->txq->queue;
while (1) {
spin_lock(q->queue_lock);
rq = elv_next_request(q);
spin_unlock(q->queue_lock);
if (!rq)
break;
ret = __mbox_msg_send(mbox, (mbox_msg_t) rq->data, rq->special);
if (ret) {
enable_mbox_irq(mbox, IRQ_TX);
return;
}
spin_lock(q->queue_lock);
if (__blk_end_request(rq, 0, 0))
BUG();
spin_unlock(q->queue_lock);
}
}
开发者ID:274914765,项目名称:C,代码行数:29,代码来源:mailbox.c
示例14: mbox_rx_work
/*
* Message receiver(workqueue)
*/
static void mbox_rx_work(struct work_struct *work)
{
struct omap_mbox_queue *mq =
container_of(work, struct omap_mbox_queue, work);
struct omap_mbox *mbox = mq->queue->queuedata;
struct request_queue *q = mbox->rxq->queue;
struct request *rq;
mbox_msg_t msg;
unsigned long flags;
if (mbox->rxq->callback == NULL) {
sysfs_notify(&mbox->dev.kobj, NULL, "mbox");
return;
}
while (1) {
spin_lock_irqsave(q->queue_lock, flags);
rq = elv_next_request(q);
spin_unlock_irqrestore(q->queue_lock, flags);
if (!rq)
break;
msg = (mbox_msg_t) rq->data;
if (blk_end_request(rq, 0, 0))
BUG();
mbox->rxq->callback((void *)msg);
}
}
开发者ID:274914765,项目名称:C,代码行数:33,代码来源:mailbox.c
示例15: request_exemple
static void request_exemple(request_queue_t * rqueue)
{
unsigned long secteur_debut;
unsigned long nb_secteurs;
struct request * rq;
while ((rq = elv_next_request(rqueue)) != NULL) {
if (! blk_fs_request(rq)) {
end_request(rq, 0);
continue;
}
/*
* Les numeros de secteurs pour le transfert correspondent
* a des secteurs de 512 octets... -> convertir.
*/
secteur_debut = rq->sector * 512 / lg_sect_exemple;
nb_secteurs = rq->current_nr_sectors * 512 / lg_sect_exemple;
if (secteur_debut + nb_secteurs > nb_sect_exemple) {
end_request(rq,1);
continue;
}
if (rq_data_dir(rq)) /* write */
memmove(& data_exemple[secteur_debut * lg_sect_exemple],
rq->buffer,
nb_secteurs * lg_sect_exemple);
else /* read */
memmove(rq->buffer,
& data_exemple[secteur_debut * lg_sect_exemple],
nb_secteurs * lg_sect_exemple);
end_request(rq, 1);
}
}
开发者ID:YorkZ,项目名称:docs_utils,代码行数:33,代码来源:exemple_05.c
示例16: osprd_process_request_queue
static void osprd_process_request_queue(request_queue_t *q)
{
osprd_info_t *d = (osprd_info_t *) q->queuedata;
struct request *req;
while ((req = elv_next_request(q)) != NULL)
osprd_process_request(d, req);
}
开发者ID:metropolisDT,项目名称:CS111,代码行数:8,代码来源:osprd.c
示例17: start_request
static void start_request(struct floppy_state *fs)
{
struct request *req;
unsigned long x;
if (fs->state == idle && fs->wanted) {
fs->state = available;
wake_up(&fs->wait);
return;
}
while (fs->state == idle && (req = elv_next_request(swim3_queue))) {
#if 0
printk("do_fd_req: dev=%s cmd=%d sec=%ld nr_sec=%ld buf=%p\n",
req->rq_disk->disk_name, req->cmd,
(long)req->sector, req->nr_sectors, req->buffer);
printk(" rq_status=%d errors=%d current_nr_sectors=%ld\n",
req->rq_status, req->errors, req->current_nr_sectors);
#endif
if (req->sector < 0 || req->sector >= fs->total_secs) {
end_request(req, 0);
continue;
}
if (req->current_nr_sectors == 0) {
end_request(req, 1);
continue;
}
if (fs->ejected) {
end_request(req, 0);
continue;
}
if (rq_data_dir(req) == WRITE) {
if (fs->write_prot < 0)
fs->write_prot = swim3_readbit(fs, WRITE_PROT);
if (fs->write_prot) {
end_request(req, 0);
continue;
}
}
/* Do not remove the cast. req->sector is now a sector_t and
* can be 64 bits, but it will never go past 32 bits for this
* driver anyway, so we can safely cast it down and not have
* to do a 64/32 division
*/
fs->req_cyl = ((long)req->sector) / fs->secpercyl;
x = ((long)req->sector) % fs->secpercyl;
fs->head = x / fs->secpertrack;
fs->req_sector = x % fs->secpertrack + 1;
fd_req = req;
fs->state = do_transfer;
fs->retries = 0;
act(fs);
}
}
开发者ID:BackupTheBerlios,项目名称:tew632-brp-svn,代码行数:57,代码来源:swim3.c
示例18: tbio_request
static void tbio_request(request_queue_t *q)
{
struct request *req;
while (( req = elv_next_request(q)) != NULL) {
tbio_transfer(req , &Device);
end_request(req , 1);
}
}
开发者ID:ystk,项目名称:debian-ltp,代码行数:10,代码来源:tbio.c
示例19: start_request
static void start_request(struct floppy_state *fs)
{
struct request *req;
unsigned long x;
if (fs->state == idle && fs->wanted) {
fs->state = available;
wake_up(&fs->wait);
return;
}
while (fs->state == idle && (req = elv_next_request(swim3_queue))) {
#if 0
printk("do_fd_req: dev=%s cmd=%d sec=%ld nr_sec=%ld buf=%p\n",
req->rq_disk->disk_name, req->cmd,
req->sector, req->nr_sectors, req->buffer);
printk(" rq_status=%d errors=%d current_nr_sectors=%ld\n",
req->rq_status, req->errors, req->current_nr_sectors);
#endif
if (req->sector < 0 || req->sector >= fs->total_secs) {
end_request(req, 0);
continue;
}
if (req->current_nr_sectors == 0) {
end_request(req, 1);
continue;
}
if (fs->ejected) {
end_request(req, 0);
continue;
}
if (rq_data_dir(req) == WRITE) {
if (fs->write_prot < 0)
fs->write_prot = swim3_readbit(fs, WRITE_PROT);
if (fs->write_prot) {
end_request(req, 0);
continue;
}
}
fs->req_cyl = req->sector / fs->secpercyl;
x = req->sector % fs->secpercyl;
fs->head = x / fs->secpertrack;
fs->req_sector = x % fs->secpertrack + 1;
fd_req = req;
fs->state = do_transfer;
fs->retries = 0;
act(fs);
}
}
开发者ID:sarnobat,项目名称:knoppix,代码行数:52,代码来源:swim3.c
示例20: ubiblk_request
/*
* The simple form of the request function.
*/
static void ubiblk_request(request_queue_t *q)
{
struct request *req;
while ((req = elv_next_request(q)) != NULL) {
struct ubiblk_dev *dev = req->rq_disk->private_data;
if(! blk_fs_request(req)) {
printk (KERN_NOTICE "Skip non-fs request\n");
end_request(req, 0);
continue;
}
ubiblk_transfer(dev, req->sector, req->current_nr_sectors,
req->buffer, rq_data_dir(req));
end_request(req, 1);
}
}
开发者ID:BackupTheBerlios,项目名称:opendidj,代码行数:19,代码来源:ubiblock.c
注:本文中的elv_next_request函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论