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