CVS commit: src/usr.sbin/makefs/msdos

2018-01-26 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sat Jan 27 02:07:33 UTC 2018

Modified Files:
src/usr.sbin/makefs/msdos: msdosfs_vfsops.c

Log Message:
Need strings.h for ffs()


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/makefs/msdos/msdosfs_vfsops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/makefs/msdos/msdosfs_vfsops.c
diff -u src/usr.sbin/makefs/msdos/msdosfs_vfsops.c:1.10 src/usr.sbin/makefs/msdos/msdosfs_vfsops.c:1.11
--- src/usr.sbin/makefs/msdos/msdosfs_vfsops.c:1.10	Sat Jan 30 09:59:27 2016
+++ src/usr.sbin/makefs/msdos/msdosfs_vfsops.c	Sat Jan 27 02:07:33 2018
@@ -50,7 +50,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.10 2016/01/30 09:59:27 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.11 2018/01/27 02:07:33 sevan Exp $");
 
 #include 
 
@@ -68,6 +68,7 @@ __KERNEL_RCSID(0, "$NetBSD: msdosfs_vfso
 #include 
 #include 
 #include 
+#include 
 
 #include "makefs.h"
 #include "msdos.h"



CVS commit: src/usr.sbin/makefs/msdos

2017-04-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 13 17:10:12 UTC 2017

Modified Files:
src/usr.sbin/makefs/msdos: msdosfs_vnops.c

Log Message:
Fix error handling; msdosfs_wfile is supposed to return errno.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.sbin/makefs/msdos/msdosfs_vnops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/makefs/msdos/msdosfs_vnops.c
diff -u src/usr.sbin/makefs/msdos/msdosfs_vnops.c:1.18 src/usr.sbin/makefs/msdos/msdosfs_vnops.c:1.19
--- src/usr.sbin/makefs/msdos/msdosfs_vnops.c:1.18	Thu Feb 16 13:50:05 2017
+++ src/usr.sbin/makefs/msdos/msdosfs_vnops.c	Thu Apr 13 13:10:12 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: msdosfs_vnops.c,v 1.18 2017/02/16 18:50:05 christos Exp $ */
+/*	$NetBSD: msdosfs_vnops.c,v 1.19 2017/04/13 17:10:12 christos Exp $ */
 
 /*-
  * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -51,7 +51,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: msdosfs_vnops.c,v 1.18 2017/02/16 18:50:05 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: msdosfs_vnops.c,v 1.19 2017/04/13 17:10:12 christos Exp $");
 
 #include 
 #include 
@@ -440,31 +440,29 @@ msdosfs_wfile(const char *path, struct d
 		return 0;
 
 	/* Don't bother to try to write files larger than the fs limit */
-	if (st->st_size > MSDOSFS_FILESIZE_MAX) {
-		errno = EFBIG;
-		return -1;
-	}
+	if (st->st_size > MSDOSFS_FILESIZE_MAX)
+		return EFBIG;
 
 	nsize = st->st_size;
 	DPRINTF(("%s(nsize=%zu, osize=%zu)\n", __func__, nsize, osize));
 	if (nsize > osize) {
-		if ((error = deextend(dep, nsize, NULL)) != 0) {
-			errno = error;
-			return -1;
-		}
-		if ((error = msdosfs_updatede(dep)) != 0) {
-			errno = error;
-			return -1;
-		}
+		if ((error = deextend(dep, nsize, NULL)) != 0)
+			return error;
+		if ((error = msdosfs_updatede(dep)) != 0)
+			return error;
 	}
 
-	if ((fd = open(path, O_RDONLY)) == -1)
-		err(1, "open %s", path);
+	if ((fd = open(path, O_RDONLY)) == -1) {
+		error = errno;
+		DPRINTF((1, "open %s: %s", path, strerror(error)));
+		return error;
+	}
 
 	if ((dat = mmap(0, nsize, PROT_READ, MAP_FILE | MAP_PRIVATE, fd, 0))
 	== MAP_FAILED) {
-		DPRINTF(("%s: mmap %s %s", __func__, node->name,
-		strerror(errno)));
+		error = errno;
+		DPRINTF(("%s: mmap %s: %s", __func__, node->name,
+		strerror(error)));
 		close(fd);
 		goto out;
 	}
@@ -478,6 +476,7 @@ msdosfs_wfile(const char *path, struct d
 		cn = dep->de_StartCluster;
 		if (cn == MSDOSFSROOT) {
 			DPRINTF(("%s: bad lbn %lu", __func__, cn));
+			error = EINVAL;
 			goto out;
 		}
 		bn = cntobn(pmp, cn);



CVS commit: src/usr.sbin/makefs/msdos

2014-07-09 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Jul  9 06:04:16 UTC 2014

Modified Files:
src/usr.sbin/makefs/msdos: msdosfs_vfsops.c

Log Message:
What a terrible use-after-free


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/makefs/msdos/msdosfs_vfsops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/makefs/msdos/msdosfs_vfsops.c
diff -u src/usr.sbin/makefs/msdos/msdosfs_vfsops.c:1.7 src/usr.sbin/makefs/msdos/msdosfs_vfsops.c:1.8
--- src/usr.sbin/makefs/msdos/msdosfs_vfsops.c:1.7	Wed Jan 30 19:19:19 2013
+++ src/usr.sbin/makefs/msdos/msdosfs_vfsops.c	Wed Jul  9 06:04:16 2014
@@ -50,7 +50,7 @@
 #endif
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: msdosfs_vfsops.c,v 1.7 2013/01/30 19:19:19 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: msdosfs_vfsops.c,v 1.8 2014/07/09 06:04:16 maxv Exp $);
 
 #include sys/param.h
 
@@ -407,7 +407,7 @@ error_exit:
 		free(pmp);
 	}
 	errno = error;
