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