- 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
This commit is contained in:
parent
6511bcb8c0
commit
8d9495bb1d
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user