CVS commit: src/sbin/tunefs

2020-11-25 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Thu Nov 26 02:06:01 UTC 2020

Modified Files:
src/sbin/tunefs: tunefs.c

Log Message:
Add missing newlines to ACL prints in tunefs; from Jan Schaumann in PR 55824.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sbin/tunefs/tunefs.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/tunefs/tunefs.c
diff -u src/sbin/tunefs/tunefs.c:1.53 src/sbin/tunefs/tunefs.c:1.54
--- src/sbin/tunefs/tunefs.c:1.53	Sat Aug  8 11:44:55 2020
+++ src/sbin/tunefs/tunefs.c	Thu Nov 26 02:06:01 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: tunefs.c,v 1.53 2020/08/08 11:44:55 christos Exp $	*/
+/*	$NetBSD: tunefs.c,v 1.54 2020/11/26 02:06:01 dholland Exp $	*/
 
 /*
  * Copyright (c) 1983, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)tunefs.c	8.3 (Berkeley) 5/3/95";
 #else
-__RCSID("$NetBSD: tunefs.c,v 1.53 2020/08/08 11:44:55 christos Exp $");
+__RCSID("$NetBSD: tunefs.c,v 1.54 2020/11/26 02:06:01 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -391,7 +391,7 @@ main(int argc, char *argv[])
 "exclusive", name);
 			} else {
 sblock.fs_flags |= FS_POSIX1EACLS;
-printf("%s set", name);
+printf("%s set\n", name);
 			}
 		} else if (strcmp(pvalue, "disable") == 0) {
 			if ((~sblock.fs_flags & FS_POSIX1EACLS) ==
@@ -400,7 +400,7 @@ main(int argc, char *argv[])
 name);
 			} else {
 sblock.fs_flags &= ~FS_POSIX1EACLS;
-printf("%s cleared", name);
+printf("%s cleared\n", name);
 			}
 		}
 	}



CVS commit: src/sbin/tunefs

2020-08-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Aug  8 11:44:55 UTC 2020

Modified Files:
src/sbin/tunefs: tunefs.c

Log Message:
Find the if a device points to an active filesystem by looking at the mount
list.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sbin/tunefs/tunefs.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/tunefs/tunefs.c
diff -u src/sbin/tunefs/tunefs.c:1.52 src/sbin/tunefs/tunefs.c:1.53
--- src/sbin/tunefs/tunefs.c:1.52	Sat May 16 14:31:47 2020
+++ src/sbin/tunefs/tunefs.c	Sat Aug  8 07:44:55 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: tunefs.c,v 1.52 2020/05/16 18:31:47 christos Exp $	*/
+/*	$NetBSD: tunefs.c,v 1.53 2020/08/08 11:44:55 christos Exp $	*/
 
 /*
  * Copyright (c) 1983, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)tunefs.c	8.3 (Berkeley) 5/3/95";
 #else
-__RCSID("$NetBSD: tunefs.c,v 1.52 2020/05/16 18:31:47 christos Exp $");
+__RCSID("$NetBSD: tunefs.c,v 1.53 2020/08/08 11:44:55 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -95,6 +95,7 @@ static	void	bread(daddr_t, char *, int, 
 static	void	change_log_info(long long);
 static	void	getsb(struct fs *, const char *);
 static	int	openpartition(const char *, int, char *, size_t);
+static	int	isactive(int, struct statvfs *);
 static	void	show_log_info(void);
 __dead static	void	usage(void);
 
@@ -233,9 +234,9 @@ main(int argc, char *argv[])
 		fi = openpartition(special, openflags, device, sizeof(device));
 		special = device;
 	}
-	active = fstatvfs(fi, ) != -1;
 	if (fi == -1)
 		err(1, "%s", special);
+	active = !Fflag && isactive(fi, );
 	getsb(, special);
 
 #define CHANGEVAL(old, new, type, suffix) do\
@@ -469,6 +470,35 @@ main(int argc, char *argv[])
 	exit(0);
 }
 
+static int
+isactive(int fd, struct statvfs *rsfs)
+{
+	struct stat st0, st;
+	struct statvfs *sfs;
+	int n;
+
+	if (fstat(fd, ) == -1) {
+		warn("stat");
+		return 0;
+	}
+
+	if ((n = getmntinfo(, 0)) == -1) {
+		warn("getmntinfo");
+		return 0;
+	}
+
+	for (int i = 0; i < n; i++) {
+		if (stat(sfs[i].f_mntfromname, ) == -1)
+			continue;
+		if (st.st_rdev != st0.st_rdev)
+			continue;
+		*rsfs = sfs[i];
+		return 1;
+
+	}
+	return 0;
+}
+
 static void
 show_log_info(void)
 {



CVS commit: src/sbin/tunefs

2020-06-18 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Jun 18 19:32:56 UTC 2020

Modified Files:
src/sbin/tunefs: tunefs.8

Log Message:
The ACL flag is -p, not -n.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sbin/tunefs/tunefs.8

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

Modified files:

Index: src/sbin/tunefs/tunefs.8
diff -u src/sbin/tunefs/tunefs.8:1.46 src/sbin/tunefs/tunefs.8:1.47
--- src/sbin/tunefs/tunefs.8:1.46	Sun Jun  7 19:35:15 2020
+++ src/sbin/tunefs/tunefs.8	Thu Jun 18 19:32:56 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: tunefs.8,v 1.46 2020/06/07 19:35:15 wiz Exp $
+.\"	$NetBSD: tunefs.8,v 1.47 2020/06/18 19:32:56 wiz Exp $
 .\"
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -44,8 +44,8 @@
 .Op Fl h Ar avgfpdir
 .Op Fl l Ar logsize
 .Op Fl m Ar minfree
-.Op Fl n Cm enable | disable
 .Op Fl o Ar optimize_preference
+.Op Fl p Cm enable | disable
 .Op Fl q Ar quota
 .Op Fl S Ar sectorsize
 .Ar special | Ar filesys



CVS commit: src/sbin/tunefs

2020-06-07 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Jun  7 19:35:15 UTC 2020

Modified Files:
src/sbin/tunefs: tunefs.8

Log Message:
Sort option descriptions.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sbin/tunefs/tunefs.8

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

Modified files:

Index: src/sbin/tunefs/tunefs.8
diff -u src/sbin/tunefs/tunefs.8:1.45 src/sbin/tunefs/tunefs.8:1.46
--- src/sbin/tunefs/tunefs.8:1.45	Sat May 16 18:31:47 2020
+++ src/sbin/tunefs/tunefs.8	Sun Jun  7 19:35:15 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: tunefs.8,v 1.45 2020/05/16 18:31:47 christos Exp $
+.\"	$NetBSD: tunefs.8,v 1.46 2020/06/07 19:35:15 wiz Exp $
 .\"
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -69,17 +69,6 @@ will lose anything changed by
 is ignored when
 .Fl N
 is specified.
-.It Fl F
-Indicates that
-.Ar special
-is a file system image, rather than a device name or file system mount point.
-.Ar special
-will be accessed
-.Sq as-is .
-.It Fl N
-Display all the settable options
-(after any changes from the tuning options)
-but do not cause any of them to be changed.
 .It Fl a Cm enable | disable
 Turn on/off the administrative NFSv4 ACL enable flag.
 .It Fl e Ar maxbpg
@@ -97,6 +86,13 @@ more frequently than if they were allowe
 in a cylinder group before seeking elsewhere.
 For file systems with exclusively large files,
 this parameter should be set higher.
+.It Fl F
+Indicates that
+.Ar special
+is a file system image, rather than a device name or file system mount point.
+.Ar special
+will be accessed
+.Sq as-is .
 .It Fl g Ar avgfilesize
 This specifies the expected average file size.
 .It Fl h Ar avgfpdir
@@ -124,6 +120,10 @@ threshold.
 Note that if the value is raised above the current usage level,
 users will be unable to allocate files until enough files have
 been deleted to get under the higher threshold.
+.It Fl N
+Display all the settable options
+(after any changes from the tuning options)
+but do not cause any of them to be changed.
 .It Fl o Ar optimize_preference
 The file system can either try to minimize the time spent
 allocating blocks, or it can attempt to minimize the space



CVS commit: src/sbin/tunefs

2020-04-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr  9 14:44:38 UTC 2020

Modified Files:
src/sbin/tunefs: tunefs.c

Log Message:
Refresh the superblock in memory if changing a mounted partition.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sbin/tunefs/tunefs.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/tunefs/tunefs.c
diff -u src/sbin/tunefs/tunefs.c:1.50 src/sbin/tunefs/tunefs.c:1.51
--- src/sbin/tunefs/tunefs.c:1.50	Thu Apr 11 21:14:37 2019
+++ src/sbin/tunefs/tunefs.c	Thu Apr  9 10:44:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: tunefs.c,v 1.50 2019/04/12 01:14:37 pgoyette Exp $	*/
+/*	$NetBSD: tunefs.c,v 1.51 2020/04/09 14:44:38 christos Exp $	*/
 
 /*
  * Copyright (c) 1983, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)tunefs.c	8.3 (Berkeley) 5/3/95";
 #else
-__RCSID("$NetBSD: tunefs.c,v 1.50 2019/04/12 01:14:37 pgoyette Exp $");
+__RCSID("$NetBSD: tunefs.c,v 1.51 2020/04/09 14:44:38 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -47,10 +47,12 @@ __RCSID("$NetBSD: tunefs.c,v 1.50 2019/0
  * tunefs: change layout parameters to an existing file system.
  */
 #include 
