autopart.c File Reference

#include <sys/types.h>
#include <stdio.h>
#include <termcap.h>
#include <errno.h>
#include <unistd.h>
#include <stddef.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <fcntl.h>
#include <time.h>
#include <dirent.h>
#include <limits.h>
#include <a.out.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/ioctl.h>
#include <minix/config.h>
#include <minix/const.h>
#include <minix/partition.h>
#include <minix/u64.h>
#include <ibm/partition.h>
#include <termios.h>
#include <stdarg.h>

Include dependency graph for autopart.c:

Go to the source code of this file.

Data Structures

struct  device
struct  region
struct  indicators
struct  object
struct  diving

Defines

#define nil   0
#define ext_part(s)   ((s) == 0x05 || (s) == 0x0F)
#define MAXSIZE   999999999L
#define SECTOR_SIZE   512
#define DEV_FD0   0x200
#define DEV_C0D0   0x300
#define MIN_REGION_SECTORS   (1024*1024*min_region_mb/SECTOR_SIZE)
#define MAX_REGION_MB   4095
#define MAX_REGION_SECTORS   (1024*(1024/SECTOR_SIZE)*MAX_REGION_MB)
#define arraysize(a)   (sizeof(a) / sizeof((a)[0]))
#define arraylimit(a)   ((a) + arraysize(a))
#define SORNOT(n)   ((n) == 1 ? "" : "s")
#define COL_RED   1
#define COL_GREEN   2
#define COL_ORANGE   3
#define COL_BLUE   4
#define COL_MAGENTA   5
#define COL_CYAN   6
#define SURE_SERIOUS   1
#define SURE_BACK   2
#define ctrl(c)   ((c) == '?' ? '\177' : ((c) & '\37'))
#define STATUSROW   10
#define minor(dev)   (((dev) >> MINOR) & BYTE)
#define major(dev)   (((dev) >> MAJOR) & BYTE)
#define makedev(major, minor)   ((dev_t) (((major) << MAJOR) | ((minor) << MINOR)))
#define NR_REGIONS   (2*NR_PARTITIONS+1)
#define MAX_DEVICES   100
#define rjust(type)   ((type) >= O_TYPHEX)
#define computed(type)   ((type) >= O_TYPTXT)
#define OF_MOD   0x01
#define OF_ODD   0x02
#define OF_BAD   0x04
#define E_ENTER   (-1)
#define E_LEAVE   (-2)
#define E_WRITE   (-3)
#define IS_YES   3
#define IS_NO   4
#define IS_OTHER   5

Typedefs

typedef enum parttype parttype_t
typedef device device_t
typedef region region_t
typedef indicators indicators_t
typedef enum objtype objtype_t
typedef object object_t
typedef diving diving_t

Enumerations

enum  parttype { DUNNO, SUBPART, PRIMARY, FLOPPY }
enum  objtype {
  O_INFO, O_TEXT, O_DEV, O_SUB,
  O_TYPTXT, O_SORT, O_NUM, O_TYPHEX,
  O_CYL, O_HEAD, O_SEC, O_SCYL,
  O_SHEAD, O_SSEC, O_LCYL, O_LHEAD,
  O_LSEC, O_BASE, O_SIZE, O_KB
}
enum  howend { SIZE, LAST }

Functions

static void printstep (int step, char *message)
void col (int col)
void type2col (int type)
int open_ct_ok (int fd)
void report (const char *label)
void fatal (const char *label)
void save_ttyflags (void)
void restore_ttyflags (void)
void tty_raw (void)
void init_tty (void)
void putchr (int c)
void putstr (char *s)
void set_cursor (int row, int col)
void stat_start (int serious)
void stat_end (int ktl)
void stat_reset (void)
void clear_screen (void)
void reset_tty (void)
void * alloc (size_t n)
void newdevice (char *name, int scanning, int disk_only)
void getdevices (int disk_only)
unsigned long sortbase (struct part_entry *pe)
void sort (void)
void dos2chs (unsigned char *dos, unsigned *chs)
void abs2dos (unsigned char *dos, unsigned long pos)
void recompute0 (void)
void guess_geometry (void)
void geometry (void)
char * typ2txt (int ind)
int round_sysind (int ind, int delta)
object_tnewobject (objtype_t type, int flags, int row, int col, int len)
unsigned long entry2base (struct part_entry *pe)
unsigned long entry2last (struct part_entry *pe)
unsigned long entry2size (struct part_entry *pe)
int overlap (unsigned long sec)
int aligned (unsigned long sec, unsigned unit)
void print (object_t *op)
void display (void)
void event (int ev, object_t *op)
void m_redraw (int ev, object_t *op)
void m_toggle (int ev, object_t *op)
void m_orientation (int ev, object_t *op)
void m_move (int ev, object_t *op)
void m_updown (int ev, object_t *op)
void m_enter (int ev, object_t *op)
void m_leave (int ev, object_t *op)
int within (unsigned *var, unsigned low, unsigned value, unsigned high)
int lwithin (unsigned long *var, unsigned long low, unsigned long value, unsigned long high)
int nextdevice (object_t *op, int delta)
void check_ind (struct part_entry *pe)
int check_existing (struct part_entry *pe)
void m_modify (int ev, object_t *op)
void newspell (unsigned long charm)
void m_magic (int ev, object_t *op)
void m_in (int ev, object_t *op)
void m_out (int ev, object_t *op)
void installboot (unsigned char *bootblock, char *masterboot)
ssize_t boot_readwrite (int rw)
int cylinderalign (region_t *reg)
void regionize (void)
void m_read (int ev, int *biosdrive)
void m_write (int ev, object_t *op)
void m_shell (int ev, object_t *op)
void m_dump (struct part_entry *print_table)
void m_quit (int ev, object_t *op)
void m_help (int ev, object_t *op)
int keypress (void)
void mainloop (void)
char * prettysizeprint (int kb)
void printregions (region_t *theregions, int indent, int p_nr_partitions, int p_free_regions, int p_nr_regions, int numbers)
int is_sure (char *fmt,...)
void warn (char *message)
int may_kill_region (void)
region_tselect_region (void)
device_tselect_disk (void)
int scribble_region (region_t *reg, struct part_entry **pe, int *made_new)
int sanitycheck_failed (char *dev, struct part_entry *pe)
int do_autopart (int resultfd)
int main (int argc, char **argv)

