Article 4XQ07 Open and write data to binary file in Kernel

Open and write data to binary file in Kernel

by
Ashok Selvaraj
from LinuxQuestions.org on (#4XQ07)
Hi All,

My Ask is to write data to a binary file in Kernel code.Is there any option in kernel to save data as binary file.

In userspace we have functions like fwrite() and fread() to operate on binary file, Similarly need some functions in kernel.

Used vfs_write() in order to store the data as hex. Similarly need function to store it as bin.

file = file_open(log_file, O_CREAT | O_BINARY | O_RDWR | O_APPEND, 00644);
vfs_write(file, data, size, &offset);

Used this O_BINARY option, but this doesn't help. Is there any other way to write it as binary data.?
Any help is much appreciated.

#linux #binary #vfs_write #O_BINARY

Thanks in Advance,
Ashoklatest?d=yIl2AUoC8zA latest?i=vD6__gAN5NI:XgaFyu3HaVQ:F7zBnMy latest?i=vD6__gAN5NI:XgaFyu3HaVQ:V_sGLiP latest?d=qj6IDK7rITs latest?i=vD6__gAN5NI:XgaFyu3HaVQ:gIN9vFwvD6__gAN5NI
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments