From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1KZWrQ-0000Jy-VB for mharc-grub-devel@gnu.org; Sat, 30 Aug 2008 16:15:53 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KZWrP-0000IL-OY for grub-devel@gnu.org; Sat, 30 Aug 2008 16:15:51 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KZWrN-0000Fa-EH for grub-devel@gnu.org; Sat, 30 Aug 2008 16:15:50 -0400 Received: from [199.232.76.173] (port=53780 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KZWrN-0000FX-95 for grub-devel@gnu.org; Sat, 30 Aug 2008 16:15:49 -0400 Received: from moutng.kundenserver.de ([212.227.126.187]:58692) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KZWrM-00026E-VT for grub-devel@gnu.org; Sat, 30 Aug 2008 16:15:49 -0400 Received: from [85.180.38.25] (e180038025.adsl.alicedsl.de [85.180.38.25]) by mrelayeu.kundenserver.de (node=mrelayeu3) with ESMTP (Nemesis) id 0MKxQS-1KZWrB0vhQ-0000V0; Sat, 30 Aug 2008 22:15:37 +0200 From: Felix Zielcke To: The development of GRUB 2 Content-Type: multipart/mixed; boundary="=-8ym/O+JJ69mFiGL2tb6t" Date: Sat, 30 Aug 2008 22:15:36 +0200 Message-Id: <1220127336.21696.30.camel@fz.local> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 X-Provags-ID: V01U2FsdGVkX19llnpLeTspSZ/uVDfk/TheYVkE6uRaNtv52IH 0PsGBC7iPIfG3I4b7pPX3vVdCKyiNX1b1O067n6x/poG6sJIFa GxRYWfxe3xHt5ZLLakxisPoecF29RvU X-detected-kernel: by monty-python.gnu.org: Linux 2.6? (barebone, rare!) Subject: [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 20:15:52 -0000 --=-8ym/O+JJ69mFiGL2tb6t Content-Type: text/plain Content-Transfer-Encoding: 7bit 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. -- Felix Zielcke --=-8ym/O+JJ69mFiGL2tb6t Content-Disposition: attachment; filename=iso9660_uuid.patch Content-Type: text/x-patch; name=iso9660_uuid.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 `struct 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,45 @@ 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 (struct grub_iso9660_date) + sizeof ('\0')); + grub_sprintf (*uuid, "%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%02u", + 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[2], + data->voldesc.created.hundredth[0], data->voldesc.created.hundredth[1], + data->voldesc.created.offset); + } + 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 +873,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 }; Index: config.h.in =================================================================== --- config.h.in (Revision 1836) +++ config.h.in (Arbeitskopie) @@ -109,17 +109,48 @@ /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS -/* Define to 1 if your processor stores words with the most significant byte - first (like Motorola and SPARC, unlike Intel and VAX). */ -#undef WORDS_BIGENDIAN +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel and VAX). */ +#if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +#elif ! defined __LITTLE_ENDIAN__ +# undef WORDS_BIGENDIAN +#endif /* Number of bits in a file offset, on hosts where this is settable. */ #undef _FILE_OFFSET_BITS +/* Define for large files, on AIX-style hosts. */ +#undef _LARGE_FILES + +/* Define to 1 if on MINIX. */ +#undef _MINIX + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +#undef _POSIX_1_SOURCE + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +#undef _POSIX_SOURCE + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # undef _GNU_SOURCE #endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# undef _POSIX_PTHREAD_SEMANTICS +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# undef _TANDEM_SOURCE +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# undef __EXTENSIONS__ +#endif -/* Define for large files, on AIX-style hosts. */ -#undef _LARGE_FILES --=-8ym/O+JJ69mFiGL2tb6t--