msdosfs_denode.c (215548) | msdosfs_denode.c (227817) |
---|---|
1/* $FreeBSD: head/sys/fs/msdosfs/msdosfs_denode.c 215548 2010-11-19 21:17:34Z kib $ */ | 1/* $FreeBSD: head/sys/fs/msdosfs/msdosfs_denode.c 227817 2011-11-22 13:30:36Z kib $ */ |
2/* $NetBSD: msdosfs_denode.c,v 1.28 1998/02/10 14:10:00 mrg Exp $ */ 3 4/*- 5 * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank. 6 * Copyright (C) 1994, 1995, 1997 TooLs GmbH. 7 * All rights reserved. 8 * Original code by Paul Popelka (paulp@uts.amdahl.com) (see below). 9 * --- 248 unchanged lines hidden (view full) --- 258 u_long size; 259 260 /* 261 * XXX it sometimes happens that the "." entry has cluster 262 * number 0 when it shouldn't. Use the actual cluster number 263 * instead of what is written in directory entry. 264 */ 265 if (diroffset == 0 && ldep->de_StartCluster != dirclust) { | 2/* $NetBSD: msdosfs_denode.c,v 1.28 1998/02/10 14:10:00 mrg Exp $ */ 3 4/*- 5 * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank. 6 * Copyright (C) 1994, 1995, 1997 TooLs GmbH. 7 * All rights reserved. 8 * Original code by Paul Popelka (paulp@uts.amdahl.com) (see below). 9 * --- 248 unchanged lines hidden (view full) --- 258 u_long size; 259 260 /* 261 * XXX it sometimes happens that the "." entry has cluster 262 * number 0 when it shouldn't. Use the actual cluster number 263 * instead of what is written in directory entry. 264 */ 265 if (diroffset == 0 && ldep->de_StartCluster != dirclust) { |
266#ifdef MSDOSFS_DEBUG |
|
266 printf("deget(): \".\" entry at clust %lu != %lu\n", 267 dirclust, ldep->de_StartCluster); | 267 printf("deget(): \".\" entry at clust %lu != %lu\n", 268 dirclust, ldep->de_StartCluster); |
269#endif |
|
268 ldep->de_StartCluster = dirclust; 269 } 270 271 nvp->v_type = VDIR; 272 if (ldep->de_StartCluster != MSDOSFSROOT) { 273 error = pcbmap(ldep, 0xffff, 0, &size, 0); 274 if (error == E2BIG) { 275 ldep->de_FileSize = de_cn2off(pmp, size); 276 error = 0; | 270 ldep->de_StartCluster = dirclust; 271 } 272 273 nvp->v_type = VDIR; 274 if (ldep->de_StartCluster != MSDOSFSROOT) { 275 error = pcbmap(ldep, 0xffff, 0, &size, 0); 276 if (error == E2BIG) { 277 ldep->de_FileSize = de_cn2off(pmp, size); 278 error = 0; |
277 } else | 279 } else { 280#ifdef MSDOSFS_DEBUG |
278 printf("deget(): pcbmap returned %d\n", error); | 281 printf("deget(): pcbmap returned %d\n", error); |
282#endif 283 } |
|
279 } 280 } else 281 nvp->v_type = VREG; 282 ldep->de_modrev = init_va_filerev(); 283 *depp = ldep; 284 return (0); 285} 286 --- 59 unchanged lines hidden (view full) --- 346 * Disallow attempts to truncate the root directory since it is of 347 * fixed size. That's just the way dos filesystems are. We use 348 * the VROOT bit in the vnode because checking for the directory 349 * bit and a startcluster of 0 in the denode is not adequate to 350 * recognize the root directory at this point in a file or 351 * directory's life. 352 */ 353 if ((DETOV(dep)->v_vflag & VV_ROOT) && !FAT32(pmp)) { | 284 } 285 } else 286 nvp->v_type = VREG; 287 ldep->de_modrev = init_va_filerev(); 288 *depp = ldep; 289 return (0); 290} 291 --- 59 unchanged lines hidden (view full) --- 351 * Disallow attempts to truncate the root directory since it is of 352 * fixed size. That's just the way dos filesystems are. We use 353 * the VROOT bit in the vnode because checking for the directory 354 * bit and a startcluster of 0 in the denode is not adequate to 355 * recognize the root directory at this point in a file or 356 * directory's life. 357 */ 358 if ((DETOV(dep)->v_vflag & VV_ROOT) && !FAT32(pmp)) { |
359#ifdef MSDOSFS_DEBUG |
|
354 printf("detrunc(): can't truncate root directory, clust %ld, offset %ld\n", 355 dep->de_dirclust, dep->de_diroffset); | 360 printf("detrunc(): can't truncate root directory, clust %ld, offset %ld\n", 361 dep->de_dirclust, dep->de_diroffset); |
362#endif |
|
356 return (EINVAL); 357 } 358 359 if (dep->de_FileSize < length) { 360 vnode_pager_setsize(DETOV(dep), length); 361 return deextend(dep, length, cred); 362 } 363 --- 258 unchanged lines hidden --- | 363 return (EINVAL); 364 } 365 366 if (dep->de_FileSize < length) { 367 vnode_pager_setsize(DETOV(dep), length); 368 return deextend(dep, length, cred); 369 } 370 --- 258 unchanged lines hidden --- |