Variables

static char MASTERBOOT [] = "/usr/mdec/masterboot"
int min_region_mb = 500
termios termios
char t_cd [16]
char t_cm [32]
char t_so [16]
char t_se [16]
char t_md [16]
char t_me [16]
int t_li
int t_co
int statusrow = STATUSROW
int stat_ktl = 1
int need_help = 1
region_t regions [NR_REGIONS]
int nr_partitions = 0
int nr_regions = 0
int free_regions
int used_regions
int nordonly = 0
device_tfirstdev = nil
device_tcurdev
struct {
   char *   f_name
   FILE *   f_fp
   int   f_type
   char *   word
   int   type
   int   val
   char *   name
   CMD   code
   void(*   fn )()
   ARGT   argt
   char *   name
   char *   nm
   char   type
   char   flags
   char *   value
   const char *   name
   signed char   fat_bits
   int   tracks
   unsigned short   heads
   unsigned short   sectors
   device_t *   dev
   int   nr_partitions
   int   free_regions
   int   used_regions
   int   sectors
   int   nr_regions
   int   biosdrive
   region_t   regions [NR_REGIONS]
   int   this_month
   int   feb
   int   sept
   int   days_in_month
   int   dow_first
   int   o_file
   int   o_field
   WINDOW *   win
   char   erase
   char   kill
   char   werase
   unsigned   baudr
   int   speedcode
   u16_t   vendor
   u16_t   device
devices [MAX_DEVICES]
unsigned char bootstrap []
int dirty = 0
unsigned char bootblock [SECTOR_SIZE]
part_entry table [1+NR_PARTITIONS]
int existing [1+NR_PARTITIONS]
unsigned long offset = 0
unsigned long extbase = 0
unsigned long extsize
int submerged = 0
char sort_index [1+NR_PARTITIONS]
char sort_order [1+NR_PARTITIONS]
unsigned cylinders = 1
unsigned heads = 1
unsigned sectors = 1
unsigned secpcyl = 1
unsigned alt_cyls = 1
unsigned alt_heads = 1
unsigned alt_secs = 1
int precise = 0
int device = -1
indicators_t ind_table []
object_tworld = nil
object_tcurobj = nil
int typing
int magic
char size_last [] = "Size"
unsigned long spell [3+4 *(1+NR_PARTITIONS)]
int nspells
objtype_t touching
diving_tdiving = nil
int quitting = 0


Define Documentation

#define arraylimit a   )     ((a) + arraysize(a))
 

Definition at line 70 of file autopart.c.

#define arraysize a   )     (sizeof(a) / sizeof((a)[0]))
 

Definition at line 69 of file autopart.c.

#define COL_BLUE   4
 

Definition at line 78 of file autopart.c.

#define COL_CYAN   6
 

Definition at line 80 of file autopart.c.

Referenced by type2col().

#define COL_GREEN   2
 

Definition at line 76 of file autopart.c.

Referenced by type2col().

#define COL_MAGENTA   5
 

Definition at line 79 of file autopart.c.

#define COL_ORANGE   3
 

Definition at line 77 of file autopart.c.

Referenced by type2col().

#define COL_RED   1
 

Definition at line 75 of file autopart.c.

#define computed type   )     ((type) >= O_TYPTXT)
 

Definition at line 746 of file autopart.c.

Referenced by print().

#define ctrl c   )     ((c) == '?' ? '\177' : ((c) & '\37'))
 

Definition at line 157 of file autopart.c.

#define DEV_C0D0   0x300
 

Definition at line 60 of file autopart.c.

Referenced by newdevice().

#define DEV_FD0   0x200
 

Definition at line 59 of file autopart.c.

#define E_ENTER   (-1)
 

Definition at line 765 of file autopart.c.

Referenced by m_enter().

#define E_LEAVE   (-2)
 

Definition at line 766 of file autopart.c.

Referenced by m_leave().

#define E_WRITE   (-3)
 

Definition at line 767 of file autopart.c.

Referenced by m_in(), m_out(), m_quit(), m_write(), and nextdevice().

#define ext_part s   )     ((s) == 0x05 || (s) == 0x0F)
 

Definition at line 40 of file autopart.c.

Referenced by extpartition(), m_in(), m_read(), and partition().

#define IS_NO   4
 

Definition at line 2262 of file autopart.c.

Referenced by do_autopart(), is_sure(), and may_kill_region().

#define IS_OTHER   5
 

Definition at line 2263 of file autopart.c.

Referenced by is_sure().

#define IS_YES   3
 

Definition at line 2261 of file autopart.c.

Referenced by do_autopart(), is_sure(), and may_kill_region().

#define major dev   )     (((dev) >> MAJOR) & BYTE)
 

Definition at line 271 of file autopart.c.

#define makedev major,
minor   )     ((dev_t) (((major) << MAJOR) | ((minor) << MINOR)))
 

Definition at line 272 of file autopart.c.

#define MAX_DEVICES   100
 

Definition at line 308 of file autopart.c.

Referenced by select_disk().

#define MAX_REGION_MB   4095
 

Definition at line 66 of file autopart.c.

Referenced by scribble_region().

#define MAX_REGION_SECTORS   (1024*(1024/SECTOR_SIZE)*MAX_REGION_MB)
 

Definition at line 67 of file autopart.c.

Referenced by scribble_region().

#define MAXSIZE   999999999L
 

Definition at line 57 of file autopart.c.

Referenced by m_modify().

#define MIN_REGION_SECTORS   (1024*1024*min_region_mb/SECTOR_SIZE)
 

Definition at line 64 of file autopart.c.

Referenced by prettysizeprint().