+#include 
 
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -103,9 +105,10 @@ main(int argc, char *argv[])
 	const char	*special, *chg[2];
 	char		device[MAXPATHLEN];
 	int		maxbpg, minfree, optim, secsize;
-	int		avgfilesize, avgfpdir;
+	int		avgfilesize, avgfpdir, active;
 	long long	logfilesize;
 	int		secshift, fsbtodb;
+	struct statvfs	sfs;
 
 	Aflag = Fflag = Nflag = 0;
 	maxbpg = minfree = optim = secsize = -1;
@@ -203,6 +206,7 @@ main(int argc, char *argv[])
 		fi = openpartition(special, openflags, device, sizeof(device));
 		special = device;
 	}
+	active = fstatvfs(fi, ) != -1;
 	if (fi == -1)
 		err(1, "%s", special);
 	getsb(, special);
@@ -365,6 +369,18 @@ main(int argc, char *argv[])
 	/* write superblock to original coordinates (use old dev_bsize!) */
 	bwrite(sblockloc, buf.data, SBLOCKSIZE, special);
 
+	if (active) {
+		struct ufs_args args;
+		args.fspec = sfs.f_mntfromname;
+		if (mount(MOUNT_FFS, sfs.f_mntonname, sfs.f_flag | MNT_UPDATE,
+		 , sizeof args) == -1)
+			 warn("mount");
+		else
+			printf("%s: mount of %s on %s updated\n",
+			getprogname(), sfs.f_mntfromname, sfs.f_mntonname);
+	}
+
+
 	/* correct dev_bsize from possibly changed superblock data */
 	dev_bsize = sblock.fs_fsize / FFS_FSBTODB(, 1);
 



