Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/ufs handle negative small block numbers for extattr



details:   https://anonhg.NetBSD.org/src/rev/8508924297f3
branches:  trunk
changeset: 931018:8508924297f3
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Apr 20 03:57:02 2020 +0000

description:
handle negative small block numbers for extattr

diffstat:

 sys/ufs/ufs/ufs_bmap.c |  11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diffs (32 lines):

diff -r 0cacb6438270 -r 8508924297f3 sys/ufs/ufs/ufs_bmap.c
--- a/sys/ufs/ufs/ufs_bmap.c    Mon Apr 20 03:00:33 2020 +0000
+++ b/sys/ufs/ufs/ufs_bmap.c    Mon Apr 20 03:57:02 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ufs_bmap.c,v 1.52 2017/03/18 05:33:06 riastradh Exp $  */
+/*     $NetBSD: ufs_bmap.c,v 1.53 2020/04/20 03:57:02 christos Exp $   */
 
 /*
  * Copyright (c) 1989, 1991, 1993
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ufs_bmap.c,v 1.52 2017/03/18 05:33:06 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_bmap.c,v 1.53 2020/04/20 03:57:02 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -190,6 +190,13 @@
                        }
                }
                return (0);
+       } else if (bn < 0 && bn >= -UFS_NXADDR) {
+               KASSERT(ump->um_fstype == UFS2);
+               daddr = ufs_rw64(ip->i_ffs2_extb[-1 - bn], UFS_MPNEEDSWAP(ump));
+               *bnp = blkptrtodb(ump, daddr);
+               if (*bnp == 0)
+                       *bnp = -1;
+               return 0;
        }
 
        xap = ap == NULL ? a : ap;



Home | Main Index | Thread Index | Old Index