ulfs_dinode.h revision 1.7
1/*	$NetBSD: ulfs_dinode.h,v 1.7 2013/06/08 02:11:49 dholland Exp $	*/
2/*  from NetBSD: dinode.h,v 1.22 2013/01/22 09:39:18 dholland Exp  */
3
4/*
5 * Copyright (c) 2002 Networks Associates Technology, Inc.
6 * All rights reserved.
7 *
8 * This software was developed for the FreeBSD Project by Marshall
9 * Kirk McKusick and Network Associates Laboratories, the Security
10 * Research Division of Network Associates, Inc. under DARPA/SPAWAR
11 * contract N66001-01-C-8035 ("CBOSS"), as part of the DARPA CHATS
12 * research program
13 *
14 * Copyright (c) 1982, 1989, 1993
15 *	The Regents of the University of California.  All rights reserved.
16 * (c) UNIX System Laboratories, Inc.
17 * All or some portions of this file are derived from material licensed
18 * to the University of California by American Telephone and Telegraph
19 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
20 * the permission of UNIX System Laboratories, Inc.
21 *
22 * Redistribution and use in source and binary forms, with or without
23 * modification, are permitted provided that the following conditions
24 * are met:
25 * 1. Redistributions of source code must retain the above copyright
26 *    notice, this list of conditions and the following disclaimer.
27 * 2. Redistributions in binary form must reproduce the above copyright
28 *    notice, this list of conditions and the following disclaimer in the
29 *    documentation and/or other materials provided with the distribution.
30 * 3. Neither the name of the University nor the names of its contributors
31 *    may be used to endorse or promote products derived from this software
32 *    without specific prior written permission.
33 *
34 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
35 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
36 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
37 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
38 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
39 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
40 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
41 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
42 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
43 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
44 * SUCH DAMAGE.
45 *
46 *	@(#)dinode.h	8.9 (Berkeley) 3/29/95
47 */
48
49/*
50 * NOTE: COORDINATE ON-DISK FORMAT CHANGES WITH THE FREEBSD PROJECT.
51 */
52
53#ifndef	_UFS_LFS_ULFS_DINODE_H_
54#define	_UFS_LFS_ULFS_DINODE_H_
55
56#include <ufs/lfs/lfs.h>
57
58/*
59 * The root inode is the root of the file system.  Inode 0 can't be used for
60 * normal purposes and historically bad blocks were linked to inode 1, thus
61 * the root inode is 2.  (Inode 1 is no longer used for this purpose, however
62 * numerous dump tapes make this assumption, so we are stuck with it).
63 */
64#define	ULFS_ROOTINO	((ino_t)2)
65
66/*
67 * The Whiteout inode# is a dummy non-zero inode number which will
68 * never be allocated to a real file.  It is used as a place holder
69 * in the directory entry which has been tagged as a DT_W entry.
70 * See the comments about ULFS_ROOTINO above.
71 */
72#define	ULFS_WINO	((ino_t)1)
73
74/*
75 * Maximum length of a symlink that can be stored within the inode.
76 */
77#define ULFS1_MAXSYMLINKLEN	((ULFS_NDADDR + ULFS_NIADDR) * sizeof(int32_t))
78#define ULFS2_MAXSYMLINKLEN	((ULFS_NDADDR + ULFS_NIADDR) * sizeof(int64_t))
79
80#define ULFS_MAXSYMLINKLEN(ip) \
81	((ip)->i_ump->um_fstype == ULFS1) ? \
82	ULFS1_MAXSYMLINKLEN : ULFS2_MAXSYMLINKLEN
83
84/* File permissions. */
85#define	IEXEC		0000100		/* Executable. */
86#define	IWRITE		0000200		/* Writable. */
87#define	IREAD		0000400		/* Readable. */
88#define	ISVTX		0001000		/* Sticky bit. */
89#define	ISGID		0002000		/* Set-gid. */
90#define	ISUID		0004000		/* Set-uid. */
91
92#endif /* !_UFS_LFS_ULFS_DINODE_H_ */
93