CVS commit: src/sbin/tunefs

2019-04-11 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Apr 12 01:14:37 UTC 2019

Modified Files:
src/sbin/tunefs: tunefs.c

Log Message:
Add missing space in "quotas disabled" output from tunefs -N


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sbin/tunefs/tunefs.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/tunefs/tunefs.c
diff -u src/sbin/tunefs/tunefs.c:1.49 src/sbin/tunefs/tunefs.c:1.50
--- src/sbin/tunefs/tunefs.c:1.49	Wed Aug 26 05:41:20 2015
+++ src/sbin/tunefs/tunefs.c	Fri Apr 12 01:14:37 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: tunefs.c,v 1.49 2015/08/26 05:41:20 mlelstv Exp $	*/
+/*	$NetBSD: tunefs.c,v 1.50 2019/04/12 01:14:37 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 1983, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)tunefs.c	8.3 (Berkeley) 5/3/95";
 #else
-__RCSID("$NetBSD: tunefs.c,v 1.49 2015/08/26 05:41:20 mlelstv Exp $");
+__RCSID("$NetBSD: tunefs.c,v 1.50 2019/04/12 01:14:37 pgoyette Exp $");
 #endif
 #endif /* not lint */
 
@@ -352,7 +352,7 @@ main(int argc, char *argv[])
 printf(" group");
 			printf(" enabled\n");
 		} else {
-			printf("disabled\n");
+			printf(" disabled\n");
 		}
 		printf("tunefs: no changes made\n");
 		exit(0);



CVS commit: src/sbin/tunefs

