hcj@lzaz.ATT.COM (HC Johnson) (03/13/89)
Changes for the kernel with rs232:
cu.c:
Added restoring terminal modes after ~%local ~%xmodem.
login.c:
Added setting the terminal speed. Change the speed line
to yours terminials speed. Sorry, it cant be a parameter,
but login gets no arguments.
mkfs.c:
Added support for HAVENEWFLOP.
stfloppy.c:
read after write was broken. Fixed, thanks to Ken Lightbody.
Changes to rstty.c and rs232.c were posted yesterday. You need them.
Also being posted, a new format.c for use with HAVENEWFLOP.
Howard C. Johnson
ATT Bell Labs
att!lzaz!hcj
hcj@lzaz.att.com
================CUT HERE=======================================
*** /npp/export/commands/cu/cu.c Thu Feb 18 09:47:38 1989
--- cu.c Thu Mar 13 09:55:21 1989
***************
*** 691,702 ****
--- 691,708 ----
kill(child, SIGKILL);
wait((char *)0);
+ /* restore the terminal */
+ mode(ORIGATT);
+
recfork(cmd);
wait((char *)0);
kill(child, SIGKILL);
wait((char *)0);
+ /* set terminal line attributes for cu */
+ mode(RAWMOD);
+ mode(CUMOD);
recfork("rec");
***************
*** 721,732 ****
--- 727,743 ----
kill(child, SIGKILL);
wait((char *)0);
+ /* restore the terminal */
+ mode(ORIGATT);
recfork(cmd);
wait((char *)0);
kill(child, SIGKILL);
wait((char *)0);
+ /* set terminal line attributes for cu */
+ mode(RAWMOD);
+ mode(CUMOD);
recfork("rec");
***************
*** 879,887 ****
case ORIGATT:
(void)ioctl(TTYIN, TCSETAW, &tv0);
- ioctl(rlfd, TCSETDTR, 0x5L);
- sleep(1);
- ioctl(rlfd, TCSETDTR, 0xaL);
break;
case CUMOD:
--- 890,895 ----
***************
*** 1089,1094 ****
--- 1097,1105 ----
if (_debug == YES) say("call hangup(%d)\r\n", arg);
#endif
mode(ORIGATT);
+ ioctl(rlfd, TCSETDTR, 0x5L);
+ sleep(1);
+ ioctl(rlfd, TCSETDTR, 0xaL);
printf("Exit(%d)\n",arg);
exit(0);
exit( arg ); /* restore users prior tty status */
*** login.c Thu Mar 13 10:34:26 1989
--- /usr/src/commands/login.c Thu Jan 17 23:18:50 1989
***************
*** 16,21 ****
--- 16,23 ----
struct sgttyb args;
struct passwd *pwd, *getpwnam();
+ args.sg_ispeed = B2400;
+
args.sg_kill = '@';
args.sg_erase = '\b';
args.sg_flags = 06030;
***************
*** 63,65 ****
--- 65,67 ----
*** mkfs.c Thu Mar 13 10:38:02 1989
--- /usr/src/commands/mkfs.c Thu Mar 13 08:44:30 1989
***************
*** 69,75 ****
long lseek();
char gwarning[] = {65,46,83,46,84,97,110,101,110,98,97,117,109,10};
!
/*================================================================
* mkfs - make filesystem
--- 69,102 ----
long lseek();
char gwarning[] = {65,46,83,46,84,97,110,101,110,98,97,117,109,10};
! #if HAVENEWFLOP
! /*
! * Block 0 of a TOS media -- from tos.c
! * (media : floppy diskette or hard disk partion)
! * Contains media description and boot code
! */
! struct block0 {
! unsigned char b0_res0[8];
! unsigned char b0_serial[3];
! unsigned char b0_bps[2];
! unsigned char b0_spc;
! unsigned char b0_res[2];
! unsigned char b0_nfats;
! unsigned char b0_ndirs[2];
! unsigned char b0_nsects[2];
! unsigned char b0_media;
! unsigned char b0_spf[2];
! unsigned char b0_spt[2];
! unsigned char b0_nsides[2];
! unsigned char b0_nhid[2];
! unsigned char b0_code[0x1e2];
! };
! struct block0 block0;
! char buf[BLOCK_SIZE - sizeof(block0)];
!
! /* convert an 88-format short into a 68-format short */
! #define sh88tosh68(ch) ((short)(((ch)[1]<<8)|(ch)[0]))
! #endif
/*================================================================
* mkfs - make filesystem
***************
*** 84,89 ****
--- 111,118 ----
FILE *fopen();
long time(), ls;
struct stat statbuf;
+ char *cp;
+ char *index();
/* Get two times, the current time and the mod time of the binary of
***************
*** 103,108 ****
--- 132,138 ----
}
if (badusage) {
write(2, "Usage: mkfs [-ldt] special proto\n", 33);
+ write(2, " or: mkfs [-ldt] special blocks[:inodes]\n", 43);
exit(1);
}
while (--argc) {
***************
*** 146,155 ****
/* Maybe the prototype file is just a size. Check for that. */
blocks = atoi(argv[argc]);
! if (blocks < 4) pexit("Can't open prototype file");
!
! /* Ok, make simple file system of given size, using defaults. */
! inodes = (blocks/3) + 8; /* default is 3 blocks/file */
mode = 040777;
usrid = BIN;
grpid = BINGRP;
--- 176,197 ----
/* Maybe the prototype file is just a size. Check for that. */
blocks = atoi(argv[argc]);
!
! if (blocks < 4) pexit("Can't open prototype file");
! if ((blocks & 1) == 0) {
! printf("Blocks reduced by 1\n");
! blocks--;
! }
!
! /* Ok, make simple file system of given size, using defaults. */
! cp = index(argv[argc],':');
! if(cp) {
! inodes = atoi(++cp);
! if(inodes < 8)
! inodes = 8;
! } else
! inodes = (blocks/3) + 8; /* default is 3 blocks/file */
! printf("block=%d inodes=%d\n",blocks,inodes);
mode = 040777;
usrid = BIN;
grpid = BINGRP;
***************
*** 165,176 ****
} /* end switch */
} /* end while */
!
#ifdef UNIX
if (!donttest) {
static short testb[BLOCK_SIZE/sizeof(short)];
/* Try writing the last block of partition or diskette. */
ls = lseek(fd, ((long)blocks - 1L) * BLOCK_SIZE, 0);
testb[0] = 0x3245;
--- 207,233 ----
} /* end switch */
} /* end while */
! #if HAVENEWFLOP
! cache_init();
! lseek(fd, 0L , 0);
! i = read(fd, &block0, BLOCK_SIZE);
! if (i != BLOCK_SIZE )
! pexit("Fatal read error of block 0\n");
! #endif
!
#ifdef UNIX
if (!donttest) {
static short testb[BLOCK_SIZE/sizeof(short)];
+ #if HAVENEWFLOP
+ i = sh88tosh68(block0.b0_nsects) / 2;
+ if (blocks > i){
+ printf("blocks=%d i(nsects) = %d\n",blocks,i);
+ pexit("File system is too big for minor device");
+ }
+
+ #endif
/* Try writing the last block of partition or diskette. */
ls = lseek(fd, ((long)blocks - 1L) * BLOCK_SIZE, 0);
testb[0] = 0x3245;
***************
*** 192,201 ****
}
#endif
! /* make the file-system */
!
! cache_init();
! put_block (0, zero); /* Write a null boot block. */
zone_shift = 0; /* for future use */
zones = blocks >> zone_shift;
--- 249,276 ----
}
#endif
! #if HAVENEWFLOP
! /* Fix the boot block up.... */
!
! block0.b0_res0[0] = block0.b0_res0[1] = 0;
! for (i=0; i<6; i++) block0.b0_res0[i+2] = "MINIX "[i];
! block0.b0_spc = 0x80;
! block0.b0_nfats = 0;
! block0.b0_ndirs[0] = block0.b0_ndirs[1] = 0;
! block0.b0_spf[0] = block0.b0_spf[1] = 0;
! /*
! bzero(block0.b0_code, sizeof(block0.b0_code) + sizeof(buf));
! */
! for(i=0;i<sizeof(buf);i++)
! block0.b0_code[i] = 0;
!
! /* make the file-system */
!
! put_block (0, &block0); /* Write a new boot block. */
! #else
! cache_init();
! put_block (0, zero);
! #endif
zone_shift = 0; /* for future use */
zones = blocks >> zone_shift;
***************
*** 1136,1138 ****
--- 1211,1213 ----
*** ../../xminix/kernel/stfloppy.c Thu Feb 21 00:47:10 1989
--- stfloppy.c Thu Mar 12 23:35:02 1989
***************
*** 240,246 ****
#endif
#if RD_AFTER_WT
! PRIVATE char lbuffer[SECTOR_SIZE]; /* used for read after write */
/*===========================================================================*
* do_wtrd *
--- 240,246 ----
#endif
#if RD_AFTER_WT
! PRIVATE char lbuffer[SECTOR_SIZE * 2]; /* used for read after write */
/*===========================================================================*
* do_wtrd *
***************
*** 293,299 ****
mp->DEVICE = Device;
if((r=do_rdwt(mp)) < 0) {
printf("Read after write failed device=%x err cod=%d sz=%d pos=%ld\n",
! mp->DEVICE,r,position);
mp->ADDRESS = address;
mp->m_type = DISK_WRITE;
if(--retry)
--- 293,299 ----
mp->DEVICE = Device;
if((r=do_rdwt(mp)) < 0) {
printf("Read after write failed device=%x err cod=%d sz=%d pos=%ld\n",
! mp->DEVICE,r,xfer_size,position);
mp->ADDRESS = address;
mp->m_type = DISK_WRITE;
if(--retry)