On Thu, Feb 9, 2017 at 7:44 PM, Andre Renaud <andre@ignavus.net> wrote:
On Thu, 9 Feb 2017 at 17:45 Charles Manning <cdhmanning@gmail.com> wrote:
On Thu, Feb 9, 2017 at 5:03 PM, Andre Renaud <andre@ignavus.net> wrote:
Hi,
The current /proc/yaffs support for Linux seems to be broken on 4.8, I think because of the way read-offsets are dealt with and the limited internal buffer (512B). Given that seq_file predates Linux 2.4, would there be a problem just dropping support for kernels that predate this, and then moving the whole thing over to seq_file, or are there enough legacy installations that still require this support?

I doubt anyone is using 2.4 these days, but would a big #if work?

#if VERSION_LESS_THAN_X
 static struct proc_dir_entry *my_proc_entry;

static char *yaffs_dump_dev_part0(char *buf, struct yaffs_dev *dev)

...
#else

new stuff

#endif

A big #if would work fine, but it would result in a reasonable amount of duplicate code - I'm not sure which is the preferred scenario. I'll put something together and see how it looks.

Last night I thought about a different way to do this:

Allocate a buffer (8k??). Use a common function to sprintf into that buffer (ie. essentially the guts of the current functions)  then just use either procfs or seqfs interfaces to send back lumps from the buffer.