2005-12-11 15:16:03 +03:00
|
|
|
/* $NetBSD: smbfs_node.c,v 1.26 2005/12/11 12:24:29 christos Exp $ */
|
2002-01-09 20:43:28 +03:00
|
|
|
|
2002-01-09 20:25:32 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2000-2001 Boris Popov
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by Boris Popov.
|
|
|
|
* 4. Neither the name of the author nor the names of any co-contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
2002-01-09 20:43:28 +03:00
|
|
|
* FreeBSD: src/sys/fs/smbfs/smbfs_node.c,v 1.5 2001/12/20 22:42:26 dillon Exp
|
2002-01-09 20:25:32 +03:00
|
|
|
*/
|
2003-02-25 12:09:31 +03:00
|
|
|
|
|
|
|
#include <sys/cdefs.h>
|
2005-12-11 15:16:03 +03:00
|
|
|
__KERNEL_RCSID(0, "$NetBSD: smbfs_node.c,v 1.26 2005/12/11 12:24:29 christos Exp $");
|
2003-02-25 12:09:31 +03:00
|
|
|
|
2002-01-09 20:25:32 +03:00
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
|
|
|
#include <sys/kernel.h>
|
|
|
|
#include <sys/lock.h>
|
|
|
|
#include <sys/malloc.h>
|
|
|
|
#include <sys/mount.h>
|
2002-01-09 20:43:28 +03:00
|
|
|
#include <sys/namei.h>
|
2002-01-09 20:25:32 +03:00
|
|
|
#include <sys/proc.h>
|
|
|
|
#include <sys/queue.h>
|
|
|
|
#include <sys/sysctl.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
#include <sys/vnode.h>
|
|
|
|
|
|
|
|
#include <netsmb/smb.h>
|
|
|
|
#include <netsmb/smb_conn.h>
|
|
|
|
#include <netsmb/smb_subr.h>
|
|
|
|
|
2002-01-09 20:43:28 +03:00
|
|
|
#include <uvm/uvm.h>
|
|
|
|
#include <uvm/uvm_extern.h>
|
2002-01-09 20:25:32 +03:00
|
|
|
|
|
|
|
#include <fs/smbfs/smbfs.h>
|
|
|
|
#include <fs/smbfs/smbfs_node.h>
|
|
|
|
#include <fs/smbfs/smbfs_subr.h>
|
|
|
|
|
|
|
|
#define SMBFS_NOHASH(smp, hval) (&(smp)->sm_hash[(hval) & (smp)->sm_hashlen])
|
2002-01-09 20:43:28 +03:00
|
|
|
#define smbfs_hash_lock(smp) lockmgr(&smp->sm_hashlock, LK_EXCLUSIVE, NULL)
|
|
|
|
#define smbfs_hash_unlock(smp) lockmgr(&smp->sm_hashlock, LK_RELEASE, NULL)
|
2002-01-09 20:25:32 +03:00
|
|
|
|
2003-04-02 20:26:53 +04:00
|
|
|
MALLOC_DEFINE(M_SMBNODENAME, "SMBFS nname", "SMBFS node name");
|
2002-01-09 20:25:32 +03:00
|
|
|
|
2005-08-30 23:01:29 +04:00
|
|
|
extern int (**smbfs_vnodeop_p)(void *);
|
2004-02-29 15:17:39 +03:00
|
|
|
extern int prtactive;
|
2002-01-09 20:25:32 +03:00
|
|
|
|
2005-06-28 13:30:37 +04:00
|
|
|
static const struct genfs_ops smbfs_genfsops = {
|
|
|
|
.gop_write = genfs_compat_gop_write,
|
2003-02-24 00:55:20 +03:00
|
|
|
};
|
|
|
|
|
2003-02-24 21:41:04 +03:00
|
|
|
struct pool smbfs_node_pool;
|
|
|
|
|
2003-02-24 00:33:06 +03:00
|
|
|
static inline char *
|
2002-01-09 20:25:32 +03:00
|
|
|
smbfs_name_alloc(const u_char *name, int nmlen)
|
|
|
|
{
|
|
|
|
u_char *cp;
|
|
|
|
|
|
|
|
cp = malloc(nmlen, M_SMBNODENAME, M_WAITOK);
|
2003-02-20 18:39:58 +03:00
|
|
|
memcpy(cp, name, nmlen);
|
|
|
|
|
2002-01-09 20:25:32 +03:00
|
|
|
return cp;
|
|
|
|
}
|
|
|
|
|
2003-02-24 00:33:06 +03:00
|
|
|
static inline void
|
2002-01-09 20:25:32 +03:00
|
|
|
smbfs_name_free(u_char *name)
|
|
|
|
{
|
|
|
|
free(name, M_SMBNODENAME);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
smbfs_node_alloc(struct mount *mp, struct vnode *dvp,
|
|
|
|
const char *name, int nmlen, struct smbfattr *fap, struct vnode **vpp)
|
|
|
|
{
|
|
|
|
struct smbmount *smp = VFSTOSMBFS(mp);
|
|
|
|
struct smbnode_hashhead *nhpp;
|
|
|
|
struct smbnode *np, *np2, *dnp;
|
|
|
|
struct vnode *vp;
|
|
|
|
u_long hashval;
|
|
|
|
int error;
|
|
|
|
|
2003-02-24 00:33:06 +03:00
|
|
|
/* do not allow allocating root vnode twice */
|
|
|
|
KASSERT(dvp != NULL || smp->sm_root == NULL);
|
|
|
|
/* do not call with dot */
|
|
|
|
KASSERT(nmlen != 1 || name[0] != '.');
|
|
|
|
|
2003-02-20 18:39:58 +03:00
|
|
|
if (nmlen == 2 && memcmp(name, "..", 2) == 0) {
|
2002-01-09 20:25:32 +03:00
|
|
|
if (dvp == NULL)
|
|
|
|
return EINVAL;
|
|
|
|
vp = VTOSMB(dvp)->n_parent->n_vnode;
|
2003-06-29 22:43:21 +04:00
|
|
|
if ((error = vget(vp, LK_EXCLUSIVE | LK_RETRY)) == 0)
|
2002-01-09 20:25:32 +03:00
|
|
|
*vpp = vp;
|
2003-02-24 00:33:06 +03:00
|
|
|
return (error);
|
2002-01-09 20:25:32 +03:00
|
|
|
}
|
2003-02-24 00:33:06 +03:00
|
|
|
|
2002-01-09 20:25:32 +03:00
|
|
|
dnp = dvp ? VTOSMB(dvp) : NULL;
|
2003-02-24 18:55:08 +03:00
|
|
|
#ifdef DIAGNOSTIC
|
|
|
|
if (dnp == NULL && dvp != NULL)
|
|
|
|
panic("smbfs_node_alloc: dead parent vnode %p", dvp);
|
|
|
|
#endif
|
2002-01-09 20:25:32 +03:00
|
|
|
hashval = smbfs_hash(name, nmlen);
|
|
|
|
retry:
|
2002-01-09 20:43:28 +03:00
|
|
|
smbfs_hash_lock(smp);
|
2002-01-09 20:25:32 +03:00
|
|
|
loop:
|
|
|
|
nhpp = SMBFS_NOHASH(smp, hashval);
|
|
|
|
LIST_FOREACH(np, nhpp, n_hash) {
|
2003-02-24 18:55:08 +03:00
|
|
|
if (np->n_parent != dnp
|
|
|
|
|| np->n_nmlen != nmlen
|
|
|
|
|| memcmp(name, np->n_name, nmlen) != 0)
|
2002-01-09 20:25:32 +03:00
|
|
|
continue;
|
2003-02-24 18:55:08 +03:00
|
|
|
vp = SMBTOV(np);
|
2003-02-18 23:00:35 +03:00
|
|
|
simple_lock(&(vp)->v_interlock);
|
2002-01-09 20:43:28 +03:00
|
|
|
smbfs_hash_unlock(smp);
|
2003-06-29 22:43:21 +04:00
|
|
|
if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK) != 0)
|
2002-01-09 20:25:32 +03:00
|
|
|
goto retry;
|
|
|
|
*vpp = vp;
|
2003-02-24 00:33:06 +03:00
|
|
|
return (0);
|
2002-01-09 20:25:32 +03:00
|
|
|
}
|
2002-01-09 20:43:28 +03:00
|
|
|
smbfs_hash_unlock(smp);
|
2002-01-09 20:25:32 +03:00
|
|
|
/*
|
|
|
|
* If we don't have node attributes, then it is an explicit lookup
|
|
|
|
* for an existing vnode.
|
|
|
|
*/
|
|
|
|
if (fap == NULL)
|
|
|
|
return ENOENT;
|
|
|
|
|
2003-02-24 21:41:04 +03:00
|
|
|
np = pool_get(&smbfs_node_pool, PR_WAITOK);
|
2003-02-18 13:24:58 +03:00
|
|
|
memset(np, 0, sizeof(*np));
|
|
|
|
|
2002-01-09 20:25:32 +03:00
|
|
|
error = getnewvnode(VT_SMBFS, mp, smbfs_vnodeop_p, &vp);
|
|
|
|
if (error) {
|
2003-02-24 21:41:04 +03:00
|
|
|
pool_put(&smbfs_node_pool, np);
|
2002-01-09 20:25:32 +03:00
|
|
|
return error;
|
|
|
|
}
|
|
|
|
vp->v_type = fap->fa_attr & SMB_FA_DIR ? VDIR : VREG;
|
|
|
|
vp->v_data = np;
|
|
|
|
np->n_vnode = vp;
|
|
|
|
np->n_mount = VFSTOSMBFS(mp);
|
|
|
|
np->n_nmlen = nmlen;
|
|
|
|
np->n_name = smbfs_name_alloc(name, nmlen);
|
|
|
|
np->n_ino = fap->fa_ino;
|
2003-02-24 00:33:06 +03:00
|
|
|
np->n_size = fap->fa_size;
|
|
|
|
|
|
|
|
/* new file vnode has to have a parent */
|
|
|
|
KASSERT(vp->v_type != VREG || dvp != NULL);
|
2002-01-09 20:25:32 +03:00
|
|
|
|
|
|
|
if (dvp) {
|
|
|
|
np->n_parent = dnp;
|
|
|
|
if (/*vp->v_type == VDIR &&*/ (dvp->v_flag & VROOT) == 0) {
|
|
|
|
vref(dvp);
|
|
|
|
np->n_flag |= NREFPARENT;
|
|
|
|
}
|
2003-02-20 18:39:58 +03:00
|
|
|
}
|
2002-01-09 20:25:32 +03:00
|
|
|
|
2002-01-09 20:43:28 +03:00
|
|
|
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
|
2002-01-09 20:25:32 +03:00
|
|
|
|
2002-01-09 20:43:28 +03:00
|
|
|
smbfs_hash_lock(smp);
|
2003-02-24 18:55:08 +03:00
|
|
|
/*
|
|
|
|
* Check if the vnode wasn't added while we were in getnewvnode/
|
|
|
|
* malloc.
|
|
|
|
*/
|
2002-01-09 20:25:32 +03:00
|
|
|
LIST_FOREACH(np2, nhpp, n_hash) {
|
2003-02-20 18:39:58 +03:00
|
|
|
if (np2->n_parent != dnp
|
|
|
|
|| np2->n_nmlen != nmlen
|
|
|
|
|| memcmp(name, np2->n_name, nmlen) != 0)
|
2002-01-09 20:25:32 +03:00
|
|
|
continue;
|
2003-02-24 00:33:06 +03:00
|
|
|
vput(vp); /* XXX ungetnewvnode/free! */
|
2002-01-09 20:25:32 +03:00
|
|
|
goto loop;
|
|
|
|
}
|
2003-02-24 00:33:06 +03:00
|
|
|
|
2003-02-24 18:55:08 +03:00
|
|
|
/* Not on hash list, add it now */
|
2002-01-09 20:25:32 +03:00
|
|
|
LIST_INSERT_HEAD(nhpp, np, n_hash);
|
2002-01-09 20:43:28 +03:00
|
|
|
smbfs_hash_unlock(smp);
|
2003-02-24 00:33:06 +03:00
|
|
|
|
2003-02-24 00:55:20 +03:00
|
|
|
genfs_node_init(vp, &smbfs_genfsops);
|
2003-02-24 00:33:06 +03:00
|
|
|
uvm_vnp_setsize(vp, np->n_size);
|
2002-01-09 20:25:32 +03:00
|
|
|
*vpp = vp;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
smbfs_nget(struct mount *mp, struct vnode *dvp, const char *name, int nmlen,
|
|
|
|
struct smbfattr *fap, struct vnode **vpp)
|
|
|
|
{
|
|
|
|
struct vnode *vp;
|
|
|
|
int error;
|
|
|
|
|
|
|
|
error = smbfs_node_alloc(mp, dvp, name, nmlen, fap, &vp);
|
|
|
|
if (error)
|
|
|
|
return error;
|
|
|
|
if (fap)
|
|
|
|
smbfs_attr_cacheenter(vp, fap);
|
|
|
|
*vpp = vp;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Free smbnode, and give vnode back to system
|
|
|
|
*/
|
|
|
|
int
|
2005-02-27 01:58:54 +03:00
|
|
|
smbfs_reclaim(v)
|
2002-01-09 20:43:28 +03:00
|
|
|
void *v;
|
|
|
|
{
|
2002-01-09 20:25:32 +03:00
|
|
|
struct vop_reclaim_args /* {
|
|
|
|
struct vnode *a_vp;
|
|
|
|
struct thread *a_p;
|
2002-01-09 20:43:28 +03:00
|
|
|
} */ *ap = v;
|
2002-01-09 20:25:32 +03:00
|
|
|
struct vnode *vp = ap->a_vp;
|
|
|
|
struct vnode *dvp;
|
|
|
|
struct smbnode *np = VTOSMB(vp);
|
|
|
|
struct smbmount *smp = VTOSMBFS(vp);
|
2005-02-27 01:58:54 +03:00
|
|
|
|
2004-02-29 15:17:39 +03:00
|
|
|
if (prtactive && vp->v_usecount != 0)
|
|
|
|
vprint("smbfs_reclaim(): pushing active", vp);
|
|
|
|
|
2003-02-20 18:39:58 +03:00
|
|
|
SMBVDEBUG("%.*s,%d\n", (int) np->n_nmlen, np->n_name, vp->v_usecount);
|
2002-01-09 20:25:32 +03:00
|
|
|
|
2004-02-29 14:47:08 +03:00
|
|
|
KASSERT((np->n_flag & NOPEN) == 0);
|
|
|
|
|
2002-01-09 20:43:28 +03:00
|
|
|
smbfs_hash_lock(smp);
|
2002-01-09 20:25:32 +03:00
|
|
|
|
|
|
|
dvp = (np->n_parent && (np->n_flag & NREFPARENT)) ?
|
|
|
|
np->n_parent->n_vnode : NULL;
|
|
|
|
|
2003-02-18 23:00:35 +03:00
|
|
|
LIST_REMOVE(np, n_hash);
|
|
|
|
|
2002-01-09 20:25:32 +03:00
|
|
|
cache_purge(vp);
|
|
|
|
if (smp->sm_root == np) {
|
|
|
|
SMBVDEBUG("root vnode\n");
|
|
|
|
smp->sm_root = NULL;
|
|
|
|
}
|
|
|
|
vp->v_data = NULL;
|
2002-01-09 20:43:28 +03:00
|
|
|
smbfs_hash_unlock(smp);
|
2002-01-09 20:25:32 +03:00
|
|
|
if (np->n_name)
|
|
|
|
smbfs_name_free(np->n_name);
|
2003-02-24 21:41:04 +03:00
|
|
|
pool_put(&smbfs_node_pool, np);
|
2003-02-18 23:00:35 +03:00
|
|
|
if (dvp)
|
|
|
|
vrele(dvp);
|
2002-01-09 20:25:32 +03:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2002-01-09 20:43:28 +03:00
|
|
|
smbfs_inactive(v)
|
|
|
|
void *v;
|
|
|
|
{
|
2002-01-09 20:25:32 +03:00
|
|
|
struct vop_inactive_args /* {
|
|
|
|
struct vnode *a_vp;
|
|
|
|
struct thread *a_td;
|
2002-01-09 20:43:28 +03:00
|
|
|
} */ *ap = v;
|
2005-12-11 15:16:03 +03:00
|
|
|
struct lwp *l = ap->a_l;
|
|
|
|
struct ucred *cred = l->l_proc->p_ucred;
|
2002-01-09 20:25:32 +03:00
|
|
|
struct vnode *vp = ap->a_vp;
|
|
|
|
struct smbnode *np = VTOSMB(vp);
|
|
|
|
struct smb_cred scred;
|
|
|
|
|
2004-02-29 15:17:39 +03:00
|
|
|
if (prtactive && vp->v_usecount != 0)
|
|
|
|
vprint("smbfs_inactive(): pushing active", vp);
|
|
|
|
|
2003-02-20 18:39:58 +03:00
|
|
|
SMBVDEBUG("%.*s: %d\n", (int) np->n_nmlen, np->n_name, vp->v_usecount);
|
2004-02-29 14:47:08 +03:00
|
|
|
if ((np->n_flag & NOPEN) != 0) {
|
|
|
|
struct smb_share *ssp = np->n_mount->sm_share;
|
|
|
|
|
2005-12-11 15:16:03 +03:00
|
|
|
smbfs_vinvalbuf(vp, V_SAVE, cred, l, 1);
|
|
|
|
smb_makescred(&scred, l, cred);
|
2004-02-29 14:47:08 +03:00
|
|
|
|
|
|
|
if (vp->v_type == VDIR && np->n_dirseq) {
|
|
|
|
smbfs_findclose(np->n_dirseq, &scred);
|
|
|
|
np->n_dirseq = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (vp->v_type != VDIR
|
|
|
|
|| SMB_CAPS(SSTOVC(ssp)) & SMB_CAP_NT_SMBS)
|
|
|
|
smbfs_smb_close(ssp, np->n_fid, &np->n_mtime, &scred);
|
|
|
|
|
|
|
|
np->n_flag &= ~NOPEN;
|
|
|
|
smbfs_attr_cacheremove(vp);
|
2002-01-09 20:25:32 +03:00
|
|
|
}
|
2002-01-09 20:43:28 +03:00
|
|
|
VOP_UNLOCK(vp, 0);
|
2002-01-09 20:25:32 +03:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* routines to maintain vnode attributes cache
|
|
|
|
* smbfs_attr_cacheenter: unpack np.i to vattr structure
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
smbfs_attr_cacheenter(struct vnode *vp, struct smbfattr *fap)
|
|
|
|
{
|
|
|
|
struct smbnode *np = VTOSMB(vp);
|
2003-02-18 13:24:58 +03:00
|
|
|
int s;
|
2002-01-09 20:25:32 +03:00
|
|
|
|
|
|
|
if (vp->v_type == VREG) {
|
|
|
|
if (np->n_size != fap->fa_size) {
|
|
|
|
np->n_size = fap->fa_size;
|
2002-01-09 20:43:28 +03:00
|
|
|
uvm_vnp_setsize(vp, np->n_size);
|
2002-01-09 20:25:32 +03:00
|
|
|
}
|
|
|
|
} else if (vp->v_type == VDIR) {
|
|
|
|
np->n_size = 16384; /* should be a better way ... */
|
|
|
|
} else
|
|
|
|
return;
|
2003-02-18 13:24:58 +03:00
|
|
|
|
2002-01-09 20:25:32 +03:00
|
|
|
np->n_mtime = fap->fa_mtime;
|
|
|
|
np->n_dosattr = fap->fa_attr;
|
2003-02-18 13:24:58 +03:00
|
|
|
|
|
|
|
s = splclock();
|
|
|
|
np->n_attrage = mono_time.tv_sec;
|
|
|
|
splx(s);
|
2002-01-09 20:25:32 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
smbfs_attr_cachelookup(struct vnode *vp, struct vattr *va)
|
|
|
|
{
|
|
|
|
struct smbnode *np = VTOSMB(vp);
|
|
|
|
struct smbmount *smp = VTOSMBFS(vp);
|
2003-02-27 12:14:25 +03:00
|
|
|
int s;
|
|
|
|
time_t diff;
|
2002-01-09 20:25:32 +03:00
|
|
|
|
2003-02-18 13:24:58 +03:00
|
|
|
s = splclock();
|
|
|
|
diff = mono_time.tv_sec - np->n_attrage;
|
|
|
|
splx(s);
|
2003-02-27 12:14:25 +03:00
|
|
|
if (diff > SMBFS_ATTRTIMO) /* XXX should be configurable */
|
2002-01-09 20:25:32 +03:00
|
|
|
return ENOENT;
|
2003-02-18 13:24:58 +03:00
|
|
|
|
2002-01-09 20:25:32 +03:00
|
|
|
va->va_type = vp->v_type; /* vnode type (for create) */
|
|
|
|
if (vp->v_type == VREG) {
|
|
|
|
va->va_mode = smp->sm_args.file_mode; /* files access mode and type */
|
|
|
|
} else if (vp->v_type == VDIR) {
|
|
|
|
va->va_mode = smp->sm_args.dir_mode; /* files access mode and type */
|
|
|
|
} else
|
|
|
|
return EINVAL;
|
|
|
|
va->va_size = np->n_size;
|
|
|
|
va->va_nlink = 1; /* number of references to file */
|
|
|
|
va->va_uid = smp->sm_args.uid; /* owner user id */
|
|
|
|
va->va_gid = smp->sm_args.gid; /* owner group id */
|
2004-04-21 05:05:31 +04:00
|
|
|
va->va_fsid = vp->v_mount->mnt_stat.f_fsidx.__fsid_val[0];
|
2002-01-09 20:25:32 +03:00
|
|
|
va->va_fileid = np->n_ino; /* file id */
|
|
|
|
if (va->va_fileid == 0)
|
|
|
|
va->va_fileid = 2;
|
|
|
|
va->va_blocksize = SSTOVC(smp->sm_share)->vc_txmax;
|
|
|
|
va->va_mtime = np->n_mtime;
|
|
|
|
va->va_atime = va->va_ctime = va->va_mtime; /* time file changed */
|
|
|
|
va->va_gen = VNOVAL; /* generation number of file */
|
|
|
|
va->va_flags = 0; /* flags defined for file */
|
|
|
|
va->va_rdev = VNOVAL; /* device the special file represents */
|
|
|
|
va->va_bytes = va->va_size; /* bytes of disk space held by file */
|
|
|
|
va->va_filerev = 0; /* file modification number */
|
|
|
|
va->va_vaflags = 0; /* operations flags */
|
|
|
|
return 0;
|
|
|
|
}
|