2015-08-25 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Wed Aug 26 05:41:20 UTC 2015

Modified Files:
src/sbin/tunefs: tunefs.c

Log Message:
Use getfsspecname also when not found in /etc/fstab.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sbin/tunefs/tunefs.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/tunefs/tunefs.c
diff -u src/sbin/tunefs/tunefs.c:1.48 src/sbin/tunefs/tunefs.c:1.49
--- src/sbin/tunefs/tunefs.c:1.48	Sat Aug  9 10:33:46 2014
+++ src/sbin/tunefs/tunefs.c	Wed Aug 26 05:41:20 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: tunefs.c,v 1.48 2014/08/09 10:33:46 mlelstv Exp $	*/
+/*	$NetBSD: tunefs.c,v 1.49 2015/08/26 05:41:20 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 1983, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT(@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = @(#)tunefs.c	8.3 (Berkeley) 5/3/95;
 #else
-__RCSID($NetBSD: tunefs.c,v 1.48 2014/08/09 10:33:46 mlelstv Exp $);
+__RCSID($NetBSD: tunefs.c,v 1.49 2015/08/26 05:41:20 mlelstv Exp $);
 #endif
 #endif /* not lint */
 
@@ -588,27 +588,26 @@ bread(daddr_t blk, char *buffer, int cnt
 static int
 openpartition(const char *name, int flags, char *device, size_t devicelen)
 {
-	char		rawspec[MAXPATHLEN], xbuf[MAXPATHLEN], *p;
+	char		specname[MAXPATHLEN];
+	char		rawname[MAXPATHLEN];
+	const char	*special, *raw;
 	struct fstab	*fs;
 	int		fd, oerrno;
 
 	fs = getfsfile(name);
-	if (fs) {
-		const char *fsspec;
-		fsspec = getfsspecname(xbuf, sizeof(xbuf), fs-fs_spec);
-		if (fsspec == NULL)
-			err(4, %s, xbuf);
-		if ((p = strrchr(fsspec, '/')) != NULL) {
-			snprintf(rawspec, sizeof(rawspec), %.*s/r%s,
-			(int)(p - fsspec), fsspec, p + 1);
-			name = rawspec;
-		} else
-			name = fsspec;
-	}
-	fd = opendisk(name, flags, device, devicelen, 0);
+	special = fs ? fs-fs_spec : name;
+
+	raw = getfsspecname(specname, sizeof(specname), special);
+	if (raw == NULL)
+		err(1, %s: %s, name, specname);
+	special = getdiskrawname(rawname, sizeof(rawname), raw); 
+	if (special == NULL)
+		special = raw;
+
+	fd = opendisk(special, flags, device, devicelen, 0);
 	if (fd == -1  errno == ENOENT) {
 		oerrno = errno;
-		strlcpy(device, name, devicelen);
+		strlcpy(device, special, devicelen);
 		errno = oerrno;
 	}
 	return (fd);



CVS commit: src/sbin/tunefs

2014-08-09 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Aug  9 10:33:46 UTC 2014

Modified Files:
src/sbin/tunefs: tunefs.8 tunefs.c

Log Message:
add -S option to adjust the superblock for different sector sizes. While
the kernel ignores this information, userland tools rely on it.

This is needed when moving images between devices of different sector size.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sbin/tunefs/tunefs.8
cvs rdiff -u -r1.47 -r1.48 src/sbin/tunefs/tunefs.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/tunefs/tunefs.8
diff -u src/sbin/tunefs/tunefs.8:1.42 src/sbin/tunefs/tunefs.8:1.43
--- src/sbin/tunefs/tunefs.8:1.42	Mon Dec  3 12:28:06 2012
+++ src/sbin/tunefs/tunefs.8	Sat Aug  9 10:33:46 2014
@@ -1,4 +1,4 @@
-.\	$NetBSD: tunefs.8,v 1.42 2012/12/03 12:28:06 wiz Exp $
+.\	$NetBSD: tunefs.8,v 1.43 2014/08/09 10:33:46 mlelstv Exp $
 .\
 .\ Copyright (c) 1983, 1991, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -45,6 +45,7 @@
 .Op Fl m Ar minfree
 .Op Fl o Ar optimize_preference
 .Op Fl q Ar quota
+.Op Fl S Ar sectorsize
 .Ar special | Ar filesys
 .Sh DESCRIPTION
 .Nm
@@ -152,6 +153,18 @@ can be used to enable/disable all types 
 After enabling a quota,
 .Xr fsck_ffs 8
 has to be run to compute the correct quota values.
+.Pp
+.It Fl S Ar sectorsize
+changes the fsbtodb value in the superblock to reflect a particular
+physical sector size. This value is ignored by the NetBSD kernel but
+needed by tools like
+.Xr fsck_ffs  8
+to access disk blocks correctly. The minimum value is DEV_BSIZE (512).
+.Pp
+Changing the fsbtodb value becomes necessary when a filesystem image
+is created for one sector size and then transferred to a device with
+a different sector size and should be applied also to the alternate
+superblocks.
 .El
 .Sh SEE ALSO
 .Xr wapbl 4 ,

Index: src/sbin/tunefs/tunefs.c
diff -u src/sbin/tunefs/tunefs.c:1.47 src/sbin/tunefs/tunefs.c:1.48
--- src/sbin/tunefs/tunefs.c:1.47	Sat Apr 26 13:23:49 2014
+++ src/sbin/tunefs/tunefs.c	Sat Aug  9 10:33:46 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: tunefs.c,v 1.47 2014/04/26 13:23:49 martin Exp $	*/
+/*	$NetBSD: tunefs.c,v 1.48 2014/08/09 10:33:46 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 1983, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT(@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = @(#)tunefs.c	8.3 (Berkeley) 5/3/95;
 #else
-__RCSID($NetBSD: tunefs.c,v 1.47 2014/04/26 13:23:49 martin Exp $);
+__RCSID($NetBSD: tunefs.c,v 1.48 2014/08/09 10:33:46 mlelstv Exp $);
 #endif
 #endif /* not lint */
 
@@ -102,18 +102,20 @@ main(int argc, char *argv[])
 	int		i, ch, Aflag, Fflag, Nflag, openflags;
 	const char	*special, *chg[2];
 	char		device[MAXPATHLEN];
-	int		maxbpg, minfree, optim;
+	int		maxbpg, minfree, optim, secsize;
 	int		avgfilesize, avgfpdir;
 	long long	logfilesize;
+	int		secshift, fsbtodb;
 
 	Aflag = Fflag = Nflag = 0;
-	maxbpg = minfree = optim = -1;
+	maxbpg = minfree = optim = secsize = -1;
 	avgfilesize = avgfpdir = -1;
 	logfilesize = -1;
+	secshift = 0;
 	chg[FS_OPTSPACE] = space;
 	chg[FS_OPTTIME] = time;
 
-	while ((ch = getopt(argc, argv, AFNe:g:h:l:m:o:q:)) != -1) {
+	while ((ch = getopt(argc, argv, AFNe:g:h:l:m:o:q:S:)) != -1) {
 		switch (ch) {
 
 		case 'A':
@@ -177,6 +179,13 @@ main(int argc, char *argv[])
 			else
 			errx(11, invalid quota type %s, optarg);
 			break;
+		case 'S':
+			secsize = strsuftoll(physical sector size,
+			optarg, 0, INT_MAX);
+			secshift = ffs(secsize) - 1;
+			if (secsize != 0  1  secshift != secsize)
+errx(12, sector size %d is not a power of two, secsize);
+			break;
 		default:
 			usage();
 		}
@@ -241,6 +250,30 @@ main(int argc, char *argv[])
 warnx(OPTWARN, space, , MINFREE);
 		}
 	}
+	if (secsize != -1) {
+		if (secsize == 0) {
+			secsize = sblock.fs_fsize / FFS_FSBTODB(sblock, 1);
+			secshift = ffs(secsize) - 1;
+		}
+
+		if (secshift  DEV_BSHIFT)
+			warnx(sector size must be at least %d, DEV_BSIZE);
+		else if (secshift  sblock.fs_fshift)
+			warnx(sector size %d cannot be larger than fragment size %d,
+secsize, sblock.fs_fsize);
+		else {
+			fsbtodb = sblock.fs_fshift - secshift;
+			if (fsbtodb == sblock.fs_fsbtodb) {
+warnx(sector size remains unchanged as %d,
+	sblock.fs_fsize / FFS_FSBTODB(sblock, 1));
+			} else {
+warnx(sector size changed from %d to %d,
+	sblock.fs_fsize / FFS_FSBTODB(sblock, 1),
+	secsize);
+sblock.fs_fsbtodb = fsbtodb;
+			}
+		}
+	}
 	CHANGEVAL(sblock.fs_avgfilesize, avgfilesize,
 	average file size, );
 	CHANGEVAL(sblock.fs_avgfpdir, avgfpdir,
@@ -328,7 +361,13 @@ main(int argc, char *argv[])
 	memcpy(buf, (char *)sblock, SBLOCKSIZE);
 	if (needswap)
 		ffs_sb_swap((struct fs*)buf, (struct fs*)buf);
+
+	/* write superblock to original coordinates (use old dev_bsize!) */
 	bwrite(sblockloc, buf.data, SBLOCKSIZE, special);
+
+	/* correct 

CVS commit: src/sbin/tunefs

2014-08-09 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Aug  9 10:41:05 UTC 2014

Modified Files:
src/sbin/tunefs: tunefs.8

Log Message:
Bump date for previous. New sentence, new line. Use more markup.
Remove superfluous Pp in list.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sbin/tunefs/tunefs.8

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

Modified files:

Index: src/sbin/tunefs/tunefs.8
diff -u src/sbin/tunefs/tunefs.8:1.43 src/sbin/tunefs/tunefs.8:1.44
--- src/sbin/tunefs/tunefs.8:1.43	Sat Aug  9 10:33:46 2014
+++ src/sbin/tunefs/tunefs.8	Sat Aug  9 10:41:05 2014
@@ -1,4 +1,4 @@
-.\	$NetBSD: tunefs.8,v 1.43 2014/08/09 10:33:46 mlelstv Exp $
+.\	$NetBSD: tunefs.8,v 1.44 2014/08/09 10:41:05 wiz Exp $
 .\
 .\ Copyright (c) 1983, 1991, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\
 .\ @(#)tunefs.8	8.3 (Berkeley) 5/3/95
 .\
-.Dd December 3, 2012
+.Dd August 9, 2014
 .Dt TUNEFS 8
 .Os
 .Sh NAME
@@ -153,13 +153,17 @@ can be used to enable/disable all types 
 After enabling a quota,
 .Xr fsck_ffs 8
 has to be run to compute the correct quota values.
-.Pp
 .It Fl S Ar sectorsize
 changes the fsbtodb value in the superblock to reflect a particular
-physical sector size. This value is ignored by the NetBSD kernel but
-needed by tools like
+physical sector size.
+This value is ignored by the
+.Nx
+kernel but needed by tools like
 .Xr fsck_ffs  8
-to access disk blocks correctly. The minimum value is DEV_BSIZE (512).
+to access disk blocks correctly.
+The minimum value is
+.Dv DEV_BSIZE
+(512).
 .Pp
 Changing the fsbtodb value becomes necessary when a filesystem image
 is created for one sector size and then transferred to a device with



CVS commit: src/sbin/tunefs

2014-04-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Apr 26 13:23:49 UTC 2014

Modified Files:
src/sbin/tunefs: tunefs.c

Log Message:
Provide proper alignement for buf - it is casted to a struct fs pointer,
so it requires the same alignement.
Fixes crashes on armv5.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sbin/tunefs/tunefs.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/tunefs/tunefs.c
diff -u src/sbin/tunefs/tunefs.c:1.46 src/sbin/tunefs/tunefs.c:1.47
--- src/sbin/tunefs/tunefs.c:1.46	Sun Jun 23 02:06:05 2013
+++ src/sbin/tunefs/tunefs.c	Sat Apr 26 13:23:49 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: tunefs.c,v 1.46 2013/06/23 02:06:05 dholland Exp $	*/
+/*	$NetBSD: tunefs.c,v 1.47 2014/04/26 13:23:49 martin Exp $	*/
 
 /*
  * Copyright (c) 1983, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT(@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = @(#)tunefs.c	8.3 (Berkeley) 5/3/95;
 #else
-__RCSID($NetBSD: tunefs.c,v 1.46 2013/06/23 02:06:05 dholland Exp $);
+__RCSID($NetBSD: tunefs.c,v 1.47 2014/04/26 13:23:49 martin Exp $);
 #endif
 #endif /* not lint */
 
@@ -71,10 +71,9 @@ __RCSID($NetBSD: tunefs.c,v 1.46 2013/0
 
 union {
 	struct	fs sb;
-	char pad[MAXBSIZE];
-} sbun;
+	char data[MAXBSIZE];
+} sbun, buf;
 #define	sblock sbun.sb
-char buf[MAXBSIZE];
 
 int	fi;
 long	dev_bsize = 512;
@@ -326,14 +325,14 @@ main(int argc, char *argv[])
 		exit(0);
 	}
 
-	memcpy(buf, (char *)sblock, SBLOCKSIZE);
+	memcpy(buf, (char *)sblock, SBLOCKSIZE);
 	if (needswap)
-		ffs_sb_swap((struct fs*)buf, (struct fs*)buf);
-	bwrite(sblockloc, buf, SBLOCKSIZE, special);
+		ffs_sb_swap((struct fs*)buf, (struct fs*)buf);
+	bwrite(sblockloc, buf.data, SBLOCKSIZE, special);
 	if (Aflag)
 		for (i = 0; i  sblock.fs_ncg; i++)
 			bwrite(FFS_FSBTODB(sblock, cgsblock(sblock, i)),
-			buf, SBLOCKSIZE, special);
+			buf.data, SBLOCKSIZE, special);
 	close(fi);
 	exit(0);
 }



