- Main Page
- Data Structures
- Files
- Directories

- Search for |

- File List
- Globals

# ufs.h File Reference

`#include <ubixos/types.h>`
`#include <vfs/vfs.h>`
`#include <sys/device.h>`

Include dependency graph for ufs.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Data Structures
struct | csum
struct | csum_total
struct | dirent
struct | fs
struct | ufs1_dinode
struct | ufs2_dinode
## Defines
#define | blkoff(fs, loc)
#define | cgbase(fs, c) (((ufs2_daddr_t)(fs)->fs_fpg) * (c))
#define | cgdmin(fs, c) (cgstart(fs, c) + (fs)->fs_dblkno)
#define | cgimin(fs, c) (cgstart(fs, c) + (fs)->fs_iblkno)
#define | cgsblock(fs, c) (cgstart(fs, c) + (fs)->fs_sblkno)
#define | cgstart(fs, c)
#define | cgtod(fs, c) (cgstart(fs, c) + (fs)->fs_cblkno)
#define | dbtofsb(fs, b) ((b) >> (fs)->fs_fsbtodb)
#define | DEV_BSHIFT 9
#define | DEV_BSIZE (1<<DEV_BSHIFT)
#define | DT_DIR 4
#define | DT_REG 8
#define | fragroundup(fs, size)
#define | FS_UFS1_MAGIC 0x011954
#define | FS_UFS2_MAGIC 0x19540119
#define | fsbtodb(fs, b) ((daddr_t)(b) << (fs)->fs_fsbtodb)
#define | FSMAXSNAP 20
#define | ino_to_cg(fs, x) ((x) / (fs)->fs_ipg)
#define | ino_to_fsba(fs, x)
#define | ino_to_fsbo(fs, x) ((x) % INOPB(fs))
#define | lblkno(fs, loc)
#define | MAXBSIZE 65536
#define | MAXMNTLEN 468
#define | MAXNAMLEN 255
#define | MAXVOLLEN 32
#define | NDADDR 12
#define | NIADDR 3
#define | NINDIR(fs) ((fs)->fs_nindir)
#define | NOCSPTRS ((128 / sizeof(void *)) - 4)
#define | NXADDR 2
#define | ROOTINO ((ino_t)2)
#define | sblksize(fs, size, lbn)
#define | SBLOCK_FLOPPY 0
#define | SBLOCK_PIGGY 262144
#define | SBLOCK_UFS1 8192
#define | SBLOCK_UFS2 65536
#define | SBLOCKSEARCH { SBLOCK_UFS2, SBLOCK_UFS1, SBLOCK_FLOPPY, SBLOCK_PIGGY, -1 }
#define | SBLOCKSIZE 8192
## Typedefs
typedef __int64_t | daddr_t
typedef int32_t | ufs1_daddr_t
typedef int64_t | ufs2_daddr_t
typedef int64_t | ufs_lbn_t
typedef int64_t | ufs_time_t
## Functions
int | ufs_init ()
int | ufs_initialize ()

## Define Documentation

#define blkoff | ( | fs,
|  | loc |  | ) |

Value:

    /* calculates (loc % fs->fs_bsize) */ \
            ((loc) & (fs)->fs_qbmask)

Definition at line 90 of file ufs.h.

Referenced by fsread().

#define cgbase | ( | fs,
|  | c |  | ) | (((ufs2_daddr_t)(fs)->fs_fpg) * (c))

Definition at line 64 of file ufs.h.

#define cgdmin | ( | fs,
|  | c |  | ) | (cgstart(fs, c) + (fs)->fs_dblkno)

Definition at line 65 of file ufs.h.

#define cgimin | ( | fs,
|  | c |  | ) | (cgstart(fs, c) + (fs)->fs_iblkno)

Definition at line 66 of file ufs.h.

#define cgsblock | ( | fs,
|  | c |  | ) | (cgstart(fs, c) + (fs)->fs_sblkno)

Definition at line 67 of file ufs.h.

#define cgstart | ( | fs,
|  | c |  | ) |

Value:

    ((fs)->fs_magic == FS_UFS2_MAGIC ? cgbase(fs, c) :               \
           (cgbase(fs, c) + (fs)->fs_old_cgoffset * ((c) & ~((fs)->fs_old_cgmask))))

Definition at line 69 of file ufs.h.

#define cgtod | ( | fs,
|  | c |  | ) | (cgstart(fs, c) + (fs)->fs_cblkno)

Definition at line 68 of file ufs.h.

#define dbtofsb | ( | fs,
|  | b |  | ) | ((b) >> (fs)->fs_fsbtodb)

Definition at line 75 of file ufs.h.

#define DEV_BSHIFT 9

Definition at line 42 of file ufs.h.

Referenced by fsread().

#define DEV_BSIZE (1<<DEV_BSHIFT)

