fsck_ffs DIOCGINFO ioctl?
Naeem Afzal
naeem_jarral at yahoo.com
Sun Nov 22 04:14:42 UTC 2009
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 }
More information about the freebsd-questions
mailing list