staticint udf_pc_to_char(struct super_block *sb, unsignedchar *from, int fromlen, unsignedchar *to, int tolen)
{ struct pathComponent *pc; int elen = 0; int comp_len; unsignedchar *p = to;
/* Reserve one byte for terminating \0 */
tolen--; while (elen < fromlen) {
pc = (struct pathComponent *)(from + elen);
elen += sizeof(struct pathComponent); switch (pc->componentType) { case 1: /* * Symlink points to some place which should be agreed * upon between originator and receiver of the media. Ignore.
*/ if (pc->lengthComponentIdent > 0) {
elen += pc->lengthComponentIdent; break;
}
fallthrough; case 2: if (tolen == 0) return -ENAMETOOLONG;
p = to;
*p++ = '/';
tolen--; break; case 3: if (tolen < 3) return -ENAMETOOLONG;
memcpy(p, "../", 3);
p += 3;
tolen -= 3; break; case 4: if (tolen < 2) return -ENAMETOOLONG;
memcpy(p, "./", 2);
p += 2;
tolen -= 2; /* that would be . - just ignore */ break; case 5:
elen += pc->lengthComponentIdent; if (elen > fromlen) return -EIO;
comp_len = udf_get_filename(sb, pc->componentIdent,
pc->lengthComponentIdent,
p, tolen); if (comp_len < 0) return comp_len;
p += comp_len;
tolen -= comp_len; if (tolen == 0) return -ENAMETOOLONG;
*p++ = '/';
tolen--; break;
}
} if (p > to + 1)
p[-1] = '\0'; else
p[0] = '\0'; return 0;
}
generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat);
folio = read_mapping_folio(inode->i_mapping, 0, NULL); if (IS_ERR(folio)) return PTR_ERR(folio); /* * UDF uses non-trivial encoding of symlinks so i_size does not match * number of characters reported by readlink(2) which apparently some * applications expect. Also POSIX says that "The value returned in the * st_size field shall be the length of the contents of the symbolic * link, and shall not count a trailing null if one is present." So * let's report the length of string returned by readlink(2) for * st_size.
*/
stat->size = strlen(folio_address(folio));
folio_put(folio);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.