grub-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] fix disk->id abuse


From: Robert Millan
Subject: Re: [PATCH] fix disk->id abuse
Date: Tue, 2 Sep 2008 21:24:25 +0200
User-agent: Mutt/1.5.13 (2006-08-11)

On Tue, Sep 02, 2008 at 09:12:04PM +0200, Christian Franke wrote:
> 
> If disk->id is supposed to be a GUID ('Grub Unique Identifier' in this 
> case :-), then a pointer to the private data structure for the disk 
> should work. This id is unique until disk close.
> 
> For drivers without disk->data, simply use the address of e.g. the open 
> function itself.

This is fine for single-disk drivers, but for multi-disk ones we need it to
be unique among different disks provided by the same driver.

Although, of course, I don't see why can't we just make it use a pointer to
itself:

  disk->id = (unsigned long) &disk->id;

but then what's the point of storing that in a variable anyway.  We might as
well just remove this variable and whoever uses it can use a pointer to the
structure instead?

This works on the assumption that disk structures are never reallocated, but
I suppose that's a sane thing to assume...

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."




reply via email to

[Prev in Thread] Current Thread [Next in Thread]