• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ end_request函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: osprd_process_request

/*
 * osprd_process_request(d, req)
 *   Called when the user reads or writes a sector.
 *   Should perform the read or write, as appropriate.
 */
static void osprd_process_request(osprd_info_t *d, struct request *req)
{
    if (!blk_fs_request(req)) {
        end_request(req, 0);
        return;
    }

    // EXERCISE: Perform the read or write request by copying data between
    // our data array and the request's buffer.
    // Hint: The 'struct request' argument tells you what kind of request
    // this is, and which sectors are being read or written.
    // Read about 'struct request' in <linux/blkdev.h>.
    // Consider the 'req->sector', 'req->current_nr_sectors', and
    // 'req->buffer' members, and the rq_data_dir() function.

    // Your code here.

    long int sector_offset = req->sector * SECTOR_SIZE;
    long int request_size = req->current_nr_sectors * SECTOR_SIZE;

    if (rq_data_dir(req) == READ) {
        memcpy(req->buffer, d->data + sector_offset, request_size);
    } else {
        memcpy(d->data + sector_offset, req->buffer, request_size);
    }

    // eprintk("Should process request...\n");

    end_request(req, 1);
}
开发者ID:jacobnisnevich,项目名称:ramdisk-lab,代码行数:35,代码来源:osprd.c


示例2: 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


示例3: osprd_process_request

/*
 * osprd_process_request(d, req)
 *   Called when the user reads or writes a sector.
 *   Should perform the read or write, as appropriate.
 */
static void osprd_process_request(osprd_info_t *d, struct request *req)
{
	if (!blk_fs_request(req)) {
		end_request(req, 0);
		return;
	}

	// EXERCISE: Perform the read or write request by copying data between
	// our data array and the request's buffer.
	// Hint: The 'struct request' argument tells you what kind of request
	// this is, and which sectors are being read or written.
	// Read about 'struct request' in <linux/blkdev.h>.
	// Consider the 'req->sector', 'req->current_nr_sectors', and
	// 'req->buffer' members, and the rq_data_dir() function.

	// Your code here.
	unsigned request_type;
	uint8_t *data_ptr;
	request_type = rq_data_dir(req);
	data_ptr = d->data + req->sector * SECTOR_SIZE;
	//eprintk("passwd_hash: %d\n", d->passwd_hash);
	if (request_type == READ) {
		memcpy((void*)req->buffer, (void*)data_ptr,
			req->current_nr_sectors * SECTOR_SIZE);
	}
	else if (request_type == WRITE) {
		memcpy((void*)data_ptr, (void*)req->buffer,
			req->current_nr_sectors * SECTOR_SIZE);
	}
	//eprintk("Should process request...\n");

	end_request(req, 1);
}
开发者ID:m1c0l,项目名称:ramdisk,代码行数:38,代码来源:osprd.c


示例4: osprd_process_request

/*
 * osprd_process_request(d, req)
 *   Called when the user reads or writes a sector.
 *   Should perform the read or write, as appropriate.
 */
static void osprd_process_request(osprd_info_t *d, struct request *req)
{
	sector_t offset = req->sector * SECTOR_SIZE;
	if (!blk_fs_request(req)) {
		end_request(req, 0);
		return;
	}

	// EXERCISE: Perform the read or write request by copying data between
	// our data array and the request's buffer.
	// Hint: The 'struct request' argument tells you what kind of request
	// this is, and which sectors are being read or written.
	// Read about 'struct request' in <linux/blkdev.h>.
	// Consider the 'req->sector', 'req->current_nr_sectors', and
	// 'req->buffer' members, and the rq_data_dir() function.

	// Your code here.
	// Calculate offset per ramdisk
	if(rq_data_dir(req)==WRITE){
		// Write - copy contents of req to d
		memcpy(&(d->data[offset]), req->buffer,
				req->current_nr_sectors * SECTOR_SIZE);
	} else {
		// Read - copy contents of d to req
		memcpy(req->buffer, &(d->data[offset]), 
				req->current_nr_sectors * SECTOR_SIZE);
	}
	end_request(req, 1);
}
开发者ID:smanikar,项目名称:ramdisk,代码行数:34,代码来源:osprd.c


