Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev Complete backward compat with NetBSd 5.x: time_t cha...



details:   https://anonhg.NetBSD.org/src/rev/f9f751d8e372
branches:  trunk
changeset: 771708:f9f751d8e372
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Tue Nov 29 20:56:12 2011 +0000

description:
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.

diffstat:

 sys/dev/fss.c    |  31 +++++++++++++++++++++++++++++--
 sys/dev/fssvar.h |  28 +++++++++++++++++++---------
 2 files changed, 48 insertions(+), 11 deletions(-)

diffs (109 lines):

diff -r dc8e01bc1e5f -r f9f751d8e372 sys/dev/fss.c
--- a/sys/dev/fss.c     Tue Nov 29 20:05:30 2011 +0000
+++ b/sys/dev/fss.c     Tue Nov 29 20:56:12 2011 +0000
@@ -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 @@
        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 @@
                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)) {
diff -r dc8e01bc1e5f -r f9f751d8e372 sys/dev/fssvar.h
--- a/sys/dev/fssvar.h  Tue Nov 29 20:05:30 2011 +0000
+++ b/sys/dev/fssvar.h  Tue Nov 29 20:56:12 2011 +0000
@@ -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 @@
 #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 */
+};
 
-#ifdef _KERNEL
+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>
 



Home | Main Index | Thread Index | Old Index