Return to BSD News archive
Newsgroups: comp.bugs.2bsd
Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!nntp.coast.net!news.kei.com!newsfeed.internetmci.com!in1.uu.net!news.new-york.net!wlbr!sms
From: sms@wlv.iipo.gtegsc.com (Steven M. Schultz)
Subject: TU81 bug,statfs(2)+fstatfs(2)+getfsstat(2) missing, More (#285 3 of 4)
Sender: news@wlbr.iipo.gtegsc.com (Steven M. Schultz)
Organization: GTE Government Systems, Thousand Oaks CA USA
Message-ID: <DKAHDz.9L2@wlbr.iipo.gtegsc.com>
X-Nntp-Posting-Host: wlv.iipo.gtegsc.com
Date: Thu, 28 Dec 1995 09:08:22 GMT
Lines: 1352
Subject: TU81 bug,statfs(2)+fstatfs(2)+getfsstat(2) missing, More (#285 3 of 4)
Index: sys/pdpuba,pdp,sys 2.11BSD
Description:
See #283.
Repeat-By:
See #283.
Fix:
This is #285, part 3 of 4. Refer to #283 for installation instructions.
The following files are modified by this part of the update kit:
/usr/src/sys/h/errno.h
/usr/src/sys/h/fs.h
/usr/src/sys/h/inode.h
/usr/src/sys/h/mount.h
/usr/src/sys/h/mtio.h
/usr/src/sys/h/param.h
/usr/src/sys/pdp/conf.c
/usr/src/sys/pdp/machdep2.c
/usr/src/sys/pdp/tmscp.h
/usr/src/sys/sys/init_main.c
/usr/src/sys/sys/init_sysent.c
/usr/src/sys/sys/syscalls.c
/usr/src/sys/sys/ufs_mount.c
/usr/src/sys/sys/ufs_syscalls.c
--------------------------cut here---------------------------
*** /usr/src/sys/h/errno.h.old Sat Nov 26 21:25:30 1994
--- /usr/src/sys/h/errno.h Tue Dec 26 20:29:53 1995
***************
*** 3,14 ****
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
! * @(#)errno.h 7.1.1 (2.11BSD GTE) 11/26/94
*/
! /*
! * Error codes
! */
#define EPERM 1 /* Not owner */
#define ENOENT 2 /* No such file or directory */
--- 3,14 ----
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
! * @(#)errno.h 7.1.2 (2.11BSD GTE) 1995/12/26
*/
! #ifndef KERNEL
! extern int errno; /* global error number */
! #endif
#define EPERM 1 /* Not owner */
#define ENOENT 2 /* No such file or directory */
*** /usr/src/sys/h/fs.h.old Sat Nov 26 14:58:48 1994
--- /usr/src/sys/h/fs.h Tue Dec 26 17:38:14 1995
***************
*** 3,11 ****
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
! * @(#)fs.h 1.2 (2.11BSD GTE) 11/26/94
*/
/*
* The root inode is the root of the file system.
* Inode 0 can't be used for normal purposes and
--- 3,14 ----
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
! * @(#)fs.h 1.3 (2.11BSD GTE) 1995/12/24
*/
+ #ifndef _SYS_FS_H_
+ #define _SYS_FS_H_
+
/*
* The root inode is the root of the file system.
* Inode 0 can't be used for normal purposes and
***************
*** 36,42 ****
#define MAXMNTLEN 12
/*
! * Super block for a file system.
*/
struct fs
{
--- 39,47 ----
#define MAXMNTLEN 12
/*
! * Super block for a file system. NOTE: The 'fs_flock' and 'fs_ilock'
! * fields MUST be on an even byte boundary because they are used as sleep()
! * channels and odd values specify a network sleep().
*/
struct fs
{
***************
*** 47,54 ****
short fs_ninode; /* number of inodes in fs_inode */
ino_t fs_inode[NICINOD]; /* free inode list */
char fs_flock; /* lock during free list manipulation */
- char fs_ilock; /* lock during i-list manipulation */
char fs_fmod; /* super block modified flag */
char fs_ronly; /* mounted read-only flag */
time_t fs_time; /* last super block update */
daddr_t fs_tfree; /* total free blocks */
--- 52,59 ----
short fs_ninode; /* number of inodes in fs_inode */
ino_t fs_inode[NICINOD]; /* free inode list */
char fs_flock; /* lock during free list manipulation */
char fs_fmod; /* super block modified flag */
+ char fs_ilock; /* lock during i-list manipulation */
char fs_ronly; /* mounted read-only flag */
time_t fs_time; /* last super block update */
daddr_t fs_tfree; /* total free blocks */
***************
*** 127,129 ****
--- 132,135 ----
struct fs *getfs();
struct fs *mountfs();
#endif
+ #endif /* _SYS_FS_H_ */
*** /usr/src/sys/h/inode.h.old Fri Nov 25 23:26:41 1994
--- /usr/src/sys/h/inode.h Sun Dec 24 15:30:21 1995
***************
*** 3,9 ****
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
! * @(#)inode.h 1.3 (2.11BSD GTE) 11/25/94
*/
/*
--- 3,9 ----
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
! * @(#)inode.h 1.4 (2.11BSD GTE) 1995/12/24
*/
/*
***************
*** 167,172 ****
--- 167,173 ----
struct inode *rootdir; /* pointer to inode of root directory */
+ struct inode *getinode();
struct inode *ialloc();
struct inode *iget();
struct inode *owner();
*** /usr/src/sys/h/mount.h.old Sat Nov 26 14:57:36 1994
--- /usr/src/sys/h/mount.h Tue Dec 26 17:36:48 1995
***************
*** 3,12 ****
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
! * @(#)mount.h 7.2.1 (2.11BSD GTE) 11/26/94
*/
/*
* Mount structure.
* One allocated on every mount.
* Used to find the super block.
--- 3,42 ----
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
! * @(#)mount.h 7.2.2 (2.11BSD GTE) 1995/12/24
*/
/*
+ * file system statistics
+ */
+ #include <sys/fs.h>
+
+ #define MNAMELEN 90 /* length of buffer for returned name */
+
+ struct statfs {
+ short f_type; /* type of filesystem (see below) */
+ u_short f_flags; /* copy of mount flags */
+ short f_bsize; /* fundamental file system block size */
+ short f_iosize; /* optimal transfer block size */
+ daddr_t f_blocks; /* total data blocks in file system */
+ daddr_t f_bfree; /* free blocks in fs */
+ daddr_t f_bavail; /* free blocks avail to non-superuser */
+ ino_t f_files; /* total file nodes in file system */
+ ino_t f_ffree; /* free file nodes in fs */
+ long f_fsid[2]; /* file system id */
+ long f_spare[5]; /* spare for later */
+ char f_mntonname[MNAMELEN]; /* directory on which mounted */
+ char f_mntfromname[MNAMELEN];/* mounted filesystem */
+ };
+
+ /*
+ * File system types. Since only UFS is supported the others are not
+ * specified at this time.
+ */
+ #define MOUNT_NONE 0
+ #define MOUNT_UFS 1 /* Fast Filesystem */
+
+ /*
* Mount structure.
* One allocated on every mount.
* Used to find the super block.
***************
*** 15,25 ****
{
dev_t m_dev; /* device mounted */
struct fs m_filsys; /* superblock data */
! #define m_flags (m_filsys.fs_flags)
struct inode *m_inodp; /* pointer to mounted on inode */
struct inode *m_qinod; /* QUOTA: pointer to quota file */
};
/*
* Mount flags.
*/
--- 45,66 ----
{
dev_t m_dev; /* device mounted */
struct fs m_filsys; /* superblock data */
! #define m_flags m_filsys.fs_flags
struct inode *m_inodp; /* pointer to mounted on inode */
struct inode *m_qinod; /* QUOTA: pointer to quota file */
+ memaddr m_extern; /* click address of mount table extension */
};
+ struct xmount
+ {
+ char xm_mntfrom[MNAMELEN]; /* /dev/xxxx mounted from */
+ char xm_mnton[MNAMELEN]; /* directory mounted on - this is the
+ * full(er) version of fs_fsmnt.
+ */
+ };
+
+ #define XMOUNTDESC (((btoc(sizeof (struct xmount)) - 1) << 8) | RW)
+
/*
* Mount flags.
*/
***************
*** 28,33 ****
--- 69,84 ----
#define MNT_NOEXEC 0x00000004 /* can't exec from filesystem */
#define MNT_NOSUID 0x00000008 /* don't honor setuid bits on fs */
#define MNT_NODEV 0x00000010 /* don't interpret special files */
+ #define MNT_VISFLAGMASK 0x000000ff /* user visible flags */
+
+ /*
+ * Flags for various system call interfaces.
+ *
+ * These aren't used for anything in the system and are present only
+ * for source code compatibility reasons.
+ */
+ #define MNT_WAIT 1
+ #define MNT_NOWAIT 2
#if defined(KERNEL) && !defined(SUPERVISOR)
struct mount mount[NMOUNT];
*** /usr/src/sys/h/mtio.h.old Fri May 10 21:09:37 1991
--- /usr/src/sys/h/mtio.h Tue Dec 12 21:16:13 1995
***************
*** 3,9 ****
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
! * @(#)mtio.h 7.1 (Berkeley) 6/4/86
*/
/*
--- 3,9 ----
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
! * @(#)mtio.h 7.1.1 (2.11BSD) 1995/12/12
*/
/*
***************
*** 27,32 ****
--- 27,33 ----
#define MTNOP 7 /* no operation, sets status only */
#define MTCACHE 8 /* enable controller cache */
#define MTNOCACHE 9 /* disable controller cache */
+ #define MTFLUSH 10 /* flush cache */
/* structure for MTIOCGET - mag tape get status command */
***************
*** 55,60 ****
--- 56,73 ----
#define MT_ISCPC 0x06 /* SUN */
#define MT_ISAR 0x07 /* SUN */
#define MT_ISTMSCP 0x08 /* DEC TMSCP protocol (TU81, TK50) */
+
+ /*
+ * At present only the TMSCP driver reports this information in the
+ * high byte of the 'drive status' word. Other drives will (hopefully)
+ * be updated in the future.
+ */
+ #define MTF_BOM 0x01 /* At beginning of media */
+ #define MTF_EOM 0x02 /* At the end of media */
+ #define MTF_OFFLINE 0x04 /* Drive is offline */
+ #define MTF_WRTLCK 0x08 /* Drive is write protected */
+ #define MTF_WRITTEN 0x10 /* Tape has been written */
+ #define MTF_CSE 0x20 /* Clear serious exception done */
/* mag tape io control commands */
#define MTIOCTOP _IOW(m, 1, struct mtop) /* do a mag tape op */
*** /usr/src/sys/h/param.h.old Fri Dec 31 23:42:16 1993
--- /usr/src/sys/h/param.h Sun Dec 24 12:21:53 1995
***************
*** 3,9 ****
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
! * @(#)param.h 1.3 (2.11BSD GTE) 12/31/93
*/
#define BSD 211 /* 2.11 * 10, as cpp doesn't do floats */
--- 3,9 ----
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
! * @(#)param.h 1.4 (2.11BSD GTE) 1995/12/24
*/
#define BSD 211 /* 2.11 * 10, as cpp doesn't do floats */
***************
*** 13,18 ****
--- 13,20 ----
#else
#include <sys/localopts.h>
#endif
+
+ #include <sys/stddef.h> /* for 'offsetof' */
/*
* Machine type dependent parameters.
*** /usr/src/sys/pdp/conf.c.old Mon Jul 24 21:46:47 1995
--- /usr/src/sys/pdp/conf.c Tue Dec 26 16:34:27 1995
***************
*** 3,9 ****
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
! * @(#)conf.c 2.8 (2.11BSD GTE) 1995/07/24
*/
#include "param.h"
--- 3,9 ----
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
! * @(#)conf.c 2.9 (2.11BSD GTE) 1995/12/24
*/
#include "param.h"
***************
*** 545,550 ****
--- 545,551 ----
/* 24 */ NODEV,
/* 25 */ NODEV
};
+
/*
* Routine to convert from character to block device number.
*
***************
*** 559,561 ****
--- 560,587 ----
return (NODEV);
return (makedev(blkmaj, minor(dev)));
}
+
+ /*
+ * This routine returns the cdevsw[] index of the block device
+ * specified by the input parameter. Used by init_main and ufs_mount to
+ * find the diskdriver's ioctl entry point so that the label and partition
+ * information can be obtained for 'block' (instead of 'character') disks.
+ *
+ * Rather than create a whole separate table 'chrtoblktbl' is scanned
+ * looking for a match. This routine is only called a half dozen times during
+ * a system's life so efficiency isn't a big concern.
+ */
+
+ blktochr(dev)
+ register dev_t dev;
+ {
+ register int maj = major(dev);
+ register int i;
+
+ for (i = 0; i < MAXDEV; i++)
+ {
+ if (maj == chrtoblktbl[i])
+ return(i);
+ }
+ return(NODEV);
+ }
*** /usr/src/sys/pdp/machdep2.c.old Wed Nov 22 20:42:50 1995
--- /usr/src/sys/pdp/machdep2.c Sun Dec 24 12:39:33 1995
***************
*** 3,9 ****
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
! * @(#)machdep2.c 2.5 (2.11BSD GTE) 1995/11/22
*/
#include "param.h"
--- 3,9 ----
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
! * @(#)machdep2.c 2.6 (2.11BSD GTE) 1995/12/24
*/
#include "param.h"
***************
*** 31,36 ****
--- 31,37 ----
#include "tms.h"
#include "ingres.h"
#include "disklabel.h"
+ #include "mount.h"
#if NINGRES > 0
#include <sys/ingreslock.h>
***************
*** 79,85 ****
* lie at <= 0120000, or other kernel data will be mapped out.
*/
if (REMAP_AREA > SEG5)
! panic("remapped area > SEG5");
/*
* Zero and free all of core:
--- 80,86 ----
* lie at <= 0120000, or other kernel data will be mapped out.
*/
if (REMAP_AREA > SEG5)
! panic("remap > SEG5");
/*
* Zero and free all of core:
***************
*** 228,233 ****
--- 229,239 ----
msgbuf.msg_bufx = msgbuf.msg_bufr = 0;
#undef C
+ #define C (btoc(sizeof (struct xmount)))
+ for (i = 0; i < NMOUNT; i++)
+ mount[i].m_extern = (memaddr)malloc(coremap, C);
+ #undef C
+
#if NINGRES > 0
#define C (btoc(LOCKTABSIZE))
***************
*** 439,459 ****
register int error;
if (dumpdev != NODEV) {
! printf("\ndumping to dev %o, offset %D\ndump ",dumpdev,dumplo);
error = (*dump)(dumpdev);
switch(error) {
case EFAULT:
! printf("device not ready (EFAULT)\n");
break;
case EINVAL:
! printf("arguments invalid (EINVAL)\n");
break;
case EIO:
! printf("I/O error (EIO)\n");
break;
default:
! printf("unknown error (%d)\n",error);
break;
case 0:
printf("succeeded\n");
--- 445,465 ----
register int error;
if (dumpdev != NODEV) {
! printf("\ndumping to dev %o off %D\ndump ",dumpdev,dumplo);
error = (*dump)(dumpdev);
switch(error) {
case EFAULT:
! printf("dev !ready:EFAULT\n");
break;
case EINVAL:
! printf("args:EINVAL\n");
break;
case EIO:
! printf("err:EIO\n");
break;
default:
! printf("unknown err:%d\n",error);
break;
case 0:
printf("succeeded\n");
*** /usr/src/sys/pdp/tmscp.h.old Mon Jun 18 16:27:23 1990
--- /usr/src/sys/pdp/tmscp.h Thu Dec 14 21:17:04 1995
***************
*** 1,4 ****
! /* @(#)tmscp.h 7.1 (Berkeley) 6/5/86 */
/*
* @(#)tmscp.h 1.3 10/21/85
--- 1,4 ----
! /* @(#)tmscp.h 1.1 (2.11BSD) 1995/12/12 */
/*
* @(#)tmscp.h 1.3 10/21/85
***************
*** 31,36 ****
--- 31,41 ----
*
* Modification history: /sys/pdp/tmscp.h
*
+ * 12-Dec-95 - sms
+ * Begin process of moving definitions common to MSCP and TMSCP into
+ * a different include file. Define additional flags for the (heavily)
+ * revised TMSCP driver.
+ *
* 18-Oct-85 - afd
* Added: defines for tape format (density) flag values.
*
***************
*** 40,149 ****
************************************************************************/
/*
- * Control message opcodes
- */
- #define M_OP_ABORT 0001 /* Abort command */
- #define M_OP_GTCMD 0002 /* Get command status command */
- #define M_OP_GTUNT 0003 /* Get unit status command */
- #define M_OP_STCON 0004 /* Set controller characteristics command */
- #define M_OP_AVAIL 0010 /* Available command */
- #define M_OP_ONLIN 0011 /* Online command */
- #define M_OP_STUNT 0012 /* Set unit characteristics command */
- #define M_OP_DTACP 0013 /* Determine access paths command */
- #define M_OP_ACCES 0020 /* Access command */
- #define M_OP_CMPCD 0021 /* Compare controller data command */
- #define M_OP_ERASE 0022 /* Erase command */
- #define M_OP_FLUSH 0023 /* Flush command */
- #define M_OP_ERGAP 0026 /* Erase gap command */
- #define M_OP_COMP 0040 /* Compare host data command */
- #define M_OP_READ 0041 /* Read command */
- #define M_OP_WRITE 0042 /* Write command */
- #define M_OP_WRITM 0044 /* Write tape mark command */
- #define M_OP_REPOS 0045 /* Reposition command */
- #define M_OP_AVATN 0100 /* Available attention message */
- #define M_OP_DUPUN 0101 /* Duplicate unit number attention message */
- #define M_OP_ACPTH 0102 /* Access path attention message */
- #define M_OP_END 0200 /* End message flag */
-
-
- /*
- * Generic command modifiers
- */
- #define M_MD_COMP 0040000 /* Compare */
- #define M_MD_CLSEX 0020000 /* Clear serious exception */
- #define M_MD_SECOR 0001000 /* Suppress error correction */
- #define M_MD_SEREC 0000400 /* Suppress error recovery */
- #define M_MD_STWRP 0000004 /* Set write protect */
- #define M_MD_ALLCD 0000002 /* All class drivers */
- #define M_MD_NXUNT 0000001 /* Next unit */
-
- /*
- * TMSCP command modifiers
- */
- #define M_MD_DLEOT 0000200 /* Delete LEOT */
- #define M_MD_IMMED 0000100 /* Immediate completion */
- #define M_MD_EXCAC 0000040 /* Exclusive access */
- #define M_MD_UNLOD 0000020 /* Unload */
- #define M_MD_REVRS 0000010 /* reverse */
- #define M_MD_OBJCT 0000004 /* object count */
- #define M_MD_REWND 0000002 /* rewind */
-
- /*
- * End message flags
- */
- #define M_EF_ERLOG 0040 /* Error log generated */
- #define M_EF_SEREX 0020 /* Serious exception */
- #define M_EF_EOT 0010 /* End of tape encountered */
- #define M_EF_PLS 0004 /* Position lost */
-
-
- /*
- * Controller flags
- */
- #define M_CF_ATTN 0200 /* Enable attention messages */
- #define M_CF_MISC 0100 /* Enable miscellaneous error log messages */
- #define M_CF_OTHER 0040 /* Enable other host's error log messages */
- #define M_CF_THIS 0020 /* Enable this host's error log messages */
-
-
- /*
- * Unit flags
- */
- #define M_UF_WRTPH 0020000 /* Write protect (hardware) */
- #define M_UF_WRTPS 0010000 /* Write protect (software or volume) */
- #define M_UF_WBKNV 0000100 /* Write back (enables cache) */
- #define M_UF_VSMSU 0000040 /* Variable speed mode suppression */
- #define M_UF_VARSP 0000020 /* Variable speed unit */
- #define M_UF_CMPWR 0000002 /* Compare writes */
- #define M_UF_CMPRD 0000001 /* Compare reads */
-
-
- /*
- * Status codes
- */
- #define M_ST_MASK 037 /* Status code mask */
- #define M_ST_SUCC 000 /* Success */
- #define M_ST_ICMD 001 /* Invalid command */
- #define M_ST_ABRTD 002 /* Command aborted */
- #define M_ST_OFFLN 003 /* Unit offline */
- #define M_ST_AVLBL 004 /* Unit available */
- #define M_ST_WRTPR 006 /* Write protected */
- #define M_ST_COMP 007 /* Compare error */
- #define M_ST_DATA 010 /* Data error */
- #define M_ST_HSTBF 011 /* Host buffer access error */
- #define M_ST_CNTLR 012 /* Controller error */
- #define M_ST_DRIVE 013 /* Drive error */
- #define M_ST_FMTER 014 /* Formatter error */
- #define M_ST_BOT 015 /* BOT encountered */
- #define M_ST_TAPEM 016 /* Tape mark encountered */
- #define M_ST_RDTRN 020 /* Record data truncated */
- #define M_ST_PLOST 021 /* Position lost */
- #define M_ST_SEX 022 /* Serious exception */
- #define M_ST_LED 023 /* LEOT detected */
- #define M_ST_DIAG 037 /* Message from an internal diagnostic */
-
- /*
* An MSCP packet
*/
--- 45,53 ----
************************************************************************/
+ #include <machine/mscp_common.h>
+
/*
* An MSCP packet
*/
***************
*** 158,199 ****
short mscp_modifier; /* modifiers */
union {
struct {
! u_short Ms_bytecnt; /* byte count */
! u_short Ms_zzz2; /* 64kb max for pdp-11 */
! u_short Ms_buf_l; /* buffer descriptor low word */
! u_short Ms_buf_h; /* buffer descriptor high word */
! long Ms_xxx2[2]; /* unused */
! u_short Ms_lbn_l; /* logical block number low word */
! u_short Ms_lbn_h; /* logical block number high word */
! long Ms_xxx4; /* unused */
! long *Ms_dscptr; /* pointer to descriptor (software) */
! long Ms_sftwds[17];/* software words, padding */
! } mscp_generic;
struct {
! short Ms_version; /* MSCP version */
! short Ms_cntflgs; /* controller flags */
! short Ms_hsttmo; /* host timeout */
! short Ms_usefrac; /* use fraction */
! quad Ms_time; /* time and date */
! long Ms_cntdep; /* controller dependent parameters */
! } mscp_setcntchar;
struct {
! short Ms_multunt; /* multi-unit code */
! short Ms_unitflgs; /* unit flags */
! long Ms_hostid; /* host identifier */
! quad Ms_unitid; /* unit identifier */
! long Ms_mediaid; /* media type identifier */
! short Ms_format; /* format (tape density) */
! short Ms_speed; /* tape speed = (ips * bpi) /1000 */
! short Ms_fmtmenu; /* format menu */
! short Ms_group; /* group size */
! short Ms_cylinder; /* cylinder size */
! short Ms_xxx3; /* reserved */
! short Ms_rctsize; /* RCT table size */
! char Ms_rbns; /* RBNs / track */
! char Ms_rctcpys; /* RCT copies */
! } mscp_getunitsts;
! } mscp_un;
short m_filler[3];
};
--- 62,116 ----
short mscp_modifier; /* modifiers */
union {
struct {
! u_short bytecnt; /* byte count (low order) */
! u_short zzz2; /* 64kb max for pdp-11 (high order) */
! u_short buf_l; /* buffer descriptor low word */
! u_short buf_h; /* buffer descriptor high word */
! long xxx2[2]; /* unused */
! u_short lbn_l; /* logical block number low word */
! u_short lbn_h; /* logical block number high word */
! long xxx4; /* unused */
! /*
! * TMSCP only looks this far into the command packet. The 'dscptr' is 26
! * bytes offset from the start of the mscp structure and the 17 longwords of
! * padding are necessary to make this structure the same length as the longest
! * errorlog datagram received
! */
! long *dscptr; /* pointer to descriptor (software) */
! long sftwds[17]; /* software words, padding */
! } gen;
struct {
! short version; /* MSCP version */
! short cntflgs; /* controller flags */
! short hsttmo; /* host timeout */
! short usefrac; /* use fraction */
! u_long time[2]; /* time and date */
! long cntdep; /* controller dependent parameters */
! } scc;
struct {
! short multunt; /* multi-unit code */
! short unitflgs; /* unit flags */
! long hostid; /* host identifier */
! u_long unitid[2]; /* unit identifier */
! long mediaid; /* media type identifier */
! short format; /* format (tape density) */
! short speed; /* tape speed = (ips * bpi) /1000 */
! short fmtmenu; /* format menu */
! u_short maxwtrec; /* max write byte count */
! u_short noiserec; /* max noise record size */
! u_short pad; /* reserved */
! } gtu;
! /*
! * Reposition end message. Note: the shorts are not swapped in any
! * of the longs.
! */
! struct {
! u_long rcskiped; /* records skipped */
! u_long tmskiped; /* tapemarks skipped */
! u_long pad[2]; /* not used */
! u_long position; /* tape position */
! } rep_em;
! } un;
short m_filler[3];
};
***************
*** 203,217 ****
* generic packet
*/
! #define mscp_zzz2 mscp_un.mscp_generic.Ms_zzz2
! #define mscp_bytecnt mscp_un.mscp_generic.Ms_bytecnt
! #define mscp_buffer_h mscp_un.mscp_generic.Ms_buf_h
! #define mscp_buffer_l mscp_un.mscp_generic.Ms_buf_l
! #define mscp_lbn_h mscp_un.mscp_generic.Ms_lbn_h
! #define mscp_lbn_l mscp_un.mscp_generic.Ms_lbn_l
! #define mscp_dscptr mscp_un.mscp_generic.Ms_dscptr
! #define mscp_sftwds mscp_un.mscp_generic.Ms_sftwds
#define mscp_status mscp_modifier
/*
* Abort / Get Command Status packet
--- 120,135 ----
* generic packet
*/
! #define mscp_zzz2 un.gen.zzz2
! #define mscp_bytecnt un.gen.bytecnt
! #define mscp_buffer_h un.gen.buf_h
! #define mscp_buffer_l un.gen.buf_l
! #define mscp_lbn_h un.gen.lbn_h
! #define mscp_lbn_l un.gen.lbn_l
! #define mscp_dscptr un.gen.dscptr
#define mscp_status mscp_modifier
+ #define mscp_endcode mscp_opcode
+ #define mscp_position un.rep_em.position
/*
* Abort / Get Command Status packet
***************
*** 223,234 ****
* Set Controller Characteristics packet
*/
! #define mscp_version mscp_un.mscp_setcntchar.Ms_version
! #define mscp_cntflgs mscp_un.mscp_setcntchar.Ms_cntflgs
! #define mscp_hsttmo mscp_un.mscp_setcntchar.Ms_hsttmo
! #define mscp_usefrac mscp_un.mscp_setcntchar.Ms_usefrac
! #define mscp_time mscp_un.mscp_setcntchar.Ms_time
! #define mscp_cntdep mscp_un.mscp_setcntchar.Ms_cntdep
/*
* Reposition command packet fields
--- 141,151 ----
* Set Controller Characteristics packet
*/
! #define mscp_version un.scc.version
! #define mscp_cntflgs un.scc.cntflgs
! #define mscp_hsttmo un.scc.hsttmo
! #define mscp_time un.scc.time
! #define mscp_cntdep un.scc.cntdep
/*
* Reposition command packet fields
***************
*** 241,263 ****
* Get Unit Status end packet
*/
! #define mscp_multunt mscp_un.mscp_getunitsts.Ms_multunt
! #define mscp_unitflgs mscp_un.mscp_getunitsts.Ms_unitflgs
! #define mscp_hostid mscp_un.mscp_getunitsts.Ms_hostid
! #define mscp_unitid mscp_un.mscp_getunitsts.Ms_unitid
! #define mscp_mediaid mscp_un.mscp_getunitsts.Ms_mediaid
! #define mscp_format mscp_un.mscp_getunitsts.Ms_format /* density:0=high */
! #define mscp_speed mscp_un.mscp_getunitsts.Ms_speed /* (ips*bpi)/1000 */
! #define mscp_fmtmenu mscp_un.mscp_getunitsts.Ms_fmtmenu
/*
- * Online / Set Unit Characteristics end packet
- */
-
- #define mscp_maxwrt mscp_dscptr /* max write byte count */
- #define mscp_noiserec mscp_cylinder /* noise record */
-
- /*
* Set Controller Characteristics end packet
*/
--- 158,173 ----
* Get Unit Status end packet
*/
! #define mscp_multunt un.gtu.multunt
! #define mscp_unitflgs un.gtu.unitflgs
! #define mscp_hostid un.gtu.hostid
! #define mscp_unitid un.gtu.unitid
! #define mscp_mediaid un.gtu.mediaid
! #define mscp_format un.gtu.format /* density:0=high */
! #define mscp_speed un.gtu.speed /* (ips*bpi)/1000 */
! #define mscp_fmtmenu un.gtu.fmtmenu
/*
* Set Controller Characteristics end packet
*/
***************
*** 265,297 ****
#define mscp_cntcmdl mscp_usefrac /* controller soft & hardware version */
#define mscp_cntid mscp_unitid /* controller id */
-
/*
- * Error Log message format codes
- */
- #define M_FM_CNTERR 0 /* Controller error */
- #define M_FM_BUSADDR 1 /* Host memory access error */
- #define M_FM_TAPETRN 5 /* Tape transfer error */
- #define M_FM_STIERR 6 /* STI communication or command failure */
- #define M_FM_STIDEL 7 /* STI drive error log */
- #define M_FM_STIFEL 010 /* STI formatter error log */
-
- /*
- * Error Log message flags
- */
- #define M_LF_SUCC 0200 /* Operation successful */
- #define M_LF_CONT 0100 /* Operation continuing */
- #define M_LF_SQNRS 0001 /* Sequence number reset */
-
- /*
- * Tape Format Flag Values
- */
- #define M_TF_800 001 /* NRZI 800 bpi */
- #define M_TF_PE 002 /* Phase Encoded 1600 bpi */
- #define M_TF_GCR 004 /* Group Code Recording 6250 bpi */
- #define M_TF_BLK 010 /* Cartridge Block Mode */
-
- /*
* MSCP Error Log packet
*
* NOTE: MSCP packet must be padded to this size.
--- 175,181 ----
***************
*** 305,315 ****
u_char mslg_format; /* format */
u_char mslg_flags; /* error log message flags */
short mslg_event; /* event code */
! quad me_cntid; /* controller id */
u_char me_cntsvr; /* controller software version */
u_char me_cnthvr; /* controller hardware version */
short mslg_multunt; /* multi-unit code */
! quad me_unitid; /* unit id */
u_char me_unitsvr; /* unit software version */
u_char me_unithvr; /* unit hardware version */
short mslg_group; /* group; retry + level */
--- 189,199 ----
u_char mslg_format; /* format */
u_char mslg_flags; /* error log message flags */
short mslg_event; /* event code */
! u_char me_cntid[8]; /* controller id */
u_char me_cntsvr; /* controller software version */
u_char me_cnthvr; /* controller hardware version */
short mslg_multunt; /* multi-unit code */
! u_long me_unitid[2]; /* unit id */
u_char me_unitsvr; /* unit software version */
u_char me_unithvr; /* unit hardware version */
short mslg_group; /* group; retry + level */
***************
*** 322,324 ****
--- 206,267 ----
#define mslg_busaddr me_unitid.val[0]
#define mslg_sdecyl mslg_group
+
+ /*
+ * These definitions were moved here where they could be included by
+ * both the main driver and the tape crash dump module.
+ */
+
+ /*
+ * Per controller information structure.
+ */
+ struct tmscp_softc {
+ struct tmscpdevice *sc_addr; /* controller CSR address */
+ short sc_state; /* state of controller */
+ short sc_ivec; /* interrupt vector address */
+ short sc_unit; /* CONTROLLER number - NOT drive unit # */
+ short sc_credits; /* transfer credits */
+ short sc_lastcmd; /* pointer into command ring */
+ short sc_lastrsp; /* pointer into response ring */
+ struct buf sc_cmdbuf; /* internal command buffer */
+ struct buf sc_ctab; /* controller queue */
+ struct buf sc_wtab; /* I/O wait queue for controller */
+ struct tmscp *sc_com; /* communications area pointer */
+ struct tms_info *sc_drives[4]; /* pointers to per drive info */
+ };
+
+ /*
+ * The TMSCP packet. This is the same as MSCP except for the leading 't'
+ * in the structure member names. Eventually the two drivers will use a
+ * single definition.
+ */
+ struct tmscp {
+ struct tmscpca tmscp_ca; /* communications area */
+ struct mscp tmscp_rsp[NRSP]; /* response packets */
+ struct mscp tmscp_cmd[NCMD]; /* command packets */
+ }; /* 1896 bytes per controller! */
+
+ /*
+ * Per drive information structure.
+ */
+ struct tms_info {
+ long tms_type; /* Drive type field */
+ int tms_resid; /* residual from last xfer */
+ u_char tms_endcode; /* last command endcode */
+ u_char tms_flags; /* flags visible to user programs */
+ u_short tms_status; /* Command status from last command */
+ u_short Tflags; /* Internal driver flags */
+ short tms_fmtmenu; /* the unit's format (density) menu */
+ short tms_unitflgs; /* unit flag parameters */
+ short tms_format; /* unit's current format (density) */
+ long tms_position; /* Drive position */
+ struct buf tms_dtab; /* I/O tape drive queues */
+ };
+
+ /* Bits in minor device */
+ #define TMSUNIT(dev) (minor(dev)&03)
+ #define TMSCTLR(dev) ((minor(dev) >> 6) & 3)
+ #define TMSDENS(dev) ((minor(dev) >> 3) & 3)
+ #define FMTMASK (M_TF_800|M_TF_PE|M_TF_GCR) /* = 7 */
+
+ #define T_NOREWIND 04
*** /usr/src/sys/sys/init_main.c.old Mon May 22 20:20:55 1995
--- /usr/src/sys/sys/init_main.c Sun Dec 24 12:11:52 1995
***************
*** 3,9 ****
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
! * @(#)init_main.c 1.9 (2.11BSD GTE) 1995/05/22
*/
#include "param.h"
--- 3,9 ----
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
! * @(#)init_main.c 2.0 (2.11BSD GTE) 1995/12/24
*/
#include "param.h"
***************
*** 165,171 ****
* support labels and we proceed normally, otherwise the partition must be
* a swap partition (so that we do not swap on top of a filesystem by mistake).
*/
! ioctl = cdevsw[major(swapdev)].d_ioctl;
if (ioctl && !(*ioctl)(swapdev, DIOCGPART, (caddr_t)&dpart, FREAD))
{
if (dpart.part->p_fstype != FS_SWAP)
--- 165,171 ----
* support labels and we proceed normally, otherwise the partition must be
* a swap partition (so that we do not swap on top of a filesystem by mistake).
*/
! ioctl = cdevsw[blktochr(swapdev)].d_ioctl;
if (ioctl && !(*ioctl)(swapdev, DIOCGPART, (caddr_t)&dpart, FREAD))
{
if (dpart.part->p_fstype != FS_SWAP)
***************
*** 181,188 ****
if (!fs)
panic("iinit");
mount[0].m_inodp = (struct inode *)1; /* XXX */
! fs->fs_fsmnt[0] = '/';
! fs->fs_fsmnt[1] = '\0';
time.tv_sec = fs->fs_time;
if (toytime = toyclk())
time.tv_sec = toytime;
--- 181,187 ----
if (!fs)
panic("iinit");
mount[0].m_inodp = (struct inode *)1; /* XXX */
! mount_updname(fs, "/", "root", 1, 4);
time.tv_sec = fs->fs_time;
if (toytime = toyclk())
time.tv_sec = toytime;
*** /usr/src/sys/sys/init_sysent.c.old Mon May 8 22:38:37 1995
--- /usr/src/sys/sys/init_sysent.c Tue Dec 26 20:43:50 1995
***************
*** 3,9 ****
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
! * @(#)init_sysent.c 1.8 (2.11BSD GTE) 1995/05/08
*/
/*
--- 3,9 ----
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
! * @(#)init_sysent.c 1.9 (2.11BSD GTE) 1995/12/24
*/
/*
***************
*** 60,65 ****
--- 60,66 ----
int chown(),fchown(),chmod(),fchmod(),utimes();
int link(),symlink(),readlink(),rename();
int lseek(),truncate(),ftruncate(),saccess(),fsync();
+ int statfs(), fstatfs(), getfsstat();
/* 2.3 communications */
int socket(),bind(),listen(),accept(),connect();
***************
*** 134,142 ****
0, geteuid, /* 25 = geteuid */
4, ptrace, /* 26 = ptrace */
0, getppid, /* 27 = getppid */
! 0, nosys, /* 28 = old fstat */
! 0, nosys, /* 29 = old pause */
! 0, nosys, /* 30 = old utime */
0, nosys, /* 31 = was stty */
0, nosys, /* 32 = was gtty */
2, saccess, /* 33 = access */
--- 135,143 ----
0, geteuid, /* 25 = geteuid */
4, ptrace, /* 26 = ptrace */
0, getppid, /* 27 = getppid */
! 2, statfs, /* 28 = statfs */
! 2, fstatfs, /* 29 = fstatfs */
! 3, getfsstat, /* 30 = getfsstat */
0, nosys, /* 31 = was stty */
0, nosys, /* 32 = was gtty */
2, saccess, /* 33 = access */
*** /usr/src/sys/sys/syscalls.c.old Mon May 8 22:35:16 1995
--- /usr/src/sys/sys/syscalls.c Tue Dec 26 23:21:40 1995
***************
*** 3,9 ****
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
! * @(#)syscalls.c 1.5 (2.11BSD GTE) 1995/05/08
*/
/*
--- 3,9 ----
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
! * @(#)syscalls.c 1.6 (2.11BSD GTE) 1995/12/26
*/
/*
***************
*** 39,47 ****
"geteuid", /* 25 = geteuid */
"ptrace", /* 26 = ptrace */
"getppid", /* 27 = getppid */
! "old fstat - nosys", /* 28 = old fstat */
! "old pause", /* 29 = old pause */
! "old utime - nosys", /* 30 = old utime */
"old stty - nosys", /* 31 = old stty */
"old gtty - nosys", /* 32 = old gtty */
"access", /* 33 = access */
--- 39,47 ----
"geteuid", /* 25 = geteuid */
"ptrace", /* 26 = ptrace */
"getppid", /* 27 = getppid */
! "statfs", /* 28 = statfs */
! "fstatfs", /* 29 = fstatfs */
! "getfsstat", /* 30 = getfsstat */
"old stty - nosys", /* 31 = old stty */
"old gtty - nosys", /* 32 = old gtty */
"access", /* 33 = access */
*** /usr/src/sys/sys/ufs_mount.c.old Sun May 21 17:18:30 1995
--- /usr/src/sys/sys/ufs_mount.c Tue Dec 26 20:09:53 1995
***************
*** 3,9 ****
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
! * @(#)ufs_mount.c 1.5 (2.11BSD GTE) 1995/05/21
*/
#include "param.h"
--- 3,9 ----
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
! * @(#)ufs_mount.c 1.6 (2.11BSD GTE) 1995/12/24
*/
#include "param.h"
***************
*** 19,24 ****
--- 19,26 ----
#include "namei.h"
#include "conf.h"
#include "stat.h"
+ #include "disklabel.h"
+ #include "ioctl.h"
#ifdef QUOTA
#include "quota.h"
#endif
***************
*** 34,40 ****
register struct inode *ip;
register struct fs *fs;
register struct nameidata *ndp = &u.u_nd;
! u_int len;
u.u_error = getmdev(&dev, uap->fspec);
if (u.u_error)
--- 36,43 ----
register struct inode *ip;
register struct fs *fs;
register struct nameidata *ndp = &u.u_nd;
! u_int lenon, lenfrom;
! char mnton[MNAMELEN], mntfrom[MNAMELEN];
u.u_error = getmdev(&dev, uap->fspec);
if (u.u_error)
***************
*** 45,52 ****
ip = namei(ndp);
if (ip == NULL)
return;
! if (ip->i_count != 1) {
iput(ip);
u.u_error = EBUSY;
return;
}
--- 48,75 ----
ip = namei(ndp);
if (ip == NULL)
return;
! /*
! * This is a hack to update the 'from' field for the root filesystem. When
! * the kernel boots the string 'root_device' placed there as a place holder
! * until the "mount -a" is done from /etc/rc - at that time the name of the
! * root device is known and passed thru to here. If '/' is the directory
! * then only the 'from' and 'on' fields are updated.
! *
! * The following two copyinstr calls will not fault because getmdev() or
! * namei() would have returned an error for invalid parameters.
! */
! copyinstr(uap->freg, mnton, sizeof (mnton) - 1, &lenon);
! copyinstr(uap->fspec, mntfrom, sizeof (mntfrom) - 1, &lenfrom);
! if (mnton[0] == '/' && mnton[1] == '\0')
! {
iput(ip);
+ if (dev != mount[0].m_dev)
+ return(u.u_error = EINVAL);
+ fs = &mount[0].m_filsys;
+ goto updname;
+ }
+ if (ip->i_count != 1 || (ip->i_number == ROOTINO)) {
+ iput(ip);
u.u_error = EBUSY;
return;
}
***************
*** 55,72 ****
u.u_error = ENOTDIR;
return;
}
! if (ip->i_number == ROOTINO) {
! iput(ip);
! u.u_error = EBUSY;
! return;
! }
fs = mountfs(dev, uap->flags, ip);
if (fs == 0)
return;
! (void) copyinstr(uap->freg, fs->fs_fsmnt, sizeof(fs->fs_fsmnt)-1, &len);
! bzero(fs->fs_fsmnt + len, sizeof (fs->fs_fsmnt) - len);
}
/* this routine has races if running twice */
struct fs *
mountfs(dev, flags, ip)
--- 78,110 ----
u.u_error = ENOTDIR;
return;
}
!
fs = mountfs(dev, uap->flags, ip);
if (fs == 0)
return;
! updname:
! mount_updname(fs, mnton, mntfrom, lenon, lenfrom);
}
+ mount_updname(fs, on, from, lenon, lenfrom)
+ struct fs *fs;
+ char *on, *from;
+ int lenon, lenfrom;
+ {
+ struct mount *mp;
+ register struct xmount *xmp;
+
+ bzero(fs->fs_fsmnt, sizeof (fs->fs_fsmnt));
+ bcopy(on, fs->fs_fsmnt, sizeof (fs->fs_fsmnt) - 1);
+ mp = (struct mount *)((int)fs - offsetof(struct mount, m_filsys));
+ xmp = (struct xmount *)SEG5;
+ mapseg5(mp->m_extern, XMOUNTDESC);
+ bzero(xmp, sizeof (struct xmount));
+ bcopy(on, xmp->xm_mnton, lenon);
+ bcopy(from, xmp->xm_mntfrom, lenfrom);
+ normalseg5();
+ }
+
/* this routine has races if running twice */
struct fs *
mountfs(dev, flags, ip)
***************
*** 80,90 ****
--- 118,144 ----
register int error;
int ronly = flags & MNT_RDONLY;
int needclose = 0;
+ int (*ioctl)();
+ struct partinfo dpart;
error =
(*bdevsw[major(dev)].d_open)(dev, ronly ? FREAD : FREAD|FWRITE, S_IFBLK);
if (error)
goto out;
+ /*
+ * Now make a check that the partition is really a filesystem if the
+ * underlying driver supports disklabels (there is an ioctl entry point
+ * and calling it does not return an error).
+ */
+ ioctl = cdevsw[blktochr(dev)].d_ioctl;
+ if (ioctl && !(*ioctl)(dev, DIOCGPART, &dpart, FREAD))
+ {
+ if (dpart.part->p_fstype != FS_V71K)
+ {
+ error = EINVAL;
+ goto out;
+ }
+ }
needclose = 1;
tp = bread(dev, SBLOCK);
if (tp->b_flags & B_ERROR)
*** /usr/src/sys/sys/ufs_syscalls.c.old Wed Dec 7 22:15:11 1994
--- /usr/src/sys/sys/ufs_syscalls.c Sun Dec 24 15:30:35 1995
***************
*** 3,9 ****
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
! * @(#)ufs_syscalls.c 1.5 (2.11BSD GTE) 12/7/94
*/
#include "param.h"
--- 3,9 ----
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
! * @(#)ufs_syscalls.c 1.6 (2.11BSD GTE) 1995/12/24
*/
#include "param.h"
***************
*** 20,26 ****
#endif
static void copen();
- static struct inode *getinode();
/*
* Change current working directory (``.'').
--- 20,25 ----
***************
*** 1503,1509 ****
iput(ip);
}
! static struct inode *
getinode(fdes)
int fdes;
{
--- 1502,1508 ----
iput(ip);
}
! struct inode *
getinode(fdes)
int fdes;
{