Date: Fri, 20 Mar 2020 12:39:42 -0700 From: John-Mark Gurney <jmg@funkthat.com> To: Arpan Palit <babupalit@gmail.com> Cc: freebsd-hackers@freebsd.org, freebsd-questions@freebsd.org, freebsd-drivers@freebsd.org Subject: Re: How to access a user space file from kernel space in FreeBSD. Message-ID: <20200320193942.GL4213@funkthat.com> In-Reply-To: <CAF3txfi1mNcmQEFDfOx01AA2aWza1Fteb7fisC%2BtWVQccoV77Q@mail.gmail.com> References: <CAF3txfi1mNcmQEFDfOx01AA2aWza1Fteb7fisC%2BtWVQccoV77Q@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Arpan Palit wrote this message on Fri, Mar 20, 2020 at 20:10 +0530: > Hi all, > > I am working on (kernel)driver ioctl implementation for file read/write, > where I need to know what are API's which can expose to read,write and > close user space file from kernel space. In general I need to know the > answer for the below questions. > > i). How to open a user space file from driver(kernel space) ? > ii). How to create a new user space file from driver(kernel space) ? > iii). How to get file parameters like size of the file ? > iv). How to read/write the files from the driver(kernel space) ? The core dumping routines do something similar, so you can look at that code: https://svnweb.freebsd.org/base/head/sys/kern/kern_sig.c?annotate=358856 Are you trying to open/write a file on behalf of a process? or just need to access the file system from your driver? If you're just needing this to load firmware for a device, you should look at the firmware(9) infrastructure that already exists: https://www.freebsd.org/cgi/man.cgi?query=firmware&manpath=FreeBSD+12.1-RELEASE+and+Ports -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not."
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20200320193942.GL4213>