#include <sys/types.h>#include <sys/dir.h>#include <sys/stat.h>#include <stdio.h>#include <errno.h>#include <fcntl.h>#include <limits.h>#include <stdlib.h>#include <string.h>#include <time.h>#include <unistd.h>#include <minix/config.h>#include <minix/const.h>#include <minix/type.h>#include <minix/minlib.h>#include "../../servers/fs/const.h"#include <minix/partition.h>#include <minix/u64.h>#include <sys/ioctl.h>#include <a.out.h>#include <tools.h>#include <dirent.h>#include "../../servers/fs/type.h"#include "../../servers/fs/super.h"#include <minix/fslib.h>Include dependency graph for mkfs.c:

Go to the source code of this file.
Defines | |
| #define | EXTERN |
| #define | max(a, b) ((a) > (b) ? (a) : (b)) |
| #define | INODE_MAP 2 |
| #define | MAX_TOKENS 10 |
| #define | LINE_LEN 200 |
| #define | BIN 2 |
| #define | BINGRP 2 |
| #define | BIT_MAP_SHIFT 13 |
| #define | N_BLOCKS MAX_BLOCK_NR |
| #define | N_BLOCKS16 (128L * 1024) |
| #define | INODE_MAX ((unsigned) 65535) |
| #define | MAX_INIT (sizeof(char *) == 2 ? N_BLOCKS16 : N_BLOCKS) |
| #define | MAX_MAX_SIZE ((unsigned long) 0xffffffff) |
Functions | |
| _PROTOTYPE (int main,(int argc, char **argv)) | |
| _PROTOTYPE (block_t sizeup,(char *device)) | |
| _PROTOTYPE (void super,(zone_t zones, Ino_t inodes)) | |
| _PROTOTYPE (void rootdir,(Ino_t inode)) | |
| _PROTOTYPE (void eat_dir,(Ino_t parent)) | |
| _PROTOTYPE (void eat_file,(Ino_t inode, int f)) | |
| _PROTOTYPE (void enter_dir,(Ino_t parent, char *name, Ino_t child)) | |
| _PROTOTYPE (void incr_size,(Ino_t n, long count)) | |
| _PROTOTYPE (PRIVATE ino_t alloc_inode,(int mode, int usrid, int grpid)) | |
| _PROTOTYPE (PRIVATE zone_t alloc_zone,(void)) | |
| _PROTOTYPE (void add_zone,(Ino_t n, zone_t z, long bytes, long cur_time)) | |
| _PROTOTYPE (void incr_link,(Ino_t n)) | |
| _PROTOTYPE (void insert_bit,(block_t block, int bit)) | |
| _PROTOTYPE (int mode_con,(char *p)) | |
| _PROTOTYPE (void getline,(char line[LINE_LEN], char *parse[MAX_TOKENS])) | |
| _PROTOTYPE (void check_mtab,(char *devname)) | |
| _PROTOTYPE (long file_time,(int f)) | |
| _PROTOTYPE (void pexit,(char *s)) | |
| _PROTOTYPE (void copy,(char *from, char *to, int count)) | |
| _PROTOTYPE (void print_fs,(void)) | |
| _PROTOTYPE (int read_and_set,(block_t n)) | |
| _PROTOTYPE (void special,(char *string)) | |
| _PROTOTYPE (void get_block,(block_t n, char *buf)) | |
| _PROTOTYPE (void get_super_block,(char *buf)) | |
| _PROTOTYPE (void mx_read,(int blocknr, char *buf)) | |
| _PROTOTYPE (void dexit,(char *s, int sectnum, int err)) | |
| _PROTOTYPE (char *alloc_block,(void)) | |
| int | main (int argc, argv) |
| block_t | sizeup (char *device) |
| void | super (zone_t zones, ino_t inodes) |
| void | rootdir (ino_t inode) |
| void | eat_dir (ino_t parent) |
| void | eat_file (ino_t inode, int f) |
| void | enter_dir (ino_t parent, char *name, ino_t child) |
| void | add_zone (ino_t n, zone_t z, long bytes, long cur_time) |
| void | add_z_1 (ino_t n, zone_t z, long bytes, long cur_time) |
| void | add_z_2 (ino_t n, zone_t z, long bytes, long cur_time) |
| void | incr_link (ino_t n) |
| void | incr_size (ino_t n, long count) |
| PRIVATE ino_t | alloc_inode (int mode, int usrid, int grpid) |
| PRIVATE zone_t | alloc_zone () |
| void | insert_bit (block_t block, int bit) |
| int | mode_con (char *p) |
| void | getline (line, parse) |
| void | check_mtab (char *devname) |
| long | file_time (int f) |
| void | pexit (char *s) |
| void | copy (char *from, char *to, int count) |
| char * | alloc_block () |
| void | print_fs () |
| int | read_and_set (block_t n) |
| void | usage () |
| void | special (char *string) |
| void | get_block (block_t n, char *buf) |
| void | get_super_block (char *buf) |
| void | put_block (block_t n, char *buf) |
| void | flush () |
| void | cache_init () |
Variables | |
| int | isdev |
| char * | optarg |
| int | optind |
| int | next_zone |
| int | next_inode |
| int | zone_size |
| int | zone_shift = 0 |
| int | zoff |
| block_t | nrblocks |
| int | inode_offset |
| int | lct = 0 |
| int | disk |
| int | fd |
| int | print = 0 |
| int | file = 0 |
| unsigned int | nrinodes |
| int | override = 0 |
| int | simple = 0 |
| int | dflag |
| int | donttest |
| char * | progname |
| long | current_time |
| long | bin_time |
| char * | zero |
| char * | lastp |
| char | umap [MAX_INIT/8] |
| block_t | zone_map |
| int | inodes_per_block |
| int | fs_version |
| unsigned int | block_size |
| block_t | max_nrblocks |
| FILE * | proto |
|
|
Definition at line 55 of file mkfs.c. Referenced by main(). |
|
|
Definition at line 56 of file mkfs.c. Referenced by main(). |
|
|
|
|
|
|
|
|
Definition at line 52 of file mkfs.c. Referenced by alloc_inode(). |
|
|
Definition at line 60 of file mkfs.c. Referenced by main(). |
|
|
|
|
|
|
|
|
Definition at line 67 of file mkfs.c. Referenced by read_and_set(). |
|
|
|
|
|
|
|
|
Definition at line 58 of file mkfs.c. Referenced by main(). |
|
|
Definition at line 59 of file mkfs.c. Referenced by main(). |
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||||||||||
|
Definition at line 736 of file mkfs.c. References b, blk, get_block(), indir, inode_offset, off, p, V1_INDIRECTS, V1_INODES_PER_BLOCK, and V1_NR_DZONES. Referenced by add_zone(). |
|
||||||||||||||||||||
|
Definition at line 780 of file mkfs.c. References b, blk, block_size, free, get_block(), indir, inode_offset, malloc(), off, p, pexit(), V2_INDIRECTS, V2_INODES_PER_BLOCK, and V2_NR_DZONES. Referenced by add_zone(). |
|
||||||||||||||||||||
|
Definition at line 724 of file mkfs.c. References add_z_1(), add_z_2(), and fs_version. |
|
|
Definition at line 1130 of file mkfs.c. References block_size, bzero(), malloc(), and pexit(). Referenced by eat_file(), insert_bit(), main(), print_fs(), and super(). |
|
||||||||||||||||
|
Definition at line 900 of file mkfs.c. References b, block_size, fprintf(), free, fs_version, get_block(), INODE_MAP, inode_offset, inodes_per_block, insert_bit(), malloc(), next_inode, nrinodes, num(), off, pexit(), put_block(), stderr, V1_INODES_PER_BLOCK, and V2_INODES_PER_BLOCK. Referenced by clone_opcl(), do_pipe(), eat_dir(), main(), and new_node(). |
|
|
Definition at line 944 of file mkfs.c. References b, insert_bit(), next_zone, nrblocks, pexit(), put_block(), z, zero, zoff, and zone_map. Referenced by eat_dir(), eat_file(), enter_dir(), new_block(), rootdir(), and write_map(). |
|
|
Definition at line 1588 of file mkfs.c. Referenced by main(). |
|
|
Definition at line 1061 of file mkfs.c. References ENOENT, errno, exit(), fprintf(), get_mtab_entry(), load_mtab(), n, PATH_MAX, progname, r, S_ISBLK, sb, stat, stderr, strcmp, strerror(), and version. Referenced by main(). |
|
||||||||||||||||
|
|
|
|
Definition at line 555 of file mkfs.c. References add_zone(), alloc_inode(), alloc_zone(), atoi, block_size, current_time, eat_dir(), eat_file(), enter_dir(), errno, fprintf(), getline(), incr_link(), incr_size(), LINE_LEN, MAX_TOKENS, min, mode_con(), n, O_RDONLY, open, p, progname, size, stderr, strerror(), and z. |
|
||||||||||||
|
Definition at line 617 of file mkfs.c. References alloc_block(), alloc_zone(), block_size, j, k, put_block(), read, z, and zone_size. Referenced by eat_dir(). |
|
||||||||||||||||
|
Definition at line 647 of file mkfs.c. References alloc_zone(), b, block_size, d1_inode::d1_zone, fs_version, get_block(), inode_offset, inodes_per_block, j, k, malloc(), NR_DIR_ENTRIES, nr_dzones, off, p1, pexit(), V1_INODES_PER_BLOCK, V1_NR_DZONES, V2_INODES_PER_BLOCK, V2_NR_DZONES, and z. |
|
|
Definition at line 1099 of file mkfs.c. References fstat, L, and stat::st_mtime. |
|
|
|
|
||||||||||||
|
Definition at line 1526 of file mkfs.c. References block_size, copy, fd, k, lseek, pexit(), read, read_and_set(), SEEK_SET, and zero. Referenced by add_z_1(), add_z_2(), alloc_bit(), alloc_inode(), clear_zone(), do_rdlink(), enter_dir(), free_bit(), get_fileblock(), get_inode(), incr_link(), incr_size(), insert_bit(), ltraverse(), main(), new_block(), print_fs(), rahead(), read_map(), rw_chunk(), rw_inode(), search_dir(), write_map(), and zeroblock_range(). |
|
|
Definition at line 1546 of file mkfs.c. References fd, k, lseek, perror(), pexit(), read, SEEK_SET, and SUPER_BLOCK_BYTES. Referenced by print_fs(). |
|
||||||||||||
|
Definition at line 1014 of file mkfs.c. References c, d, EOF, fgetc(), k, lct, p, pexit(), and proto. |
|
|
Definition at line 834 of file mkfs.c. References b, block_size, enter(), exit(), fs_version, get_block(), inode_offset, inodes_per_block, malloc(), NULL, off, pexit(), put_block(), V1_INODES_PER_BLOCK, and V2_INODES_PER_BLOCK. |
|
||||||||||||
|
Definition at line 868 of file mkfs.c. References b, block_size, free, fs_version, get_block(), inode_offset, inodes_per_block, malloc(), off, pexit(), put_block(), V1_INODES_PER_BLOCK, and V2_INODES_PER_BLOCK. Referenced by eat_dir(). |
|
||||||||||||
|
Definition at line 967 of file mkfs.c. References alloc_block(), free, get_block(), pexit(), put_block(), and s. Referenced by alloc_inode(), and alloc_zone(). |
|
||||||||||||
|
Definition at line 139 of file mkfs.c. References _MAX_BLOCK_SIZE, _MIN_BLOCK_SIZE, _STATIC_BLOCK_SIZE, alloc_block(), alloc_inode(), atoi, atol(), BIN, bin_time, BINGRP, BLOCK_SIZE, block_size, blocks, bzero(), cache_init(), check_mtab(), current_time, dflag, donttest, eat_dir(), EOF, flush, fopen(), fprintf(), free, fs_version, get_block(), getline(), getopt(), i, INODE_MAX, inodes, inodes_per_block, isdev, L, lct, LINE_LEN, lseek, max, max_nrblocks, MAX_TOKENS, mode_con(), N_BLOCKS, N_BLOCKS16, nrblocks, nrinodes, NULL, optarg, optind, override, perror(), pexit(), print, print_fs(), printf, progname, proto, put_block(), read, rootdir(), SECTOR_SIZE, SEEK_SET, simple, sizeup(), special(), stat::st_mtime, stat, stderr, strncpy(), strtoul(), super, sync, time, time_t, ULONG_MAX, usage, V1_INODES_PER_BLOCK, V2_INODE_SIZE, V2_INODES_PER_BLOCK, write, zero, and zone_shift. |
|
|
Definition at line 991 of file mkfs.c. References I_BLOCK_SPECIAL, I_CHAR_SPECIAL, I_DIRECTORY, I_REGULAR, I_SET_GID_BIT, and I_SET_UID_BIT. |
|
|
Definition at line 1112 of file mkfs.c. References exit(), flush, fprintf(), lct, progname, and stderr. Referenced by add_z_2(), alloc_block(), alloc_inode(), alloc_zone(), enter_dir(), get_block(), get_super_block(), getline(), incr_link(), incr_size(), insert_bit(), main(), print_fs(), put_block(), read_and_set(), and special(). |
|
|
Definition at line 1142 of file mkfs.c. References alloc_block(), b, block_size, dir, free, fs_version, get_block(), get_super_block(), inode_offset, j, k, malloc(), NR_DIR_ENTRIES, nrinodes, NULL, pexit(), printf, V1_INODES_PER_BLOCK, and V2_INODES_PER_BLOCK. Referenced by main(). |
|
||||||||||||
|
Definition at line 1563 of file mkfs.c. References block_size, fd, lseek, pexit(), read_and_set(), SEEK_SET, and write. Referenced by alloc_bit(), alloc_inode(), alloc_zone(), clear_zone(), do_rdlink(), do_slink(), eat_file(), free_bit(), incr_link(), incr_size(), insert_bit(), ltraverse(), main(), rahead(), read_ahead(), read_map(), rw_chunk(), rw_inode(), search_dir(), write_map(), and zeroblock_range(). |
|
|
Definition at line 1227 of file mkfs.c. References MAX_INIT, pexit(), r, s, and umap. Referenced by get_block(), and put_block(). |
|
|
Definition at line 538 of file mkfs.c. References add_zone(), alloc_zone(), current_time, enter_dir(), incr_link(), and z. Referenced by main(). |
|
|
Definition at line 417 of file mkfs.c. References block_size, close, cvu64(), d, DIOCGETP, div64u(), ENOENT, entry, errno, fprintf(), fstat, ioctl, O_RDONLY, open, perror(), entry::size, st, stat::st_size, and stderr. |
|
|
Definition at line 1504 of file mkfs.c. References close, creat, fd, fstat, isdev, O_RDWR, open, pexit(), S_IFBLK, S_IFCHR, S_IFMT, and stat::st_mode. Referenced by evalvar(), file(), list(), main(), readfs(), and update_mtab(). |
|
||||||||||||
|
Definition at line 450 of file mkfs.c. References alloc_block(), block_size, cp, fs_version, i, super_block::s_ninodes, and super_block::s_nzones. |
|
|
|
|
|
Definition at line 90 of file mkfs.c. Referenced by main(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 87 of file mkfs.c. Referenced by main(). |
|
|
|
|
|
|
|
|
|
|
|
Definition at line 84 of file mkfs.c. Referenced by add_z_1(), add_z_2(), alloc_inode(), enter_dir(), incr_link(), incr_size(), and print_fs(). |
|
|
|
|
|
|
|
|
Definition at line 91 of file mkfs.c. Referenced by stripsp(). |
|
|
|
|
|
Definition at line 97 of file mkfs.c. Referenced by main(). |
|
|
Definition at line 82 of file mkfs.c. Referenced by alloc_inode(). |
|
|
Definition at line 82 of file mkfs.c. Referenced by alloc_zone(). |
|
|
Definition at line 83 of file mkfs.c. Referenced by alloc_zone(), and main(). |
|
|
Definition at line 85 of file mkfs.c. Referenced by alloc_inode(), main(), and print_fs(). |
|
|
|
|
|
|
|
|
|
|
|
Definition at line 84 of file mkfs.c. Referenced by display(), docd(), extract(), get(), is_added(), listfiles(), main(), setoption(), show(), string_print(), usage(), and work(). |
|
|
|
|
|
Definition at line 99 of file mkfs.c. Referenced by getline(), getprotoent(), ip_port_arrive(), main(), pr_rr(), and udp_cksum(). |
|
|
Definition at line 86 of file mkfs.c. Referenced by command(), main(), and secondary(). |
|
|
Definition at line 92 of file mkfs.c. Referenced by read_and_set(). |
|
|
Definition at line 91 of file mkfs.c. Referenced by alloc_zone(), bc_divide(), get_block(), main(), test5a(), traversetree(), and udp_cksum(). |
|
|
Definition at line 82 of file mkfs.c. Referenced by alloc_zone(). |
|
|
Definition at line 93 of file mkfs.c. Referenced by alloc_zone(). |
|
|
|
|
|
Definition at line 82 of file mkfs.c. Referenced by clear_zone(), eat_file(), freesp_inode(), new_block(), and truncate_inode(). |
1.4.6