linux/drivers/dax/super.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright(c) 2017 Intel Corporation. All rights reserved.
 */
#include <linux/pagemap.h>
#include <linux/module.h>
#include <linux/mount.h>
#include <linux/pseudo_fs.h>
#include <linux/magic.h>
#include <linux/pfn_t.h>
#include <linux/cdev.h>
#include <linux/slab.h>
#include <linux/uio.h>
#include <linux/dax.h>
#include <linux/fs.h>
#include <linux/cacheinfo.h>
#include "dax-private.h"

/**
 * struct dax_device - anchor object for dax services
 * @inode: core vfs
 * @cdev: optional character interface for "device dax"
 * @private: dax driver private data
 * @flags: state and boolean properties
 * @ops: operations for this device
 * @holder_data: holder of a dax_device: could be filesystem or mapped device
 * @holder_ops: operations for the inner holder
 */
struct dax_device {};

static dev_t dax_devt;
DEFINE_STATIC_SRCU();
static struct vfsmount *dax_mnt;
static DEFINE_IDA(dax_minor_ida);
static struct kmem_cache *dax_cache __read_mostly;
static struct super_block *dax_superblock __read_mostly;

int dax_read_lock(void)
{}
EXPORT_SYMBOL_GPL();

void dax_read_unlock(int id)
{}
EXPORT_SYMBOL_GPL();

#if defined(CONFIG_BLOCK) && defined(CONFIG_FS_DAX)
#include <linux/blkdev.h>

static DEFINE_XARRAY(dax_hosts);

int dax_add_host(struct dax_device *dax_dev, struct gendisk *disk)
{}
EXPORT_SYMBOL_GPL();

void dax_remove_host(struct gendisk *disk)
{}
EXPORT_SYMBOL_GPL();

/**
 * fs_dax_get_by_bdev() - temporary lookup mechanism for filesystem-dax
 * @bdev: block device to find a dax_device for
 * @start_off: returns the byte offset into the dax_device that @bdev starts
 * @holder: filesystem or mapped device inside the dax_device
 * @ops: operations for the inner holder
 */
struct dax_device *fs_dax_get_by_bdev(struct block_device *bdev, u64 *start_off,
		void *holder, const struct dax_holder_operations *ops)
{}
EXPORT_SYMBOL_GPL();

void fs_put_dax(struct dax_device *dax_dev, void *holder)
{}
EXPORT_SYMBOL_GPL();
#endif /* CONFIG_BLOCK && CONFIG_FS_DAX */

enum dax_device_flags {};

/**
 * dax_direct_access() - translate a device pgoff to an absolute pfn
 * @dax_dev: a dax_device instance representing the logical memory range
 * @pgoff: offset in pages from the start of the device to translate
 * @nr_pages: number of consecutive pages caller can handle relative to @pfn
 * @mode: indicator on normal access or recovery write
 * @kaddr: output parameter that returns a virtual address mapping of pfn
 * @pfn: output parameter that returns an absolute pfn translation of @pgoff
 *
 * Return: negative errno if an error occurs, otherwise the number of
 * pages accessible at the device relative @pgoff.
 */
long dax_direct_access(struct dax_device *dax_dev, pgoff_t pgoff, long nr_pages,
		enum dax_access_mode mode, void **kaddr, pfn_t *pfn)
{}
EXPORT_SYMBOL_GPL();

size_t dax_copy_from_iter(struct dax_device *dax_dev, pgoff_t pgoff, void *addr,
		size_t bytes, struct iov_iter *i)
{}

size_t dax_copy_to_iter(struct dax_device *dax_dev, pgoff_t pgoff, void *addr,
		size_t bytes, struct iov_iter *i)
{}

int dax_zero_page_range(struct dax_device *dax_dev, pgoff_t pgoff,
			size_t nr_pages)
{}
EXPORT_SYMBOL_GPL();

size_t dax_recovery_write(struct dax_device *dax_dev, pgoff_t pgoff,
		void *addr, size_t bytes, struct iov_iter *iter)
{}
EXPORT_SYMBOL_GPL();

