MFS to PFS.
return(r);
}
-
-/*===========================================================================*
- * fs_newnode *
- *===========================================================================*/
-PUBLIC int fs_newnode()
-{
- register int r;
- mode_t bits;
- struct inode *rip;
-
- caller_uid = fs_m_in.REQ_UID;
- caller_gid = fs_m_in.REQ_GID;
- bits = fs_m_in.REQ_MODE;
-
- /* Try to allocate the inode */
- if( (rip = alloc_inode(fs_dev, bits) ) == NIL_INODE)
- return err_code;
-
- switch (bits & S_IFMT) {
- case S_IFBLK:
- case S_IFCHR:
- rip->i_zone[0] = fs_m_in.REQ_DEV; /* major/minor dev numbers*/
- break;
- }
-
- rw_inode(rip, WRITING); /* mark inode as allocated */
- rip->i_update = ATIME | CTIME | MTIME;
-
- /* Fill in the fields of the response message */
- fs_m_out.RES_INODE_NR = rip->i_num;
- fs_m_out.RES_MODE = rip->i_mode;
- fs_m_out.RES_FILE_SIZE_LO = rip->i_size;
- fs_m_out.RES_UID = rip->i_uid;
- fs_m_out.RES_GID = rip->i_gid;
- fs_m_out.RES_DEV = (dev_t) rip->i_zone[0];
-
- return(OK);
-}
-
-
/*===========================================================================*
* new_node *
*===========================================================================*/
_PROTOTYPE( int fs_inhibread, (void) );
_PROTOTYPE( int fs_mkdir, (void) );
_PROTOTYPE( int fs_mknod, (void) );
-_PROTOTYPE( int fs_newnode, (void) );
_PROTOTYPE( int fs_slink, (void) );
/* path.c */
PUBLIC _PROTOTYPE (int (*fs_call_vec[]), (void) ) = {
no_sys, /* 0 not used */
- no_sys, /* 1 */ /* Was: fs_getnode */
+ no_sys, /* 1 */ /* Was: fs_getnode */
fs_putnode, /* 2 */
fs_slink, /* 3 */
fs_ftrunc, /* 4 */
fs_lookup, /* 26 */
fs_mountpoint, /* 27 */
fs_readsuper, /* 28 */
- fs_newnode, /* 29 */
+ no_sys, /* 29 */ /* Was: fs_newnode */
fs_rdlink, /* 30 */
fs_getdents, /* 31 */
};
/* free, put at the front of the LRU list */
unhash_inode(rip);
rip->i_num = 0;
+ rip->i_dev = NO_DEV;
+ rip->i_rdev = NO_DEV;
TAILQ_INSERT_HEAD(&unused_inodes, rip, i_unused);
} else {
/* unused, put at the back of the LRU (cache it) */
/* The following items are not present on the disk. */
dev_t i_dev; /* which device is the inode on */
+ dev_t i_rdev; /* which special device is the inode on */
ino_t i_num; /* inode number on its (minor) device */
int i_count; /* # times inode used; 0 means slot is free */
char i_update; /* the ATIME, CTIME, and MTIME bits are here */
/* Try to allocate the inode */
if( (rip = alloc_inode(dev, bits) ) == NIL_INODE) return(err_code);
- if ((bits & S_IFMT) != S_IFIFO) {
- r = EIO; /* We only support pipes */
- } else if ((get_block(dev, rip->i_num)) == NIL_BUF)
- r = EIO;
+ switch (bits & S_IFMT) {
+ case S_IFBLK:
+ case S_IFCHR:
+ rip->i_rdev = dev; /* Major/minor dev numbers */
+ break;
+ case S_IFIFO:
+ if ((get_block(dev, rip->i_num)) == NIL_BUF)
+ r = EIO;
+ break;
+ default:
+ r = EIO; /* Unsupported file type */
+ }
if (r != OK) {
free_inode(rip);
cum_io = 0;
inumb = fs_m_in.REQ_INODE_NR;
rw_flag = (fs_m_in.m_type == REQ_READ ? READING : WRITING);
-#if 0
- printf("PFS: going to %s inode %d\n", (rw_flag == READING? "read from": "write to"), inumb);
-#endif
/* Find the inode referred */
if ((rip = find_inode(inumb)) == NIL_INODE) return(EINVAL);
)
{
/* Common code for stat and fstat system calls. */
-
+ mode_t type;
struct stat statbuf;
int r, s;
+ type = rip->i_mode & I_TYPE;
+ s = (type == I_CHAR_SPECIAL || type == I_BLOCK_SPECIAL);
+
/* Update the atime, ctime, and mtime fields in the inode, if need be. */
if (rip->i_update) update_times(rip);
statbuf.st_nlink = rip->i_nlinks;
statbuf.st_uid = rip->i_uid;
statbuf.st_gid = rip->i_gid;
- statbuf.st_rdev = (dev_t) 0;
+ statbuf.st_rdev = (dev_t) (s ? rip->i_rdev : NO_DEV);
statbuf.st_size = rip->i_size;
- statbuf.st_mode &= ~I_REGULAR; /* wipe out I_REGULAR bit for pipes */
+ if (!s) statbuf.st_mode &= ~I_REGULAR;/* wipe out I_REGULAR bit for pipes */
statbuf.st_atime = rip->i_atime;
statbuf.st_mtime = rip->i_mtime;
statbuf.st_ctime = rip->i_ctime;
struct node_details res;
/* A new minor device number has been returned.
- * Request the root FS to create a temporary device file to
- * hold it.
+ * Request PFS to create a temporary device file to hold it.
*/
/* Device number of the new device. */
dev = (dev & ~(BYTE << MINOR)) | (dev_mess.REP_STATUS << MINOR);
/* Issue request */
- r = req_newnode(ROOT_FS_E, fp->fp_effuid, fp->fp_effgid,
+ r = req_newnode(PFS_PROC_NR, fp->fp_effuid, fp->fp_effgid,
ALL_MODES | I_CHAR_SPECIAL, dev, &res);
if (r != OK) {
(void) clone_opcl(DEV_CLOSE, dev, proc_e, 0);
vp = fp->fp_filp[m_in.fd]->filp_vno;
vp->v_fs_e = res.fs_e;
- if ((vmp = find_vmnt(vp->v_fs_e)) == NIL_VMNT)
- printf("VFS clone_opcl: no vmnt found\n");
-
- vp->v_vmnt = vmp;
- vp->v_dev = vmp->m_dev;
+ vp->v_vmnt = NIL_VMNT;
+ vp->v_dev = NO_DEV;
vp->v_fs_e = res.fs_e;
vp->v_inode_nr = res.inode_nr;
vp->v_mode = res.fmode;
/* If a write has been done, the inode is already marked as DIRTY. */
if (--fp->filp_count == 0) {
if (vp->v_pipe == I_PIPE) {
- /* Last reader or writer is going. Tell MFS about latest
+ /* Last reader or writer is going. Tell PFS about latest
* pipe size.
*/
truncate_vnode(vp, vp->v_size);