Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Jan 2014 15:00:01 GMT
From:      Fahad Ahmed <ahmedatnet@gmail.com>
To:        freebsd-fs@FreeBSD.org
Subject:   Re: kern/167979: [ufs] DIOCGDINFO ioctl does not work on 8.2 file systems
Message-ID:  <201401131500.s0DF01g1051827@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/167979; it has been noted by GNATS.

From: Fahad Ahmed <ahmedatnet@gmail.com>
To: bug-followup@FreeBSD.org,
 spencer_minear@mcafee.com
Cc:  
Subject: Re: kern/167979: [ufs] DIOCGDINFO ioctl does not work on 8.2 file systems
Date: Mon, 13 Jan 2014 06:55:37 -0800

 Bug 167979 states that ioctl(fd, DIOCGDINFO, &dl) fails with error: =
 'Inappropriate ioctl for device'. The reason for failure of ioctl call =
 with DIOCGDINFO option is that Makefile used to build kernel image does =
 not have /usr/src/sys/geom/geom_bsd.c and =
 /usr/src/sys/geom/geom_bsd_enc.c files included in it. When these two =
 files are included in the Makefile and information is added for how to =
 make object files of these files and how to link them with kernel image, =
 DIOCGDINFO option works fine when used with ioctl.
 
 
 
 To add these files in Makefile automatically, "/usr/src/sys/conf/files" =
 has to be changed as follows:
 
 
 # diff -u /usr/src/sys/conf/files_org /usr/src/sys/conf/files
 --- /usr/src/sys/conf/files_org 2012-09-20 23:47:07.000000000 -0700
 +++ /usr/src/sys/conf/files     2012-09-20 23:48:04.000000000 -0700
 @@ -2011,8 +2011,8 @@
  geom/eli/pkcs5v2.c             optional geom_eli
  geom/gate/g_gate.c             optional geom_gate
  geom/geom_aes.c                optional geom_aes
 -geom/geom_bsd.c                optional geom_bsd
 -geom/geom_bsd_enc.c            optional geom_bsd
 +geom/geom_bsd.c                standard
 +geom/geom_bsd_enc.c            standard
  geom/geom_ccd.c                optional ccd | geom_ccd
  geom/geom_ctl.c                standard
  geom/geom_dev.c                standard
 
 
 
 After these changes, automatically generated Makefile will have =
 inclusion of  "/usr/src/sys/geom/geom_bsd.c" and =
 "/usr/src/sys/geom/geom_bsd_enc.c" files.
 =20
 
 
 Difference in Makefile generated by making above changes in =
 "/usr/src/sys/conf/files":
 
 # diff -u Makefile ../BUG_FIX/Makefile | grep geom
 -       pseudofs_fileno.o pseudofs_vncache.o pseudofs_vnops.o geom_ctl.o =
 \
 -       geom_dev.o geom_disk.o geom_dump.o geom_event.o geom_io.o \
 -       geom_kern.o geom_slice.o geom_subr.o geom_vfs.o g_label.o \
 +       pseudofs_fileno.o pseudofs_vncache.o pseudofs_vnops.o geom_bsd.o =
 \
 +       geom_bsd_enc.o geom_ctl.o geom_dev.o geom_disk.o geom_dump.o \
 +       geom_event.o geom_io.o geom_kern.o geom_slice.o geom_subr.o \
 +       geom_vfs.o g_label.o g_label_ext2fs.o g_label_iso9660.o \
 -       $S/fs/pseudofs/pseudofs_vnops.c $S/geom/geom_ctl.c \
 -       $S/geom/geom_dev.c $S/geom/geom_disk.c $S/geom/geom_dump.c \
 -       $S/geom/geom_event.c $S/geom/geom_io.c $S/geom/geom_kern.c \
 -       $S/geom/geom_slice.c $S/geom/geom_subr.c $S/geom/geom_vfs.c \
 -       $S/geom/label/g_label.c $S/geom/label/g_label_ext2fs.c \
 -       $S/geom/label/g_label_iso9660.c $S/geom/label/g_label_msdosfs.c =
 \
 -       $S/geom/label/g_label_ntfs.c $S/geom/label/g_label_reiserfs.c \
 -       $S/geom/label/g_label_ufs.c $S/geom/label/g_label_gpt.c \
 -       $S/geom/part/g_part.c $S/geom/part/g_part_bsd.c \
 -       $S/geom/part/g_part_ebr.c $S/geom/part/g_part_gpt.c \
 -       $S/geom/part/g_part_mbr.c $S/isa/isa_common.c $S/isa/isahint.c \
 +       $S/fs/pseudofs/pseudofs_vnops.c $S/geom/geom_bsd.c \
 +       $S/geom/geom_bsd_enc.c $S/geom/geom_ctl.c $S/geom/geom_dev.c \
 +       $S/geom/geom_disk.c $S/geom/geom_dump.c $S/geom/geom_event.c \
 +       $S/geom/geom_io.c $S/geom/geom_kern.c $S/geom/geom_slice.c \
 +       $S/geom/geom_subr.c $S/geom/geom_vfs.c $S/geom/label/g_label.c \
 +       $S/geom/label/g_label_ext2fs.c $S/geom/label/g_label_iso9660.c \
 +       $S/geom/label/g_label_msdosfs.c $S/geom/label/g_label_ntfs.c \
 +       $S/geom/label/g_label_reiserfs.c $S/geom/label/g_label_ufs.c \
 +       $S/geom/label/g_label_gpt.c $S/geom/part/g_part.c \
 +       $S/geom/part/g_part_bsd.c $S/geom/part/g_part_ebr.c \
 +       $S/geom/part/g_part_gpt.c $S/geom/part/g_part_mbr.c \
 +geom_bsd.ln: $S/geom/geom_bsd.c
 +geom_bsd.o: $S/geom/geom_bsd.c
 +geom_bsd_enc.ln: $S/geom/geom_bsd_enc.c
 +geom_bsd_enc.o: $S/geom/geom_bsd_enc.c
  geom_ctl.ln: $S/geom/geom_ctl.c
 
 
 =20
 Fix was tested on FreeBSD 8.3, with the test program provided with the =
 bug. Following are the results:
 
 Before Fix:
 
 # ./bug ad0s1a
 bug: DIOCGDIFNO failed on 'ad0s1a': Inappropriate ioctl for device
 
 
 # ./bug ad0s1b
 bug: DIOCGDIFNO failed on 'ad0s1b': Inappropriate ioctl for device
 
 
 After Fix:
 
 # ./bug ad0s1a
 Filesystem type 4.2BSD
 
 # ./bug ad0s1b
 Filesystem type swap
 
 
 Fahad Ahmed, Engineer
 Dorr H. Clark, advisor
 COEN 284, Operating Systems Case Study
 Santa Clara University
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201401131500.s0DF01g1051827>