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

Re: [Xen-devel] [PATCH 3/9] pygrub: don't leave fds open



Roger Pau Monne writes ("[PATCH 3/9] pygrub: don't leave fds open"):
> On NetBSD a block device can only be opened once, so make sure pygrub
> closes it every time, if this is not done libfsimage is not able to
> open the disk later.
> 
> Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
> Cc: Christoph Egger <Christoph.Egger@xxxxxxx>
> Signed-off-by: Roger Pau Monne <roger.pau@xxxxxxxxxx>

Looks plausible to me.

Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>

Although:

>      fd = os.open(file, os.O_RDONLY)
>      os.lseek(fd, offset + (DK_LABEL_LOC * SECTOR_SIZE), 0)
>      buf = os.read(fd, 512)
> +    os.close(fd)
...
>      fd = os.open(file, os.O_RDONLY)
>      buf = os.read(fd, 512)
> +    os.close(fd)

These are two remarkably similar bits of code which might deserve a
function.

Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.