Date: Sat, 17 Mar 2012 22:51:58 +0100 From: Pawel Jakub Dawidek <pjd@FreeBSD.org> To: Grzegorz Bernacki <gber@FreeBSD.org> Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r233091 - in projects/nand: sbin/fdisk sys/sys Message-ID: <20120317215156.GJ1340@garage.freebsd.pl> In-Reply-To: <201203171710.q2HHAFiq079651@svn.freebsd.org> References: <201203171710.q2HHAFiq079651@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--fLj60tP2PZ34xyqD Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Mar 17, 2012 at 05:10:15PM +0000, Grzegorz Bernacki wrote: > Author: gber > Date: Sat Mar 17 17:10:14 2012 > New Revision: 233091 > URL: http://svn.freebsd.org/changeset/base/233091 >=20 > Log: > Add ioctl and structures for accessing nand disk devices. Grzegorz, this is really wrong way to do it. Neither geom_dev nor geom_disk are the places to add NAND specific ioctls. The DEV GEOM class will forward unknown ioctl to provider's class. In this case to the DISK class. The DISK class will also forward ioctls to your method. Take a look at the g_disk_ioctl() function. When you configure your disk structure between disk_alloc() and disk_create() you just need to set d_ioctl field to your ioctl method and handle all ioctls specific to your class there. See disk(9) for more info. Ioctl is also the way you should send/receive metadata (eventually BIO_GETATTR) and not to introduce new BIO types that will only be used by one GEOM class. Don't hesitate to discuss this stuff on the freebsd-geom@ mailing list to avoid surprises on the commit day. > Modified: projects/nand/sys/sys/disk.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- projects/nand/sys/sys/disk.h Sat Mar 17 16:40:15 2012 (r233090) > +++ projects/nand/sys/sys/disk.h Sat Mar 17 17:10:14 2012 (r233091) > @@ -116,6 +116,32 @@ void disk_err(struct bio *bp, const char > * This should be a multiple of the sector size. > */ > =20 > +#define DIOCNOOBSIZE _IOR('d', 141, u_int) /* Get oob size */ > + /*- > + * Get the OOB area size of NAND flash device. > + */ > + > +#define DIOCNBLKSIZE _IOR('d', 142, u_int) /* Get block size */ > + /* - > + * Get the block size of NAND flash device. > + */ > + > +struct nand_oob_request { > + off_t offset; /* offset in bytes, page-aligned */ > + off_t length; /* length */ > + void * ubuf; /* buffer supplied by user */ > +}; > + > +#define DIOCNREADOOB _IOW('d', 143, struct nand_oob_request) /* Read OOB= area */ > + /*- > + * Read page OOB area from NAND flash device. > + */ > + > +#define DIOCNWRITEOOB _IOW('d', 144, struct nand_oob_request) /* Write O= OB area */ > + /*- > + * Write page OOB area to NAND flash device. > + */ > + > #define DIOCGPHYSPATH _IOR('d', 141, char[MAXPATHLEN]) > /* > * Get a string defining the physical path for a given provider. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl --fLj60tP2PZ34xyqD Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iEYEARECAAYFAk9lB3sACgkQForvXbEpPzQGvQCePKu0mNHlnnPJxoVlkcA9FgKl p/YAn1mVusRedJQhPiO51UIWgZet2ZNK =zk08 -----END PGP SIGNATURE----- --fLj60tP2PZ34xyqD--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120317215156.GJ1340>