CVS commit: src

2011-08-10 Thread UCHIYAMA Yasushi
Module Name:src
Committed By:   uch
Date:   Wed Aug 10 11:31:49 UTC 2011

Modified Files:
src/sbin/newfs_v7fs: main.c newfs_v7fs.8 newfs_v7fs.c newfs_v7fs.h
src/usr.sbin/makefs: v7fs.c v7fs_makefs.h
src/usr.sbin/makefs/v7fs: v7fs_estimate.c v7fs_populate.c

Log Message:
newfs_v7fs(8)'s -v and -P options are obsolete. changed to newfs(8) compatible 
-V option.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sbin/newfs_v7fs/main.c
cvs rdiff -u -r1.2 -r1.3 src/sbin/newfs_v7fs/newfs_v7fs.8
cvs rdiff -u -r1.1 -r1.2 src/sbin/newfs_v7fs/newfs_v7fs.c \
src/sbin/newfs_v7fs/newfs_v7fs.h
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/makefs/v7fs.c
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/makefs/v7fs_makefs.h
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/makefs/v7fs/v7fs_estimate.c
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/makefs/v7fs/v7fs_populate.c

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

Modified files:

Index: src/sbin/newfs_v7fs/main.c
diff -u src/sbin/newfs_v7fs/main.c:1.9 src/sbin/newfs_v7fs/main.c:1.10
--- src/sbin/newfs_v7fs/main.c:1.9	Tue Aug  9 11:18:28 2011
+++ src/sbin/newfs_v7fs/main.c	Wed Aug 10 11:31:49 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.9 2011/08/09 11:18:28 uch Exp $	*/
+/*	$NetBSD: main.c,v 1.10 2011/08/10 11:31:49 uch Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: main.c,v 1.9 2011/08/09 11:18:28 uch Exp $);
+__RCSID($NetBSD: main.c,v 1.10 2011/08/10 11:31:49 uch Exp $);
 #endif /* not lint */
 
 #include sys/param.h
@@ -54,7 +54,8 @@
 #include newfs_v7fs.h
 #include progress.h /*../sbin/fsck */
 
