*参照元 [#hb74e1d0]
#backlinks

*説明 [#a2515283]
-パス: [[linux-2.6.33/mm/filemap.c]]

-FIXME: これは何?
--説明


**引数 [#pb4bbd6e]
-
-struct kiocb *iocb
--
--[[linux-2.6.33/kiocb]]
-const struct iovec *iov
--
--[[linux-2.6.33/iovec]]
-unsigned long nr_segs
--
-loff_t pos
--


**返り値 [#k23bc63a]
-
-ssize_t
--


**参考 [#cfda8061]


*実装 [#i5f4004c]
 /**
  * generic_file_aio_read - generic filesystem read routine
  * @iocb:	kernel I/O control block
  * @iov:	io vector request
  * @nr_segs:	number of segments in the iovec
  * @pos:	current file position
  *
  * This is the "read()" routine for all filesystems
  * that can use the page cache directly.
  */
 ssize_t
 generic_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
 		unsigned long nr_segs, loff_t pos)
 {
 	struct file *filp = iocb->ki_filp;
 	ssize_t retval;
 	unsigned long seg;
 	size_t count;
 	loff_t *ppos = &iocb->ki_pos;
 
-
--[[linux-2.6.33/file]]

 	count = 0;
 	retval = generic_segment_checks(iov, &nr_segs, &count, VERIFY_WRITE);
 	if (retval)
 		return retval;
 
-
--[[linux-2.6.33/generic_segment_checks()]]

 	/* coalesce the iovecs and go direct-to-BIO for O_DIRECT */
 	if (filp->f_flags & O_DIRECT) {
 		loff_t size;
 		struct address_space *mapping;
 		struct inode *inode;
 
-
--[[linux-2.6.33/address_space]]
-
--[[linux-2.6.33/inode]]

 		mapping = filp->f_mapping;
 		inode = mapping->host;
 		if (!count)
 			goto out; /* skip atime */
 		size = i_size_read(inode);
-
--[[linux-2.6.33/i_size_read()]]

 		if (pos < size) {
 			retval = filemap_write_and_wait_range(mapping, pos,
 					pos + iov_length(iov, nr_segs) - 1);
-
--[[linux-2.6.33/filemap_write_and_wait_range()]]

 			if (!retval) {
 				retval = mapping->a_ops->direct_IO(READ, iocb,
 							iov, pos, nr_segs);
-mapping->a_ops は  型
--[[linux-2.6.33/]]
-mapping->a_ops は address_space_operations 型
--[[linux-2.6.33/address_space_operations]]

 			}
 			if (retval > 0)
 				*ppos = pos + retval;
 			if (retval) {
 				file_accessed(filp);
 				goto out;
 			}
-
--[[linux-2.6.33/file_accessed()]]

 		}
 	}
 
 	for (seg = 0; seg < nr_segs; seg++) {
 		read_descriptor_t desc;
 
-
--[[linux-2.6.33/read_descriptor_t]]

 		desc.written = 0;
 		desc.arg.buf = iov[seg].iov_base;
 		desc.count = iov[seg].iov_len;
 		if (desc.count == 0)
 			continue;
 		desc.error = 0;
 		do_generic_file_read(filp, ppos, &desc, file_read_actor);
-
--[[linux-2.6.33/do_generic_file_read()]]

 		retval += desc.written;
 		if (desc.error) {
 			retval = retval ?: desc.error;
 			break;
 		}
 		if (desc.count > 0)
 			break;
 	}
 out:
 	return retval;
 }
 EXPORT_SYMBOL(generic_file_aio_read);
-特にライセンスを区別せずシンボルを公開する。
--[[linux-2.6.33/EXPORT_SYMBOL()]]


*コメント [#j620b89e]


トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS