[PATCH 4/4] [MTD] nandsim: add option to use a file to cache pages

David Woodhouse dwmw2 at infradead.org
Wed Jun 4 12:48:28 EDT 2008


On Fri, 2008-05-30 at 15:56 +0300, Adrian Hunter wrote:
> 
>  static int alloc_device(struct nandsim *ns)
>  {
> -       int i;
> +       struct file *cfile;
> +       int i, err;
> +
> +       if (cache_file) {
> +               cfile = filp_open(cache_file, O_CREAT | O_RDWR | O_LARGEFILE, 0640);
> +               if (IS_ERR(cfile))
> +                       return PTR_ERR(cfile);
> +               if (!cfile->f_op || (!cfile->f_op->read && !cfile->f_op->aio_read)) {
> +                       NS_ERR("alloc_device: cache file not readable\n");
> +                       err = -EINVAL;
> +                       goto err_close;
> +               }

Would you care to post that to linux-kernel at vger.kernel.org and see if
it passes muster?

-- 
dwmw2




More information about the linux-mtd mailing list