-#define	VPRINTF(fmt, args...)	{ if (verbose) printf(fmt, ##args); }
+#define	VPRINTF(lv, fmt, args...)	{ if (v7fs_newfs_verbose = lv)	\
+	printf(fmt, ##args); }
 
 static v7fs_daddr_t
 determine_ilist_size(v7fs_daddr_t volume_size, int32_t files)
@@ -170,14 +171,14 @@
 		progress(0);
 		if (j == (int32_t)fs-superblock.volume_size)
 		{
-			VPRINTF(\nlast freeblock #%d\n,
+			VPRINTF(4, \nlast freeblock #%d\n,
 			(*val32)(fb-freeblock[i + 1]));
 
 			memmove(fb-freeblock + 1, fb-freeblock + i + 1, k *
 			sizeof(v7fs_daddr_t));
 			fb-freeblock[0] = 0; /* Terminate link; */
 			fb-nfreeblock = (*val16)(k + 1);
-			VPRINTF(last freeblock contains #%d\n,
+			VPRINTF(4, last freeblock contains #%d\n,
 			(*val16)(fb-nfreeblock));
 			fs-io.write(fs-io.cookie, buf, listblk);
 			return 0;
@@ -207,7 +208,7 @@
 	int32_t i, j;
 
 	/* Setup ilist. (ilist must be zero filled. becuase of they are free) */
-	VPRINTF(Zero clear ilist.\n);
+	VPRINTF(4, Zero clear ilist.\n);
 	progress((struct progress_arg){ .label = zero ilist, .tick =
 	ilist_size / PROGRESS_BAR_GRANULE });
 	memset(buf, 0, sizeof buf);
@@ -218,7 +219,7 @@
 #ifndef HAVE_NBTOOL_CONFIG_H
 	progress_done();
 #endif
-	VPRINTF(\n);
+	VPRINTF(4, \n);
 
 	/* Construct superblock */
 	sb = fs-superblock;
@@ -227,14 +228,14 @@
 	sb-update_time = time(NULL);
 
 	/* fill free inode cache. */
-	VPRINTF(Setup inode cache.\n);
+	VPRINTF(4, Setup inode cache.\n);
 	sb-nfreeinode = V7FS_MAX_FREEINODE;
 	for (i = V7FS_MAX_FREEINODE - 1, j = V7FS_ROOT_INODE; i = 0; i--, j++)
 		sb-freeinode[i] = j;
 	sb-total_freeinode = ilist_size * V7FS_INODE_PER_BLOCK - 1;
 
 	/* fill free block cache. */
-	VPRINTF(Setup free block cache.\n);
+	VPRINTF(4, Setup free block cache.\n);
 	sb-nfreeblock = V7FS_MAX_FREEBLOCK;
 	for (i = V7FS_MAX_FREEBLOCK - 1, j = sb-datablock_start_sector; i = 0;
 	i--, j++)
@@ -251,7 +252,7 @@
 	}
 
 	/* Construct freeblock list */
-	VPRINTF(Setup whole freeblock list.\n);
+	VPRINTF(4, Setup whole freeblock list.\n);
 	progress((struct progress_arg){ .label = freeblock list, .tick =
 	(volume_size - sb-datablock_start_sector) / PROGRESS_BAR_GRANULE});
 	blk = sb-freeblock[0];
@@ -261,7 +262,7 @@
 	progress_done();
 #endif
 
-	VPRINTF(done.\n);
+	VPRINTF(4, done.\n);
 
 	return 0;
 }
@@ -283,7 +284,7 @@
 
 	ilist_size = determine_ilist_size(volume_size, maxfile);
 
-	VPRINTF(volume size=%d, ilist size=%d, endian=%d, NAME_MAX=%d\n,
+	VPRINTF(1, volume size=%d, ilist size=%d, endian=%d, NAME_MAX=%d\n,
 	volume_size, ilist_size, mount-endian, V7FS_NAME_MAX);
 
 	/* Setup I/O ops. */

Index: src/sbin/newfs_v7fs/newfs_v7fs.8
diff -u src/sbin/newfs_v7fs/newfs_v7fs.8:1.2 src/sbin/newfs_v7fs/newfs_v7fs.8:1.3
--- src/sbin/newfs_v7fs/newfs_v7fs.8:1.2	Mon Jun 27 13:50:31 2011
+++ src/sbin/newfs_v7fs/newfs_v7fs.8	Wed Aug 10 11:31:49 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: newfs_v7fs.8,v 1.2 2011/06/27 13:50:31 wiz Exp $
+.\	$NetBSD: newfs_v7fs.8,v 1.3 2011/08/10 11:31:49 uch Exp $
 .\
 .\ Copyright (c) 2011 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -64,10 +64,11 @@
 .Nd construct a new 7th Edition(V7) File System
 .Sh SYNOPSIS
 .Nm
-.Op Fl FPvZ
+.Op Fl FZ
 .Op Fl B Ar byte-order
 .Op Fl n Ar inodes
 .Op Fl s Ar sectors

CVS commit: src/sbin/newfs_v7fs

2011-08-09 Thread UCHIYAMA Yasushi
Module Name:src
Committed By:   uch
Date:   Tue Aug  9 09:12:07 UTC 2011

Modified Files:
src/sbin/newfs_v7fs: main.c

Log Message:
Check whether superblock is writable sector.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sbin/newfs_v7fs/main.c

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

Modified files:

Index: src/sbin/newfs_v7fs/main.c
diff -u src/sbin/newfs_v7fs/main.c:1.7 src/sbin/newfs_v7fs/main.c:1.8
--- src/sbin/newfs_v7fs/main.c:1.7	Fri Jul 22 09:15:10 2011
+++ src/sbin/newfs_v7fs/main.c	Tue Aug  9 09:12:07 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.7 2011/07/22 09:15:10 uch Exp $	*/
+/*	$NetBSD: main.c,v 1.8 2011/08/09 09:12:07 uch Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: main.c,v 1.7 2011/07/22 09:15:10 uch Exp $);
+__RCSID($NetBSD: main.c,v 1.8 2011/08/09 09:12:07 uch Exp $);
 #endif /* not lint */
 
 #include sys/param.h
@@ -72,6 +72,26 @@
 }
 
 static int
+partition_check(struct v7fs_self *fs)
+{
+	struct v7fs_superblock *sb = fs-superblock;
+	int error;
+
+	if ((error = v7fs_superblock_load(fs))) {
+		warnx(Can't read superblock sector.);
+	}
+	sb-modified = 1;
+	if ((error = v7fs_superblock_writeback(fs))) {
+		if (errno == EROFS) {
+			warnx(Overwriting disk label? );
+		}
+		warnx(Can't write superblock sector.);
+	}
+
+	return error;
+}
+
+static int
 make_root(struct v7fs_self *fs)
 {
 	struct v7fs_inode inode;
@@ -126,7 +146,7 @@
 	v7fs_inode_writeback(fs, inode);
 	if ((error = v7fs_superblock_writeback(fs))) {
 		errno = error;
-		warn(Can't write superblock.);
+		warnx(Can't write superblock.);
 	}
 
 	return error;
@@ -272,6 +292,10 @@
 	fs-endian = mount-endian;
 	v7fs_endian_init(fs);
 
+	if ((error = partition_check(fs))) {
+		return error;
+	}
+
 	/* Construct filesystem. */
 	if ((error = make_filesystem(fs, volume_size, ilist_size))) {
 		return error;



CVS commit: src/sbin/newfs_v7fs

2011-08-09 Thread UCHIYAMA Yasushi
Module Name:src
Committed By:   uch
Date:   Tue Aug  9 11:18:29 UTC 2011

Modified Files:
src/sbin/newfs_v7fs: main.c

Log Message:
Fix warning message.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sbin/newfs_v7fs/main.c

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

Modified files:

Index: src/sbin/newfs_v7fs/main.c
diff -u src/sbin/newfs_v7fs/main.c:1.8 src/sbin/newfs_v7fs/main.c:1.9
--- src/sbin/newfs_v7fs/main.c:1.8	Tue Aug  9 09:12:07 2011
+++ src/sbin/newfs_v7fs/main.c	Tue Aug  9 11:18:28 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.8 2011/08/09 09:12:07 uch Exp $	*/
+/*	$NetBSD: main.c,v 1.9 2011/08/09 11:18:28 uch Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: main.c,v 1.8 2011/08/09 09:12:07 uch Exp $);
+__RCSID($NetBSD: main.c,v 1.9 2011/08/09 11:18:28 uch Exp $);
 #endif /* not lint */
 
 #include sys/param.h
@@ -78,7 +78,10 @@
 	int error;
 
 	if ((error = v7fs_superblock_load(fs))) {
-		warnx(Can't read superblock sector.);
+		if (error != EINVAL) {
+			/* Invalid superblock information is OK. */
+			warnx(Can't read superblock sector.);
+		}
 	}
 	sb-modified = 1;
 	if ((error = v7fs_superblock_writeback(fs))) {



CVS commit: src/sys/fs/v7fs

2011-08-08 Thread UCHIYAMA Yasushi
Module Name:src
Committed By:   uch
Date:   Mon Aug  8 11:42:30 UTC 2011

Modified Files:
src/sys/fs/v7fs: v7fs_io_user.c

Log Message:
Remove suspicious warning message.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/fs/v7fs/v7fs_io_user.c

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

Modified files:

Index: src/sys/fs/v7fs/v7fs_io_user.c
diff -u src/sys/fs/v7fs/v7fs_io_user.c:1.3 src/sys/fs/v7fs/v7fs_io_user.c:1.4
--- src/sys/fs/v7fs/v7fs_io_user.c:1.3	Wed Aug  3 16:21:52 2011
+++ src/sys/fs/v7fs/v7fs_io_user.c	Mon Aug  8 11:42:30 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: v7fs_io_user.c,v 1.3 2011/08/03 16:21:52 dholland Exp $	*/
+/*	$NetBSD: v7fs_io_user.c,v 1.4 2011/08/08 11:42:30 uch Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: v7fs_io_user.c,v 1.3 2011/08/03 16:21:52 dholland Exp $);
+__RCSID($NetBSD: v7fs_io_user.c,v 1.4 2011/08/08 11:42:30 uch Exp $);
 #endif /* not lint */
 
 #include stdio.h
@@ -88,7 +88,6 @@
 	local.addr = mmap(NULL, local.size, PROT_READ | PROT_WRITE | PROT_NONE,
 	MAP_FILE | MAP_SHARED/*writeback*/, local.fd,  0);
 	if (local.addr == MAP_FAILED) {
-		warn(mmap failed. use direct I/O.);
 		local.addr = 0;
 		p-io.read = read_sector;
 		p-io.write = write_sector;



CVS commit: src/sys/fs/v7fs

2011-07-29 Thread UCHIYAMA Yasushi
Module Name:src
Committed By:   uch
Date:   Sat Jul 30 03:51:53 UTC 2011

Modified Files:
src/sys/fs/v7fs: v7fs_file.c

Log Message:
Fix return vaule. Pass t_vnops:rename_dotdot, dir_noempty, rename_dir(6)


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/fs/v7fs/v7fs_file.c

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

Modified files:

Index: src/sys/fs/v7fs/v7fs_file.c
diff -u src/sys/fs/v7fs/v7fs_file.c:1.2 src/sys/fs/v7fs/v7fs_file.c:1.3
--- src/sys/fs/v7fs/v7fs_file.c:1.2	Mon Jul 18 21:51:49 2011
+++ src/sys/fs/v7fs/v7fs_file.c	Sat Jul 30 03:51:53 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: v7fs_file.c,v 1.2 2011/07/18 21:51:49 apb Exp $	*/
+/*	$NetBSD: v7fs_file.c,v 1.3 2011/07/30 03:51:53 uch Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #endif
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: v7fs_file.c,v 1.2 2011/07/18 21:51:49 apb Exp $);
+__KERNEL_RCSID(0, $NetBSD: v7fs_file.c,v 1.3 2011/07/30 03:51:53 uch Exp $);
 #if defined _KERNEL_OPT
 #include opt_v7fs.h
 #endif
@@ -247,16 +247,24 @@
 		return error;
 
 	if (v7fs_inode_isdir(inode)) {
-		/* Check child directory exists. */
+		char filename[V7FS_NAME_MAX + 1];
+		v7fs_dirent_filename(filename, name);
+		/* Check parent */
+		if (strncmp(filename, .., V7FS_NAME_MAX) == 0) {
+			DPRINTF(can not remove '..'\n);
+			return EINVAL; /* t_vnops rename_dotdot */
+		}
+		/* Check empty */
 		if (v7fs_inode_filesize(inode) !=
 		sizeof(struct v7fs_dirent) * 2 /*. + ..*/) {
-			DPRINTF(file exists.\n);
-			return EEXIST;
+			DPRINTF(directory not empty.\n);
+			return ENOTEMPTY;/* t_vnops dir_noempty, rename_dir(6)*/
 		}
 		inode.nlink = 0;	/* remove this. */
 	} else {
 		/* Decrement reference count. */
 		--inode.nlink;	/* regular file. */
+		DPRINTF(%s nlink=%d\n, name, inode.nlink);
 	}
 
 



CVS commit: src/sys/fs/v7fs

2011-07-29 Thread UCHIYAMA Yasushi
Module Name:src
Committed By:   uch
Date:   Sat Jul 30 03:52:05 UTC 2011

Modified Files:
src/sys/fs/v7fs: v7fs_file_util.c

Log Message:
When rename directory, check hierarchy. Pass t_vnops rename_dir(5)


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/fs/v7fs/v7fs_file_util.c

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

Modified files:

Index: src/sys/fs/v7fs/v7fs_file_util.c
diff -u src/sys/fs/v7fs/v7fs_file_util.c:1.3 src/sys/fs/v7fs/v7fs_file_util.c:1.4
--- src/sys/fs/v7fs/v7fs_file_util.c:1.3	Mon Jul 18 21:51:49 2011
+++ src/sys/fs/v7fs/v7fs_file_util.c	Sat Jul 30 03:52:04 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: v7fs_file_util.c,v 1.3 2011/07/18 21:51:49 apb Exp $	*/
+/*	$NetBSD: v7fs_file_util.c,v 1.4 2011/07/30 03:52:04 uch Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #endif
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: v7fs_file_util.c,v 1.3 2011/07/18 21:51:49 apb Exp $);
+__KERNEL_RCSID(0, $NetBSD: v7fs_file_util.c,v 1.4 2011/07/30 03:52:04 uch Exp $);
 #ifdef _KERNEL
 #include sys/systm.h
 #include sys/param.h
@@ -61,6 +61,9 @@
 static int replace_subr(struct v7fs_self *, void *, v7fs_daddr_t, size_t);
 static int lookup_by_number_subr(struct v7fs_self *, void *, v7fs_daddr_t,
 size_t);
+static int can_dirmove(struct v7fs_self *, v7fs_ino_t, v7fs_ino_t);
+static int lookup_parent_from_dir_subr(struct v7fs_self *, void *,
+v7fs_daddr_t, size_t);
 
 int
 v7fs_file_link(struct v7fs_self *fs, struct v7fs_inode *parent_dir,
@@ -118,26 +121,38 @@
 const char *from, struct v7fs_inode *parent_to, const char *to)
 {
 	v7fs_ino_t from_ino, to_ino;
+	struct v7fs_inode inode;
 	int error;
+	bool dir_move;
 
+	/* Check source file */
 	if ((error = v7fs_file_lookup_by_name(fs, parent_from, from,
 	from_ino))) {
 		DPRINTF(%s don't exists\n, from);
 		return error;
 	}
+	v7fs_inode_load(fs, inode, from_ino);
+	dir_move = v7fs_inode_isdir(inode);
 
-	/* If target file exists, remove. */
+	/* Check target file */
 	error = v7fs_file_lookup_by_name(fs, parent_to, to, to_ino);
-	if (error == 0) {
+	if (error == 0) {	/* found */
 		DPRINTF(%s already exists\n, to);
 		if ((error = v7fs_file_deallocate(fs, parent_to, to))) {
-			DPRINTF(%s can't remove\n, to);
+			DPRINTF(%s can't remove %d\n, to, error);
 			return error;
 		}
 	} else if (error != ENOENT) {
 		DPRINTF(error=%d\n, error);
 		return error;
 	}
+	/* Check directory hierarchy. t_vnops rename_dir(5) */
+	if (dir_move  (error = can_dirmove(fs, from_ino,
+	parent_to-inode_number))) {
+		DPRINTF(dst '%s' is child dir of '%s'. error=%d\n, to, from,
+		error);
+		return error;
+	}
 
 	if ((error = v7fs_directory_add_entry(fs, parent_to, from_ino, to))) {
 		DPRINTF(can't add entry);
@@ -149,18 +164,14 @@
 		return error;
 	}
 
-	if (parent_from != parent_to) {
+	if (dir_move  (parent_from != parent_to)) {
 		/* If directory move, update .. */
-		struct v7fs_inode inode;
-		v7fs_inode_load(fs, inode, from_ino);
-		if (v7fs_inode_isdir(inode)) {
-			if ((error = v7fs_directory_replace_entry(fs, inode,
-			.., parent_to-inode_number))) {
-DPRINTF(can't replace parent dir);
-return error;
-			}
-			v7fs_inode_writeback(fs, inode);
+		if ((error = v7fs_directory_replace_entry(fs, inode, ..,
+			parent_to-inode_number))) {
+			DPRINTF(can't replace parent dir);
+			return error;
 		}
+		v7fs_inode_writeback(fs, inode);
 	}
 
 	return 0;
@@ -258,3 +269,76 @@
 
 	return ret;
 }
+
+struct lookup_parent_arg {
+	v7fs_ino_t parent_ino;
+};
+
+static int
+can_dirmove(struct v7fs_self *fs, v7fs_ino_t from_ino, v7fs_ino_t to_ino)
+{
+	struct v7fs_inode inode;
+	v7fs_ino_t parent;
+	int error;
+
+	/* Start dir. */
+	if ((error = v7fs_inode_load(fs, inode, to_ino)))
+		return error;
+
+	if (!v7fs_inode_isdir(inode))
+		return ENOTDIR;
+
+	/* Lookup the parent. */
+	do {
+		struct lookup_parent_arg arg;
+		/* Search parent dir */
+		arg.parent_ino = 0;
+		v7fs_datablock_foreach(fs, inode, lookup_parent_from_dir_subr,
+		arg);
+		if ((parent = arg.parent_ino) == 0) {
+			DPRINTF(***parent missing\n);
+			return ENOENT;
+		}
+		/* Load parent dir */
+		if ((error = v7fs_inode_load(fs, inode, parent)))
+			return error;
+		if (parent == from_ino) {
+			DPRINTF(#%d is child dir of #%d\n, to_ino, from_ino);
+			return EINVAL;
+		}
+	} while (parent != V7FS_ROOT_INODE);
+
+	return 0;
+}
+
+static int
+lookup_parent_from_dir_subr(struct v7fs_self *fs, void *ctx, v7fs_daddr_t blk,
+size_t sz)
+{
+	struct lookup_parent_arg *arg = (struct lookup_parent_arg *)ctx;
+	char name[V7FS_NAME_MAX + 1];
+	void *buf;
+	int ret = 0;
+
+	if (!(buf = scratch_read(fs, blk)))
+		return 0;
+	struct v7fs_dirent *dir = (struct v7fs_dirent *)buf;
+	size_t i, n = sz / sizeof(*dir);
+	if (!v7fs_dirent_endian_convert(fs, dir, n)) {
+		scratch_free(fs, buf);
+		return V7FS_ITERATOR_ERROR;
+	}
+
+	for (i = 0; i 

CVS commit: src/sys/fs/v7fs

2011-07-29 Thread UCHIYAMA Yasushi
Module Name:src
Committed By:   uch
Date:   Sat Jul 30 03:53:18 UTC 2011

Modified Files:
src/sys/fs/v7fs: v7fs_vfsops.c v7fs_vnops.c

Log Message:
v7fs_lookup() fix return value. Pass t_vnops rename_dir(3)
v7fs_setttr() check credential. Pass t_unpriv owner
v7fs_rename() reload inode(v7fs_vnode_reload). Pass t_vnops rename_reg_nodir


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/fs/v7fs/v7fs_vfsops.c
cvs rdiff -u -r1.5 -r1.6 src/sys/fs/v7fs/v7fs_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/sys/fs/v7fs/v7fs_vfsops.c
diff -u src/sys/fs/v7fs/v7fs_vfsops.c:1.3 src/sys/fs/v7fs/v7fs_vfsops.c:1.4
--- src/sys/fs/v7fs/v7fs_vfsops.c:1.3	Sat Jul 23 05:10:30 2011
+++ src/sys/fs/v7fs/v7fs_vfsops.c	Sat Jul 30 03:53:18 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: v7fs_vfsops.c,v 1.3 2011/07/23 05:10:30 uch Exp $	*/
+/*	$NetBSD: v7fs_vfsops.c,v 1.4 2011/07/30 03:53:18 uch Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: v7fs_vfsops.c,v 1.3 2011/07/23 05:10:30 uch Exp $);
+__KERNEL_RCSID(0, $NetBSD: v7fs_vfsops.c,v 1.4 2011/07/30 03:53:18 uch Exp $);
 #if defined _KERNEL_OPT
 #include opt_v7fs.h
 #endif
@@ -75,6 +75,7 @@
 static void v7fs_closefs(struct vnode *, struct mount *);
 static int is_v7fs_partition(struct vnode *);
 static enum vtype v7fs_mode_to_vtype(v7fs_mode_t mode);
+int v7fs_vnode_reload(struct mount *, struct vnode *);
 
 int
 v7fs_mount(struct mount *mp, const char *path, void *data, size_t *data_len)
@@ -594,3 +595,34 @@
 
 	return 0;
 }
+
+/* Reload disk inode information */
+int
+v7fs_vnode_reload(struct mount *mp, struct vnode *vp)
+{
+	struct v7fs_mount *v7fsmount = mp-mnt_data;
+	struct v7fs_self *fs = v7fsmount-core;
+	struct v7fs_node *v7fs_node;
+	struct v7fs_inode *inode = ((struct v7fs_node *)vp-v_data)-inode;
+	int target_ino = inode-inode_number;
+	int error = 0;
+
+	DPRINTF(#%d\n, target_ino);
+	mutex_enter(mntvnode_lock);
+	for (v7fs_node = LIST_FIRST(v7fsmount-v7fs_node_head);
+	 v7fs_node != NULL; v7fs_node = LIST_NEXT(v7fs_node, link)) {
+		inode = v7fs_node-inode;
+		if (!v7fs_inode_allocated(inode)) {
+			continue;
+		}
+		if (inode-inode_number == target_ino) {
+			error = v7fs_inode_load(fs, v7fs_node-inode,
+			target_ino);
+			DPRINTF(sync #%d error=%d\n, target_ino, error);
+			break;
+		}
+	}
+	mutex_exit(mntvnode_lock);
+
+	return error;
+}

Index: src/sys/fs/v7fs/v7fs_vnops.c
diff -u src/sys/fs/v7fs/v7fs_vnops.c:1.5 src/sys/fs/v7fs/v7fs_vnops.c:1.6
--- src/sys/fs/v7fs/v7fs_vnops.c:1.5	Sun Jul 24 12:31:33 2011
+++ src/sys/fs/v7fs/v7fs_vnops.c	Sat Jul 30 03:53:18 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: v7fs_vnops.c,v 1.5 2011/07/24 12:31:33 uch Exp $	*/
+/*	$NetBSD: v7fs_vnops.c,v 1.6 2011/07/30 03:53:18 uch Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: v7fs_vnops.c,v 1.5 2011/07/24 12:31:33 uch Exp $);
+__KERNEL_RCSID(0, $NetBSD: v7fs_vnops.c,v 1.6 2011/07/30 03:53:18 uch Exp $);
 #if defined _KERNEL_OPT
 #include opt_v7fs.h
 #endif
@@ -67,6 +67,8 @@
 MALLOC_JUSTDEFINE(M_V7FS_VNODE, v7fs vnode, v7fs vnode structures);
 MALLOC_DECLARE(M_V7FS);
 
+int v7fs_vnode_reload(struct mount *, struct vnode *);
+
 static v7fs_mode_t vtype_to_v7fs_mode(enum vtype);
 static uint8_t v7fs_mode_to_d_type(v7fs_mode_t);
 
@@ -110,9 +112,11 @@
 	bool islastcn = flags  ISLASTCN;
 	v7fs_ino_t ino;
 	int error;
-
-	DPRINTF(%s op=%d flags=%d parent=%d %o %dbyte\n, name,
-	nameiop, cnp-cn_flags, parent-inode_number, parent-mode,
+#ifdef V7FS_VNOPS_DEBUG
+	const char *opname[] = { LOOKUP, CREATE, DELETE, RENAME };
+#endif
+	DPRINTF('%s' op=%s flags=%d parent=%d %o %dbyte\n, name,
+	opname[nameiop], cnp-cn_flags, parent-inode_number, parent-mode,
 	parent-filesize);
 
 	*a-a_vpp = 0;
@@ -132,6 +136,9 @@
 
 	/* . */
 	if (namelen == 1  name[0] == '.') {
+		if ((nameiop == RENAME)  islastcn) {
+			return EISDIR; /* t_vnops rename_dir(3) */
+		}
 		vref(dvp); /* v_usecount++ */
 		*a-a_vpp = dvp;
 		DPRINTF(done.(.)\n);
@@ -170,7 +177,7 @@
 		vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY);
 	}
 	*a-a_vpp = vpp;
-	DPRINTF(done.\n);
+	DPRINTF(done.(%s)\n, name);
 
 	return 0;
 }
@@ -439,6 +446,7 @@
 	struct v7fs_node *v7node = vp-v_data;
 	struct v7fs_self *fs = v7node-v7fsmount-core;
 	struct v7fs_inode *inode = v7node-inode;
+	kauth_cred_t cred = ap-a_cred;
 	struct timespec *acc, *mod;
 	int error = 0;
 	acc = mod = NULL;
@@ -477,15 +485,38 @@
 		if (error == 0)
 			uvm_vnp_setsize(vp, vap-va_size);
 	}
+	uid_t uid = inode-uid;
+	gid_t gid = inode-gid;
 
 	if (vap-va_uid != (uid_t)VNOVAL) {
-		inode-uid = vap-va_uid;
+		uid = vap-va_uid;
+		error = kauth_authorize_vnode(cred,
+		KAUTH_VNODE_CHANGE_OWNERSHIP, vp, NULL,
+		genfs_can_chown(vp, cred, inode-uid, 

CVS commit: src

2011-07-24 Thread UCHIYAMA Yasushi
Module Name:src
Committed By:   uch
Date:   Sun Jul 24 08:55:31 UTC 2011

Modified Files:
src/distrib/sets/lists/base: mi shl.mi
src/distrib/sets/lists/comp: mi shl.mi
src/distrib/sets/lists/man: mi
src/sys/rump/fs: Makefile.rumpfscomp
src/usr.sbin/puffs: Makefile makerumpmanpages.sh
Added Files:
src/sys/rump/fs/lib/libv7fs: Makefile shlib_version
src/usr.sbin/puffs/rump_v7fs: rump_v7fs.8 rump_v7fs.c

Log Message:
v7fs rump support


To generate a diff of this commit:
cvs rdiff -u -r1.944 -r1.945 src/distrib/sets/lists/base/mi
cvs rdiff -u -r1.592 -r1.593 src/distrib/sets/lists/base/shl.mi
cvs rdiff -u -r1.1646 -r1.1647 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.181 -r1.182 src/distrib/sets/lists/comp/shl.mi
cvs rdiff -u -r1.1325 -r1.1326 src/distrib/sets/lists/man/mi
cvs rdiff -u -r1.3 -r1.4 src/sys/rump/fs/Makefile.rumpfscomp
cvs rdiff -u -r0 -r1.1 src/sys/rump/fs/lib/libv7fs/Makefile \
src/sys/rump/fs/lib/libv7fs/shlib_version
cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/puffs/Makefile
cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/puffs/makerumpmanpages.sh
cvs rdiff -u -r0 -r1.1 src/usr.sbin/puffs/rump_v7fs/rump_v7fs.8 \
src/usr.sbin/puffs/rump_v7fs/rump_v7fs.c

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

Modified files:

Index: src/distrib/sets/lists/base/mi
diff -u src/distrib/sets/lists/base/mi:1.944 src/distrib/sets/lists/base/mi:1.945
--- src/distrib/sets/lists/base/mi:1.944	Sat Jul  9 21:24:29 2011
+++ src/distrib/sets/lists/base/mi	Sun Jul 24 08:55:28 2011
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.944 2011/07/09 21:24:29 tron Exp $
+# $NetBSD: mi,v 1.945 2011/07/24 08:55:28 uch Exp $
 #
 # Note:	Don't delete entries from here - mark them as obsolete instead,
 #	unless otherwise stated below.
@@ -1402,6 +1402,7 @@
 ./usr/sbin/rump_sysvbfsbase-puffs-bin
 ./usr/sbin/rump_tmpfsbase-puffs-bin
 ./usr/sbin/rump_udfbase-puffs-bin
+./usr/sbin/rump_v7fsbase-puffs-bin
 ./usr/sbin/rwhodbase-netutil-bin
 ./usr/sbin/sa	base-sysutil-bin
 ./usr/sbin/screenblankbase-sysutil-bin

Index: src/distrib/sets/lists/base/shl.mi
diff -u src/distrib/sets/lists/base/shl.mi:1.592 src/distrib/sets/lists/base/shl.mi:1.593
--- src/distrib/sets/lists/base/shl.mi:1.592	Tue Jul  5 22:05:36 2011
+++ src/distrib/sets/lists/base/shl.mi	Sun Jul 24 08:55:28 2011
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.592 2011/07/05 22:05:36 spz Exp $
+# $NetBSD: shl.mi,v 1.593 2011/07/24 08:55:28 uch Exp $
 #
 # Note:	Don't delete entries from here - mark them as obsolete instead,
 #	unless otherwise stated below.
@@ -556,6 +556,9 @@
 ./usr/lib/librumpfs_union.so			base-rump-shlib
 ./usr/lib/librumpfs_union.so.0			base-rump-shlib
 ./usr/lib/librumpfs_union.so.0.0		base-rump-shlib
+./usr/lib/librumpfs_v7fs.so			base-rump-shlib
+./usr/lib/librumpfs_v7fs.so.0			base-rump-shlib
+./usr/lib/librumpfs_v7fs.so.0.0			base-rump-shlib
 ./usr/lib/librumpfs_zfs.so			base-rump-shlib		zfs
 ./usr/lib/librumpfs_zfs.so.0			base-rump-shlib		zfs
 ./usr/lib/librumpfs_zfs.so.0.0			base-rump-shlib		zfs

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.1646 src/distrib/sets/lists/comp/mi:1.1647
--- src/distrib/sets/lists/comp/mi:1.1646	Thu Jul 21 03:13:31 2011
+++ src/distrib/sets/lists/comp/mi	Sun Jul 24 08:55:29 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.1646 2011/07/21 03:13:31 mrg Exp $
+#	$NetBSD: mi,v 1.1647 2011/07/24 08:55:29 uch Exp $
 #
 # Note: don't delete entries from here - mark them as obsolete instead.
 #
@@ -3140,6 +3140,9 @@
 ./usr/lib/librumpfs_union.a			comp-c-lib
 ./usr/lib/librumpfs_union_g.a			-unknown-		debuglib
 ./usr/lib/librumpfs_union_p.a			comp-c-proflib		profile
+./usr/lib/librumpfs_v7fs.a			comp-c-lib
+./usr/lib/librumpfs_v7fs_g.a			-unknown-		debuglib
+./usr/lib/librumpfs_v7fs_p.a			comp-c-proflib		profile
 ./usr/lib/librumpfs_zfs.a			comp-c-lib		zfs
 ./usr/lib/librumpfs_zfs_g.a			-unknown-		zfs,debuglib
 ./usr/lib/librumpfs_zfs_p.a			comp-c-piclib		zfs,profile
@@ -4189,6 +4192,7 @@
 ./usr/libdata/debug/usr/sbin/rump_sysvbfs.debug	comp-puffs-debug	debug
 ./usr/libdata/debug/usr/sbin/rump_tmpfs.debug	comp-puffs-debug	debug
 ./usr/libdata/debug/usr/sbin/rump_udf.debug	comp-puffs-debug	debug
+./usr/libdata/debug/usr/sbin/rump_v7fs.debug	comp-puffs-debug	debug
 ./usr/libdata/debug/usr/sbin/rwhod.debug	comp-netutil-debug	debug
 ./usr/libdata/debug/usr/sbin/sa.debug		comp-sysutil-debug	debug
 ./usr/libdata/debug/usr/sbin/schedctl.debug	comp-sysutil-debug	debug

Index: src/distrib/sets/lists/comp/shl.mi
diff -u src/distrib/sets/lists/comp/shl.mi:1.181 src/distrib/sets/lists/comp/shl.mi:1.182
--- src/distrib/sets/lists/comp/shl.mi:1.181	Thu Jul 21 03:13:32 2011
+++ src/distrib/sets/lists/comp/shl.mi	Sun Jul 24 08:55:30 2011
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.181 2011/07/21 03:13:32 mrg Exp $
+# $NetBSD: shl.mi,v 1.182 2011/07/24 08:55:30 uch Exp $
 #
 # Note: don't 

CVS commit: src/usr.sbin/puffs

2011-07-24 Thread UCHIYAMA Yasushi
Module Name:src
Committed By:   uch
Date:   Sun Jul 24 09:00:08 UTC 2011

Modified Files:
src/usr.sbin/puffs/rump_cd9660: rump_cd9660.8
src/usr.sbin/puffs/rump_efs: rump_efs.8
src/usr.sbin/puffs/rump_ext2fs: rump_ext2fs.8
src/usr.sbin/puffs/rump_fdesc: rump_fdesc.8
src/usr.sbin/puffs/rump_ffs: rump_ffs.8
src/usr.sbin/puffs/rump_hfs: rump_hfs.8
src/usr.sbin/puffs/rump_kernfs: rump_kernfs.8
src/usr.sbin/puffs/rump_lfs: rump_lfs.8
src/usr.sbin/puffs/rump_msdos: rump_msdos.8
src/usr.sbin/puffs/rump_nfs: rump_nfs.8
src/usr.sbin/puffs/rump_ntfs: rump_ntfs.8
src/usr.sbin/puffs/rump_smbfs: rump_smbfs.8
src/usr.sbin/puffs/rump_sysvbfs: rump_sysvbfs.8
src/usr.sbin/puffs/rump_tmpfs: rump_tmpfs.8
src/usr.sbin/puffs/rump_udf: rump_udf.8
Added Files:
src/usr.sbin/puffs/rump_v7fs: Makefile

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/puffs/rump_cd9660/rump_cd9660.8
cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/puffs/rump_efs/rump_efs.8
cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/puffs/rump_ext2fs/rump_ext2fs.8
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/puffs/rump_fdesc/rump_fdesc.8
cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/puffs/rump_ffs/rump_ffs.8
cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/puffs/rump_hfs/rump_hfs.8
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/puffs/rump_kernfs/rump_kernfs.8
cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/puffs/rump_lfs/rump_lfs.8
cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/puffs/rump_msdos/rump_msdos.8
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/puffs/rump_nfs/rump_nfs.8
cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/puffs/rump_ntfs/rump_ntfs.8
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/puffs/rump_smbfs/rump_smbfs.8
cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/puffs/rump_sysvbfs/rump_sysvbfs.8
cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/puffs/rump_tmpfs/rump_tmpfs.8
cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/puffs/rump_udf/rump_udf.8
cvs rdiff -u -r0 -r1.1 src/usr.sbin/puffs/rump_v7fs/Makefile

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/puffs/rump_cd9660/rump_cd9660.8
diff -u src/usr.sbin/puffs/rump_cd9660/rump_cd9660.8:1.12 src/usr.sbin/puffs/rump_cd9660/rump_cd9660.8:1.13
--- src/usr.sbin/puffs/rump_cd9660/rump_cd9660.8:1.12	Mon Nov 22 07:56:54 2010
+++ src/usr.sbin/puffs/rump_cd9660/rump_cd9660.8	Sun Jul 24 09:00:06 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: rump_cd9660.8,v 1.12 2010/11/22 07:56:54 pooka Exp $
+.\	$NetBSD: rump_cd9660.8,v 1.13 2011/07/24 09:00:06 uch Exp $
 .\
 .\	WARNING: GENERATED FILE, DO NOT EDIT
 .\	INSTEAD, EDIT makerumpmanpages.sh AND REGEN

Index: src/usr.sbin/puffs/rump_efs/rump_efs.8
diff -u src/usr.sbin/puffs/rump_efs/rump_efs.8:1.12 src/usr.sbin/puffs/rump_efs/rump_efs.8:1.13
--- src/usr.sbin/puffs/rump_efs/rump_efs.8:1.12	Mon Nov 22 07:56:55 2010
+++ src/usr.sbin/puffs/rump_efs/rump_efs.8	Sun Jul 24 09:00:06 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: rump_efs.8,v 1.12 2010/11/22 07:56:55 pooka Exp $
+.\	$NetBSD: rump_efs.8,v 1.13 2011/07/24 09:00:06 uch Exp $
 .\
 .\	WARNING: GENERATED FILE, DO NOT EDIT
 .\	INSTEAD, EDIT makerumpmanpages.sh AND REGEN

Index: src/usr.sbin/puffs/rump_ext2fs/rump_ext2fs.8
diff -u src/usr.sbin/puffs/rump_ext2fs/rump_ext2fs.8:1.12 src/usr.sbin/puffs/rump_ext2fs/rump_ext2fs.8:1.13
--- src/usr.sbin/puffs/rump_ext2fs/rump_ext2fs.8:1.12	Mon Nov 22 07:56:55 2010
+++ src/usr.sbin/puffs/rump_ext2fs/rump_ext2fs.8	Sun Jul 24 09:00:06 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: rump_ext2fs.8,v 1.12 2010/11/22 07:56:55 pooka Exp $
+.\	$NetBSD: rump_ext2fs.8,v 1.13 2011/07/24 09:00:06 uch Exp $
 .\
 .\	WARNING: GENERATED FILE, DO NOT EDIT
 .\	INSTEAD, EDIT makerumpmanpages.sh AND REGEN

Index: src/usr.sbin/puffs/rump_fdesc/rump_fdesc.8
diff -u src/usr.sbin/puffs/rump_fdesc/rump_fdesc.8:1.5 src/usr.sbin/puffs/rump_fdesc/rump_fdesc.8:1.6
--- src/usr.sbin/puffs/rump_fdesc/rump_fdesc.8:1.5	Mon Nov 22 07:56:55 2010
+++ src/usr.sbin/puffs/rump_fdesc/rump_fdesc.8	Sun Jul 24 09:00:06 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: rump_fdesc.8,v 1.5 2010/11/22 07:56:55 pooka Exp $
+.\	$NetBSD: rump_fdesc.8,v 1.6 2011/07/24 09:00:06 uch Exp $
 .\
 .\	WARNING: GENERATED FILE, DO NOT EDIT
 .\	INSTEAD, EDIT makerumpmanpages.sh AND REGEN

Index: src/usr.sbin/puffs/rump_ffs/rump_ffs.8
diff -u src/usr.sbin/puffs/rump_ffs/rump_ffs.8:1.12 src/usr.sbin/puffs/rump_ffs/rump_ffs.8:1.13
--- src/usr.sbin/puffs/rump_ffs/rump_ffs.8:1.12	Mon Nov 22 07:56:55 2010
+++ src/usr.sbin/puffs/rump_ffs/rump_ffs.8	Sun Jul 24 09:00:06 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: rump_ffs.8,v 1.12 2010/11/22 07:56:55 pooka Exp $
+.\	$NetBSD: rump_ffs.8,v 1.13 2011/07/24 09:00:06 uch Exp $
 .\
 .\	WARNING: GENERATED FILE, DO NOT EDIT
 .\	INSTEAD, EDIT makerumpmanpages.sh AND REGEN

Index: src/usr.sbin/puffs/rump_hfs/rump_hfs.8
diff -u src/usr.sbin/puffs/rump_hfs/rump_hfs.8:1.12 

CVS commit: src/sys/fs/v7fs

2011-07-24 Thread UCHIYAMA Yasushi
Module Name:src
Committed By:   uch
Date:   Sun Jul 24 12:31:33 UTC 2011

Modified Files:
src/sys/fs/v7fs: v7fs_vnops.c

Log Message:
Existing inode don't recycle. rump works.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/fs/v7fs/v7fs_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/sys/fs/v7fs/v7fs_vnops.c
diff -u src/sys/fs/v7fs/v7fs_vnops.c:1.4 src/sys/fs/v7fs/v7fs_vnops.c:1.5
--- src/sys/fs/v7fs/v7fs_vnops.c:1.4	Sat Jul 16 12:35:40 2011
+++ src/sys/fs/v7fs/v7fs_vnops.c	Sun Jul 24 12:31:33 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: v7fs_vnops.c,v 1.4 2011/07/16 12:35:40 uch Exp $	*/
+/*	$NetBSD: v7fs_vnops.c,v 1.5 2011/07/24 12:31:33 uch Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: v7fs_vnops.c,v 1.4 2011/07/16 12:35:40 uch Exp $);
+__KERNEL_RCSID(0, $NetBSD: v7fs_vnops.c,v 1.5 2011/07/24 12:31:33 uch Exp $);
 #if defined _KERNEL_OPT
 #include opt_v7fs.h
 #endif
@@ -954,14 +954,14 @@
 	struct v7fs_node *v7node = vp-v_data;
 	struct v7fs_inode *inode = v7node-inode;
 
-	DPRINTF(%p\n, vp);
-
+	DPRINTF(%p #%d\n, vp, inode-inode_number);
 	if (v7fs_inode_allocated(inode)) {
 		v7fs_update(vp, 0, 0, UPDATE_WAIT);
+		*a-a_recycle = false;
+	} else {
+		*a-a_recycle = true;
 	}
 
-	*a-a_recycle = true;
-
 	VOP_UNLOCK(vp);
 
 	return 0;
@@ -978,7 +978,7 @@
 	struct vnode *vp = a-a_vp;
 	struct v7fs_node *v7node = vp-v_data;
 
-	DPRINTF(%p\n, vp);
+	DPRINTF(%p #%d\n, vp, v7node-inode.inode_number);
 	mutex_enter(mntvnode_lock);
 	LIST_REMOVE(v7node, link);
 	mutex_exit(mntvnode_lock);



CVS commit: src/sbin/newfs_v7fs

2011-07-22 Thread UCHIYAMA Yasushi
Module Name:src
Committed By:   uch
Date:   Fri Jul 22 09:15:10 UTC 2011

Modified Files:
src/sbin/newfs_v7fs: main.c

Log Message:
Fixed the problem that partition size over 8GiB(v7fs filesystem limit) failed 
newfs.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sbin/newfs_v7fs/main.c

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

Modified files:

Index: src/sbin/newfs_v7fs/main.c
diff -u src/sbin/newfs_v7fs/main.c:1.6 src/sbin/newfs_v7fs/main.c:1.7
--- src/sbin/newfs_v7fs/main.c:1.6	Tue Jul 19 19:57:54 2011
+++ src/sbin/newfs_v7fs/main.c	Fri Jul 22 09:15:10 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.6 2011/07/19 19:57:54 tron Exp $	*/
+/*	$NetBSD: main.c,v 1.7 2011/07/22 09:15:10 uch Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: main.c,v 1.6 2011/07/19 19:57:54 tron Exp $);
+__RCSID($NetBSD: main.c,v 1.7 2011/07/22 09:15:10 uch Exp $);
 #endif /* not lint */
 
 #include sys/param.h
@@ -252,8 +252,11 @@
 	v7fs_daddr_t volume_size = mount-sectors;
 
 	/* Check and determine ilistblock, datablock size. */
-	if (volume_size  V7FS_DADDR_MAX + 1)
-		return ENOSPC;
+	if (volume_size  V7FS_DADDR_MAX + 1) {
+		warnx(volume size %d over v7fs limit %d. truncated.,
+		volume_size, V7FS_DADDR_MAX + 1);
+		volume_size = V7FS_DADDR_MAX + 1;
+	}
 
 	ilist_size = determine_ilist_size(volume_size, maxfile);
 



CVS commit: src/sys/fs/v7fs

2011-07-22 Thread UCHIYAMA Yasushi
Module Name:src
Committed By:   uch
Date:   Sat Jul 23 05:10:30 UTC 2011

Modified Files:
src/sys/fs/v7fs: v7fs_vfsops.c

Log Message:
remove partition check from v7fs_mount. problem on rump implementation.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/fs/v7fs/v7fs_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/sys/fs/v7fs/v7fs_vfsops.c
diff -u src/sys/fs/v7fs/v7fs_vfsops.c:1.2 src/sys/fs/v7fs/v7fs_vfsops.c:1.3
--- src/sys/fs/v7fs/v7fs_vfsops.c:1.2	Sat Jul  2 01:05:38 2011
+++ src/sys/fs/v7fs/v7fs_vfsops.c	Sat Jul 23 05:10:30 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: v7fs_vfsops.c,v 1.2 2011/07/02 01:05:38 uch Exp $	*/
+/*	$NetBSD: v7fs_vfsops.c,v 1.3 2011/07/23 05:10:30 uch Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: v7fs_vfsops.c,v 1.2 2011/07/02 01:05:38 uch Exp $);
+__KERNEL_RCSID(0, $NetBSD: v7fs_vfsops.c,v 1.3 2011/07/23 05:10:30 uch Exp $);
 #if defined _KERNEL_OPT
 #include opt_v7fs.h
 #endif
@@ -223,15 +223,8 @@
 		goto unlock_exit;
 	}
 
-	/* Get partition information */
-	if ((error = is_v7fs_partition(devvp))) {
-		goto close_exit;
-	}
-
 	return 0; /* lock held */
 
-close_exit:
-	VOP_CLOSE(devvp, oflags, NOCRED);
 unlock_exit:
 	VOP_UNLOCK(devvp);
 



CVS commit: src/usr.sbin/makefs

2011-07-18 Thread UCHIYAMA Yasushi
Module Name:src
Committed By:   uch
Date:   Mon Jul 18 08:58:39 UTC 2011

Modified Files:
src/usr.sbin/makefs: Makefile README makefs.8 makefs.c makefs.h
Added Files:
src/usr.sbin/makefs: v7fs.c v7fs_makefs.h
src/usr.sbin/makefs/v7fs: Makefile.inc v7fs_estimate.c v7fs_populate.c

Log Message:
v7fs(7th edition(V7) file system) support.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/makefs/Makefile
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/makefs/README
cvs rdiff -u -r1.33 -r1.34 src/usr.sbin/makefs/makefs.8
cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/makefs/makefs.c
cvs rdiff -u -r1.20 -r1.21 src/usr.sbin/makefs/makefs.h
cvs rdiff -u -r0 -r1.1 src/usr.sbin/makefs/v7fs.c \
src/usr.sbin/makefs/v7fs_makefs.h
cvs rdiff -u -r0 -r1.1 src/usr.sbin/makefs/v7fs/Makefile.inc \
src/usr.sbin/makefs/v7fs/v7fs_estimate.c \
src/usr.sbin/makefs/v7fs/v7fs_populate.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/Makefile
diff -u src/usr.sbin/makefs/Makefile:1.25 src/usr.sbin/makefs/Makefile:1.26
--- src/usr.sbin/makefs/Makefile:1.25	Wed Apr 22 15:23:05 2009
+++ src/usr.sbin/makefs/Makefile	Mon Jul 18 08:58:38 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.25 2009/04/22 15:23:05 lukem Exp $
+#	$NetBSD: Makefile,v 1.26 2011/07/18 08:58:38 uch Exp $
 #
 
 WARNS?=	3	# XXX -Wsign-compare
@@ -6,7 +6,7 @@
 .include bsd.own.mk
 
 PROG=	makefs
-SRCS=	cd9660.c ffs.c \
+SRCS=	cd9660.c ffs.c v7fs.c \
 	getid.c \
 	makefs.c misc.c \
 	pack_dev.c \
@@ -22,6 +22,7 @@
 
 .include ${.CURDIR}/cd9660/Makefile.inc
 .include ${.CURDIR}/ffs/Makefile.inc
+.include ${.CURDIR}/v7fs/Makefile.inc
 
 .if (${HOSTPROG:U} == )
 DPADD+= ${LIBUTIL}

Index: src/usr.sbin/makefs/README
diff -u src/usr.sbin/makefs/README:1.4 src/usr.sbin/makefs/README:1.5
--- src/usr.sbin/makefs/README:1.4	Sat Jan  3 08:25:35 2009
+++ src/usr.sbin/makefs/README	Mon Jul 18 08:58:38 2011
@@ -1,4 +1,4 @@
-$NetBSD: README,v 1.4 2009/01/03 08:25:35 lukem Exp $
+$NetBSD: README,v 1.5 2011/07/18 08:58:38 uch Exp $
 
 makefs - build a file system image from a directory tree
 
@@ -17,6 +17,7 @@
 the following file system types can be built:
 	ffs	BSD fast file system
 	cd9660	ISO 9660 file system
+	v7fs	7th edition(V7) file system
 
 Support for the following file systems maybe be added in the future
 	ext2fs	Linux EXT2 file system

Index: src/usr.sbin/makefs/makefs.8
diff -u src/usr.sbin/makefs/makefs.8:1.33 src/usr.sbin/makefs/makefs.8:1.34
--- src/usr.sbin/makefs/makefs.8:1.33	Sun May 22 21:51:39 2011
+++ src/usr.sbin/makefs/makefs.8	Mon Jul 18 08:58:38 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: makefs.8,v 1.33 2011/05/22 21:51:39 christos Exp $
+.\	$NetBSD: makefs.8,v 1.34 2011/07/18 08:58:38 uch Exp $
 .\
 .\ Copyright (c) 2001-2003 Wasabi Systems, Inc.
 .\ All rights reserved.
@@ -191,6 +191,8 @@
 BSD fast file system (default).
 .It Sy cd9660
 ISO 9660 file system.
+.It Sy v7fs
+7th Edition(V7) file system.
 .El
 .It Fl x
 Exclude file system nodes not explicitly listed in the specfile.
@@ -327,6 +329,16 @@
 .It Sy volumeid
 Volume set identifier of the image.
 .El
+.Ss V7FS-specific options
+The following keywords are supported:
+.Pp
+.Bl -tag -width optimization -offset indent -compact
+.It Sy pdp
+PDP endian.
+.It Sy progress
+Display a progress meter for the file system construction and file
+popuration.
+.El
 .Sh SEE ALSO
 .Xr strsuftoll 3 ,
 .Xr installboot 8 ,
@@ -346,4 +358,6 @@
 .An Ryan Gabrys ,
 .An Alan Perez-Rathke ,
 .An Ram Vedam
-(cd9660 support)
+(cd9660 support),
+.An UCHIYAMA Yasushi
+(v7fs support)

Index: src/usr.sbin/makefs/makefs.c
diff -u src/usr.sbin/makefs/makefs.c:1.26 src/usr.sbin/makefs/makefs.c:1.27
--- src/usr.sbin/makefs/makefs.c:1.26	Sun Oct 22 21:11:56 2006
+++ src/usr.sbin/makefs/makefs.c	Mon Jul 18 08:58:38 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: makefs.c,v 1.26 2006/10/22 21:11:56 christos Exp $	*/
+/*	$NetBSD: makefs.c,v 1.27 2011/07/18 08:58:38 uch Exp $	*/
 
 /*
  * Copyright (c) 2001-2003 Wasabi Systems, Inc.
@@ -41,7 +41,7 @@
 
 #include sys/cdefs.h
 #if defined(__RCSID)  !defined(__lint)
-__RCSID($NetBSD: makefs.c,v 1.26 2006/10/22 21:11:56 christos Exp $);
+__RCSID($NetBSD: makefs.c,v 1.27 2011/07/18 08:58:38 uch Exp $);
 #endif	/* !__lint */
 
 #include assert.h
@@ -73,6 +73,8 @@
 	{ ffs, ffs_prep_opts,	ffs_parse_opts,	ffs_cleanup_opts, ffs_makefs },
 	{ cd9660, cd9660_prep_opts, cd9660_parse_opts, cd9660_cleanup_opts,
 	  cd9660_makefs},
+	{ v7fs, v7fs_prep_opts, v7fs_parse_opts, v7fs_cleanup_opts,
+	  v7fs_makefs },
 	{ .type = NULL	},
 };
 

Index: src/usr.sbin/makefs/makefs.h
diff -u src/usr.sbin/makefs/makefs.h:1.20 src/usr.sbin/makefs/makefs.h:1.21
--- src/usr.sbin/makefs/makefs.h:1.20	Sun Dec 28 21:51:46 2008
+++ src/usr.sbin/makefs/makefs.h	Mon Jul 18 08:58:38 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: makefs.h,v 1.20 2008/12/28 21:51:46 christos Exp $	*/
+/*	$NetBSD

CVS commit: src/sbin/fsck_v7fs

2011-07-17 Thread UCHIYAMA Yasushi
Module Name:src
Committed By:   uch
Date:   Sun Jul 17 12:47:38 UTC 2011

Modified Files:
src/sbin/fsck_v7fs: freeblock.c

Log Message:
fix freeblock counting


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sbin/fsck_v7fs/freeblock.c

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

Modified files:

Index: src/sbin/fsck_v7fs/freeblock.c
diff -u src/sbin/fsck_v7fs/freeblock.c:1.1 src/sbin/fsck_v7fs/freeblock.c:1.2
--- src/sbin/fsck_v7fs/freeblock.c:1.1	Mon Jun 27 11:52:58 2011
+++ src/sbin/fsck_v7fs/freeblock.c	Sun Jul 17 12:47:38 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: freeblock.c,v 1.1 2011/06/27 11:52:58 uch Exp $	*/
+/*	$NetBSD: freeblock.c,v 1.2 2011/07/17 12:47:38 uch Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: freeblock.c,v 1.1 2011/06/27 11:52:58 uch Exp $);
+__RCSID($NetBSD: freeblock.c,v 1.2 2011/07/17 12:47:38 uch Exp $);
 #endif /* not lint */
 
 #include stdio.h
@@ -241,6 +241,7 @@
 		}
 
 		/* freeblock list is used as freeblock. */
+		n--;
 		if ((ret = func(fs, ctx, blk)))
 			return ret;
 



CVS commit: src/sys/fs/v7fs

2011-07-16 Thread UCHIYAMA Yasushi
Module Name:src
Committed By:   uch
Date:   Sat Jul 16 12:35:32 UTC 2011

Modified Files:
src/sys/fs/v7fs: v7fs_datablock.c v7fs_datablock.h

Log Message:
export v7fs_datablock_addr for makefs


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/fs/v7fs/v7fs_datablock.c
cvs rdiff -u -r1.1 -r1.2 src/sys/fs/v7fs/v7fs_datablock.h

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

Modified files:

Index: src/sys/fs/v7fs/v7fs_datablock.c
diff -u src/sys/fs/v7fs/v7fs_datablock.c:1.2 src/sys/fs/v7fs/v7fs_datablock.c:1.3
--- src/sys/fs/v7fs/v7fs_datablock.c:1.2	Wed Jul 13 12:18:22 2011
+++ src/sys/fs/v7fs/v7fs_datablock.c	Sat Jul 16 12:35:32 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: v7fs_datablock.c,v 1.2 2011/07/13 12:18:22 uch Exp $	*/
+/*	$NetBSD: v7fs_datablock.c,v 1.3 2011/07/16 12:35:32 uch Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: v7fs_datablock.c,v 1.2 2011/07/13 12:18:22 uch Exp $);
+__KERNEL_RCSID(0, $NetBSD: v7fs_datablock.c,v 1.3 2011/07/16 12:35:32 uch Exp $);
 #if defined _KERNEL_OPT
 #include opt_v7fs.h
 #endif
@@ -58,12 +58,6 @@
 #define	DPRINTF(fmt, args...)	((void)0)
 #endif
 
-struct v7fs_daddr_map {
-	int level; /* direct, index1, index2, index3 */
-	v7fs_daddr_t index[3];
-};
-
-static int v7fs_datablock_addr(size_t, struct v7fs_daddr_map *);
 static int v7fs_datablock_deallocate(struct v7fs_self *, v7fs_daddr_t);
 static int loop1(struct v7fs_self *, v7fs_daddr_t, size_t *,
 int (*)(struct v7fs_self *, void *, v7fs_daddr_t, size_t), void *);
@@ -198,7 +192,7 @@
 	return error;
 }
 
-static int
+int
 v7fs_datablock_addr(size_t sz, struct v7fs_daddr_map *map)
 {
 #define	NIDX		V7FS_DADDR_PER_BLOCK

Index: src/sys/fs/v7fs/v7fs_datablock.h
diff -u src/sys/fs/v7fs/v7fs_datablock.h:1.1 src/sys/fs/v7fs/v7fs_datablock.h:1.2
--- src/sys/fs/v7fs/v7fs_datablock.h:1.1	Mon Jun 27 11:52:24 2011
+++ src/sys/fs/v7fs/v7fs_datablock.h	Sat Jul 16 12:35:32 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: v7fs_datablock.h,v 1.1 2011/06/27 11:52:24 uch Exp $	*/
+/*	$NetBSD: v7fs_datablock.h,v 1.2 2011/07/16 12:35:32 uch Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -42,5 +42,11 @@
 int v7fs_datablock_expand(struct v7fs_self *, struct v7fs_inode *, size_t);
 int v7fs_datablock_contract(struct v7fs_self *, struct v7fs_inode *, size_t);
 int v7fs_datablock_size_change(struct v7fs_self *, size_t, struct v7fs_inode *);
+
+struct v7fs_daddr_map {
+	int level; /* direct, index1, index2, index3 */
+	v7fs_daddr_t index[3];
+};
+int v7fs_datablock_addr(size_t, struct v7fs_daddr_map *);
 __END_DECLS
 #endif /*!_V7FS_INODE_H_ */



CVS commit: src/sys/fs/v7fs

2011-07-16 Thread UCHIYAMA Yasushi
Module Name:src
Committed By:   uch
Date:   Sat Jul 16 12:35:40 UTC 2011

Modified Files:
src/sys/fs/v7fs: v7fs.h v7fs_file.h v7fs_file_util.c v7fs_vnops.c

Log Message:
core symlink operation moved to v7fs_file_util.c and introduce 
V7FSBSD_MAXSYMLINKLEN for makefs


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/fs/v7fs/v7fs.h src/sys/fs/v7fs/v7fs_file.h \
src/sys/fs/v7fs/v7fs_file_util.c
cvs rdiff -u -r1.3 -r1.4 src/sys/fs/v7fs/v7fs_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/sys/fs/v7fs/v7fs.h
diff -u src/sys/fs/v7fs/v7fs.h:1.1 src/sys/fs/v7fs/v7fs.h:1.2
--- src/sys/fs/v7fs/v7fs.h:1.1	Mon Jun 27 11:52:24 2011
+++ src/sys/fs/v7fs/v7fs.h	Sat Jul 16 12:35:40 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: v7fs.h,v 1.1 2011/06/27 11:52:24 uch Exp $	*/
+/*	$NetBSD: v7fs.h,v 1.2 2011/07/16 12:35:40 uch Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -175,6 +175,6 @@
 /* Don't apear original V7 filesystem. NetBSD. */
 #define	V7FSBSD_IFFIFO	001	/* Named pipe. */
 
-#define	V7FSBSD_MAXSYMLINKS	8
+#define	V7FSBSD_MAXSYMLINKLEN	V7FS_BSIZE
 
 #endif	/*!_V7FS_H_ */
Index: src/sys/fs/v7fs/v7fs_file.h
diff -u src/sys/fs/v7fs/v7fs_file.h:1.1 src/sys/fs/v7fs/v7fs_file.h:1.2
--- src/sys/fs/v7fs/v7fs_file.h:1.1	Mon Jun 27 11:52:24 2011
+++ src/sys/fs/v7fs/v7fs_file.h	Sat Jul 16 12:35:40 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: v7fs_file.h,v 1.1 2011/06/27 11:52:24 uch Exp $	*/
+/*	$NetBSD: v7fs_file.h,v 1.2 2011/07/16 12:35:40 uch Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -60,5 +60,6 @@
 const char *);
 bool v7fs_file_lookup_by_number(struct v7fs_self *, struct v7fs_inode *,
 v7fs_ino_t, char *);
+int v7fs_file_symlink(struct v7fs_self *, struct v7fs_inode *, const char *);
 __END_DECLS
 #endif /*!_V7FS_INODE_H_ */
Index: src/sys/fs/v7fs/v7fs_file_util.c
diff -u src/sys/fs/v7fs/v7fs_file_util.c:1.1 src/sys/fs/v7fs/v7fs_file_util.c:1.2
--- src/sys/fs/v7fs/v7fs_file_util.c:1.1	Mon Jun 27 11:52:24 2011
+++ src/sys/fs/v7fs/v7fs_file_util.c	Sat Jul 16 12:35:40 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: v7fs_file_util.c,v 1.1 2011/06/27 11:52:24 uch Exp $	*/
+/*	$NetBSD: v7fs_file_util.c,v 1.2 2011/07/16 12:35:40 uch Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: v7fs_file_util.c,v 1.1 2011/06/27 11:52:24 uch Exp $);
+__KERNEL_RCSID(0, $NetBSD: v7fs_file_util.c,v 1.2 2011/07/16 12:35:40 uch Exp $);
 #ifdef _KERNEL
 #include sys/systm.h
 #include sys/param.h
@@ -77,6 +77,39 @@
 }
 
 int
+v7fs_file_symlink(struct v7fs_self *fs, struct v7fs_inode *p,
+const char *target)
+{
+	int error;
+	size_t len = strlen(target) + 1;
+
+	if (len  V7FSBSD_MAXSYMLINKLEN) {/* limited target 512byte pathname */
+		DPRINTF(too long pathname.);
+		return ENAMETOOLONG;
+	}
+
+	if ((error = v7fs_datablock_expand(fs, p, len))) {
+		return error;
+	}
+
+	v7fs_daddr_t blk = p-addr[0];	/* 1block only.  */
+	void *buf;
+	if (!(buf = scratch_read(fs, blk))) {
+		return EIO;
+	}
+
+	strncpy(buf, target, V7FS_BSIZE);
+	if (!fs-io.write(fs-io.cookie, buf, blk)) {
+		scratch_free(fs, buf);
+		return EIO;
+	}
+	scratch_free(fs, buf);
+	v7fs_inode_writeback(fs, p);
+
+	return 0;
+}
+
+int
 v7fs_file_rename(struct v7fs_self *fs, struct v7fs_inode *parent_from,
 const char *from, struct v7fs_inode *parent_to, const char *to)
 {

Index: src/sys/fs/v7fs/v7fs_vnops.c
diff -u src/sys/fs/v7fs/v7fs_vnops.c:1.3 src/sys/fs/v7fs/v7fs_vnops.c:1.4
--- src/sys/fs/v7fs/v7fs_vnops.c:1.3	Wed Jul 13 12:28:57 2011
+++ src/sys/fs/v7fs/v7fs_vnops.c	Sat Jul 16 12:35:40 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: v7fs_vnops.c,v 1.3 2011/07/13 12:28:57 uch Exp $	*/
+/*	$NetBSD: v7fs_vnops.c,v 1.4 2011/07/16 12:35:40 uch Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: v7fs_vnops.c,v 1.3 2011/07/13 12:28:57 uch Exp $);
+__KERNEL_RCSID(0, $NetBSD: v7fs_vnops.c,v 1.4 2011/07/16 12:35:40 uch Exp $);
 #if defined _KERNEL_OPT
 #include opt_v7fs.h
 #endif
@@ -1130,7 +1130,7 @@
 		*a-a_retval = 30; /* ~1G */
 		break;
 	case _PC_SYMLINK_MAX:
-		*a-a_retval = MAXPATHLEN;
+		*a-a_retval = V7FSBSD_MAXSYMLINKLEN;
 		break;
 	case _PC_2_SYMLINKS:
 		*a-a_retval = 1;
@@ -1224,26 +1224,7 @@
 
 	struct v7fs_node *newnode = (*a-a_vpp)-v_data;
 	struct v7fs_inode *p = newnode-inode;
-
-	if ((error = v7fs_datablock_expand(fs, p, len))) {
-		v7fs_inode_deallocate(fs, ino);
-		error = ENOSPC;
-		goto unlock_exit;
-	}
-	v7fs_daddr_t blk = p-addr[0];	/* 1block only.  */
-	void *buf;
-	if (!(buf = scratch_read(fs, blk))) {
-		v7fs_inode_deallocate(fs, ino);
-		error = EIO;
-		goto unlock_exit;
-	}
-	strncpy(buf, from, V7FS_BSIZE);
-	if (!fs-io.write(fs-io.cookie, buf, blk)) {
-		scratch_free(fs, buf);
-		error = EIO;
-		goto unlock_exit;
-	

CVS commit: src/sys/fs/v7fs

2011-07-13 Thread UCHIYAMA Yasushi
Module Name:src
Committed By:   uch
Date:   Wed Jul 13 12:18:22 UTC 2011

Modified Files:
src/sys/fs/v7fs: v7fs_datablock.c

Log Message:
When filesize is zero, correctly return V7FS_ITERATOR_END


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/fs/v7fs/v7fs_datablock.c

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

Modified files:

Index: src/sys/fs/v7fs/v7fs_datablock.c
diff -u src/sys/fs/v7fs/v7fs_datablock.c:1.1 src/sys/fs/v7fs/v7fs_datablock.c:1.2
--- src/sys/fs/v7fs/v7fs_datablock.c:1.1	Mon Jun 27 11:52:24 2011
+++ src/sys/fs/v7fs/v7fs_datablock.c	Wed Jul 13 12:18:22 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: v7fs_datablock.c,v 1.1 2011/06/27 11:52:24 uch Exp $	*/
+/*	$NetBSD: v7fs_datablock.c,v 1.2 2011/07/13 12:18:22 uch Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: v7fs_datablock.c,v 1.1 2011/06/27 11:52:24 uch Exp $);
+__KERNEL_RCSID(0, $NetBSD: v7fs_datablock.c,v 1.2 2011/07/13 12:18:22 uch Exp $);
 #if defined _KERNEL_OPT
 #include opt_v7fs.h
 #endif
@@ -262,7 +262,7 @@
 	int ret;
 
 	if (!(filesize = v7fs_inode_filesize(p)))
-		return 0;
+		return V7FS_ITERATOR_END;
 #ifdef V7FS_DATABLOCK_DEBUG
 	size_t sz = filesize;
 #endif



CVS commit: src/sys/fs/v7fs

2011-07-13 Thread UCHIYAMA Yasushi
Module Name:src
Committed By:   uch
Date:   Wed Jul 13 12:22:49 UTC 2011

Modified Files:
src/sys/fs/v7fs: v7fs_vnops.c

Log Message:
Fix inode update method. chown and chmod works.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/fs/v7fs/v7fs_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/sys/fs/v7fs/v7fs_vnops.c
diff -u src/sys/fs/v7fs/v7fs_vnops.c:1.1 src/sys/fs/v7fs/v7fs_vnops.c:1.2
--- src/sys/fs/v7fs/v7fs_vnops.c:1.1	Mon Jun 27 11:52:25 2011
+++ src/sys/fs/v7fs/v7fs_vnops.c	Wed Jul 13 12:22:49 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: v7fs_vnops.c,v 1.1 2011/06/27 11:52:25 uch Exp $	*/
+/*	$NetBSD: v7fs_vnops.c,v 1.2 2011/07/13 12:22:49 uch Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: v7fs_vnops.c,v 1.1 2011/06/27 11:52:25 uch Exp $);
+__KERNEL_RCSID(0, $NetBSD: v7fs_vnops.c,v 1.2 2011/07/13 12:22:49 uch Exp $);
 #if defined _KERNEL_OPT
 #include opt_v7fs.h
 #endif
@@ -439,7 +439,9 @@
 	struct v7fs_node *v7node = vp-v_data;
 	struct v7fs_self *fs = v7node-v7fsmount-core;
 	struct v7fs_inode *inode = v7node-inode;
+	struct timespec *acc, *mod;
 	int error = 0;
+	acc = mod = NULL;
 
 	DPRINTF(\n);
 
@@ -476,20 +478,28 @@
 			uvm_vnp_setsize(vp, vap-va_size);
 	}
 
-	if (vap-va_uid != (uid_t)VNOVAL)
+	if (vap-va_uid != (uid_t)VNOVAL) {
 		inode-uid = vap-va_uid;
-	if (vap-va_gid != (uid_t)VNOVAL)
+	}
+	if (vap-va_gid != (uid_t)VNOVAL) {
 		inode-gid = vap-va_gid;
-	if (vap-va_mode != (mode_t)VNOVAL)
+	}
+	if (vap-va_mode != (mode_t)VNOVAL) {
 		v7fs_inode_chmod(inode, vap-va_mode);
-	if (vap-va_atime.tv_sec != VNOVAL)
-		inode-atime = vap-va_atime.tv_sec;
-	if (vap-va_mtime.tv_sec != VNOVAL)
-		inode-mtime = vap-va_mtime.tv_sec;
-	if (vap-va_ctime.tv_sec != VNOVAL)
-		inode-ctime = vap-va_ctime.tv_sec;
+	}
+	if (vap-va_atime.tv_sec != VNOVAL) {
+		acc = vap-va_atime;
+	}
+	if (vap-va_mtime.tv_sec != VNOVAL) {
+		mod = vap-va_mtime;
+		v7node-update_mtime = true;
+	}
+	if (vap-va_ctime.tv_sec != VNOVAL) {
+		v7node-update_ctime = true;
+	}
 
-	v7fs_update(vp, 0, 0, 0);
+	v7node-update_atime = true;
+	v7fs_update(vp, acc, mod, 0);
 
 	return error;
 }



CVS commit: src/sys/fs/v7fs

2011-07-13 Thread UCHIYAMA Yasushi
Module Name:src
Committed By:   uch
Date:   Wed Jul 13 12:28:57 UTC 2011

Modified Files:
src/sys/fs/v7fs: v7fs_vnops.c

Log Message:
Fix readdir eofflag(bogus eofflags was setted). getcwd works.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/fs/v7fs/v7fs_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/sys/fs/v7fs/v7fs_vnops.c
diff -u src/sys/fs/v7fs/v7fs_vnops.c:1.2 src/sys/fs/v7fs/v7fs_vnops.c:1.3
--- src/sys/fs/v7fs/v7fs_vnops.c:1.2	Wed Jul 13 12:22:49 2011
+++ src/sys/fs/v7fs/v7fs_vnops.c	Wed Jul 13 12:28:57 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: v7fs_vnops.c,v 1.2 2011/07/13 12:22:49 uch Exp $	*/
+/*	$NetBSD: v7fs_vnops.c,v 1.3 2011/07/13 12:28:57 uch Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: v7fs_vnops.c,v 1.2 2011/07/13 12:22:49 uch Exp $);
+__KERNEL_RCSID(0, $NetBSD: v7fs_vnops.c,v 1.3 2011/07/13 12:28:57 uch Exp $);
 #if defined _KERNEL_OPT
 #include opt_v7fs.h
 #endif
@@ -887,6 +887,9 @@
 	}
 	scratch_free(fs, buf);
 
+	if (p-cnt == p-end)
+		return V7FS_ITERATOR_BREAK;
+
 	return error;
 }
 



CVS commit: src/sbin/newfs_v7fs

2011-07-10 Thread UCHIYAMA Yasushi
Module Name:src
Committed By:   uch
Date:   Sun Jul 10 12:14:01 UTC 2011

Modified Files:
src/sbin/newfs_v7fs: main.c

Log Message:
fix freeblock count bug.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sbin/newfs_v7fs/main.c

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

Modified files:

Index: src/sbin/newfs_v7fs/main.c
diff -u src/sbin/newfs_v7fs/main.c:1.1 src/sbin/newfs_v7fs/main.c:1.2
--- src/sbin/newfs_v7fs/main.c:1.1	Mon Jun 27 11:52:58 2011
+++ src/sbin/newfs_v7fs/main.c	Sun Jul 10 12:14:01 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.1 2011/06/27 11:52:58 uch Exp $	*/
+/*	$NetBSD: main.c,v 1.2 2011/07/10 12:14:01 uch Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: main.c,v 1.1 2011/06/27 11:52:58 uch Exp $);
+__RCSID($NetBSD: main.c,v 1.2 2011/07/10 12:14:01 uch Exp $);
 #endif /* not lint */
 
 #include sys/param.h
@@ -146,11 +146,11 @@
 		{
 			VPRINTF(\nlast freeblock #%d\n,
 			(*val32)(fb-freeblock[i + 1]));
-			fb-nfreeblock = (*val16)(k);
 
 			memmove(fb-freeblock + 1, fb-freeblock + i + 1, k *
 			sizeof(v7fs_daddr_t));
 			fb-freeblock[0] = 0; /* Terminate link; */
+			fb-nfreeblock = (*val16)(k + 1);
 			VPRINTF(last freeblock contains #%d\n,
 			(*val16)(fb-nfreeblock));
 			fs-io.write(fs-io.cookie, buf, listblk);
@@ -211,7 +211,8 @@
 	for (i = V7FS_MAX_FREEBLOCK - 1, j = sb-datablock_start_sector; i = 0;
 	i--, j++)
 		sb-freeblock[i] = j;
-	sb-total_freeblock = volume_size - sb-datablock_start_sector - 1;
+
+	sb-total_freeblock = volume_size - sb-datablock_start_sector;
 
 	/* Write superblock. */
 	sb-modified = 1;



CVS commit: src/sys/fs/v7fs

2011-07-01 Thread UCHIYAMA Yasushi
Module Name:src
Committed By:   uch
Date:   Sat Jul  2 01:05:38 UTC 2011

Modified Files:
src/sys/fs/v7fs: v7fs_vfsops.c

Log Message:
Set missing error number


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/fs/v7fs/v7fs_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/sys/fs/v7fs/v7fs_vfsops.c
diff -u src/sys/fs/v7fs/v7fs_vfsops.c:1.1 src/sys/fs/v7fs/v7fs_vfsops.c:1.2
--- src/sys/fs/v7fs/v7fs_vfsops.c:1.1	Mon Jun 27 11:52:25 2011
+++ src/sys/fs/v7fs/v7fs_vfsops.c	Sat Jul  2 01:05:38 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: v7fs_vfsops.c,v 1.1 2011/06/27 11:52:25 uch Exp $	*/
+/*	$NetBSD: v7fs_vfsops.c,v 1.2 2011/07/02 01:05:38 uch Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: v7fs_vfsops.c,v 1.1 2011/06/27 11:52:25 uch Exp $);
+__KERNEL_RCSID(0, $NetBSD: v7fs_vfsops.c,v 1.2 2011/07/02 01:05:38 uch Exp $);
 #if defined _KERNEL_OPT
 #include opt_v7fs.h
 #endif
@@ -73,7 +73,7 @@
 static int v7fs_mountfs(struct vnode *, struct mount *, int);
 static int v7fs_openfs(struct vnode *, struct mount *, struct lwp *);
 static void v7fs_closefs(struct vnode *, struct mount *);
-static bool is_v7fs_partition(struct vnode *);
+static int is_v7fs_partition(struct vnode *);
 static enum vtype v7fs_mode_to_vtype(v7fs_mode_t mode);
 
 int
@@ -185,7 +185,7 @@
 	mp-mnt_op-vfs_name, mp, l);
 }
 
-static bool
+static int
 is_v7fs_partition(struct vnode *devvp)
 {
 	struct partinfo dpart;
@@ -193,12 +193,12 @@
 
 	if ((error = VOP_IOCTL(devvp, DIOCGPART, dpart, FREAD, NOCRED)) != 0) {
 		DPRINTF(VOP_IOCTL=%d\n, error);
-		return false;
+		return error;
 	}
 	DPRINTF(fstype=%d dtype=%d bsize=%d\n, dpart.part-p_fstype,
 	dpart.disklab-d_type, dpart.disklab-d_secsize);
 
-	return dpart.part-p_fstype == FS_V7;
+	return (dpart.part-p_fstype == FS_V7) ? 0 : EINVAL;
 }
 
 static int
@@ -224,8 +224,9 @@
 	}
 
 	/* Get partition information */
-	if (!is_v7fs_partition(devvp))
+	if ((error = is_v7fs_partition(devvp))) {
 		goto close_exit;
+	}
 
 	return 0; /* lock held */
 
@@ -576,8 +577,8 @@
 
 	DPRINTF();
 	/* On mountroot, devvp (rootdev) is opened by vfs_mountroot */
-	if (!is_v7fs_partition (rootvp))
-		return EINVAL;
+	if ((error = is_v7fs_partition (rootvp)))
+		return error;
 
 	if ((error = vfs_rootmountalloc(MOUNT_V7FS, root_device, mp))) {
 		DPRINTF(mountalloc error=%d\n, error);



CVS commit: src/distrib/sets/lists/comp

2011-06-27 Thread UCHIYAMA Yasushi
Module Name:src
Committed By:   uch
Date:   Tue Jun 28 04:53:52 UTC 2011

Modified Files:
src/distrib/sets/lists/comp: mi

Log Message:
Add fsck_v7fs, mount_v7fs, newfs_v7fs entries for MKDEBUG=yes


To generate a diff of this commit:
cvs rdiff -u -r1.1634 -r1.1635 src/distrib/sets/lists/comp/mi

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

Modified files:

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.1634 src/distrib/sets/lists/comp/mi:1.1635
--- src/distrib/sets/lists/comp/mi:1.1634	Mon Jun 27 16:39:43 2011
+++ src/distrib/sets/lists/comp/mi	Tue Jun 28 04:53:51 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.1634 2011/06/27 16:39:43 manu Exp $
+#	$NetBSD: mi,v 1.1635 2011/06/28 04:53:51 uch Exp $
 #
 # Note: don't delete entries from here - mark them as obsolete instead.
 #
@@ -3051,6 +3051,7 @@
 ./usr/libdata/debug/sbin/fsck_ffs.debug		comp-sysutil-debug	debug
 ./usr/libdata/debug/sbin/fsck_lfs.debug		comp-sysutil-debug	debug
 ./usr/libdata/debug/sbin/fsck_msdos.debug	comp-sysutil-debug	debug
+./usr/libdata/debug/sbin/fsck_v7fs.debug	comp-sysutil-debug	debug
 ./usr/libdata/debug/sbin/fsdb.debug		comp-sysutil-debug	debug
 ./usr/libdata/debug/sbin/fsirand.debug		comp-sysutil-debug	debug
 ./usr/libdata/debug/sbin/gpt.debug		comp-sysutil-debug	debug
@@ -3094,12 +3095,14 @@
 ./usr/libdata/debug/sbin/mount_udf.debug	comp-sysutil-debug	debug
 ./usr/libdata/debug/sbin/mount_umap.debug	comp-miscfs-debug	debug
 ./usr/libdata/debug/sbin/mount_union.debug	comp-miscfs-debug	debug
+./usr/libdata/debug/sbin/mount_v7fs.debug	comp-sysutil-debug	debug
 ./usr/libdata/debug/sbin/newfs.debug		comp-sysutil-debug	debug
 ./usr/libdata/debug/sbin/newfs_ext2fs.debug	comp-sysutil-debug	debug
 ./usr/libdata/debug/sbin/newfs_lfs.debug	comp-sysutil-debug	debug
 ./usr/libdata/debug/sbin/newfs_msdos.debug	comp-sysutil-debug	debug
 ./usr/libdata/debug/sbin/newfs_sysvbfs.debug	comp-sysutil-debug	debug
 ./usr/libdata/debug/sbin/newfs_udf.debug	comp-sysutil-debug	debug
+./usr/libdata/debug/sbin/newfs_v7fs.debug	comp-sysutil-debug	debug
 ./usr/libdata/debug/sbin/pfctl.debug		comp-pf-debug		pf,debug
 ./usr/libdata/debug/sbin/pflogd.debug		comp-pf-debug		pf,debug
 ./usr/libdata/debug/sbin/pfs.debug		comp-pf-debug		pf,debug



CVS commit: src/sys/arch/sh3/sh3

2011-06-12 Thread UCHIYAMA Yasushi
Module Name:src
Committed By:   uch
Date:   Mon Jun 13 05:23:34 UTC 2011

Modified Files:
src/sys/arch/sh3/sh3: vm_machdep.c

Log Message:
include uvm_page.h for vm_physmem[]


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/sys/arch/sh3/sh3/vm_machdep.c

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

Modified files:

Index: src/sys/arch/sh3/sh3/vm_machdep.c
diff -u src/sys/arch/sh3/sh3/vm_machdep.c:1.72 src/sys/arch/sh3/sh3/vm_machdep.c:1.73
--- src/sys/arch/sh3/sh3/vm_machdep.c:1.72	Sun Jun 12 03:35:46 2011
+++ src/sys/arch/sh3/sh3/vm_machdep.c	Mon Jun 13 05:23:33 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_machdep.c,v 1.72 2011/06/12 03:35:46 rmind Exp $	*/
+/*	$NetBSD: vm_machdep.c,v 1.73 2011/06/13 05:23:33 uch Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc. All rights reserved.
@@ -81,7 +81,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vm_machdep.c,v 1.72 2011/06/12 03:35:46 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: vm_machdep.c,v 1.73 2011/06/13 05:23:33 uch Exp $);
 
 #include opt_kstack_debug.h
 
@@ -101,6 +101,7 @@
 #include dev/mm.h
 
 #include uvm/uvm_extern.h
+#include uvm/uvm_page.h
 
 #include sh3/locore.h
 #include sh3/cpu.h



CVS commit: src/sys/arch/sh3/sh3

2009-12-10 Thread UCHIYAMA Yasushi
Module Name:src
Committed By:   uch
Date:   Thu Dec 10 13:35:32 UTC 2009

Modified Files:
src/sys/arch/sh3/sh3: vm_machdep.c

Log Message:
u-area is no longer zero-cleared. reset here


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/sh3/sh3/vm_machdep.c

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

Modified files:

Index: src/sys/arch/sh3/sh3/vm_machdep.c
diff -u src/sys/arch/sh3/sh3/vm_machdep.c:1.65 src/sys/arch/sh3/sh3/vm_machdep.c:1.66
--- src/sys/arch/sh3/sh3/vm_machdep.c:1.65	Sun Nov 29 04:15:43 2009
+++ src/sys/arch/sh3/sh3/vm_machdep.c	Thu Dec 10 13:35:32 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_machdep.c,v 1.65 2009/11/29 04:15:43 rmind Exp $	*/
+/*	$NetBSD: vm_machdep.c,v 1.66 2009/12/10 13:35:32 uch Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc. All rights reserved.
@@ -81,7 +81,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vm_machdep.c,v 1.65 2009/11/29 04:15:43 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: vm_machdep.c,v 1.66 2009/12/10 13:35:32 uch Exp $);
 
 #include opt_kstack_debug.h
 
@@ -189,6 +189,8 @@
 #define	P1ADDR(x)	(SH3_PHYS_TO_P1SEG(*__pmap_kpte_lookup(x)  PG_PPN))
 
 	pcb = lwp_getpcb(l);
+	pcb-pcb_onfault = NULL;
+	pcb-pcb_faultbail = 0;
 #ifdef SH3
 	/*
 	 * Accessing context store space must not cause exceptions.



CVS commit: src/sys/arch/ews4800mips/ews4800mips

2009-08-02 Thread UCHIYAMA Yasushi
Module Name:src
Committed By:   uch
Date:   Sun Aug  2 12:04:28 UTC 2009

Modified Files:
src/sys/arch/ews4800mips/ews4800mips: disksubr.c

Log Message:
fix comment


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/ews4800mips/ews4800mips/disksubr.c

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

Modified files:

Index: src/sys/arch/ews4800mips/ews4800mips/disksubr.c
diff -u src/sys/arch/ews4800mips/ews4800mips/disksubr.c:1.7 src/sys/arch/ews4800mips/ews4800mips/disksubr.c:1.8
--- src/sys/arch/ews4800mips/ews4800mips/disksubr.c:1.7	Mon Apr 28 20:23:18 2008
+++ src/sys/arch/ews4800mips/ews4800mips/disksubr.c	Sun Aug  2 12:04:28 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: disksubr.c,v 1.7 2008/04/28 20:23:18 martin Exp $	*/
+/*	$NetBSD: disksubr.c,v 1.8 2009/08/02 12:04:28 uch Exp $	*/
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: disksubr.c,v 1.7 2008/04/28 20:23:18 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: disksubr.c,v 1.8 2009/08/02 12:04:28 uch Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -139,7 +139,7 @@
 	sector_write(rwops, (void *)ux-vtoc,
 	ux-pdinfo.logical_sector + VTOC_SECTOR);
 
-	/* 3. Write disklabel to BFS */
+	/* 3. Write disklabel to LABELSECTOR */
 	memset(buf, 0, sizeof buf);
 	memcpy(buf, d, sizeof *d);
 	if (!sector_write(rwops, buf, LABELSECTOR)) {



CVS commit: src/sys/fs/sysvbfs

2009-04-26 Thread UCHIYAMA Yasushi
Module Name:src
Committed By:   uch
Date:   Sun Apr 26 12:41:59 UTC 2009

Modified Files:
src/sys/fs/sysvbfs: bfs.c

Log Message:
added error check.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/fs/sysvbfs/bfs.c

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

Modified files:

Index: src/sys/fs/sysvbfs/bfs.c
diff -u src/sys/fs/sysvbfs/bfs.c:1.11 src/sys/fs/sysvbfs/bfs.c:1.12
--- src/sys/fs/sysvbfs/bfs.c:1.11	Mon Apr 28 20:24:02 2008
+++ src/sys/fs/sysvbfs/bfs.c	Sun Apr 26 12:41:59 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: bfs.c,v 1.11 2008/04/28 20:24:02 martin Exp $	*/
+/*	$NetBSD: bfs.c,v 1.12 2009/04/26 12:41:59 uch Exp $	*/
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(0, $NetBSD: bfs.c,v 1.11 2008/04/28 20:24:02 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: bfs.c,v 1.12 2009/04/26 12:41:59 uch Exp $);
 #define	BFS_DEBUG
 
 #include sys/param.h
@@ -256,10 +256,12 @@
 
 	p = buf;
 	n = end - start;
-	bfs-io-read_n(bfs-io, p, start, n);
+	if (!bfs-io-read_n(bfs-io, p, start, n))
+		return EIO;
 	/* last sector */
 	n *= DEV_BSIZE;
-	bfs-io-read(bfs-io, tmpbuf, end);
+	if (!bfs-io-read(bfs-io, tmpbuf, end))
+		return EIO;
 	memcpy(p + n, tmpbuf, sz - n);
 
 	if (read_size)