Deleted Added
full compact
ffs_inode.c (34901) ffs_inode.c (34961)
1/*
2 * Copyright (c) 1982, 1986, 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)ffs_inode.c 8.13 (Berkeley) 4/21/95
1/*
2 * Copyright (c) 1982, 1986, 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)ffs_inode.c 8.13 (Berkeley) 4/21/95
34 * $Id: ffs_inode.c,v 1.38 1998/03/19 22:49:42 dyson Exp $
34 * $Id: ffs_inode.c,v 1.39 1998/03/26 20:53:49 phk Exp $
35 */
36
37#include "opt_quota.h"
38
39#include <sys/param.h>
40#include <sys/systm.h>
41#include <sys/mount.h>
42#include <sys/proc.h>

--- 31 unchanged lines hidden (view full) ---

74 struct timeval *access;
75 struct timeval *modify;
76 int waitfor;
77{
78 register struct fs *fs;
79 struct buf *bp;
80 struct inode *ip;
81 int error;
35 */
36
37#include "opt_quota.h"
38
39#include <sys/param.h>
40#include <sys/systm.h>
41#include <sys/mount.h>
42#include <sys/proc.h>

--- 31 unchanged lines hidden (view full) ---

74 struct timeval *access;
75 struct timeval *modify;
76 int waitfor;
77{
78 register struct fs *fs;
79 struct buf *bp;
80 struct inode *ip;
81 int error;
82 time_t tv_sec;
83
84 ip = VTOI(vp);
85 if (vp->v_mount->mnt_flag & MNT_RDONLY) {
86 ip->i_flag &=
87 ~(IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE);
88 return (0);
89 }
90 if (((ip->i_flag &
91 (IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE)) == 0) &&
92 (waitfor != MNT_WAIT))
93 return (0);
94 /*
82
83 ip = VTOI(vp);
84 if (vp->v_mount->mnt_flag & MNT_RDONLY) {
85 ip->i_flag &=
86 ~(IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE);
87 return (0);
88 }
89 if (((ip->i_flag &
90 (IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE)) == 0) &&
91 (waitfor != MNT_WAIT))
92 return (0);
93 /*
95 * Use a copy of the current time to get consistent timestamps
96 * (a_access and a_modify are sometimes aliases for &time).
97 *
98 * XXX in 2.0, a_access and a_modify are often pointers to the
99 * same copy of `time'. This is not as good. Some callers forget
100 * to make a copy; others make a copy too early (before the i/o
101 * has completed)...
102 *
103 * XXX there should be a function or macro for reading the time
104 * (e.g., some machines may require splclock()).
105 * XXX there are: they're called get{micro|nano}time
94 * XXX: Some callers make a copy too early (before the i/o has
95 * completed)...
106 */
96 */
107 tv_sec = time.tv_sec;
108 if (ip->i_flag & IN_ACCESS)
97 if (ip->i_flag & IN_ACCESS)
109 ip->i_atime =
110 (access == &time ? tv_sec : access->tv_sec);
98 ip->i_atime = access->tv_sec;
111 if (ip->i_flag & IN_UPDATE) {
99 if (ip->i_flag & IN_UPDATE) {
112 ip->i_mtime =
113 (modify == &time ? tv_sec : modify->tv_sec);
100 ip->i_mtime = modify->tv_sec;
114 ip->i_modrev++;
115 }
116 if (ip->i_flag & IN_CHANGE)
101 ip->i_modrev++;
102 }
103 if (ip->i_flag & IN_CHANGE)
117 ip->i_ctime = tv_sec;
104 ip->i_ctime = time_second;
118 ip->i_flag &= ~(IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE);
119 fs = ip->i_fs;
120 /*
121 * Ensure that uid and gid are correct. This is a temporary
122 * fix until fsck has been changed to do the update.
123 */
124 if (fs->fs_inodefmt < FS_44INODEFMT) { /* XXX */
125 ip->i_din.di_ouid = ip->i_uid; /* XXX */

--- 53 unchanged lines hidden (view full) ---

179 oip = VTOI(ovp);
180 if (oip->i_size == length)
181 return (0);
182 fs = oip->i_fs;
183 if (length < 0)
184 return (EINVAL);
185 if (length > fs->fs_maxfilesize)
186 return (EFBIG);
105 ip->i_flag &= ~(IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE);
106 fs = ip->i_fs;
107 /*
108 * Ensure that uid and gid are correct. This is a temporary
109 * fix until fsck has been changed to do the update.
110 */
111 if (fs->fs_inodefmt < FS_44INODEFMT) { /* XXX */
112 ip->i_din.di_ouid = ip->i_uid; /* XXX */

--- 53 unchanged lines hidden (view full) ---

166 oip = VTOI(ovp);
167 if (oip->i_size == length)
168 return (0);
169 fs = oip->i_fs;
170 if (length < 0)
171 return (EINVAL);
172 if (length > fs->fs_maxfilesize)
173 return (EFBIG);
187 gettime(&tv);
174 getmicrotime(&tv);
188 if (ovp->v_type == VLNK &&
189 (oip->i_size < ovp->v_mount->mnt_maxsymlinklen || oip->i_din.di_blocks == 0)) {
190#ifdef DIAGNOSTIC
191 if (length != 0)
192 panic("ffs_truncate: partial truncate of symlink");
193#endif
194 bzero((char *)&oip->i_shortlink, (u_int)oip->i_size);
195 oip->i_size = 0;

--- 357 unchanged lines hidden ---
175 if (ovp->v_type == VLNK &&
176 (oip->i_size < ovp->v_mount->mnt_maxsymlinklen || oip->i_din.di_blocks == 0)) {
177#ifdef DIAGNOSTIC
178 if (length != 0)
179 panic("ffs_truncate: partial truncate of symlink");
180#endif
181 bzero((char *)&oip->i_shortlink, (u_int)oip->i_size);
182 oip->i_size = 0;

--- 357 unchanged lines hidden ---