CVS commit: src/sbin/tunefs

2011-03-06 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Mar  6 17:21:08 UTC 2011

Modified Files:
src/sbin/tunefs: tunefs.8

Log Message:
Fix punctuation markup; new sentence, new line.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sbin/tunefs/tunefs.8

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

Modified files:

Index: src/sbin/tunefs/tunefs.8
diff -u src/sbin/tunefs/tunefs.8:1.39 src/sbin/tunefs/tunefs.8:1.40
--- src/sbin/tunefs/tunefs.8:1.39	Sun Mar  6 17:08:17 2011
+++ src/sbin/tunefs/tunefs.8	Sun Mar  6 17:21:08 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: tunefs.8,v 1.39 2011/03/06 17:08:17 bouyer Exp $
+.\	$NetBSD: tunefs.8,v 1.40 2011/03/06 17:21:08 wiz Exp $
 .\
 .\ Copyright (c) 1983, 1991, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -136,12 +136,13 @@
 enable or disable a quota.
 .Ar quota
 can be one of
-.Li user,
-.Li group,
+.Li user ,
+.Li group ,
 .Li nouser
 or
 .Li nogroup
-to enable or disable the specified quota type. Multiple
+to enable or disable the specified quota type.
+Multiple
 .Fl q
 can be used to enable/disable all types at once.
 .Pp



