lockmgr(&sysctl_disklock, LK_RELEASE, NULL, p);
lockmgr(&sysctl_disklock, LK_RELEASE, NULL);
sysctl_diskinit(update, p)	int update;	struct proc *p;{	struct diskstats *sdk;	struct disk *dk;	int i, tlen, l;	if ((i = lockmgr(&sysctl_disklock, LK_EXCLUSIVE, NULL, p)) != 0)		return i;	if (disk_change) {		for (dk = TAILQ_FIRST(&disklist), tlen = 0; dk;		    dk = TAILQ_NEXT(dk, dk_link))			tlen += strlen(dk->dk_name) + 1;		tlen++;		if (disknames)			free(disknames, M_SYSCTL);		if (diskstats)			free(diskstats, M_SYSCTL);		diskstats = NULL;		disknames = NULL;		diskstats = malloc(disk_count * sizeof(struct diskstats),		    M_SYSCTL, M_WAITOK);		disknames = malloc(tlen, M_SYSCTL, M_WAITOK);		disknames[0] = '\0';		for (dk = TAILQ_FIRST(&disklist), i = 0, l = 0; dk;		    dk = TAILQ_NEXT(dk, dk_link), i++) {			snprintf(disknames + l, tlen - l, "%s,",			    dk->dk_name ? dk->dk_name : "");			l += strlen(disknames + l);			sdk = diskstats + i;			strlcpy(sdk->ds_name, dk->dk_name,			    sizeof(sdk->ds_name));			sdk->ds_busy = dk->dk_busy;			sdk->ds_rxfer = dk->dk_rxfer;			sdk->ds_wxfer = dk->dk_wxfer;			sdk->ds_seek = dk->dk_seek;			sdk->ds_rbytes = dk->dk_rbytes;			sdk->ds_wbytes = dk->dk_wbytes;			sdk->ds_attachtime = dk->dk_attachtime;			sdk->ds_timestamp = dk->dk_timestamp;			sdk->ds_time = dk->dk_time;		}		/* Eliminate trailing comma */		if (l != 0)			disknames[l - 1] = '\0';		disk_change = 0;	} else if (update) {		/* Just update, number of drives hasn't changed */		for (dk = TAILQ_FIRST(&disklist), i = 0; dk;		    dk = TAILQ_NEXT(dk, dk_link), i++) {			sdk = diskstats + i;			strlcpy(sdk->ds_name, dk->dk_name,			    sizeof(sdk->ds_name));			sdk->ds_busy = dk->dk_busy;			sdk->ds_rxfer = dk->dk_rxfer;			sdk->ds_wxfer = dk->dk_wxfer;			sdk->ds_seek = dk->dk_seek;			sdk->ds_rbytes = dk->dk_rbytes;			sdk->ds_wbytes = dk->dk_wbytes;			sdk->ds_attachtime = dk->dk_attachtime;			sdk->ds_timestamp = dk->dk_timestamp;			sdk->ds_time = dk->dk_time;		}	}	lockmgr(&sysctl_disklock, LK_RELEASE, NULL, p);	return 0;}