Hi Darren,

Darren J Moffat wrote:
> yang wrote:
>> Hi all,
>> when define _KERNEL, I use:
>> FILE * fp;
>> fp=fileopen("path","w");
> 
> I assume you mean fopen().  That is a stdio interface which exists only 
> in userland via libc.
> 
> When you say you defined _KERNEL are you actually building a kernel 
> module ?  If not then you should not define _KERNEL.
> 
>> So in C files , how can I open a fild and write something into it in _KERNEL 
>> stat?
> 
> It is quite difficult and usually avoided to read files in the kernel. 
> Instead a userland helper program is often used to read and parse the 
> file into structured content and pass it over an ioctl or syscall to the 
> kernel driver.

There does have the requirement to read files in the kernel.

We're working on a 10Gb Ethernet driver and we want to let the driver
update the firmware on-the-fly if needed when the driver is loaded.
Save the firmware image in a separate file and let the driver read it
with kobj_open_file() should be an option. But kobj_open_file() is not a
stable interface. So what's the best practice for the task like this?

Thanks,
Lucy

> 

_______________________________________________
opensolaris-code mailing list
opensolaris-code@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to