iso9660 UUID support by using the creation date/time
PATCH 1/1 iso9660 UUID support by using the creation date/time
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.
Signature · 1 line
Felix Zielcke
2008-08-30 Felix Zielcke <[email protected]>
* fs/iso9660.c (grub_iso9660_date): New structure. (grub_iso9660_primary_voldesc): Add `struct grub_iso9660_date' member. (grub_iso9660_uuid): New function.
iso9660.c +53 -1
@@ -67,6 +67,18 @@ struct grub_iso9660_dirgrub_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_voldescgrub_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 devicereturn 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 };
config.h.in +36 -5
53 lines not on this page · raw message
Am Samstag, den 30.08.2008, 22:15 +0200 schrieb Felix Zielcke:
Quoted 4 lines
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 :)
Signature · 1 line
Felix Zielcke
2008-08-30 Felix Zielcke <[email protected]>
* fs/iso9660.c (grub_iso9660_date): New structure. (grub_iso9660_primary_voldesc): Add `grub_iso9660_date' member. (grub_iso9660_uuid): New function.
iso9660.c +52 -1
@@ -67,6 +67,18 @@ struct grub_iso9660_dirgrub_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_voldescgrub_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 devicereturn 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 };
Quoted 2 lines · Felix Zielcke
Here's a patch which implements UUID support for the iso9660 filesystem, by using the creation date in the `superblock'.
Nice work :-)
Quoted 2 lines
The specs say that it's allowed to contain only zeros but I think this shouldn't be a big problem.
I think this could indeed be a problem if it leads to collisions. If "all zeroes" is detected, one could rise an error in uuid() function to prevent the caller from taking the value into consideration.
iso9660.c grub_iso9660_label (grub_device_t device · line 853
Quoted 11 lines
iso9660.c +11
-0+ *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);
Since the string contains human-readable information, may I suggest separating it with dashes to make it easier to comprehend?
Signature · 5 lines
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."
Hello list,
Am Sonntag, den 31.08.2008, 15:47 +0200 schrieb Robert Millan:
Quoted 1 line
Nice work :-)
By the way the TAB key on emacs is really nice you even don't need to care about moving the cursor to the beginning of the line :)
Quoted 6 lines
Quoted 2 lines
The specs say that it's allowed to contain only zeros but I think this shouldn't be a big problem.
I think this could indeed be a problem if it leads to collisions. If "all zeroes" is detected, one could rise an error in
uuid()function to prevent the caller from taking the value into consideration.
I have now used grub_error (GRUB_ERR_BAD_NUMBER)
But maybe it would be better to make a new type for this, though I don't have yet an idea how to call it.
Suggestions please :)
Quoted 2 lines
Since the string contains human-readable information, may I suggest separating it with dashes to make it easier to comprehend?
Good idea, I should have done that first that would make it even for me a bit easier. I did it now even more human-readable for the `sizeof ()'
Signature · 1 line
Felix Zielcke
2008-08-31 Felix Zielcke <[email protected]>
* fs/iso9660.c (grub_iso9660_date): New structure. (grub_iso9660_primary_voldesc): Add `grub_iso9660_date' member. (grub_iso9660_uuid): New function.
iso9660.c +67 -1
@@ -67,6 +67,18 @@ struct grub_iso9660_dirgrub_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_voldescgrub_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,59 @@ grub_iso9660_label (grub_device_t devicereturn 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) + { +if (! 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 ]) + { +grub_error (GRUB_ERR_BAD_NUMBER ,"No creation date in filesystem to generate UUID." ); + *uuid =NULL ; + } +else + { + *uuid =grub_malloc (sizeof ("YYYY-MM-DD-HH-mm-ss-hh" ) +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 +887,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 };
Quoted 7 lines · Felix Zielcke
Quoted 6 lines
Quoted 2 lines
The specs say that it's allowed to contain only zeros but I think this shouldn't be a big problem.
I think this could indeed be a problem if it leads to collisions. If "all zeroes" is detected, one could rise an error in
uuid()function to prevent the caller from taking the value into consideration.
Quoted 5 lines
I have now used
grub_error(GRUB_ERR_BAD_NUMBER)But maybe it would be better to make a new type for this, though I don't have yet an idea how to call it.
Suggestions please :)
What about:
* BAD_FS looks the most contextual here, but if the ISO9660 standard
allows filesystems to "lack" the creation date, then they are certainly not "bad", though for the purposes of the uuid function they are - slightly confusing.
* BAD_ARGUMENT as in "the FS you requested to id is not a valid
argument to this function", but this err code is usually applied for the failure of argument precondition checks (non-empty device names, etc.)
* INVALID_COMMAND as in "this command cannot be applied to that FS"
* Or even NOT_IMPLEMENTED_YET as in "we still haven't figured how to id
this FS", but this seems to imply that we will eventually do.
By the way, reviewing BAD_ARGUMENT has reminded me that maybe the function should check whether "uuid" is valid. If not, you don't need to abort the operation, just the malloc and consequent sprintf. If implemented like this in all other FSs, this would be a fast way to check whether or not a particular FS can have an UUID extracted without actually having to get the id itself:
/* ... */
grub_error (GRUB_ERR_BAD_NUMBER, "No creation date in
filesystem to generate UUID.");
if (uuid)
*uuid = NULL;
}
else
{
if (uuid)
{
*uuid = /* ... */-Habbit
Am Sonntag, den 31.08.2008, 17:06 +0200 schrieb Javier Martín:
Hello Javier,
Quoted 5 lines · Felix Zielcke
Quoted 4 lines
But maybe it would be better to make a new type for this, though I don't have yet an idea how to call it.
Suggestions please :)
Quoted 11 lines
What about:
*BAD_FSlooks the most contextual here, but if the ISO9660 standard
allows filesystems to "lack" the creation date, then they are certainly not "bad", though for the purposes of the uuid function they are - slightly confusing.
*BAD_ARGUMENTas in "the FS you requested to id is not a valid
argument to this function", but this err code is usually applied for the failure of argument precondition checks (non-empty device names, etc.)
*INVALID_COMMANDas in "this command cannot be applied to that FS"
* Or evenNOT_IMPLEMENTED_YETas in "we still haven't figured how to id
this FS", but this seems to imply that we will eventually do.
Yep not really easy to find a correct one, but luckly not that important on grub2's sourcecode the values aren't that often exactly checked as far as I could see.
This is probable just about `coding style'
Well let's see and wait.
Quoted 6 lines
By the way, reviewing
BAD_ARGUMENThas reminded me that maybe the function should check whether "uuid" is valid. If not, you don't need to abort the operation, just the malloc and consequent sprintf. If implemented like this in all other FSs, this would be a fast way to check whether or not a particular FS can have an UUID extracted without actually having to get the id itself:
Actually it is currently in a fast way implemented.
iso9660 filesystem currently doestn't have any UUID function at all, because it doestn't have one strictly speaking.
For normal filesystems if the specs say they have an UUID field they normally always should have one.
But the problem with iso9660 is that the specs say that the creation date which I use can be just zeros.
I tend now too like Robert that no UUID for iso9660 + printing an error might be better then an UUID containing just zeros.
util/grub-probe.c
if (! fs->uuid)
grub_util_error ("%s does not support UUIDs", fs->name);
fs->uuid (dev, &uuid);For example fs/cpio.c still has no uuid function at all :)
Signature · 1 line
Felix Zielcke
Some more things I overlooked..
iso9660.c struct grub_iso9660_dir · line 80
Quoted 11 lines · Felix Zielcke
iso9660.c +11
-0+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));
^
Please add a space here
iso9660.c grub_iso9660_label (grub_device_t device · line 815
Quoted 5 lines
iso9660.c +0
-1@@ -812,8 +826,59 @@ grub_iso9660_label (grub_device_t devicereturn grub_errno; } -
Please don't remove the ^Ls.
Signature · 5 lines
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."
Am Sonntag, den 31.08.2008, 18:56 +0200 schrieb Robert Millan:
Quoted 6 lines
Some more things I overlooked..
Quoted 1 line
+}__attribute__ ((packed));
^Please add a space here
Right.
Quoted 7 lines
Review grub_iso9660_label (grub_device_t device · line 815
Quoted 5 lines
(quoted diff) +0
-1@@ -812,8 +826,59 @@ grub_iso9660_label (grub_device_t device return grub_errno; } -Please don't remove the ^Ls.
It was moved to down, but I forgot an empty line so diff choose to - and + it. Fixed now in the attached one it's only once shown now without - or + :)
Bean hopefully comments on this too because he did the iso9660 module. I leaved now the errno to BAD_NUMBER.
Signature · 1 line
Felix Zielcke
2008-08-31 Felix Zielcke <[email protected]>
* fs/iso9660.c (grub_iso9660_date): New structure. (grub_iso9660_primary_voldesc): Add `grub_iso9660_date' member. (grub_iso9660_uuid): New function.
iso9660.c +67 -0
@@ -67,6 +67,18 @@ struct grub_iso9660_dirgrub_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_voldescgrub_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,6 +826,58 @@ grub_iso9660_label (grub_device_t devicereturn 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) + { +if (! 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 ]) + { +grub_error (GRUB_ERR_BAD_NUMBER ,"No creation date in filesystem to generate UUID." ); + *uuid =NULL ; + } +else + { + *uuid =grub_malloc (sizeof ("YYYY-MM-DD-HH-mm-ss-hh" ) +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 =
@@ -822,6 +888,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 };
Review
Quoted 1 line · Felix Zielcke
(quoted diff) +1
-0+ *uuid = grub_malloc (sizeof ("YYYY-MM-DD-HH-mm-ss-hh")
Lovely :-)
Quoted 1 line
+ sizeof ('\0'));
Is this really needed? sizeof("foo") implicitly includes the trailing \0.
Signature · 5 lines
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."
Am Sonntag, den 31.08.2008, 20:40 +0200 schrieb Robert Millan:
Quoted 8 lines · Felix Zielcke
Review
Quoted 1 line
(quoted diff) +1
-0+ *uuid = grub_malloc (sizeof ("YYYY-MM-DD-HH-mm-ss-hh")Lovely :-)
Quoted 1 line
+ sizeof ('\0'));
Is this really needed?
sizeof("foo")implicitly includes the trailing \0.
Args, I'm blind :(
I copied the function from fs/ntfs.c and there it says `grub_malloc 16 + sizeof (\0)' With "" it's useless so .5 attached so it doestn't get lost :)
Signature · 1 line
Felix Zielcke
2008-08-31 Felix Zielcke <[email protected]>
* fs/iso9660.c (grub_iso9660_date): New structure. (grub_iso9660_primary_voldesc): Add `grub_iso9660_date' member. (grub_iso9660_uuid): New function.
iso9660.c +67 -0
@@ -67,6 +67,18 @@ struct grub_iso9660_dirgrub_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_voldescgrub_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,6 +826,58 @@ grub_iso9660_label (grub_device_t devicereturn 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) + { +if (! 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 ]) + { +grub_error (GRUB_ERR_BAD_NUMBER ,"No creation date in filesystem to generate UUID." ); + *uuid =NULL ; + } +else + { + *uuid =grub_malloc (sizeof ("YYYY-MM-DD-HH-mm-ss-hh" )); +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 =
@@ -822,6 +888,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 };
Am Sonntag, den 31.08.2008, 20:55 +0200 schrieb Felix Zielcke:
Quoted 3 lines
Args, I'm blind :(
I copied the function fromfs/ntfs.cand there it says `grub_malloc 16 + sizeof (\0)' With "" it's useless so .5 attached so it doestn't get lost :)
Bean did only the joliet support and he already said it looks okay. But Marco I'd like to have your comment because you initially coded the iso9660 support :)
Quoted 9 lines · Felix Zielcke
Am Sonntag, den 31.08.2008, 20:55 +0200 schrieb Felix Zielcke:
Quoted 3 lines
Args, I'm blind :(
I copied the function fromfs/ntfs.cand there it says `grub_malloc 16 + sizeof (\0)' With "" it's useless so .5 attached so it doestn't get lost :)Bean did only the joliet support and he already said it looks okay. But Marco I'd like to have your comment because you initially coded the iso9660 support :)
The patch is completely non-intrusive, and nobody had objections or other comments for a while. I think it's fine if you check it in.
Signature · 5 lines
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."
Am Samstag, den 06.09.2008, 13:11 +0200 schrieb Robert Millan:
Quoted 7 lines · Felix Zielcke
Quoted 3 lines
Bean did only the joliet support and he already said it looks okay. But Marco I'd like to have your comment because you initially coded the iso9660 support :)
The patch is completely non-intrusive, and nobody had objections or other comments for a while. I think it's fine if you check it in.
Thanks Robert commited :)