int dax_holder_notify_failure(struct dax_device *dax_dev, u64 off,
			      u64 len, int mf_flags)
{}
EXPORT_SYMBOL_GPL();

#ifdef CONFIG_ARCH_HAS_PMEM_API
void arch_wb_cache_pmem(void *addr, size_t size);
void dax_flush(struct dax_device *dax_dev, void *addr, size_t size)
{}
#else
void dax_flush(struct dax_device *dax_dev, void *addr, size_t size)
{
}
#endif
EXPORT_SYMBOL_GPL();

void dax_write_cache(struct dax_device *dax_dev, bool wc)
{}
EXPORT_SYMBOL_GPL();

bool dax_write_cache_enabled(struct dax_device *dax_dev)
{}
EXPORT_SYMBOL_GPL();

bool dax_synchronous(struct dax_device *dax_dev)
{}
EXPORT_SYMBOL_GPL();

void set_dax_synchronous(struct dax_device *dax_dev)
{}
EXPORT_SYMBOL_GPL();

void set_dax_nocache(struct dax_device *dax_dev)
{}
EXPORT_SYMBOL_GPL();

void set_dax_nomc(struct dax_device *dax_dev)
{}
EXPORT_SYMBOL_GPL();

bool dax_alive(struct dax_device *dax_dev)
{}
EXPORT_SYMBOL_GPL();

/*
 * Note, rcu is not protecting the liveness of dax_dev, rcu is ensuring
 * that any fault handlers or operations that might have seen
 * dax_alive(), have completed.  Any operations that start after
 * synchronize_srcu() has run will abort upon seeing !dax_alive().
 *
 * Note, because alloc_dax() returns an ERR_PTR() on error, callers
 * typically store its result into a local variable in order to check
 * the result. Therefore, care must be taken to populate the struct
 * device dax_dev field make sure the dax_dev is not leaked.
 */
void kill_dax(struct dax_device *dax_dev)
{}
EXPORT_SYMBOL_GPL();

void run_dax(struct dax_device *dax_dev)
{}
EXPORT_SYMBOL_GPL();

static struct inode *dax_alloc_inode(struct super_block *sb)
{}

static struct dax_device *to_dax_dev(struct inode *inode)
{}

static void dax_free_inode(struct inode *inode)
{}

static void dax_destroy_inode(struct inode *inode)
{}

static const struct super_operations dax_sops =;

static int dax_init_fs_context(struct fs_context *fc)
{}

static struct file_system_type dax_fs_type =;

static int dax_test(struct inode *inode, void *data)
{}

static int dax_set(struct inode *inode, void *data)
{}

static struct dax_device *dax_dev_get(dev_t devt)
{}

struct dax_device *alloc_dax(void *private, const struct dax_operations *ops)
{}
EXPORT_SYMBOL_GPL();

void put_dax(struct dax_device *dax_dev)
{}
EXPORT_SYMBOL_GPL();

/**
 * dax_holder() - obtain the holder of a dax device
 * @dax_dev: a dax_device instance
 *
 * Return: the holder's data which represents the holder if registered,
 * otherwize NULL.
 */
void *dax_holder(struct dax_device *dax_dev)
{}
EXPORT_SYMBOL_GPL();

/**
 * inode_dax: convert a public inode into its dax_dev
 * @inode: An inode with i_cdev pointing to a dax_dev
 *
 * Note this is not equivalent to to_dax_dev() which is for private
 * internal use where we know the inode filesystem type == dax_fs_type.
 */
struct dax_device *inode_dax(struct inode *inode)
{}
EXPORT_SYMBOL_GPL();

struct inode *dax_inode(struct dax_device *dax_dev)
{}
EXPORT_SYMBOL_GPL();

void *dax_get_private(struct dax_device *dax_dev)
{}
EXPORT_SYMBOL_GPL();

static void init_once(void *_dax_dev)
{}

static int dax_fs_init(void)
{}

static void dax_fs_exit(void)
{}

static int __init dax_core_init(void)
{}

static void __exit dax_core_exit(void)
{}

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();
subsys_initcall(dax_core_init);
module_exit(dax_core_exit);