mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-23 04:13:55 +07:00
d187715589
Strengthen validation of BFS superblock against corruption. Make in-core inode bitmap static part of superblock info structure. Print a warning when mounting a BFS filesystem created with "-N 512" option as only 510 files can be created in the root directory. Make the kernel messages more uniform. Update the 'prefix' passed to bfs_dump_imap() to match the current naming of operations. White space and comments cleanup. Link: http://lkml.kernel.org/r/CAK+_RLkFZMduoQF36wZFd3zLi-6ZutWKsydjeHFNdtRvZZEb4w@mail.gmail.com Signed-off-by: Tigran Aivazian <aivazian.tigran@gmail.com> Reported-by: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
83 lines
1.9 KiB
C
83 lines
1.9 KiB
C
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
|
/*
|
|
* include/linux/bfs_fs.h - BFS data structures on disk.
|
|
* Copyright (C) 1999-2018 Tigran Aivazian <aivazian.tigran@gmail.com>
|
|
*/
|
|
|
|
#ifndef _LINUX_BFS_FS_H
|
|
#define _LINUX_BFS_FS_H
|
|
|
|
#include <linux/types.h>
|
|
|
|
#define BFS_BSIZE_BITS 9
|
|
#define BFS_BSIZE (1<<BFS_BSIZE_BITS)
|
|
|
|
#define BFS_MAGIC 0x1BADFACE
|
|
#define BFS_ROOT_INO 2
|
|
#define BFS_INODES_PER_BLOCK 8
|
|
|
|
/* SVR4 vnode type values (bfs_inode->i_vtype) */
|
|
#define BFS_VDIR 2L
|
|
#define BFS_VREG 1L
|
|
|
|
/* BFS inode layout on disk */
|
|
struct bfs_inode {
|
|
__le16 i_ino;
|
|
__u16 i_unused;
|
|
__le32 i_sblock;
|
|
__le32 i_eblock;
|
|
__le32 i_eoffset;
|
|
__le32 i_vtype;
|
|
__le32 i_mode;
|
|
__le32 i_uid;
|
|
__le32 i_gid;
|
|
__le32 i_nlink;
|
|
__le32 i_atime;
|
|
__le32 i_mtime;
|
|
__le32 i_ctime;
|
|
__u32 i_padding[4];
|
|
};
|
|
|
|
#define BFS_NAMELEN 14
|
|
#define BFS_DIRENT_SIZE 16
|
|
#define BFS_DIRS_PER_BLOCK 32
|
|
|
|
struct bfs_dirent {
|
|
__le16 ino;
|
|
char name[BFS_NAMELEN];
|
|
};
|
|
|
|
/* BFS superblock layout on disk */
|
|
struct bfs_super_block {
|
|
__le32 s_magic;
|
|
__le32 s_start;
|
|
__le32 s_end;
|
|
__le32 s_from;
|
|
__le32 s_to;
|
|
__s32 s_bfrom;
|
|
__s32 s_bto;
|
|
char s_fsname[6];
|
|
char s_volume[6];
|
|
__u32 s_padding[118];
|
|
};
|
|
|
|
|
|
#define BFS_OFF2INO(offset) \
|
|
((((offset) - BFS_BSIZE) / sizeof(struct bfs_inode)) + BFS_ROOT_INO)
|
|
|
|
#define BFS_INO2OFF(ino) \
|
|
((__u32)(((ino) - BFS_ROOT_INO) * sizeof(struct bfs_inode)) + BFS_BSIZE)
|
|
#define BFS_NZFILESIZE(ip) \
|
|
((le32_to_cpu((ip)->i_eoffset) + 1) - le32_to_cpu((ip)->i_sblock) * BFS_BSIZE)
|
|
|
|
#define BFS_FILESIZE(ip) \
|
|
((ip)->i_sblock == 0 ? 0 : BFS_NZFILESIZE(ip))
|
|
|
|
#define BFS_FILEBLOCKS(ip) \
|
|
((ip)->i_sblock == 0 ? 0 : (le32_to_cpu((ip)->i_eblock) + 1) - le32_to_cpu((ip)->i_sblock))
|
|
#define BFS_UNCLEAN(bfs_sb, sb) \
|
|
((le32_to_cpu(bfs_sb->s_from) != -1) && (le32_to_cpu(bfs_sb->s_to) != -1) && !(sb->s_flags & SB_RDONLY))
|
|
|
|
|
|
#endif /* _LINUX_BFS_FS_H */
|