#define minor dev   )     (((dev) >> MINOR) & BYTE)
 

Definition at line 270 of file autopart.c.

#define nil   0
 

Definition at line 9 of file autopart.c.

#define NR_REGIONS   (2*NR_PARTITIONS+1)
 

Definition at line 301 of file autopart.c.

#define OF_BAD   0x04
 

Definition at line 762 of file autopart.c.

Referenced by print().

#define OF_MOD   0x01
 

Definition at line 760 of file autopart.c.

Referenced by m_move(), and main().

#define OF_ODD   0x02
 

Definition at line 761 of file autopart.c.

Referenced by print().

#define rjust type   )     ((type) >= O_TYPHEX)
 

Definition at line 745 of file autopart.c.

Referenced by print().

#define SECTOR_SIZE   512
 

Definition at line 58 of file autopart.c.

#define SORNOT n   )     ((n) == 1 ? "" : "s")
 

Definition at line 72 of file autopart.c.

Referenced by select_region().

#define STATUSROW   10
 

Definition at line 161 of file autopart.c.

Referenced by stat_reset().

#define SURE_BACK   2
 

Definition at line 83 of file autopart.c.

#define SURE_SERIOUS   1
 

Definition at line 82 of file autopart.c.


Typedef Documentation

typedef struct device device_t
 

typedef struct diving diving_t
 

typedef struct indicators indicators_t
 

typedef struct object object_t
 

typedef enum objtype objtype_t
 

typedef enum parttype parttype_t
 

typedef struct region region_t
 


Enumeration Type Documentation

enum howend
 

Enumerator:
SIZE 
LAST 

Definition at line 770 of file autopart.c.

enum objtype
 

Enumerator:
O_INFO 
O_TEXT 
O_DEV 
O_SUB 
O_TYPTXT 
O_SORT 
O_NUM 
O_TYPHEX 
O_CYL 
O_HEAD 
O_SEC 
O_SCYL 
O_SHEAD 
O_SSEC 
O_LCYL 
O_LHEAD 
O_LSEC 
O_BASE 
O_SIZE 
O_KB 

Definition at line 738 of file autopart.c.

enum parttype
 

Enumerator:
DUNNO 
SUBPART 
PRIMARY 
FLOPPY 

Definition at line 276 of file autopart.c.


Function Documentation

void abs2dos unsigned char *  dos,
unsigned long  pos
 

Definition at line 473 of file autopart.c.

References c, s, secpcyl, and sectors.

int aligned unsigned long  sec,
unsigned  unit
 

Definition at line 828 of file autopart.c.

References extbase, and offset.

void* alloc size_t  n  ) 
 

Definition at line 260 of file autopart.c.

ssize_t boot_readwrite int  rw  ) 
 

Definition at line 1676 of file autopart.c.

References _STATIC_BLOCK_SIZE, add64(), add64u(), partition::base, bootblock, cmp64(), cvu64(), DIOCGETP, DIOCSETP, fcntl, ioctl, LONG_MAX, lseek, mul64u(), offset, r, read, SECTOR_SIZE, SEEK_SET, partition::size, sync, and write.

Referenced by m_read().

int check_existing struct part_entry pe  ) 
 

Definition at line 1233 of file autopart.c.

References c, existing, fflush(), getchar, nil, putchr(), putstr(), stat_end(), stat_start(), stdout, and table.

Referenced by m_magic(), and m_modify().

void check_ind struct part_entry pe  ) 
 

Definition at line 1219 of file autopart.c.

References ACTIVE_FLAG, part_entry::bootind, dirty, NO_PART, part_entry::sysind, and table.

Referenced by do_autopart(), m_magic(), and m_modify().

void clear_screen void   ) 
 

Definition at line 244 of file autopart.c.

References putchr(), set_cursor(), stat_ktl, stat_reset(), t_cd, and tputs().

void col int  col  ) 
 

Definition at line 85 of file autopart.c.

References printf.

Referenced by cmd_args(), cmd_print(), d_ncols(), drawtext(), fix_line(), format(), idx2col(), indtion(), inindex(), isinsets(), m_tocol(), main(), nudgecursor(), output(), overlay(), overwrite(), print(), print_sector(), printregions(), samesets(), sctrin(), showjobs(), smartdrawtext(), and type2col().

int cylinderalign region_t reg  ) 
 

Definition at line 1720 of file autopart.c.

References extra(), reg, secpcyl, sectors, and table.

Referenced by scribble_region().

void display void   ) 
 

Definition at line 1019 of file autopart.c.

Referenced by command(), delete(), do_absolute(), do_backward(), do_forward(), do_lline(), do_visit(), file_insert(), load_file(), mainloop(), next_screen(), prev_screen(), RD(), redraw(), S(), scrollb(), and tomark().

int do_autopart int  resultfd  ) 
 

Definition at line 2587 of file autopart.c.

References check_ind(), close, curdev, devname, disk, exit(), fprintf(), int(), IS_NO, is_sure(), IS_YES, part_entry::lowsec, lowsec, m_read(), memcpy(), MINIX_PART, device::name, nordonly, NR_PARTITIONS, NULL, printf, printstep(), r, recompute0(), regions, scribble_region(), select_disk(), select_region(), sort(), sort_order, stderr, and table.

void dos2chs unsigned char *  dos,
unsigned *  chs
 

Definition at line 462 of file autopart.c.

Referenced by m_dump().

unsigned long entry2base struct part_entry pe  ) 
 

Definition at line 798 of file autopart.c.

References part_entry::lowsec, NO_PART, and part_entry::sysind.

Referenced by print().

unsigned long entry2last struct part_entry pe  ) 
 

Definition at line 804 of file autopart.c.

References part_entry::lowsec, NO_PART, part_entry::size, and part_entry::sysind.

Referenced by print().

unsigned long entry2size struct part_entry pe  ) 
 

Definition at line 809 of file autopart.c.

References NO_PART, part_entry::size, and part_entry::sysind.

Referenced by print().

