help with sendfile code

vijay singh vijjus at rocketmail.com
Thu Sep 11 15:43:11 PDT 2003


Hello hackers. What would be the FreeBSD 2.1
equivalent of the following sendfile code from
uipc_syscalls.c

	for (off = uap->offset; ; off += xfsize, sbytes +=
xfsize) {
		vm_pindex_t pindex;
		vm_offset_t pgoff;

		pindex = OFF_TO_IDX(off);
retry_lookup:
		/*
		 * Calculate the amount to transfer. Not to exceed a
page,
		 * the EOF, or the passed in nbytes.
		 */
		xfsize = obj->un_pager.vnp.vnp_size - off;

I have:

        for (off = uap->offset; ; off += xfsize,
sbytes += xfsize) {
                vm_offset_t pindex;
                vm_offset_t pgoff;
                register vn_pager_t vnp = (vn_pager_t)
obj->pager->pg_data;

                pindex = OFF_TO_IDX(off);
retry_lookup:
                /*
                 * Calculate the amount to transfer.
Not to exceed a page,
                 * the EOF, or the passed in nbytes.
                 */
                xfsize = vnp->vnp_size - off;

with OFF_TO_IDX defined as:

#define OFF_TO_IDX(off)
((vm_pindex_t)(((int64_t)(off)) >> PAGE_SHIFT))


However this seems to result in xfsize = 0. Could
someome please point out what I'm doing wrong? Any
help will be greatly appreciated. Kindly CC me.

thanks
vijay

=====
Everytime I scream, I'm killing pain.

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com


More information about the freebsd-hackers mailing list