]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - lib/libdisk/disklabel.c
This commit was generated by cvs2svn to compensate for changes in r89402,
[FreeBSD/FreeBSD.git] / lib / libdisk / disklabel.c
1 /*
2  * ----------------------------------------------------------------------------
3  * "THE BEER-WARE LICENSE" (Revision 42):
4  * <phk@login.dknet.dk> wrote this file.  As long as you retain this notice you
5  * can do whatever you want with this stuff. If we meet some day, and you think
6  * this stuff is worth it, you can buy me a beer in return.   Poul-Henning Kamp
7  * ----------------------------------------------------------------------------
8  */
9
10 #include <sys/cdefs.h>
11 __FBSDID("$FreeBSD$");
12
13 #include <stdio.h>
14 #include <stdlib.h>
15 #include <unistd.h>
16 #include <sys/disklabel.h>
17 #include "libdisk.h"
18
19 struct disklabel *
20 read_disklabel(int fd, daddr_t block, u_long sector_size)
21 {
22         struct disklabel *dp;
23
24         dp = (struct disklabel *) read_block(fd, block, sector_size);
25         if (dp->d_magic != DISKMAGIC)
26                 return 0;
27         if (dp->d_magic2 != DISKMAGIC)
28                 return 0;
29         if (dkcksum(dp) != 0)
30                 return 0;
31         return dp;
32 }