void event int  ev,
object_t op
 

void fatal const char *  label  ) 
 

Definition at line 126 of file autopart.c.

References exit(), and report().

void geometry void   ) 
 

Definition at line 570 of file autopart.c.

References alt_cyls, alt_heads, alt_secs, partition::base, curdev, partition::cylinders, cylinders, DIOCGETP, div64u(), ENODEV, ENOTTY, err, errno, exit(), fstat, geometry, guess_geometry(), partition::heads, heads, ioctl, device::name, precise, printf, recompute0(), S_ISBLK, S_ISCHR, SECTOR_SIZE, partition::sectors, sectors, partition::size, sort(), stat::st_mode, stat_end(), stat_start(), strerror(), submerged, and table.

void getdevices int  disk_only  ) 
 

Definition at line 376 of file autopart.c.

References closedir, d, e, fatal(), newdevice(), nil, opendir, readdir, and strcpy().

void guess_geometry void   ) 
 

Definition at line 502 of file autopart.c.

References alt_cyls, alt_heads, alt_secs, i, n, and s.

Referenced by geometry().

void init_tty void   ) 
 

Definition at line 163 of file autopart.c.

References exit(), fprintf(), getenv(), nil, save_ttyflags(), stderr, t_cd, t_cm, t_co, t_li, t_md, t_me, t_se, t_so, term, tgetent(), tgetnum(), tgetstr(), and tty_raw().

void installboot unsigned char *  bootblock,
char *  masterboot
 

Definition at line 1626 of file autopart.c.

References exec::a_cpu, exec::a_data, exec::a_hdrlen, A_I8086, A_MINHDR, exec::a_text, BADMAG, err, errno, fclose(), ferror, fopen(), fread(), fseek(), nil, PART_TABLE_OFF, printf, stat_end(), stat_start(), and strerror().

Referenced by m_read().

int is_sure char *  fmt,
  ...
 

Definition at line 2265 of file autopart.c.

References exit(), fflush(), fgets(), IS_NO, IS_OTHER, IS_YES, printf, stdin, stdout, strcmp, va_end, va_start, and vprintf().

Referenced by do_autopart(), and may_kill_region().

int keypress void   ) 
 

Definition at line 2128 of file autopart.c.

References c, object::col, ctrl, curobj, esc, fatal(), fflush(), read, object::row, set_cursor(), and stdout.

Referenced by mainloop().

int lwithin unsigned long *  var,
unsigned long  low,
unsigned long  value,
unsigned long  high
 

Definition at line 1179 of file autopart.c.

Referenced by m_modify().

void m_dump struct part_entry print_table  ) 
 

Definition at line 2005 of file autopart.c.

References ACTIVE_FLAG, part_entry::bootind, dos2chs(), part_entry::last_head, part_entry::lowsec, print_table(), printf, part_entry::size, SIZE, part_entry::start_head, and part_entry::sysind.

void m_enter int  ev,
object_t op
 

Definition at line 1153 of file autopart.c.

References curobj, E_ENTER, magic, op, and typing.

void m_help int  ev,
object_t op
 

Definition at line 2043 of file autopart.c.

References arraylimit, help(), printf, putstr(), stat_end(), stat_start(), t_md, t_me, t_se, and t_so.

void m_in int  ev,
object_t op
 

Definition at line 1548 of file autopart.c.

References alloc(), close, curdev, dirty, diving, DUNNO, E_WRITE, event, ext_part, extbase, extsize, MINIX_PART, nil, offset, diving::oldsubname, op, device::parttype, PRIMARY, part_entry::size, strcpy(), strlen(), submerged, device::subname, SUBPART, part_entry::sysind, and table.

void m_leave int  ev,
object_t op
 

Definition at line 1163 of file autopart.c.

References E_LEAVE.

void m_magic int  ev,
object_t op
 

Definition at line 1432 of file autopart.c.

References check_existing(), check_ind(), event, extbase, part_entry::lowsec, magic, memset(), MINIX_PART, object::next, nil, NO_PART, O_BASE, O_KB, O_LCYL, O_LHEAD, O_LSEC, O_SCYL, O_SHEAD, O_SIZE, O_SSEC, offset, op, object::row, part_entry::size, spell, part_entry::sysind, object::type, typing, and world.

void m_modify int  ev,
object_t op
 

Definition at line 1250 of file autopart.c.

References ACTIVE_FLAG, part_entry::bootind, check_existing(), check_ind(), cylinders, object::entry, event, heads, if(), L, LAST, lwithin(), magic, MAXSIZE, memset(), MINIX_PART, object::next, nextdevice(), nil, NO_PART, O_BASE, O_CYL, O_DEV, O_HEAD, O_KB, O_LCYL, O_LHEAD, O_LSEC, O_NUM, O_SCYL, O_SEC, O_SHEAD, O_SIZE, O_SSEC, O_TYPHEX, O_TYPTXT, op, recompute0(), round_sysind(), sectors, SIZE, part_entry::sysind, t, object::type, type, typing, within(), and world.

void m_move int  ev,
object_t op
 

Definition at line 1076 of file autopart.c.

References abs, object::col, event, object::flags, if(), object::next, nil, O_DEV, OF_MOD, op, object::row, switch(), object::type, and world.

void m_orientation int  ev,
object_t op
 

Definition at line 1061 of file autopart.c.

References LAST, SIZE, and strcpy().

void m_out int  ev,
object_t op
 

Definition at line 1597 of file autopart.c.

References close, curdev, dirty, diving, E_WRITE, event, extbase, free, nil, offset, diving::old0, diving::oldextbase, diving::oldoffset, diving::oldparttype, diving::oldsubname, op, device::parttype, submerged, device::subname, table, and diving::up.

void m_quit int  ev,
object_t op
 

Definition at line 2032 of file autopart.c.

References dirty, E_WRITE, event, and op.

void m_read int  ev,
int *  biosdrive
 

Definition at line 1830 of file autopart.c.

