📄 31.html
字号:
<html>
<head>
<title>include/linux/fs.h</title>
<meta name='robots' content='noindex,nofollow'>
<meta name='generator' content='GLOBAL-5.4.1'>
</head>
<body text='#191970' bgcolor='#f5f5dc' vlink='gray'>
<a name='TOP'><h2><a href='../mains.html'>root</a>/<a href='../files/99.html'>include</a>/<a href='../files/101.html'>linux</a>/fs.h</h2>
<i><font color='green'>/* [<][>][^][v][top]<a href='#BOTTOM'>[bottom]</a><a href='../mains.html'>[index]</a><a href='../help.html'>[help]</a> */</font></i>
<hr>
<h2><a href='../J/31.html' title='Multiple included from 9 places.'>INCLUDED FROM</a></h2>
<hr>
<pre>
<a name='L1'><i><font color='green'>/*</font></i>
<a name='L2'><i><font color='green'>* This file has definitions for some important file table</font></i>
<a name='L3'><i><font color='green'>* structures etc.</font></i>
<a name='L4'><i><font color='green'>*/</font></i>
<a name='L5'><i><font color='green'>/*</font></i>
<a name='L6'><i><font color='green'>* 本文件含有某些重要文件表结构的定义等。</font></i>
<a name='L7'><i><font color='green'>*/</font></i>
<a name='L8'>
<a name='L9'><font color='darkred'>#ifndef</font> <a href='../S/31.html#L10' title='Defined at 10 in include/linux/fs.h.'>_FS_H</a>
<a name='L10'><font color='darkred'>#define</font> <a href='../S/31.html#L9' title='Refered from 9 in include/linux/fs.h.'>_FS_H</a>
<a name='L11'>
<a name='L12'><font color='darkred'>#include</font> <<a href='45.html'>sys/types.h</a>> <i><font color='green'>// 类型头文件。定义了基本的系统数据类型。</font></i>
<a name='L13'>
<a name='L14'><i><font color='green'>/* devices are as follows: (same as minix, so we can use the minix</font></i>
<a name='L15'><i><font color='green'>* file system. These are major numbers.)</font></i>
<a name='L16'><i><font color='green'>*</font></i>
<a name='L17'><i><font color='green'>* 0 - unused (nodev)</font></i>
<a name='L18'><i><font color='green'>* 1 - /dev/mem</font></i>
<a name='L19'><i><font color='green'>* 2 - /dev/fd</font></i>
<a name='L20'><i><font color='green'>* 3 - /dev/hd</font></i>
<a name='L21'><i><font color='green'>* 4 - /dev/ttyx</font></i>
<a name='L22'><i><font color='green'>* 5 - /dev/tty</font></i>
<a name='L23'><i><font color='green'>* 6 - /dev/lp</font></i>
<a name='L24'><i><font color='green'>* 7 - unnamed pipes</font></i>
<a name='L25'><i><font color='green'>*/</font></i>
<a name='L26'><i><font color='green'>/*</font></i>
<a name='L27'><i><font color='green'>* 系统所含的设备如下:(与minix 系统的一样,所以我们可以使用minix 的</font></i>
<a name='L28'><i><font color='green'>* 文件系统。以下这些是主设备号。)</font></i>
<a name='L29'><i><font color='green'>*</font></i>
<a name='L30'><i><font color='green'>* 0 - 没有用到(nodev)</font></i>
<a name='L31'><i><font color='green'>* 1 - /dev/mem 内存设备。</font></i>
<a name='L32'><i><font color='green'>* 2 - /dev/fd 软盘设备。</font></i>
<a name='L33'><i><font color='green'>* 3 - /dev/hd 硬盘设备。</font></i>
<a name='L34'><i><font color='green'>* 4 - /dev/ttyx tty 串行终端设备。</font></i>
<a name='L35'><i><font color='green'>* 5 - /dev/tty tty 终端设备。</font></i>
<a name='L36'><i><font color='green'>* 6 - /dev/lp 打印设备。</font></i>
<a name='L37'><i><font color='green'>* 7 - unnamed pipes 没有命名的管道。</font></i>
<a name='L38'><i><font color='green'>*/</font></i>
<a name='L39'>
<a name='L40'><font color='darkred'>#define</font> <a href='../S/17.html#L45' title='Refered from 45 in fs/read_write.c.'>IS_SEEKABLE</a>(x) ((x)>=1 && (x)<=3) <i><font color='green'>// 是否是可以寻找定位的设备。</font></i>
<a name='L41'>
<a name='L42'><font color='darkred'>#define</font> <a href='../R/208.html' title='Multiple refered from 11 places.'>READ</a> 0
<a name='L43'><font color='darkred'>#define</font> <a href='../R/311.html' title='Multiple refered from 10 places.'>WRITE</a> 1
<a name='L44'><font color='darkred'>#define</font> <a href='../R/209.html' title='Multiple refered from 3 places.'>READA</a> 2 <i><font color='green'>/* read-ahead - don't pause */</font></i>
<a name='L45'><font color='darkred'>#define</font> <a href='../S/57.html#L129' title='Refered from 129 in kernel/blk_drv/ll_rw_blk.c.'>WRITEA</a> 3 <i><font color='green'>/* "write-ahead" - silly, but somewhat useful */</font></i>
<a name='L46'>
<a name='L47'><b>void</b> <a href='../S/6.html#L515' title='Defined at 515 in fs/buffer.c.'>buffer_init</a> (<b>long</b> buffer_end);
<a name='L48'>
<a name='L49'><font color='darkred'>#define</font> <a href='../R/120.html' title='Multiple refered from 13 places.'>MAJOR</a>(a) (((<b>unsigned</b>)(a))>>8) <i><font color='green'>// 取高字节(主设备号)。</font></i>
<a name='L50'><font color='darkred'>#define</font> <a href='../R/131.html' title='Multiple refered from 7 places.'>MINOR</a>(a) ((a)&0xff) <i><font color='green'>// 取低字节(次设备号)。</font></i>
<a name='L51'>
<a name='L52'><font color='darkred'>#define</font> <a href='../R/133.html' title='Multiple refered from 10 places.'>NAME_LEN</a> 14 <i><font color='green'>// 名字长度值。</font></i>
<a name='L53'><font color='darkred'>#define</font> <a href='../R/212.html' title='Multiple refered from 4 places.'>ROOT_INO</a> 1 <i><font color='green'>// 根i 节点。</font></i>
<a name='L54'>
<a name='L55'><font color='darkred'>#define</font> <a href='../R/105.html' title='Multiple refered from 3 places.'>I_MAP_SLOTS</a> 8 <i><font color='green'>// i 节点位图槽数。</font></i>
<a name='L56'><font color='darkred'>#define</font> <a href='../R/317.html' title='Multiple refered from 3 places.'>Z_MAP_SLOTS</a> 8 <i><font color='green'>// 逻辑块(区段块)位图槽数。</font></i>
<a name='L57'><font color='darkred'>#define</font> <a href='../R/238.html' title='Multiple refered from 2 places.'>SUPER_MAGIC</a> 0x137F <i><font color='green'>// 文件系统魔数。</font></i>
<a name='L58'>
<a name='L59'><font color='darkred'>#define</font> <a href='../R/145.html' title='Multiple refered from 19 places.'>NR_OPEN</a> 20 <i><font color='green'>// 打开文件数。</font></i>
<a name='L60'><font color='darkred'>#define</font> <a href='../R/144.html' title='Multiple refered from 9 places.'>NR_INODE</a> 32
<a name='L61'><font color='darkred'>#define</font> <a href='../R/141.html' title='Multiple refered from 6 places.'>NR_FILE</a> 64
<a name='L62'><font color='darkred'>#define</font> <a href='../R/147.html' title='Multiple refered from 8 places.'>NR_SUPER</a> 8
<a name='L63'><font color='darkred'>#define</font> <a href='../R/142.html' title='Multiple refered from 3 places.'>NR_HASH</a> 307
<a name='L64'><font color='darkred'>#define</font> <a href='../R/140.html' title='Multiple refered from 7 places.'>NR_BUFFERS</a> nr_buffers
<a name='L65'><font color='darkred'>#define</font> <a href='../R/8.html' title='Multiple refered from 26 places.'>BLOCK_SIZE</a> 1024 <i><font color='green'>// 数据块长度。</font></i>
<a name='L66'><font color='darkred'>#define</font> <a href='../R/9.html' title='Multiple refered from 5 places.'>BLOCK_SIZE_BITS</a> 10 <i><font color='green'>// 数据块长度所占比特位数。</font></i>
<a name='L67'><font color='darkred'>#ifndef</font> <a href='../D/261.html' title='Multiple defined in 12 places.'>NULL</a>
<a name='L68'><font color='darkred'>#define</font> <a href='../R/149.html' title='Multiple refered from 109 places.'>NULL</a> ((<b>void</b> *) 0)
<a name='L69'><font color='darkred'>#endif</font>
<a name='L70'>
<a name='L71'><i><font color='green'>// 每个逻辑块可存放的i 节点数。</font></i>
<a name='L72'><font color='darkred'>#define</font> <a href='../R/96.html' title='Multiple refered from 4 places.'>INODES_PER_BLOCK</a> ((<a href='../D/23.html' title='Multiple defined in 2 places.'>BLOCK_SIZE</a>)/(<b>sizeof</b> (<b>struct</b> d_inode)))
<a name='L73'><i><font color='green'>// 每个逻辑块可存放的目录项数。</font></i>
<a name='L74'><font color='darkred'>#define</font> <a href='../R/31.html' title='Multiple refered from 6 places.'>DIR_ENTRIES_PER_BLOCK</a> ((<a href='../D/23.html' title='Multiple defined in 2 places.'>BLOCK_SIZE</a>)/(<b>sizeof</b> (<b>struct</b> dir_entry)))
<a name='L75'>
<a name='L76'><i><font color='green'>// 管道头、管道尾、管道大小、管道空?、管道满?、管道头指针递增。</font></i>
<a name='L77'><font color='darkred'>#define</font> <a href='../R/201.html' title='Multiple refered from 7 places.'>PIPE_HEAD</a>(inode) ((inode).i_zone[0])
<a name='L78'><font color='darkred'>#define</font> <a href='../R/203.html' title='Multiple refered from 7 places.'>PIPE_TAIL</a>(inode) ((inode).i_zone[1])
<a name='L79'><font color='darkred'>#define</font> <a href='../R/202.html' title='Multiple refered from 4 places.'>PIPE_SIZE</a>(inode) ((<a href='../S/31.html#L77' title='Defined at 77 in include/linux/fs.h.'>PIPE_HEAD</a>(inode)-<a href='../S/31.html#L78' title='Defined at 78 in include/linux/fs.h.'>PIPE_TAIL</a>(inode))&(<a href='../D/324.html' title='Multiple defined in 4 places.'>PAGE_SIZE</a>-1))
<a name='L80'><font color='darkred'>#define</font> PIPE_EMPTY(inode) (<a href='../S/31.html#L77' title='Defined at 77 in include/linux/fs.h.'>PIPE_HEAD</a>(inode)==<a href='../S/31.html#L78' title='Defined at 78 in include/linux/fs.h.'>PIPE_TAIL</a>(inode))
<a name='L81'><font color='darkred'>#define</font> PIPE_FULL(inode) (<a href='../S/31.html#L79' title='Defined at 79 in include/linux/fs.h.'>PIPE_SIZE</a>(inode)==(<a href='../D/324.html' title='Multiple defined in 4 places.'>PAGE_SIZE</a>-1))
<a name='L82'><font color='darkred'>#define</font> INC_PIPE(head) \
<a name='L83'><b>__asm__</b>( "incl %0\n\tandl $4095,%0":: "m" (head))
<a name='L84'>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -