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