CVS commit: src/sbin/tunefs

2009-09-13 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Sep 13 18:30:30 UTC 2009

Modified Files:
src/sbin/tunefs: tunefs.c

Log Message:
Restore change from 1.39 after previous commit.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sbin/tunefs/tunefs.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/tunefs/tunefs.c
diff -u src/sbin/tunefs/tunefs.c:1.41 src/sbin/tunefs/tunefs.c:1.42
--- src/sbin/tunefs/tunefs.c:1.41	Sun Sep 13 14:13:23 2009
+++ src/sbin/tunefs/tunefs.c	Sun Sep 13 18:30:30 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: tunefs.c,v 1.41 2009/09/13 14:13:23 bouyer Exp $	*/
+/*	$NetBSD: tunefs.c,v 1.42 2009/09/13 18:30:30 bouyer Exp $	*/
 
 /*
  * Copyright (c) 1983, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = @(#)tunefs.c	8.3 (Berkeley) 5/3/95;
 #else
-__RCSID($NetBSD: tunefs.c,v 1.41 2009/09/13 14:13:23 bouyer Exp $);
+__RCSID($NetBSD: tunefs.c,v 1.42 2009/09/13 18:30:30 bouyer Exp $);
 #endif
 #endif /* not lint */
 
@@ -368,7 +368,7 @@
 	if (!in_fs_log  logfilesize  0  old_size  0)
 		errx(1, Can't change size of non-in-filesystem log);
 
-	if (old_size == logfilesize  logfilesize  0) {
+	if (old_size == (uint64_t)logfilesize  logfilesize  0) {
 		/* no action */
 		warnx(log file size remains unchanged at %lld, logfilesize);
 		return;