1*2874c5fdSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */
2da4458bdSDavid Howells /* RomFS internal definitions
3da4458bdSDavid Howells *
4da4458bdSDavid Howells * Copyright © 2007 Red Hat, Inc. All Rights Reserved.
5da4458bdSDavid Howells * Written by David Howells (dhowells@redhat.com)
6da4458bdSDavid Howells */
7da4458bdSDavid Howells
8da4458bdSDavid Howells #include <linux/romfs_fs.h>
9da4458bdSDavid Howells
10da4458bdSDavid Howells struct romfs_inode_info {
11da4458bdSDavid Howells struct inode vfs_inode;
12da4458bdSDavid Howells unsigned long i_metasize; /* size of non-data area */
13da4458bdSDavid Howells unsigned long i_dataoffset; /* from the start of fs */
14da4458bdSDavid Howells };
15da4458bdSDavid Howells
romfs_maxsize(struct super_block * sb)16da4458bdSDavid Howells static inline size_t romfs_maxsize(struct super_block *sb)
17da4458bdSDavid Howells {
18da4458bdSDavid Howells return (size_t) (unsigned long) sb->s_fs_info;
19da4458bdSDavid Howells }
20da4458bdSDavid Howells
ROMFS_I(struct inode * inode)21da4458bdSDavid Howells static inline struct romfs_inode_info *ROMFS_I(struct inode *inode)
22da4458bdSDavid Howells {
23da4458bdSDavid Howells return container_of(inode, struct romfs_inode_info, vfs_inode);
24da4458bdSDavid Howells }
25da4458bdSDavid Howells
26da4458bdSDavid Howells /*
27da4458bdSDavid Howells * mmap-nommu.c
28da4458bdSDavid Howells */
29da4458bdSDavid Howells #if !defined(CONFIG_MMU) && defined(CONFIG_ROMFS_ON_MTD)
30da4458bdSDavid Howells extern const struct file_operations romfs_ro_fops;
31da4458bdSDavid Howells #else
32da4458bdSDavid Howells #define romfs_ro_fops generic_ro_fops
33da4458bdSDavid Howells #endif
34da4458bdSDavid Howells
35da4458bdSDavid Howells /*
36da4458bdSDavid Howells * storage.c
37da4458bdSDavid Howells */
38da4458bdSDavid Howells extern int romfs_dev_read(struct super_block *sb, unsigned long pos,
39da4458bdSDavid Howells void *buf, size_t buflen);
40da4458bdSDavid Howells extern ssize_t romfs_dev_strnlen(struct super_block *sb,
41da4458bdSDavid Howells unsigned long pos, size_t maxlen);
4284baf74bSDavid Howells extern int romfs_dev_strcmp(struct super_block *sb, unsigned long pos,
43da4458bdSDavid Howells const char *str, size_t size);
44