References boot_readwrite(), bootblock, close, curdev, DIOCTIMEOUT, existing, ext_part, extbase, fflush(), HZ, installboot(), ioctl, part_entry::lowsec, MASTERBOOT, memcpy(), memset(), device::name, NO_PART, O_RDWR, offset, open, open_ct_ok(), PART_TABLE_OFF, printf, r, SECTOR_SIZE, stat_end(), stat_start(), stdout, device::subname, part_entry::sysind, and table.

Referenced by do_autopart(), and select_disk().

void m_redraw int  ev,
object_t op
 

Definition at line 1032 of file autopart.c.

References clear_screen(), ctrl, object::next, nil, object::value, and world.

void m_shell int  ev,
object_t op
 

Definition at line 1962 of file autopart.c.

References close, ctrl, errno, event, execl, exit(), fflush(), fork, int(), nil, op, pid, printf, r, reset_tty(), SIG_IGN, SIGINT, signal(), SIGQUIT, SIGTERM, stat_end(), stat_start(), status, stdout, strerror(), tty_raw(), wait, WEXITSTATUS, and WIFEXITED.

void m_toggle int  ev,
object_t op
 

Definition at line 1043 of file autopart.c.

References alt_cyls, alt_heads, alt_secs, cylinders, dirty, heads, recompute0(), sectors, and t.

void m_updown int  ev,
object_t op
 

Definition at line 1127 of file autopart.c.

References ctrl, dirty, event, existing, j, nil, op, sort(), table, and tmp.

void m_write int  ev,
object_t op
 

Definition at line 1910 of file autopart.c.

References c, curdev, dirty, E_WRITE, extbase, memcpy(), memset(), NO_PART, NR_PARTITIONS, printf, stat_end(), stat_start(), device::subname, part_entry::sysind, and table.

int main int  argc,
char **  argv
 

Definition at line 2716 of file autopart.c.

References curobj, key, newobject(), O_BASE, O_CYL, O_DEV, O_HEAD, O_INFO, O_KB, O_LCYL, O_LHEAD, O_LSEC, O_NUM, O_SCYL, O_SEC, O_SHEAD, O_SIZE, O_SORT, O_SSEC, O_SUB, O_TEXT, O_TYPHEX, O_TYPTXT, OF_MOD, op, r, size_last, strcmp, strrchr(), and table.

void mainloop void   ) 
 

Definition at line 2182 of file autopart.c.

References curobj, display(), event, key, keypress(), and stat_reset().

int may_kill_region void   ) 
 

Definition at line 2287 of file autopart.c.

References atoi, dirty, fflush(), fgets(), free_regions, IS_NO, is_sure(), IS_YES, isdigit, NO_PART, nr_partitions, nr_regions, NULL, printf, printregions(), r, regionize(), regions, stdin, table, region::tableno, and used_regions.

Referenced by select_region().

void newdevice char *  name,
int  scanning,
int  disk_only
 

Definition at line 316 of file autopart.c.

References alloc(), curdev, DEV_C0D0, DEV_FD0, DUNNO, firstdev, FLOPPY, major, minor, device::next, nil, perror(), device::prev, PRIMARY, device::rdev, S_ISBLK, st, stat::st_mode, stat::st_rdev, stat, strcpy(), and strlen().

Referenced by getdevices().

object_t* newobject objtype_t  type,
int  flags,
int  row,
int  col,
int  len
 

Definition at line 775 of file autopart.c.

References alloc(), nil, and world.

Referenced by main().

void newspell unsigned long  charm  ) 
 

Definition at line 1410 of file autopart.c.

References j, lowsec, O_BASE, size, spell, and table.

int nextdevice object_t op,
int  delta
 

Definition at line 1189 of file autopart.c.

References close, curdev, dirty, E_WRITE, event, major, device::next, offset, op, device::prev, device::rdev, and recompute0().

Referenced by m_modify(), and select_disk().

int open_ct_ok int  fd  ) 
 

Definition at line 107 of file autopart.c.

References c, DIOCOPENCT, ioctl, and printf.

Referenced by m_read(), and sanitycheck_failed().

int overlap unsigned long  sec  ) 
 

Definition at line 814 of file autopart.c.

References if(), lowsec, part_entry::lowsec, NO_PART, part_entry::size, part_entry::sysind, and table.

Referenced by print().

char* prettysizeprint int  kb  ) 
 

Definition at line 2199 of file autopart.c.

References MIN_REGION_SECTORS, and sprintf().

Referenced by printregions().

void print object_t op  ) 
 

Definition at line 834 of file autopart.c.

References ACTIVE_FLAG, aligned, part_entry::bootind, computed, curdev, curobj, cylinders, entry2base(), entry2last(), entry2size(), fields, FLOPPY, fp, heads, part_entry::lowsec, lowsec, memmove(), memset(), n, device::name, NO_PART, O_BASE, O_CYL, O_DEV, O_HEAD, O_INFO, O_KB, O_LCYL, O_LHEAD, O_LSEC, O_NUM, O_SCYL, O_SEC, O_SHEAD, O_SIZE, O_SORT, O_SSEC, O_SUB, O_TEXT, O_TYPHEX, O_TYPTXT, OF_BAD, OF_ODD, offset, op, overlap(), device::parttype, PRIMARY, putchr(), putstr(), rjust, secpcyl, sectors, set_cursor(), part_entry::size, SIZE, sort_index, sprintf(), strcmp, strcpy(), strlen(), device::subname, SUBPART, part_entry::sysind, t, t_md, t_me, t_se, t_so, table, tputs(), typ2txt(), type, object::type, and field::type.

void printregions region_t theregions,
int  indent,
int  p_nr_partitions,
int  p_free_regions,
int  p_nr_regions,
int  numbers
 

Definition at line 2220 of file autopart.c.

References col(), prettysizeprint(), printf, r, reg, typ2txt(), and type2col().

Referenced by may_kill_region(), and select_region().

static void printstep int  step,
char *  message
[static]
 

Definition at line 2406 of file autopart.c.

References printf.

Referenced by do_autopart(), select_disk(), and select_region().

void putchr int  c  ) 
 

Definition at line 190 of file autopart.c.

References putchar.

Referenced by check_existing(), clear_screen(), m_write(), print(), putstr(), reset_tty(), set_cursor(), stat_end(), and stat_start().

void putstr char *  s  ) 
 

Definition at line 195 of file autopart.c.

References c, and putchr().

Referenced by check_existing(), m_help(), m_write(), print(), and stat_reset().

void recompute0 void   ) 
 

Definition at line 487 of file autopart.c.

References cylinders, heads, long(), memset(), MINIX_PART, NO_PART, offset, precise, secpcyl, sectors, and table.

Referenced by do_autopart(), geometry(), m_modify(), m_toggle(), and nextdevice().

void regionize void   ) 
 

Definition at line 1749 of file autopart.c.

References curdev, exit(), free_regions, lowsec, device::name, NO_PART, nr_partitions, nr_regions, printf, sectors, sort(), sort_order, table, and used_regions.

Referenced by may_kill_region().

void report const char *  label  ) 
 

Definition at line 121 of file autopart.c.

References errno, fprintf(), stderr, and strerror().

void reset_tty void   ) 
 

Definition at line 252 of file autopart.c.

References putchr(), restore_ttyflags(), set_cursor(), statusrow, t_cd, and tputs().

Referenced by alloc(), and m_shell().

void restore_ttyflags void   ) 
 

Definition at line 140 of file autopart.c.

References fatal(), TCSANOW, tcsetattr, and termios.

Referenced by reset_tty().

int round_sysind int  ind,
int  delta
 

Definition at line 720 of file autopart.c.

References arraylimit, indicators::ind, and ind_table.

Referenced by m_modify().

int sanitycheck_failed char *  dev,
struct part_entry pe
 

Definition at line 2546 of file autopart.c.

References close, DIOCGETP, div64u(), fprintf(), ioctl, part_entry::lowsec, O_RDONLY, open, open_ct_ok(), part, perror(), printf, SECTOR_SIZE, part_entry::size, and stderr.

void save_ttyflags void   ) 
 

Definition at line 134 of file autopart.c.

References fatal(), tcgetattr, and termios.

Referenced by init_tty().

int scribble_region region_t reg,
struct part_entry **  pe,
int *  made_new
 

Definition at line 2497 of file autopart.c.

References changed, cylinderalign(), ex, exit(), part_entry::lowsec, MAX_REGION_MB, MAX_REGION_SECTORS, MINIX_PART, NO_PART, printf, reg, part_entry::size, part_entry::sysind, and table.

Referenced by do_autopart().

device_t* select_disk void   ) 
 

Definition at line 2415 of file autopart.c.

References device::biosdrive, biosdrive, curdev, devices, done, fflush(), firstdev, free_regions, m_read(), MAX_DEVICES, memcpy(), nextdevice(), nr_partitions, nr_regions, NULL, printf, printstep(), regions, stdout, table, and used_regions.

Referenced by do_autopart().

region_t* select_region void   ) 
 

Definition at line 2336 of file autopart.c.

References done, exit(), fflush(), fgets(), free_regions, may_kill_region(), nr_partitions, nr_regions, NULL, printf, printregions(), printstep(), r, reg, regions, rem, SORNOT, sscanf(), stdin, strcmp, and warn.

Referenced by do_autopart().

void set_cursor int  row,
int  col
 

Definition at line 202 of file autopart.c.

References putchr(), t_cm, tgoto(), and tputs().

Referenced by abort_mined(), bottom_line(), change(), clear_screen(), delete(), display(), file_insert(), forward_scroll(), keypress(), move(), print(), PU(), RD(), reset_tty(), reverse_scroll(), S(), SD(), search(), SH(), stat_start(), SU(), and XT().

void sort void   ) 
 

Definition at line 442 of file autopart.c.

References i, j, NR_PARTITIONS, sort_order, sortbase(), and table.

unsigned long sortbase struct part_entry pe  ) 
 

Definition at line 437 of file autopart.c.

References part_entry::lowsec, NO_PART, and part_entry::sysind.

Referenced by sort().

void stat_end int  ktl  ) 
 

Definition at line 219 of file autopart.c.

References need_help, putchr(), stat_ktl, t_se, and tputs().

Referenced by check_existing(), geometry(), installboot(), m_dump(), m_help(), m_read(), m_shell(), and m_write().

void stat_reset void   ) 
 

Definition at line 227 of file autopart.c.

References need_help, putstr(), stat_ktl, stat_start(), STATUSROW, and statusrow.

Referenced by clear_screen(), and mainloop().

void stat_start int  serious  ) 
 

Definition at line 211 of file autopart.c.

References putchr(), set_cursor(), statusrow, t_cd, t_so, and tputs().

Referenced by check_existing(), geometry(), installboot(), m_dump(), m_help(), m_read(), m_shell(), m_write(), and stat_reset().

void tty_raw void   ) 
 

Definition at line 146 of file autopart.c.

References termios::c_lflag, ECHO, fatal(), ICANON, ICRNL, ISIG, TCSANOW, tcsetattr, and termios.

Referenced by init_tty(), and m_shell().

char* typ2txt int  ind  ) 
 

Definition at line 709 of file autopart.c.

References arraylimit, indicators::ind, ind_table, and indicators::name.

Referenced by print(), and printregions().

void type2col int  type  ) 
 

Definition at line 91 of file autopart.c.

References col(), COL_CYAN, COL_GREEN, COL_ORANGE, and MINIX_PART.

Referenced by printregions().

void warn char *  message  ) 
 

Definition at line 2281 of file autopart.c.

References printf.

int within unsigned *  var,
unsigned  low,
unsigned  value,
unsigned  high
 

Definition at line 1169 of file autopart.c.

Referenced by m_modify().


Variable Documentation

unsigned alt_cyls = 1
 

Definition at line 433 of file autopart.c.

Referenced by geometry(), guess_geometry(), and m_toggle().

unsigned alt_heads = 1
 

Definition at line 433 of file autopart.c.

Referenced by geometry(), guess_geometry(), and m_toggle().

unsigned alt_secs = 1
 

Definition at line 433 of file autopart.c.

Referenced by geometry(), guess_geometry(), and m_toggle().

int biosdrive
 

Definition at line 312 of file autopart.c.

Referenced by select_disk().

unsigned char bootblock[SECTOR_SIZE]
 

Definition at line 426 of file autopart.c.

Referenced by boot_readwrite(), and m_read().

unsigned char bootstrap[]
 

Initial value:

 {
0353,0001,0000,0061,0300,0216,0330,0216,0300,0372,0216,0320,0274,0000,0174,0373,
0275,0276,0007,0211,0346,0126,0277,0000,0006,0271,0000,0001,0374,0363,0245,0352,
0044,0006,0000,0000,0264,0002,0315,0026,0250,0010,0164,0033,0350,0071,0001,0174,
0007,0060,0344,0315,0026,0242,0205,0007,0054,0060,0074,0012,0163,0363,0120,0350,
0046,0001,0205,0007,0130,0353,0012,0240,0002,0006,0204,0300,0165,0003,0351,0147,
0000,0230,0262,0005,0366,0362,0262,0200,0000,0302,0210,0340,0120,0350,0234,0000,
0163,0003,0351,0147,0000,0130,0054,0001,0175,0003,0351,0141,0000,0276,0276,0175,
0211,0357,0271,0040,0000,0363,0245,0200,0301,0004,0211,0356,0215,0174,0020,0070,
0154,0004,0164,0016,0213,0135,0010,0053,0134,0010,0213,0135,0012,0033,0134,0012,
0163,0014,0212,0044,0206,0144,0020,0210,0044,0106,0071,0376,0162,0364,0211,0376,
0201,0376,0356,0007,0162,0326,0342,0322,0211,0356,0264,0020,0366,0344,0001,0306,
0200,0174,0004,0001,0162,0026,0353,0021,0204,0322,0175,0041,0211,0356,0200,0174,
0004,0000,0164,0013,0366,0004,0200,0164,0006,0350,0070,0000,0162,0053,0303,0203,
0306,0020,0201,0376,0376,0007,0162,0346,0350,0215,0000,0211,0007,0376,0302,0204,
0322,0174,0023,0315,0021,0321,0340,0321,0340,0200,0344,0003,0070,0342,0167,0355,
0350,0011,0000,0162,0350,0303,0350,0003,0000,0162,0146,0303,0211,0356,0214,0134,
0010,0214,0134,0012,0277,0003,0000,0122,0006,0127,0264,0010,0315,0023,0137,0007,
0200,0341,0077,0376,0306,0210,0310,0366,0346,0211,0303,0213,0104,0010,0213,0124,
0012,0367,0363,0222,0210,0325,0366,0361,0060,0322,0321,0352,0321,0352,0010,0342,
0210,0321,0376,0301,0132,0210,0306,0273,0000,0174,0270,0001,0002,0315,0023,0163,
0020,0200,0374,0200,0164,0011,0117,0174,0006,0060,0344,0315,0023,0163,0270,0371,
0303,0201,0076,0376,0175,0125,0252,0165,0001,0303,0350,0013,0000,0243,0007,0353,
0005,0350,0004,0000,0227,0007,0353,0376,0136,0255,0126,0211,0306,0254,0204,0300,
0164,0011,0264,0016,0273,0001,0000,0315,0020,0353,0362,0303,0057,0144,0145,0166,
0057,0150,0144,0077,0010,0000,0015,0012,0000,0116,0157,0156,0145,0040,0141,0143,
0164,0151,0166,0145,0015,0012,0000,0122,0145,0141,0144,0040,0145,0162,0162,0157,
0162,0040,0000,0116,0157,0164,0040,0142,0157,0157,0164,0141,0142,0154,0145,0040,
0000,0000,
}

Definition at line 394 of file autopart.c.

Referenced by exec_bootstrap().

device_t * curdev
 

Definition at line 306 of file autopart.c.

Referenced by do_autopart(), geometry(), m_in(), m_out(), m_read(), m_write(), newdevice(), nextdevice(), print(), regionize(), and select_disk().

object_t* curobj = nil
 

Definition at line 773 of file autopart.c.

Referenced by keypress(), m_enter(), main(), mainloop(), and print().

unsigned cylinders = 1
 

Definition at line 432 of file autopart.c.

Referenced by geometry(), m_modify(), m_toggle(), print(), recompute0(), setsize(), and w_init().

device_t* dev
 

Definition at line 310 of file autopart.c.

Referenced by boot_device(), calc_fs_parameters(), check_mknod(), common_open(), compare_geom(), devclose(), devio(), devopen(), do_amd_isabr(), do_close(), do_find_dev(), do_ioctl(), do_mount(), do_piix(), do_sis_isabr(), do_umount(), do_unpause(), do_via_isabr(), Draw_Info(), file_geom(), find_device(), free_proc(), freesp_inode(), fs_init(), fts_stat(), getsuper(), init_geom(), init_geometry_boot(), link_islink(), linked(), lock_dev(), main(), mcat(), mformat(), minfo(), mounted(), mpartition(), mtoolstest(), name2dev(), name_to_dev(), params2params(), pci_intel_init(), precmd(), probe_bus(), rahead(), read_super(), read_write(), rw_block(), rw_chunk(), set_def_format(), set_misc_flags(), set_openflags(), SimpleFileOpen(), and truncate_inode().

int device = -1
 

Definition at line 435 of file autopart.c.

struct { ... } devices[MAX_DEVICES] [static]
 

int dirty = 0
 

Definition at line 425 of file autopart.c.

Referenced by apply_add(), blkflush(), cache_reply(), check_ind(), chkdirzone(), exec_bootstrap(), flushall(), job_save_cache(), m_in(), m_out(), m_quit(), m_toggle(), m_updown(), m_write(), may_kill_region(), mpartition(), and nextdevice().

diving_t* diving = nil
 

Definition at line 1546 of file autopart.c.

Referenced by m_in(), and m_out().

int existing[1+NR_PARTITIONS]
 

Definition at line 428 of file autopart.c.

Referenced by check_existing(), m_read(), and m_updown().

unsigned long extbase = 0
 

Definition at line 429 of file autopart.c.

Referenced by aligned(), m_in(), m_magic(), m_out(), m_read(), and m_write().

unsigned long extsize
 

Definition at line 429 of file autopart.c.

Referenced by m_in(), and unzRepair().

device_t* firstdev = nil
 

Definition at line 306 of file autopart.c.

Referenced by newdevice(), and select_disk().

int free_regions
 

Definition at line 311 of file autopart.c.

int free_regions
 

Definition at line 303 of file autopart.c.

Referenced by may_kill_region(), regionize(), select_disk(), and select_region().

unsigned heads = 1
 

Definition at line 432 of file autopart.c.

indicators_t ind_table[]
 

Definition at line 671 of file autopart.c.

Referenced by round_sysind(), and typ2txt().

int magic
 

Definition at line 1028 of file autopart.c.

Referenced by check_exec(), dhcp_init(), file(), init_super(), m_enter(), m_magic(), m_modify(), main(), open_archive(), process(), read_super(), readfs(), and shutdown().

char MASTERBOOT[] = "/usr/mdec/masterboot" [static]
 

Definition at line 43 of file autopart.c.

Referenced by m_read().

int min_region_mb = 500
 

Definition at line 62 of file autopart.c.

int need_help = 1
 

Definition at line 209 of file autopart.c.

Referenced by stat_end(), and stat_reset().

int nordonly = 0
 

Definition at line 304 of file autopart.c.

Referenced by do_autopart().

int nr_partitions
 

Definition at line 311 of file autopart.c.

int nr_partitions = 0
 

Definition at line 303 of file autopart.c.

Referenced by may_kill_region(), regionize(), select_disk(), and select_region().

int nr_regions
 

Definition at line 311 of file autopart.c.

int nr_regions = 0
 

Definition at line 303 of file autopart.c.

Referenced by may_kill_region(), regionize(), select_disk(), and select_region().

int nspells
 

Definition at line 1407 of file autopart.c.

unsigned long offset = 0
 

Definition at line 429 of file autopart.c.

int precise = 0
 

Definition at line 434 of file autopart.c.

Referenced by geometry(), and recompute0().

int quitting = 0
 

Definition at line 2030 of file autopart.c.

region_t regions[NR_REGIONS]
 

Definition at line 313 of file autopart.c.

region_t regions[NR_REGIONS]
 

Definition at line 302 of file autopart.c.

Referenced by do_autopart(), may_kill_region(), select_disk(), and select_region().

unsigned secpcyl = 1
 

Definition at line 432 of file autopart.c.

Referenced by abs2dos(), cylinderalign(), print(), and recompute0().

unsigned sectors = 1
 

Definition at line 432 of file autopart.c.

int sectors
 

Definition at line 311 of file autopart.c.

char size_last[] = "Size"
 

Definition at line 1059 of file autopart.c.

Referenced by main().

char sort_index[1+NR_PARTITIONS]
 

Definition at line 431 of file autopart.c.

Referenced by print().

char sort_order[1+NR_PARTITIONS]
 

Definition at line 431 of file autopart.c.

Referenced by do_autopart(), regionize(), and sort().

unsigned long spell[3+4 *(1+NR_PARTITIONS)]
 

Definition at line 1406 of file autopart.c.

Referenced by m_magic(), and newspell().

int stat_ktl = 1
 

Definition at line 208 of file autopart.c.

Referenced by clear_screen(), stat_end(), and stat_reset().

int statusrow = STATUSROW
 

Definition at line 207 of file autopart.c.

Referenced by m_read(), reset_tty(), stat_reset(), and stat_start().

int submerged = 0
 

Definition at line 430 of file autopart.c.

Referenced by geometry(), m_in(), and m_out().

char t_cd[16]
 

Definition at line 159 of file autopart.c.

Referenced by clear_screen(), init_tty(), reset_tty(), and stat_start().

char t_cm[32]
 

Definition at line 159 of file autopart.c.

Referenced by init_tty(), and set_cursor().

int t_co
 

Definition at line 160 of file autopart.c.

Referenced by init_tty().

int t_li
 

Definition at line 160 of file autopart.c.

Referenced by init_tty().

char t_md[16]
 

Definition at line 159 of file autopart.c.

Referenced by init_tty(), m_help(), and print().

char t_me[16]
 

Definition at line 159 of file autopart.c.

Referenced by init_tty(), m_help(), and print().

char t_se[16]
 

Definition at line 159 of file autopart.c.

Referenced by init_tty(), m_help(), print(), and stat_end().

char t_so[16]
 

Definition at line 159 of file autopart.c.

Referenced by init_tty(), m_help(), print(), and stat_start().

struct part_entry table[1+NR_PARTITIONS]
 

Definition at line 427 of file autopart.c.

struct termios termios
 

Definition at line 132 of file autopart.c.

Referenced by DoTalk(), main(), option(), report(), restore_ttyflags(), save_ttyflags(), set_control(), set_min_tim(), tty_raw(), and will_option().

objtype_t touching
 

Definition at line 1408 of file autopart.c.

int typing
 

Definition at line 1027 of file autopart.c.

Referenced by m_enter(), m_magic(), and m_modify().

int used_regions
 

Definition at line 311 of file autopart.c.

int used_regions
 

Definition at line 303 of file autopart.c.

Referenced by may_kill_region(), regionize(), and select_disk().

object_t* world = nil
 

Definition at line 772 of file autopart.c.

Referenced by display(), m_magic(), m_modify(), m_move(), m_redraw(), and newobject().


Generated on Fri Apr 14 23:04:52 2006 for minix by  doxygen 1.4.6