Re: [PATCH 6/6] block: Add n64 cart driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 4 Jan 2021 07:49:02 -0800
Keith Busch <kbusch@xxxxxxxxxx> wrote:

> On Mon, Jan 04, 2021 at 03:50:31PM +0200, Lauri Kasanen wrote:
> > block folks: rest of the series is on linux-mips. Being a mips-specific driver,
> > not sure which tree it should go to.
>
> Probably through mips.

Thanks.

> > +static blk_status_t get_seg(struct request *req)
> > +{
> > +	u32 bstart = blk_rq_pos(req) * 512;
> > +	u32 len = blk_rq_cur_bytes(req);
> > +	void *dst = bio_data(req->bio);
> > +
> > +	if (bstart + len > size || rq_data_dir(req) == WRITE)
> > +		return BLK_STS_IOERR;
>
> If you don't support writes (is that limitation temporary?), then you
> can prevent such operations from reaching the driver by setting the
> "disk" to read-only during initialization with set_disk_ro(disk, true).

The media is read-only (but not runtime removable).

> > +static int __init n64cart_init(void)
> > +{
> > +	int err;
> > +
> > +	if (!start || !size) {
> > +		pr_err("n64cart: start and size not specified\n");
> > +		return -ENODEV;
> > +	}
>
> Just curious, is it not possible to discover these values from the
> installed cart? Requiring module parameters seems a bit fragile.

No, it's not possible. Even the cart's size is not discoverable, and
where the disk image starts and how long it is could only be scanned if
you knew in advance what FS what used, etc. There is no FS on the cart
itself, it's just raw data.

The bootloader embeds these values into itself when it's built.

- Lauri




[Index of Archives]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux