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