Module Name: src
Committed By: bouyer
Date: Tue Nov 29 20:56:12 UTC 2011
Modified Files:
src/sys/dev: fss.c fssvar.h
Log Message:
Complete backward compat with NetBSd 5.x: time_t changed size, so did
struct timeval, and so did struct fss_get. So we need a compat FSSIOCGET50
ioctl.
To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 src/sys/dev/fss.c
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/fssvar.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/dev/fss.c
diff -u src/sys/dev/fss.c:1.79 src/sys/dev/fss.c:1.80
--- src/sys/dev/fss.c:1.79 Tue Nov 29 19:17:03 2011
+++ src/sys/dev/fss.c Tue Nov 29 20:56:12 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: fss.c,v 1.79 2011/11/29 19:17:03 bouyer Exp $ */
+/* $NetBSD: fss.c,v 1.80 2011/11/29 20:56:12 bouyer Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.79 2011/11/29 19:17:03 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.80 2011/11/29 20:56:12 bouyer Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -304,6 +304,7 @@ fss_ioctl(dev_t dev, u_long cmd, void *d
struct fss_set *fss = (struct fss_set *)data;
struct fss_set50 *fss50 = (struct fss_set50 *)data;
struct fss_get *fsg = (struct fss_get *)data;
+ struct fss_get50 *fsg50 = (struct fss_get50 *)data;
switch (cmd) {
case FSSIOCSET50:
@@ -337,6 +338,32 @@ fss_ioctl(dev_t dev, u_long cmd, void *d
mutex_exit(&sc->sc_lock);
break;
+ case FSSIOCGET50:
+ mutex_enter(&sc->sc_lock);
+ switch (sc->sc_flags & (FSS_PERSISTENT | FSS_ACTIVE)) {
+ case FSS_ACTIVE:
+ memcpy(fsg50->fsg_mount, sc->sc_mntname, MNAMELEN);
+ fsg50->fsg_csize = FSS_CLSIZE(sc);
+ timeval_to_timeval50(&sc->sc_time, &fsg50->fsg_time);
+ fsg50->fsg_mount_size = sc->sc_clcount;
+ fsg50->fsg_bs_size = sc->sc_clnext;
+ error = 0;
+ break;
+ case FSS_PERSISTENT | FSS_ACTIVE:
+ memcpy(fsg50->fsg_mount, sc->sc_mntname, MNAMELEN);
+ fsg50->fsg_csize = 0;
+ timeval_to_timeval50(&sc->sc_time, &fsg50->fsg_time);
+ fsg50->fsg_mount_size = 0;
+ fsg50->fsg_bs_size = 0;
+ error = 0;
+ break;
+ default:
+ error = ENXIO;
+ break;
+ }
+ mutex_exit(&sc->sc_lock);
+ break;
+
case FSSIOCGET:
mutex_enter(&sc->sc_lock);
switch (sc->sc_flags & (FSS_PERSISTENT | FSS_ACTIVE)) {
Index: src/sys/dev/fssvar.h
diff -u src/sys/dev/fssvar.h:1.26 src/sys/dev/fssvar.h:1.27
--- src/sys/dev/fssvar.h:1.26 Tue Nov 29 19:17:03 2011
+++ src/sys/dev/fssvar.h Tue Nov 29 20:56:12 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: fssvar.h,v 1.26 2011/11/29 19:17:03 bouyer Exp $ */
+/* $NetBSD: fssvar.h,v 1.27 2011/11/29 20:56:12 bouyer Exp $ */
/*-
* Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@@ -37,12 +37,6 @@
#define FSS_UNCONFIG_ON_CLOSE 0x01 /* Unconfigure on last close */
#define FSS_UNLINK_ON_CREATE 0x02 /* Unlink backing store on create */
-struct fss_set50 {
- char *fss_mount; /* Mount point of file system */
- char *fss_bstore; /* Path of backing store */
- blksize_t fss_csize; /* Preferred cluster size */
-};
-
struct fss_set {
char *fss_mount; /* Mount point of file system */
char *fss_bstore; /* Path of backing store */
@@ -63,9 +57,25 @@ struct fss_get {
#define FSSIOCCLR _IO('F', 2) /* Unconfigure */
#define FSSIOFSET _IOW('F', 3, int) /* Set flags */
#define FSSIOFGET _IOR('F', 4, int) /* Get flags */
-#define FSSIOCSET50 _IOW('F', 0, struct fss_set50) /* Old configure */
-
#ifdef _KERNEL
+#include <compat/sys/time_types.h>
+
+struct fss_set50 {
+ char *fss_mount; /* Mount point of file system */
+ char *fss_bstore; /* Path of backing store */
+ blksize_t fss_csize; /* Preferred cluster size */
+};
+
+struct fss_get50 {
+ char fsg_mount[MNAMELEN]; /* Mount point of file system */
+ struct timeval50 fsg_time; /* Time this snapshot was taken */
+ blksize_t fsg_csize; /* Current cluster size */
+ blkcnt_t fsg_mount_size; /* # clusters on file system */
+ blkcnt_t fsg_bs_size; /* # clusters on backing store */
+};
+
+#define FSSIOCSET50 _IOW('F', 0, struct fss_set50) /* Old configure */
+#define FSSIOCGET50 _IOR('F', 1, struct fss_get50) /* Old Status */
#include <sys/bufq.h>