open() and mmap() from the driver

From: Dmitry Shmidt
Date: Tue Feb 10 2004 - 01:02:58 EST


Hi,

I want to access file from the driver.
In user application I can access file through the pointer with the help of:
----------------------------------------------------------------
fd = open( "myfile", O_RDWR );
myptr = mmap( NULL, mysize, PROT_READ + PROT_WRITE, MAP_SHARED, fd, 0 );
...
msync( myptr, mysize, MS_SYNC );
munmap( myptr, mysize );
-----------------------------------------------------------------

Generally speaking I can use:
-----------------------------------------------------------------
filp_open(filename);
vmalloc(filesize);
kernel_read() in loop
... Do something with the image in memory ...
And then I can
kernel_write() in loop
filp_close();
vfree();
-----------------------------------------------------------------
However, it will be much more convenient to use some kind of mmap()
equivalent for this purpose. Is it possible ?

Thanks,

Dmitry
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/