Print this page
*** NO COMMENTS ***


 107  * different purge all caches for this vnode.
 108  */
 109 int
 110 smbfs_validate_caches(
 111         struct vnode *vp,
 112         cred_t *cr)
 113 {
 114         struct vattr va;
 115 
 116         va.va_mask = AT_SIZE;
 117         return (smbfsgetattr(vp, &va, cr));
 118 }
 119 
 120 /*
 121  * Purge all of the various data caches.
 122  */
 123 /*ARGSUSED*/
 124 void
 125 smbfs_purge_caches(struct vnode *vp)
 126 {
 127 #if 0   /* not yet: mmap support */
 128         /*
 129          * NFS: Purge the DNLC for this vp,
 130          * Clear any readdir state bits,
 131          * the readlink response cache, ...
 132          */
 133         smbnode_t *np = VTOSMB(vp);
 134 
 135         /*
 136          * Flush the page cache.
 137          */
 138         if (vn_has_cached_data(vp)) {
 139                 (void) VOP_PUTPAGE(vp, (u_offset_t)0, 0, B_INVAL, cr, NULL);
 140         }
 141 #endif  /* not yet */
 142 }
 143 
 144 /*
 145  * Check the attribute cache to see if the new attributes match
 146  * those cached.  If they do, the various `data' caches are
 147  * considered to be good.  Otherwise, purge the cached data.
 148  */
 149 void
 150 smbfs_cache_check(
 151         struct vnode *vp,
 152         struct smbfattr *fap)
 153 {
 154         smbnode_t *np;
 155         int purge_data = 0;
 156         int purge_acl = 0;
 157 
 158         np = VTOSMB(vp);
 159         mutex_enter(&np->r_statelock);
 160 
 161         /*


 277         oldvt = vp->v_type;
 278         vp->v_type = vtype;
 279 
 280         /*
 281          * Shall we update r_size? (local notion of size)
 282          *
 283          * The real criteria for updating r_size should be:
 284          * if the file has grown on the server, or if
 285          * the client has not modified the file.
 286          *
 287          * Also deal with the fact that SMB presents
 288          * directories as having size=0.  Doing that
 289          * here and leaving fa_size as returned OtW
 290          * avoids fixing the size lots of places.
 291          */
 292         newsize = fap->fa_size;
 293         if (vtype == VDIR && newsize < DEV_BSIZE)
 294                 newsize = DEV_BSIZE;
 295 
 296         if (np->r_size != newsize) {
 297 #if 0   /* not yet: mmap support */
 298                 if (!vn_has_cached_data(vp) || ...)
 299                         /* XXX: See NFS page cache code. */
 300 #endif  /* not yet */
 301                 /* OK to set the size. */
 302                 np->r_size = newsize;
 303         }

 304 
 305         /* NFS: np->r_flags &= ~RWRITEATTR; */
 306         np->n_flag &= ~NATTRCHANGED;
 307 
 308         mutex_exit(&np->r_statelock);
 309 
 310         if (oldvt != vtype) {
 311                 SMBVDEBUG("vtype change %d to %d\n", oldvt, vtype);
 312         }
 313 }
 314 
 315 /*
 316  * Fill in attribute from the cache.
 317  *
 318  * If valid, copy to *fap and return zero,
 319  * otherwise return an error.
 320  *
 321  * From NFS: nfs_getattr_cache()
 322  */
 323 int




 107  * different purge all caches for this vnode.
 108  */
 109 int
 110 smbfs_validate_caches(
 111         struct vnode *vp,
 112         cred_t *cr)
 113 {
 114         struct vattr va;
 115 
 116         va.va_mask = AT_SIZE;
 117         return (smbfsgetattr(vp, &va, cr));
 118 }
 119 
 120 /*
 121  * Purge all of the various data caches.
 122  */
 123 /*ARGSUSED*/
 124 void
 125 smbfs_purge_caches(struct vnode *vp)
 126 {

 127         /*
 128          * NFS: Purge the DNLC for this vp,
 129          * Clear any readdir state bits,
 130          * the readlink response cache, ...
 131          */
 132         smbnode_t *np = VTOSMB(vp);
 133 
 134         /*
 135          * Flush the page cache.
 136          */
 137         if (vn_has_cached_data(vp)) {
 138                 (void) VOP_PUTPAGE(vp, (u_offset_t) 0, 0, B_INVAL, np->r_cred, NULL);
 139         }

 140 }
 141 
 142 /*
 143  * Check the attribute cache to see if the new attributes match
 144  * those cached.  If they do, the various `data' caches are
 145  * considered to be good.  Otherwise, purge the cached data.
 146  */
 147 void
 148 smbfs_cache_check(
 149         struct vnode *vp,
 150         struct smbfattr *fap)
 151 {
 152         smbnode_t *np;
 153         int purge_data = 0;
 154         int purge_acl = 0;
 155 
 156         np = VTOSMB(vp);
 157         mutex_enter(&np->r_statelock);
 158 
 159         /*


 275         oldvt = vp->v_type;
 276         vp->v_type = vtype;
 277 
 278         /*
 279          * Shall we update r_size? (local notion of size)
 280          *
 281          * The real criteria for updating r_size should be:
 282          * if the file has grown on the server, or if
 283          * the client has not modified the file.
 284          *
 285          * Also deal with the fact that SMB presents
 286          * directories as having size=0.  Doing that
 287          * here and leaving fa_size as returned OtW
 288          * avoids fixing the size lots of places.
 289          */
 290         newsize = fap->fa_size;
 291         if (vtype == VDIR && newsize < DEV_BSIZE)
 292                 newsize = DEV_BSIZE;
 293 
 294         if (np->r_size != newsize) {
 295                 if (!vn_has_cached_data(vp) 
 296                     || (!(np->r_flags & RDIRTY)&& np->r_count == 0)) {


 297                         /* OK to set the size. */
 298                         np->r_size = newsize;
 299                 }
 300         }
 301 
 302         /* NFS: np->r_flags &= ~RWRITEATTR; */
 303         np->n_flag &= ~NATTRCHANGED;
 304 
 305         mutex_exit(&np->r_statelock);
 306 
 307         if (oldvt != vtype) {
 308                 SMBVDEBUG("vtype change %d to %d\n", oldvt, vtype);
 309         }
 310 }
 311 
 312 /*
 313  * Fill in attribute from the cache.
 314  *
 315  * If valid, copy to *fap and return zero,
 316  * otherwise return an error.
 317  *
 318  * From NFS: nfs_getattr_cache()
 319  */
 320 int