示例5: do_mcd_request

static void do_mcd_request(request_queue_t * q)
{
	test2(printk(" do_mcd_request(%ld+%ld)\n", CURRENT->sector,
	       CURRENT->nr_sectors));

		mcd_transfer_is_active = 1;
	while (current_valid()) {
		mcd_transfer();
		if (CURRENT->nr_sectors == 0) {
			end_request(CURRENT, 1);
		} else {
			mcd_buf_out = -1;	/* Want to read a block not in buffer */
			if (mcd_state == MCD_S_IDLE) {
				if (!tocUpToDate) {
					if (updateToc() < 0) {
						while (current_valid())
							end_request(CURRENT, 0);
						break;
					}
				}
				mcd_state = MCD_S_START;
				McdTries = 5;
				mcd_timer.function = mcd_poll;
				mod_timer(&mcd_timer, jiffies + 1);
			}
			break;
		}
	}
	mcd_transfer_is_active = 0;
	test2(printk(" do_mcd_request ends\n"));
}
开发者ID:NandanPhadke,项目名称:oslab,代码行数:31,代码来源:mcd.c


示例6: do_pd_write_done

static void do_pd_write_done( void )

{       int	unit = pd_unit;
	long    saved_flags;

        if (pd_wait_for(unit,STAT_READY,"do_pd_write_done") & STAT_ERR) {
                pi_disconnect(PI);
                if (pd_retries < PD_MAX_RETRIES) {
                        pd_retries++;
                        pi_do_claimed(PI,do_pd_write_start);
                        return;
                }
		spin_lock_irqsave(&io_request_lock,saved_flags);
                end_request(0);
                pd_busy = 0;
		do_pd_request(NULL);
		spin_unlock_irqrestore(&io_request_lock,saved_flags);
                return;
        }
        pi_disconnect(PI);
	spin_lock_irqsave(&io_request_lock,saved_flags);
        end_request(1);
        pd_busy = 0;
	do_pd_request(NULL);
	spin_unlock_irqrestore(&io_request_lock,saved_flags);
}
开发者ID:TitaniumBoy,项目名称:lin,代码行数:26,代码来源:pd.c


示例7: 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


示例8: get_address

 void partition_resolver_simple::handle_pending_requests(std::deque<request_context_ptr>& reqs, error_code err)
 {
     for (auto& req : reqs)
     {
         if (err == ERR_OK)
         {
             rpc_address addr;
             err = get_address(req->partition_index, addr);
             if (err == ERR_OK)
             {
                 end_request(std::move(req), err, addr);
             }
             else
             {
                 call(std::move(req), true);
             }
         }
         else if (err == ERR_HANDLER_NOT_FOUND)
         {
             end_request(std::move(req), err, rpc_address());
         }
         else
         {
             call(std::move(req), true);
         }
     }
     reqs.clear();
 }
开发者ID:Microsoft,项目名称:rDSN,代码行数:28,代码来源:partition_resolver_simple.cpp


示例9: osprd_process_request

/*
 * osprd_process_request(d, req)
 *	 Called when the user reads or writes a sector.
 *	 Should perform the read or write, as appropriate.
 */
static void osprd_process_request(osprd_info_t *d, struct request *req)
{
	void *data_offset;
	unsigned int data_length;

	if (!blk_fs_request(req)) {
		end_request(req, 0);
		return;
	}

	// EXERCISE: Perform the read or write request by copying data between
	// our data array and the request's buffer.
	// Hint: The 'struct request' argument tells you what kind of request
	// this is, and which sectors are being read or written.
	// Read about 'struct request' in <linux/blkdev.h>.
	// Consider the 'req->sector', 'req->current_nr_sectors', and
	// 'req->buffer' members, and the rq_data_dir() function.

	data_offset = d->data + (SECTOR_SIZE * req->sector);
	data_length = req->current_nr_sectors * SECTOR_SIZE;

	// TODO: include a test for out-of-range read/writes
	if (rq_data_dir(req) == WRITE)
		memcpy(data_offset, req->buffer, data_length);
	else if (rq_data_dir(req) == READ)
		memcpy(req->buffer, data_offset, data_length);
	else {
		eprintk("Unrecognized command.\n");
		end_request(req, 0);
	}

	end_request(req, 1);
}
开发者ID:akhahaha,项目名称:os-ramdisk,代码行数:38,代码来源:osprd.c


