Deleted Added
full compact
tmpfs_vnops.c (178243) tmpfs_vnops.c (182371)
1/* $NetBSD: tmpfs_vnops.c,v 1.39 2007/07/23 15:41:01 jmmv Exp $ */
2
3/*
4 * Copyright (c) 2005, 2006 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Julio M. Merino Vidal, developed as part of Google's Summer of Code

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

36 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37 * POSSIBILITY OF SUCH DAMAGE.
38 */
39
40/*
41 * tmpfs vnode interface.
42 */
43#include <sys/cdefs.h>
1/* $NetBSD: tmpfs_vnops.c,v 1.39 2007/07/23 15:41:01 jmmv Exp $ */
2
3/*
4 * Copyright (c) 2005, 2006 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Julio M. Merino Vidal, developed as part of Google's Summer of Code

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

36 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37 * POSSIBILITY OF SUCH DAMAGE.
38 */
39
40/*
41 * tmpfs vnode interface.
42 */
43#include <sys/cdefs.h>
44__FBSDID("$FreeBSD: head/sys/fs/tmpfs/tmpfs_vnops.c 178243 2008-04-16 11:33:32Z kib $");
44__FBSDID("$FreeBSD: head/sys/fs/tmpfs/tmpfs_vnops.c 182371 2008-08-28 15:23:18Z attilio $");
45
46#include <sys/param.h>
47#include <sys/fcntl.h>
48#include <sys/lockf.h>
49#include <sys/namei.h>
50#include <sys/priv.h>
51#include <sys/proc.h>
52#include <sys/resourcevar.h>

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

385/* XXX Should this operation be atomic? I think it should, but code in
386 * XXX other places (e.g., ufs) doesn't seem to be... */
387int
388tmpfs_setattr(struct vop_setattr_args *v)
389{
390 struct vnode *vp = v->a_vp;
391 struct vattr *vap = v->a_vap;
392 struct ucred *cred = v->a_cred;
45
46#include <sys/param.h>
47#include <sys/fcntl.h>
48#include <sys/lockf.h>
49#include <sys/namei.h>
50#include <sys/priv.h>
51#include <sys/proc.h>
52#include <sys/resourcevar.h>

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

385/* XXX Should this operation be atomic? I think it should, but code in
386 * XXX other places (e.g., ufs) doesn't seem to be... */
387int
388tmpfs_setattr(struct vop_setattr_args *v)
389{
390 struct vnode *vp = v->a_vp;
391 struct vattr *vap = v->a_vap;
392 struct ucred *cred = v->a_cred;
393 struct thread *l = v->a_td;
393 struct thread *td = curthread;
394
395 int error;
396
397 MPASS(VOP_ISLOCKED(vp));
398
399 error = 0;
400
401 /* Abort if any unsettable attribute is given. */
402 if (vap->va_type != VNON ||
403 vap->va_nlink != VNOVAL ||
404 vap->va_fsid != VNOVAL ||
405 vap->va_fileid != VNOVAL ||
406 vap->va_blocksize != VNOVAL ||
407 vap->va_gen != VNOVAL ||
408 vap->va_rdev != VNOVAL ||
409 vap->va_bytes != VNOVAL)
410 error = EINVAL;
411
412 if (error == 0 && (vap->va_flags != VNOVAL))
394
395 int error;
396
397 MPASS(VOP_ISLOCKED(vp));
398
399 error = 0;
400
401 /* Abort if any unsettable attribute is given. */
402 if (vap->va_type != VNON ||
403 vap->va_nlink != VNOVAL ||
404 vap->va_fsid != VNOVAL ||
405 vap->va_fileid != VNOVAL ||
406 vap->va_blocksize != VNOVAL ||
407 vap->va_gen != VNOVAL ||
408 vap->va_rdev != VNOVAL ||
409 vap->va_bytes != VNOVAL)
410 error = EINVAL;
411
412 if (error == 0 && (vap->va_flags != VNOVAL))
413 error = tmpfs_chflags(vp, vap->va_flags, cred, l);
413 error = tmpfs_chflags(vp, vap->va_flags, cred, td);
414
415 if (error == 0 && (vap->va_size != VNOVAL))
414
415 if (error == 0 && (vap->va_size != VNOVAL))
416 error = tmpfs_chsize(vp, vap->va_size, cred, l);
416 error = tmpfs_chsize(vp, vap->va_size, cred, td);
417
418 if (error == 0 && (vap->va_uid != VNOVAL || vap->va_gid != VNOVAL))
417
418 if (error == 0 && (vap->va_uid != VNOVAL || vap->va_gid != VNOVAL))
419 error = tmpfs_chown(vp, vap->va_uid, vap->va_gid, cred,
420 l);
419 error = tmpfs_chown(vp, vap->va_uid, vap->va_gid, cred, td);
421
422 if (error == 0 && (vap->va_mode != (mode_t)VNOVAL))
420
421 if (error == 0 && (vap->va_mode != (mode_t)VNOVAL))
423 error = tmpfs_chmod(vp, vap->va_mode, cred, l);
422 error = tmpfs_chmod(vp, vap->va_mode, cred, td);
424
425 if (error == 0 && ((vap->va_atime.tv_sec != VNOVAL &&
426 vap->va_atime.tv_nsec != VNOVAL) ||
427 (vap->va_mtime.tv_sec != VNOVAL &&
428 vap->va_mtime.tv_nsec != VNOVAL) ||
429 (vap->va_birthtime.tv_sec != VNOVAL &&
430 vap->va_birthtime.tv_nsec != VNOVAL)))
431 error = tmpfs_chtimes(vp, &vap->va_atime, &vap->va_mtime,
423
424 if (error == 0 && ((vap->va_atime.tv_sec != VNOVAL &&
425 vap->va_atime.tv_nsec != VNOVAL) ||
426 (vap->va_mtime.tv_sec != VNOVAL &&
427 vap->va_mtime.tv_nsec != VNOVAL) ||
428 (vap->va_birthtime.tv_sec != VNOVAL &&
429 vap->va_birthtime.tv_nsec != VNOVAL)))
430 error = tmpfs_chtimes(vp, &vap->va_atime, &vap->va_mtime,
432 &vap->va_birthtime, vap->va_vaflags, cred, l);
431 &vap->va_birthtime, vap->va_vaflags, cred, td);
433
434 /* Update the node times. We give preference to the error codes
435 * generated by this function rather than the ones that may arise
436 * from tmpfs_update. */
437 tmpfs_update(vp);
438
439 MPASS(VOP_ISLOCKED(vp));
440

--- 1042 unchanged lines hidden ---
432
433 /* Update the node times. We give preference to the error codes
434 * generated by this function rather than the ones that may arise
435 * from tmpfs_update. */
436 tmpfs_update(vp);
437
438 MPASS(VOP_ISLOCKED(vp));
439

--- 1042 unchanged lines hidden ---