⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ufs2.h

📁 i386的bootloader源码grub
💻 H
📖 第 1 页 / 共 2 页
字号:
/* * Copyright (c) 2002 Networks Associates Technology, Inc. * All rights reserved. * * This software was developed for the FreeBSD Project by Marshall * Kirk McKusick and Network Associates Laboratories, the Security * Research Division of Network Associates, Inc. under DARPA/SPAWAR * contract N66001-01-C-8035 ("CBOSS"), as part of the DARPA CHATS * research program * * Copyright (c) 1982, 1989, 1993 *	The Regents of the University of California.  All rights reserved. * (c) UNIX System Laboratories, Inc. * All or some portions of this file are derived from material licensed * to the University of California by American Telephone and Telegraph * Co. or Unix System Laboratories, Inc. and are reproduced herein with * the permission of UNIX System Laboratories, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright *    notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright *    notice, this list of conditions and the following disclaimer in the *    documentation and/or other materials provided with the distribution. * 3. The names of the authors may not be used to endorse or promote *    products derived from this software without specific prior written *    permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * *	@(#)dinode.h	8.3 (Berkeley) 1/21/94 * $FreeBSD: src/sys/ufs/ufs/dinode.h,v 1.11 2002/07/16 22:36:00 mckusick Exp $ */#ifndef _GRUB_UFS2_H_#define _GRUB_UFS2_H_typedef signed char            int8_t;typedef signed short           int16_t;typedef signed int             int32_t;typedef signed long long int   int64_t;typedef unsigned char          uint8_t;typedef unsigned short         uint16_t;typedef unsigned int           uint32_t;typedef unsigned long long int uint64_t;typedef uint8_t                u_char;typedef uint32_t               u_int;typedef uint8_t                u_int8_t;typedef uint16_t               u_int16_t;typedef uint32_t               u_int32_t;typedef uint64_t               u_int64_t;/* * __uint* constants already defined in * FreeBSD's /usr/include/machine/_types.h */#ifndef _MACHINE__TYPES_H_typedef uint8_t                __uint8_t;typedef uint16_t               __uint16_t;typedef uint32_t               __uint32_t;typedef uint64_t               __uint64_t;#endif /* _MACHINE__TYPES_H_ */#define i_size di_size#define DEV_BSIZE 512/* * The root inode is the root of the filesystem.  Inode 0 can't be used for * normal purposes and historically bad blocks were linked to inode 1, thus * the root inode is 2.  (Inode 1 is no longer used for this purpose, however * numerous dump tapes make this assumption, so we are stuck with it). */#define	ROOTINO	((ino_t)2)/* * The size of physical and logical block numbers and time fields in UFS. */typedef int32_t ufs1_daddr_t;typedef	int64_t	ufs2_daddr_t;typedef int64_t ufs_lbn_t;typedef int64_t ufs_time_t;/* inode number */typedef __uint32_t      ino_t;/* File permissions. */#define	IEXEC		0000100		/* Executable. */#define	IWRITE		0000200		/* Writeable. */#define	IREAD		0000400		/* Readable. */#define	ISVTX		0001000		/* Sticky bit. */#define	ISGID		0002000		/* Set-gid. */#define	ISUID		0004000		/* Set-uid. *//* File types. */#define	IFMT		0170000		/* Mask of file type. */#define	IFIFO		0010000		/* Named pipe (fifo). */#define	IFCHR		0020000		/* Character device. */#define	IFDIR		0040000		/* Directory file. */#define	IFBLK		0060000		/* Block device. */#define	IFREG		0100000		/* Regular file. */#define	IFLNK		0120000		/* Symbolic link. */#define	IFSOCK		0140000		/* UNIX domain socket. */#define	IFWHT		0160000		/* Whiteout. *//* * A dinode contains all the meta-data associated with a UFS2 file. * This structure defines the on-disk format of a dinode. Since * this structure describes an on-disk structure, all its fields * are defined by types with precise widths. */#define	NXADDR	2			/* External addresses in inode. */#define	NDADDR	12			/* Direct addresses in inode. */#define	NIADDR	3			/* Indirect addresses in inode. */struct ufs1_dinode {	u_int16_t       di_mode;        /*   0: IFMT, permissions; see below. */	int16_t         di_nlink;       /*   2: File link count. */	union {		u_int16_t oldids[2];    /*   4: Ffs: old user and group ids. */	} di_u;	u_int64_t       di_size;        /*   8: File byte count. */	int32_t         di_atime;       /*  16: Last access time. */	int32_t         di_atimensec;   /*  20: Last access time. */	int32_t         di_mtime;       /*  24: Last modified time. */	int32_t         di_mtimensec;   /*  28: Last modified time. */	int32_t         di_ctime;       /*  32: Last inode change time. */	int32_t         di_ctimensec;   /*  36: Last inode change time. */	ufs1_daddr_t    di_db[NDADDR];  /*  40: Direct disk blocks. */	ufs1_daddr_t    di_ib[NIADDR];  /*  88: Indirect disk blocks. */	u_int32_t       di_flags;       /* 100: Status flags (chflags). */	int32_t         di_blocks;      /* 104: Blocks actually held. */	int32_t         di_gen;         /* 108: Generation number. */	u_int32_t       di_uid;         /* 112: File owner. */	u_int32_t       di_gid;         /* 116: File group. */	int32_t         di_spare[2];    /* 120: Reserved; currently unused */};struct ufs2_dinode {	u_int16_t	di_mode;	/*   0: IFMT, permissions; see below. */	int16_t		di_nlink;	/*   2: File link count. */	u_int32_t	di_uid;		/*   4: File owner. */	u_int32_t	di_gid;		/*   8: File group. */	u_int32_t	di_blksize;	/*  12: Inode blocksize. */	u_int64_t	di_size;	/*  16: File byte count. */	u_int64_t	di_blocks;	/*  24: Bytes actually held. */	ufs_time_t	di_atime;	/*  32: Last access time. */	ufs_time_t	di_mtime;	/*  40: Last modified time. */	ufs_time_t	di_ctime;	/*  48: Last inode change time. */	ufs_time_t	di_birthtime;	/*  56: Inode creation time. */	int32_t		di_mtimensec;	/*  64: Last modified time. */	int32_t		di_atimensec;	/*  68: Last access time. */	int32_t		di_ctimensec;	/*  72: Last inode change time. */	int32_t		di_birthnsec;	/*  76: Inode creation time. */	int32_t		di_gen;		/*  80: Generation number. */	u_int32_t	di_kernflags;	/*  84: Kernel flags. */	u_int32_t	di_flags;	/*  88: Status flags (chflags). */	int32_t		di_extsize;	/*  92: External attributes block. */	ufs2_daddr_t	di_extb[NXADDR];/*  96: External attributes block. */	ufs2_daddr_t	di_db[NDADDR];	/* 112: Direct disk blocks. */	ufs2_daddr_t	di_ib[NIADDR];	/* 208: Indirect disk blocks. */	int64_t		di_spare[3];	/* 232: Reserved; currently unused */};#define	MAXNAMLEN	255struct	direct {	u_int32_t d_ino;		/* inode number of entry */	u_int16_t d_reclen;		/* length of this record */	u_int8_t  d_type; 		/* file type, see below */	u_int8_t  d_namlen;		/* length of string in d_name */	char	  d_name[MAXNAMLEN + 1];/* name with length <= MAXNAMLEN */};/* * File types */#define DT_UNKNOWN       0#define DT_FIFO          1#define DT_CHR           2#define DT_DIR           4#define DT_BLK           6#define DT_REG           8#define DT_LNK          10#define DT_SOCK         12#define DT_WHT          14/* * Superblock offsets */#define SBLOCK_FLOPPY        0#define SBLOCK_UFS1       8192#define SBLOCK_UFS2      65536#define SBLOCK_PIGGY    262144#define SBLOCKSIZE        8192#define SBLOCKSEARCH \	{ SBLOCK_UFS2, SBLOCK_UFS1, SBLOCK_FLOPPY, SBLOCK_PIGGY, -1 }#define MAXMNTLEN	512#define	NOCSPTRS	((128 / sizeof(void *)) - 4)/* * The maximum number of snapshot nodes that can be associated * with each filesystem. This limit affects only the number of * snapshot files that can be recorded within the superblock so * that they can be found when the filesystem is mounted. However, * maintaining too many will slow the filesystem performance, so * having this limit is a good idea.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -