Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!mit-eddie!uw-beaver!tikal!amc!ipmoea!ericr From: ericr@ipmoea.UUCP (Eric Roskos) Newsgroups: comp.os.minix Subject: Changes to compile Minix with MSC (fs changes: 2 of 12) Message-ID: <22@ipmoea.UUCP> Date: Sat, 8-Aug-87 20:00:00 EDT Article-I.D.: ipmoea.22 Posted: Sat Aug 8 20:00:00 1987 Date-Received: Tue, 11-Aug-87 05:24:33 EDT Reply-To: ericr@ipmoea.UUCP (Eric Roskos) Organization: Redmond, WA Lines: 212 Directory: /usr2/ericr/minix/minix/fs ------------------------------------------------------------ *** glo.h Sat Aug 1 13:38:24 1987 --- ../../dos/fs/glo.h Sat Aug 1 13:33:16 1987 *************** *** 6,11 EXTERN int reviving; /* number of pipe processes to be revived */ EXTERN file_pos rdahedpos; /* position to read ahead */ EXTERN struct inode *rdahed_inode; /* pointer to inode to read ahead */ /* The parameters of the call are kept here. */ EXTERN message m; /* the input message itself */ --- 6,12 ----- EXTERN int reviving; /* number of pipe processes to be revived */ EXTERN file_pos rdahedpos; /* position to read ahead */ EXTERN struct inode *rdahed_inode; /* pointer to inode to read ahead */ + EXTERN dev_nr root_dev; /* the root device number (major/minor) */ /* The parameters of the call are kept here. */ EXTERN message m; /* the input message itself */ ------------------------------------------------------------ *** main.c Sat Aug 1 13:38:22 1987 --- ../../dos/fs/main.c Sat Aug 1 13:33:13 1987 *************** *** 24,29 #define M64K 0xFFFF0000L /* 16 bit mask for DMA check */ #define INFO 2 /* where in data_org is info from build */ #define MAX_RAM 512 /* maxium RAM disk size in blocks */ /*===========================================================================* --- 24,30 ----- #define M64K 0xFFFF0000L /* 16 bit mask for DMA check */ #define INFO 2 /* where in data_org is info from build */ + #define ROOT_IDX 0 /* where in data_org kernel put boot-dev idx */ #define MAX_RAM 512 /* maxium RAM disk size in blocks */ /*===========================================================================* *************** *** 223,228 struct super_block *sp; block_nr i; phys_clicks ram_clicks, init_org, init_text_clicks, init_data_clicks; extern phys_clicks data_org[INFO + 2]; extern struct buf *get_block(); --- 224,231 ----- struct super_block *sp; block_nr i; phys_clicks ram_clicks, init_org, init_text_clicks, init_data_clicks; + int fLoadRam; + int ir; extern phys_clicks data_org[INFO + 2]; extern struct buf *get_block(); *************** *** 231,246 init_text_clicks = data_org[INFO + 1]; init_data_clicks = data_org[INFO + 2]; ! /* Get size of RAM disk by reading root file system's super block */ ! bp = get_block(BOOT_DEV, SUPER_BLOCK, NORMAL); /* get RAM super block */ ! copy(super_block, bp->b_data, sizeof(struct super_block)); ! sp = &super_block[0]; ! if (sp->s_magic != SUPER_MAGIC) ! panic("Diskette in drive 0 is not root file system", NO_NUM); ! count = sp->s_nzones << sp->s_log_zone_size; /* # blocks on root dev */ ! if (count > MAX_RAM) panic("RAM disk is too big. # blocks = ", count); ! ram_clicks = count * (BLOCK_SIZE/CLICK_SIZE); ! put_block(bp, FULL_DATA_BLOCK); /* Tell MM the origin and size of INIT, and the amount of memory used for the * system plus RAM disk combined, so it can remove all of it from the map. --- 234,242 ----- init_text_clicks = data_org[INFO + 1]; init_data_clicks = data_org[INFO + 2]; ! /* select root device based on user input to fsck - JER 7/29/87 */ ! /* get root-device index stored by kernel at end of main() init */ ! ir = data_org[ROOT_IDX]; if (ir == 0) root_dev = DEV_RAM; *************** *** 242,247 ram_clicks = count * (BLOCK_SIZE/CLICK_SIZE); put_block(bp, FULL_DATA_BLOCK); /* Tell MM the origin and size of INIT, and the amount of memory used for the * system plus RAM disk combined, so it can remove all of it from the map. */ --- 238,269 ----- /* get root-device index stored by kernel at end of main() init */ ir = data_org[ROOT_IDX]; + if (ir == 0) + root_dev = DEV_RAM; + else + root_dev = DEV_WINI + ir; + + /* if root device is ram disk, have to load ram from boot floppy */ + fLoadRam = (root_dev&0xff00)==DEV_RAM; + + if (fLoadRam) + { + /* Get size of RAM disk by reading root file system's super block */ + bp = get_block(BOOT_DEV, SUPER_BLOCK, NORMAL); /* get RAM super block */ + copy(super_block, bp->b_data, sizeof(struct super_block)); + sp = &super_block[0]; + if (sp->s_magic != SUPER_MAGIC) + panic("Diskette in drive 0 is not root file system", NO_NUM); + count = sp->s_nzones << sp->s_log_zone_size; /* # blocks on root dev */ + if (count > MAX_RAM) panic("RAM disk is too big. # blocks = ", count); + ram_clicks = count * (BLOCK_SIZE/CLICK_SIZE); + put_block(bp, FULL_DATA_BLOCK); + } + else + { + ram_clicks = RAM_MIN * (BLOCK_SIZE/CLICK_SIZE); + } + /* Tell MM the origin and size of INIT, and the amount of memory used for the * system plus RAM disk combined, so it can remove all of it from the map. */ *************** *** 260,277 m1.COUNT = count; if (sendrec(MEM, &m1) != OK) panic("Can't report size to MEM", NO_NUM); ! /* Copy the blocks one at a time from the root diskette to the RAM */ ! printf("Loading RAM disk from root diskette. Loaded: 0K "); ! for (i = 0; i < count; i++) { ! bp = get_block(BOOT_DEV, (block_nr) i, NORMAL); ! bp1 = get_block(ROOT_DEV, i, NO_READ); ! copy(bp1->b_data, bp->b_data, BLOCK_SIZE); ! bp1->b_dirt = DIRTY; ! put_block(bp, I_MAP_BLOCK); ! put_block(bp1, I_MAP_BLOCK); ! k_loaded = ( (long) i * BLOCK_SIZE)/1024L; /* K loaded so far */ ! if (k_loaded % 5 == 0) printf("\b\b\b\b\b%3DK %c", k_loaded, 0); ! } printf("\rRAM disk loaded. Please remove root diskette. \n\n"); } --- 282,301 ----- m1.COUNT = count; if (sendrec(MEM, &m1) != OK) panic("Can't report size to MEM", NO_NUM); ! if (fLoadRam) ! { ! /* Copy the blocks one at a time from the root diskette to the RAM */ ! printf("Loading RAM disk from root diskette. Loaded: 0K "); ! for (i = 0; i < count; i++) { ! bp = get_block(BOOT_DEV, (block_nr) i, NORMAL); ! bp1 = get_block(ROOT_DEV, i, NO_READ); ! copy(bp1->b_data, bp->b_data, BLOCK_SIZE); ! bp1->b_dirt = DIRTY; ! put_block(bp, I_MAP_BLOCK); ! put_block(bp1, I_MAP_BLOCK); ! k_loaded = ( (long) i * BLOCK_SIZE)/1024L; /* K loaded so far */ ! if (k_loaded % 5 == 0) printf("\b\b\b\b\b%3DK %c", k_loaded, 0); ! } printf("\rRAM disk loaded. Please remove root diskette. \n\n"); } *************** *** 273,279 if (k_loaded % 5 == 0) printf("\b\b\b\b\b%3DK %c", k_loaded, 0); } ! printf("\rRAM disk loaded. Please remove root diskette. \n\n"); } --- 297,304 ----- if (k_loaded % 5 == 0) printf("\b\b\b\b\b%3DK %c", k_loaded, 0); } ! printf("\rRAM disk loaded. Please remove root diskette. \n\n"); ! } } ------------------------------------------------------------ *** super.c Sat Aug 1 13:38:24 1987 --- ../../dos/fs/super.c Sat Aug 1 13:33:15 1987 *************** *** 22,27 #include "buf.h" #include "inode.h" #include "super.h" #define INT_BITS (sizeof(int)<<3) #define BIT_MAP_SHIFT 13 /* (log2 of BLOCK_SIZE) + 3; 13 for 1k blocks */ --- 22,28 ----- #include "buf.h" #include "inode.h" #include "super.h" + #include "glo.h" #define INT_BITS (sizeof(int)<<3) #define BIT_MAP_SHIFT 13 /* (log2 of BLOCK_SIZE) + 3; 13 for 1k blocks */