Source-Changes-HG archive

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

[src/uebayasi-xip]: src/sys/ufs/ffs Check XIP mount condition more nicely.



details:   https://anonhg.NetBSD.org/src/rev/2b24f127f056
branches:  uebayasi-xip
changeset: 751586:2b24f127f056
user:      uebayasi <uebayasi%NetBSD.org@localhost>
date:      Tue Feb 23 07:00:58 2010 +0000

description:
Check XIP mount condition more nicely.

diffstat:

 sys/ufs/ffs/ffs_vfsops.c |  21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)

diffs (42 lines):

diff -r 6fec583e76c3 -r 2b24f127f056 sys/ufs/ffs/ffs_vfsops.c
--- a/sys/ufs/ffs/ffs_vfsops.c  Tue Feb 23 06:58:06 2010 +0000
+++ b/sys/ufs/ffs/ffs_vfsops.c  Tue Feb 23 07:00:58 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ffs_vfsops.c,v 1.257.2.1 2010/02/11 05:22:38 uebayasi Exp $    */
+/*     $NetBSD: ffs_vfsops.c,v 1.257.2.2 2010/02/23 07:00:58 uebayasi Exp $    */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.257.2.1 2010/02/11 05:22:38 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.257.2.2 2010/02/23 07:00:58 uebayasi Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -1176,11 +1176,18 @@
        mp->mnt_iflag |= IMNT_MPSAFE;
 #ifdef XIP
        paddr_t phys_addr = 0;
-       if ((VOP_IOCTL(devvp, DIOCGPHYSADDR, &phys_addr, FREAD,
-           cred) == 0) &&
-           phys_addr != 0) {
-               mp->mnt_iflag |= IMNT_XIP;
-               mp->mnt_phys_addr = phys_addr;
+       if (mp->mnt_flag & MNT_XIP) {
+               if ((mp->mnt_flag & MNT_RDONLY) == 0)
+                       printf("XIP needs read-only mount\n");
+               else {
+                       if ((VOP_IOCTL(devvp, DIOCGPHYSADDR, &phys_addr, FREAD,
+                           cred) == 0) &&
+                           phys_addr != 0) {
+                               mp->mnt_iflag |= IMNT_XIP;
+                               mp->mnt_phys_addr = phys_addr;
+                       } else
+                               printf("device doesn't support DIOCGPHYSADDR\n");
+               }
        }
 #endif
 #ifdef FFS_EI



Home | Main Index | Thread Index | Old Index