Deleted Added
full compact
msdosfs_vnops.c (29362) msdosfs_vnops.c (29653)
1/* $Id: msdosfs_vnops.c,v 1.43 1997/08/26 07:32:39 phk Exp $ */
1/* $Id: msdosfs_vnops.c,v 1.44 1997/09/14 02:57:44 peter Exp $ */
2/* $NetBSD: msdosfs_vnops.c,v 1.20 1994/08/21 18:44:13 ws Exp $ */
3
4/*-
5 * Copyright (C) 1994 Wolfgang Solfrank.
6 * Copyright (C) 1994 TooLs GmbH.
7 * All rights reserved.
8 * Original code by Paul Popelka (paulp@uts.amdahl.com) (see below).
9 *

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

172 ? ATTR_ARCHIVE : ATTR_ARCHIVE | ATTR_READONLY;
173 ndirent.de_StartCluster = 0;
174 ndirent.de_FileSize = 0;
175 ndirent.de_dev = pdep->de_dev;
176 ndirent.de_devvp = pdep->de_devvp;
177 if ((error = createde(&ndirent, pdep, &dep)) == 0) {
178 *ap->a_vpp = DETOV(dep);
179 if ((cnp->cn_flags & SAVESTART) == 0)
2/* $NetBSD: msdosfs_vnops.c,v 1.20 1994/08/21 18:44:13 ws Exp $ */
3
4/*-
5 * Copyright (C) 1994 Wolfgang Solfrank.
6 * Copyright (C) 1994 TooLs GmbH.
7 * All rights reserved.
8 * Original code by Paul Popelka (paulp@uts.amdahl.com) (see below).
9 *

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

172 ? ATTR_ARCHIVE : ATTR_ARCHIVE | ATTR_READONLY;
173 ndirent.de_StartCluster = 0;
174 ndirent.de_FileSize = 0;
175 ndirent.de_dev = pdep->de_dev;
176 ndirent.de_devvp = pdep->de_devvp;
177 if ((error = createde(&ndirent, pdep, &dep)) == 0) {
178 *ap->a_vpp = DETOV(dep);
179 if ((cnp->cn_flags & SAVESTART) == 0)
180 free(cnp->cn_pnbuf, M_NAMEI);
180 zfree(namei_zone, cnp->cn_pnbuf);
181 } else {
181 } else {
182 free(cnp->cn_pnbuf, M_NAMEI);
182 zfree(namei_zone, cnp->cn_pnbuf);
183 }
184 vput(ap->a_dvp); /* release parent dir */
185 return error;
186}
187
188static int
189msdosfs_mknod(ap)
190 struct vop_mknod_args /* {

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

202 break;
203
204 case VREG:
205 error = msdosfs_create((struct vop_create_args *)ap);
206 break;
207
208 default:
209 error = EINVAL;
183 }
184 vput(ap->a_dvp); /* release parent dir */
185 return error;
186}
187
188static int
189msdosfs_mknod(ap)
190 struct vop_mknod_args /* {

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

202 break;
203
204 case VREG:
205 error = msdosfs_create((struct vop_create_args *)ap);
206 break;
207
208 default:
209 error = EINVAL;
210 free(ap->a_cnp->cn_pnbuf, M_NAMEI);
210 zfree(namei_zone, ap->a_cnp->cn_pnbuf);
211 vput(ap->a_dvp);
212 break;
213 }
214 return error;
215}
216
217static int
218msdosfs_open(ap)

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

1331 pdep = VTODE(ap->a_dvp);
1332
1333 /*
1334 * If this is the root directory and there is no space left we
1335 * can't do anything. This is because the root directory can not
1336 * change size.
1337 */
1338 if (pdep->de_StartCluster == MSDOSFSROOT && pdep->de_fndclust == (u_long)-1) {
211 vput(ap->a_dvp);
212 break;
213 }
214 return error;
215}
216
217static int
218msdosfs_open(ap)

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

