Source-Changes-HG archive

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

[src/trunk]: src/sys/compat/common Some further tidying for the COMPAT_50 quo...



details:   https://anonhg.NetBSD.org/src/rev/5edc3b94f9f1
branches:  trunk
changeset: 773212:5edc3b94f9f1
user:      dholland <dholland%NetBSD.org@localhost>
date:      Sun Jan 29 07:19:48 2012 +0000

description:
Some further tidying for the COMPAT_50 quotactl code. Mostly cosmetic,
but also use PNBUF_GET() and PNBUF_PUT() for a path buffer instead of
malloc with M_TEMP.

diffstat:

 sys/compat/common/vfs_syscalls_50.c |  26 +++++++++++++-------------
 1 files changed, 13 insertions(+), 13 deletions(-)

diffs (79 lines):

diff -r fc0c09e20ba5 -r 5edc3b94f9f1 sys/compat/common/vfs_syscalls_50.c
--- a/sys/compat/common/vfs_syscalls_50.c       Sun Jan 29 07:19:04 2012 +0000
+++ b/sys/compat/common/vfs_syscalls_50.c       Sun Jan 29 07:19:48 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_syscalls_50.c,v 1.14 2012/01/29 07:19:04 dholland Exp $    */
+/*     $NetBSD: vfs_syscalls_50.c,v 1.15 2012/01/29 07:19:48 dholland Exp $    */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_50.c,v 1.14 2012/01/29 07:19:04 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_50.c,v 1.15 2012/01/29 07:19:48 dholland Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -51,7 +51,6 @@
 #include <sys/proc.h>
 #include <sys/uio.h>
 #include <sys/dirent.h>
-#include <sys/malloc.h>
 #include <sys/kauth.h>
 #include <sys/time.h>
 #include <sys/vfs_syscalls.h>
@@ -327,17 +326,17 @@
                syscallarg(int) uid;
                syscallarg(void *) arg; 
        } */
+       struct vnode *vp;
        struct mount *mp;
-       int error;
-       struct vnode *vp;
-       int q1cmd = SCARG(uap, cmd);
-       char *bufpath;
+       int q1cmd;
+       int idtype;
+       char *qfile;
        struct dqblk dqblk;
        struct quotakey key;
        struct quotaval blocks, files;
        struct quotastat qstat;
        struct vfs_quotactl_args args;
-       int idtype;
+       int error;
 
        error = namei_simple_user(SCARG(uap, path),
                                NSM_FOLLOW_TRYEMULROOT, &vp);
@@ -345,23 +344,24 @@
                return (error);       
 
        mp = vp->v_mount;
+       q1cmd = SCARG(uap, cmd);
        idtype = quota_idtype_from_ufs(q1cmd & SUBCMDMASK);
 
        switch ((q1cmd & ~SUBCMDMASK) >> SUBCMDSHIFT) {
        case Q_QUOTAON:
-               bufpath = malloc(PATH_MAX * sizeof(char), M_TEMP, M_WAITOK);
-               error = copyinstr(SCARG(uap, arg), bufpath, PATH_MAX, NULL);
+               qfile = PNBUF_GET();
+               error = copyinstr(SCARG(uap, arg), qfile, PATH_MAX, NULL);
                if (error != 0) {
-                       free(bufpath, M_TEMP);
+                       PNBUF_PUT(qfile);
                        break;
                }
 
                args.qc_op = QUOTACTL_QUOTAON;
-               args.u.quotaon.qc_quotafile = bufpath;
+               args.u.quotaon.qc_quotafile = qfile;
                args.u.quotaon.qc_idtype = idtype;
                error = VFS_QUOTACTL(mp, &args);
 
-               free(bufpath, M_TEMP);
+               PNBUF_PUT(qfile);
                break;
 
        case Q_QUOTAOFF:



Home | Main Index | Thread Index | Old Index