-	return pmp;
+	return NULL;
 }
 
 int



CVS commit: src/usr.sbin/makefs/msdos

2013-01-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 29 19:45:47 UTC 2013

Modified Files:
src/usr.sbin/makefs/msdos: msdosfs_vnops.c

Log Message:
workaround for gcc/vax


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/usr.sbin/makefs/msdos/msdosfs_vnops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/makefs/msdos/msdosfs_vnops.c
diff -u src/usr.sbin/makefs/msdos/msdosfs_vnops.c:1.13 src/usr.sbin/makefs/msdos/msdosfs_vnops.c:1.14
--- src/usr.sbin/makefs/msdos/msdosfs_vnops.c:1.13	Sun Jan 27 19:16:48 2013
+++ src/usr.sbin/makefs/msdos/msdosfs_vnops.c	Tue Jan 29 14:45:47 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: msdosfs_vnops.c,v 1.13 2013/01/28 00:16:48 christos Exp $ */
+/*	$NetBSD: msdosfs_vnops.c,v 1.14 2013/01/29 19:45:47 christos Exp $ */
 
 /*-
  * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -51,7 +51,7 @@
 #endif
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: msdosfs_vnops.c,v 1.13 2013/01/28 00:16:48 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: msdosfs_vnops.c,v 1.14 2013/01/29 19:45:47 christos Exp $);
 
 #include sys/param.h
 #include sys/mman.h
@@ -426,6 +426,7 @@ msdosfs_wfile(const char *path, struct d
 	char *dat;
 	u_long cn = 0;
 
+	error = 0;	/* XXX: gcc/vax */
 	DPRINTF((%s(diroff %lu, dirclust %lu, startcluster %lu)\n, __func__,
 	dep-de_diroffset, dep-de_dirclust, dep-de_StartCluster));
 	if (st-st_size == 0)



CVS commit: src/usr.sbin/makefs/msdos

2013-01-27 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Sun Jan 27 10:07:23 UTC 2013

Modified Files:
src/usr.sbin/makefs/msdos: msdosfs_vnops.c

