⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chklabel.c

📁 操作系统SunOS 4.1.3版本的源码
💻 C
字号:
/* * @(#)chklabel.c 1.1 92/07/30 Copyright (c) 1985 by Sun Microsystems, Inc. */#include <stand/saio.h>#include <sun/dklabel.h>char msg_nolabel[] = "No label found - attempting boot anyway.\n";/* * Checks a disk label, returns 0 for success, 1 for failure. * If the magic number is right but the checksum is wrong, prints * "Corrupt label" error message, otherwise is silent. */chklabel(label)	register struct dk_label *label;{	register int count, sum = 0;	register short *sp;	if (label->dkl_magic != DKL_MAGIC)		return (1);	count = sizeof (struct dk_label) / sizeof (short);	sp = (short *)label;	while (count--) 		sum ^= *sp++;	if (sum != 0) {		printf("Corrupt label\n");		return (1);	}	return (0);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -