newfs_msdos.c (170166) | newfs_msdos.c (185345) |
---|---|
1/* 2 * Copyright (c) 1998 Robert Nordier 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 --- 13 unchanged lines hidden (view full) --- 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 25 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 */ 27 28#ifndef lint 29static const char rcsid[] = | 1/* 2 * Copyright (c) 1998 Robert Nordier 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 --- 13 unchanged lines hidden (view full) --- 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 25 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 */ 27 28#ifndef lint 29static const char rcsid[] = |
30 "$FreeBSD: head/sbin/newfs_msdos/newfs_msdos.c 170166 2007-05-31 20:06:46Z trhodes $"; | 30 "$FreeBSD: head/sbin/newfs_msdos/newfs_msdos.c 185345 2008-11-26 21:05:03Z luigi $"; |
31#endif /* not lint */ 32 33#include <sys/param.h> 34#include <sys/fdcio.h> 35#include <sys/disk.h> 36#include <sys/disklabel.h> 37#include <sys/mount.h> 38#include <sys/stat.h> --- 681 unchanged lines hidden (view full) --- 720 721 /* If the user specified a disk type, try to use that */ 722 if (dtype != NULL) { 723 lp = getdiskbyname(dtype); 724 } 725 726 /* Maybe it's a floppy drive */ 727 if (lp == NULL) { | 31#endif /* not lint */ 32 33#include <sys/param.h> 34#include <sys/fdcio.h> 35#include <sys/disk.h> 36#include <sys/disklabel.h> 37#include <sys/mount.h> 38#include <sys/stat.h> --- 681 unchanged lines hidden (view full) --- 720 721 /* If the user specified a disk type, try to use that */ 722 if (dtype != NULL) { 723 lp = getdiskbyname(dtype); 724 } 725 726 /* Maybe it's a floppy drive */ 727 if (lp == NULL) { |
728 if (ioctl(fd, DIOCGMEDIASIZE, &ms) == -1) 729 errx(1, "Cannot get disk size, %s", strerror(errno)); 730 if (ioctl(fd, FD_GTYPE, &type) != -1) { | 728 if (ioctl(fd, DIOCGMEDIASIZE, &ms) == -1) { 729 struct stat st; 730 731 bzero(&st, sizeof(st)); 732 if (fstat(fd, &st)) 733 err(1, "Cannot get disk size"); 734 /* create a fake geometry for a file image */ 735 ms = st.st_size; 736 dlp.d_secsize = 512; 737 dlp.d_nsectors = 64; 738 dlp.d_ntracks = 32; 739 dlp.d_secperunit = ms / dlp.d_secsize; 740 lp = &dlp; 741 } else if (ioctl(fd, FD_GTYPE, &type) != -1) { |
731 dlp.d_secsize = 128 << type.secsize; 732 dlp.d_nsectors = type.sectrac; 733 dlp.d_ntracks = type.heads; 734 dlp.d_secperunit = ms / dlp.d_secsize; 735 lp = &dlp; 736 } 737 } 738 --- 158 unchanged lines hidden --- | 742 dlp.d_secsize = 128 << type.secsize; 743 dlp.d_nsectors = type.sectrac; 744 dlp.d_ntracks = type.heads; 745 dlp.d_secperunit = ms / dlp.d_secsize; 746 lp = &dlp; 747 } 748 } 749 --- 158 unchanged lines hidden --- |