#include "types.h"#include "defs.h"#include "param.h"#include "stat.h"#include "mmu.h"#include "proc.h"#include "spinlock.h"#include "buf.h"#include "fs.h"#include "file.h"Go to the source code of this file.
Defines | |
| #define | min(a, b) ((a) < (b) ? (a) : (b)) |
Functions | |
| static void | itrunc (struct inode *) |
| static void | readsb (int dev, struct superblock *sb) |
| static void | bzero (int dev, int bno) |
| static uint | balloc (uint dev) |
| static void | bfree (int dev, uint b) |
| void | iinit (void) |
| static struct inode * | iget (uint dev, uint inum) |
| struct inode * | ialloc (uint dev, short type) |
| void | iupdate (struct inode *ip) |
| struct inode * | idup (struct inode *ip) |
| void | ilock (struct inode *ip) |
| void | iunlock (struct inode *ip) |
| void | iput (struct inode *ip) |
| void | iunlockput (struct inode *ip) |
| static uint | bmap (struct inode *ip, uint bn) |
| void | stati (struct inode *ip, struct stat *st) |
| int | readi (struct inode *ip, char *dst, uint off, uint n) |
| int | writei (struct inode *ip, char *src, uint off, uint n) |
| int | namecmp (const char *s, const char *t) |
| struct inode * | dirlookup (struct inode *dp, char *name, uint *poff) |
| int | dirlink (struct inode *dp, char *name, uint inum) |
| static char * | skipelem (char *path, char *name) |
| static struct inode * | namex (char *path, int nameiparent, char *name) |
| struct inode * | namei (char *path) |
| struct inode * | nameiparent (char *path, char *name) |
Variables | |
| struct { | |
| struct spinlock lock | |
| struct inode inode [NINODE] | |
| } | icache |
| #define min | ( | a, | |||
| b | ) | ((a) < (b) ? (a) : (b)) |
| static void bfree | ( | int | dev, | |
| uint | b | |||
| ) | [static] |
Definition at line 320 of file fs.c.
References inode::addrs, balloc(), bread(), brelse(), bwrite(), buf::data, inode::dev, NDIRECT, NINDIRECT, and panic().
Referenced by dirlookup(), readi(), and writei().
| static void bzero | ( | int | dev, | |
| int | bno | |||
| ) | [static] |
Definition at line 497 of file fs.c.
References dirlookup(), DIRSIZ, dirent::inum, iput(), dirent::name, panic(), readi(), inode::size, strncpy(), and writei().
Referenced by create(), and sys_link().
Definition at line 465 of file fs.c.
References bmap(), bread(), brelse(), BSIZE, buf::data, inode::dev, iget(), dirent::inum, inode::inum, dirent::name, namecmp(), panic(), inode::size, T_DIR, and inode::type.
Referenced by create(), dirlink(), namex(), and sys_unlink().
Definition at line 192 of file fs.c.
References acquire(), inode::dev, inode::flags, icache, inode::inum, NINODE, panic(), inode::ref, and release().
Referenced by dirlookup(), ialloc(), and namex().
| void iinit | ( | void | ) |
| void ilock | ( | struct inode * | ip | ) |
Definition at line 237 of file fs.c.
References acquire(), dinode::addrs, inode::addrs, bread(), brelse(), buf::data, inode::dev, inode::flags, I_BUSY, I_VALID, IBLOCK, icache, inode::inum, IPB, dinode::major, inode::major, memmove(), dinode::minor, inode::minor, dinode::nlink, inode::nlink, panic(), inode::ref, release(), dinode::size, inode::size, sleep(), dinode::type, and inode::type.
Referenced by consoleread(), consolewrite(), create(), exec(), fileread(), filestat(), filewrite(), namex(), sys_chdir(), sys_link(), sys_open(), and sys_unlink().
| void iput | ( | struct inode * | ip | ) |
Definition at line 282 of file fs.c.
References acquire(), inode::flags, I_BUSY, I_VALID, icache, itrunc(), iupdate(), inode::nlink, panic(), inode::ref, release(), inode::type, and wakeup().
Referenced by dirlink(), exit(), fileclose(), iunlockput(), namex(), sys_chdir(), and sys_link().
| static void itrunc | ( | struct inode * | ip | ) | [static] |
Definition at line 353 of file fs.c.
References inode::addrs, bfree(), bread(), brelse(), buf::data, inode::dev, iupdate(), NDIRECT, NINDIRECT, and inode::size.
Referenced by iput().
| void iunlock | ( | struct inode * | ip | ) |
Definition at line 269 of file fs.c.
References acquire(), inode::flags, I_BUSY, icache, panic(), inode::ref, release(), and wakeup().
Referenced by consoleread(), consolewrite(), fileread(), filestat(), filewrite(), iunlockput(), namex(), sys_chdir(), sys_link(), and sys_open().
| void iunlockput | ( | struct inode * | ip | ) |
Definition at line 304 of file fs.c.
References iput(), and iunlock().
Referenced by create(), exec(), namex(), sys_chdir(), sys_link(), sys_mkdir(), sys_mknod(), sys_open(), and sys_unlink().
| void iupdate | ( | struct inode * | ip | ) |
Definition at line 172 of file fs.c.
References inode::addrs, dinode::addrs, bread(), brelse(), bwrite(), buf::data, inode::dev, IBLOCK, inode::inum, IPB, inode::major, dinode::major, memmove(), inode::minor, dinode::minor, inode::nlink, dinode::nlink, inode::size, dinode::size, inode::type, and dinode::type.
Referenced by create(), iput(), itrunc(), sys_link(), sys_unlink(), and writei().
| int namecmp | ( | const char * | s, | |
| const char * | t | |||
| ) |
Definition at line 456 of file fs.c.
References DIRSIZ, and strncmp().
Referenced by dirlookup(), and sys_unlink().
| struct inode* namei | ( | char * | path | ) | [read] |
Definition at line 603 of file fs.c.
References DIRSIZ, name, and namex().
Referenced by exec(), sys_chdir(), sys_link(), sys_open(), and userinit().
| struct inode* nameiparent | ( | char * | path, | |
| char * | name | |||
| ) | [read] |
Definition at line 610 of file fs.c.
References namex().
Referenced by create(), sys_link(), and sys_unlink().
| static struct inode* namex | ( | char * | path, | |
| int | nameiparent, | |||
| char * | name | |||
| ) | [static, read] |
Definition at line 568 of file fs.c.
References dirlookup(), idup(), iget(), ilock(), iput(), iunlock(), iunlockput(), ROOTDEV, ROOTINO, skipelem(), T_DIR, and inode::type.
Referenced by namei(), and nameiparent().
Definition at line 395 of file fs.c.
References bmap(), bread(), brelse(), BSIZE, buf::data, inode::dev, inode::major, memmove(), min, NDEV, inode::size, T_DEV, and inode::type.
Referenced by dirlink(), exec(), fileread(), and isdirempty().
| static void readsb | ( | int | dev, | |
| struct superblock * | sb | |||
| ) | [static] |
| static char* skipelem | ( | char * | path, | |
| char * | name | |||
| ) | [static] |
Definition at line 384 of file fs.c.
References inode::dev, stat::dev, stat::ino, inode::inum, inode::nlink, stat::nlink, inode::size, stat::size, inode::type, and stat::type.
Referenced by filestat().
Definition at line 422 of file fs.c.
References bmap(), bread(), brelse(), BSIZE, bwrite(), buf::data, inode::dev, iupdate(), inode::major, MAXFILE, memmove(), min, NDEV, inode::size, T_DEV, and inode::type.
Referenced by dirlink(), filewrite(), and sys_unlink().
1.5.6