/usr/share/doc/HOWTO/ja-html/Linux-Kernel-Internals-3.html is in doc-linux-ja-html 2006.05.25-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.21">
<TITLE>Linux Kernel 2.4 Internals: $B2>A[%U%!%$%k%7%9%F%`(B (VFS) </TITLE>
<LINK HREF="Linux-Kernel-Internals-4.html" REL=next>
<LINK HREF="Linux-Kernel-Internals-2.html" REL=previous>
<LINK HREF="Linux-Kernel-Internals.html#toc3" REL=contents>
</HEAD>
<BODY>
<A HREF="Linux-Kernel-Internals-4.html">$B<!$N%Z!<%8(B</A>
<A HREF="Linux-Kernel-Internals-2.html">$BA0$N%Z!<%8(B</A>
<A HREF="Linux-Kernel-Internals.html#toc3">$BL\<!$X(B</A>
<HR>
<H2><A NAME="s3">3.</A> <A HREF="Linux-Kernel-Internals.html#toc3">$B2>A[%U%!%$%k%7%9%F%`(B (VFS) </A></H2>
<H2><A NAME="ss3.1">3.1</A> <A HREF="Linux-Kernel-Internals.html#toc3.1">Inode $B%-%c%C%7%e$H(BDcache $B$H$NAj8_:nMQ(B</A>
</H2>
<P>$BJ#?t$N%U%!%$%k%7%9%F%`$r%5%]!<%H$9$k$?$a!"(B Linux $B$O(B VFS (Virtual Filesystem Switch)
$B$H$$$&FCJL$J%+!<%M%k%$%s%?!<%U%'!<%9%l%Y%k$r;}$C$F$$$^$9!#(B
$B$3$l$O(B SVR4 $B$+$iGI@8$7$?(B OS $B$K8+$i$l$k(B vnode/vfs $B%$%s%?!<%U%'!<%9$KNI$/;w$F$$$^$9(B
($B$b$H$b$H$O!"(BBSD $B$H(B Sun $B$KM3Mh$N<BAu$+$i$-$F$$$^$9(B)$B!#(B</P>
<P>Linux $B$N(B inode $B%-%c%C%7%e$O!"0l$D$N(B 977 $B9T$+$i$J$k%U%!%$%k(B <CODE>fs/inode.c</CODE> $B$K<BAu$5$l$F$$$^$9!#(B
$BFCI.$9$Y$-;v$K!"$3$N%U%!%$%k$O!"$3$N(B 5-7 $BG/$N4V$[$H$s$IJQ99$,$"$j$^$;$s$G$7$?!#(B
$B0lHV:G8e$K99?7$5$l$?$N$O!"$=$&(B 1.3.42 $B$N;~$J$N$G$9!#(B</P>
<P>Linux $B$N(B inode $B%-%c%C%7%e$N9=B$$O0J2<$NDL$j$G$9!#(B</P>
<P>
<OL>
<LI>
$B3F(B inode $B$,%9!<%Q!<%V%m%C%/%]%$%s%?$H(B 32bit $B$N(B inode $BHV9f$NCM$K$h$C$F%O%C%7%e$5$l$k%0%m!<%P%k%O%C%7%e%F!<%V%k(B <CODE>inode_hashtable</CODE>$B!#(B $B%9!<%Q!<%V%m%C%/$NL5$$(B inode (<CODE>inode->i_sb == NULL</CODE>) $B$O!"Be$j$K(B<CODE>anon_hash_chain</CODE>$B$G;O$^$k%@%V%k%j%s%/%j%9%H$X$H$D$J$,$l$k!#F?L>(B inode$B$NNc$H$7$F!"(B<CODE>fs/inode.c:get_empty_inode()</CODE>$B$r8F$V$3$H$G!"(B<CODE>net/socket.c:sock_alloc()</CODE>$B$K$h$C$F:n$i$l$k%=%1%C%H$,$"$k!#(B
</LI>
<LI> <CODE>i_count>0</CODE> $B$+$D(B <CODE>i_nlink>0</CODE> $B$H$J$k(B inode $B$+$i$J$k%0%m!<%P%k%?%$%W$N(B in_use_list(<CODE>inode_in_use</CODE>)$B!#(Binode $B$O!"(B<CODE>get_empty_inode()</CODE> $B$H(B <CODE>get_new_inode()</CODE> $B$K$h$j?7$?$K3d$jEv$F$i$l!"(B<CODE>inode_in_use</CODE> $B%j%9%H$X$D$J$,$l$k!#(B
</LI>
<LI> <CODE>i_count = 0</CODE>$B$G$"$k$h$&$J(B $B%0%m!<%P%k%?%$%W$NL$;HMQ%j%9%H(B (<CODE>inode_unused</CODE>)$B!#(B
</LI>
<LI> <CODE>i_count>0</CODE>$B!"(B<CODE>i_nlink>0</CODE>$B$=$7$F(B<CODE>i_state & I_DIRTY </CODE>$B$G$"$k$h$&$J(B inode $B$K$h$k%9!<%Q!<%V%m%C%/Kh$N1x$l$?%j%9%H(B(<CODE>sb->s_dirty</CODE>)$B!#(Binode$B$,(B dirty$B$N0u$,$D$1$i$l$?$i!"$=$l$O$d$O$j%O%C%7%e$K$J$C$F$$$k(B<CODE>sb->s_dirty</CODE>$B%j%9%H$KDI2C$5$l$k!#%9!<%Q!<%V%m%C%/Kh$K(B inode $B$N(B dirty $B%j%9%H$r4IM}$9$k$3$H$G!"(Binode $B$NF14|$r$9$P$d$/9T$&$3$H$,$G$-$k$h$&$K$J$k!#(B
</LI>
<LI> $B87L)$J0UL#$N(B inode $B%-%c%C%7%e(B -- <CODE>inode_cachep</CODE>$B$r8F$S=P$9(B SLAB $B%-%c%C%7%e!#(Binode $B%*%V%8%'%/%H$,3d$jEv$F$i$l$?$j!"2rJ|$5$l$?$j$9$k$H$-$O!"$3$N(B SLAB $B%-%c%C%7%e$+$i<hF@$5$l$?$j!"JV$5$l$?$j$9$k!#(B</LI>
</OL>
</P>
<P>$B$=$l$>$l$N%?%$%W%j%9%H$O!"(B<CODE>inode->i_list</CODE>$B$+$i;X$7<($5$l!"%O%C%7%e%F!<%V%k$O!"(B<CODE>inode->i_hash</CODE>$B$+$i7k$SIU$1$i$l$F$$$^$9!#3F(B inode $B$O(B $B$=$l$>$l%O%C%7%e%F!<%V%k$H#1<oN`$N$_$N%?%$%W%j%9%H(B(in_use, unused, $B$^$?$O(B dirty)$B$KF~$j$^$9!#(B</P>
<P>$B$3$N$9$Y$F$N%j%9%H$O0l$D$N%9%T%s%m%C%/(B<CODE>inode_lock</CODE>$B$K$h$jJ]8n$5$l$F$$$^$9!#(B</P>
<P>inode $B%-%c%C%7%e%5%V%7%9%F%`$O!"(B<CODE>inode_init()</CODE>$B4X?t$,!"(B<CODE>init/main.c:start_kernel()</CODE>$B$+$i8F$S=P$5$l$?;~$K=i4|2=$5$l$^$9!#$3$N4X?t$O!"(B<CODE>__init</CODE>$B$H%^!<%/$5$l$F$*$j!"$3$l$O$=$N8e!"$3$N%3!<%I$,2rJ|$5$l$F$7$^$&$3$H$r0UL#$7$F$$$^$9!#$3$N4X?t$O0l$D$N0z?t(B -- $B%7%9%F%`$NJ*M}%Z!<%8?t$rEO$7$^$9!#$3$N$3$H$+$i!"(Binode $B%-%c%C%7%e$OMxMQ2DG=$J%a%b%jNL$K0MB8$7$F7h$a$i$l$F$$$k$3$H$,$o$+$j$^$9!#$D$^$j!"$b$7==J,$JNL$N%a%b%j$,$"$l$P!"$h$jBg$-$J%O%C%7%e%F!<%V%k$r:n@.$9$k$H$$$&$3$H$G$9!#(B</P>
<P>inode $B%-%c%C%7%e$K4X$9$k$NM#0l$NE}7WE*>pJs$O!"MxMQ$5$l$F$$$J$$(Binode$B?t$G$9!#$3$l$O!"(B<CODE>inodes_stat.nr_unused</CODE>$B$K3JG<$5$l!"%U%!%$%k(B<CODE>/proc/sys/fs/inode-nr</CODE>$B$d(B<CODE>proc/sys/fs/inode-state</CODE>$B$rDL$7$F%f!<%6%W%m%0%i%`$+$i8+$k$3$H$,$G$-$^$9!#(B</P>
<P>$B$=$N$?$a!"@8$-$?%+!<%M%k$G<B9T$9$k(B <B>gdb</B> $B$+$i%j%9%H$r<h=P$9$3$H$,$G$-$^$9!#(B</P>
<P>
<BLOCKQUOTE><CODE>
<HR>
<PRE>
(gdb) printf "%d\n", (unsigned long)(&((struct inode *)0)->i_list)
8
(gdb) p inode_unused
$34 = 0xdfa992a8
(gdb) p (struct list_head)inode_unused
$35 = {next = 0xdfa992a8, prev = 0xdfcdd5a8}
(gdb) p ((struct list_head)inode_unused).prev
$36 = (struct list_head *) 0xdfcdd5a8
(gdb) p (((struct list_head)inode_unused).prev)->prev
$37 = (struct list_head *) 0xdfb5a2e8
(gdb) set $i = (struct inode *)0xdfb5a2e0
(gdb) p $i->i_ino
$38 = 0x3bec7
(gdb) p $i->i_count
$39 = {counter = 0x0}
</PRE>
<HR>
</CODE></BLOCKQUOTE>
</P>
<P>$B$3$3$G!"(B<CODE>include/linux/list.h</CODE> $B$N(B <CODE>list_entry()</CODE>$B%^%/%m$NDj5A$K$7$?$,$C$F(B<CODE>struct inode</CODE>$B$N%"%I%l%9(B (0xdfb5a3e0) $B$rF@$k$?$a$K!"%"%I%l%9(B 0xdfb5a2e8 $B$+$i(B8$B$r0z$$$F$$$k$3$H$KCm0U$7$^$7$g$&!#(B</P>
<P>inode $B%-%c%C%7%e$,$I$N$h$&$KF/$/$+M}2r$9$k$?$a$K!"(Bext2 $B%U%!%$%k%7%9%F%`$NDL>o$N%U%!%$%k$G!"(B
$B%*!<%W%s!"%/%m!<%:$5$l$k$H$-$N(B inode $B$N0l@8$r8+$F$$$-$^$7$g$&!#(B</P>
<P>
<BLOCKQUOTE><CODE>
<HR>
<PRE>
fd = open("file", O_RDONLY);
close(fd);
</PRE>
<HR>
</CODE></BLOCKQUOTE>
</P>
<P><B>open(2)</B> $B%7%9%F%`%3!<%k$O(B <CODE>fs/open.c:sys_open()</CODE> $B4X?t$KDj5A$5$l$F$$$F!"<BBN$O(B <CODE>fs/open.c:file_open()</CODE> $B4X?t$,9T$C$F$$$^$9!#$3$N4X?t$O(B2$B$D$NItJ,$KJ,$1$i$l!"(B</P>
<P>
<OL>
<LI> <CODE>open_namei()</CODE>: dentry$B$H(Bvfsmount$B9=B$BN$+$i$J$k(Bnamei$B%G!<%?9=B$BN$rKd$a$k!#(B
</LI>
<LI> <CODE>dentry_open()</CODE>: dentry$B$d(Bvfsmount$B$rM?$($k!#$3$N4X?t$O!"?7$7$$(B<CODE>struct file</CODE>$B$r3d$jEv$F!"Aj8_$K%j%s%/$9$k!#$^$?!"(Binode $B$,(B(<CODE>dentry->d_inode</CODE>$B$+$i(B inode $B$rM?$($k(B) <CODE>open_namei()</CODE> $B$GFI$_9~$^$l$k;~(B <CODE>inode->i_fop</CODE> $B$K%;%C%H$5$l$F$$$k%U%!%$%k%7%9%F%`$KFCM-$N(B <CODE>f_op->open()</CODE> $B%a%=%C%I$r8F$S=P$9!#(B</LI>
</OL>
</P>
<P><CODE>open_namei()</CODE> $B4X?t$O!"%U%!%$%k%7%9%F%`Kh$N(B<CODE>inode_operations->lookup()</CODE> $B%a%=%C%I$r5/F0$9$k(B <CODE>real_lookup()</CODE>$B$r$5$i$K8F$S=P$9(B <CODE>path_walk()</CODE> $B$K$h$C$F!"(B dentry $B%-%c%C%7%e$HAj8_:nMQ$r5/$3$7$^$9!#(B
$B$3$N%a%=%C%I$NLr3d$O!"?F%G%#%l%/%H%j$GL>A0$N0lCW$9$k%(%s%H%j$rC5$9$3$H$G!"$=$N(B inode $B$r<hF@$9$k$?$a(B <CODE>iget(sb, ino)</CODE> $B$r8F$S=P$7$F$$$^$9!#$3$N4X?t$O(B inode $B%-%c%C%7%e$X%"%/%;%9$7$^$9!#(B
inode $B$,FI$_9~$^$l$?$i!"(B <CODE>d_add(dentry, inode)</CODE> $B$K$h$j(B dentry $B$N%$%s%9%?%s%9$,:n@.$5$l$^$9!#(B
$B$3$3$GCm0U$9$k$N$O!">e5-$N4V$G!"%*%s%G%#%9%/(B inode $BHV9f$H$$$&%3%s%;%W%H$r;}$D(BUNIX $B%9%?%$%k$N%U%!%$%k%7%9%F%`$N$?$a$K!"$=$N%(%s%G%#%"%s$r8=:_$N(B CPU $B%U%)!<%^%C%H$K%^%C%W$9$k$N$,%k%C%/%"%C%W%a%=%C%I$N;E;v$@$H$$$&$3$H$G$9!#(B
$B$?$H$($P!"%U%!%$%k%7%9%F%`$KFCM-$J(B raw $B%G%#%l%/%H%j%(%s%H%j$N(B inode $BHV9f$,%j%H%k%(%s%G%#%"%s$N(B32$B%S%C%H%U%)!<%^%C%H$G$"$l$P!"(B</P>
<P>
<BLOCKQUOTE><CODE>
<HR>
<PRE>
unsigned long ino = le32_to_cpu(de->inode);
inode = iget(sb, ino);
d_add(dentry, inode);
</PRE>
<HR>
</CODE></BLOCKQUOTE>
$B$H$$$&%3!<%I$r<B9T$7$^$9!#(B</P>
<P>$B$3$N$h$&$K!"%U%!%$%k$r3+$/$H$-$K$O!"<BBN$,(B<CODE>iget4(sb, ino, NULL, NULL)</CODE> $B$G$"$k(B <CODE>iget(sb, ino)</CODE> $B$r$?$?$-$^$9!#$3$l$O!"(B</P>
<P>
<OL>
<LI> <CODE>inode_lock</CODE>$B$NJ]8n$N$b$H!"%O%C%7%e%F!<%V%k$NCf$+$i!"%9!<%Q%V%m%C%/$H(B inode $BHV9f$,0lCW$9$k(B inode $B$r8+$D$1$h$&$H$9$k!#$b$7!"(Binode $B$,8+$D$+$l$P!"$=$N;2>H%+%&%s%?(B (<CODE>i_count</CODE>) $B$rA}J,$9$k!#(B
$B$b$7!"A}2C$NA0$NCM$,(B 0 $B$G$"$C$?$i$P!"(Binode $B$O(B dirty $B$G$O$J$$$N$G!"$I$N%?%$%W$N%j%9%H(B(<CODE>iode->i_list</CODE>)$B$+$i$G$"$l:o=|$9$k!#$3$l$O!"8=:_(B on ($B$=$l$O$b$A$m$s(B<CODE>inode_unused</CODE>$B%j%9%H$G$J$1$l$P$J$i$J$$(B)$B$G$"$j!"(B<CODE>inode_in_use</CODE>$B%?%$%W$N%j%9%H$KA^F~$5$l$k!#:G8e$K!"(B<CODE>inodes_stat.nr_unused</CODE> $B$,8:>/$5$l$k!#(B
</LI>
<LI> $B$b$7(Binode$B$,8=:_%m%C%/$5$l$F$$$?$i!"%m%C%/$,2r=|$5$l$k$^$GBT$D!#$D$^$j!"(B<CODE>iget4()</CODE>$B$O%m%C%/$5$l$F$$$J$$(B inode $B$rJV$9$3$H$,J]>Z$5$l$k!#(B
</LI>
<LI> $B$b$7(B inode $B$,%O%C%7%e%F!<%V%k$K8+$D$+$i$J$1$l$P!"$3$N(B inode $B$K=i$a$F=P2q$C$?$H$$$&$3$H$K$J$k!#$h$C$F!"(B<CODE>get_new_inode()</CODE>$B$r8F$S=P$7!"%O%C%7%e%F!<%V%k$NA^F~$9$Y$-0LCV$r%]%$%s%?$GEO$9!#(B
</LI>
<LI> <CODE>get_new_inode()</CODE> $B$O?7$7$$(B inode $B$r(B<CODE>inode_cachep</CODE> SLAB $B%-%c%C%7%e$+$i3d$jEv$F$k!#$7$+$7!"$3$NA`:n$O(B(<CODE> GFP_KERNEL</CODE>$B3d$jEv$F$G(B)$B%V%m%C%/$G$-$k$?$a!"%O%C%7%e%F!<%V%k$r<i$k(B <CODE>inode_lock</CODE> spinlock $B$r%I%m%C%W$7$J$$$H$$$1$J$$!#(Bspinlock $B$r%I%m%C%W$7$F$7$^$C$?$?$a!"8e$G:F$S%O%C%7%e%F!<%V%k$G(B inode $B$r8!:w$7$F$_$J$/$F$O$J$i$J$$!#:FEY$=$l$,8+$D$+$l$P!"%O%C%7%e%F!<%V%k$G8+$D$1$?$b$N$rI|5"$7!"(B(<CODE>__iget</CODE> $B$K$h$C$F;2>H?t$rA}$d$7$?8e$K(B)$B!"?7$7$/3d$jEv$F$i$l$?(B inode $B$rGK4~$9$k!#%O%C%7%e%F!<%V%k$G$^$@8+$D$+$i$J$1$l$P!":#$5$C$-3d$jEv$F$??7$7$$(B inode $B$,!";H$o$l$k$Y$-$b$N$H$J$k!#$7$?$,$C$F!"$=$l$OMW5a$5$l$?CM$K=i4|2=$5$l$k!#$=$7$F!"%U%!%$%k%7%9%F%`$KFCM-$N(B <CODE>sb->s_op->read_inode()</CODE> $B%a%=%C%I$O!";D$j$N(B inode $B$r;H$&$?$a$K5/F0$5$l$k!#(B
$B$H$$$&$3$H$G!"(Binode $B%-%c%C%7%e%P%C%/$N%3!<%I$+$i!"%U%!%$%k%7%9%F%`%3!<%I$X8+$K9T$+$J$1$l$P$J$i$J$$!#(B
$B$3$3$G!"%U%!%$%k%7%9%F%`$KFCM-$N(B <CODE>lookup()</CODE> $B%a%=%C%I$,(B <CODE>iget()</CODE>$B$r5/F0$7$?$?$a$K!"(B inode $B%-%c%C%7%e$N%3!<%I$rFI$s$G$$$k$3$H$r;W$$=P$7$F$[$7$$!#(B <CODE>s_op->read_inode()</CODE> $B%a%=%C%I$,%G%#%9%/$h$j(Binode$B$rFI$_9~$`4V!"(Binode $B$O%m%C%/$5$l$k!#(B(<CODE>i_state = I_LOCK()</CODE>) <CODE>read_inode()</CODE> $B%a%=%C%I$,I|5"$7$?8e$K%m%C%/2r=|$5$l$k!#$=$7$F!"(Binode $B%m%C%/$rBT$C$F$$$kA4$F$,5/$3$5$l$k!#(B
</LI>
</OL>
$B$5$F!"$3$N%U%!%$%k%G%#%9%/%j%W%?$r(Bclose$B$7$?$H$-$K!"$J$K$,5/$3$k$+$r$_$F$$$-$^$9!#(B<B>close(2)</B> $B%7%9%F%`%3!<%k$O!"(B<CODE>do_close(fd, 1)</CODE> $B$r8F$S=P$9(B <CODE>fs/open.c:sys_close()</CODE> $B4X?t$H$7$F<BAu$5$l$F$$$^$9!#(B<CODE>do_close(fd, 1)</CODE> $B$O!"%W%m%;%9$N%U%!%$%k%G%#%9%/%j%W%?%F!<%V%k$N5-=R;R$rGm$.<h$j(B(NULL $B$GCV$-49$($k(B)$B!"$[$H$s$I$N:n6H$r9T$&(B <CODE>filp_close()</CODE> $B4X?t$r8F$S=P$7$^$9!#(B
<CODE>fput()</CODE>$B$G$O$*$b$7$m$$$3$H$,5/$3$j$^$9!#$3$l$,%U%!%$%k$N:G8e$N%j%U%!%l%s%9$G$"$k$J$i$P!"(B<CODE>__fput()</CODE>$B$r8F$S$@$9(B <CODE>fs/file_table.c:_fput()</CODE> $B$,8F$S=P$5$l!"(Bdcache $B$HAj8_:nMQ$r5/$3$7$^$9!#(B($B$7$+$b(B inode cache $B$H$b:nMQ$7$^$9(B -- dcache $B$O(B inode $B%-%c%C%7%e$N%^%9%?!<$G$"$C$?(B!)
<CODE>fs/dcache.c:dput()</CODE> $B$O!"(B $B2f!9$r(B <CODE>iput(inode)</CODE>$B$r7PM3$7$F(Binode $B%-%c%C%7%e$X0z$-La$7$F$/$l$k(B<CODE>dentry_iput()</CODE>$B$r<B9T$7$^$9!#(B
$B$7$?$,$C$F!"(B<CODE>fs/inode.c:iput(inode)</CODE>$B$O<!$N$h$&$KM}2r$9$k$3$H$,$G$-$^$9!#(B</P>
<P>
<OL>
<LI> $B$b$7EO$5$l$?%Q%i%a!<%?$,(B NULL $B$J$i$P!"K\Ev$K2?$b$;$:La$k!#(B</LI>
<LI> $B$b$7!"(Bfs$BFCM-$N(B <CODE>sb->s_op->put_inode()</CODE> $B%a%=%C%I$,$"$l$P!"(B($B%V%m%C%/$G$-$k$?$a(B)$B%9%T%s%m%C%/$r<hF@$9$k$3$H$J$/$9$0$K5/F0$5$l$k!#(B</LI>
<LI> <CODE>inode_lock</CODE>$B%9%T%s%m%C%/$,<hF@$5$l(B <CODE>i_count</CODE> $B$,#1$D8:>/$5$l$k!#(B
$B$b$7$3$l$,$3$N(B inode $B$X$N:G8e$N%j%U%!%l%s%9$G!v$J$1$l!v$P!"C1=c$K%j%U%!%l%s%9$,B?$9$.$J$$$+$I$&$+$r3NG'$9$k!#(B
$B$3$l$O!"(B<CODE>i_count</CODE> $B$,3d$jEv$F$i$l$?(B 32bit $B0JFb$KG<$a$k$?$a$G$"$k!#$b$7!"%j%U%!%l%s%9$,B?$9$.$k>l9g$O7Y9p$rI=<($7$FJV$k!#(B
$B$3$3$G!"(B<CODE>inode_lock</CODE> $B%9%T%s%m%C%/$r<hF@$7$F$$$k$H$-$K(B <CODE>printk()</CODE> $B$r8F$S=P$9$,!"$3$l$OBg>fIW$G$"$k!#$H$$$&$N$O!"(B<CODE>printk()</CODE>$B$O%V%m%C%/$5$l$k$3$H$O$J$/!"$7$?$,$C$F$$$D$$$+$J$k%3%s%F%-%9%H(B($B3d$j9~$_%O%s%I%i$G$5$((B)$B$+$i$G$b8F$S=P$9$3$H$,$G$-$k$?$a$@!#(B
</LI>
<LI> $B$b$7:G8e$N%"%/%F%#%V$J%j%U%!%l%s%9$G$"$C$?>l9g$K$O!"I,MW$J=hM}$,$"$k!#(B</LI>
</OL>
</P>
<P>$B:G8e$N(B inode $B%j%U%!%l%s%9$G$N(B <CODE>iput()</CODE> $B$,9T$&=hM}$O!"$d$dJ#;($J$b$N$G$9!#$=$N$?$a!"%j%9%H$G$b$=$N:G8e$KJ,$1$F$"$j$^$9!#(B</P>
<P>
<OL>
<LI> $B$b$7(B <CODE>i_nlink == 0</CODE> ($BNc(B: $B%U%!%$%k$,%*!<%W%s$7$F$$$k$H$-$K(B unlink $B$5$l$?(B)$B>l9g$O!"(B
inode $B$O%O%C%7%e%F!<%V%k$H(Btype list $B$+$i:o=|$5$l$k!#$b$7!"$3$N(B inode $B$N%Z!<%8%-%c%C%7%e$K$J$K$+%G!<%?%Z!<%8$,J];}$5$l$F$$$?$i!"(B<CODE>truncate_all_inode_pages(&inode->i_data)</CODE> $B$K$h$j:o=|$5$l$k!#(B
$B$=$7$F!"%U%!%$%k%7%9%F%`FCM-$N(B <CODE>s_op->delete_inode()</CODE>$B%a%=%C%I$,8F$S=P$5$l$k!#(B
$B$3$l$ODL>o$O!"%G%#%9%/>e$N(B inode $B$r:o=|$9$k!#$b$7!"(B<CODE>s_op->delete_inode()</CODE>$B%a%=%C%I$,%U%!%$%k%7%9%F%`$K$h$jEPO?$5$l$F$$$J$$(B($BNc(B: ramfs)$B>l9g$K$O!"(B<CODE>clear_inode(inode)</CODE>$B$r8F$S=P$7!"$3$l$O$b$7EPO?$5$l$F$$$l$P(B<CODE>s_op->clear_inode()</CODE>$B$r8F$S=P$9!#$^$?!"(Binode $B$,FCDj$N%V%m%C%/%G%P%$%9$K4XO"$7$F$$$l$P!"%G%P%$%9$N%j%U%!%l%s%9%+%&%s%H$r(B<CODE>bdput(inode->i_bdev)</CODE>$B$GMn$H$9!#(B
</LI>
<LI> $B$b$7(B <CODE>i_nlink != 0</CODE> $B$J$i!"F1$8%O%C%7%e%P%1%C%H$NB>$N(B inode $B$,$"$k$+%A%'%C%/$9$k!#$=$7$F!"$J$1$l$P(B inode $B$O(B dirty $B$G$O$J$$$?$a!"$=$N(B type list $B$+$i:o=|$G$-$k!#(B $B$=$7$F!"(B<CODE>inode_unused</CODE>$B%j%9%H$XDI2C$7!"(B<CODE>inodes_stat.nr_unused</CODE>$B$rA}J,$9$k!#(B
$B$b$7!"$3$l$,F?L>(B inode $B$G$"$C$?(B(NetApp .snapshot)$B$J$i!"%?%$%W%j%9%H$+$i:o=|$7!"40A4$K%/%j%"(B/$BGK2u$9$k!#(B</LI>
</OL>
</P>
<H2><A NAME="ss3.2">3.2</A> <A HREF="Linux-Kernel-Internals.html#toc3.2">$B%U%!%$%k%7%9%F%`EPO?(B/$BEPO?2r=|(B</A>
</H2>
<P>Linux$B%+!<%M%k$O!"?7$7$$%U%!%$%k%7%9%F%`$r:G>.8B$NEXNO$G=q$/$3$H$,$G$-$k5!9=$rDs6!$7$F$$$^$9!#$=$NNr;KE*$JM}M3$H$O<!$N$h$&$J$b$N$G$9!#(B</P>
<P>
<OL>
<LI> $B?M!9$,(BLinux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"40A4$J=q$-9~$_%5%]!<%H$rDI2C$7$F40@.$5$;$k$N$K?t=54V$rMW$7$?$3$H$r5s$2$i$l$k(B($B$7$+$b!"8=:_$G$b(B
$B40`z<g5A<T$+$i!"(B"$B$3$l$O(Bcompactification$B%5%]!<%H$r;}$?$J$$$?$a(B"$B40@.$7$F$$$J$$$H<gD%$5$l$k$N$@(B)$B!#(B
</LI>
<LI> VFS $B%$%s%?!<%U%'!<%9$O%(%-%9%]!<%H$5$l$F$*$j!"$7$?$,$C$F$9$Y$F$N(BLinux$B%U%!%$%k%7%9%F%`$O%b%8%e!<%k$H$7$F<BAu$G$-$k!#(B
</LI>
</OL>
</P>
<P>$B$3$3$G!"(BLinux$B$G%U%!%$%k%7%9%F%`$N<BAu$KI,MW$J%9%F%C%W$r9M$($F$_$^$7$g$&!#%U%!%$%k%7%9%F%`$r<BAu$9$k%3!<%I$O!"F0E*$K%m!<%I$5$l$k%b%8%e!<%k$G$b!"@EE*$K%+!<%M%k$K%j%s%/$5$l$k$h$&$K$b9=@.$9$k$3$H$,$G$-$^$9!#(B
$B$=$7$F!"(B Linux$B$N85$G9T$o$l$kJ}K!$OHs>o$KL@Gr$G$9!#I,MW$J$3$H$O!"(B<CODE>struct file_system_type</CODE>$B9=B$BN$K>pJs$rKd$a$F!"$3$l$r(BVFS$B$X(B<CODE>register_filesystem()</CODE>$B4X?t$K$h$C$FEPO?$9$k$3$H$@$1$J$N$G$9!#(B<CODE>fs/bfs/inode.c</CODE>$B$NNc$@$H!"0J2<$N$h$&$K$J$j$^$9!#(B</P>
<P>
<BLOCKQUOTE><CODE>
<HR>
<PRE>
#include <linux/module.h>
#include <linux/init.h>
static struct super_block *bfs_read_super(struct super_block *, void *, int);
static DECLARE_FSTYPE_DEV(bfs_fs_type, "bfs", bfs_read_super);
static int __init init_bfs_fs(void)
{
return register_filesystem(&bfs_fs_type);
}
static void __exit exit_bfs_fs(void)
{
unregister_filesystem(&bfs_fs_type);
}
module_init(init_bfs_fs)
module_exit(exit_bfs_fs)
</PRE>
<HR>
</CODE></BLOCKQUOTE>
</P>
<P><CODE>module_init()/module_exit()</CODE>$B%^%/%m$O!"(BBFS$B$,%b%8%e!<%k$H$7$F%3%s%Q%$%k$5$l$?$H$-$K!"4X?t(B<CODE>init_bfs_fs()</CODE>$B$H(B<CODE>exit_bfs_fs()</CODE>$B$,$=$l$>$l!"(B<CODE>init_module()</CODE>$B$H(B<CODE>cleanup_module()</CODE>$B$K$J$k$h$&$K$7$^$9!#(B</P>
<P><CODE>struct file_system_type</CODE>$B$O!"(B<CODE>include/linux/fs.h</CODE>$B$GDj5A$5$l$^$9!#(B</P>
<P>
<BLOCKQUOTE><CODE>
<HR>
<PRE>
struct file_system_type {
const char *name;
int fs_flags;
struct super_block *(*read_super) (struct super_block *, void *, int);
struct module *owner;
struct vfsmount *kern_mnt; /* For kernel mount, if it's FS_SINGLE fs */
struct file_system_type * next;
};
</PRE>
<HR>
</CODE></BLOCKQUOTE>
</P>
<P>$B$=$l$>$l$N%a%s%P$O!"<!$N$h$&$K@bL@$5$l$^$9!#(B</P>
<P>
<UL>
<LI> <B>name</B>: $B?M$,FI$a$kL>A0$G!"(B<CODE>filesystemsproc</CODE>$B%U%!%$%k$X8=$o$l$^$9!#$=$7$F!"%U%!%$%k%7%9%F%`$rL>A0$+$i8+$D$1$k$H$-$N%-!<$H$7$F;H$o$l$^$9!#$3$l$HF1$8L>A0$O!"(B<B>mount(2)</B>$B$X;XDj$9$k%U%!%$%k%7%9%F%`$N%?%$%W$H$7$F$b;H$o$l!"%U%!%$%k%7%9%F%`$4$H$K0l0U$G$J$1$l$P$J$j$^$;$s!#(B
</LI>
<LI> <B>fs_flags</B>: $B#1$D$J$$$7$O(B(OR$B$5$l$?(B)$BJ#?t$N%U%i%0(B: <CODE>FS_REQUIRES_DEV</CODE>$B$O!"%V%m%C%/%G%P%$%9>e$K$@$1%^%&%s%H2DG=$J%U%!%$%k%7%9%F%`$H$$$&0UL#!#(B<CODE>FS_SINGLE</CODE>$B$O!"M##1$D$N%9!<%Q!<%V%m%C%/$r$b$D%U%!%$%k%7%9%F%`!"(B<CODE>FS_NOMOUNT</CODE>$B$O%f!<%6%9%Z!<%9$+$i%^%&%s%H$G$-$J$$!"$D$^$j(B<B>mount(2)</B>$B%7%9%F%`%3!<%k$G%^%&%s%H$G$-$J$$%U%!%$%k%7%9%F%`!#$7$+$7$3$l$O!"FbItE*$K$O(B<CODE>kern_mount()</CODE>$B%$%s%?!<%U%'!<%9$r;H$($P%^%&%s%H$G$-$k(B ($BNc(B pipefs)$B!#(B
</LI>
<LI><B>read_super</B>: $B%^%&%s%HA`:nCf$K%9!<%Q%V%m%C%/$rFI9~$`4X?t$X$N%]%$%s%?!#$3$N4X?t$OI,?\$G$"$k!#$3$N%]%$%s%?$,EO$5$l$J$+$C$?$J$i!"%^%&%s%HA`:n(B($B%f!<%66u4V$K$;$h%+!<%M%k$+$i$K$;$h(B)$B$,(B<CODE>FS_SINGLE</CODE>$B$N>l9g$r=|$$$F>o$K<:GT$7!"(B
<CODE>fs_type->kern_mnt->mnt_sb</CODE>$B$r(B(<CODE>fs_type->kern_mnt = NULL</CODE>)$B$N$h$&$K;2>H$7$h$&$H$7$F!"(B<CODE>get_sb_sinle()</CODE>$B$G(BOops $B%(%i!<$,H/@8$9$k!#(B
</LI>
<LI><B>owner</B>: $B$3$N%U%!%$%k%7%9%F%`$r<BAu$7$F$$$k%b%8%e!<%k$X$N%]%$%s%?!#$b$7%U%!%$%k%7%9%F%`$,%+!<%M%k$K@EE*$K%j%s%/$5$l$F$$$l$P!"$3$NCM$O(BNULL$B$H$J$k!#$3$l$r<jF0$G@_Dj$9$kI,MW$O$J$/!"%^%/%m(B <CODE>THIS_MODULE</CODE> $B$K$h$C$F<+F0$GE,@Z$K@_Dj$5$l$k!#(B
</LI>
<LI><B>kern_mnt</B>: <CODE>FS_SINGLE</CODE>$B%U%!%$%k%7%9%F%`$N$_MxMQ!#$3$l$O(B<CODE>kern_mount()</CODE>$B$,@_Dj$9$k!#(B(TODO: <CODE>kern_mount()</CODE>$B$O(B<CODE>FS_SINGLE</CODE>$B$,@_Dj$5$l$F$$$J$$%U%!%$%k%7%9%F%`$N%^%&%s%H$r5qH]$9$Y$-$G$"$k(B)$B!#(B
</LI>
<LI> <B>next</B>: <CODE>file_systems$B$K$h$k(B</CODE>$BJRJ}8~%j%9%H$N@hF,$X$N%j%s%/(B (<CODE>fs/super.c</CODE>$B$r;2>H(B)$B!#%j%9%H$O!"(B<CODE>file_systems_lock</CODE>$BFI$_=q$-%9%T%s%m%C%/$K$h$jJ]8n$5$l$F$*$j!"(B<CODE>register/unregister_filesystem()</CODE>$B4X?t$O!"%j%9%H$+$i%(%s%H%j$r<h$j30$7$?$j!"F~$l$?$j$9$k$3$H$GJQ99$r9T$&!#(B</LI>
</UL>
</P>
<P><CODE>read_super()</CODE>$B4X?t$N;E;v$O!"%9!<%Q!<%V%m%C%/$N%U%#!<%k%I$rKd$a$k$3$H$G$9!#(B
inode$B$N>l=j$r3d$jEv$F!"%^%&%s%H$5$l$?%U%!%$%k%7%9%F%`$N%$%s%9%?%s%9$K4XO"$E$1$i$l$?(Bfs$B8GM-$N>pJs$r=i4|2=$7$^$9!#(B</P>
<P>
<OL>
<LI> $B%P%C%U%!%-%c%C%7%e(B<CODE>bread()</CODE>$B4X?t$r;H$C$F!"%9!<%Q!<%V%m%C%/$r(B<CODE>sb->s_dev</CODE>$B9`$G;X<($5$l$k%G%P%$%9$+$iFI$_<h$k!#(B</LI>
<LI> $B%9!<%Q%V%m%C%/$,@5$7$$%^%8%C%/%J%s%P!<$+$i$J$C$F$$$k$+3NG'$7!"A4BNE*$K@5>o$G$"$k$+$r!V8+!W$k!#(B
</LI>
<LI> <CODE>sb->s_op</CODE>$B$r(B<CODE>struct super_block_operations</CODE>$B9=B$BN$r;X$9$h$&$K=i4|2=$9$k!#$3$N9=B$BN$O!"!V(Binode$B$rFI$_<h$k!W$H$+!"!V(Binode$B$r:o=|$9$k!W$J$I$N$h$&$JA`:n$r<BAu$7$F$$$k%U%!%$%k%7%9%F%`FCM-$N4X?t$+$i$J$k!#(B
</LI>
<LI> <CODE>d_alloc_root()</CODE>$B$rMQ$$$F%k!<%H(Binode$B$H%k!<%H(Bdentry$B$r3d$jEv$F$k!#(B
</LI>
<LI> $B$b$7%U%!%$%k%7%9%F%`$,FI$_<h$j@lMQ$G%^%&%s%H$5$l$F$$$J$1$l$P!"(B<CODE>sb->s_dirt</CODE>$B$r(B1$B$K@_Dj$7!"%9!<%Q!<%V%m%C%/$+$i$J$k%P%C%U%!$r(Bdirty$B$H%^!<%/$9$k(B(TODO: $B$J$<$3$l$,I,MW(B?BFS$B$G$O!"(BMINIX$B$,$=$&$7$F$$$?$N$G$d$C$F$$$k$,(B...)</LI>
</OL>
</P>
<H2><A NAME="ss3.3">3.3</A> <A HREF="Linux-Kernel-Internals.html#toc3.3">$B%U%!%$%k%G%9%/%j%W%?4IM}(B</A>
</H2>
<P>Linux$B$K$*$$$F$O!"%f!<%6%U%!%$%k%G%9%/%j%W%?$H%+!<%M%k$N(Binode$B9=B$BN$N4V$K4V@\E*$J%l%Y%k$,B8:_$7$F$$$^$9!#%W%m%;%9$,(B<CODE>open(2)</CODE>$B%7%9%F%`%3!<%k8F$S=P$9$H$-!"%+!<%M%k$O!"$3$N%U%!%$%k$r<!$N(BI/O$BA`:n$G;HMQ$9$k>.$5$$@5$N@0?t$rJV$7$^$9!#$3$N@0?t$O!"(B<CODE>struct file</CODE>$B$X$N%]%$%s%?$NG[Ns$N%$%s%G%C%/%9$K$J$C$F$$$^$9!#3F%U%!%$%k9=B$BN$O!"(B<CODE>file->f_dentry</CODE>$B$rDL$7$F!"(Bdentry$B$r;X$7$F$$$^$9!#$=$7$F3F(Bdentry$B$O(B<CODE>dentry->d_inode</CODE>$B$rDL$8$F(Binode$B$r;X$7$F$$$^$9!#(B</P>
<P>$B3F%?%9%/$O!"(B<CODE>include/linux/sched.h</CODE>$B$GDj5A$5$l$F$$$k(B<CODE>struct files_struct</CODE>$B$r;X$7$F$$$k(B<CODE>tsk->files</CODE>$B%U%#!<%k%I$r;}$C$F$$$^$9!#(B</P>
<P>
<BLOCKQUOTE><CODE>
<HR>
<PRE>
/*
* Open file table structure
*/
struct files_struct {
atomic_t count;
rwlock_t file_lock;
int max_fds;
int max_fdset;
int next_fd;
struct file ** fd; /* current fd array */
fd_set *close_on_exec;
fd_set *open_fds;
fd_set close_on_exec_init;
fd_set open_fds_init;
struct file * fd_array[NR_OPEN_DEFAULT];
};
</PRE>
<HR>
</CODE></BLOCKQUOTE>
</P>
<P><CODE>file->count</CODE>$B$O;2>H%+%&%s%?$G$"$j!"(B($BDL>o!"(B<CODE>fget()</CODE>$B$+$i8F$S=P$5$l$k(B)<CODE>get_file()</CODE>$B$GA}J,$5$l!"(B<CODE>fput()</CODE>$B$H(B<CODE>put_filp()</CODE>$B$G8:>/$5$l$^$9!#(B<CODE>fput()</CODE>$B$H(B<CODE>put_filp()</CODE>$B$N0c$$$O!"(B<CODE>fput()</CODE>$B$,0lHL$N%U%!%$%k$KDL>oI,MW$J!"%U%!%$%k%m%C%/$N3+J|$d(Bdentry$B$N3+J|$J$I$NDI2C$N=hM}$r9T$&$N$KBP$7!"(B<CODE>put_filp()</CODE>$B$OC1$K%U%!%$%k%F!<%V%k9=B$BN$rA`:n$9$k$K2a$.$J$$$H$3$m$K$"$j$^$9!#$D$^$j!"%+%&%s%?$N8:>/$O(B<CODE>file_lock</CODE>$B%9%T%s%m%C%/$NJ]8n$N$b$H!"(B<CODE>anon_list</CODE>$B$+$i%U%!%$%k$r:o=|$7!"$=$l$r(B<CODE>free_list</CODE>$B$XDI2C$9$k$H$$$&$3$H$G$9!#(B</P>
<P>$B$b$7;R$N%9%l%C%I$,%/%m!<%s%U%i%00z?t$K(B<CODE>CLONE_FILES</CODE>$B$r@_Dj$7$F(B<CODE>clone()</CODE>$B%7%9%F%`%3!<%k$r8F$s$G:n$i$l$?$b$N$G$"$l$P!"(B<CODE>tsk->files</CODE>$B$O?F$H;R$N4V$G6&M-$9$k$3$H$,$G$-$^$9!#$3$l$O!"(B(<CODE>do_fork()</CODE>$B$K$h$C$F8F$P$l$k(B)<CODE>kernel/fork.c:copy_files()</CODE>$B$K$*$$$F8+$k$3$H$,$G$-!"$3$l$O!"$b$7(B<CODE>CLONE_FILES</CODE>$B$,!"EAE}E*$J=>Mh$N8EE5E*(BUNIX$B$N(B<B>fork(2)</B>$B$K$*$1$kDL>o$N%U%!%$%k%G%9%/%j%W%?%F!<%V%k$N%3%T!<$N$+$o$j$K@_Dj$5$l$F$$$l$P!"C1$K(B<CODE>file->count</CODE>$B$rA}J,$5$;$k$@$1$G$9!#(B</P>
<P>$B%U%!%$%k$,3+$+$l$k$H$-!"$=$l$K3d$jEv$F$i$l$k%U%!%$%k9=B$BN$O!"(B<CODE>current->files->fd[fd]</CODE>$B%9%m%C%H$XAH$_9~$^$l$^$9!#$=$7$F%S%C%H%^%C%W(B<CODE>current->files->open_fds</CODE>$B$N(B<CODE>fd</CODE>$B%S%C%H$,%;%C%H$5$l$^$9!#$3$l$i$N$3$H$OA4$F!"(B<CODE>current->files->file_lock</CODE>$BFI$_=q$-%9%T%s%m%C%/$N=q$-9~$_J]8n$N$b$H$G9T$o$l$^$9!#$b$7!"%G%9%/%j%W%?$,(Bclose$B$5$l$l$P!"(B <CODE>current->files->open_fds</CODE>$B$N(B<CODE>fd</CODE>$B%S%C%H$O%/%j%"$5$l!"$3$N%W%m%;%9$,%U%!%$%k$r$D$.$K%*!<%W%s;HMQ$H$7$?$H$-$K!":G=i$NL$;HMQ$N%G%9%/%j%W%?$r8+$D$1$k$?$a$N%R%s%H$H$7$F!"(B<CODE>current->files->next_fd</CODE>$B$O(B<CODE>fd</CODE>$B$HF1$8$K$J$k$h$&@_Dj$5$l$^$9!#(B</P>
<H2><A NAME="ss3.4">3.4</A> <A HREF="Linux-Kernel-Internals.html#toc3.4">$B%U%!%$%k9=B$BN4IM}(B</A>
</H2>
<P>$B%U%!%$%k9=B$BN$O(B <CODE>include/linux/fs.h</CODE>$B$GDj5A$5$l$F$$$^$9!#(B</P>
<P>
<BLOCKQUOTE><CODE>
<HR>
<PRE>
struct fown_struct {
int pid; /* pid or -pgrp where SIGIO should be sent */
uid_t uid, euid; /* uid/euid of process setting the owner */
int signum; /* posix.1b rt signal to be delivered on IO */
};
struct file {
struct list_head f_list;
struct dentry *f_dentry;
struct vfsmount *f_vfsmnt;
struct file_operations *f_op;
atomic_t f_count;
unsigned int f_flags;
mode_t f_mode;
loff_t f_pos;
unsigned long f_reada, f_ramax, f_raend, f_ralen, f_rawin;
struct fown_struct f_owner;
unsigned int f_uid, f_gid;
int f_error;
unsigned long f_version;
/* needed for tty driver, and maybe others */
void *private_data;
};
</PRE>
<HR>
</CODE></BLOCKQUOTE>
</P>
<P>$B$G$O(B <CODE>struct file</CODE> $B$N%a%s%P$r8+$F$$$-$^$7$g$&!#(B</P>
<P>
<OL>
<LI> <B>f_list</B>: $B$3$N%a%s%P$O<!$N%j%9%H$N$&$A0l$D(B($B$=$7$F$?$@$R$H$D(B)$B$N%U%!%$%k9=B$BN$r%j%s%/$9$k!#(Ba) $B$3$N%U%!%$%k%7%9%F%`$NA4$F$N%*!<%W%s$7$F$$$k%U%!%$%k$N(B<CODE>sb->s_files</CODE>$B%j%9%H!"$b$74XO"$9$k(Binode$B$,F?L>$G$J$1$l$P!"(B(<CODE>filp_open()</CODE>$B$+$i$h$P$l$k(B)<CODE>dentry_open()</CODE>$B$O!"$3$N%j%9%H$K%U%!%$%k$r%j%s%/$9$k!#(Bb) <CODE>fs/file_table.c:free_list</CODE>, $BL$;HMQ$N%U%!%$%k9=B$BN$+$i$J$k!#(Bc) <CODE>fs/file_table.c:anon_list</CODE>, <CODE>get_empty_filp()</CODE>$B$K$h$C$F?7$7$$%U%!%$%k9=B$BN$,:n$i$l$?$H$-$K$3$N%j%9%H$K$*$+$l$k!#$9$Y$F$N%j%9%H$O(B<CODE>files_lock</CODE>$B%9%T%s%m%C%/$K$h$C$FJ]8n$5$l$k!#(B
</LI>
<LI> <B>f_dentry</B>: $B$3$N%U%!%$%k$K4XO"$E$1$i$l$k(Bdentry$B!#(Bdentry$B$O!"(B<CODE>open_namei()</CODE>$B$,(Bnameidata$B$rC5$9$H$-(B($B$"$k$$$O!"$3$l$r8F$S=P$9(B<CODE>path_walk()</CODE>$B$,<B9T$5$l$?$H$-(B)$B$K:n$i$l$k!#$7$+$7!"<B:]$N(B<CODE>file->f_dentry</CODE>$B%a%s%P$O(B<CODE>dentry_open()</CODE>$B$K$h$C$F!"$3$N$h$&$K$7$F8+$D$+$C$?(Bdentry$B$K%;%C%H$5$l$k!#(B
</LI>
<LI> <B>f_vfsmnt</B>: $B$=$N%U%!%$%k$N(B<CODE>vfsmount</CODE>$B%U%!%$%k%7%9%F%`9=B$BN$r;X$9!#$3$l$O!"(B<CODE>dentry_open()</CODE>$B$K$h$C$F@_Dj$5$l$k$,!"(B<CODE>open_namei()</CODE>($B$J$$$7$O!"$3$l$r8F$S=P$9(B <CODE>path_init()</CODE>) $B$K$h$j(B nameidata $B$N0lIt$H$7$F8+$k$3$H$,$G$-$k!#(B
</LI>
<LI> <B>f_op</B>: $B$3$N%U%!%$%k$G5/F0$5$l$k$5$^$6$^$J%a%=%C%I$+$i$J$k(B<CODE>file_operations</CODE>$B$r;X$9!#$3$l$O!"(Bnameidata$B$N8!:wCf$K%U%!%$%k%7%9%F%`FCM-$N(B<CODE>s_op->read_inode()</CODE>$B%a%=%C%I$K$h$C$F:n$i$l$?!"(B<CODE>inode->i_fop</CODE>$B$+$i%3%T!<$5$l$k!#$3$N%;%/%7%g%s$N8e$NJ}$G!"(B<CODE>file_operations</CODE>$B%a%=%C%I$O>\:Y$K8+$F$$$/$3$H$K$7$h$&!#(B
</LI>
<LI><B>f_count</B>: <CODE>get_file/put_filp/fput</CODE>$B$K$h$jA`:n$5$l$k%j%U%!%l%s%9%+%&%s%?!#(B
</LI>
<LI><B>f_flags</B>: <CODE>dentry_open()</CODE>$B$K$h$C$F(B(<CODE>filp_open()</CODE>$B$,<c43$NJQ99$r2C$($F(B)$B%3%T!<$5$l$k(B<B>open(2)</B>$B%7%9%F%`%3!<%k$+$i$N(B<CODE>O_XXX</CODE>$B%U%i%0!#(B<CODE>O_CREAT</CODE>$B!"(B<CODE>O_EXCL</CODE>$B!"(B<CODE>O_NOCTTY</CODE>$B!"(B<CODE>O_TRUNC</CODE>$B$r%/%j%"$7$?8e$O$3$l$i$N%U%i%0$rD9$$4VJ]B8$7$F$*$/0UL#$O$J$$!#$J$<$J$i!"(B<CODE>F_SETFL</CODE> $B$d(B <CODE>F_GETFL</CODE> <B>fcntl(2)</B> $B%7%9%F%`%3!<%k$GJQ99$5$l$k$3$H$b!"Ld$$9g$o$;$i$l$k$3$H$b$J$$$+$i$G$"$k!#(B
</LI>
<LI><B>f_mode</B>: $B%f!<%66u4V$N%U%i%0$H%b!<%I$NAH$_9g$o$;!#(B<CODE>dentry_open()</CODE>$B$K$h$C$F@_Dj$5$l$k!#JQ49$N%]%$%s%H$O!"FI$_=q$-$N%"%/%;%9$rJL$N%S%C%H$X3JG<$9$k$3$H$G!"(B<CODE>(f_mode & FMODE_WRITE)</CODE>$B$d(B<CODE>(f_mode & FMODE_READ)</CODE>$B$N$h$&$J%A%'%C%/$rMF0W$K$9$k$3$H$,$G$-$k!#(B
</LI>
<LI><B>f_pos</B>: $B<!2s$N%U%!%$%k$NFI$_=q$-$K$*$1$k8=:_$N%U%!%$%k0LCV!#(Bi386$B$G$O!"(B<CODE>long long</CODE>$B7?!"$D$^$j(B64$B%S%C%HCM$K$J$k!#(B
</LI>
<LI><B>f_reada, f_ramax, f_raend, f_ralen, frawin</B>: readahead$B$r%5%]!<%H$9$k!#(B -- $BJ#;($9$.$F?M4V$K$O5DO@$G$-$J$$(B ;)
</LI>
<LI><B>f_owner</B>: $BHsF14|(BI/O$BDLCN$r(B<CODE>SIGIO</CODE>$B5!9=$rDL$8$F<u$1<h$k%U%!%$%k(BI/O$B$N=jM-<T!#(B(<CODE>fs/fcntl.c:kill_fasync()</CODE>$B;2>H(B)
</LI>
<LI><B>f_uid, f_gid</B>: $B%U%!%$%k9=B$BN$,(B<CODE>get_empty_filp()</CODE>$B$K$h$C$F:n$i$l$?$H$-$K%U%!%$%k$r3+$$$?%W%m%;%9$N%f!<%6(BID$B$H%0%k!<%W(BID$B$K@_Dj$5$l$k!#%U%!%$%k$,%=%1%C%H$N$H$-$O!"(Bipv4$B%M%C%H%U%#%k%?$,;H$&!#(B
</LI>
<LI><B>f_error</B>: $B=q$-9~$_%(%i!<$rJV$9$?$a$K(BNFS$B%/%i%$%"%s%H$,MxMQ$9$k!#$3$l$O(B<CODE>fs/nfs/file.c</CODE>$B$G@_Dj$5$l!"(B<CODE>mm/filemap.c:generic_file_write()</CODE>$B$G%A%'%C%/$5$l$k!#(B
</LI>
<LI><B>f_version</B>: $B%-%c%C%7%e$r<h$j>C$9$?$a$N%P!<%8%g%s4IM}%a%+%K%:%`!#(B($B%0%m!<%P%kJQ?t$N(B<CODE>event</CODE>$B$r;H$C$F(B)<CODE>f_pos</CODE>$B$,JQ$C$?$H$-$K$$$D$bA}J,$5$l$k!#(B
</LI>
<LI><B>private_data</B>: $B%U%!%$%k%7%9%F%`$,;H$&$3$H$,$G$-$k(B($BNc$($P!"(Bcoda $B$O$3$3$K(B $B>ZL@=q$r3JG<$9$k(B) $BHs8x3+$N%U%!%$%kKh$N%G!<%?!#$J$$$7$O!"%G%P%$%9%I%i%$%P$,;H$&!#(B(devfs$B$K$"$k(B)$B%G%P%$%9%I%i%$%P$O!"$3$N%a%s%P$r!"(B<CODE>file->f_dentry->d_inode->i_rdev</CODE>$B$KId9f2=$5$l$k!"8EE5E*$J%^%$%J!<HV9f$N$+$o$j$K!"J#?t$N%$%s%9%?%s%94V$r6hJL$9$k$N$K;H$($k!#(B
</LI>
</OL>
</P>
<P>$B$5$F!"%U%!%$%k$K$D$$$F5/F0$G$-$k%a%=%C%I$+$i$G$-$F$$$k(B <CODE>file_operations</CODE>$B9=B$BN$r8+$F$_$^$7$g$&!#(B<CODE>inode->i_fop</CODE>$B$+$i%3%T!<$5$l$k$3$H$d!"$=$l$,(B<CODE>s_op->read_inode()</CODE>$B%a%=%C%I$K$h$C$F@_Dj$5$l$k$3$H$J$I$r3P$($F$$$k$G$7$g$&$+!#$3$l$O!"(B<CODE>include/linux/fs.h</CODE>$B$GDj5A$5$l$F$$$^$9!#(B</P>
<P>
<BLOCKQUOTE><CODE>
<HR>
<PRE>
struct file_operations {
struct module *owner;
loff_t (*llseek) (struct file *, loff_t, int);
ssize_t (*read) (struct file *, char *, size_t, loff_t *);
ssize_t (*write) (struct file *, const char *, size_t, loff_t *);
int (*readdir) (struct file *, void *, filldir_t);
unsigned int (*poll) (struct file *, struct poll_table_struct *);
int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned long);
int (*mmap) (struct file *, struct vm_area_struct *);
int (*open) (struct inode *, struct file *);
int (*flush) (struct file *);
int (*release) (struct inode *, struct file *);
int (*fsync) (struct file *, struct dentry *, int datasync);
int (*fasync) (int, struct file *, int);
int (*lock) (struct file *, int, struct file_lock *);
ssize_t (*readv) (struct file *, const struct iovec *, unsigned long, loff_t *);
ssize_t (*writev) (struct file *, const struct iovec *, unsigned long, loff_t *);
};
</PRE>
<HR>
</CODE></BLOCKQUOTE>
</P>
<P>
<OL>
<LI><B>owner</B>: $BO@E@$H$J$C$F$$$k%5%V%7%9%F%`$r=jM-$7$F$$$k%b%8%e!<%k$r;X$9!#%I%i%$%P$N$_$,$3$l$r(B<CODE>THIS_MODULE</CODE>$B$K@_Dj$9$kI,MW$,$"$j!"%b%8%e!<%k$N%+%&%s%H$O!"%I%i%$%P$,(Bopen/release$B;~$K@)8f$9$kI,MW$,$"$k$N$KBP$7$F!"(Bmount/umount$B$N$H$-$K@)8f$5$l$k$?$a!"%U%!%$%k%7%9%F%`$O9,1?$J$3$H$KL5;k$G$-$k!#(B
</LI>
<LI><B>llseek</B>: <B>lseek(2)</B>$B%7%9%F%`%3!<%k$r<BAu$7$F$$$k!#DL>o!"$3$l$O>JN,$5$l!"(B<CODE>fs/read_wirte.c:default_llseek()</CODE>$B$,;H$o$l$k!#$3$l$O@5$7$$J}K!$G$"$k!#(B(TODO: default_llseek$B$r;H$&$?$a$K8=:_$3$l$K(BNULL$B$r@_Dj$7$J$1$l$P$J$i$J$/$J$C$F$$$k!#$3$N$H$-$O!"(B<CODE>llseek()</CODE>$B$G(B<CODE>if()</CODE>$B$rJ]B8$7$F$$$k(B)$B!#(B
</LI>
<LI><B>read</B>: <CODE>read(2)</CODE>$B%7%9%F%`%3!<%k$N<BAu!#$3$3$G$O!"%U%!%$%k%7%9%F%`$O!"(B<CODE>mm/flemap.c:generic_file_read()</CODE>$B$rDL>o$N%U%!%$%k$K!"(B<CODE>fs/read_write.c:generic_read_dir()</CODE>($BC1=c$K(B<CODE>-EISDIR</CODE>$B$rJV$9(B)$B$r%G%#%l%/%H%j$K;HMQ$G$-$k!#(B
</LI>
<LI><B>write</B>: <B>write(2)</B>$B%7%9%F%`%3!<%k$N<BAu!#$3$3$G$O!"%U%!%$%k%7%9%F%`$O!"(B<CODE>mm/filemap.c:generic_file_write()</CODE>$B$rDL>o$N%U%!%$%k$K;HMQ$G$-!"%G%#%l%/%H%j$OL5;k$G$-$k!#(B
</LI>
<LI><B>readdir</B>: $B%U%!%$%k%7%9%F%`$,;H$&!#DL>o$N%U%!%$%k$OL5;k$5$l!"%G%#%l%/%H%j$K$O(B<B>readdir(2)</B> $B$H(B <B>getdents(2)</B> $B%7%9%F%`%3!<%k$,<BAu$5$l$k!#(B
</LI>
<LI><B>poll</B>: <B>poll(2)</B> $B$H(B <B>select(2)</B> $B%7%9%F%`%3!<%k$,<BAu$5$l$k!#(B
</LI>
<LI><B>ioctl</B>: $B%I%i%$%P$d%U%!%$%k%7%9%F%`FCM-$N(B ioctl $B$r<BAu$7$F$$$k!#0lHL$N%U%!%$%k$KBP$9$k(B <CODE>FIBMAP</CODE>$B$d(B <CODE>FIGETBSZ</CODE>$B!"(B <CODE>FIONREAD</CODE> $B$N$h$&$J(Bioctl $B$O!"9b%l%Y%k$G<BAu$5$l$F$*$j(B<CODE>f_op->ioctl()</CODE> $B%a%=%C%I$rFI$`$3$H$,$J$$!#(B
</LI>
<LI><B>mmap</B>: <B>mmap(2)</B> $B%7%9%F%`%3!<%k$r<BAu$7$F$$$k!#%U%!%$%k%7%9%F%`$O(B <B>generic_file_mmap</B>$B$r0lHL$N%U%!%$%k$KBP$7$F$3$3$G;H$&$3$H$,$G$-!"%G%#%l%/%H%j$KBP$7$F$OL5;k$5$l$k!#(B
</LI>
<LI><B>open</B>: <B>open(2)</B> $B$7$?$H$-$K(B<CODE>dentry_open()</CODE> $B$,8F$V!#%U%!%$%k%7%9%F%`$OLGB?$K;H$o$J$$!#Nc$($P!"(Bcoda $B$O%*!<%W%s$7$?$H$-$K%U%!%$%k$r%m!<%+%k$K%-%c%C%7%e$7$h$&$H$9$k!#(B</LI>
<LI><B>flush</B>: $B%U%!%$%k$N3F(B<B>close(2)</B>$B$4$H$K8F$P$l$k!#I,$:$7$b:G8e$K8F$P$l$kI,MW$O$J$$!#(B($B0J2<$N(B<CODE>release()</CODE>$B%a%=%C%I;2>H(B) $B$3$l$r;H$&%U%!%$%k%7%9%F%`$H$$$&$N$O!"M#0l(BNFS$B$N%/%i%$%"%s%H$G!"A4$F$N(Bdirty$B%Z!<%8$r=q$-=P$9!#$3$3$G!"(B<B>close(2)</B>$B%7%9%F%`%3!<%k$+$i!"%f!<%66u4V$KAw$jJV$5$l$k%(%i!<$rJV$9$3$H$,$"$k!#(B
</LI>
<LI><B>release</B>: $B%U%!%$%k$N:G8e$N(B<B>close(2)</B>$B$G8F$P$l$k!#$D$^$j!"(B<CODE>file->f_count</CODE>$B$,(B0$B$G$"$k$H$-$@!#@0?t$rJV$9$HDj5A$5$l$F$$$k$K$b4X$o$i$:!"(BVFS$B$G$OJV$jCM$OL5;k$5$l$k!#(B(<CODE>fs/file_table.c:__fput()</CODE>$B$r;2>H(B)
</LI>
<LI><B>fsync</B>: <B>fsync(2)/fdatasync(2)</B>$B%7%9%F%`%3!<%k$KD>@\BP1~$9$k!#:G8e$N0z?t$G(Bfsync$B$K$J$k$+(Bfdatasync$B$K$J$k$+$r;XDj$9$k!#(BVFS $B$O$=$N:]$[$H$s$I2?$b;E;v$r$7$J$$$,!"%U%!%$%k%G%#%9%/%j%W%?$r(B file $B9=B$BN$KBP1~$5$;$k$3$H(B (<CODE>file = fget(fd)</CODE>)$B!"$*$h$S(B <CODE>inode->i_sem</CODE> $B%;%^%U%)$rA`:n$9$k$3$H$O9T$&!#(BExt2 $B%U%!%$%k%7%9%F%`$O:G8e$N0z?t$rL5;k$9$k$N$G!"(B<B>fsync(2)</B> $B$H(B <B>fdatasync(2)</B> $B$N%7%9%F%`%3!<%k$OA4$/F1$8F/$-$r$9$k!#(B
</LI>
<LI><B>fasync</B>: $B$3$N%a%=%C%I$O!"(B<CODE>file->f_flags & FASYNC</CODE> $B$,??$G$"$k$H$-$K;H$o$l$k!#(B
</LI>
<LI><B>lock</B> : $B%U%!%$%k%7%9%F%`$K8GM-$J(BPOSIX$B$N(B<B>fcntl(2)</B>$B$N%U%!%$%kNN0h%m%C%/5!9=!#$3$3$G$NM#0l$N%P%0$O!"(Bfs $BHs0MB8(B(<CODE>posix_lock_file()</CODE>)$B$J$b$N$,8F$P$l$kA0$K8F$P$l$?$H$-!"$b$7@.8y$7$?$,DL>o$N(BPOSIX$B%m%C%/%3!<%I$,<:GT$7$?$i(B fs $B0MB8%l%Y%k$G$O!"%m%C%/2r=|$G$-$J$/$J$k$H$$$&$3$H$G$"$k!#(B
</LI>
<LI><B>readv</B>: <B>readv(2)</B>$B%7%9%F%`%3!<%k$N<BAu!#(B
</LI>
<LI><B>writev</B>: <B>writev(2)</B>$B%7%9%F%`%3!<%k$N<BAu!#(B</LI>
</OL>
</P>
<H2><A NAME="ss3.5">3.5</A> <A HREF="Linux-Kernel-Internals.html#toc3.5">$B%9!<%Q!<%V%m%C%/$H%^%&%s%H%]%$%s%H4IM}(B</A>
</H2>
<P>Linux $B$K$*$$$F$O!"%^%&%s%H$5$l$?%U%!%$%k%7%9%F%`$K$D$$$F$N>pJs$O(B2$B$D$KJ,$+$l$?9=B$BN(B <CODE>super_block</CODE>$B$H(B<CODE>vfsmount</CODE> $B$GJ];}$5$l$F$$$^$9!#$3$l$O(B Linux $B$OF1$8%U%!%$%k%7%9%F%`(B($B%V%m%C%/%G%P%$%9(B)$B$rJ#?t$N%^%&%s%H%]%$%s%H$X%^%&%s%H$9$k!"$D$^$jF1$8(B<CODE>super_block</CODE> $B$,J#?t$N(B<CODE>vfsmount</CODE>$B9=B$BN$X4XO"$E$1$i$l$k$H$$$&0UL#$G$9$,!"$3$l$,5v$5$l$F$$$k$3$H$,!"(B2$B$D$KJ,$+$l$F4IM}$5$l$kM}M3$K$J$C$F$$$^$9!#(B</P>
<P><CODE>include/linux/fs.h</CODE> $B$GDj5A$5$l$k(B <CODE>struct super_block</CODE> $B$r:G=i$K$_$F$$$-$^$9!#(B</P>
<P>
<BLOCKQUOTE><CODE>
<HR>
<PRE>
struct super_block {
struct list_head s_list; /* Keep this first */
kdev_t s_dev;
unsigned long s_blocksize;
unsigned char s_blocksize_bits;
unsigned char s_lock;
unsigned char s_dirt;
struct file_system_type *s_type;
struct super_operations *s_op;
struct dquot_operations *dq_op;
unsigned long s_flags;
unsigned long s_magic;
struct dentry *s_root;
wait_queue_head_t s_wait;
struct list_head s_dirty; /* dirty inodes */
struct list_head s_files;
struct block_device *s_bdev;
struct list_head s_mounts; /* vfsmount(s) of this one */
struct quota_mount_options s_dquot; /* Diskquota specific options */
union {
struct minix_sb_info minix_sb;
struct ext2_sb_info ext2_sb;
..... all filesystems that need sb-private info ...
void *generic_sbp;
} u;
/*
* The next field is for VFS *only*. No filesystems have any business
* even looking at it. You had been warned.
*/
struct semaphore s_vfs_rename_sem; /* Kludge */
/* The next field is used by knfsd when converting a (inode number based)
* file handle into a dentry. As it builds a path in the dcache tree from
* the bottom up, there may for a time be a subpath of dentrys which is not
* connected to the main tree. This semaphore ensure that there is only ever
* one such free path per filesystem. Note that unconnected files (or other
* non-directories) are allowed, but not unconnected diretories.
*/
struct semaphore s_nfsd_free_path_sem;
};
</PRE>
<HR>
</CODE></BLOCKQUOTE>
</P>
<P><CODE>super_block</CODE> $B9=B$BN$K$OMM!9$J%a%s%P$,$"$j$^$9!#(B</P>
<P>
<OL>
<LI><B>s_list</B>: $BA4$F$N%"%/%F%#%V$J%9!<%Q!<%V%m%C%/$N%@%V%k%j%s%/%j%9%H!#$3$3$G!"!VA4$F$N%^%&%s%H$5$l$?%U%!%$%k%7%9%F%`!W$H8@$o$J$$$N$O!"(BLinux $B$G$O!"0l$D$N%9!<%Q%V%m%C%/$K4XO"$E$1$i$l$?%^%&%s%H$5$l$?%U%!%$%k%7%9%F%`$NJ#?t$N%$%s%9%?%s%9$r;}$F$k$?$a$G$"$k!#(B
</LI>
<LI><B>s_dev</B>: $B%^%&%s%H$5$l$k$N$K%V%m%C%/$rI,MW$H$9$k%U%!%$%k%7%9%F%`!"$D$^$j(B <CODE>FS_REQUIRES_DEV</CODE> $B$J%U%!%$%k%7%9%F%`$K$H$C$F$O!"$3$N%a%s%P$O$=$N%V%m%C%/%G%P%$%9$N(B <CODE>i_dev</CODE> $B$G$"$k!#$=$NB>$N(B ($BF?L>%U%!%$%k%7%9%F%`$H8F$P$l$k(B) $B%U%!%$%k%7%9%F%`$KBP$7$F$O!"$3$l$O(B <CODE>MKDEV(UNNAMED_MAJOR, i)</CODE> $B$GI=$5$l$k@0?t$G$"$k!#$?$@$7(B <CODE>i</CODE> $B$O!"(B<CODE>unnamed_dev_in_use</CODE> $B%S%C%HG[Ns$NCf$G:G=i$N(B OFF $B%S%C%H$r;X$9!"(B1 $B$+$i(B 255 $B$NHO0O$NCM$G$"$k!#(B<CODE>fs/super.c:get_unnamed_dev()/put_unnamed_dev()</CODE> $B$r;2>H$N$3$H!#F?L>%U%!%$%k%7%9%F%`$,(B <CODE>s_dev</CODE> $B%a%s%P$rMxMQ$9$Y$-$G$J$$$H$$$&$3$H$O!"$3$l$^$G2?EY$bDs0F$5$l$F$-$?!#(B
</LI>
<LI><B>s_blocksize, s_blocksize_bits</B>: $B%V%m%C%/%5%$%:$H(Blog2($B%V%m%C%/%5%$%:(B)$B!#(B
</LI>
<LI><B>s_lock</B>: $B%9!<%Q!<%V%m%C%/$,!"(B<CODE>lock_super()/unlock_super()</CODE> $B$K$h$C$F8=:_%m%C%/$5$l$F$$$k$+$I$&$+$r<($9!#(B
</LI>
<LI><B>s_dirt</B>: $B%9!<%Q!<%V%m%C%/$,JQ99$5$l$?$H$-$K@_Dj$5$l!"%G%#%9%/$X=q$-La$5$l$?$H$-$O$$$D$b%/%j%"$5$l$k!#(B
</LI>
<LI><B>s_type</B>: $B4XO"$9$k%U%!%$%k%7%9%F%`$N(B <CODE>struct file_system_type</CODE> $B$r;X$9!#(Bfs $BFCM-$N(B<CODE>read_super()</CODE>$B$,@.8y$7$?$H$-$K(B VFS <CODE>fs/super.c:read_super()</CODE> $B$,@_Dj$7!"<:GT$7$?$H$-(B NULL $B$K%j%;%C%H$9$k$?$a!"%U%!%$%k%7%9%F%`$N(B <CODE>read_super()</CODE> $B%a%=%C%I$O@_Dj$9$kI,MW$,$J$$!#(B
</LI>
<LI><B>s_op</B>: fs $BFCM-$N(Bread/write inode$B$J$I$N%a%=%C%I$+$i$J$k(B <CODE>super_operations</CODE> $B9=B$BN$X$N%]%$%s%?!#(B<CODE>s_op</CODE> $B$r@5$7$/=i4|2=$9$k$N$O!"%U%!%$%k%7%9%F%`$N(B <CODE>read_super()</CODE> $B%a%=%C%I$N;E;v$G$"$k!#(B
</LI>
<LI><B>dq_op</B>: $B%G%#%9%/%/%*%?A`:n!#(B
</LI>
<LI><B>s_flags</B>: $B%9!<%Q!<%V%m%C%/%U%i%0!#(B
</LI>
<LI><B>s_magic</B>: $B%U%!%$%k%7%9%F%`$N%^%8%C%/HV9f!#(Bminix$B%U%!%$%k%7%9%F%`$G$O!"$=$l<+?H$NJ#?t%P!<%8%g%s$r6hJL$9$k$?$a$K;H$o$l$k!#(B
</LI>
<LI><B>s_root</B>: $B%U%!%$%k%7%9%F%`$N%k!<%H$N(Bdentry$B!#%k!<%H$N(B inode $B$r%G%#%9%/$+$iFI$_!"(B<CODE>d_alloc_root()</CODE>$B$r8F$s$G(Bdentry$B$r3d$jEv$F$F<BBN2=$9$k$?$a$KEO$9$N$O!"(B<CODE>read_super()</CODE> $B$N;E;v$G$"$k!#(B
</LI>
<LI><B>s_wait</B>: $B%9!<%Q!<%V%m%C%/$,%m%C%/2r=|$5$l$k$N$rBT$D%W%m%;%9$NBT$A%-%e!<!#(B
</LI>
<LI><B>s_dirty</B>: $BA4$F$N(Bdirty $B$J(B inode $B$N%j%9%H!#$b$7(B inode $B$,1x$l$F(B(<CODE>inode->i_state & I_DIRTY</CODE>)$B$$$l$P!"%9!<%Q!<%V%m%C%/FCM-$N(B<CODE>inode->i_list</CODE>$B7PM3$G%j%s%/$5$l$?(B dirty $B%j%9%H$K$*$+$l$k!#(B
</LI>
<LI><B>s_files</B>: $B$3$N%9!<%Q!<%V%m%C%/$G%*!<%W%s$7$F$$$k%U%!%$%kA4$F$N%j%9%H!#%U%!%$%k%7%9%F%`$r(B read-only $B$G:F%^%&%s%H$G$-$k$+$rH=CG$9$k$H$-$KM-MQ!#(B<CODE>sb->s_files</CODE> $B%j%9%H$r$_$F!"$b$7%U%!%$%k$,=q$-9~$_%*!<%W%s$5$l$F$$$k(B(<CODE>file->f_mode & FMODE_WRITE</CODE>)$B$+!"(Bunlink$B$,J]N1$5$l$F$$$k(B(<CODE>inode->i_nlink == 0</CODE>)$B%U%!%$%k$,$"$l$P!":F%^%&%s%H$r5qH]$9$k(B<CODE>fs/file_table.c:fs_may_remount_ro()</CODE>$B$r;2>H$9$k$3$H!#(B
</LI>
<LI><B>s_bdev</B>: <CODE>FS_REQUIRES_DEV</CODE> $B$N$?$a$K!"$3$l$O(B $B%U%!%$%k%7%9%F%`$,%^%&%s%H$5$l$F$$$k%G%P%$%9$rI=$9(B block_device $B9=B$BN$r;X$7$F$$$k!#(B
</LI>
<LI><B>s_mounts</B>: $BA4$F$N(B <CODE>vfsmount</CODE> $B9=B$BN$N%j%9%H!#%^%&%s%H$5$l$?$3$N%9!<%Q!<%V%m%C%/$N3F%$%s%9%?%s%9$N(B???
</LI>
<LI><B>s_dquot</B>: $B%G%#%9%/%/%*%?MQ!#(B</LI>
</OL>
</P>
<P>$B%9!<%Q!<%V%m%C%/$NA`:n$O!"(B<CODE>include/linux/fs.h</CODE> $B$GDj5A$5$l$F$$$k(B <CODE>super_operations</CODE> $B9=B$BN$K5-=R$5$l$F$$$k!#(B</P>
<P>
<BLOCKQUOTE><CODE>
<HR>
<PRE>
struct super_operations {
void (*read_inode) (struct inode *);
void (*write_inode) (struct inode *, int);
void (*put_inode) (struct inode *);
void (*delete_inode) (struct inode *);
void (*put_super) (struct super_block *);
void (*write_super) (struct super_block *);
int (*statfs) (struct super_block *, struct statfs *);
int (*remount_fs) (struct super_block *, int *, char *);
void (*clear_inode) (struct inode *);
void (*umount_begin) (struct super_block *);
};
</PRE>
<HR>
</CODE></BLOCKQUOTE>
</P>
<P>
<OL>
<LI><B>read_inode</B>: inode$B$r%U%!%$%k%7%9%F%`$+$iFI$_9~$`!#(B<CODE>iget4()</CODE>($B$7$?$,$C$F!"(B<CODE>iget()</CODE>)$B$rDL$7$F!"(B<CODE>fs/inode.c:get_new_inode()</CODE> $B$+$i$N$_8F$P$l$k!#$b$7%U%!%$%k%7%9%F%`$,(B<CODE>iget()</CODE>$B$r;H$$$?$$$J$i$P!"(B<CODE>read_inode()</CODE>$B$O<BAu$5$l$J$$$H$$$1$J$$!#$=$&$G$J$1$l$P!"(B<CODE>get_new_inode()</CODE>$B$O%Q%K%C%/$K$J$k!#(B
inode$B$,FI$^$l$F$$$k4V$O%m%C%/$5$l$k(B(<CODE>inode->i_state = I_LOCK</CODE>)$B!#4X?t$+$iI|5"$9$k$H$-!"A4$F$N(B<CODE>inode->i_wait</CODE>$B$NBT$A$O5/$3$5$l$k!#%U%!%$%k%7%9%F%`$N(B<CODE>read_inode()</CODE>$B%a%=%C%I$N;E;v$O!"FI$_9~$^$l$k(B inode $B$+$i$J$k%G%#%9%/%V%m%C%/$r3d$jEv$F!"%P%C%U%!!<%-%c%C%7%e(B <CODE>bread()</CODE>$B4X?t$r;H$C$FFI$_9~$_!$(Binode $B9=B$BN$NMM!9$J%U%#!<%k%I$,=i4|2=$5$l$k!%(B
$BNc$($P(B<CODE>inode->i_op</CODE> $B$H(B<CODE>inode->i_fop</CODE> $B$G$O!"(BVFS$B%l%Y%k$,!"(Binode $B$d4XO"$9$k%U%!%$%k$G$J$s$NA`:n$,9T$o$l$k$+$rCN$C$F$$$k(B
<CODE>read_inode()</CODE>$B$r<BAu$7$J$$%U%!%$%k%7%9%F%`$O!"(Bramfs$B$H(Bpipefs$B$G$"$k!#$?$H$($P!"(Bramfs$B$O!"I,MW$K$J$C$?$H$-$KA4$F$N(Binode $B$NA`:n$,8F$V!"<+?H$N(Binode$B@8@.4X?t(B<CODE>ramfs_get_inode()</CODE>$B$r;}$C$F$$$k!#(B
</LI>
<LI><B>write_inode</B>: inode $B$r%G%#%9%/$K=q$-La$9!#(B<CODE>read_inode()</CODE>$B$H;w$F!"%G%#%9%/$KF1MM$J%V%m%C%/$r3d$jEv$F!"(B<CODE>mark_buffer_dirty(bh)</CODE>$B$r8F$V$3$H$G!"%P%C%U%!%-%c%C%7%e$H:nMQ$9$k!#$3$N%a%=%C%I$O!"(Binode$B$,!"$=$l$>$l$d%U%!%$%k%7%9%F%`A4BN$NF14|$N0lIt$J$j$GF14|$5$l$kI,MW$,$"$k$H$-!"(Bdirty $B$J(B inode (<CODE>mark_inode_dirty()</CODE>$B$K$h$C$F(B dirty $B$H0u$r$D$1$i$l$F$$$k(B)$B$KBP$7$F8F$P$l$k!#(B
</LI>
<LI><B>put_inode</B>: $B%j%U%!%l%s%9%+%&%s%?$,8:>/$5$;$i$l$k$H$-$K$$$D$b8F$P$l$k!#(B
</LI>
<LI><B>delete_inode</B>: <CODE>inode->i_count</CODE>$B$H(B<CODE>inode->i_nlink</CODE>$B$,(B0$B$K$J$k$H$-$O>o$K8F$P$l$k!#%U%!%$%k%7%9%F%`$O!"%*%s%G%#%9%/$N(Binode$B$N%3%T!<$r:o=|$7!"(BVFS$B$G(B<CODE>clear_inode()</CODE>$B$r8F$S=P$7$F!"!V40A4$K:,@d$9$k!W!#(B
-->
</LI>
<LI><B>put_super</B>: <B>umount(2)</B>$B%7%9%F%`%3!<%k$N:G=*CJ3,$G8F$P$l!"%U%!%$%k%7%9%F%`$KBP$7$F!"$3$N%$%s%9%?%s%9$K$D$$$F%U%!%$%k%7%9%F%`$,J];}$7$F$$$k$$$+$J$kFbIt$N>pJs$r2rJ|$7$J$1$l$P$J$i$J$$$3$H$rDLCN$9$k!#E57?E*$K$O$3$l$O!"%9!<%Q!<%V%m%C%/$,$"$k%V%m%C%/$r(B<CODE>brelse()</CODE>$B$7!"%U%j!<%V%m%C%/$d(Binode$B$J$I$N$?$a$K3d$jEv$F$i$l$?%S%C%H%^%C%W$rA4$F(B<CODE>kfree()</CODE>$B$9$k!#(B
</LI>
<LI><B>write_super</B>: $B%9!<%Q!<%V%m%C%/$r%G%#%9%/$K=q$-La$9I,MW$,$"$k$H$-$K8F$P$l$k!#$3$l$O!"%9!<%Q%V%m%C%/(B($BDL>o(B<CODE>sb-private</CODE>$BNN0h$K$"$k(B)$B$H(B<CODE>mark_buffer_dirty(bh)</CODE>$B$,$"$k%V%m%C%/$r8+$D$1$J$1$l$P$J$i$J$$!#$3$l$O$^$?!"(B<CODE>sb->s_dirt</CODE>$B%U%i%0$r%/%j%"$9$k!#(B
</LI>
<LI><B>statfs</B>: <B>fstatfs(2)/statfs(2)</B>$B%7%9%F%`%3!<%k$N<BAu!#0z?t$H$7$FEO$5$l$k(B<CODE>struct stats</CODE>$B$X$N%]%$%s%?$O!"%f!<%6%]%$%s%?$G$O$J$/%+!<%M%k%]%$%s%?$G$"$k$?$a!"%f!<%66u4V$X$N(BI/O$B$,ITI,MW$G$"$k$3$H$KCm0U$9$k$3$H!#$b$7<BAu$5$l$F$$$J$1$l$P!"(B<CODE>statfs(2)</CODE>$B$O(B<CODE>ENOSYS</CODE>$B$G<:GT$9$k!#(B
</LI>
<LI><B>remount_fs</B>: $B%U%!%$%k%7%9%F%`$r:F%^%&%s%H$9$k$H$-$K$OI,$:8F$P$l$k!#(B
</LI>
<LI><B>clear_inode</B>: VFS$B%l%Y%k(B<CODE>clear_inode()</CODE>$B$+$i8F$P$l$k!#%W%i%$%Y!<%H%G!<%?$r(Binode$B9=B$BN$X(B(<CODE>generic_ip</CODE>$B%a%s%P$r7PM3$7$F(B)$B3d$jEv$F$k%U%!%$%k%7%9%F%`$O!"$3$3$G2rJ|$5$l$J$1$l$P$J$i$J$$!#(B
</LI>
<LI><B>umount_begin</B>: $B$J$K$b%U%!%$%k%7%9%F%`$r%S%8!<$K$7$J$$$3$H$r3N$+$a$k$N$KA4NO$r?T$/$9$3$H$,$G$-$k$h$&$K!"$"$i$+$8$a%U%!%$%k%7%9%F%`$XDLCN$9$k$?$a!"(Bumount$B$r6/@)$9$k4V$K8F$P$l$k!#8=:_!"(BNFS$B$G$N$_;H$o$l$k!#$3$l$O!"0lHLE*$J(BVFS$B%l%Y%k$N6/@)(Bumount$B%5%]!<%H$H$N4X78$O$J$$!#(B</LI>
</OL>
</P>
<P>$B$=$l$G$O!"(Bon-disk (<CODE>FS_REQUIRES_DEV</CODE>)$B%U%!%$%k%7%9%F%`$r%^%&%s%H$9$k$H$-$K5/$k$3$H$r8+$F$$$-$^$7$g$&!#(B
<B>mount(2)</B>$B%7%9%F%`%3!<%k$N<BAu$O!"(B<CODE>fs/super.c:sys_mount()</CODE> $B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%9%F%`$N(B<CODE>read_super()</CODE>$B%a%=%C%I$HO"7H$7$F%9!<%Q!<%V%m%C%/$rKd$a$k(B<CODE>get_sb_bdev()</CODE>$B$r8F$V$3$H$G!"%9!<%Q!<%V%m%C%/$,=i4|2=$5$l$k!#A4$F$,$&$^$/9T$1$P!"(B<CODE>super_block</CODE>$B9=B$BN$O=i4|2=$5$l!"%U%!%$%k%7%9%F%`%b%8%e!<%k$X$N(Bextra$B;2>H$H!"2<$K$"$k%V%m%C%/%G%P%$%9$X$N;2>H$rF@$k$3$H$K$J$k!#(B
</LI>
<LI> $B?7$7$$(B<CODE>vfsmount</CODE>$B9=B$BN$,3d$jEv$F$i$l!"(B<CODE>sb->s_mounts</CODE>$B%j%9%H$H%0%m!<%P%k$J(B<CODE>vfsmntlist</CODE>$B%j%9%H$X%j%s%/$5$l$k!#(B<CODE>vfsmount</CODE>$B$N%a%s%P$N(B<CODE>mnt_instances</CODE>$B$OA4$F$NF1$8%9!<%Q!<%V%m%C%/$K%^%&%s%H$5$l$F$$$k%$%s%9%?%s%9$r8+$D$1$i$l$k$h$&$K$9$k!#(B
<CODE>mnt_list</CODE>$B%a%s%P$O!"%7%9%F%`A4BN$NA4$F$N%9!<%Q!<%V%m%C%/$KBP$7$F!"A4$F$N%$%s%9%?%s%9$r8+$D$1$k$3$H$,$G$-$k$h$&$K$9$k!#(B<CODE>mnt_sb</CODE>$B%a%s%P$O$3$N%9!<%Q!<%V%m%C%/$r;X$7!"(B<CODE>mnt_root</CODE>$B$O(B<CODE>sb->s_root</CODE> dentry $B$X$N?7$7$$;2>H$r;}$D!#(B</LI>
</OL>
</P>
<H2><A NAME="ss3.6">3.6</A> <A HREF="Linux-Kernel-Internals.html#toc3.6">$B2>A[%U%!%$%k%7%9%F%`$NNc(B: pipefs</A>
</H2>
<P>$B%^%&%s%H$K%V%m%C%/%G%P%$%9$,I,MW$J$$4JC1$J(B Linux $B%U%!%$%k%7%9%F%`$NNc$H$7$F!"(B<CODE>fs/pipe.c</CODE>$B$+$i(Bpipefs$B$r<h$j>e$2$^$7$g$&!#%U%!%$%k%7%9%F%`$NA0DsItJ,$O$+$J$j4JC1$G!"$A$g$C$H$7$?@bL@$G==J,$G$9!#(B</P>
<P>
<BLOCKQUOTE><CODE>
<HR>
<PRE>
static DECLARE_FSTYPE(pipe_fs_type, "pipefs", pipefs_read_super,
FS_NOMOUNT|FS_SINGLE);
static int __init init_pipe_fs(void)
{
int err = register_filesystem(&pipe_fs_type);
if (!err) {
pipe_mnt = kern_mount(&pipe_fs_type);
err = PTR_ERR(pipe_mnt);
if (!IS_ERR(pipe_mnt))
err = 0;
}
return err;
}
static void __exit exit_pipe_fs(void)
{
unregister_filesystem(&pipe_fs_type);
kern_umount(pipe_mnt);
}
module_init(init_pipe_fs)
module_exit(exit_pipe_fs)
</PRE>
<HR>
</CODE></BLOCKQUOTE>
</P>
<P>$B$3$N%U%!%$%k%7%9%F%`$O!"%f!<%66u4V$+$i%^%&%s%H$G$-$:!"%7%9%F%`A4BN$G0l$D$N%9!<%Q!<%V%m%C%/$N$_;}$F$k$3$H$r0UL#$9$k(B<CODE>FS_NOMOUNT|FS_SINGLE</CODE>$B7?$K$J$C$F$$$^$9!#(B
<CODE>FS_SINGLE</CODE>$B$G$"$k%U%!%$%k$OF1MM$K!"(B<CODE>register_filesystem()</CODE>$B$r;H$C$FEPO?@.8y$7$?$"$H$K!"(B<CODE>kern_mount()</CODE>$B$r;H$C$F%^%&%s%H$5$l$J$1$l$P$J$i$J$$$3$H$r0UL#$7$F$$$^$9!#$3$l$O!"$^$5$K!"(B<CODE>init_pipe_fs()</CODE>$B$G9T$o$l$k$3$H$G$9!#$3$N4X?t$NM#0l$N%P%0$O!"$b$7(B<CODE>kern_mount()</CODE>$B$,<:GT$7$?>l9g(B($BNc$($P!"(B<CODE>kmalloc()</CODE>$B$,(B<CODE>add_vfsmnt()</CODE>$BCf$G<:GT$7$?$H$-$J$I(B)$B$K!"%U%!%$%k%7%9%F%`$OEPO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J%*%Z%l!<%F%#%s%0%7%9%F%`$H$J$j!"D9$$4|4V:F%3%s%Q%$%k$r$7$J$$$GB?$/$N%"%W%j%1!<%7%g%s$,;H$($k$h$&$K$9$k$N$G$9!#(B</P>
<P><CODE>kern_mount()</CODE>$B$N7k2L$O<!$N$h$&$K$J$j$^$9!#(B</P>
<P>
<OL>
<LI>$B?7$?$JL5L>$N(B(anonymous)$B%G%P%$%9HV9f$,3d$jEv$F$i$l!"(B<CODE>unnamed_dev_in_use</CODE>$B%S%C%H%^%C%W$N%S%C%H$,@_Dj$5$l$k!#$b$73d$jEv$F$k%S%C%H$,$J$1$l$P!"(B<CODE>kern_mount()</CODE>$B$O(B<CODE>EMFILE</CODE>$B$G<:GT$9$k!#(B
</LI>
<LI><CODE>get_empty_super()</CODE>$B$K$h$C$F!"?7$?$J%9!<%Q!<%V%m%C%/9=B$BN$,3d$jEv$F$i$l$k!#(B<CODE>get_empty_super()</CODE>$B4X?t$O!"(B<CODE>super_block</CODE>$B$K$h$C$F@hF,$r<($5$l$k%9!<%Q!<%V%m%C%/$N%j%9%H$r8+$F!"(B<CODE>s->s_dev == 0</CODE>$B$H$J$k6u$N%(%s%H%j!<$rC5$9!#(B
</LI>
<LI> $B%U%!%$%k%7%9%F%`FCM-$N(B<CODE>pipe_fs_type->read_super()</CODE>$B%a%=%C%I(B($B$D$^$j(B<CODE>pipefs_read_super()</CODE>$B$@$,(B)$B$,5/F0$5$l!"%k!<%H$N(Binode$B$H%k!<%H$N(Bdentry$B$H$J$k(B <CODE>sb->s_root</CODE>$B$r3d$jEv$F!"(B<CODE>sb->s_op</CODE>$B$r(B<CODE>&pipefs_ops</CODE>$B$K$J$k$h$&@_Dj$9$k!#(B
</LI>
<LI>$B$=$7$F(B <CODE>kern_mount()</CODE> $B$,(B $B?7$7$$(B<CODE>vfsmount</CODE>$B9=B$BN$r3d$jEv$F!"(B<CODE>vfsmntlist</CODE>$B$H(B<CODE>sb->s_mounts</CODE> $B$X%j%s%/$9$k(B<CODE>add_vfsmnt(NULL, sb->s_root, "none")</CODE> $B$r8F$V!#(B
</LI>
<LI><CODE>pipe_fs_type->kern_mnt</CODE>$B$O?7$7$$(B<CODE>vfsmount</CODE>$B9=B$BN$K@_Dj$5$l$FLa$k!#(B<CODE>kern_mount()</CODE>$BJV$jCM$,(B<CODE>vfsmount</CODE>$B9=B$BN$K$J$C$F$$$k$N$O!"(B<CODE>FS_SINGLE</CODE>$B$N%U%!%$%k%7%9%F%`$G$5$(J#?t2s%^%&%s%H$G$-$k$3$H$+$i!"(B<CODE>mnt->mnt_sb</CODE>$B$O(B<CODE>kern_mount()</CODE>$B$NJ#?t2s$N8F$S=P$7$+$i$NLa$j$G$"$C$?$H$7$F$bF1$8$b$N$r;X$7$FLa$k$?$a$G$"$k!#(B</LI>
</OL>
</P>
<P>$B$3$l$G%U%!%$%k%7%9%F%`$OEPO?$5$l!";d$?$A$,;H$($k$h$&$K%+!<%M%kFb$K%^%&%s%H$5$l$^$7$?!#(Bpipefs$B%U%!%$%k%7%9%F%`$N%(%s%H%j%]%$%s%H$O!"(B<B>pipe(2)</B>$B%7%9%F%`%3!<%k$H$J$j!"$3$l$O%"!<%-%F%/%A%c0MB8$N(B<CODE>sys_pipe()</CODE>$B$X<BAu$5$l$F$$$^$9$,!"<B:]$K$O%"!<%-%F%/%A%cHs0MB8$N(B<CODE>fs/pipe.c:do_pipe()</CODE>$B4X?t$G=hM}$5$l$^$9!#$3$l$+$i(B<CODE>do_pipe()</CODE>$B$r8+$F$$$3$&$H;W$$$^$9!#(Bpipefs $B$H$NAj8_:nMQ$O!"(B<CODE>do_pipe()</CODE>$B$,(B<CODE>get_pipe_inode()</CODE>$B$r?7$7$$(B pipefs $B$N(B inode $B$r3d$jEv$F$k$?$a$K8F$S=P$7$?$H$-$K5/$3$j$^$9!#$3$N(B inode $B$N$?$a$K!"(B<CODE>inode->i_sb</CODE>$B$O!"(Bpipefs $B$N%9!<%Q!<%V%m%C%/(B<CODE>pipe_mnt->mnt_sb</CODE>$B$X@_Dj$5$l$^$9!#$=$7$F%U%!%$%k$NA`:n(B<CODE>i_fop</CODE>$B$O(B<CODE>rdwr_pipe_fops</CODE>$B$K@_Dj$5$l$F!"(B(<CODE>inode->i_pipe</CODE>$B$KJ];}$5$l$k(B)$BFI$_=q$-$9$k<T$N?t$O(B 1 $B$K@_Dj$5$l$^$9!#(B<CODE>fs-private</CODE> $B6&MQBN$XJ]B8$9$kBe$j$K!"JL$N(B inode $B%a%s%P(B <CODE>i_pipe</CODE> $B$,$"$kM}M3$O!"(Bpipe $B$H(B FIFO $B$,F1$8%3!<%I$r6&M-$7$F$$$k$?$a$H!"F1$86&MQBN$NCf$NB>$N%"%/%;%9%Q%9$r;H$&J#?t$N(B FIFO $B$,B>$N%U%!%$%k%7%9%F%`>e$KB8:_$G$-$k$h$&$K$"$&$k$?$a$G$9!#$3$l$O$H$F$b0-$$(B C $B$N;H$$J}$G$"$j!"=c?h$K1?$@$1$GF0$-$^$9!#$=$N$?$a!"$=$&!"(B2.2.x $B%+!<%M%k$O!"1?$@$1$GF0$$$F$$$k$N$G$9!#(Binode $B$N%U%#!<%k%I$r$9$3$7D4@0$9$l$P$9$0$K=hM}$rDd;_$7$F$7$^$&$3$H$K$J$k$G$7$g$&!#(B</P>
<P><B>pipe(2)</B>$B%7%9%F%`%3!<%kKh$K!"(B<CODE>pipe_mnt</CODE>$B%^%&%s%H%$%s%9%?%s%9$N;2>H%+%&%s%?$OA}J,$5$l$^$9!#(B</P>
<P>Linux $B$K$*$$$F$O(B $B%Q%$%W$OBP>N!JAPJ}8~$"$k$$$O(BSTREAM pipe)$B$G$O$J$/!"$D$^$j%U%!%$%k$NN>B&$G!"(B<CODE>read_pipe_fops</CODE>$B$H(B<CODE>write_pipe_fops</CODE>$B$=$l$>$l$N(B <CODE>file->f_op</CODE> $BA`:n$O;}$F$^$;$s!#(B</P>
<H2><A NAME="ss3.7">3.7</A> <A HREF="Linux-Kernel-Internals.html#toc3.7">$B%G%#%9%/%U%!%$%k%7%9%F%`$NNc(B:BFS</A>
</H2>
<P>$B4JC1$J%G%#%9%/>e$N(B Linux $B%U%!%$%k%7%9%F%`$NNc$H$7$F(BBFS$B$r9M$($F$_$^$7$g$&!#(BBFS$B%b%8%e!<%k$N%W%j%"%s%V%k$O(B<CODE>fs/bfs/inode.c</CODE>$B$K$"$j!"(B</P>
<P>
<BLOCKQUOTE><CODE>
<HR>
<PRE>
static DECLARE_FSTYPE_DEV(bfs_fs_type, "bfs", bfs_read_super);
static int __init init_bfs_fs(void)
{
return register_filesystem(&bfs_fs_type);
}
static void __exit exit_bfs_fs(void)
{
unregister_filesystem(&bfs_fs_type);
}
module_init(init_bfs_fs)
module_exit(exit_bfs_fs)
</PRE>
<HR>
</CODE></BLOCKQUOTE>
$B$H$J$C$F$$$^$9!#(B</P>
<P>$BFCJL$J(Bfstype $BDj5A%^%/%m(B<CODE>DECLARE_FSTYPE_DEV()</CODE>$B$,;H$o$l$F!"(B<CODE>fs_type->flags</CODE>$B$r(B <CODE>FS_REQUIRES_DEV</CODE>$B$K@_Dj$5$l!"(BBFS $B$,%^%&%s%H$9$k<B:]$N%V%m%C%/%G%P%$%9$,I,MW$G$"$k$3$H$r<($7$F$$$^$9!#(B</P>
<P>$B%b%8%e!<%k$N=i4|2=4X?t$O%U%!%$%k%7%9%F%`$H(B(BFS$B$,%b%8%e!<%k$H$7$F@_Dj$5$l$?$H$-$N$_B8:_$9$k(B)$BEPO?2r=|$r9T$&2r=|4X?t$r(BVFS$B$KEPO?$7$^$9!#(B</P>
<P>$B%U%!%$%k%7%9%F%`$NEPO?$r9T$&$3$H$G!"%^%&%s%H$r?J$a$k$3$H$,$G$-$^$9!#%^%&%s%H$G$O(B<CODE>fs/bfs/inode.c:bfs_read_super()</CODE> $B$K<BAu$5$l$F$$$k(B <CODE>fs_type->read_super()</CODE>$B%a%=%C%I$,5/F0$5$l$^$9!#$3$N4X?t$O<!$N$h$&$J=hM}$r9T$$$^$9!#(B</P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B inode $B$r;}$C$F$k$Y$-$b$N$@$+$i$@!#(B
</LI>
<LI> $B$=$7$F(B<CODE>s->s_op</CODE>$B$r=i4|2=$9$k!#$3$l$O(B<CODE>s_op->read_inode()</CODE>$B$,5/F0$5$l$k7k2L$H$7$F(B<CODE>iget()</CODE>$B$rDL$8$F!"$3$N;~E@$+$i(B inode $B%-%c%C%7%e$r8F$S=P$9$3$H$,$G$-$k!#$3$l$O!"(B(<CODE>inode->i_ino</CODE>$B$H(B<CODE>inode->i_dev</CODE>$B$K$h$k(B)$BFCDj$N(Binode $B$+$i$J$k%V%m%C%/$r8+$D$1$FFI$_9~$`!#(B
$B$b$7%k!<%H(B inode $B$N<hF@$,<:GT$7$?$i!"(Binode $B%S%C%H%^%C%W$r2rJ|$7!"%P%C%U%!!<%-%c%C%7%e$NGX8e$K$"$k%9!<%Q!<%V%m%C%/%P%C%U%!!<$r2rJ|$7$F!"(BNULL $B$rJV$9!#$b$7%k!<%H(B inode $B$NFI$_9~$_$,(BOK$B$G$"$l$P!"(B($B%k!<%H$H$J$k(B)<CODE>/</CODE>$B$H$$$&L>A0$N(Bdentry$B$r3d$jEv$F!"$3$N(B inode $B$r<BBN2=$9$k!#(B
</LI>
<LI>$B$5$F!"%U%!%$%k%7%9%F%`$NA4$F$N(B inode $B$r8+$F!"FbIt$N(B inode $B%S%C%H%^%C%W$N4XO"$9$k%S%C%H$r@_Dj$9$k$?$a$K!"$=$l$rA4$FFI$_9~$`!#$=$7$F!":G8e$N(B inode $B$N%*%U%;%C%H$d:G8e$N%U%!%$%k$N3+;O(B/$B=*N;%V%m%C%/$N$h$&$J$=$NB>$NFbIt%Q%i%a!<%?$r7W;;$9$k!#FI$_9~$`3F(B inode $B$O(B inode $B%-%c%C%7%e$X(B <CODE>iput()</CODE>$B$rDL$8$FLa$5$l$k!#$=$&!"I,MW0J>e$KD9$/;2>H$rJ];}$G$-$J$$$N$@!#(B
</LI>
<LI>$B$b$7%U%!%$%k%7%9%F%`$,FI$_9~$_@lMQ$G%^%&%s%H$5$l$J$1$l$P!"%9!<%Q!<%V%m%C%/%P%C%U%!$r(Bdirty$B$H0u$r$D$1!"(B<CODE>s->s_dirt</CODE>$B%U%i%0$r@_Dj$9$k(B(TODO: $B$J$<$3$l$r$d$k$N$+(B? $BIaDL$O!"$3$l$O(B<CODE>minix_read_super()</CODE>$B$,$d$k$+$i$J$N$@$,!"(Bminix$B$b(BBFS $B$b(B<CODE>read_super()</CODE>$B$G%9!<%Q!<%V%m%C%/$r=q$-49$($F$$$J$$$h$&$J$N$@(B)$B!#(B
</LI>
<LI>$BA4$F$,$&$^$/9T$1$P!"(BVFS$BAX$N8F$S=P$7!"$D$^$j(B<CODE>fs/super.c:read_super()</CODE>$B$X!"$3$N=i4|2=$5$l$?%9!<%Q!<%V%m%C%/$rJV$9!#(B</LI>
</OL>
</P>
<P><CODE>read_super()</CODE>$B4X?t$,@.8y$7$FLa$C$?8e!"(B<CODE>fs/super.c:get_sb_bdev()</CODE>$B$N(B<CODE>get_filesystem(fs_type)</CODE>$B8F$S=P$7$rDL$8$F(B VFS $B$O%U%!%$%k%7%9%F%`%b%8%e!<%k$X$N;2>H$H%V%m%C%/%G%P%$%9$X$N;2>H$rF@$^$9!#(B</P>
<P>$B$3$3$G!"%U%!%$%k%7%9%F%`$X(B I/O $B$r9T$&$H$-$K$J$K$,5/$k$+$r9M$($F$_$^$7$g$&!#$9$G$K(B <CODE>iget()</CODE>$B$,8F$P$l$k$H$-$K(Binode$B$,$I$N$h$&$KFI$^$l$k$+!"$^$?(B<CODE>iput()</CODE>$B$G$I$N$h$&$K2rJ|$5$l$k$+$O8+$F$-$^$7$?!#(B
inode $B$NFI$_9~$_$O!"B>$N$3$H$K:.$8$C$F(B<CODE>inode->i_op</CODE>$B$H(B<CODE>inode->i_fop</CODE>$B$N;vA0@_Dj$r9T$&$3$H$K$J$j$^$9!#%U%!%$%k$N%*!<%W%s$O!"(B<CODE>inode->i_fop</CODE>$B$+$i(B<CODE>file->f_op</CODE>$B$XEAHB$7$^$9!#(B</P>
<P>$B$5$F!"(B<B>link(2)</B>$B%7%9%F%`%3!<%k$N%3!<%I$NDL$jF;$r$_$F$$$-$^$7$g$&!#%7%9%F%`%3!<%k$N<BAu$O(B<CODE>fs/namei.c:sys_link()</CODE>$B$K$"$j$^$9!#(B</P>
<P>
<OL>
<LI> $B%f!<%66u4V$NL>A0$O%+!<%M%k6u4V$X%(%i!<%A%'%C%/$r9T$&(B<CODE>getname()</CODE>$B4X?t$r;H$C$F%3%T!<$5$l$k!#(B
</LI>
<LI> $B$3$l$i$NL>A0$O(B<CODE>path_init()/path_walk()</CODE>$B$r;H$C$F(B nameidata $B$KJQ49$5$l!"(Bdcache $B$HAj8_:nMQ$9$k!#7k2L$O(B <CODE>old_nd</CODE> $B$H(B<CODE>nd</CODE>$B9=B$BN$X3JG<$5$l$k!#(B
</LI>
<LI> <CODE>old_nd.mnt != nd.mnt</CODE>$B$G$"$C$?$i!"!V%/%m%9%G%P%$%9%j%s%/!W(B<CODE>EXDEV</CODE>$B$,JV$5$l$k!#%U%!%$%k%7%9%F%`$rD6$($?%j%s%/$O$G$-$J$$$,!"(BLinux $B$G$O$=$l$r%U%!%$%k%7%9%F%`$N%^%&%s%H$5$l$?%$%s%9%?%s%9(B($B$"$k$$$OFCDj$N%U%!%$%k%7%9%F%`4V(B)$B$rD6$($?%j%s%/$,$G$-$J$$$H2r<a$7$F$$$k!#(B
</LI>
<LI> $B?7$7$$(B dentry $B$,:n$i$l(B<CODE>nd</CODE>$B$X(B<CODE>lookup_create()</CODE>$B$K$h$C$F4XO"$E$1$i$l$k!#(B
</LI>
<LI> $B0lHLE*$J(B<CODE>vfs_link()</CODE>$B4X?t$,8F$P$l!"%G%#%l%/%H%j$K?7$7$$%(%s%H%j!<$r:n$k$3$H$,$G$-$k$+$I$&$+%A%'%C%/$9$k!#$=$7$F!"(B<CODE>dir->i_op->link()</CODE>$B%a%=%C%I$r8F$S=P$9!#$3$l$O%U%!%$%k%7%9%F%`$KFCM-$N(B<CODE>fs/bfs/dir.c:bfs_link()</CODE>$B4X?t$r8F$S=P$9$3$H$K$J$k!#(B
</LI>
<LI><CODE>bfs_link()</CODE>$B$NFbIt$G$O!"%G%#%l%/%H%j$r%j%s%/$7$h$&$H$7$F$$$J$$$+%A%'%C%/$7!"$b$7$=$&$G$"$l$P(B<CODE>EPERM</CODE>$B%(%i!<$G5qH]$9$k!#$3$l$OI8=`%U%!%$%k%7%9%F%`(B(ext2)$B$rF1$85sF0$G$"$k!#(B
</LI>
<LI>$B$X%k%Q!<4X?t(B<CODE>bfs_add_entry()</CODE>$B$r8F$S=P$7$F?7$7$$%G%#%l%/%H%j%(%s%H%j$rFCDj$N%G%#%l%/%H%j$KDI2C$7$h$&$H$9$k!#$3$N4X?t$O!";HMQ$7$F$$$J$$%9%m%C%H(B(<CODE>de->ino == 0</CODE>)$B$rC5$7$FA4$F$N%(%s%H%j!<$r8+$F$$$-!"8+$D$+$C$?$J$i$P!"(B name/inode $B$NBP$r4XO"$9$k%V%m%C%/$X=q$-=P$7$F!"(B dirty$B$N0u$r(B($B%9!<%Q%V%m%C%/0J30$NM%@hEY$G(B)$B$D$1$k!#(B
</LI>
<LI> $B$b$7!"%G%#%l%/%H%j%(%s%H%j$NDI2C$,@.8y$7$?$i!"A`:n$,<:GT$9$k$3$H$O$J$$$?$a!"(B<CODE>inode->i_nlink</CODE>$B$rA}J,$7!"(B<CODE>inode->i_ctime</CODE>$B$r99?7$7$F!"(Binode $B$H0l=o$K%$%s%9%?%s%92=$7$??7$7$$(Bdentry$B$HF1MM$K!"$3$N(B inode $B$r(B dirty $B$H%^!<%/$9$k!#(B</LI>
</OL>
</P>
<P><CODE>unlink()/rename()</CODE>$B$N$h$&$JB>$N4XO"(B inode $BA`:n$b!"F1$8$h$&$J$d$jJ}$GF/$-$^$9!#$7$?$,$C$F!"$"$^$j%a%j%C%H$,$J$$$?$a!"$3$3$GA4$F$N>\:Y$r07$&$3$H$O$7$^$;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(B</P>
<P>$B<B9T%I%a%$%s$O(B<CODE>kernel/exec_domain.c</CODE>$B$K<BAu$5$l!"(B2.4 $B%+!<%M%k$G(B 2.2.x $B$+$i40A4$K=q$-D>$5$l$^$7$?!#%5%]!<%H$7$F$$$k%Q!<%=%J%j%F%#$N<oN`$K2C$(!"%+!<%M%k$,8=:_%5%]!<%H$7$F$$$k<B9T%I%a%$%s$N%j%9%H$O!"(B<CODE>/proc/execdomains</CODE>$B%U%!%$%k$rFI$_=P$9$3$H$GF@$k$3$H$,$G$-$^$9!#(B<CODE>PER_LINUX</CODE> $B$r=|$/<B9T%I%a%$%s$O!"F0E*$KFI$_9~$^$l$k%b%8%e!<%k$H$7$F<BAu$G$-$^$9!#(B</P>
<P>$B%f!<%6%$%s%?!<%U%'!<%9$O!"(B<B>personality(2)</B>$B%7%9%F%`%3!<%k$rDL$8$F!"8=:_$N%W%m%;%9$N%Q!<%=%J%j%F%#$r@_Dj$G$-$k$h$&$K$J$C$F$$$^$9!#$"$k$$$O!"$b$70z?t$,B8:_$7$J$$%Q!<%=%J%j%F%#(B 0xffffffff $B$G$"$C$?$i(B<CODE>current->personality</CODE>$B$r$?$@JV$7$^$9!#L@$i$+$K$3$N%7%9%F%`%3!<%k$N?6$kIq$$$O!"%Q!<%=%J%j%F%#$H$OFHN)$G$9!#(B</P>
<P>$B<B9T%I%a%$%sEPO?$N%+!<%M%k%$%s%?!<%U%'!<%9$O(B2$B$D$N4X?t$K$J$C$F$$$^$9!#(B</P>
<P>
<UL>
<LI><CODE>int register_exec_domain(struct exec_domain *)</CODE>: $BFI$_=q$-%9%T%s%m%C%/(B<CODE>exec_domain_lock</CODE>$B$K$h$k=q$-9~$_J]8n$N$b$H!"C1%j%s%/%j%9%H$N(B<CODE>exec_domains</CODE>$B$X<B9T%I%a%$%s$r%j%s%/$9$k$3$H$G!"EPO?$9$k!#@.8y$9$l$P(B0$B$rJV$7!"<:GT$J$iHs(B0$B$H$J$k!#(B
</LI>
<LI><CODE>int unregister_exec_domain(struct exec_domain *)</CODE>: <CODE>exec_domians</CODE>$B%j%9%H$+$i$O$:$9$3$H$K$h$j<B9T%I%a%$%s$rEPO?2r=|$9$k!#EPO?$HF1MM!"(B<CODE>exec_domian_lock</CODE>$B%9%T%s%m%C%/$r=q$-9~$_%b!<%I$GMxMQ$9$k!#@.8y$9$l$P(B0$B$rJV$9!#(B</LI>
</UL>
</P>
<P><CODE>exec_domains_lock</CODE>$B$,FI$_=q$-%m%C%/$G$"$kM}M3$O!"EPO?$HEPO?2r=|MW5a$N$_$,%j%9%H$r=q$-49$(!"(B<B>cat /proc/filesystems</B>$B$,(B<CODE>fs/exec_domain.c:get_exec_domain_list()</CODE>$B$r8F$V$3$H$@$1$,!"%j%9%H$NFI$_=P$7$r9T$&$?$a$G$9!#?7$7$$<B9T%I%a%$%s$NEPO?$K$h$j!"!V(Blcall7 $B%O%s%I%i!W$H%7%0%J%kHV9f$NJQ49%^%C%W$rDj5A$5$l$^$9!#<B:]!"(BABI$B%Q%C%A$O!"$3$N<B9T%I%a%$%s$N9M$(J}$r3HD%$7$F!"(B($B%=%1%C%H%*%W%7%g%s$d%=%1%C%H%?%$%W!"%"%I%l%9%U%!%_%j%#$d%(%i!<HV9f%^%C%W$H$$$C$?(B)$BDI2C$N>pJs$r;}$D$h$&$K$7$F$$$^$9!#(B</P>
<P>$B%P%$%J%j%U%)!<%^%C%H$OF1$8$h$&$K<BAu$5$l$F$$$^$9!#$D$^$j!"C1%j%s%/%j%9%H%U%)!<%^%C%H$r(B<CODE>fs/exec.c</CODE>$B$GDj5A$7!"FI$_=q$-%m%C%/$N(B<CODE>binfmt_lock</CODE>$B$GJ]8n$7$^$9!#(B<CODE>exec_domains_lock</CODE>$B$N$h$&$K!"(B<CODE>binfmt_lock</CODE>$B$O!"%P%$%J%j%U%)!<%^%C%H$NEPO?$dEPO?2r=|$N$H$-$r=|$/$[$H$s$I$N>l9g$KFI$_9~$_$N$_$K$J$C$F$$$^$9!#(B
$B?7$7$$%P%$%J%j%U%)!<%^%C%H$rEPO?$9$k$3$H$G!"(B<CODE>core_dump()</CODE>$B$,$G$-$k$N$HF1MM$K!"?7$7$$(B<CODE>load_binary/load_shlib()</CODE>$B4X?t$K$h$C$F!"(B<B>execve(2)</B>$B%7%9%F%`%3!<%k$O5!G=3HD%$5$l$^$9!#(B<CODE>load_binary()</CODE>$B%a%=%C%I$,!"(B<B>execve(2)</B>$B%7%9%F%`%3!<%k$r<BAu$7$F$$$k(B<CODE>do_execve()</CODE>$B$+$i(B<CODE>search_binary_handler()</CODE>$B$K$h$C$F8F$P$l$F$$$k$H$-$K!"(B<CODE>load_shlib()</CODE>$B%a%=%C%I$O8E$$(B<B>uselib(2)</B>$B%7%9%F%`%3!<%k$K$h$C$F$N$_;H$o$^$9!#(B</P>
<P>$B%W%m%;%9$N%Q!<%=%J%j%F%#$O!"<c43$NH/8+E*<jK!$r$D$+$C$FBP1~$9$k%U%)!<%^%C%H$N(B<CODE>load_binary()</CODE>$B%a%=%C%I$+$iFI$_9~$^$l$?%P%$%J%j!<%U%)!<%^%C%H$K$h$C$F7hDj$5$l$^$9!#(B
UnixWare7$B%P%$%J%j$r7hDj$9$kNc$H$7$F$O!"$^$:(B<B>elfmark(1)</B>$B%f!<%F%#%j%F%#$r;H$C$F!"(BELF$B$N$X%C%@!<$N(B<CODE>e_flags</CODE>$B$K!"%^%8%C%/CM(B 0x314B4455$B$K@_Dj$7!"0u$r$D$1$^$9!#(B
$B$3$N%^%8%C%/CM$O!"(BELF$B$N%m!<%I;~$K8!=P$5$l!"(B<CODE>current->personality</CODE>$B$K(BPER_UW7$B$r@_Dj$7$^$9!#(B</P>
<P>$B0lEY%Q!<%=%J%j%F%#(B($B$H!"=>$C$F(B<CODE>current->exzec_domain</CODE>)$B$,J,$+$l$P!"%7%9%F%`%3!<%k$O<!$N$h$&$K<h$j07$$$^$9!#%W%m%;%9$,(B lcall7 $B%2!<%HL?Na$r;H$C$F%7%9%F%`%3!<%k$rH/9T$7$?$H$7$^$7$g$&!#(B
$B$3$l$O@)8f$r(B <CODE>arch/i386/kernel/entry.S</CODE>$B$N(B<CODE>ENTRY(lcall7)</CODE>$B$K0\$7$^$9!#$J$<$J$i$3$l$O!"(B<CODE>arch/i386/kernel/traps.c:trap_init()</CODE>$B$K=`Hw$5$l$F$$$k$?$a$G$9!#(B
$BE,@Z$J%9%?%C%/3d$jEv$F$NJQ49$N$"$H!"(B<CODE>entry.S:lcall7</CODE>$B$O(B<CODE>current</CODE> $B$+$i(B <CODE>exec_domain</CODE> $B$X$N%]%$%s%?$H!"$=$7$F(B($B%"%;%s%V%i$G(B4$B$K%O!<%I%3!<%I$5$l$F$*$j!"(B<CODE>struct exec_domain</CODE>$B$N(BC$B$NDj5A$G!"(B<CODE>handler</CODE>$B%a%s%P$r0\F0$G$-$J$$$N$G$"$k$,(B)<CODE>exec_domain</CODE>$BCf$N(B lcall7 $B%O%s%I%i$N%*%U%;%C%H$rF@$F!"$=$3$X%8%c%s%W$7$^$9!#$=$&$G$9!"(BC$B$G$O!"<!$N$h$&$K$J$j$^$9!#(B</P>
<P>
<BLOCKQUOTE><CODE>
<HR>
<PRE>
static void UW7_lcall7(int segment, struct pt_regs * regs)
{
abi_dispatch(regs, &uw7_funcs[regs->eax & 0xff], 1);
}
</PRE>
<HR>
</CODE></BLOCKQUOTE>
</P>
<P><CODE>abi_dispatch()</CODE>$B$O!"4X?t%]%$%s%?$NI=$X$N%i%C%Q!<$G$"$j!"$=$l$O$3$N%Q!<%=%J%j%F%#$N%7%9%F%`%3!<%k$N(B<CODE>uw7_funcs</CODE>$B$r<BAu$7$?$b$N$K$J$C$F$$$^$9!#(B</P>
<HR>
<A HREF="Linux-Kernel-Internals-4.html">$B<!$N%Z!<%8(B</A>
<A HREF="Linux-Kernel-Internals-2.html">$BA0$N%Z!<%8(B</A>
<A HREF="Linux-Kernel-Internals.html#toc3">$BL\<!$X(B</A>
</BODY>
</HTML>
|