g_label_ufs.c (156299) | g_label_ufs.c (162357) |
---|---|
1/*- 2 * Copyright (c) 2002, 2003 Gordon Tetlow 3 * Copyright (c) 2006 Pawel Jakub Dawidek <pjd@FreeBSD.org> 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 12 unchanged lines hidden (view full) --- 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 */ 27 28#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2002, 2003 Gordon Tetlow 3 * Copyright (c) 2006 Pawel Jakub Dawidek <pjd@FreeBSD.org> 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 12 unchanged lines hidden (view full) --- 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 */ 27 28#include <sys/cdefs.h> |
29__FBSDID("$FreeBSD: head/sys/geom/label/g_label_ufs.c 156299 2006-03-04 19:41:54Z pjd $"); | 29__FBSDID("$FreeBSD: head/sys/geom/label/g_label_ufs.c 162357 2006-09-16 11:24:41Z pjd $"); |
30 31#include <sys/param.h> 32#include <sys/systm.h> 33#include <sys/kernel.h> 34#include <sys/malloc.h> 35 36#include <ufs/ufs/dinode.h> 37#include <ufs/ffs/fs.h> --- 35 unchanged lines hidden (view full) --- 73 */ 74 if (superblock % cp->provider->sectorsize != 0) 75 continue; 76 77 fs = (struct fs *)g_read_data(cp, superblock, SBLOCKSIZE, NULL); 78 if (fs == NULL) 79 continue; 80 /* Check for magic and make sure things are the right size */ | 30 31#include <sys/param.h> 32#include <sys/systm.h> 33#include <sys/kernel.h> 34#include <sys/malloc.h> 35 36#include <ufs/ufs/dinode.h> 37#include <ufs/ffs/fs.h> --- 35 unchanged lines hidden (view full) --- 73 */ 74 if (superblock % cp->provider->sectorsize != 0) 75 continue; 76 77 fs = (struct fs *)g_read_data(cp, superblock, SBLOCKSIZE, NULL); 78 if (fs == NULL) 79 continue; 80 /* Check for magic and make sure things are the right size */ |
81 if (fs->fs_magic == FS_UFS1_MAGIC && 82 fs->fs_old_size * fs->fs_fsize == (int32_t)pp->mediasize) { | 81 if (fs->fs_magic == FS_UFS1_MAGIC && fs->fs_fsize > 0 && 82 pp->mediasize / fs->fs_fsize == fs->fs_old_size) { |
83 /* Valid UFS1. */ 84 } else if (fs->fs_magic == FS_UFS2_MAGIC && fs->fs_fsize > 0 && 85 pp->mediasize / fs->fs_fsize == fs->fs_size) { 86 /* Valid UFS2. */ 87 } else { 88 g_free(fs); 89 continue; 90 } --- 23 unchanged lines hidden --- | 83 /* Valid UFS1. */ 84 } else if (fs->fs_magic == FS_UFS2_MAGIC && fs->fs_fsize > 0 && 85 pp->mediasize / fs->fs_fsize == fs->fs_size) { 86 /* Valid UFS2. */ 87 } else { 88 g_free(fs); 89 continue; 90 } --- 23 unchanged lines hidden --- |