Deleted Added
full compact
newfs_nandfs.c (256281) newfs_nandfs.c (266274)
1/*-
2 * Copyright (c) 2010-2012 Semihalf.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2010-2012 Semihalf.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: stable/10/sbin/newfs_nandfs/newfs_nandfs.c 249743 2013-04-21 22:36:14Z ed $");
28__FBSDID("$FreeBSD: stable/10/sbin/newfs_nandfs/newfs_nandfs.c 266274 2014-05-16 23:27:18Z ian $");
29
30#include <sys/param.h>
31#include <sys/fdcio.h>
32#include <sys/disk.h>
33#include <sys/disklabel.h>
34#include <sys/mount.h>
35#include <sys/stat.h>
36#include <sys/time.h>

--- 946 unchanged lines hidden (view full) ---

983
984 /* Get storage size */
985 mediasize = g_mediasize(fd);
986 debug("mediasize: %#jx", mediasize);
987
988 /* Get storage erase unit size */
989 if (!is_nand)
990 erasesize = NANDFS_DEF_ERASESIZE;
29
30#include <sys/param.h>
31#include <sys/fdcio.h>
32#include <sys/disk.h>
33#include <sys/disklabel.h>
34#include <sys/mount.h>
35#include <sys/stat.h>
36#include <sys/time.h>

--- 946 unchanged lines hidden (view full) ---

983
984 /* Get storage size */
985 mediasize = g_mediasize(fd);
986 debug("mediasize: %#jx", mediasize);
987
988 /* Get storage erase unit size */
989 if (!is_nand)
990 erasesize = NANDFS_DEF_ERASESIZE;
991 else if (ioctl(fd, NAND_IO_GET_CHIP_PARAM, &chip_params) == -1)
992 errx(1, "Cannot ioctl(NAND_IO_GET_CHIP_PARAM)");
993 else
991 else if (ioctl(fd, NAND_IO_GET_CHIP_PARAM, &chip_params) != -1)
994 erasesize = chip_params.page_size * chip_params.pages_per_block;
992 erasesize = chip_params.page_size * chip_params.pages_per_block;
993 else
994 errx(1, "Cannot ioctl(NAND_IO_GET_CHIP_PARAM)");
995
996 debug("erasesize: %#jx", (uintmax_t)erasesize);
997
998 if (blocks_per_segment == 0) {
999 if (erasesize >= NANDFS_MIN_SEGSIZE)
1000 blocks_per_segment = erasesize / blocksize;
1001 else
1002 blocks_per_segment = NANDFS_MIN_SEGSIZE / blocksize;

--- 177 unchanged lines hidden ---
995
996 debug("erasesize: %#jx", (uintmax_t)erasesize);
997
998 if (blocks_per_segment == 0) {
999 if (erasesize >= NANDFS_MIN_SEGSIZE)
1000 blocks_per_segment = erasesize / blocksize;
1001 else
1002 blocks_per_segment = NANDFS_MIN_SEGSIZE / blocksize;

--- 177 unchanged lines hidden ---