From owner-freebsd-current@FreeBSD.ORG Mon Mar 8 08:44:09 2010 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D7193106564A; Mon, 8 Mar 2010 08:44:09 +0000 (UTC) (envelope-from c.jayachandran@gmail.com) Received: from mail-gy0-f182.google.com (mail-gy0-f182.google.com [209.85.160.182]) by mx1.freebsd.org (Postfix) with ESMTP id 7ABEF8FC0C; Mon, 8 Mar 2010 08:44:09 +0000 (UTC) Received: by gyg8 with SMTP id 8so1325482gyg.13 for ; Mon, 08 Mar 2010 00:44:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=xZGYM8h5FFYZlsCO3CFyt2lTrHnQCAMADHji4LlUvDE=; b=Li1w61tg1d4WdMGx8c6dJOy+MJDMXfacOOoomencAUDCyGkhh1FQrOUrHJRBvfPyYC 4xmZERkw/J+7LiVafGypnXp+H2tueXffMWiSkKOx/Tkt7yTWB5fzdUyq1NT/6Ex5NZDi nlLbBt8X4dntYd77gIu+Okdc7w/76C6mlJ89M= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=F4DnOOLnnmf/QCdZX2TplsfprB0brDwDHtyCKyrPeNwCeNlUgFTIqJAcN560Qa69ZE q0m2K052WMujo80NCshO7O8+3eHnU7F9bX/DPII0GquxO+m/0LR+cXeDe9ptuFWqWtbj UCdObBWMAIz80HunvpBldRTyDBAAGRPOAM+n8= Received: by 10.90.16.12 with SMTP id 12mr2666389agp.46.1268037848599; Mon, 08 Mar 2010 00:44:08 -0800 (PST) Received: from jayachandranc@netlogicmicro.com ([203.92.57.132]) by mx.google.com with ESMTPS id 5sm1368080yxd.71.2010.03.08.00.44.06 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 08 Mar 2010 00:44:08 -0800 (PST) Date: Mon, 8 Mar 2010 14:17:17 +0530 From: "Jayachandran C." To: sobomax@freebsd.org Message-ID: <4b94b8d8.c501be0a.4ce5.760a@mx.google.com> References: <98a59be81003040504x6e97fbaeqeb10f8ea7bedb7b9@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <98a59be81003040504x6e97fbaeqeb10f8ea7bedb7b9@mail.gmail.com> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: FreeBSD Current Subject: newfs broken in -CURRENT after 204654 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2010 08:44:09 -0000 On Thu, Mar 04, 2010 at 06:34:03PM +0530, C. Jayachandran wrote: > I'm testing this on the mips platform, but I think there is an issue > with change that made sectorsize int64_t, because the ioctl > DIOCGSECTORSIZE used to read sector size seems to take u_int. This > quick change fixes it for me (sample patch - may be whitespace > damaged). I'm trying this one more time, since the issue is still unresolved. newfs(8) broke for big-endian systems since revision 204654. This change made sectorsize variable int64_t, and now it cannot be passed to the ioctl DIOCGSECTORSIZE. The patch below (updated from the previous one) fixes it, please review and apply if correct. Thanks, JC. Index: sbin/newfs/newfs.c =================================================================== --- sbin/newfs/newfs.c (revision 204701) +++ sbin/newfs/newfs.c (working copy) @@ -132,6 +132,7 @@ char *cp, *special; intmax_t reserved; int ch, i, rval; + u_int tsecsize; off_t mediasize; char part_name; /* partition name, default to full disk */ @@ -327,9 +328,12 @@ mediasize = st.st_size; /* set fssize from the partition */ } else { - if (sectorsize == 0) - if (ioctl(disk.d_fd, DIOCGSECTORSIZE, §orsize) == -1) + if (sectorsize == 0) { + if (ioctl(disk.d_fd, DIOCGSECTORSIZE, &tsecsize) == -1) sectorsize = 0; /* back out on error for safety */ + else + sectorsize = tsecsize; + } if (sectorsize && ioctl(disk.d_fd, DIOCGMEDIASIZE, &mediasize) != -1) getfssize(&fssize, special, mediasize / sectorsize, reserved); }