162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
262306a36Sopenharmony_ci/* RomFS internal definitions
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci * Copyright © 2007 Red Hat, Inc. All Rights Reserved.
562306a36Sopenharmony_ci * Written by David Howells (dhowells@redhat.com)
662306a36Sopenharmony_ci */
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#include <linux/romfs_fs.h>
962306a36Sopenharmony_ci
1062306a36Sopenharmony_cistruct romfs_inode_info {
1162306a36Sopenharmony_ci	struct inode	vfs_inode;
1262306a36Sopenharmony_ci	unsigned long	i_metasize;	/* size of non-data area */
1362306a36Sopenharmony_ci	unsigned long	i_dataoffset;	/* from the start of fs */
1462306a36Sopenharmony_ci};
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_cistatic inline size_t romfs_maxsize(struct super_block *sb)
1762306a36Sopenharmony_ci{
1862306a36Sopenharmony_ci	return (size_t) (unsigned long) sb->s_fs_info;
1962306a36Sopenharmony_ci}
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_cistatic inline struct romfs_inode_info *ROMFS_I(struct inode *inode)
2262306a36Sopenharmony_ci{
2362306a36Sopenharmony_ci	return container_of(inode, struct romfs_inode_info, vfs_inode);
2462306a36Sopenharmony_ci}
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci/*
2762306a36Sopenharmony_ci * mmap-nommu.c
2862306a36Sopenharmony_ci */
2962306a36Sopenharmony_ci#if !defined(CONFIG_MMU) && defined(CONFIG_ROMFS_ON_MTD)
3062306a36Sopenharmony_ciextern const struct file_operations romfs_ro_fops;
3162306a36Sopenharmony_ci#else
3262306a36Sopenharmony_ci#define romfs_ro_fops	generic_ro_fops
3362306a36Sopenharmony_ci#endif
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ci/*
3662306a36Sopenharmony_ci * storage.c
3762306a36Sopenharmony_ci */
3862306a36Sopenharmony_ciextern int romfs_dev_read(struct super_block *sb, unsigned long pos,
3962306a36Sopenharmony_ci			  void *buf, size_t buflen);
4062306a36Sopenharmony_ciextern ssize_t romfs_dev_strnlen(struct super_block *sb,
4162306a36Sopenharmony_ci				 unsigned long pos, size_t maxlen);
4262306a36Sopenharmony_ciextern int romfs_dev_strcmp(struct super_block *sb, unsigned long pos,
4362306a36Sopenharmony_ci			    const char *str, size_t size);
44