[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freebsd-hackers
Subject:    Re: How to access a user space file from kernel space in FreeBSD.
From:       John-Mark Gurney <jmg () funkthat ! com>
Date:       2020-03-20 19:39:42
Message-ID: 20200320193942.GL4213 () funkthat ! com
[Download RAW message or body]

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."
_______________________________________________
freebsd-hackers@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic