Date: Sat, 21 Nov 2009 19:48:02 -0800 (PST) From: Naeem Afzal <naeem_jarral@yahoo.com> To: freebsd-questions@freebsd.org Subject: fsck_ffs DIOCGINFO ioctl? Message-ID: <500098.47043.qm@web81104.mail.mud.yahoo.com>
next in thread | raw e-mail | index | archive | help
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 }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?500098.47043.qm>