From owner-freebsd-questions@FreeBSD.ORG Sun Nov 22 04:14:42 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D4ED5106566B for ; Sun, 22 Nov 2009 04:14:42 +0000 (UTC) (envelope-from naeem_jarral@yahoo.com) Received: from web81104.mail.mud.yahoo.com (web81104.mail.mud.yahoo.com [68.142.199.96]) by mx1.freebsd.org (Postfix) with SMTP id 962BE8FC08 for ; Sun, 22 Nov 2009 04:14:42 +0000 (UTC) Received: (qmail 47712 invoked by uid 60001); 22 Nov 2009 03:48:02 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1258861682; bh=NL85M6t5UC5tBDW+s9Q1g2hscX7U/n8j4Qj35BVcYyU=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type; b=4hJ6RxNhNftnGS2dsYpYxuOM7nzVaAH2B1kqtbOcDZbZHsS+ZU7sxTLwZYMb4egfiq1/olIqWxhuIwVGhvjCMyPXYyiD/bAt8Lb1ScxlB+cPbIbPskFZpVO0sEMiIP6XqBTSaGZYXUv8PuNa3TZyrQ1hl1YgcUzXbtEpfbJQp94= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type; b=1QuOWq8KnDy2I8JCJeu3/OBJdbHP7KA6Tcg9KgtutLHVwl98iYCJYeQ8+iqczxysjYjIUpla4CruZyZfR6aneeM31xFbt9uhL4mPbV4vRcKU9853IkISOZM0ce4As9NPhMSLhJ6jdj3jJTv2fHb7iyHyNHgFQlHuTQ+qhOKOYZw=; Message-ID: <500098.47043.qm@web81104.mail.mud.yahoo.com> X-YMail-OSG: 6k27rs4VM1lZ_EKkfTaUi8GQJuV3wXEDtnpYgdVp39g9Y21OLL2qFhsU811uACTvbmAY9pzWlfZ9Ner8yxQ7RU_K9VsW1bnEE59SorCi0HPnvoA49MgdwJoRCCOLHNSw8l9jF9jlaZ2oh9aWYYRB0OhU9rL1skVK1LDDuZIv06NNF2BjRL4HLGo3yxDKANIv4k9VTz1DKGNifg3UC5MgAqPxJ9_Ppbfg2AbOCNpu2p_uQnk0NwF2f5Cw9VI4FNN8dBQTo31cwhlUdSQztCWTAwhdg_tiGVdl7Jj6FJwU Received: from [192.55.54.38] by web81104.mail.mud.yahoo.com via HTTP; Sat, 21 Nov 2009 19:48:02 PST X-Mailer: YahooMailRC/211.6 YahooMailWebService/0.8.100.260964 Date: Sat, 21 Nov 2009 19:48:02 -0800 (PST) From: Naeem Afzal To: freebsd-questions@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: fsck_ffs DIOCGINFO ioctl? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Nov 2009 04:14:42 -0000 I am not sure how this ioctl (DIOCGDINFO) in fsck_ffs/setup.c is returned from kernel. Seems like there is only one place in sys/geom/geom_bsd.c, I have enabled GEOM_BSD option in config file, but not able to see it. Could someone point out how this ioctl is returned from kernel? I see it is returning -1 from somewhere, so cannot be this place in geom_bsd.c, then where from? thanks naeem .... sys/geom/geom_bsd.c ......... static int g_bsd_ioctl(struct g_provider *pp, u_long cmd, void *data, int fflag, struct thread *td) { struct g_geom *gp; struct g_bsd_softc *ms; struct g_slicer *gsp; u_char *label; int error; gp = pp->geom; gsp = gp->softc; ms = gsp->softc; switch(cmd) { case DIOCGDINFO: /* Return a copy of the disklabel to userland. */ bsd_disklabel_le_dec(ms->label, data, MAXPARTITIONS); printf(">>>>>>> DIOCGDINFO <<<<<<<<<<<\n"); return(0); case DIOCBSDBB: { ------ -------- sbin/fsck_ffs/setup.c: static struct disklabel * 692 getdisklabel(char *s, int fd) 693 { 694 static struct disklabel lab; 695 696 if (ioctl(fd, DIOCGDINFO, (char *)&lab) < 0) { 697 if (s == NULL) 698 return (NULL); 699 pwarn("ioctl (GCINFO): %s\n", strerror(errno)); 700 errexit("%s: can't read disk label\n", s); 701 } 702 return (&lab); 703 }