18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 28c2ecf20Sopenharmony_ci#ifndef __LINUX_ROMFS_FS_H 38c2ecf20Sopenharmony_ci#define __LINUX_ROMFS_FS_H 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci#include <linux/types.h> 68c2ecf20Sopenharmony_ci#include <linux/fs.h> 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci/* The basic structures of the romfs filesystem */ 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#define ROMBSIZE BLOCK_SIZE 118c2ecf20Sopenharmony_ci#define ROMBSBITS BLOCK_SIZE_BITS 128c2ecf20Sopenharmony_ci#define ROMBMASK (ROMBSIZE-1) 138c2ecf20Sopenharmony_ci#define ROMFS_MAGIC 0x7275 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci#define ROMFS_MAXFN 128 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci#define __mkw(h,l) (((h)&0x00ff)<< 8|((l)&0x00ff)) 188c2ecf20Sopenharmony_ci#define __mkl(h,l) (((h)&0xffff)<<16|((l)&0xffff)) 198c2ecf20Sopenharmony_ci#define __mk4(a,b,c,d) cpu_to_be32(__mkl(__mkw(a,b),__mkw(c,d))) 208c2ecf20Sopenharmony_ci#define ROMSB_WORD0 __mk4('-','r','o','m') 218c2ecf20Sopenharmony_ci#define ROMSB_WORD1 __mk4('1','f','s','-') 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ci/* On-disk "super block" */ 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_cistruct romfs_super_block { 268c2ecf20Sopenharmony_ci __be32 word0; 278c2ecf20Sopenharmony_ci __be32 word1; 288c2ecf20Sopenharmony_ci __be32 size; 298c2ecf20Sopenharmony_ci __be32 checksum; 308c2ecf20Sopenharmony_ci char name[0]; /* volume name */ 318c2ecf20Sopenharmony_ci}; 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ci/* On disk inode */ 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_cistruct romfs_inode { 368c2ecf20Sopenharmony_ci __be32 next; /* low 4 bits see ROMFH_ */ 378c2ecf20Sopenharmony_ci __be32 spec; 388c2ecf20Sopenharmony_ci __be32 size; 398c2ecf20Sopenharmony_ci __be32 checksum; 408c2ecf20Sopenharmony_ci char name[0]; 418c2ecf20Sopenharmony_ci}; 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ci#define ROMFH_TYPE 7 448c2ecf20Sopenharmony_ci#define ROMFH_HRD 0 458c2ecf20Sopenharmony_ci#define ROMFH_DIR 1 468c2ecf20Sopenharmony_ci#define ROMFH_REG 2 478c2ecf20Sopenharmony_ci#define ROMFH_SYM 3 488c2ecf20Sopenharmony_ci#define ROMFH_BLK 4 498c2ecf20Sopenharmony_ci#define ROMFH_CHR 5 508c2ecf20Sopenharmony_ci#define ROMFH_SCK 6 518c2ecf20Sopenharmony_ci#define ROMFH_FIF 7 528c2ecf20Sopenharmony_ci#define ROMFH_EXEC 8 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ci/* Alignment */ 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci#define ROMFH_SIZE 16 578c2ecf20Sopenharmony_ci#define ROMFH_PAD (ROMFH_SIZE-1) 588c2ecf20Sopenharmony_ci#define ROMFH_MASK (~ROMFH_PAD) 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_ci#endif 61