Deleted Added
full compact
vfs_vnops.c (50830) vfs_vnops.c (51111)
1/*
2 * Copyright (c) 1982, 1986, 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

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

31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)vfs_vnops.c 8.2 (Berkeley) 1/21/94
1/*
2 * Copyright (c) 1982, 1986, 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

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

31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)vfs_vnops.c 8.2 (Berkeley) 1/21/94
39 * $FreeBSD: head/sys/kern/vfs_vnops.c 50830 1999-09-03 05:16:59Z julian $
39 * $FreeBSD: head/sys/kern/vfs_vnops.c 51111 1999-09-09 19:08:44Z julian $
40 */
41
42#include <sys/param.h>
43#include <sys/systm.h>
44#include <sys/fcntl.h>
45#include <sys/file.h>
46#include <sys/stat.h>
47#include <sys/proc.h>

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

424 sb->st_nlink = vap->va_nlink;
425 sb->st_uid = vap->va_uid;
426 sb->st_gid = vap->va_gid;
427 sb->st_rdev = vap->va_rdev;
428 sb->st_size = vap->va_size;
429 sb->st_atimespec = vap->va_atime;
430 sb->st_mtimespec = vap->va_mtime;
431 sb->st_ctimespec = vap->va_ctime;
40 */
41
42#include <sys/param.h>
43#include <sys/systm.h>
44#include <sys/fcntl.h>
45#include <sys/file.h>
46#include <sys/stat.h>
47#include <sys/proc.h>

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

424 sb->st_nlink = vap->va_nlink;
425 sb->st_uid = vap->va_uid;
426 sb->st_gid = vap->va_gid;
427 sb->st_rdev = vap->va_rdev;
428 sb->st_size = vap->va_size;
429 sb->st_atimespec = vap->va_atime;
430 sb->st_mtimespec = vap->va_mtime;
431 sb->st_ctimespec = vap->va_ctime;
432 /*
433 * For block and char device nodes we don't really care
434 * about what the filesystem told us, we want to know
435 * what the device told us
432
433 /*
434 * According to www.opengroup.org, the meaning of st_blksize is
435 * "a filesystem-specific preferred I/O block size for this
436 * object. In some filesystem types, this may vary from file
437 * to file"
438 * Default to zero to catch bogus uses of this field.
436 */
439 */
437 switch (vap->va_type) {
438 case VBLK:
439 sb->st_blksize = vp->v_rdev->si_bsize_best;
440 break;
441 case VCHR:
442 sb->st_blksize = vp->v_rdev->si_bsize_max;
443 break;
444 default:
440
441 if (vap->va_type == VREG) {
445 sb->st_blksize = vap->va_blocksize;
442 sb->st_blksize = vap->va_blocksize;
446 break;
443 } else if ((vp->v_type == VBLK || vp->v_type == VCHR) &&
444 devsw(vp->v_rdev) && (devsw(vp->v_rdev)->d_flags & D_DISK)) {
445 /* XXX use vn_isdisk() above once VCHR is also disk */
446 sb->st_blksize = vp->v_rdev->si_bsize_best;
447 if (sb->st_blksize < vp->v_rdev->si_bsize_phys)
448 sb->st_blksize = vp->v_rdev->si_bsize_phys;
449 if (sb->st_blksize < BLKDEV_IOSIZE)
450 sb->st_blksize = BLKDEV_IOSIZE;
451 } else {
452 sb->st_blksize = 0;
447 }
453 }
454
448 sb->st_flags = vap->va_flags;
449 if (suser_xxx(p->p_ucred, 0, 0))
450 sb->st_gen = 0;
451 else
452 sb->st_gen = vap->va_gen;
453
454#if (S_BLKSIZE == 512)
455 /* Optimize this case */

--- 137 unchanged lines hidden ---
455 sb->st_flags = vap->va_flags;
456 if (suser_xxx(p->p_ucred, 0, 0))
457 sb->st_gen = 0;
458 else
459 sb->st_gen = vap->va_gen;
460
461#if (S_BLKSIZE == 512)
462 /* Optimize this case */

--- 137 unchanged lines hidden ---