forked from KolibriOS/kolibrios
kernel: Bring back XFS: v4 and v5 disk formats are supported now.
Read-only. Writing is not planned. git-svn-id: svn://kolibrios.org@7736 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
a0a18277da
commit
7b1eb2c733
@ -692,8 +692,4 @@ include "iso9660.inc" ; read for CD filesystem
|
|||||||
include "fat.inc"
|
include "fat.inc"
|
||||||
include "ntfs.inc"
|
include "ntfs.inc"
|
||||||
include "ext.inc"
|
include "ext.inc"
|
||||||
; include "xfs.asm"
|
include "xfs.asm"
|
||||||
|
|
||||||
xfs_create_partition:
|
|
||||||
xor eax, eax
|
|
||||||
ret
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,56 +1,94 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2013-2015. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2013-2020. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
$Revision$
|
$Revision$
|
||||||
|
|
||||||
|
; file types from stat.h
|
||||||
; from stat.h
|
S_IFMT = 0170000o ; These bits determine file type
|
||||||
; distinguish file types
|
S_IFDIR = 0040000o ; Directory
|
||||||
S_IFMT = 0170000o ; These bits determine file type.
|
S_IFCHR = 0020000o ; Character device
|
||||||
S_IFDIR = 0040000o ; Directory.
|
S_IFBLK = 0060000o ; Block device
|
||||||
S_IFCHR = 0020000o ; Character device.
|
S_IFREG = 0100000o ; Regular file
|
||||||
S_IFBLK = 0060000o ; Block device.
|
S_IFIFO = 0010000o ; FIFO
|
||||||
S_IFREG = 0100000o ; Regular file.
|
S_IFLNK = 0120000o ; Symbolic link
|
||||||
S_IFIFO = 0010000o ; FIFO.
|
S_IFSOCK = 0140000o ; Socket
|
||||||
S_IFLNK = 0120000o ; Symbolic link.
|
|
||||||
S_IFSOCK = 0140000o ; Socket.
|
|
||||||
; end stat.h
|
|
||||||
|
|
||||||
|
|
||||||
; XFS null constant: empty fields must be all ones, not zeros!
|
; XFS null constant: empty fields must be all ones, not zeros!
|
||||||
XFS_NULL = -1
|
XFS_NULL = -1
|
||||||
|
|
||||||
|
|
||||||
; static sector numbers
|
|
||||||
XFS_SECT_SB = 0
|
XFS_SECT_SB = 0
|
||||||
XFS_SECT_AGF = 1
|
|
||||||
XFS_SECT_AGI = 2
|
|
||||||
XFS_SECT_AGFL = 3
|
|
||||||
|
|
||||||
|
|
||||||
; signatures of file system structures
|
; signatures of file system structures
|
||||||
; 'string' numbers are treated by fasm as big endian
|
|
||||||
XFS_SB_MAGIC = 'XFSB'
|
|
||||||
XFS_AGF_MAGIC = 'XAGF'
|
XFS_AGF_MAGIC = 'XAGF'
|
||||||
XFS_AGI_MAGIC = 'XAGI'
|
|
||||||
XFS_ABTB_MAGIC = 'ABTB'
|
|
||||||
XFS_ABTC_MAGIC = 'ABTC'
|
|
||||||
XFS_IBT_MAGIC = 'IABT'
|
|
||||||
XFS_DINODE_MAGIC = 'IN'
|
XFS_DINODE_MAGIC = 'IN'
|
||||||
XFS_BMAP_MAGIC = 'BMAP'
|
XFS_BMAP_MAGIC = 'BMAP'
|
||||||
XFS_DA_NODE_MAGIC = 0xbefe ; those are little endian here
|
XFS_DA_NODE_MAGIC = 0xbefe
|
||||||
XFS_ATTR_LEAF_MAGIC = 0xeefb ; but big endian in docs
|
XFS_DIR2_LEAF1_MAGIC = 0xf1d2
|
||||||
XFS_DIR2_LEAF1_MAGIC = 0xf1d2 ; pay attention!
|
XFS_DIR2_LEAFN_MAGIC = 0xffd2
|
||||||
XFS_DIR2_LEAFN_MAGIC = 0xffd2 ;
|
|
||||||
XFS_DIR2_BLOCK_MAGIC = 'XD2B'
|
XFS_DIR2_BLOCK_MAGIC = 'XD2B'
|
||||||
XFS_DIR2_DATA_MAGIC = 'XD2D'
|
XFS_DIR2_DATA_MAGIC = 'XD2D'
|
||||||
XFS_DIR2_FREE_MAGIC = 'XD2F'
|
|
||||||
XFS_DQUOT_MAGIC = 'DQ'
|
|
||||||
|
|
||||||
|
XFS_BMAP3_MAGIC = 'BMA3'
|
||||||
|
XFS_DA3_NODE_MAGIC = 0xbe3e ; non-leaf blocks
|
||||||
|
XFS_DIR3_LEAF1_MAGIC = 0xf13d ; v3 dir single blks
|
||||||
|
XFS_DIR3_LEAFN_MAGIC = 0xff3d ; v3 dir multi blks
|
||||||
|
XFS_DIR3_BLOCK_MAGIC = 'XDB3' ; single block dirs
|
||||||
|
XFS_DIR3_DATA_MAGIC = 'XDD3' ; multiblock dirs
|
||||||
|
|
||||||
|
XFS_SB_MAGIC = 'XFSB'
|
||||||
|
XFS_SB_VERSION_NUMBITS = 0x000f
|
||||||
|
XFS_SB_VERSION_ALLFBITS = 0xfff0
|
||||||
|
XFS_SB_VERSION_REALFBITS = 0x0ff0
|
||||||
|
XFS_SB_VERSION_ATTRBIT = 0x0010
|
||||||
|
XFS_SB_VERSION_NLINKBIT = 0x0020
|
||||||
|
XFS_SB_VERSION_QUOTABIT = 0x0040
|
||||||
|
XFS_SB_VERSION_ALIGNBIT = 0x0080
|
||||||
|
XFS_SB_VERSION_DALIGNBIT = 0x0100
|
||||||
|
XFS_SB_VERSION_SHAREDBIT = 0x0200
|
||||||
|
XFS_SB_VERSION_LOGV2BIT = 0x0400
|
||||||
|
XFS_SB_VERSION_SECTORBIT = 0x0800
|
||||||
|
XFS_SB_VERSION_EXTFLGBIT = 0x1000
|
||||||
|
XFS_SB_VERSION_DIRV2BIT = 0x2000
|
||||||
|
XFS_SB_VERSION_BORGBIT = 0x4000 ; ASCII only case-insensitive
|
||||||
|
XFS_SB_VERSION_MOREBITSBIT = 0x8000
|
||||||
|
|
||||||
|
XFS_SB_VERSION_SUPPORTED = XFS_SB_VERSION_NUMBITS OR \
|
||||||
|
XFS_SB_VERSION_ATTRBIT OR \
|
||||||
|
XFS_SB_VERSION_NLINKBIT OR \
|
||||||
|
XFS_SB_VERSION_QUOTABIT OR \
|
||||||
|
XFS_SB_VERSION_ALIGNBIT OR \
|
||||||
|
XFS_SB_VERSION_LOGV2BIT OR \
|
||||||
|
XFS_SB_VERSION_SECTORBIT OR \
|
||||||
|
XFS_SB_VERSION_EXTFLGBIT OR \
|
||||||
|
XFS_SB_VERSION_DIRV2BIT OR \
|
||||||
|
XFS_SB_VERSION_MOREBITSBIT
|
||||||
|
|
||||||
|
XFS_SB_VERSION2_RESERVED1BIT = 0x00000001
|
||||||
|
XFS_SB_VERSION2_LAZYSBCOUNTBIT = 0x00000002 ; Superblk counters
|
||||||
|
XFS_SB_VERSION2_RESERVED4BIT = 0x00000004
|
||||||
|
XFS_SB_VERSION2_ATTR2BIT = 0x00000008 ; Inline attr rework
|
||||||
|
XFS_SB_VERSION2_PARENTBIT = 0x00000010 ; parent pointers in xattr
|
||||||
|
XFS_SB_VERSION2_PROJID32BIT = 0x00000080 ; 32 bit project id
|
||||||
|
XFS_SB_VERSION2_CRCBIT = 0x00000100 ; metadata CRCs
|
||||||
|
XFS_SB_VERSION2_FTYPE = 0x00000200 ; inode type in dir
|
||||||
|
|
||||||
|
XFS_SB_VERSION2_SUPPORTED = XFS_SB_VERSION2_LAZYSBCOUNTBIT OR \
|
||||||
|
XFS_SB_VERSION2_ATTR2BIT OR \
|
||||||
|
XFS_SB_VERSION2_PARENTBIT OR \
|
||||||
|
XFS_SB_VERSION2_PROJID32BIT OR \
|
||||||
|
XFS_SB_VERSION2_CRCBIT OR \
|
||||||
|
XFS_SB_VERSION2_FTYPE
|
||||||
|
|
||||||
|
XFS_SB_FEAT_INCOMPAT_FTYPE = 1 ; filetype in dirent
|
||||||
|
XFS_SB_FEAT_INCOMPAT_SPINODES = 2 ; sparse inode chunks
|
||||||
|
XFS_SB_FEAT_INCOMPAT_META_UUID = 4 ; metadata UUID
|
||||||
|
XFS_SB_FEAT_INCOMPAT_SUPPORTED = XFS_SB_FEAT_INCOMPAT_FTYPE OR \
|
||||||
|
XFS_SB_FEAT_INCOMPAT_SPINODES OR \
|
||||||
|
XFS_SB_FEAT_INCOMPAT_META_UUID
|
||||||
|
|
||||||
; bitfield lengths for packed extent
|
; bitfield lengths for packed extent
|
||||||
; MSB to LSB / left to right
|
; MSB to LSB / left to right
|
||||||
@ -59,36 +97,27 @@ BMBT_STARTOFF_BITLEN = 54
|
|||||||
BMBT_STARTBLOCK_BITLEN = 52
|
BMBT_STARTBLOCK_BITLEN = 52
|
||||||
BMBT_BLOCKCOUNT_BITLEN = 21
|
BMBT_BLOCKCOUNT_BITLEN = 21
|
||||||
|
|
||||||
|
XFS_DIR2_DATA_ALIGN_LOG = 3
|
||||||
; those constants are taken from linux source (xfs_dir2_leaf.h)
|
XFS_DIR2_DATA_ALIGN = 1 SHL XFS_DIR2_DATA_ALIGN_LOG
|
||||||
; they are magic infile offsets for directories
|
|
||||||
XFS_DIR2_DATA_ALIGN_LOG = 3 ; i.e., 8 bytes
|
|
||||||
XFS_DIR2_LEAF_SPACE = 1
|
|
||||||
XFS_DIR2_SPACE_SIZE = (1 SHL (32 + XFS_DIR2_DATA_ALIGN_LOG))
|
XFS_DIR2_SPACE_SIZE = (1 SHL (32 + XFS_DIR2_DATA_ALIGN_LOG))
|
||||||
XFS_DIR2_LEAF_OFFSET = (XFS_DIR2_LEAF_SPACE * XFS_DIR2_SPACE_SIZE)
|
XFS_DIR2_DATA_OFFSET = 0*XFS_DIR2_SPACE_SIZE
|
||||||
XFS_DIR2_FREE_SPACE = 2
|
XFS_DIR2_LEAF_OFFSET = 1*XFS_DIR2_SPACE_SIZE
|
||||||
XFS_DIR2_SPACE_SIZE = (1 SHL (32 + XFS_DIR2_DATA_ALIGN_LOG))
|
XFS_DIR2_FREE_OFFSET = 2*XFS_DIR2_SPACE_SIZE
|
||||||
XFS_DIR2_FREE_OFFSET = (XFS_DIR2_FREE_SPACE * XFS_DIR2_SPACE_SIZE)
|
|
||||||
|
|
||||||
|
|
||||||
; data section magic constants for directories (xfs_dir2_data.h)
|
; data section magic constants for directories (xfs_dir2_data.h)
|
||||||
XFS_DIR2_DATA_FD_COUNT = 3
|
XFS_DIR2_DATA_FD_COUNT = 3
|
||||||
XFS_DIR2_DATA_FREE_TAG = 0xffff
|
|
||||||
|
|
||||||
|
|
||||||
; valid inode formats
|
; valid inode formats
|
||||||
; enum xfs_dinode_fmt (xfs_dinode.h)
|
; enum xfs_dinode_fmt (xfs_dinode.h)
|
||||||
XFS_DINODE_FMT_DEV = 0 ; xfs_dev_t
|
XFS_DINODE_FMT_DEV = 0
|
||||||
XFS_DINODE_FMT_LOCAL = 1 ; one inode is enough (shortdir)
|
XFS_DINODE_FMT_LOCAL = 1
|
||||||
XFS_DINODE_FMT_EXTENTS = 2 ; one or more extents (leafdir, nodedir, regular files)
|
XFS_DINODE_FMT_EXTENTS = 2
|
||||||
XFS_DINODE_FMT_BTREE = 3 ; highly fragmented files or really huge directories
|
XFS_DINODE_FMT_BTREE = 3
|
||||||
XFS_DINODE_FMT_UUID = 4 ; uuid_t
|
XFS_DINODE_FMT_UUID = 4
|
||||||
|
|
||||||
|
|
||||||
; size of the unlinked inode hash table in the agi
|
; size of the unlinked inode hash table in the agi
|
||||||
XFS_AGI_UNLINKED_BUCKETS = 64
|
XFS_AGI_UNLINKED_BUCKETS = 64
|
||||||
|
|
||||||
|
|
||||||
; possible extent states
|
; possible extent states
|
||||||
; enum xfs_exntst_t (xfs_bmap_btree.h)
|
; enum xfs_exntst_t (xfs_bmap_btree.h)
|
||||||
XFS_EXT_NORM = 0
|
XFS_EXT_NORM = 0
|
||||||
@ -96,203 +125,165 @@ XFS_EXT_UNWRITTEN = 1
|
|||||||
XFS_EXT_DMAPI_OFFLINE = 2
|
XFS_EXT_DMAPI_OFFLINE = 2
|
||||||
XFS_EXT_INVALID = 3
|
XFS_EXT_INVALID = 3
|
||||||
|
|
||||||
|
|
||||||
; values for inode core flags / di_flags (xfs_dinode.h)
|
; values for inode core flags / di_flags (xfs_dinode.h)
|
||||||
XFS_DIFLAG_REALTIME_BIT = 0 ; file's blocks come from rt area
|
XFS_DIFLAG_REALTIME_BIT = 0 ; file's blocks come from rt area
|
||||||
XFS_DIFLAG_PREALLOC_BIT = 1 ; file space has been preallocated
|
XFS_DIFLAG_PREALLOC_BIT = 1 ; file space has been preallocated
|
||||||
XFS_DIFLAG_NEWRTBM_BIT = 2 ; for rtbitmap inode, new format
|
XFS_DIFLAG_NEWRTBM_BIT = 2 ; for rtbitmap inode, new format
|
||||||
XFS_DIFLAG_IMMUTABLE_BIT = 3 ; inode is immutable
|
|
||||||
XFS_DIFLAG_APPEND_BIT = 4 ; inode is append-only
|
|
||||||
XFS_DIFLAG_SYNC_BIT = 5 ; inode is written synchronously
|
|
||||||
XFS_DIFLAG_NOATIME_BIT = 6 ; do not update atime
|
|
||||||
XFS_DIFLAG_NODUMP_BIT = 7 ; do not dump
|
XFS_DIFLAG_NODUMP_BIT = 7 ; do not dump
|
||||||
XFS_DIFLAG_RTINHERIT_BIT = 8 ; create with realtime bit set
|
|
||||||
XFS_DIFLAG_PROJINHERIT_BIT = 9 ; create with parents projid
|
|
||||||
XFS_DIFLAG_NOSYMLINKS_BIT = 10 ; disallow symlink creation
|
|
||||||
XFS_DIFLAG_EXTSIZE_BIT = 11 ; inode extent size allocator hint
|
|
||||||
XFS_DIFLAG_EXTSZINHERIT_BIT = 12 ; inherit inode extent size
|
|
||||||
XFS_DIFLAG_NODEFRAG_BIT = 13 ; do not reorganize/defragment
|
|
||||||
XFS_DIFLAG_FILESTREAM_BIT = 14 ; use filestream allocator
|
|
||||||
XFS_DIFLAG_REALTIME = (1 SHL XFS_DIFLAG_REALTIME_BIT)
|
XFS_DIFLAG_REALTIME = (1 SHL XFS_DIFLAG_REALTIME_BIT)
|
||||||
XFS_DIFLAG_PREALLOC = (1 SHL XFS_DIFLAG_PREALLOC_BIT)
|
XFS_DIFLAG_PREALLOC = (1 SHL XFS_DIFLAG_PREALLOC_BIT)
|
||||||
XFS_DIFLAG_NEWRTBM = (1 SHL XFS_DIFLAG_NEWRTBM_BIT)
|
XFS_DIFLAG_NEWRTBM = (1 SHL XFS_DIFLAG_NEWRTBM_BIT)
|
||||||
XFS_DIFLAG_IMMUTABLE = (1 SHL XFS_DIFLAG_IMMUTABLE_BIT)
|
|
||||||
XFS_DIFLAG_APPEND = (1 SHL XFS_DIFLAG_APPEND_BIT)
|
|
||||||
XFS_DIFLAG_SYNC = (1 SHL XFS_DIFLAG_SYNC_BIT)
|
|
||||||
XFS_DIFLAG_NOATIME = (1 SHL XFS_DIFLAG_NOATIME_BIT)
|
|
||||||
XFS_DIFLAG_NODUMP = (1 SHL XFS_DIFLAG_NODUMP_BIT)
|
XFS_DIFLAG_NODUMP = (1 SHL XFS_DIFLAG_NODUMP_BIT)
|
||||||
XFS_DIFLAG_RTINHERIT = (1 SHL XFS_DIFLAG_RTINHERIT_BIT)
|
|
||||||
XFS_DIFLAG_PROJINHERIT = (1 SHL XFS_DIFLAG_PROJINHERIT_BIT)
|
|
||||||
XFS_DIFLAG_NOSYMLINKS = (1 SHL XFS_DIFLAG_NOSYMLINKS_BIT)
|
|
||||||
XFS_DIFLAG_EXTSIZE = (1 SHL XFS_DIFLAG_EXTSIZE_BIT)
|
|
||||||
XFS_DIFLAG_EXTSZINHERIT = (1 SHL XFS_DIFLAG_EXTSZINHERIT_BIT)
|
|
||||||
XFS_DIFLAG_NODEFRAG = (1 SHL XFS_DIFLAG_NODEFRAG_BIT)
|
|
||||||
XFS_DIFLAG_FILESTREAM = (1 SHL XFS_DIFLAG_FILESTREAM_BIT)
|
|
||||||
|
|
||||||
|
|
||||||
; superblock _ondisk_ structure (xfs_sb.h)
|
; superblock _ondisk_ structure (xfs_sb.h)
|
||||||
; this is _not_ the partition structure
|
; this is _not_ the partition structure
|
||||||
; for XFS partition structure see XFS below
|
; for XFS partition structure see XFS below
|
||||||
struct xfs_sb
|
struct xfs_sb
|
||||||
sb_magicnum dd ? ; signature, must be XFS_SB_MAGIC
|
sb_magicnum dd ? ; signature, must be XFS_SB_MAGIC
|
||||||
sb_blocksize dd ? ; block is the minimal file system unit, in bytes
|
sb_blocksize dd ? ; block is the minimal file system unit, in bytes
|
||||||
sb_dblocks dq ? ; number of data blocks
|
sb_dblocks DQ ? ; number of data blocks
|
||||||
sb_rblocks dq ? ; number of realtime blocks (not supported yet!)
|
sb_rblocks DQ ? ; number of realtime blocks
|
||||||
sb_rextents dq ? ; number of realtime extents (not supported yet!)
|
sb_rextents DQ ? ; number of realtime extents
|
||||||
sb_uuid rb 16 ; file system unique identifier
|
sb_uuid rb 16 ; file system unique identifier
|
||||||
sb_logstart dq ? ; starting block of log (for internal journal; journals on separate devices are not supported!)
|
sb_logstart DQ ? ; starting block of log (for internal journal)
|
||||||
sb_rootino dq ? ; root inode number
|
sb_rootino DQ ? ; root inode number
|
||||||
sb_rbmino dq ? ; bitmap inode for realtime extents (ignored)
|
sb_rbmino DQ ? ; bitmap inode for realtime extents
|
||||||
sb_rsumino dq ? ; summary inode for rt bitmap (ignored)
|
sb_rsumino DQ ? ; summary inode for rt bitmap
|
||||||
sb_rextsize dd ? ; realtime extent size, blocks
|
sb_rextsize dd ? ; realtime extent size, blocks
|
||||||
sb_agblocks dd ? ; size of an allocation group (the last one may be smaller!)
|
sb_agblocks dd ? ; size of an allocation group (the last one may be smaller!)
|
||||||
sb_agcount dd ? ; number of allocation groups
|
sb_agcount dd ? ; number of allocation groups
|
||||||
sb_rbmblocks dd ? ; number of rt bitmap blocks
|
sb_rbmblocks dd ? ; number of rt bitmap blocks
|
||||||
sb_logblocks dd ? ; number of log blocks
|
sb_logblocks dd ? ; number of log blocks
|
||||||
sb_versionnum dw ? ; header version == XFS_SB_VERSION
|
sb_versionnum dw ? ; header version
|
||||||
sb_sectsize dw ? ; volume sector size in bytes (only 512B sectors are supported)
|
sb_sectsize dw ? ; volume sector size in bytes
|
||||||
sb_inodesize dw ? ; inode size, bytes
|
sb_inodesize dw ? ; inode size, bytes
|
||||||
sb_inopblock dw ? ; inodes per block
|
sb_inopblock dw ? ; inodes per block
|
||||||
sb_fname rb 12 ; inodes per block (aka label)
|
sb_fname rb 12 ; inodes per block (aka label)
|
||||||
sb_blocklog db ? ; log2 of sb_blocksize
|
sb_blocklog db ? ; log2 of sb_blocksize
|
||||||
sb_sectlog db ? ; log2 of sb_blocksize
|
sb_sectlog db ? ; log2 of sb_blocksize
|
||||||
sb_inodelog db ? ; log2 of sb_inodesize
|
sb_inodelog db ? ; log2 of sb_inodesize
|
||||||
sb_inopblog db ? ; log2 of sb_inopblock
|
sb_inopblog db ? ; log2 of sb_inopblock
|
||||||
sb_agblklog db ? ; log2 of sb_agblocks (rounded up!)
|
sb_agblklog db ? ; log2 of sb_agblocks (rounded up!)
|
||||||
sb_rextslog db ? ; log2 of sb_rextents
|
sb_rextslog db ? ; log2 of sb_rextents
|
||||||
sb_inprogress db ? ; mkfs is in progress, don't mount
|
sb_inprogress db ? ; mkfs is in progress, don't mount
|
||||||
sb_imax_pct db ? ; max % of fs for inode space
|
sb_imax_pct db ? ; max % of fs for inode space
|
||||||
; statistics
|
; statistics
|
||||||
sb_icount dq ? ; allocated inodes
|
sb_icount DQ ? ; allocated inodes
|
||||||
sb_ifree dq ? ; free inodes
|
sb_ifree DQ ? ; free inodes
|
||||||
sb_fdblocks dq ? ; free data blocks
|
sb_fdblocks DQ ? ; free data blocks
|
||||||
sb_frextents dq ? ; free realtime extents
|
sb_frextents DQ ? ; free realtime extents
|
||||||
|
|
||||||
sb_uquotino dq ? ; user quota inode
|
sb_uquotino DQ ? ; user quota inode
|
||||||
sb_gquotino dq ? ; group quota inode
|
sb_gquotino DQ ? ; group quota inode
|
||||||
sb_qflags dw ? ; quota flags
|
sb_qflags dw ? ; quota flags
|
||||||
sb_flags db ? ; misc. flags
|
sb_flags db ? ; misc. flags
|
||||||
sb_shared_vn db ? ; shared version number
|
sb_shared_vn db ? ; shared version number
|
||||||
sb_inoalignmt dd ? ; inode chunk alignment, fsblocks
|
sb_inoalignmt dd ? ; inode chunk alignment, fsblocks
|
||||||
sb_unit dd ? ; stripe or raid unit
|
sb_unit dd ? ; stripe or raid unit
|
||||||
sb_width dd ? ; stripe or raid width
|
sb_width dd ? ; stripe or raid width
|
||||||
sb_dirblklog db ? ; log2 of dir block size (fsbs)
|
sb_dirblklog db ? ; log2 of dir block size (fsbs)
|
||||||
sb_logsectlog db ? ; log2 of the log sector size
|
sb_logsectlog db ? ; log2 of the log sector size
|
||||||
sb_logsectsize dw ? ; sector size for the log, bytes
|
sb_logsectsize dw ? ; sector size for the log, bytes
|
||||||
sb_logsunit dd ? ; stripe unit size for the log
|
sb_logsunit dd ? ; stripe unit size for the log
|
||||||
sb_features2 dd ? ; additional feature bits
|
sb_features2 dd ? ; additional feature bits
|
||||||
|
sb_bad_features2 dd ?
|
||||||
|
sb_features_compat dd ?
|
||||||
|
sb_features_ro_compat dd ?
|
||||||
|
sb_features_incompat dd ?
|
||||||
|
sb_features_log_incompat dd ?
|
||||||
|
sb_crc dd ? ; superblock crc
|
||||||
|
sb_spino_align dd ? ; sparse inode chunk alignment
|
||||||
|
sb_pquotino DQ ? ; project quota inode
|
||||||
|
sb_lsn DQ ? ; last write sequence
|
||||||
|
sb_meta_uuid rb 16 ; metadata file system unique id
|
||||||
ends
|
ends
|
||||||
|
|
||||||
|
|
||||||
; allocation group inode (xfs_ag.h)
|
|
||||||
struct xfs_agi
|
|
||||||
agi_magicnum dd ? ; magic number == XFS_AGI_MAGIC
|
|
||||||
agi_versionnum dd ? ; header version == XFS_AGI_VERSION
|
|
||||||
agi_seqno dd ? ; sequence number starting from 0
|
|
||||||
agi_length dd ? ; size in blocks of a.g.
|
|
||||||
agi_count dd ? ; count of allocated inodes
|
|
||||||
agi_root dd ? ; root of inode btree
|
|
||||||
agi_level dd ? ; levels in inode btree
|
|
||||||
agi_freecount dd ? ; number of free inodes
|
|
||||||
agi_newino dd ? ; new inode just allocated
|
|
||||||
agi_dirino dd ? ; last directory inode chunk
|
|
||||||
agi_unlinked rd XFS_AGI_UNLINKED_BUCKETS ; Hash table of inodes which have been unlinked but are still being referenced
|
|
||||||
ends
|
|
||||||
|
|
||||||
|
|
||||||
; superblock structure of b+tree node/leaf (same structure, bb_level matters)
|
|
||||||
struct xfs_btree_sblock
|
|
||||||
bb_magic dd ?
|
|
||||||
bb_level dw ? ; distinguishes nodeds and leaves
|
|
||||||
bb_numrecs dw ?
|
|
||||||
bb_leftsib dd ?
|
|
||||||
bb_rightsib dd ?
|
|
||||||
ends
|
|
||||||
|
|
||||||
|
|
||||||
; record of b+tree inode
|
|
||||||
struct xfs_inobt_rec
|
|
||||||
ir_startino dd ?
|
|
||||||
ir_freecount dd ?
|
|
||||||
ir_free dq ?
|
|
||||||
ends
|
|
||||||
|
|
||||||
|
|
||||||
; structure to store create, access and modification time in inode core
|
; structure to store create, access and modification time in inode core
|
||||||
struct xfs_timestamp
|
struct xfs_timestamp
|
||||||
t_sec dd ?
|
t_sec dd ?
|
||||||
t_nsec dd ? ; nanoseconds
|
t_nsec dd ? ; nanoseconds
|
||||||
ends
|
ends
|
||||||
|
|
||||||
|
|
||||||
; inode core structure: basic information about file
|
; inode core structure: basic information about file
|
||||||
struct xfs_dinode_core
|
struct xfs_dinode_core
|
||||||
di_magic dw ? ; inode magic = XFS_DINODE_MAGIC
|
di_magic dw ? ; inode magic = XFS_DINODE_MAGIC
|
||||||
di_mode dw ? ; mode and type of file
|
di_mode dw ? ; mode and type of file
|
||||||
di_version db ? ; inode version
|
di_version db ? ; inode version
|
||||||
di_format db ? ; format of di_c data
|
di_format db ? ; format of di_c data
|
||||||
di_onlink dw ? ; old number of links to file
|
di_onlink dw ? ; old number of links to file
|
||||||
di_uid dd ? ; owner's user id
|
di_uid dd ? ; owner's user id
|
||||||
di_gid dd ? ; owner's group id
|
di_gid dd ? ; owner's group id
|
||||||
di_nlink dd ? ; number of links to file
|
di_nlink dd ? ; number of links to file
|
||||||
di_projid dw ? ; owner's project id
|
di_projid dw ? ; owner's project id
|
||||||
di_pad rb 8 ; unused, zeroed space
|
di_pad rb 8 ; unused, zeroed space
|
||||||
di_flushiter dw ? ; incremented on flush
|
di_flushiter dw ? ; incremented on flush
|
||||||
di_atime xfs_timestamp ; time last accessed
|
di_atime xfs_timestamp ; time last accessed
|
||||||
di_mtime xfs_timestamp ; time last modified
|
di_mtime xfs_timestamp ; time last modified
|
||||||
di_ctime xfs_timestamp ; time created/inode modified
|
di_ctime xfs_timestamp ; time created/inode modified
|
||||||
di_size dq ? ; number of bytes in file
|
di_size DQ ? ; number of bytes in file
|
||||||
di_nblocks dq ? ; number of direct & btree blocks used
|
di_nblocks DQ ? ; number of direct & btree blocks used
|
||||||
di_extsize dd ? ; basic/minimum extent size for file
|
di_extsize dd ? ; basic/minimum extent size for file
|
||||||
di_nextents dd ? ; number of extents in data fork
|
di_nextents dd ? ; number of extents in data fork
|
||||||
di_anextents dw ? ; number of extents in attribute fork
|
di_anextents dw ? ; number of extents in attribute fork
|
||||||
di_forkoff db ? ; attr fork offs, <<3 for 64b align
|
di_forkoff db ? ; attr fork offs, <<3 for 64b align
|
||||||
di_aformat db ? ; format of attr fork's data
|
di_aformat db ? ; format of attr fork's data
|
||||||
di_dmevmask dd ? ; DMIG event mask
|
di_dmevmask dd ? ; DMIG event mask
|
||||||
di_dmstate dw ? ; DMIG state info
|
di_dmstate dw ? ; DMIG state info
|
||||||
di_flags dw ? ; random flags, XFS_DIFLAG_...
|
di_flags dw ? ; random flags, XFS_DIFLAG_...
|
||||||
di_gen dd ? ; generation number
|
di_gen dd ? ; generation number
|
||||||
|
di_next_unlinked dd ? ; unlinked but still used inode (if any, XFS_NULL otherwise)
|
||||||
|
ends
|
||||||
|
|
||||||
|
struct xfs_dinode3_core xfs_dinode_core
|
||||||
|
di_crc dd ? ; CRC of the inode
|
||||||
|
di_changecount DQ ? ; number of attribute changes
|
||||||
|
di_lsn DQ ? ; flush sequence
|
||||||
|
di_flags2 DQ ? ; more random flags
|
||||||
|
di_cowextsize dd ? ; basic cow extent size for file
|
||||||
|
di_pad2 rb 12 ; more padding for future expansion
|
||||||
|
|
||||||
|
; fields only written to during inode creation
|
||||||
|
di_crtime xfs_timestamp ; time created
|
||||||
|
di_ino DQ ? ; inode number
|
||||||
|
di_uuid rb 16 ; UUID of the filesystem
|
||||||
ends
|
ends
|
||||||
|
|
||||||
|
|
||||||
; shortform dir header
|
|
||||||
struct xfs_dir2_sf_hdr
|
struct xfs_dir2_sf_hdr
|
||||||
count db ? ; the number of directory entries, used only if each inode number fits 4 bytes; zero otherwise
|
count db ?
|
||||||
i8count db ? ; the number of directory entries, used only when count is zero
|
i8count db ?
|
||||||
parent dq ? ; parent inode number: xfs_dir2_inou_t (4 or 8 bytes)
|
parent DQ ? ; parent inode number, 4 or 8 bytes
|
||||||
ends
|
ends
|
||||||
|
|
||||||
|
|
||||||
; shortform dir entry
|
|
||||||
struct xfs_dir2_sf_entry
|
struct xfs_dir2_sf_entry
|
||||||
namelen db ? ; actual name length (ASCII)
|
namelen db ? ; actual name length (ASCII)
|
||||||
offset rb 2 ; saved offset
|
offset rb 2 ; saved offset
|
||||||
name db ? ; name, variable size
|
name db ? ; name, variable size
|
||||||
; inumber dq ? ; xfs_dir2_inou_t
|
inumber DQ ? ; 4 or 8 bytes
|
||||||
ends
|
ends
|
||||||
|
|
||||||
|
struct xfs_dir2_sf
|
||||||
|
hdr xfs_dir2_sf_hdr
|
||||||
|
entries xfs_dir2_sf_entry
|
||||||
|
ends
|
||||||
|
|
||||||
; active entry in a data block
|
; active entry in a data block
|
||||||
; aligned to 8 bytes
|
; aligned to 8 bytes
|
||||||
; tag appears as the last 2 bytes
|
; tag appears as the last 2 bytes
|
||||||
struct xfs_dir2_data_entry
|
struct xfs_dir2_data_entry
|
||||||
inumber dq ? ; inode number
|
inumber DQ ?
|
||||||
namelen db ? ; name length
|
namelen db ?
|
||||||
name db ? ; name bytes, no null
|
name db ? ; name bytes array without terminator
|
||||||
; tag dw ? ; starting offset of us
|
; tag dw ? ; starting offset of the entry
|
||||||
ends
|
ends
|
||||||
|
|
||||||
|
|
||||||
; unused entry in a data block
|
; unused entry in a data block
|
||||||
; aligned to 8 bytes
|
|
||||||
; tag appears as the last 2 bytes
|
|
||||||
struct xfs_dir2_data_unused
|
struct xfs_dir2_data_unused
|
||||||
freetag dw ? ; XFS_DIR2_DATA_FREE_TAG
|
freetag dw ? ; XFS_DIR2_DATA_FREE_TAG aka XFS_NULL
|
||||||
length dw ? ; total free length
|
length dw ? ; total free length
|
||||||
; tag dw ? ; starting offset of us
|
; tag dw ? ; starting offset of the entry
|
||||||
ends
|
ends
|
||||||
|
|
||||||
|
|
||||||
; generic data entry
|
; generic data entry
|
||||||
struct xfs_dir2_data_union
|
struct xfs_dir2_data_union
|
||||||
union
|
union
|
||||||
@ -301,7 +292,6 @@ struct xfs_dir2_data_union
|
|||||||
ends
|
ends
|
||||||
ends
|
ends
|
||||||
|
|
||||||
|
|
||||||
; describe a free area in the data block
|
; describe a free area in the data block
|
||||||
; the freespace will be formatted as a xfs_dir2_data_unused_t
|
; the freespace will be formatted as a xfs_dir2_data_unused_t
|
||||||
struct xfs_dir2_data_free
|
struct xfs_dir2_data_free
|
||||||
@ -309,17 +299,24 @@ struct xfs_dir2_data_free
|
|||||||
length dw ? ; length of freespace
|
length dw ? ; length of freespace
|
||||||
ends
|
ends
|
||||||
|
|
||||||
|
|
||||||
; header for the data blocks
|
; header for the data blocks
|
||||||
; always at the beginning of a directory-sized block
|
; always at the beginning of a directory-sized block
|
||||||
; the code knows that XFS_DIR2_DATA_FD_COUNT is 3
|
; the code knows that XFS_DIR2_DATA_FD_COUNT is 3
|
||||||
struct xfs_dir2_data_hdr
|
struct xfs_dir2_data_hdr
|
||||||
magic dd ? ; XFS_DIR2_DATA_MAGIC or XFS_DIR2_BLOCK_MAGIC
|
magic dd ? ; XFS_DIR2_DATA_MAGIC or XFS_DIR2_BLOCK_MAGIC
|
||||||
bestfree xfs_dir2_data_free
|
bestfree xfs_dir2_data_free
|
||||||
bestfree2 xfs_dir2_data_free
|
bestfree2 xfs_dir2_data_free
|
||||||
bestfree3 xfs_dir2_data_free
|
bestfree3 xfs_dir2_data_free
|
||||||
ends
|
ends
|
||||||
|
|
||||||
|
struct xfs_dir3_data_hdr xfs_dir2_data_hdr
|
||||||
|
magic3 dd ?
|
||||||
|
crc dd ?
|
||||||
|
blkno DQ ?
|
||||||
|
lsn DQ ?
|
||||||
|
uuid rb 16
|
||||||
|
owner DQ ?
|
||||||
|
ends
|
||||||
|
|
||||||
; leaf block entry
|
; leaf block entry
|
||||||
struct xfs_dir2_leaf_entry
|
struct xfs_dir2_leaf_entry
|
||||||
@ -327,31 +324,20 @@ struct xfs_dir2_leaf_entry
|
|||||||
address dd ? ; address of data entry
|
address dd ? ; address of data entry
|
||||||
ends
|
ends
|
||||||
|
|
||||||
|
|
||||||
; the tail of directory block
|
; the tail of directory block
|
||||||
struct xfs_dir2_block_tail
|
struct xfs_dir2_block_tail
|
||||||
count dd ? ; count of leaf entries
|
count dd ? ; count of leaf entries
|
||||||
stale dd ? ; count of stale leaf entries
|
stale dd ? ; count of stale leaf entries
|
||||||
ends
|
ends
|
||||||
|
|
||||||
|
|
||||||
; generic single-block structure, for xfs_db
|
; generic single-block structure, for xfs_db
|
||||||
struct xfs_dir2_block
|
struct xfs_dir2_block
|
||||||
hdr xfs_dir2_data_hdr
|
hdr xfs_dir2_data_hdr ; magic XFS_DIR2_DATA_MAGIC
|
||||||
u xfs_dir2_data_union
|
u xfs_dir2_data_union
|
||||||
; leaf xfs_dir2_leaf_entry
|
; leaf xfs_dir2_leaf_entry
|
||||||
; tail xfs_dir2_block_tail
|
; tail xfs_dir2_block_tail
|
||||||
ends
|
ends
|
||||||
|
|
||||||
|
|
||||||
;
|
|
||||||
struct xfs_dir2_data
|
|
||||||
hdr xfs_dir2_data_hdr ; magic XFS_DIR2_DATA_MAGIC
|
|
||||||
u xfs_dir2_data_union
|
|
||||||
ends
|
|
||||||
|
|
||||||
|
|
||||||
;
|
|
||||||
struct xfs_da_blkinfo
|
struct xfs_da_blkinfo
|
||||||
forw dd ? ; previous block in list
|
forw dd ? ; previous block in list
|
||||||
back dd ? ; following block in list
|
back dd ? ; following block in list
|
||||||
@ -359,33 +345,43 @@ struct xfs_da_blkinfo
|
|||||||
pad dw ? ; unused
|
pad dw ? ; unused
|
||||||
ends
|
ends
|
||||||
|
|
||||||
|
|
||||||
; leaf block header
|
|
||||||
struct xfs_dir2_leaf_hdr
|
struct xfs_dir2_leaf_hdr
|
||||||
info xfs_da_blkinfo ; header for da routines
|
info xfs_da_blkinfo
|
||||||
count dw ? ; count of entries
|
count dw ?
|
||||||
stale dw ? ; count of stale entries
|
stale dw ?
|
||||||
ends
|
ends
|
||||||
|
|
||||||
|
struct xfs_da3_blkinfo xfs_da_blkinfo
|
||||||
; leaf block tail
|
crc dd ? ; CRC of block
|
||||||
struct xfs_dir2_leaf_tail
|
blkno DQ ? ; first block of the buffer
|
||||||
bestcount dd ?
|
lsn DQ ? ; sequence number of last write
|
||||||
|
uuid rb 16 ; filesystem we belong to
|
||||||
|
owner DQ ? ; inode that owns the block
|
||||||
ends
|
ends
|
||||||
|
|
||||||
|
struct xfs_dir3_leaf_hdr
|
||||||
|
info xfs_da3_blkinfo
|
||||||
|
count dw ?
|
||||||
|
stale dw ?
|
||||||
|
pad dd ?
|
||||||
|
ends
|
||||||
|
|
||||||
; leaf block
|
|
||||||
; bests and tail are at the end of the block for single-leaf only
|
; bests and tail are at the end of the block for single-leaf only
|
||||||
; (magic = XFS_DIR2_LEAF1_MAGIC not XFS_DIR2_LEAFN_MAGIC)
|
; (magic = XFS_DIR2_LEAF1_MAGIC not XFS_DIR2_LEAFN_MAGIC)
|
||||||
struct xfs_dir2_leaf
|
struct xfs_dir2_leaf
|
||||||
hdr xfs_dir2_leaf_hdr ; leaf header
|
hdr xfs_dir2_leaf_hdr
|
||||||
ents xfs_dir2_leaf_entry ; entries
|
ents xfs_dir2_leaf_entry
|
||||||
; bests dw ? ; best free counts
|
; bests dw ?
|
||||||
; tail xfs_dir2_leaf_tail ; leaf tail
|
; tail xfs_dir2_leaf_tail
|
||||||
ends
|
ends
|
||||||
|
|
||||||
|
struct xfs_dir3_leaf
|
||||||
|
hdr xfs_dir3_leaf_hdr
|
||||||
|
ents xfs_dir2_leaf_entry
|
||||||
|
; bests
|
||||||
|
; tail
|
||||||
|
ends
|
||||||
|
|
||||||
; header of 'free' block part
|
|
||||||
struct xfs_dir2_free_hdr
|
struct xfs_dir2_free_hdr
|
||||||
magic dd ? ; XFS_DIR2_FREE_MAGIC
|
magic dd ? ; XFS_DIR2_FREE_MAGIC
|
||||||
firstdb dd ? ; db of first entry
|
firstdb dd ? ; db of first entry
|
||||||
@ -393,69 +389,68 @@ struct xfs_dir2_free_hdr
|
|||||||
nused dd ? ; count of used entries
|
nused dd ? ; count of used entries
|
||||||
ends
|
ends
|
||||||
|
|
||||||
|
|
||||||
; 'free' part of directiry block
|
|
||||||
struct xfs_dir2_free
|
|
||||||
hdr xfs_dir2_free_hdr ; block header
|
|
||||||
bests dw ? ; best free counts
|
|
||||||
; unused entries are -1 (XFS_NULL)
|
|
||||||
ends
|
|
||||||
|
|
||||||
|
|
||||||
; b+tree node header
|
|
||||||
struct xfs_da_node_hdr
|
struct xfs_da_node_hdr
|
||||||
info xfs_da_blkinfo
|
info xfs_da_blkinfo
|
||||||
count dw ?
|
count dw ?
|
||||||
level dw ?
|
level dw ?
|
||||||
ends
|
ends
|
||||||
|
|
||||||
|
|
||||||
; b+tree node
|
|
||||||
struct xfs_da_node_entry
|
struct xfs_da_node_entry
|
||||||
hashval dd ? ; hash value for this descendant
|
hashval dd ? ; hash value for this descendant
|
||||||
before dd ? ; Btree block before this key
|
before dd ? ; Btree block before this key
|
||||||
ends
|
ends
|
||||||
|
|
||||||
|
|
||||||
;
|
|
||||||
struct xfs_da_intnode
|
struct xfs_da_intnode
|
||||||
hdr xfs_da_node_hdr
|
hdr xfs_da_node_hdr
|
||||||
btree xfs_da_node_entry
|
btree xfs_da_node_entry
|
||||||
ends
|
ends
|
||||||
|
|
||||||
|
struct xfs_da3_node_hdr
|
||||||
|
info xfs_da3_blkinfo
|
||||||
|
count dw ?
|
||||||
|
level dw ?
|
||||||
|
pad dd ?
|
||||||
|
ends
|
||||||
|
|
||||||
|
struct xfs_da3_intnode
|
||||||
|
hdr xfs_da3_node_hdr
|
||||||
|
btree xfs_da_node_entry
|
||||||
|
ends
|
||||||
|
|
||||||
; packet extent
|
; packet extent
|
||||||
struct xfs_bmbt_rec
|
struct xfs_bmbt_rec
|
||||||
l0 dq ?
|
l0 DQ ?
|
||||||
l1 dq ?
|
l1 DQ ?
|
||||||
ends
|
ends
|
||||||
|
|
||||||
|
|
||||||
; unpacked extent
|
; unpacked extent
|
||||||
struct xfs_bmbt_irec
|
struct xfs_bmbt_irec
|
||||||
br_startoff dq ? ; starting file offset
|
br_startoff DQ ?
|
||||||
br_startblock dq ? ; starting block number
|
br_startblock DQ ?
|
||||||
br_blockcount dd ? ; number of blocks
|
br_blockcount dd ?
|
||||||
br_state dd ? ; extent state
|
br_state dd ?
|
||||||
ends
|
ends
|
||||||
|
|
||||||
|
struct xfs_dir2_bmx
|
||||||
|
bmx xfs_bmbt_rec
|
||||||
|
ends
|
||||||
|
|
||||||
; bmap root header, on-disk form only
|
; bmap root header
|
||||||
struct xfs_bmdr_block
|
struct xfs_bmdr_block
|
||||||
bb_level dw ? ; 0 is a leaf
|
bb_level dw ? ; 0 is a leaf
|
||||||
bb_numrecs dw ? ; current number of data records
|
bb_numrecs dw ? ; current number of data records
|
||||||
ends
|
ends
|
||||||
|
|
||||||
|
|
||||||
; key structure for non-leaf levels of the tree
|
; key structure for non-leaf levels of the tree
|
||||||
struct xfs_bmbt_key
|
struct xfs_bmbt_key
|
||||||
br_startoff dq ? ; starting file offset
|
br_startoff DQ ? ; starting file offset
|
||||||
ends
|
ends
|
||||||
|
|
||||||
|
struct xfs_bmdr_ptr DQ
|
||||||
|
ends
|
||||||
|
|
||||||
sizeof.xfs_bmbt_ptr = 8 ; workaround
|
struct xfs_bmbt_ptr DQ
|
||||||
sizeof.xfs_bmdr_ptr = 8 ; workaround
|
ends
|
||||||
|
|
||||||
|
|
||||||
; long form header: bmap btrees
|
; long form header: bmap btrees
|
||||||
; xfs_btree_lblock is xfs_bmbt_block (xfs_btree.h)
|
; xfs_btree_lblock is xfs_bmbt_block (xfs_btree.h)
|
||||||
@ -463,66 +458,165 @@ struct xfs_bmbt_block
|
|||||||
bb_magic dd ? ; magic number for block type
|
bb_magic dd ? ; magic number for block type
|
||||||
bb_level dw ? ; 0 is a leaf
|
bb_level dw ? ; 0 is a leaf
|
||||||
bb_numrecs dw ? ; current number of data records
|
bb_numrecs dw ? ; current number of data records
|
||||||
bb_leftsib dq ? ; left sibling block or NULLDFSBNO
|
bb_leftsib DQ ? ; left sibling block or NULLDFSBNO
|
||||||
bb_rightsib dq ? ; right sibling block or NULLDFSBNO
|
bb_rightsib DQ ? ; right sibling block or NULLDFSBNO
|
||||||
ends
|
ends
|
||||||
|
|
||||||
|
struct xfs_bmbt3_block xfs_bmbt_block
|
||||||
|
bb_blkno DQ ?
|
||||||
|
bb_lsn DQ ?
|
||||||
|
bb_uuid rb 16
|
||||||
|
bb_owner DQ ?
|
||||||
|
bb_crc dd ?
|
||||||
|
bb_pad dd ?
|
||||||
|
ends
|
||||||
|
|
||||||
; high level inode structure
|
|
||||||
struct xfs_inode
|
struct xfs_inode
|
||||||
di_core xfs_dinode_core ; main info, aka core
|
di_core xfs_dinode_core ; main info, aka core
|
||||||
di_next_unlinked dd ? ; unlinked but still used inode (if any, XFS_NULL otherwise)
|
union
|
||||||
di_u db ? ; data fork inode part
|
di_u db ? ; data fork inode part
|
||||||
|
dir2_sf xfs_dir2_sf
|
||||||
|
bmx xfs_dir2_bmx
|
||||||
|
ends
|
||||||
; di_a db ? ; data attribute
|
; di_a db ? ; data attribute
|
||||||
ends
|
ends
|
||||||
|
|
||||||
|
struct xfs_agf
|
||||||
|
agf_magicnum dd ? ; magic number == XFS_AGF_MAGIC
|
||||||
|
agf_versionnum dd ? ; header version == XFS_AGF_VERSION
|
||||||
|
agf_seqno dd ? ; sequence # starting from 0
|
||||||
|
agf_length dd ? ; size in blocks of AG
|
||||||
|
agf_roots dd ?
|
||||||
|
agf_levels dd ?
|
||||||
|
agf_flfirst dd ?
|
||||||
|
agf_fllast dd ?
|
||||||
|
agf_flcount dd ?
|
||||||
|
agf_freeblks dd ? ; free blocks in AG
|
||||||
|
ends
|
||||||
|
|
||||||
; internal data for every XFS partition
|
; internal data for every XFS partition
|
||||||
; this _is_ XFS partition structure
|
; this _is_ XFS partition structure
|
||||||
; most fields are unpacked or bswap'ed values from the superblock, so see xfs_sb structure above
|
; most fields are unpacked or bswap'ed values of the superblock, see xfs_sb structure above
|
||||||
struct XFS PARTITION
|
struct XFS PARTITION
|
||||||
Lock MUTEX ? ; access mutex
|
Lock MUTEX ? ; access mutex
|
||||||
blocksize dd ?
|
|
||||||
sectsize dd ?
|
sectsize dd ?
|
||||||
|
blocksize dd ?
|
||||||
dirblocksize dd ?
|
dirblocksize dd ?
|
||||||
rootino dq ?
|
|
||||||
cur_block dd ?
|
|
||||||
cur_inode dd ?
|
|
||||||
cur_sect dd ?
|
|
||||||
cur_dirblock dd ?
|
|
||||||
tmp_inode dd ?
|
|
||||||
versionnum dd ?
|
|
||||||
features2 dd ?
|
|
||||||
inodesize dd ?
|
inodesize dd ?
|
||||||
|
rootino DQ ?
|
||||||
|
versionnum dd ?
|
||||||
|
version dd ?
|
||||||
|
features2 dd ?
|
||||||
inopblock dd ?
|
inopblock dd ?
|
||||||
|
blkpdirblk dd ?
|
||||||
blocklog dd ?
|
blocklog dd ?
|
||||||
sectlog dd ?
|
sectlog dd ?
|
||||||
inodelog dd ?
|
inodelog dd ?
|
||||||
inopblog dd ?
|
inopblog dd ?
|
||||||
agblklog dd ?
|
agblklog dd ?
|
||||||
blockmsectlog dd ?
|
sectpblog dd ?
|
||||||
inodetoblocklog dd ?
|
dirblklog dd ? ; in fsblocks
|
||||||
dirblklog dd ?
|
|
||||||
sectpblock dd ?
|
sectpblock dd ?
|
||||||
agblocks dd ?
|
agblocks dd ?
|
||||||
|
dir2_leaf_offset_blocks DQ ?
|
||||||
|
dir2_free_offset_blocks DQ ?
|
||||||
|
agblockmask DQ ?
|
||||||
|
inode_core_size dd ?
|
||||||
|
features_incompat dd ?
|
||||||
|
ftype_size dd ?
|
||||||
|
dir_block_magic dd ?
|
||||||
|
dir_data_magic dd ?
|
||||||
|
dir_leaf1_magic dw ?
|
||||||
|
dir_leafn_magic dw ?
|
||||||
|
da_node_magic dw ?
|
||||||
|
bmap_magic dd ?
|
||||||
|
bmbt_block_size dd ?
|
||||||
|
dir_block_size dd ?
|
||||||
|
dir_data_size dd ?
|
||||||
|
dir_leaf1_size dd ?
|
||||||
|
dir_leafn_size dd ?
|
||||||
|
da_node_size dd ?
|
||||||
|
da_blkinfo_size dd ?
|
||||||
; helpers, temporary vars, etc
|
; helpers, temporary vars, etc
|
||||||
agblockmask dq ?
|
; should go to file descriptor and local vars?
|
||||||
|
cur_block dd ?
|
||||||
|
cur_block_data dd ?
|
||||||
|
cur_inode dd ?
|
||||||
|
cur_sect dd ?
|
||||||
|
cur_dirblock dd ?
|
||||||
|
tmp_inode dd ?
|
||||||
extent xfs_bmbt_irec
|
extent xfs_bmbt_irec
|
||||||
left_extents dd ?
|
|
||||||
left_leaves dd ?
|
|
||||||
bytes_to_read dd ?
|
bytes_to_read dd ?
|
||||||
bytes_read dd ?
|
bytes_read dd ?
|
||||||
|
bytes_left_in_file DQ ?
|
||||||
|
file_offset DQ ?
|
||||||
|
file_buffer dd ?
|
||||||
entries_read dd ?
|
entries_read dd ?
|
||||||
file_offset dq ?
|
requested_cnt dd ?
|
||||||
|
dir_sf_self_done dd ?
|
||||||
|
dir_sf_parent_done dd ?
|
||||||
|
entries_left_in_dir dd ?
|
||||||
|
entries_to_skip dd ?
|
||||||
max_dirblockaddr dd ?
|
max_dirblockaddr dd ?
|
||||||
next_block_num dq ?
|
|
||||||
dir2_leaf_offset_blocks dd ?
|
|
||||||
dir2_free_offset_blocks dd ?
|
|
||||||
cur_inode_save dd ?
|
cur_inode_save dd ?
|
||||||
bytes_left_in_file dq ?
|
shortform_inodelen dd ?
|
||||||
ro_nextents dd ?
|
bdfe_nameenc dd ?
|
||||||
bb_ptrs dd ?
|
bdfe_len dd ?
|
||||||
maxnumrecs dd ?
|
bdfe_process dd ?
|
||||||
buffer_pos dd ?
|
inode_self DQ ?
|
||||||
|
bdfe_buf dd ?
|
||||||
eof dd ?
|
eof dd ?
|
||||||
|
offset_begin DQ ?
|
||||||
|
offset_end DQ ?
|
||||||
|
ends
|
||||||
|
|
||||||
|
struct f70s0arg
|
||||||
|
sf dd ?
|
||||||
|
offset DQ ?
|
||||||
|
count dd ?
|
||||||
|
buf dd ?
|
||||||
|
zero db ?
|
||||||
|
path dd ?
|
||||||
|
ends
|
||||||
|
|
||||||
|
struct f70s1arg
|
||||||
|
sf dd ?
|
||||||
|
start_idx dd ?
|
||||||
|
encoding dd ?
|
||||||
|
count dd ?
|
||||||
|
buf dd ?
|
||||||
|
zero db ?
|
||||||
|
path dd ?
|
||||||
|
ends
|
||||||
|
|
||||||
|
struct f70s5arg
|
||||||
|
sf dd ?
|
||||||
|
dd ?
|
||||||
|
xflags dd ? ; name flags is already used
|
||||||
|
dd ?
|
||||||
|
buf dd ?
|
||||||
|
zero db ?
|
||||||
|
path dd ?
|
||||||
|
ends
|
||||||
|
|
||||||
|
struct bdfe_hdr
|
||||||
|
version dd ?
|
||||||
|
read_cnt dd ?
|
||||||
|
total_cnt dd ?
|
||||||
|
zeroed rd 5
|
||||||
|
ends
|
||||||
|
|
||||||
|
struct bdfe
|
||||||
|
attr dd ?
|
||||||
|
nameenc dd ?
|
||||||
|
; nameenc db ?
|
||||||
|
; reserved db 3 dup(?)
|
||||||
|
ctime dd ?
|
||||||
|
cdate dd ?
|
||||||
|
atime dd ?
|
||||||
|
adate dd ?
|
||||||
|
mtime dd ?
|
||||||
|
mdate dd ?
|
||||||
|
size DQ ?
|
||||||
|
name db ?
|
||||||
ends
|
ends
|
||||||
|
@ -68,6 +68,7 @@ include "fs/fs_lfn.inc" ; sysfunction 70
|
|||||||
include "network/stack.inc"
|
include "network/stack.inc"
|
||||||
|
|
||||||
include "crc.inc" ; checksums
|
include "crc.inc" ; checksums
|
||||||
|
include "unicode.inc"
|
||||||
|
|
||||||
; include "imports.inc"
|
; include "imports.inc"
|
||||||
; include "core/ext_lib.inc"
|
; include "core/ext_lib.inc"
|
||||||
|
117
kernel/trunk/unicode.inc
Normal file
117
kernel/trunk/unicode.inc
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;; ;;
|
||||||
|
;; Copyright (C) KolibriOS team 2020-2020. All rights reserved. ;;
|
||||||
|
;; Distributed under terms of the GNU General Public License. ;;
|
||||||
|
;; Version 2, or (at your option) any later version. ;;
|
||||||
|
;; ;;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
$Revision$
|
||||||
|
|
||||||
|
unicode.utf8.decode:
|
||||||
|
test ecx, ecx
|
||||||
|
jz .error
|
||||||
|
movzx eax, byte[esi]
|
||||||
|
test al, al
|
||||||
|
jns .read1
|
||||||
|
shl al, 2
|
||||||
|
jnc .error
|
||||||
|
shl al, 1
|
||||||
|
jnc .read2
|
||||||
|
shl al, 1
|
||||||
|
jnc .read3
|
||||||
|
shl al, 1
|
||||||
|
jnc .read4
|
||||||
|
jmp .error
|
||||||
|
.read1:
|
||||||
|
sub ecx, 1
|
||||||
|
add esi, 1
|
||||||
|
jmp .done
|
||||||
|
.read2:
|
||||||
|
cmp ecx, 2
|
||||||
|
jb .error
|
||||||
|
shl eax, 5
|
||||||
|
mov al, [esi+1]
|
||||||
|
shl al, 1
|
||||||
|
jnc .error
|
||||||
|
shl al, 1
|
||||||
|
jc .error
|
||||||
|
shr eax, 2
|
||||||
|
sub ecx, 2
|
||||||
|
add esi, 2
|
||||||
|
jmp .done
|
||||||
|
.read3:
|
||||||
|
cmp ecx, 3
|
||||||
|
jb .error
|
||||||
|
shl eax, 4
|
||||||
|
mov al, [esi+1]
|
||||||
|
shl al, 1
|
||||||
|
jnc .error
|
||||||
|
shl al, 1
|
||||||
|
jc .error
|
||||||
|
shl eax, 6
|
||||||
|
mov al, [esi+2]
|
||||||
|
shl al, 1
|
||||||
|
jnc .error
|
||||||
|
shl al, 1
|
||||||
|
jc .error
|
||||||
|
shr eax, 2
|
||||||
|
sub ecx, 3
|
||||||
|
add esi, 3
|
||||||
|
jmp .done
|
||||||
|
.read4:
|
||||||
|
cmp ecx, 4
|
||||||
|
jb .error
|
||||||
|
shl eax, 3
|
||||||
|
mov al, [esi+1]
|
||||||
|
shl al, 1
|
||||||
|
jnc .error
|
||||||
|
shl al, 1
|
||||||
|
jc .error
|
||||||
|
shl eax, 6
|
||||||
|
mov al, [esi+2]
|
||||||
|
shl al, 1
|
||||||
|
jnc .error
|
||||||
|
shl al, 1
|
||||||
|
jc .error
|
||||||
|
shl eax, 6
|
||||||
|
mov al, [esi+3]
|
||||||
|
shl al, 1
|
||||||
|
jnc .error
|
||||||
|
shl al, 1
|
||||||
|
jc .error
|
||||||
|
shr eax, 2
|
||||||
|
sub ecx, 4
|
||||||
|
add esi, 4
|
||||||
|
jmp .done
|
||||||
|
.error:
|
||||||
|
.done:
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
unicode.cp866.encode:
|
||||||
|
call uni2ansi_char
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
unicode.utf16.encode:
|
||||||
|
cmp eax, 0x110000
|
||||||
|
jae .error
|
||||||
|
cmp eax, 0x10000
|
||||||
|
jae .write2
|
||||||
|
cmp eax, 0xe000
|
||||||
|
jae .write1
|
||||||
|
cmp eax, 0xd800
|
||||||
|
jb .write1
|
||||||
|
jmp .error
|
||||||
|
.write1:
|
||||||
|
jmp .done
|
||||||
|
.write2:
|
||||||
|
sub eax, 0x10000
|
||||||
|
shl eax, 6
|
||||||
|
shr ax, 6
|
||||||
|
or eax, 0xdc00d800
|
||||||
|
jmp .done
|
||||||
|
.done:
|
||||||
|
.error:
|
||||||
|
ret
|
Loading…
Reference in New Issue
Block a user