From: Christoph Hellwig <hch@infradead.org>
To: Osamu Tomita <tomita@cinet.co.jp>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: Re: [PATCH] PC-9800 subarch. support for 2.5.62-AC1 (6/21) FS & partiton
Date: Sun, 23 Feb 2003 10:29:37 +0000 [thread overview]
Message-ID: <20030223102937.A15963@infradead.org> (raw)
In-Reply-To: <20030223094325.GG1324@yuzuki.cinet.co.jp>; from tomita@cinet.co.jp on Sun, Feb 23, 2003 at 06:43:25PM +0900
On Sun, Feb 23, 2003 at 06:43:25PM +0900, Osamu Tomita wrote:
> - if (FAT_FIRST_ENT(sb, media) != first) {
> + if (FAT_FIRST_ENT(sb, media) != first
> + && (!pc98 || media != 0xf8 || (first & 0xff) != 0xfe))
> + {
I think this should be made unconditionally. There's no reason why
non-pc98 linux machines shouldn't read fat filesystems created on pc98.
> +/* #ifdef CONFIG_BLK_DEV_IDEDISK */
> +#include <linux/ide.h>
> +/* #endif */
> +
> +/* #ifdef CONFIG_BLK_DEV_SD */
> +#include "../../drivers/scsi/scsi.h"
> +#include "../../drivers/scsi/hosts.h"
> +#include <scsi/scsicam.h>
> +/* #endif */
this is really ugly..
> + int g_head, g_sect;
> + Sector sect;
> + const struct nec98_partition *part;
> + unsigned char *data;
> + int sector_size = bdev_hardsect_size(bdev);
> + int major = major(to_kdev_t(bdev->bd_dev));
> + int minor = minor(to_kdev_t(bdev->bd_dev));
use MAJOR/MINOR here.
> +
> + switch (major) {
> +#if defined CONFIG_BLK_DEV_HD_ONLY
> + case HD_MAJOR:
> + {
> + extern struct hd_i_struct hd_info[2];
> +
> + g_head = hd_info[minor >> 6].head;
> + g_sect = hd_info[minor >> 6].sect;
> + break;
> + }
> +#endif /* CONFIG_BLK_DEV_HD_ONLY */
> +#if defined CONFIG_BLK_DEV_SD || defined CONFIG_BLK_DEV_SD_MODULE
> + case SCSI_DISK0_MAJOR:
> + case SCSI_DISK1_MAJOR:
> + case SCSI_DISK2_MAJOR:
> + case SCSI_DISK3_MAJOR:
> + case SCSI_DISK4_MAJOR:
> + case SCSI_DISK5_MAJOR:
> + case SCSI_DISK6_MAJOR:
> + case SCSI_DISK7_MAJOR:
> + {
> + int diskinfo[3] = { 0, 0, 0 };
> +
> + pc98_bios_param(bdev, diskinfo);
> +
> + if ((g_head = diskinfo[0]) <= 0)
> + g_head = 8;
> + if ((g_sect = diskinfo[1]) <= 0)
> + g_sect = 17;
> + break;
> + }
> +#endif /* CONFIG_BLK_DEV_SD(_MODULE) */
> +#if defined CONFIG_BLK_DEV_IDEDISK || defined CONFIG_BLK_DEV_IDEDISK_MODULE
> + case IDE0_MAJOR:
> + case IDE1_MAJOR:
> + case IDE2_MAJOR:
> + case IDE3_MAJOR:
> + case IDE4_MAJOR:
> + case IDE5_MAJOR:
> + case IDE6_MAJOR:
> + case IDE7_MAJOR:
> + case IDE8_MAJOR:
> + case IDE9_MAJOR:
> + {
> + ide_drive_t *drive;
> + unsigned int h;
> +
> + for (h = 0; h < MAX_HWIFS; ++h) {
> + ide_hwif_t *hwif = &ide_hwifs[h];
> + if (hwif->present && major == hwif->major) {
> + unsigned unit = minor >> PARTN_BITS;
> + if (unit < MAX_DRIVES) {
> + drive = &hwif->drives[unit];
> + if (drive->present) {
> + g_head = drive->head;
> + g_sect = drive->sect;
> + goto found;
> + }
> + }
> + break;
> + }
> + }
> + }
> +#endif /* CONFIG_BLK_DEV_IDEDISK(_MODULE) */
> + default:
> + printk(" unsupported disk (major = %u)\n", major);
> + return 0;
> + }
This is horribly ugly. Just do an inkernel ioctl instead. Something
like the following (untested!):
struct hd_geometry geo;
int err;
err = ioctl_by_bdev(bdev, HDIO_GETGEO, &geo);
if (err)
return err;
g_head = geo.heads;
g_sect = geo.sectors;
next prev parent reply other threads:[~2003-02-23 10:19 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-02-23 9:21 [PATCH] PC-9800 subarch. support for 2.5.62-AC1 (0/21) summary Osamu Tomita
2003-02-23 9:34 ` [PATCH] PC-9800 subarch. support for 2.5.62-AC1 (1/21) ALSA Osamu Tomita
2003-02-23 9:36 ` [PATCH] PC-9800 subarch. support for 2.5.62-AC1 (2/21) APM Osamu Tomita
2003-02-23 9:38 ` [PATCH] PC-9800 subarch. support for 2.5.62-AC1 (3/21) console Osamu Tomita
2003-02-23 9:40 ` [PATCH] PC-9800 subarch. support for 2.5.62-AC1 (4/21) Misc core Osamu Tomita
2003-02-23 9:41 ` [PATCH] PC-9800 subarch. support for 2.5.62-AC1 (5/21) DMA Osamu Tomita
2003-02-23 9:43 ` [PATCH] PC-9800 subarch. support for 2.5.62-AC1 (6/21) FS & partiton Osamu Tomita
2003-02-23 10:29 ` Christoph Hellwig [this message]
2003-02-23 10:45 ` Osamu Tomita
2003-02-24 14:05 ` Osamu Tomita
2003-02-24 14:16 ` Christoph Hellwig
2003-02-23 10:47 ` John Bradford
2003-02-23 9:44 ` [PATCH] PC-9800 subarch. support for 2.5.62-AC1 (7/21) IDE Osamu Tomita
2003-02-23 9:46 ` [PATCH] PC-9800 subarch. support for 2.5.62-AC1 (8/21) kanji Osamu Tomita
2003-02-23 9:47 ` [PATCH] PC-9800 subarch. support for 2.5.62-AC1 (9/21) kconfig Osamu Tomita
2003-02-23 9:48 ` [PATCH] PC-9800 subarch. support for 2.5.62-AC1 (10/21) NIC Osamu Tomita
2003-02-23 9:50 ` [PATCH] PC-9800 subarch. support for 2.5.62-AC1 (11/21) parport Osamu Tomita
2003-02-23 9:51 ` [PATCH] PC-9800 subarch. support for 2.5.62-AC1 (12/21) PCI Osamu Tomita
2003-02-23 9:52 ` [PATCH] PC-9800 subarch. support for 2.5.62-AC1 (13/21) PCMCIA Osamu Tomita
2003-02-23 9:53 ` [PATCH] PC-9800 subarch. support for 2.5.62-AC1 (14/21) PNP Osamu Tomita
2003-02-23 9:54 ` [PATCH] PC-9800 subarch. support for 2.5.62-AC1 (15/21) RTC Osamu Tomita
2003-02-23 9:55 ` [PATCH] PC-9800 subarch. support for 2.5.62-AC1 (16/21) SCSI Osamu Tomita
2003-02-23 10:52 ` Christoph Hellwig
2003-02-23 9:56 ` [PATCH] PC-9800 subarch. support for 2.5.62-AC1 (17/21) serial Osamu Tomita
2003-02-23 9:57 ` [PATCH] PC-9800 subarch. support for 2.5.62-AC1 (18/21) setup Osamu Tomita
2003-02-23 9:58 ` [PATCH] PC-9800 subarch. support for 2.5.62-AC1 (19/21) SMP Osamu Tomita
2003-02-23 9:59 ` [PATCH] PC-9800 subarch. support for 2.5.62-AC1 (20/21) timer Osamu Tomita
2003-02-23 10:00 ` [PATCH] PC-9800 subarch. support for 2.5.62-AC1 (21/21) traps Osamu Tomita
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030223102937.A15963@infradead.org \
--to=hch@infradead.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=tomita@cinet.co.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®