Log Message:
Allow this to compile on 32bit architectures.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/makefs/msdos/msdosfs_vnops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/makefs/msdos/msdosfs_vnops.c
diff -u src/usr.sbin/makefs/msdos/msdosfs_vnops.c:1.4 src/usr.sbin/makefs/msdos/msdosfs_vnops.c:1.5
--- src/usr.sbin/makefs/msdos/msdosfs_vnops.c:1.4	Sat Jan 26 16:58:14 2013
+++ src/usr.sbin/makefs/msdos/msdosfs_vnops.c	Sun Jan 27 10:07:23 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: msdosfs_vnops.c,v 1.4 2013/01/26 16:58:14 christos Exp $	*/
+/*	$NetBSD: msdosfs_vnops.c,v 1.5 2013/01/27 10:07:23 mbalmer Exp $	*/
 
 /*-
  * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -51,7 +51,7 @@
 #endif
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: msdosfs_vnops.c,v 1.4 2013/01/26 16:58:14 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: msdosfs_vnops.c,v 1.5 2013/01/27 10:07:23 mbalmer Exp $);
 
 #include sys/param.h
 #include sys/mman.h
@@ -177,7 +177,7 @@ msdosfs_wfile(const char *path, struct d
 	int error, fd;
 	size_t osize = dep-de_FileSize;
 	struct stat *st = node-inode-st;
-	size_t nsize = st-st_size;
+	off_t nsize = st-st_size;
 	size_t offs = 0;
 	struct msdosfsmount *pmp = dep-de_pmp;
 	struct buf *bp;
@@ -207,7 +207,7 @@ msdosfs_wfile(const char *path, struct d
 	if ((fd = open(path, O_RDONLY)) == -1)
 		err(1, open %s, path);
 
-	if ((dat = mmap(0, nsize, PROT_READ, MAP_FILE | MAP_PRIVATE, fd, 0))
+	if ((dat = mmap(0, (size_t)nsize, PROT_READ, MAP_FILE | MAP_PRIVATE, fd, 0))
 	== MAP_FAILED)
 		err(1, mmap %s, node-name);
 	close(fd);



CVS commit: src/usr.sbin/makefs/msdos

2013-01-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jan 27 12:25:13 UTC 2013

Modified Files:
src/usr.sbin/makefs/msdos: msdosfs_vnops.c

Log Message:
Make it compile on 32bit AND 64bit archs.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/makefs/msdos/msdosfs_vnops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/makefs/msdos/msdosfs_vnops.c
diff -u src/usr.sbin/makefs/msdos/msdosfs_vnops.c:1.5 src/usr.sbin/makefs/msdos/msdosfs_vnops.c:1.6
--- src/usr.sbin/makefs/msdos/msdosfs_vnops.c:1.5	Sun Jan 27 10:07:23 2013
+++ src/usr.sbin/makefs/msdos/msdosfs_vnops.c	Sun Jan 27 12:25:13 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: msdosfs_vnops.c,v 1.5 2013/01/27 10:07:23 mbalmer Exp $	*/
+/*	$NetBSD: msdosfs_vnops.c,v 1.6 2013/01/27 12:25:13 martin Exp $	*/
 
 /*-
  * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -51,7 +51,7 @@
 #endif
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: msdosfs_vnops.c,v 1.5 2013/01/27 10:07:23 mbalmer Exp $);
+__KERNEL_RCSID(0, $NetBSD: msdosfs_vnops.c,v 1.6 2013/01/27 12:25:13 martin Exp $);
 
 #include sys/param.h
 #include sys/mman.h
@@ -177,7 +177,7 @@ msdosfs_wfile(const char *path, struct d
 	int error, fd;
 	size_t osize = dep-de_FileSize;
 	struct stat *st = node-inode-st;
-	off_t nsize = st-st_size;
+	size_t nsize;
 	size_t offs = 0;
 	struct msdosfsmount *pmp = dep-de_pmp;
 	struct buf *bp;
@@ -188,15 +188,16 @@ msdosfs_wfile(const char *path, struct d
 	printf(msdosfs_write(): diroff %lu, dirclust %lu, startcluster %lu\n,
 	dep-de_diroffset, dep-de_dirclust, dep-de_StartCluster);
 #endif
-	if (nsize == 0)
+	if (st-st_size == 0)
 		return 0;
 
 	/* Don't bother to try to write files larger than the fs limit */
