From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1KZXgm-0001L7-DV for mharc-grub-devel@gnu.org; Sat, 30 Aug 2008 17:08:56 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KZXgk-0001JP-WA for grub-devel@gnu.org; Sat, 30 Aug 2008 17:08:55 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KZXgj-0001Hp-Gd for grub-devel@gnu.org; Sat, 30 Aug 2008 17:08:54 -0400 Received: from [199.232.76.173] (port=46291 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KZXgj-0001HY-8d for grub-devel@gnu.org; Sat, 30 Aug 2008 17:08:53 -0400 Received: from moutng.kundenserver.de ([212.227.126.188]:53852) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KZXgi-0000zl-V9 for grub-devel@gnu.org; Sat, 30 Aug 2008 17:08:53 -0400 Received: from [85.180.38.25] (e180038025.adsl.alicedsl.de [85.180.38.25]) by mrelayeu.kundenserver.de (node=mrelayeu8) with ESMTP (Nemesis) id 0ML31I-1KZXgh15JL-0002P2; Sat, 30 Aug 2008 23:08:51 +0200 From: Felix Zielcke To: The development of GRUB 2 In-Reply-To: <1220127336.21696.30.camel@fz.local> References: <1220127336.21696.30.camel@fz.local> Content-Type: multipart/mixed; boundary="=-kfqxsxVnV+6fcMAyNCMB" Date: Sat, 30 Aug 2008 23:08:50 +0200 Message-Id: <1220130530.21696.36.camel@fz.local> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 X-Provags-ID: V01U2FsdGVkX1+PoVLTNnSz+EM3rNblvcJ16BU+6/xttlCoiZ+ ULLykFJDREjgxe0onpjvgDGT+DfYYIRbubgBJxWd/pEO3E8z+7 /PAQ0Gwg3NmqjukBst0ZR/4iINKGXNw X-detected-kernel: by monty-python.gnu.org: Linux 2.6? (barebone, rare!) Subject: Re: [PATCH] iso9660 UUID support by using the creation date/time X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Aug 2008 21:08:55 -0000 --=-kfqxsxVnV+6fcMAyNCMB Content-Type: text/plain Content-Transfer-Encoding: 7bit Am Samstag, den 30.08.2008, 22:15 +0200 schrieb Felix Zielcke: > Here's a patch which implements UUID support for the iso9660 filesystem, > by using the creation date in the `superblock'. > The specs say that it's allowed to contain only zeros but I think this > shouldn't be a big problem. I just got another idea, make GCC warnings more visible. It did work fine with grub-emu and the CD I tested with. I have removed now the offset, grub_sprintf doestn't support %hhu format, and as far as I understand it's stored like a normal `signed int' just with 8bit size i.e. `signed char' but not a ASCII digit. Without it, it should be still unique enough. So better try it out with this attached one :) -- Felix Zielcke --=-kfqxsxVnV+6fcMAyNCMB Content-Disposition: attachment; filename=iso9660_uuid2.patch Content-Type: text/x-patch; name=iso9660_uuid2.patch; charset=UTF-8 Content-Transfer-Encoding: 7bit 2008-08-30 Felix Zielcke * fs/iso9660.c (grub_iso9660_date): New structure. (grub_iso9660_primary_voldesc): Add `grub_iso9660_date' member. (grub_iso9660_uuid): New function. Index: fs/iso9660.c =================================================================== --- fs/iso9660.c (Revision 1836) +++ fs/iso9660.c (Arbeitskopie) @@ -67,6 +67,18 @@ struct grub_iso9660_dir grub_uint8_t namelen; } __attribute__ ((packed)); +struct grub_iso9660_date +{ + grub_uint8_t year[4]; + grub_uint8_t month[2]; + grub_uint8_t day[2]; + grub_uint8_t hour[2]; + grub_uint8_t minute[2]; + grub_uint8_t second[2]; + grub_uint8_t hundredth[2]; + grub_uint8_t offset; +}__attribute__ ((packed)); + /* The primary volume descriptor. Only little endian is used. */ struct grub_iso9660_primary_voldesc { @@ -81,6 +93,8 @@ struct grub_iso9660_primary_voldesc grub_uint32_t path_table; grub_uint8_t unused5[12]; struct grub_iso9660_dir rootdir; + grub_uint8_t unused6[641]; + struct grub_iso9660_date created; } __attribute__ ((packed)); /* A single entry in the path table. */ @@ -812,8 +826,44 @@ grub_iso9660_label (grub_device_t device return grub_errno; } - +static grub_err_t +grub_iso9660_uuid (grub_device_t device, char **uuid) +{ + struct grub_iso9660_data *data; + grub_disk_t disk = device->disk; + +#ifndef GRUB_UTIL + grub_dl_ref (my_mod); +#endif + + data = grub_iso9660_mount (disk); + if (data) + { + *uuid = grub_malloc (sizeof ("xxxxxxxxxxxxxxxx") + sizeof ('\0')); + grub_sprintf (*uuid, "%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c", + data->voldesc.created.year[0], data->voldesc.created.year[1], + data->voldesc.created.year[2], data->voldesc.created.year[3], + data->voldesc.created.month[0], data->voldesc.created.month[1], + data->voldesc.created.day[0], data->voldesc.created.day[1], + data->voldesc.created.hour[0], data->voldesc.created.hour[1], + data->voldesc.created.minute[0], data->voldesc.created.minute[1], + data->voldesc.created.second[0], data->voldesc.created.second[1], + data->voldesc.created.hundredth[0], data->voldesc.created.hundredth[1]) + } + else + *uuid = NULL; + +#ifndef GRUB_UTIL + grub_dl_unref (my_mod); +#endif + + grub_free (data); + + return grub_errno; +} + + static struct grub_fs grub_iso9660_fs = { .name = "iso9660", @@ -822,6 +872,7 @@ static struct grub_fs grub_iso9660_fs = .read = grub_iso9660_read, .close = grub_iso9660_close, .label = grub_iso9660_label, + .uuid = grub_iso9660_uuid, .next = 0 }; --=-kfqxsxVnV+6fcMAyNCMB--