diff options
Diffstat (limited to 'usr/src/common/fs/ufsops.c')
| -rw-r--r-- | usr/src/common/fs/ufsops.c | 48 |
1 files changed, 44 insertions, 4 deletions
diff --git a/usr/src/common/fs/ufsops.c b/usr/src/common/fs/ufsops.c index f440e85b1b..054d8a76e0 100644 --- a/usr/src/common/fs/ufsops.c +++ b/usr/src/common/fs/ufsops.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -628,6 +627,46 @@ bufs_lseek(int fd, off_t addr, int whence) return (0); } + +int +bufs_fstat(int fd, struct bootstat *stp) +{ + fileid_t *filep; + struct inode *ip; + + if (!(filep = find_fp(fd))) + return (-1); + + ip = filep->fi_inode; + + stp->st_mode = 0; + stp->st_size = 0; + + if (ip == NULL) + return (0); + + switch (ip->i_smode & IFMT) { + case IFLNK: + stp->st_mode = S_IFLNK; + break; + case IFREG: + stp->st_mode = S_IFREG; + break; + default: + break; + } + stp->st_size = ip->i_size; + stp->st_atim.tv_sec = ip->i_atime.tv_sec; + stp->st_atim.tv_nsec = ip->i_atime.tv_usec * 1000; + stp->st_mtim.tv_sec = ip->i_mtime.tv_sec; + stp->st_mtim.tv_nsec = ip->i_mtime.tv_usec * 1000; + stp->st_ctim.tv_sec = ip->i_ctime.tv_sec; + stp->st_ctim.tv_nsec = ip->i_ctime.tv_usec * 1000; + + return (0); +} + + static int bufs_close(int fd) { @@ -733,5 +772,6 @@ struct boot_fs_ops bufs_ops = { bufs_close, bufs_read, bufs_lseek, + bufs_fstat, NULL }; |
