Xiu-Yan Wang wrote:
> 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?

In that case I strongly suggest you work on extending the existing 
fwflash program and infrastructure to support your device class rather 
than inventing yet another firmware download capability for 
Solaris/OpenSolaris.

-- 
Darren J Moffat
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to