wok-current annotate syslinux/stuff/extra/iso9660.u @ rev 23831
syslinux/iso2exe: fix loram case
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sun May 31 14:59:28 2020 +0000 (2020-05-31) |
parents | 3f48e3a93cd7 |
children |
rev | line source |
---|---|
pascal@13747 | 1 --- core/fs/iso9660/iso9660.c |
pascal@13747 | 2 +++ core/fs/iso9660/iso9660.c |
pascal@17156 | 3 @@ -89,6 +89,24 @@ |
pascal@17156 | 4 return true; |
pascal@17156 | 5 } |
pascal@17156 | 6 |
pascal@17156 | 7 +#define __ROCKRIDGE |
pascal@17156 | 8 +#ifdef __ROCKRIDGE |
pascal@17156 | 9 +static size_t rockname(const struct iso_dir_entry *de, char **name) |
pascal@17156 | 10 +{ |
pascal@17156 | 11 + size_t len, delen, n = (de->name_len + 34) & -2; |
pascal@17156 | 12 + char *data = (char *) de; |
pascal@17156 | 13 + |
pascal@17156 | 14 + for (delen = 0; n + 2 < de->length; n += len) { |
pascal@17156 | 15 + len = data[n + 2]; |
pascal@17156 | 16 + if (* (short *) (data + n) == 0x4D4E) { /* NM */ |
pascal@17156 | 17 + *name = data + n + 5; |
pascal@17156 | 18 + delen = len - 5; |
pascal@17156 | 19 + } |
pascal@17156 | 20 + } |
pascal@17156 | 21 + return delen; |
pascal@17156 | 22 +} |
pascal@17156 | 23 +#endif |
pascal@17156 | 24 + |
pascal@17156 | 25 /* |
pascal@17156 | 26 * Find a entry in the specified dir with name _dname_. |
pascal@17156 | 27 */ |
pascal@17156 | 28 @@ -132,6 +150,20 @@ |
pascal@13747 | 29 |
pascal@13747 | 30 de_name_len = de->name_len; |
pascal@13747 | 31 de_name = de->name; |
pascal@13747 | 32 +#ifdef __ROCKRIDGE |
pascal@13747 | 33 + { |
pascal@17156 | 34 + char *name; |
pascal@17156 | 35 + size_t len = rockname(de, &name); |
pascal@17156 | 36 + |
pascal@17156 | 37 + if (len) { |
pascal@17156 | 38 + name[len] = 0; |
pascal@13747 | 39 + if (!strcmp(name, dname)) { |
pascal@13747 | 40 + dprintf("Found rockridge.\n"); |
pascal@13747 | 41 + return de; |
pascal@13747 | 42 + } |
pascal@13747 | 43 + } |
pascal@13747 | 44 + } |
pascal@13747 | 45 +#endif |
pascal@13747 | 46 if (iso_compare_name(de_name, de_name_len, dname)) { |
pascal@13747 | 47 dprintf("Found.\n"); |
pascal@13747 | 48 return de; |
pascal@17156 | 49 @@ -217,11 +249,22 @@ |
pascal@17156 | 50 dirent->d_ino = 0; /* Inode number is invalid to ISO fs */ |
pascal@17156 | 51 dirent->d_off = file->offset; |
pascal@17156 | 52 dirent->d_type = get_inode_mode(de->flags); |
pascal@17156 | 53 - dirent->d_reclen = offsetof(struct dirent, d_name) + 1 + |
pascal@17156 | 54 - iso_convert_name(dirent->d_name, de->name, de->name_len); |
pascal@17156 | 55 + iso_convert_name(dirent->d_name, de->name, de->name_len); |
pascal@17156 | 56 |
pascal@17156 | 57 +#ifdef __ROCKRIDGE |
pascal@13747 | 58 + { |
pascal@17156 | 59 + char *name; |
pascal@17156 | 60 + size_t len = rockname(de, &name); |
pascal@17156 | 61 + |
pascal@17156 | 62 + if (len) { |
pascal@17156 | 63 + strcpy(dirent->d_name, name); |
pascal@17156 | 64 + dirent->d_name[len] = 0; |
pascal@13747 | 65 + } |
pascal@13747 | 66 + } |
pascal@13747 | 67 +#endif |
pascal@17156 | 68 + dirent->d_reclen = offsetof(struct dirent, d_name) + 1 + strlen(dirent->d_name); |
pascal@17156 | 69 file->offset += de->length; /* Update for next reading */ |
pascal@17156 | 70 - |
pascal@17156 | 71 + |
pascal@17156 | 72 return 0; |
pascal@17156 | 73 } |
pascal@17156 | 74 |