示例10: 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


示例11: 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


示例12: 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


示例13: do_pd_read_drq

static void do_pd_read_drq( void )

{       int	unit = pd_unit;
	long    saved_flags;

	while (1) {
            if (pd_wait_for(unit,STAT_DRQ,"do_pd_read_drq") & STAT_ERR) {
                pi_disconnect(PI);
                if (pd_retries < PD_MAX_RETRIES) {
                        pd_retries++;
                        pi_do_claimed(PI,do_pd_read_start);
                        return;
                }
		spin_lock_irqsave(&io_request_lock,saved_flags);
                end_request(0);
                pd_busy = 0;
		do_pd_request(NULL);
		spin_unlock_irqrestore(&io_request_lock,saved_flags);
                return;
            }
            pi_read_block(PI,pd_buf,512);
            pd_count--; pd_run--;
            pd_buf += 512;
	    pd_block++;
	    if (!pd_run) break;
	    if (!pd_count) pd_next_buf(unit);
        }
        pi_disconnect(PI);
	spin_lock_irqsave(&io_request_lock,saved_flags);
        end_request(1);
        pd_busy = 0;
	do_pd_request(NULL);
	spin_unlock_irqrestore(&io_request_lock,saved_flags);
}
开发者ID:TitaniumBoy,项目名称:lin,代码行数:34,代码来源:pd.c


示例14: 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


示例15: do_pd_request

static void do_pd_request (request_queue_t * q)
{
	int	unit;

        if (pd_busy) return;
repeat:
        if (QUEUE_EMPTY || (CURRENT->rq_status == RQ_INACTIVE)) return;
        INIT_REQUEST;

        pd_dev = minor(CURRENT->rq_dev);
	pd_unit = unit = DEVICE_NR(CURRENT->rq_dev);
        pd_block = CURRENT->sector;
        pd_run = CURRENT->nr_sectors;
        pd_count = CURRENT->current_nr_sectors;

        if ((pd_dev >= PD_DEVS) || 
	    ((pd_block+pd_count) > pd_hd[pd_dev].nr_sects)) {
                end_request(0);
                goto repeat;
        }

	pd_cmd = rq_data_dir(CURRENT);
        pd_buf = CURRENT->buffer;
        pd_retries = 0;

	pd_busy = 1;
        if (pd_cmd == READ) pi_do_claimed(PI,do_pd_read);
        else if (pd_cmd == WRITE) pi_do_claimed(PI,do_pd_write);
        else {  pd_busy = 0;
		end_request(0);
                goto repeat;
        }
}
开发者ID:fgeraci,项目名称:cs518-sched,代码行数:33,代码来源:pd.c


示例16: osprd_process_request

/*
 * osprd_process_request(d, req)
 *   Called when the user reads or writes a sector.
 *   Should perform the read or write, as appropriate.
 */
static void osprd_process_request(osprd_info_t *d, struct request *req)
{
	if (!blk_fs_request(req)) {
		end_request(req, 0);
		return;
	}

	// EXERCISE: Perform the read or write request by copying data between
	// our data array and the request's buffer.
	// Hint: The 'struct request' argument tells you what kind of request
	// this is, and which sectors are being read or written.
	// Read about 'struct request' in <linux/blkdev.h>.
	// Consider the 'req->sector', 'req->current_nr_sectors', and
	// 'req->buffer' members, and the rq_data_dir() function.

	// Your code here.
    
    int offset = req->sector * SECTOR_SIZE;
    int bytes = req->current_nr_sectors * SECTOR_SIZE;
    // current_nr_sectors = number of sectors that is requested
    
    // rq_data_dir will tell if its a read or write
    if (rq_data_dir(req) == WRITE) memcpy(d->data + offset, req->buffer, bytes);
    else if (rq_data_dir(req) == READ) memcpy(req->buffer, d->data + offset, bytes);
    else eprintk("Must be read or written");

	end_request(req, 1);
}
开发者ID:jeffreytai,项目名称:OS-Sectors,代码行数:33,代码来源:osprd.c


