linux/drivers/mtd/mtdpstore.c

// SPDX-License-Identifier: GPL-2.0

#define dev_fmt(fmt)

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/pstore_blk.h>
#include <linux/mtd/mtd.h>
#include <linux/bitops.h>
#include <linux/slab.h>

static struct mtdpstore_context {} oops_cxt;

static int mtdpstore_block_isbad(struct mtdpstore_context *cxt, loff_t off)
{}

static inline int mtdpstore_panic_block_isbad(struct mtdpstore_context *cxt,
		loff_t off)
{}

static inline void mtdpstore_mark_used(struct mtdpstore_context *cxt,
		loff_t off)
{}

static inline void mtdpstore_mark_unused(struct mtdpstore_context *cxt,
		loff_t off)
{}

static inline void mtdpstore_block_mark_unused(struct mtdpstore_context *cxt,
		loff_t off)
{}

static inline int mtdpstore_is_used(struct mtdpstore_context *cxt, loff_t off)
{}

static int mtdpstore_block_is_used(struct mtdpstore_context *cxt,
		loff_t off)
{}

static int mtdpstore_is_empty(struct mtdpstore_context *cxt, char *buf,
		size_t size)
{}

static void mtdpstore_mark_removed(struct mtdpstore_context *cxt, loff_t off)
{}

static void mtdpstore_block_clear_removed(struct mtdpstore_context *cxt,
		loff_t off)
{}

static int mtdpstore_block_is_removed(struct mtdpstore_context *cxt,
		loff_t off)
{}

static int mtdpstore_erase_do(struct mtdpstore_context *cxt, loff_t off)
{}

/*
 * called while removing file
 *
 * Avoiding over erasing, do erase block only when the whole block is unused.
 * If the block contains valid log, do erase lazily on flush_removed() when
 * unregister.
 */
static ssize_t mtdpstore_erase(size_t size, loff_t off)
{}

/*
 * What is security for mtdpstore?
 * As there is no erase for panic case, we should ensure at least one zone
 * is writable. Otherwise, panic write will fail.
 * If zone is used, write operation will return -ENOMSG, which means that
 * pstore/blk will try one by one until gets an empty zone. So, it is not
 * needed to ensure the next zone is empty, but at least one.
 */
static int mtdpstore_security(struct mtdpstore_context *cxt, loff_t off)
{}

static ssize_t mtdpstore_write(const char *buf, size_t size, loff_t off)
{}

static inline bool mtdpstore_is_io_error(int ret)
{}

/*
 * All zones will be read as pstore/blk will read zone one by one when do
 * recover.
 */
static ssize_t mtdpstore_read(char *buf, size_t size, loff_t off)
{}

static ssize_t mtdpstore_panic_write(const char *buf, size_t size, loff_t off)
{}

static void mtdpstore_notify_add(struct mtd_info *mtd)
{}

static int mtdpstore_flush_removed_do(struct mtdpstore_context *cxt,
		loff_t off, size_t size)
{}

/*
 * What does mtdpstore_flush_removed() do?
 * When user remove any log file on pstore filesystem, mtdpstore should do
 * something to ensure log file removed. If the whole block is no longer used,
 * it's nice to erase the block. However if the block still contains valid log,
 * what mtdpstore can do is to erase and write the valid log back.
 */
static int mtdpstore_flush_removed(struct mtdpstore_context *cxt)
{}

static void mtdpstore_notify_remove(struct mtd_info *mtd)
{}

static struct mtd_notifier mtdpstore_notifier =;

static int __init mtdpstore_init(void)
{}
module_init();

static void __exit mtdpstore_exit(void)
{}
module_exit(mtdpstore_exit);

MODULE_LICENSE();
MODULE_AUTHOR();
MODULE_DESCRIPTION();