1331 pdep = VTODE(ap->a_dvp);
1332
1333 /*
1334 * If this is the root directory and there is no space left we
1335 * can't do anything. This is because the root directory can not
1336 * change size.
1337 */
1338 if (pdep->de_StartCluster == MSDOSFSROOT && pdep->de_fndclust == (u_long)-1) {
1339 free(ap->a_cnp->cn_pnbuf, M_NAMEI);
1339 zfree(namei_zone, ap->a_cnp->cn_pnbuf);
1340 vput(ap->a_dvp);
1341 return ENOSPC;
1342 }
1343
1344 pmp = pdep->de_pmp;
1345
1346 /*
1347 * Allocate a cluster to hold the about to be created directory.
1348 */
1349 error = clusteralloc(pmp, 0, 1, CLUST_EOFE, &newcluster, NULL);
1350 if (error) {
1340 vput(ap->a_dvp);
1341 return ENOSPC;
1342 }
1343
1344 pmp = pdep->de_pmp;
1345
1346 /*
1347 * Allocate a cluster to hold the about to be created directory.
1348 */
1349 error = clusteralloc(pmp, 0, 1, CLUST_EOFE, &newcluster, NULL);
1350 if (error) {
1351 free(ap->a_cnp->cn_pnbuf, M_NAMEI);
1351 zfree(namei_zone, ap->a_cnp->cn_pnbuf);
1352 vput(ap->a_dvp);
1353 return error;
1354 }
1355
1356 /*
1357 * Now fill the cluster with the "." and ".." entries. And write
1358 * the cluster to disk. This way it is there for the parent
1359 * directory to be pointing at if there were a crash.

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

1371 putushort(denp->deTime, dTime);
1372 denp++;
1373 putushort(denp->deStartCluster, pdep->de_StartCluster);
1374 putushort(denp->deDate, dDate);
1375 putushort(denp->deTime, dTime);
1376 error = bwrite(bp);
1377 if (error) {
1378 clusterfree(pmp, newcluster, NULL);
1352 vput(ap->a_dvp);
1353 return error;
1354 }
1355
1356 /*
1357 * Now fill the cluster with the "." and ".." entries. And write
1358 * the cluster to disk. This way it is there for the parent
1359 * directory to be pointing at if there were a crash.

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

1371 putushort(denp->deTime, dTime);
1372 denp++;
1373 putushort(denp->deStartCluster, pdep->de_StartCluster);
1374 putushort(denp->deDate, dDate);
1375 putushort(denp->deTime, dTime);
1376 error = bwrite(bp);
1377 if (error) {
1378 clusterfree(pmp, newcluster, NULL);
1379 free(ap->a_cnp->cn_pnbuf, M_NAMEI);
1379 zfree(namei_zone, ap->a_cnp->cn_pnbuf);
1380 vput(ap->a_dvp);
1381 return error;
1382 }
1383
1384 /*
1385 * Now build up a directory entry pointing to the newly allocated
1386 * cluster. This will be written to an empty slot in the parent
1387 * directory.

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

1396 ndep->de_Attributes = ATTR_DIRECTORY;
1397
1398 error = createde(ndep, pdep, &ndep);
1399 if (error) {
1400 clusterfree(pmp, newcluster, NULL);
1401 } else {
1402 *ap->a_vpp = DETOV(ndep);
1403 }
1380 vput(ap->a_dvp);
1381 return error;
1382 }
1383
1384 /*
1385 * Now build up a directory entry pointing to the newly allocated
1386 * cluster. This will be written to an empty slot in the parent
1387 * directory.

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

1396 ndep->de_Attributes = ATTR_DIRECTORY;
1397
1398 error = createde(ndep, pdep, &ndep);
1399 if (error) {
1400 clusterfree(pmp, newcluster, NULL);
1401 } else {
1402 *ap->a_vpp = DETOV(ndep);
1403 }
1404 free(ap->a_cnp->cn_pnbuf, M_NAMEI);
1404 zfree(namei_zone, ap->a_cnp->cn_pnbuf);
1405#ifdef MSDOSFS_DEBUG
1406 printf("msdosfs_mkdir(): vput(%08x)\n", ap->a_dvp);
1407#endif
1408 vput(ap->a_dvp);
1409 return error;
1410}
1411
1412static int

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

1474 struct vop_symlink_args /* {
1475 struct vnode *a_dvp;
1476 struct vnode **a_vpp;
1477 struct componentname *a_cnp;
1478 struct vattr *a_vap;
1479 char *a_target;
1480 } */ *ap;
1481{
1405#ifdef MSDOSFS_DEBUG
1406 printf("msdosfs_mkdir(): vput(%08x)\n", ap->a_dvp);
1407#endif
1408 vput(ap->a_dvp);
1409 return error;
1410}
1411
1412static int

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

1474 struct vop_symlink_args /* {
1475 struct vnode *a_dvp;
1476 struct vnode **a_vpp;
1477 struct componentname *a_cnp;
1478 struct vattr *a_vap;
1479 char *a_target;
1480 } */ *ap;
1481{
1482 free(ap->a_cnp->cn_pnbuf, M_NAMEI);
1482 zfree(namei_zone, ap->a_cnp->cn_pnbuf);
1483 vput(ap->a_dvp);
1484 return EINVAL;
1485}
1486
1487/*
1488 * Dummy dirents to simulate the "." and ".." entries of the root directory
1489 * in a dos filesystem. Dos doesn't provide these. Note that each entry
1490 * must be the same size as a dos directory entry (32 bytes).

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

1789static int
1790msdosfs_abortop(ap)
1791 struct vop_abortop_args /* {
1792 struct vnode *a_dvp;
1793 struct componentname *a_cnp;
1794 } */ *ap;
1795{
1796 if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF)
1483 vput(ap->a_dvp);
1484 return EINVAL;
1485}
1486
1487/*
1488 * Dummy dirents to simulate the "." and ".." entries of the root directory
1489 * in a dos filesystem. Dos doesn't provide these. Note that each entry
1490 * must be the same size as a dos directory entry (32 bytes).

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

1789static int
1790msdosfs_abortop(ap)
1791 struct vop_abortop_args /* {
1792 struct vnode *a_dvp;
1793 struct componentname *a_cnp;
1794 } */ *ap;
1795{
1796 if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF)
1797 FREE(ap->a_cnp->cn_pnbuf, M_NAMEI);
1797 zfree(namei_zone, ap->a_cnp->cn_pnbuf);
1798 return 0;
1799}
1800
1801static int
1802msdosfs_lock(ap)
1803 struct vop_lock_args /* {
1804 struct vnode *a_vp;
1805 int a_flags;

--- 238 unchanged lines hidden ---
1798 return 0;
1799}
1800
1801static int
1802msdosfs_lock(ap)
1803 struct vop_lock_args /* {
1804 struct vnode *a_vp;
1805 int a_flags;

--- 238 unchanged lines hidden ---