/*
* CXL Flash Device Driver
*
* Written by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>, IBM Corporation
* Uma Krishnan <ukrishn@linux.vnet.ibm.com>, IBM Corporation
*
* Copyright (C) 2018 IBM Corporation
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
#include <linux/file.h>
#include <linux/idr.h>
#include <linux/module.h>
#include <linux/mount.h>
#include <linux/poll.h>
#include <linux/sched/signal.h>
#include <misc/ocxl.h>
#include <uapi/misc/cxl.h>
#include "backend.h"
#include "ocxl_hw.h"
/*
* Pseudo-filesystem to allocate inodes.
*/
#define OCXLFLASH_FS_MAGIC 0x1697698f
static int ocxlflash_fs_cnt;
static struct vfsmount *ocxlflash_vfs_mount;
static const struct dentry_operations ocxlflash_fs_dops = {
.d_dname = simple_dname,
};
/*
* ocxlflash_fs_mount() - mount the pseudo-filesystem
* @fs_type: File system type.
* @flags: Flags for the filesystem.
* @dev_name: Device name associated with the filesystem.
* @data: Data pointer.
*
* Return: pointer to the directory entry structure
*/
static struct dentry *ocxlflash_fs_mount(struct file_system_type *fs_type,
int flags, const char *dev_name,
void *data)
{
return mount_pseudo(fs_type, "ocxlflash:", NULL, &ocxlflash_fs_dops,
OCXLFLASH_FS_MAGIC);
}
static struct file_system_type ocxlflash_fs_type = {
.name = "ocxlflash",
.owner = THIS_MODULE,
.mount = ocxlflash_fs_mount,
.kill_sb = kill_anon_super,
};
/*
* ocxlflash_release_mapping() - release the memory mapping
* @ctx: Context whose mapping is to be released.
*/
static void ocxlflash_release_mapping(struct ocxlflash_context *ctx)
{
if (ctx->mapping)
simple_release_fs(&ocxlflash_vfs_mount, &ocxlflash_fs_cnt);
ctx->mapping = NULL;
}
/*
* ocxlflash_getfile()