-	if (nsize  MSDOSFS_FILESIZE_MAX) {
+	if (st-st_size  (off_t)min(MSDOSFS_FILESIZE_MAX,__SIZE_MAX__)) {
 		errno = EFBIG;
 		return -1;
 	}
 
+	nsize = st-st_size;
 	if (nsize  osize) {
 		if ((error = deextend(dep, nsize, NULL)) != 0) {
 			errno = error;



CVS commit: src/usr.sbin/makefs/msdos

2013-01-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jan 27 16:03:16 UTC 2013

Modified Files:
src/usr.sbin/makefs/msdos: msdosfs_vnops.c

Log Message:
the max msdos file size is less than size_t so don't bother checking against it.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/makefs/msdos/msdosfs_vnops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/makefs/msdos/msdosfs_vnops.c
diff -u src/usr.sbin/makefs/msdos/msdosfs_vnops.c:1.7 src/usr.sbin/makefs/msdos/msdosfs_vnops.c:1.8
--- src/usr.sbin/makefs/msdos/msdosfs_vnops.c:1.7	Sun Jan 27 10:35:45 2013
+++ src/usr.sbin/makefs/msdos/msdosfs_vnops.c	Sun Jan 27 11:03:15 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: msdosfs_vnops.c,v 1.7 2013/01/27 15:35:45 christos Exp $ */
+/*	$NetBSD: msdosfs_vnops.c,v 1.8 2013/01/27 16:03:15 christos Exp $ */
 
 /*-
  * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -51,7 +51,7 @@
 #endif
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: msdosfs_vnops.c,v 1.7 2013/01/27 15:35:45 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: msdosfs_vnops.c,v 1.8 2013/01/27 16:03:15 christos Exp $);
 
 #include sys/param.h
 #include sys/mman.h
@@ -423,7 +423,7 @@ msdosfs_wfile(const char *path, struct d
 		return 0;
 
 	/* Don't bother to try to write files larger than the fs limit */
-	if (st-st_size  (off_t)min(MSDOSFS_FILESIZE_MAX,__SIZE_MAX__)) {
+	if (st-st_size  MSDOSFS_FILESIZE_MAX) {
 		errno = EFBIG;
 		return -1;
 	}



CVS commit: src/usr.sbin/makefs/msdos

2013-01-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jan 27 22:07:20 UTC 2013

Modified Files:
src/usr.sbin/makefs/msdos: msdosfs_vnops.c

Log Message:
- some more debugging
- use msdosfs_update() -- should not be needed.
- remove sys/mount.h


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/makefs/msdos/msdosfs_vnops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/makefs/msdos/msdosfs_vnops.c
diff -u src/usr.sbin/makefs/msdos/msdosfs_vnops.c:1.9 src/usr.sbin/makefs/msdos/msdosfs_vnops.c:1.10
--- src/usr.sbin/makefs/msdos/msdosfs_vnops.c:1.9	Sun Jan 27 15:05:46 2013
+++ src/usr.sbin/makefs/msdos/msdosfs_vnops.c	Sun Jan 27 17:07:19 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: msdosfs_vnops.c,v 1.9 2013/01/27 20:05:46 christos Exp $ */
+/*	$NetBSD: msdosfs_vnops.c,v 1.10 2013/01/27 22:07:19 christos Exp $ */
 
 /*-
  * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -51,11 +51,10 @@
 #endif
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: msdosfs_vnops.c,v 1.9 2013/01/27 20:05:46 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: msdosfs_vnops.c,v 1.10 2013/01/27 22:07:19 christos Exp $);
 
 #include sys/param.h
 #include sys/mman.h
-#include sys/mount.h
 #include fcntl.h
 #include unistd.h
 
@@ -554,6 +553,7 @@ msdosfs_mkdire(const char *path, struct 
 	if (error)
 		goto bad2;
 
+	DPRINTF((%s(newcluster %lu)\n, __func__, newcluster));
 	memset(ndirent, 0, sizeof(ndirent));
 	ndirent.de_pmp = pmp;
 	ndirent.de_flag = DE_ACCESS | DE_CREATE | DE_UPDATE;
@@ -566,6 +566,8 @@ msdosfs_mkdire(const char *path, struct 
 	 */
 	bn = cntobn(pmp, newcluster);
 	lbn = de_bn2kb(pmp, bn);
+	DPRINTF((%s(newcluster %lu, bn=%lu, lbn=%lu)\n, __func__, newcluster,
+	bn, lbn));
 	/* always succeeds */
 	bp = getblk(pmp-pm_devvp, lbn, pmp-pm_bpcluster, 0, 0);
 	memset(bp-b_data, 0, pmp-pm_bpcluster);
@@ -616,6 +618,8 @@ msdosfs_mkdire(const char *path, struct 
 		goto bad;
 	if ((error = createde(ndirent, pdep, dep, cn)) != 0)
 		goto bad;
+	if ((error = msdosfs_updatede(dep)) != 0)
+		goto bad;
 	return dep;
 
 bad:



CVS commit: src/usr.sbin/makefs/msdos

2013-01-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jan 27 22:09:25 UTC 2013

Modified Files:
src/usr.sbin/makefs/msdos: msdosfs_vnops.c

Log Message:
undo c99


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/makefs/msdos/msdosfs_vnops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/makefs/msdos/msdosfs_vnops.c
diff -u src/usr.sbin/makefs/msdos/msdosfs_vnops.c:1.10 src/usr.sbin/makefs/msdos/msdosfs_vnops.c:1.11
--- src/usr.sbin/makefs/msdos/msdosfs_vnops.c:1.10	Sun Jan 27 17:07:19 2013
+++ src/usr.sbin/makefs/msdos/msdosfs_vnops.c	Sun Jan 27 17:09:24 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: msdosfs_vnops.c,v 1.10 2013/01/27 22:07:19 christos Exp $ */
+/*	$NetBSD: msdosfs_vnops.c,v 1.11 2013/01/27 22:09:24 christos Exp $ */
 
 /*-
  * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -51,7 +51,7 @@
 #endif
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: msdosfs_vnops.c,v 1.10 2013/01/27 22:07:19 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: msdosfs_vnops.c,v 1.11 2013/01/27 22:09:24 christos Exp $);
 
 #include sys/param.h
 #include sys/mman.h
@@ -419,7 +419,7 @@ msdosfs_wfile(const char *path, struct d
 	int error, fd;
 	size_t osize = dep-de_FileSize;
 	struct stat *st = node-inode-st;
-	size_t nsize;
+	size_t nsize, offs;
 	struct msdosfsmount *pmp = dep-de_pmp;
 	struct buf *bp;
 	char *dat;
@@ -460,7 +460,7 @@ msdosfs_wfile(const char *path, struct d
 	}
 	close(fd);
 
-	for (size_t offs = 0; offs  nsize;) {
+	for (offs = 0; offs  nsize;) {
 		int blsize, cpsize;
 		daddr_t bn;
 		u_long lbn = dep-de_StartCluster;



CVS commit: src/usr.sbin/makefs/msdos

2013-01-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jan 27 22:52:19 UTC 2013

Modified Files:
src/usr.sbin/makefs/msdos: msdosfs_vnops.c

Log Message:
- don't forget to set de_pmp
- unexpand inserted tabs to the . and .. strings!


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/makefs/msdos/msdosfs_vnops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/makefs/msdos/msdosfs_vnops.c
diff -u src/usr.sbin/makefs/msdos/msdosfs_vnops.c:1.11 src/usr.sbin/makefs/msdos/msdosfs_vnops.c:1.12
--- src/usr.sbin/makefs/msdos/msdosfs_vnops.c:1.11	Sun Jan 27 17:09:24 2013
+++ src/usr.sbin/makefs/msdos/msdosfs_vnops.c	Sun Jan 27 17:52:19 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: msdosfs_vnops.c,v 1.11 2013/01/27 22:09:24 christos Exp $ */
+/*	$NetBSD: msdosfs_vnops.c,v 1.12 2013/01/27 22:52:19 christos Exp $ */
 
 /*-
  * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -51,7 +51,7 @@
 #endif
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: msdosfs_vnops.c,v 1.11 2013/01/27 22:09:24 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: msdosfs_vnops.c,v 1.12 2013/01/27 22:52:19 christos Exp $);
 
 #include sys/param.h
 #include sys/mman.h
@@ -146,6 +146,7 @@ msdosfs_findslot(struct denode *dp, stru
 	int olddos = 1;
 
 	pmp = dp-de_pmp;
+
 	switch (unix2dosfn((const u_char *)cnp-cn_nameptr, dosfilename,
 	cnp-cn_namelen, 0)) {
 	case 0:
@@ -498,7 +499,7 @@ static const struct {
 	struct direntry dot;
 	struct direntry dotdot;
 } dosdirtemplate = {
-	{	.	 , 	,			/* the . entry */
+	{	.   ,,			/* the . entry */
 		ATTR_DIRECTORY,/* file attribute */
 		0,	/* reserved */
 		0, { 0, 0 }, { 0, 0 },			/* create time  date */
@@ -508,7 +509,7 @@ static const struct {
 		{ 0, 0 },/* startcluster */
 		{ 0, 0, 0, 0 }/* filesize */
 	},
-	{	..	 , 	,			/* the .. entry */
+	{	..  ,,			/* the .. entry */
 		ATTR_DIRECTORY,/* file attribute */
 		0,	/* reserved */
 		0, { 0, 0 }, { 0, 0 },			/* create time  date */
@@ -553,7 +554,6 @@ msdosfs_mkdire(const char *path, struct 
 	if (error)
 		goto bad2;
 
-	DPRINTF((%s(newcluster %lu)\n, __func__, newcluster));
 	memset(ndirent, 0, sizeof(ndirent));
 	ndirent.de_pmp = pmp;
 	ndirent.de_flag = DE_ACCESS | DE_CREATE | DE_UPDATE;
@@ -581,6 +581,8 @@ msdosfs_mkdire(const char *path, struct 
 	putushort(denp[0].deMDate, ndirent.de_MDate);
 	putushort(denp[0].deMTime, ndirent.de_MTime);
 	pcl = pdep-de_StartCluster;
+	DPRINTF((%s(pcl %lu, rootdirblk=%lu)\n, __func__, pcl,
+	pmp-pm_rootdirblk));
 	if (FAT32(pmp)  pcl == pmp-pm_rootdirblk)
 		pcl = 0;
 	putushort(denp[1].deStartCluster, pcl);
@@ -614,6 +616,7 @@ msdosfs_mkdire(const char *path, struct 
 	ndirent.de_FileSize = 0;
 	ndirent.de_dev = pdep-de_dev;
 	ndirent.de_devvp = pdep-de_devvp;
+	ndirent.de_pmp = pdep-de_pmp;
 	if ((error = msdosfs_findslot(pdep, cn)) != 0)
 		goto bad;
 	if ((error = createde(ndirent, pdep, dep, cn)) != 0)



CVS commit: src/usr.sbin/makefs/msdos

2013-01-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jan 27 22:52:38 UTC 2013

Modified Files:
src/usr.sbin/makefs/msdos: msdosfs_denode.c

Log Message:
fix root detection (although the code is a noop)


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/makefs/msdos/msdosfs_denode.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/makefs/msdos/msdosfs_denode.c
diff -u src/usr.sbin/makefs/msdos/msdosfs_denode.c:1.2 src/usr.sbin/makefs/msdos/msdosfs_denode.c:1.3
--- src/usr.sbin/makefs/msdos/msdosfs_denode.c:1.2	Sat Jan 26 11:50:46 2013
+++ src/usr.sbin/makefs/msdos/msdosfs_denode.c	Sun Jan 27 17:52:38 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: msdosfs_denode.c,v 1.2 2013/01/26 16:50:46 christos Exp $	*/
+/*	$NetBSD: msdosfs_denode.c,v 1.3 2013/01/27 22:52:38 christos Exp $	*/
 
 /*-
  * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -52,7 +52,7 @@
 #endif
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: msdosfs_denode.c,v 1.2 2013/01/26 16:50:46 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: msdosfs_denode.c,v 1.3 2013/01/27 22:52:38 christos Exp $);
 
 #include sys/param.h
 
@@ -215,7 +215,7 @@ detrunc(struct denode *dep, u_long lengt
 	 * recognize the root directory at this point in a file or
 	 * directory's life.
 	 */
-	if ((DETOV(dep) == (struct vnode *)-1)  !FAT32(pmp)) {
+	if (dep-de_vnode != NULL  !FAT32(pmp)) {
 		printf(detrunc(): can't truncate root directory, clust %ld, offset %ld\n,
 		dep-de_dirclust, dep-de_diroffset);
 		return (EINVAL);
@@ -323,7 +323,7 @@ deextend(struct denode *dep, u_long leng
 	/*
 	 * The root of a DOS filesystem cannot be extended.
 	 */
-	if ((DETOV(dep) == (struct vnode *)-1)  !FAT32(pmp))
+	if (dep-de_vnode != NULL  !FAT32(pmp))
 		return EINVAL;
 
 	/*



CVS commit: src/usr.sbin/makefs/msdos

2013-01-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jan 28 00:16:24 UTC 2013

Modified Files:
src/usr.sbin/makefs/msdos: msdosfs_denode.c

Log Message:
don't forget to initialize the cache.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/makefs/msdos/msdosfs_denode.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/makefs/msdos/msdosfs_denode.c
diff -u src/usr.sbin/makefs/msdos/msdosfs_denode.c:1.3 src/usr.sbin/makefs/msdos/msdosfs_denode.c:1.4
--- src/usr.sbin/makefs/msdos/msdosfs_denode.c:1.3	Sun Jan 27 17:52:38 2013
+++ src/usr.sbin/makefs/msdos/msdosfs_denode.c	Sun Jan 27 19:16:24 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: msdosfs_denode.c,v 1.3 2013/01/27 22:52:38 christos Exp $	*/
+/*	$NetBSD: msdosfs_denode.c,v 1.4 2013/01/28 00:16:24 christos Exp $	*/
 
 /*-
  * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -52,7 +52,7 @@
 #endif
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: msdosfs_denode.c,v 1.3 2013/01/27 22:52:38 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: msdosfs_denode.c,v 1.4 2013/01/28 00:16:24 christos Exp $);
 
 #include sys/param.h
 
@@ -113,6 +113,7 @@ deget(struct msdosfsmount *pmp, u_long d
 	ldep-de_pmp = pmp;
 	ldep-de_devvp = pmp-pm_devvp;
 	ldep-de_refcnt = 1;
+	fc_purge(ldep, 0);
 	/*
 	 * Copy the directory entry into the denode area of the vnode.
 	 */



CVS commit: src/usr.sbin/makefs/msdos

2013-01-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jan 28 00:16:48 UTC 2013

Modified Files:
src/usr.sbin/makefs/msdos: msdosfs_vnops.c

Log Message:
use pcbmap instead of the open coded hack now the pcbmap works.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/makefs/msdos/msdosfs_vnops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/makefs/msdos/msdosfs_vnops.c
diff -u src/usr.sbin/makefs/msdos/msdosfs_vnops.c:1.12 src/usr.sbin/makefs/msdos/msdosfs_vnops.c:1.13
--- src/usr.sbin/makefs/msdos/msdosfs_vnops.c:1.12	Sun Jan 27 17:52:19 2013
+++ src/usr.sbin/makefs/msdos/msdosfs_vnops.c	Sun Jan 27 19:16:48 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: msdosfs_vnops.c,v 1.12 2013/01/27 22:52:19 christos Exp $ */
+/*	$NetBSD: msdosfs_vnops.c,v 1.13 2013/01/28 00:16:48 christos Exp $ */
 
 /*-
  * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -51,7 +51,7 @@
 #endif
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: msdosfs_vnops.c,v 1.12 2013/01/27 22:52:19 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: msdosfs_vnops.c,v 1.13 2013/01/28 00:16:48 christos Exp $);
 
 #include sys/param.h
 #include sys/mman.h
@@ -424,6 +424,7 @@ msdosfs_wfile(const char *path, struct d
 	struct msdosfsmount *pmp = dep-de_pmp;
 	struct buf *bp;
 	char *dat;
+	u_long cn = 0;
 
 	DPRINTF((%s(diroff %lu, dirclust %lu, startcluster %lu)\n, __func__,
 	dep-de_diroffset, dep-de_dirclust, dep-de_StartCluster));
@@ -464,17 +465,23 @@ msdosfs_wfile(const char *path, struct d
 	for (offs = 0; offs  nsize;) {
 		int blsize, cpsize;
 		daddr_t bn;
-		u_long lbn = dep-de_StartCluster;
 		u_long on = offs  pmp-pm_crbomask;
-
-		if (lbn == MSDOSFSROOT) {
-			DPRINTF((%s: bad lbn %lu, __func__, lbn));
+#ifdef HACK
+		cn = dep-de_StartCluster;
+		if (cn == MSDOSFSROOT) {
+			DPRINTF((%s: bad lbn %lu, __func__, cn));
 			goto out;
 		}
-		bn = cntobn(pmp, lbn);
+		bn = cntobn(pmp, cn);
 		blsize = pmp-pm_bpcluster;
-		DPRINTF((%s(lbn=%lu, bn=%llu/%llu, blsize=%d)\n, __func__,
-		lbn, (unsigned long long)bn,
+#else
+		if ((error = pcbmap(dep, cn++, bn, NULL, blsize)) != 0) {
+			DPRINTF((%s: pcbmap %lu, __func__, bn));
+			goto out;
+		}
+#endif
+		DPRINTF((%s(cn=%lu, bn=%llu/%llu, blsize=%d)\n, __func__,
+		cn, (unsigned long long)bn,
 		(unsigned long long)de_bn2kb(pmp, bn), blsize));
 		if ((error = bread(pmp-pm_devvp, de_bn2kb(pmp, bn), blsize,
 		NULL, 0, bp)) != 0) {



CVS commit: src/usr.sbin/makefs/msdos

2013-01-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan 26 16:58:32 UTC 2013

Modified Files:
src/usr.sbin/makefs/msdos: msdosfs_vnops.c

Log Message:
depend on TOOLS instead of __NetBSD__ for extra functionality


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/makefs/msdos/msdosfs_vnops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/makefs/msdos/msdosfs_vnops.c
diff -u src/usr.sbin/makefs/msdos/msdosfs_vnops.c:1.3 src/usr.sbin/makefs/msdos/msdosfs_vnops.c:1.4
--- src/usr.sbin/makefs/msdos/msdosfs_vnops.c:1.3	Sat Jan 26 11:50:46 2013
+++ src/usr.sbin/makefs/msdos/msdosfs_vnops.c	Sat Jan 26 11:58:14 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: msdosfs_vnops.c,v 1.3 2013/01/26 16:50:46 christos Exp $	*/
+/*	$NetBSD: msdosfs_vnops.c,v 1.4 2013/01/26 16:58:14 christos Exp $	*/
 
 /*-
  * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -51,7 +51,7 @@
 #endif
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: msdosfs_vnops.c,v 1.3 2013/01/26 16:50:46 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: msdosfs_vnops.c,v 1.4 2013/01/26 16:58:14 christos Exp $);
 
 #include sys/param.h
 #include sys/mman.h
@@ -94,7 +94,7 @@ static void
 msdosfs_times(struct msdosfsmount *pmp, struct denode *dep,
 const struct stat *st)
 {
-#ifdef __NetBSD__
+#ifndef HAVE_NBTOOL_CONFIG_H
 	struct timespec at = st-st_atimespec;
 	struct timespec mt = st-st_mtimespec;
 #else