tech-kern archive

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

Re: the bouyer-quota2 branch



On Thu, Mar 10, 2011 at 07:40:59PM +0100, Manuel Bouyer wrote:
> I'll look at extract some functions from ufs/ufs this week-end.

Here is a first attemps.
Some functions from quota2_prop have moved to lib/proplib,
some other in a new common/lib/quota/quotaprop.c
quota2_prop.[ch] will go, usr.bin/quota has been quickly converted to the new
interface.

the idea is that you give the conversion functions an array of
integers (32 or 64bits, depending on your on-disk format for example),
and an array of string which has the corresponding names in the
dictionary. This should be completely independant from the filesystem,
as long as what you want to pass between kernel and userland is
key/values of integers.

-- 
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
     NetBSD: 26 ans d'experience feront toujours la difference
--
? quota2_prop.c.notyet
? quota2_prop.h.notyet
Index: ufs_quota2.c
===================================================================
RCS file: /cvsroot/src/sys/ufs/ufs/Attic/ufs_quota2.c,v
retrieving revision 1.1.2.15
diff -u -r1.1.2.15 ufs_quota2.c
--- ufs_quota2.c        12 Feb 2011 21:48:09 -0000      1.1.2.15
+++ ufs_quota2.c        17 Feb 2011 18:15:11 -0000
@@ -64,7 +64,7 @@
  */
 
 static int quota2_bwrite(struct mount *, struct buf *);
-static int getinoquota2(struct inode *, int, struct buf **,
+static int getinoquota2(struct inode *, bool, bool, struct buf **,
     struct quota2_entry **);
 static int getq2h(struct ufsmount *, int, struct buf **,
     struct quota2_header **, int);
@@ -321,7 +321,7 @@
 }
 
 static int
-getinoquota2(struct inode *ip, int alloc, struct buf **bpp,
+getinoquota2(struct inode *ip, bool alloc, bool modify, struct buf **bpp,
     struct quota2_entry **q2ep)
 {
        int error;
@@ -365,7 +365,7 @@
                }
 
                if ((dq->dq2_lblkno | dq->dq2_blkoff) == 0) {
-                       if (alloc == 0) {
+                       if (!alloc) {
                                continue;
                        }
                        /* need to alloc a new on-disk quot */
@@ -377,7 +377,8 @@
                                return error;
                } else {
                        error = getq2e(ump, i, dq->dq2_lblkno,
-                           dq->dq2_blkoff, &bpp[i], &q2ep[i], B_MODIFY);
+                           dq->dq2_blkoff, &bpp[i], &q2ep[i],
+                           modify ? B_MODIFY : 0);
                        if (error)
                                return error;
                }
@@ -400,7 +401,7 @@
        const int needswap = UFS_MPNEEDSWAP(ump);
        int i;
 
-       if ((error = getinoquota2(ip, change > 0, bp, q2e)) != 0)
+       if ((error = getinoquota2(ip, change > 0, change != 0, bp, q2e)) != 0)
                return error;
        if (change == 0) {
                for (i = 0; i < MAXQUOTAS; i++) {


Home | Main Index | Thread Index | Old Index