示例17: osprd_process_request

/*
 * osprd_process_request(d, req)
 *   Called when the user reads or writes a sector.
 *   Should perform the read or write, as appropriate.
 */
static void osprd_process_request(osprd_info_t *d, struct request *req)
{
	if (!blk_fs_request(req)) {
		end_request(req, 0);
		return;
	}

	// DONE EXERCISE: Perform the read or write request by copying data between
	// our data array and the request's buffer.
	// Hint: The 'struct request' argument tells you what kind of request
	// this is, and which sectors are being read or written.
	// Read about 'struct request' in <linux/blkdev.h>.
	// Consider the 'req->sector', 'req->current_nr_sectors', and
	// 'req->buffer' members, and the rq_data_dir() function.

	// Your code here.

	// compute the offset, set pointer to correct region
	uint8_t *dataPtr = d->data + (req->sector) * SECTOR_SIZE;
	
	// check if it's read or write and copy data
	unsigned int requestType = rq_data_dir(req);

	if(requestType == READ)
		memcpy((void*) req->buffer, (void*)dataPtr, req->current_nr_sectors * SECTOR_SIZE);
	else if (requestType == WRITE)
		memcpy((void*)dataPtr, (void*) req->buffer, req->current_nr_sectors * SECTOR_SIZE);

	//eprintk("Should process request...\n");
	end_request(req, 1);
}
开发者ID:123cristen,项目名称:cs111,代码行数:36,代码来源:osprd.c


示例18: 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


示例19: osprd_process_request

/*
 * osprd_process_request(d, req)
 *   Called when the user reads or writes a sector.
 *   Should perform the read or write, as appropriate.
 */
static void osprd_process_request(osprd_info_t *d, struct request *req)
{
  size_t offset;
  size_t num_bytes;

	if (!blk_fs_request(req)) {
		end_request(req, 0);
		return;
	}

	// EXERCISE: Perform the read or write request by copying data between
	// our data array and the request's buffer.
	// Hint: The 'struct request' argument tells you what kind of request
	// this is, and which sectors are being read or written.
	// Read about 'struct request' in <linux/blkdev.h>.
	// Consider the 'req->sector', 'req->current_nr_sectors', and
	// 'req->buffer' members, and the rq_data_dir() function.

  if (req->sector < 0 || req->sector >= nsectors)
  {
    // sector_t is defined as an unsigned long in <linux/types.h>
    eprintk("Invalid sector requested: [%lu]. max sectors: [%i]\n", (unsigned long)req->sector, nsectors);
    end_request(req, 0);
  }

  offset = req->sector * SECTOR_SIZE;

  // If the number of requested sectors would reach the end of the disk
  // use as many sectors as possible until the end is reached
  if(req->sector + req->current_nr_sectors > nsectors)
  {
    num_bytes = (nsectors - req->sector) * SECTOR_SIZE;
    eprintk("Requested sector [%lu] with [%u] additional sectors.\n", (unsigned long)req->sector, req->current_nr_sectors);
    eprintk("Using [%u] additional sectors instead.\n", num_bytes / SECTOR_SIZE);
  }
  else
  {
    num_bytes = req->current_nr_sectors * SECTOR_SIZE;
  }

  // According to http://www.makelinux.net/ldd3/chp-16-sect-3
  // it is save to dereference req->buffer and write to it.

  // Note from @ipetkov: I'm not sure if req->buffer needs to
  // be resized at all, I'm assuming linux will allocate the
  // memory before the request is sent. No issues are apparent
  // from the first 8 default test cases.
  spin_lock(&d->mutex);

  if(rq_data_dir(req) == READ)
    memcpy(req->buffer, d->data + offset, num_bytes);
  else // WRITE
    memcpy(d->data + offset, req->buffer, num_bytes);

  spin_unlock(&d->mutex);

	end_request(req, 1);
}
开发者ID:aamoyg,项目名称:ucla-cs111,代码行数:63,代码来源:osprd.c


示例20: 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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ end_time函数代码示例发布时间:2022-05-30
下一篇:
C++ end_page_writeback函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap