SLIP needs nullmodem (and then lint is happy, too)
[unix-history] / usr / src / sys / kern / vfs_xxx.c
CommitLineData
da7c5cc6 1/*
0880b18e 2 * Copyright (c) 1982, 1986 Regents of the University of California.
da7c5cc6
KM
3 * All rights reserved. The Berkeley software License Agreement
4 * specifies the terms and conditions for redistribution.
5 *
0880b18e 6 * @(#)vfs_xxx.c 7.1 (Berkeley) %G%
da7c5cc6 7 */
2a9ead0d 8
94368568
JB
9#include "param.h"
10#include "systm.h"
11#include "inode.h"
12#include "fs.h"
13#include "mount.h"
14#include "dir.h"
15#include "user.h"
16#include "buf.h"
17#include "conf.h"
2a9ead0d 18
75a02b8d 19#ifdef COMPAT
94368568
JB
20#include "file.h"
21#include "kernel.h"
1139f919
SL
22
23/*
24 * Oh, how backwards compatibility is ugly!!!
25 */
26struct ostat {
27 dev_t ost_dev;
6a056086 28 u_short ost_ino;
1139f919
SL
29 u_short ost_mode;
30 short ost_nlink;
31 short ost_uid;
32 short ost_gid;
33 dev_t ost_rdev;
34 int ost_size;
35 int ost_atime;
36 int ost_mtime;
37 int ost_ctime;
38};
39
40/*
41 * The old fstat system call.
42 */
43ofstat()
44{
45 register struct file *fp;
46 register struct a {
47 int fd;
48 struct ostat *sb;
88a7a62a
SL
49 } *uap = (struct a *)u.u_ap;
50 extern struct file *getinode();
1139f919 51
88a7a62a 52 fp = getinode(uap->fd);
1139f919
SL
53 if (fp == NULL)
54 return;
88a7a62a 55 ostat1((struct inode *)fp->f_data, uap->sb);
1139f919
SL
56}
57
58/*
59 * Old stat system call. This version follows links.
60 */
61ostat()
62{
63 register struct inode *ip;
64 register struct a {
65 char *fname;
66 struct ostat *sb;
715baff1
KM
67 } *uap = (struct a *)u.u_ap;
68 register struct nameidata *ndp = &u.u_nd;
1139f919 69
715baff1
KM
70 ndp->ni_nameiop = LOOKUP | FOLLOW;
71 ndp->ni_segflg = UIO_USERSPACE;
72 ndp->ni_dirp = uap->fname;
73 ip = namei(ndp);
1139f919
SL
74 if (ip == NULL)
75 return;
76 ostat1(ip, uap->sb);
77 iput(ip);
78}
79
80ostat1(ip, ub)
81 register struct inode *ip;
82 struct ostat *ub;
83{
84 struct ostat ds;
85
86 IUPDAT(ip, &time, &time, 0);
87 /*
88 * Copy from inode table
89 */
90 ds.ost_dev = ip->i_dev;
91 ds.ost_ino = (short)ip->i_number;
92 ds.ost_mode = (u_short)ip->i_mode;
93 ds.ost_nlink = ip->i_nlink;
94 ds.ost_uid = (short)ip->i_uid;
95 ds.ost_gid = (short)ip->i_gid;
96 ds.ost_rdev = (dev_t)ip->i_rdev;
97 ds.ost_size = (int)ip->i_size;
98 ds.ost_atime = (int)ip->i_atime;
99 ds.ost_mtime = (int)ip->i_mtime;
100 ds.ost_ctime = (int)ip->i_ctime;
127f7d76 101 u.u_error = copyout((caddr_t)&ds, (caddr_t)ub, sizeof(ds));
1139f919 102}
02c45551
SL
103
104/*
105 * Set IUPD and IACC times on file.
106 * Can't set ICHG.
107 */
108outime()
109{
110 register struct a {
111 char *fname;
112 time_t *tptr;
113 } *uap = (struct a *)u.u_ap;
114 register struct inode *ip;
115 time_t tv[2];
116 struct timeval tv0, tv1;
117
715baff1 118 if ((ip = owner(uap->fname, FOLLOW)) == NULL)
02c45551
SL
119 return;
120 u.u_error = copyin((caddr_t)uap->tptr, (caddr_t)tv, sizeof (tv));
121 if (u.u_error == 0) {
122 ip->i_flag |= IACC|IUPD|ICHG;
123 tv0.tv_sec = tv[0]; tv0.tv_usec = 0;
124 tv1.tv_sec = tv[1]; tv1.tv_usec = 0;
125 iupdat(ip, &tv0, &tv1, 0);
126 }
127 iput(ip);
128}
1139f919 129#endif