Author: davide
Date: Thu Oct 25 20:23:04 2012
New Revision: 242092
URL: http://svn.freebsd.org/changeset/base/242092

Log:
  - Remove the references to the deprecated zalloc kernel interface
  - Use M_ZERO flag in malloc() rather than bzero()
  - malloc() with M_NOWAIT can't return NULL so there's no need to check
  
  Reviewed by:  alc
  Approved by:  alc

Modified:
  head/sys/fs/smbfs/smbfs_smb.c
  head/sys/fs/smbfs/smbfs_vfsops.c

Modified: head/sys/fs/smbfs/smbfs_smb.c
==============================================================================
--- head/sys/fs/smbfs/smbfs_smb.c       Thu Oct 25 20:16:38 2012        
(r242091)
+++ head/sys/fs/smbfs/smbfs_smb.c       Thu Oct 25 20:23:04 2012        
(r242092)
@@ -1165,8 +1165,6 @@ smbfs_findopenLM2(struct smbfs_fctx *ctx
                ctx->f_name = malloc(SMB_MAXFNAMELEN * 2, M_SMBFSDATA, 
M_WAITOK);
        } else
                ctx->f_name = malloc(SMB_MAXFNAMELEN, M_SMBFSDATA, M_WAITOK);
-       if (ctx->f_name == NULL)
-               return ENOMEM;
        ctx->f_infolevel = SMB_DIALECT(SSTOVC(ctx->f_ssp)) < 
SMB_DIALECT_NTLM0_12 ?
            SMB_INFO_STANDARD : SMB_FIND_FILE_DIRECTORY_INFO;
        ctx->f_attrmask = attr;
@@ -1311,10 +1309,7 @@ smbfs_findopen(struct smbnode *dnp, cons
        struct smbfs_fctx *ctx;
        int error;
 
-       ctx = malloc(sizeof(*ctx), M_SMBFSDATA, M_WAITOK);
-       if (ctx == NULL)
-               return ENOMEM;
-       bzero(ctx, sizeof(*ctx));
+       ctx = malloc(sizeof(*ctx), M_SMBFSDATA, M_WAITOK | M_ZERO);
        ctx->f_ssp = dnp->n_mount->sm_share;
        ctx->f_dnp = dnp;
        ctx->f_flags = SMBFS_RDD_FINDFIRST;

Modified: head/sys/fs/smbfs/smbfs_vfsops.c
==============================================================================
--- head/sys/fs/smbfs/smbfs_vfsops.c    Thu Oct 25 20:16:38 2012        
(r242091)
+++ head/sys/fs/smbfs/smbfs_vfsops.c    Thu Oct 25 20:23:04 2012        
(r242092)
@@ -54,13 +54,6 @@ static int smbfs_debuglevel = 0;
 
 static int smbfs_version = SMBFS_VERSION;
 
-#ifdef SMBFS_USEZONE
-#include <vm/vm.h>
-#include <vm/vm_extern.h>
-
-vm_zone_t smbfsmount_zone;
-#endif
-
 SYSCTL_NODE(_vfs, OID_AUTO, smbfs, CTLFLAG_RW, 0, "SMB/CIFS filesystem");
 SYSCTL_INT(_vfs_smbfs, OID_AUTO, version, CTLFLAG_RD, &smbfs_version, 0, "");
 SYSCTL_INT(_vfs_smbfs, OID_AUTO, debuglevel, CTLFLAG_RW, &smbfs_debuglevel, 0, 
"");
@@ -172,18 +165,7 @@ smbfs_mount(struct mount *mp)
        smb_share_unlock(ssp, 0);
        mp->mnt_stat.f_iosize = SSTOVC(ssp)->vc_txmax;
 
-#ifdef SMBFS_USEZONE
-       smp = zalloc(smbfsmount_zone);
-#else
-       smp = malloc(sizeof(*smp), M_SMBFSDATA, M_WAITOK);
-#endif
-        if (smp == NULL) {
-               printf("could not alloc smbmount\n");
-               vfs_mount_error(mp, "could not alloc smbmount", v, error);
-               error = ENOMEM;
-               goto bad;
-        }
-       bzero(smp, sizeof(*smp));
+       smp = malloc(sizeof(*smp), M_SMBFSDATA, M_WAITOK | M_ZERO);
         mp->mnt_data = smp;
        smp->sm_hash = hashinit(desiredvnodes, M_SMBFSHASH, &smp->sm_hashlen);
        if (smp->sm_hash == NULL)
@@ -261,11 +243,7 @@ bad:
                if (smp->sm_hash)
                        free(smp->sm_hash, M_SMBFSHASH);
                sx_destroy(&smp->sm_hashlock);
-#ifdef SMBFS_USEZONE
-               zfree(smbfsmount_zone, smp);
-#else
                free(smp, M_SMBFSDATA);
-#endif
        }
        if (ssp)
                smb_share_put(ssp, &scred);
@@ -311,11 +289,7 @@ smbfs_unmount(struct mount *mp, int mntf
        if (smp->sm_hash)
                free(smp->sm_hash, M_SMBFSHASH);
        sx_destroy(&smp->sm_hashlock);
-#ifdef SMBFS_USEZONE
-       zfree(smbfsmount_zone, smp);
-#else
        free(smp, M_SMBFSDATA);
-#endif
        MNT_ILOCK(mp);
        mp->mnt_flag &= ~MNT_LOCAL;
        MNT_IUNLOCK(mp);
@@ -383,9 +357,6 @@ smbfs_quotactl(mp, cmd, uid, arg)
 int
 smbfs_init(struct vfsconf *vfsp)
 {
-#ifdef SMBFS_USEZONE
-       smbfsmount_zone = zinit("SMBFSMOUNT", sizeof(struct smbmount), 0, 0, 1);
-#endif
        smbfs_pbuf_freecnt = nswbuf / 2 + 1;
        SMBVDEBUG("done.\n");
        return 0;
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to