diff options
author | davide <davide@FreeBSD.org> | 2012-10-25 20:23:04 +0000 |
---|---|---|
committer | davide <davide@FreeBSD.org> | 2012-10-25 20:23:04 +0000 |
commit | bac20b679d394666359241df51cd79eab738bc5a (patch) | |
tree | 80353a474646ca0a147c238f3a413986b57177bd /sys | |
parent | 7a91df3c3792dc1bed5ff818447fc26896d809d1 (diff) | |
download | FreeBSD-src-bac20b679d394666359241df51cd79eab738bc5a.zip FreeBSD-src-bac20b679d394666359241df51cd79eab738bc5a.tar.gz |
- 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
Diffstat (limited to 'sys')
-rw-r--r-- | sys/fs/smbfs/smbfs_smb.c | 7 | ||||
-rw-r--r-- | sys/fs/smbfs/smbfs_vfsops.c | 31 |
2 files changed, 2 insertions, 36 deletions
diff --git a/sys/fs/smbfs/smbfs_smb.c b/sys/fs/smbfs/smbfs_smb.c index 05162d5..7b84f4b 100644 --- a/sys/fs/smbfs/smbfs_smb.c +++ b/sys/fs/smbfs/smbfs_smb.c @@ -1165,8 +1165,6 @@ smbfs_findopenLM2(struct smbfs_fctx *ctx, struct smbnode *dnp, 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, const char *wildcard, int wclen, int attr, 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; diff --git a/sys/fs/smbfs/smbfs_vfsops.c b/sys/fs/smbfs/smbfs_vfsops.c index f5460b5..2443001 100644 --- a/sys/fs/smbfs/smbfs_vfsops.c +++ b/sys/fs/smbfs/smbfs_vfsops.c @@ -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 mntflags) 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; |