Definition at line 43 of file ufs.h.

Referenced by fsfind(), and fsread().

#define DT_DIR 4

Definition at line 41 of file ufs.h.

Referenced by lookup().

#define DT_REG 8

Definition at line 38 of file ufs.h.

Referenced by lookup().

#define fragroundup | ( | fs,
|  | size |  | ) |

Value:

    /* calculates roundup(size, fs->fs_fsize) */ \
            (((size) + (fs)->fs_qfmask) & (fs)->fs_fmask)

Definition at line 94 of file ufs.h.

#define FS_UFS1_MAGIC 0x011954

Definition at line 51 of file ufs.h.

Referenced by fsread().

#define FS_UFS2_MAGIC 0x19540119

Definition at line 52 of file ufs.h.

Referenced by fsread().

#define fsbtodb | ( | fs,
|  | b |  | ) | ((daddr_t)(b) << (fs)->fs_fsbtodb)

Definition at line 74 of file ufs.h.

Referenced by fsread().

#define FSMAXSNAP 20

Definition at line 56 of file ufs.h.

#define ino_to_cg | ( | fs,
|  | x |  | ) | ((x) / (fs)->fs_ipg)

Definition at line 83 of file ufs.h.

#define ino_to_fsba | ( | fs,
|  | x |  | ) |

Value:

    ((ufs2_daddr_t)(cgimin(fs, ino_to_cg(fs, x)) +                  \
                (blkstofrags((fs), (((x) % (fs)->fs_ipg) / INOPB(fs))))))

Definition at line 84 of file ufs.h.

#define ino_to_fsbo | ( | fs,
|  | x |  | ) | ((x) % INOPB(fs))

Definition at line 87 of file ufs.h.

#define lblkno | ( | fs,
|  | loc |  | ) |

Value:

    /* calculates (loc / fs->fs_bsize) */ \
            ((loc) >> (fs)->fs_bshift)

Definition at line 92 of file ufs.h.

Referenced by fsread().

#define MAXBSIZE 65536

Definition at line 57 of file ufs.h.

Referenced by fsread().

#define MAXMNTLEN 468

Definition at line 53 of file ufs.h.

#define MAXNAMLEN 255

Definition at line 39 of file ufs.h.

Referenced by lookup().

#define MAXVOLLEN 32

Definition at line 54 of file ufs.h.

#define NDADDR 12

Definition at line 121 of file ufs.h.

Referenced by fsread().

#define NIADDR 3

Definition at line 122 of file ufs.h.

#define NINDIR | ( | fs |  | ) | ((fs)->fs_nindir)

Definition at line 58 of file ufs.h.

Referenced by fsread().

#define NOCSPTRS ((128 / sizeof(void *)) - 4)

Definition at line 55 of file ufs.h.

#define NXADDR 2

Definition at line 120 of file ufs.h.

#define ROOTINO ((ino_t)2)

Definition at line 40 of file ufs.h.

Referenced by lookup().

#define sblksize | ( | fs,
|  | size,
|  | lbn |  | ) |

Value:

    (((lbn) >= NDADDR || (size) >= ((lbn) + 1) << (fs)->fs_bshift) \
              ? (fs)->fs_bsize \
              : (fragroundup(fs, blkoff(fs, (size)))))

Definition at line 98 of file ufs.h.

Referenced by fsread().

#define SBLOCK_FLOPPY 0

Definition at line 44 of file ufs.h.

#define SBLOCK_PIGGY 262144

Definition at line 47 of file ufs.h.

#define SBLOCK_UFS1 8192

Definition at line 45 of file ufs.h.

#define SBLOCK_UFS2 65536

Definition at line 46 of file ufs.h.

#define SBLOCKSEARCH { SBLOCK_UFS2, SBLOCK_UFS1, SBLOCK_FLOPPY, SBLOCK_PIGGY, -1 }

Definition at line 49 of file ufs.h.

#define SBLOCKSIZE 8192

Definition at line 48 of file ufs.h.

## Typedef Documentation

typedef __int64_t daddr_t

Definition at line 110 of file ufs.h.

typedef int32_t ufs1_daddr_t

Definition at line 106 of file ufs.h.

typedef int64_t ufs2_daddr_t

Definition at line 107 of file ufs.h.

typedef int64_t ufs_lbn_t

Definition at line 108 of file ufs.h.

typedef int64_t ufs_time_t

Definition at line 109 of file ufs.h.

## Function Documentation

int ufs_init | ( |  | ) |

Definition at line 314 of file ufs.c.

References kpanic(), NULL, ufs_initialize(), ufs_openFile(), ufs_readFile(), ufs_writeFile(), vfsRegisterFS(), and x1.

Here is the call graph for this function:

int ufs_initialize | ( |  | ) |

Referenced by ufs_init().