From owner-freebsd-hackers Wed May 17 16:39:24 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from apollo.backplane.com (apollo.backplane.com [216.240.41.2]) by hub.freebsd.org (Postfix) with ESMTP id D8F8037B5B3 for ; Wed, 17 May 2000 16:39:20 -0700 (PDT) (envelope-from dillon@apollo.backplane.com) Received: (from dillon@localhost) by apollo.backplane.com (8.9.3/8.9.1) id QAA28046; Wed, 17 May 2000 16:24:40 -0700 (PDT) (envelope-from dillon) Date: Wed, 17 May 2000 16:24:40 -0700 (PDT) From: Matthew Dillon Message-Id: <200005172324.QAA28046@apollo.backplane.com> To: Joy Ganguly Cc: Alfred Perlstein , freebsd-hackers Subject: Re: Question about file write???? References: <20000517160746.12768.qmail@www0a.netaddress.usa.net> <20000517102516.B14968@fw.wintelcom.net> <3922DB0F.9D9095C9@falcon.niksun.com> <20000517135644.D14968@fw.wintelcom.net> <39231E06.31DFB153@falcon.niksun.com> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG :i have a device buffer in contiguous physical memory. i want to write :that buffer into :a file disk. for that ive written a simple ioctl which works similar to :the syscall :write. except that it transfers from kernel space instead of user :space. my user :program calls this ioctl with the write file desc....the ioctl calls :fp->f_ops->fo_write after setting up the uio to do the transfer. : :earlier the user code looked like:- I think it would be a whole lot easier to implement mmap() on the device, then allow the user process to mmap() the device buffer and read() and write() it directly. I don't think you need to implement any ioctl's for this problem. fd = open device ptr = mmap(...) fd = open file read(fd, ptr, BUFSIZE) read from file, store into device buf ... write(fd, ptr, BUFSIZE) read from device buf, store into file -Matt To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message