License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.
By default all files without license information are under the default
license of the kernel, which is GPL version 2.
Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.
This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.
How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,
Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.
The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.
The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.
Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if <5
lines).
All documentation files were explicitly excluded.
The following heuristics were used to determine which SPDX license
identifiers to apply.
- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.
For non */uapi/* files that summary was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139
and resulted in the first patch in this series.
If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930
and resulted in the second patch in this series.
- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:
SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1
and that resulted in the third patch in this series.
- when the two scanners agreed on the detected license(s), that became
the concluded license(s).
- when there was disagreement between the two scanners (one detected a
license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.
- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply (and
which scanner probably needed to revisit its heuristics).
- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.
- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.
In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.
Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights. The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.
Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.
In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.
Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
- a full scancode scan run, collecting the matched texts, detected
license ids and scores
- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct
- reviewing anything where there was no detection but the patch license
was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
SPDX license was correct
This produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.
These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-01 22:07:57 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* linux/fs/isofs/rock.c
|
|
|
|
*
|
|
|
|
* (C) 1992, 1993 Eric Youngdale
|
|
|
|
*
|
|
|
|
* Rock Ridge Extensions to iso9660
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/slab.h>
|
|
|
|
#include <linux/pagemap.h>
|
|
|
|
|
2005-04-26 09:32:12 +08:00
|
|
|
#include "isofs.h"
|
2005-04-17 06:20:36 +08:00
|
|
|
#include "rock.h"
|
|
|
|
|
2005-06-22 08:16:47 +08:00
|
|
|
/*
|
|
|
|
* These functions are designed to read the system areas of a directory record
|
2005-04-17 06:20:36 +08:00
|
|
|
* and extract relevant information. There are different functions provided
|
|
|
|
* depending upon what information we need at the time. One function fills
|
|
|
|
* out an inode structure, a second one extracts a filename, a third one
|
|
|
|
* returns a symbolic link name, and a fourth one returns the extent number
|
2005-06-22 08:16:47 +08:00
|
|
|
* for the file.
|
|
|
|
*/
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-06-22 08:16:42 +08:00
|
|
|
#define SIG(A,B) ((A) | ((B) << 8)) /* isonum_721() */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-06-22 08:16:46 +08:00
|
|
|
struct rock_state {
|
|
|
|
void *buffer;
|
|
|
|
unsigned char *chr;
|
|
|
|
int len;
|
|
|
|
int cont_size;
|
|
|
|
int cont_extent;
|
|
|
|
int cont_offset;
|
2014-12-15 21:22:46 +08:00
|
|
|
int cont_loops;
|
2005-06-22 08:16:46 +08:00
|
|
|
struct inode *inode;
|
|
|
|
};
|
|
|
|
|
2005-06-22 08:16:44 +08:00
|
|
|
/*
|
|
|
|
* This is a way of ensuring that we have something in the system
|
2005-06-22 08:16:47 +08:00
|
|
|
* use fields that is compatible with Rock Ridge. Return zero on success.
|
2005-06-22 08:16:44 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
static int check_sp(struct rock_ridge *rr, struct inode *inode)
|
|
|
|
{
|
|
|
|
if (rr->u.SP.magic[0] != 0xbe)
|
|
|
|
return -1;
|
|
|
|
if (rr->u.SP.magic[1] != 0xef)
|
|
|
|
return -1;
|
|
|
|
ISOFS_SB(inode->i_sb)->s_rock_offset = rr->u.SP.skip;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2005-06-22 08:16:46 +08:00
|
|
|
static void setup_rock_ridge(struct iso_directory_record *de,
|
2005-06-22 08:16:46 +08:00
|
|
|
struct inode *inode, struct rock_state *rs)
|
2005-06-22 08:16:46 +08:00
|
|
|
{
|
2005-06-22 08:16:46 +08:00
|
|
|
rs->len = sizeof(struct iso_directory_record) + de->name_len[0];
|
|
|
|
if (rs->len & 1)
|
|
|
|
(rs->len)++;
|
|
|
|
rs->chr = (unsigned char *)de + rs->len;
|
|
|
|
rs->len = *((unsigned char *)de) - rs->len;
|
|
|
|
if (rs->len < 0)
|
|
|
|
rs->len = 0;
|
2005-06-22 08:16:46 +08:00
|
|
|
|
|
|
|
if (ISOFS_SB(inode->i_sb)->s_rock_offset != -1) {
|
2005-06-22 08:16:46 +08:00
|
|
|
rs->len -= ISOFS_SB(inode->i_sb)->s_rock_offset;
|
|
|
|
rs->chr += ISOFS_SB(inode->i_sb)->s_rock_offset;
|
|
|
|
if (rs->len < 0)
|
|
|
|
rs->len = 0;
|
2005-06-22 08:16:46 +08:00
|
|
|
}
|
2005-06-22 08:16:42 +08:00
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-06-22 08:16:46 +08:00
|
|
|
static void init_rock_state(struct rock_state *rs, struct inode *inode)
|
|
|
|
{
|
|
|
|
memset(rs, 0, sizeof(*rs));
|
|
|
|
rs->inode = inode;
|
|
|
|
}
|
|
|
|
|
2014-12-15 21:22:46 +08:00
|
|
|
/* Maximum number of Rock Ridge continuation entries */
|
|
|
|
#define RR_MAX_CE_ENTRIES 32
|
|
|
|
|
2005-06-22 08:16:46 +08:00
|
|
|
/*
|
|
|
|
* Returns 0 if the caller should continue scanning, 1 if the scan must end
|
|
|
|
* and -ve on error.
|
|
|
|
*/
|
|
|
|
static int rock_continue(struct rock_state *rs)
|
|
|
|
{
|
|
|
|
int ret = 1;
|
2005-06-22 08:16:50 +08:00
|
|
|
int blocksize = 1 << rs->inode->i_blkbits;
|
|
|
|
const int min_de_size = offsetof(struct rock_ridge, u);
|
2005-06-22 08:16:46 +08:00
|
|
|
|
|
|
|
kfree(rs->buffer);
|
|
|
|
rs->buffer = NULL;
|
2005-06-22 08:16:50 +08:00
|
|
|
|
|
|
|
if ((unsigned)rs->cont_offset > blocksize - min_de_size ||
|
|
|
|
(unsigned)rs->cont_size > blocksize ||
|
|
|
|
(unsigned)(rs->cont_offset + rs->cont_size) > blocksize) {
|
|
|
|
printk(KERN_NOTICE "rock: corrupted directory entry. "
|
|
|
|
"extent=%d, offset=%d, size=%d\n",
|
|
|
|
rs->cont_extent, rs->cont_offset, rs->cont_size);
|
|
|
|
ret = -EIO;
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
2005-06-22 08:16:46 +08:00
|
|
|
if (rs->cont_extent) {
|
|
|
|
struct buffer_head *bh;
|
|
|
|
|
|
|
|
rs->buffer = kmalloc(rs->cont_size, GFP_KERNEL);
|
|
|
|
if (!rs->buffer) {
|
|
|
|
ret = -ENOMEM;
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
ret = -EIO;
|
2014-12-15 21:22:46 +08:00
|
|
|
if (++rs->cont_loops >= RR_MAX_CE_ENTRIES)
|
|
|
|
goto out;
|
2005-06-22 08:16:46 +08:00
|
|
|
bh = sb_bread(rs->inode->i_sb, rs->cont_extent);
|
|
|
|
if (bh) {
|
|
|
|
memcpy(rs->buffer, bh->b_data + rs->cont_offset,
|
|
|
|
rs->cont_size);
|
|
|
|
put_bh(bh);
|
|
|
|
rs->chr = rs->buffer;
|
|
|
|
rs->len = rs->cont_size;
|
|
|
|
rs->cont_extent = 0;
|
|
|
|
rs->cont_size = 0;
|
|
|
|
rs->cont_offset = 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
printk("Unable to read rock-ridge attributes\n");
|
|
|
|
}
|
|
|
|
out:
|
|
|
|
kfree(rs->buffer);
|
|
|
|
rs->buffer = NULL;
|
|
|
|
return ret;
|
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-06-22 08:16:51 +08:00
|
|
|
/*
|
|
|
|
* We think there's a record of type `sig' at rs->chr. Parse the signature
|
|
|
|
* and make sure that there's really room for a record of that type.
|
|
|
|
*/
|
|
|
|
static int rock_check_overflow(struct rock_state *rs, int sig)
|
|
|
|
{
|
|
|
|
int len;
|
|
|
|
|
|
|
|
switch (sig) {
|
|
|
|
case SIG('S', 'P'):
|
|
|
|
len = sizeof(struct SU_SP_s);
|
|
|
|
break;
|
|
|
|
case SIG('C', 'E'):
|
|
|
|
len = sizeof(struct SU_CE_s);
|
|
|
|
break;
|
|
|
|
case SIG('E', 'R'):
|
|
|
|
len = sizeof(struct SU_ER_s);
|
|
|
|
break;
|
|
|
|
case SIG('R', 'R'):
|
|
|
|
len = sizeof(struct RR_RR_s);
|
|
|
|
break;
|
|
|
|
case SIG('P', 'X'):
|
|
|
|
len = sizeof(struct RR_PX_s);
|
|
|
|
break;
|
|
|
|
case SIG('P', 'N'):
|
|
|
|
len = sizeof(struct RR_PN_s);
|
|
|
|
break;
|
|
|
|
case SIG('S', 'L'):
|
|
|
|
len = sizeof(struct RR_SL_s);
|
|
|
|
break;
|
|
|
|
case SIG('N', 'M'):
|
|
|
|
len = sizeof(struct RR_NM_s);
|
|
|
|
break;
|
|
|
|
case SIG('C', 'L'):
|
|
|
|
len = sizeof(struct RR_CL_s);
|
|
|
|
break;
|
|
|
|
case SIG('P', 'L'):
|
|
|
|
len = sizeof(struct RR_PL_s);
|
|
|
|
break;
|
|
|
|
case SIG('T', 'F'):
|
|
|
|
len = sizeof(struct RR_TF_s);
|
|
|
|
break;
|
|
|
|
case SIG('Z', 'F'):
|
|
|
|
len = sizeof(struct RR_ZF_s);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
len = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
len += offsetof(struct rock_ridge, u);
|
|
|
|
if (len > rs->len) {
|
|
|
|
printk(KERN_NOTICE "rock: directory entry would overflow "
|
|
|
|
"storage\n");
|
|
|
|
printk(KERN_NOTICE "rock: sig=0x%02x, size=%d, remaining=%d\n",
|
|
|
|
sig, len, rs->len);
|
|
|
|
return -EIO;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2005-06-22 08:16:47 +08:00
|
|
|
/*
|
|
|
|
* return length of name field; 0: not found, -1: to be ignored
|
|
|
|
*/
|
2005-06-22 08:16:42 +08:00
|
|
|
int get_rock_ridge_filename(struct iso_directory_record *de,
|
|
|
|
char *retname, struct inode *inode)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-06-22 08:16:46 +08:00
|
|
|
struct rock_state rs;
|
2005-06-22 08:16:43 +08:00
|
|
|
struct rock_ridge *rr;
|
|
|
|
int sig;
|
|
|
|
int retnamlen = 0;
|
|
|
|
int truncate = 0;
|
2005-06-22 08:16:46 +08:00
|
|
|
int ret = 0;
|
2016-05-06 04:25:35 +08:00
|
|
|
char *p;
|
|
|
|
int len;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-06-22 08:16:42 +08:00
|
|
|
if (!ISOFS_SB(inode->i_sb)->s_rock)
|
|
|
|
return 0;
|
|
|
|
*retname = 0;
|
|
|
|
|
2005-06-22 08:16:46 +08:00
|
|
|
init_rock_state(&rs, inode);
|
|
|
|
setup_rock_ridge(de, inode, &rs);
|
2005-06-22 08:16:43 +08:00
|
|
|
repeat:
|
|
|
|
|
2005-06-22 08:16:46 +08:00
|
|
|
while (rs.len > 2) { /* There may be one byte for padding somewhere */
|
|
|
|
rr = (struct rock_ridge *)rs.chr;
|
2008-07-25 16:46:32 +08:00
|
|
|
/*
|
|
|
|
* Ignore rock ridge info if rr->len is out of range, but
|
|
|
|
* don't return -EIO because that would make the file
|
|
|
|
* invisible.
|
|
|
|
*/
|
2005-06-22 08:16:43 +08:00
|
|
|
if (rr->len < 3)
|
|
|
|
goto out; /* Something got screwed up here */
|
2005-06-22 08:16:46 +08:00
|
|
|
sig = isonum_721(rs.chr);
|
2005-06-22 08:16:51 +08:00
|
|
|
if (rock_check_overflow(&rs, sig))
|
|
|
|
goto eio;
|
2005-06-22 08:16:46 +08:00
|
|
|
rs.chr += rr->len;
|
|
|
|
rs.len -= rr->len;
|
2008-07-25 16:46:32 +08:00
|
|
|
/*
|
|
|
|
* As above, just ignore the rock ridge info if rr->len
|
|
|
|
* is bogus.
|
|
|
|
*/
|
2005-06-22 08:16:46 +08:00
|
|
|
if (rs.len < 0)
|
2008-07-25 16:46:32 +08:00
|
|
|
goto out; /* Something got screwed up here */
|
2005-06-22 08:16:43 +08:00
|
|
|
|
|
|
|
switch (sig) {
|
|
|
|
case SIG('R', 'R'):
|
|
|
|
if ((rr->u.RR.flags[0] & RR_NM) == 0)
|
|
|
|
goto out;
|
|
|
|
break;
|
|
|
|
case SIG('S', 'P'):
|
2005-06-22 08:16:44 +08:00
|
|
|
if (check_sp(rr, inode))
|
|
|
|
goto out;
|
2005-06-22 08:16:43 +08:00
|
|
|
break;
|
|
|
|
case SIG('C', 'E'):
|
2005-06-22 08:16:46 +08:00
|
|
|
rs.cont_extent = isonum_733(rr->u.CE.extent);
|
|
|
|
rs.cont_offset = isonum_733(rr->u.CE.offset);
|
|
|
|
rs.cont_size = isonum_733(rr->u.CE.size);
|
2005-06-22 08:16:43 +08:00
|
|
|
break;
|
|
|
|
case SIG('N', 'M'):
|
|
|
|
if (truncate)
|
2005-06-22 08:16:42 +08:00
|
|
|
break;
|
2005-06-22 08:16:43 +08:00
|
|
|
if (rr->len < 5)
|
2005-06-22 08:16:42 +08:00
|
|
|
break;
|
2005-06-22 08:16:43 +08:00
|
|
|
/*
|
|
|
|
* If the flags are 2 or 4, this indicates '.' or '..'.
|
|
|
|
* We don't want to do anything with this, because it
|
|
|
|
* screws up the code that calls us. We don't really
|
|
|
|
* care anyways, since we can just use the non-RR
|
|
|
|
* name.
|
|
|
|
*/
|
|
|
|
if (rr->u.NM.flags & 6)
|
2005-06-22 08:16:42 +08:00
|
|
|
break;
|
|
|
|
|
2005-06-22 08:16:43 +08:00
|
|
|
if (rr->u.NM.flags & ~1) {
|
|
|
|
printk("Unsupported NM flag settings (%d)\n",
|
|
|
|
rr->u.NM.flags);
|
2005-06-22 08:16:42 +08:00
|
|
|
break;
|
2005-06-22 08:16:43 +08:00
|
|
|
}
|
2016-05-06 04:25:35 +08:00
|
|
|
len = rr->len - 5;
|
|
|
|
if (retnamlen + len >= 254) {
|
2005-06-22 08:16:43 +08:00
|
|
|
truncate = 1;
|
2005-06-22 08:16:42 +08:00
|
|
|
break;
|
|
|
|
}
|
2016-05-06 04:25:35 +08:00
|
|
|
p = memchr(rr->u.NM.name, '\0', len);
|
|
|
|
if (unlikely(p))
|
|
|
|
len = p - rr->u.NM.name;
|
|
|
|
memcpy(retname + retnamlen, rr->u.NM.name, len);
|
|
|
|
retnamlen += len;
|
|
|
|
retname[retnamlen] = '\0';
|
2005-06-22 08:16:43 +08:00
|
|
|
break;
|
|
|
|
case SIG('R', 'E'):
|
2005-06-22 08:16:46 +08:00
|
|
|
kfree(rs.buffer);
|
2005-06-22 08:16:43 +08:00
|
|
|
return -1;
|
|
|
|
default:
|
|
|
|
break;
|
2005-06-22 08:16:42 +08:00
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2005-06-22 08:16:46 +08:00
|
|
|
ret = rock_continue(&rs);
|
|
|
|
if (ret == 0)
|
|
|
|
goto repeat;
|
|
|
|
if (ret == 1)
|
|
|
|
return retnamlen; /* If 0, this file did not have a NM field */
|
2005-06-22 08:16:43 +08:00
|
|
|
out:
|
2005-06-22 08:16:46 +08:00
|
|
|
kfree(rs.buffer);
|
|
|
|
return ret;
|
2005-06-22 08:16:51 +08:00
|
|
|
eio:
|
|
|
|
ret = -EIO;
|
|
|
|
goto out;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2014-08-17 17:49:57 +08:00
|
|
|
#define RR_REGARD_XA 1
|
|
|
|
#define RR_RELOC_DE 2
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
static int
|
|
|
|
parse_rock_ridge_inode_internal(struct iso_directory_record *de,
|
2014-08-17 17:49:57 +08:00
|
|
|
struct inode *inode, int flags)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-06-22 08:16:42 +08:00
|
|
|
int symlink_len = 0;
|
2005-06-22 08:16:43 +08:00
|
|
|
int cnt, sig;
|
2014-08-17 17:49:57 +08:00
|
|
|
unsigned int reloc_block;
|
2005-06-22 08:16:43 +08:00
|
|
|
struct inode *reloc;
|
|
|
|
struct rock_ridge *rr;
|
|
|
|
int rootflag;
|
2005-06-22 08:16:46 +08:00
|
|
|
struct rock_state rs;
|
|
|
|
int ret = 0;
|
2005-06-22 08:16:42 +08:00
|
|
|
|
|
|
|
if (!ISOFS_SB(inode->i_sb)->s_rock)
|
|
|
|
return 0;
|
|
|
|
|
2005-06-22 08:16:46 +08:00
|
|
|
init_rock_state(&rs, inode);
|
|
|
|
setup_rock_ridge(de, inode, &rs);
|
2014-08-17 17:49:57 +08:00
|
|
|
if (flags & RR_REGARD_XA) {
|
2005-06-22 08:16:46 +08:00
|
|
|
rs.chr += 14;
|
|
|
|
rs.len -= 14;
|
|
|
|
if (rs.len < 0)
|
|
|
|
rs.len = 0;
|
2005-06-22 08:16:42 +08:00
|
|
|
}
|
|
|
|
|
2005-06-22 08:16:43 +08:00
|
|
|
repeat:
|
2005-06-22 08:16:46 +08:00
|
|
|
while (rs.len > 2) { /* There may be one byte for padding somewhere */
|
|
|
|
rr = (struct rock_ridge *)rs.chr;
|
2008-07-25 16:46:32 +08:00
|
|
|
/*
|
|
|
|
* Ignore rock ridge info if rr->len is out of range, but
|
|
|
|
* don't return -EIO because that would make the file
|
|
|
|
* invisible.
|
|
|
|
*/
|
2005-06-22 08:16:43 +08:00
|
|
|
if (rr->len < 3)
|
|
|
|
goto out; /* Something got screwed up here */
|
2005-06-22 08:16:46 +08:00
|
|
|
sig = isonum_721(rs.chr);
|
2005-06-22 08:16:51 +08:00
|
|
|
if (rock_check_overflow(&rs, sig))
|
|
|
|
goto eio;
|
2005-06-22 08:16:46 +08:00
|
|
|
rs.chr += rr->len;
|
|
|
|
rs.len -= rr->len;
|
2008-07-25 16:46:32 +08:00
|
|
|
/*
|
|
|
|
* As above, just ignore the rock ridge info if rr->len
|
|
|
|
* is bogus.
|
|
|
|
*/
|
2005-06-22 08:16:46 +08:00
|
|
|
if (rs.len < 0)
|
2008-07-25 16:46:32 +08:00
|
|
|
goto out; /* Something got screwed up here */
|
2005-06-22 08:16:43 +08:00
|
|
|
|
|
|
|
switch (sig) {
|
2005-04-17 06:20:36 +08:00
|
|
|
#ifndef CONFIG_ZISOFS /* No flag for SF or ZF */
|
2005-06-22 08:16:43 +08:00
|
|
|
case SIG('R', 'R'):
|
|
|
|
if ((rr->u.RR.flags[0] &
|
|
|
|
(RR_PX | RR_TF | RR_SL | RR_CL)) == 0)
|
|
|
|
goto out;
|
|
|
|
break;
|
2005-04-17 06:20:36 +08:00
|
|
|
#endif
|
2005-06-22 08:16:43 +08:00
|
|
|
case SIG('S', 'P'):
|
2005-06-22 08:16:44 +08:00
|
|
|
if (check_sp(rr, inode))
|
|
|
|
goto out;
|
2005-06-22 08:16:43 +08:00
|
|
|
break;
|
|
|
|
case SIG('C', 'E'):
|
2005-06-22 08:16:46 +08:00
|
|
|
rs.cont_extent = isonum_733(rr->u.CE.extent);
|
|
|
|
rs.cont_offset = isonum_733(rr->u.CE.offset);
|
|
|
|
rs.cont_size = isonum_733(rr->u.CE.size);
|
2005-06-22 08:16:43 +08:00
|
|
|
break;
|
|
|
|
case SIG('E', 'R'):
|
2014-12-19 00:26:10 +08:00
|
|
|
/* Invalid length of ER tag id? */
|
|
|
|
if (rr->u.ER.len_id + offsetof(struct rock_ridge, u.ER.data) > rr->len)
|
|
|
|
goto out;
|
2005-06-22 08:16:43 +08:00
|
|
|
ISOFS_SB(inode->i_sb)->s_rock = 1;
|
|
|
|
printk(KERN_DEBUG "ISO 9660 Extensions: ");
|
|
|
|
{
|
|
|
|
int p;
|
|
|
|
for (p = 0; p < rr->u.ER.len_id; p++)
|
2016-11-30 15:52:01 +08:00
|
|
|
printk(KERN_CONT "%c", rr->u.ER.data[p]);
|
2005-06-22 08:16:43 +08:00
|
|
|
}
|
2016-11-30 15:52:01 +08:00
|
|
|
printk(KERN_CONT "\n");
|
2005-06-22 08:16:43 +08:00
|
|
|
break;
|
|
|
|
case SIG('P', 'X'):
|
|
|
|
inode->i_mode = isonum_733(rr->u.PX.mode);
|
2011-10-28 20:13:29 +08:00
|
|
|
set_nlink(inode, isonum_733(rr->u.PX.n_links));
|
2012-02-11 03:35:50 +08:00
|
|
|
i_uid_write(inode, isonum_733(rr->u.PX.uid));
|
|
|
|
i_gid_write(inode, isonum_733(rr->u.PX.gid));
|
2005-06-22 08:16:43 +08:00
|
|
|
break;
|
|
|
|
case SIG('P', 'N'):
|
|
|
|
{
|
|
|
|
int high, low;
|
|
|
|
high = isonum_733(rr->u.PN.dev_high);
|
|
|
|
low = isonum_733(rr->u.PN.dev_low);
|
|
|
|
/*
|
|
|
|
* The Rock Ridge standard specifies that if
|
|
|
|
* sizeof(dev_t) <= 4, then the high field is
|
|
|
|
* unused, and the device number is completely
|
|
|
|
* stored in the low field. Some writers may
|
|
|
|
* ignore this subtlety,
|
|
|
|
* and as a result we test to see if the entire
|
|
|
|
* device number is
|
|
|
|
* stored in the low field, and use that.
|
|
|
|
*/
|
|
|
|
if ((low & ~0xff) && high == 0) {
|
|
|
|
inode->i_rdev =
|
|
|
|
MKDEV(low >> 8, low & 0xff);
|
|
|
|
} else {
|
|
|
|
inode->i_rdev =
|
|
|
|
MKDEV(high, low);
|
2005-06-22 08:16:42 +08:00
|
|
|
}
|
2005-06-22 08:16:43 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SIG('T', 'F'):
|
|
|
|
/*
|
|
|
|
* Some RRIP writers incorrectly place ctime in the
|
|
|
|
* TF_CREATE field. Try to handle this correctly for
|
|
|
|
* either case.
|
|
|
|
*/
|
|
|
|
/* Rock ridge never appears on a High Sierra disk */
|
|
|
|
cnt = 0;
|
|
|
|
if (rr->u.TF.flags & TF_CREATE) {
|
|
|
|
inode->i_ctime.tv_sec =
|
|
|
|
iso_date(rr->u.TF.times[cnt++].time,
|
|
|
|
0);
|
|
|
|
inode->i_ctime.tv_nsec = 0;
|
|
|
|
}
|
|
|
|
if (rr->u.TF.flags & TF_MODIFY) {
|
|
|
|
inode->i_mtime.tv_sec =
|
|
|
|
iso_date(rr->u.TF.times[cnt++].time,
|
|
|
|
0);
|
|
|
|
inode->i_mtime.tv_nsec = 0;
|
|
|
|
}
|
|
|
|
if (rr->u.TF.flags & TF_ACCESS) {
|
|
|
|
inode->i_atime.tv_sec =
|
|
|
|
iso_date(rr->u.TF.times[cnt++].time,
|
|
|
|
0);
|
|
|
|
inode->i_atime.tv_nsec = 0;
|
|
|
|
}
|
|
|
|
if (rr->u.TF.flags & TF_ATTRIBUTES) {
|
|
|
|
inode->i_ctime.tv_sec =
|
|
|
|
iso_date(rr->u.TF.times[cnt++].time,
|
|
|
|
0);
|
|
|
|
inode->i_ctime.tv_nsec = 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SIG('S', 'L'):
|
|
|
|
{
|
|
|
|
int slen;
|
|
|
|
struct SL_component *slp;
|
|
|
|
struct SL_component *oldslp;
|
|
|
|
slen = rr->len - 5;
|
|
|
|
slp = &rr->u.SL.link;
|
|
|
|
inode->i_size = symlink_len;
|
|
|
|
while (slen > 1) {
|
|
|
|
rootflag = 0;
|
|
|
|
switch (slp->flags & ~1) {
|
|
|
|
case 0:
|
|
|
|
inode->i_size +=
|
|
|
|
slp->len;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
inode->i_size += 1;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
inode->i_size += 2;
|
|
|
|
break;
|
|
|
|
case 8:
|
|
|
|
rootflag = 1;
|
|
|
|
inode->i_size += 1;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
printk("Symlink component flag "
|
|
|
|
"not implemented\n");
|
2005-06-22 08:16:42 +08:00
|
|
|
}
|
2005-06-22 08:16:43 +08:00
|
|
|
slen -= slp->len + 2;
|
|
|
|
oldslp = slp;
|
|
|
|
slp = (struct SL_component *)
|
|
|
|
(((char *)slp) + slp->len + 2);
|
|
|
|
|
|
|
|
if (slen < 2) {
|
|
|
|
if (((rr->u.SL.
|
|
|
|
flags & 1) != 0)
|
|
|
|
&&
|
|
|
|
((oldslp->
|
|
|
|
flags & 1) == 0))
|
2005-06-22 08:16:42 +08:00
|
|
|
inode->i_size +=
|
2005-06-22 08:16:43 +08:00
|
|
|
1;
|
|
|
|
break;
|
2005-06-22 08:16:42 +08:00
|
|
|
}
|
2005-06-22 08:16:43 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* If this component record isn't
|
|
|
|
* continued, then append a '/'.
|
|
|
|
*/
|
|
|
|
if (!rootflag
|
|
|
|
&& (oldslp->flags & 1) == 0)
|
|
|
|
inode->i_size += 1;
|
2005-06-22 08:16:42 +08:00
|
|
|
}
|
2005-06-22 08:16:43 +08:00
|
|
|
}
|
|
|
|
symlink_len = inode->i_size;
|
|
|
|
break;
|
|
|
|
case SIG('R', 'E'):
|
|
|
|
printk(KERN_WARNING "Attempt to read inode for "
|
|
|
|
"relocated directory\n");
|
|
|
|
goto out;
|
|
|
|
case SIG('C', 'L'):
|
2014-08-17 17:49:57 +08:00
|
|
|
if (flags & RR_RELOC_DE) {
|
|
|
|
printk(KERN_ERR
|
|
|
|
"ISOFS: Recursive directory relocation "
|
|
|
|
"is not supported\n");
|
|
|
|
goto eio;
|
|
|
|
}
|
|
|
|
reloc_block = isonum_733(rr->u.CL.location);
|
|
|
|
if (reloc_block == ISOFS_I(inode)->i_iget5_block &&
|
|
|
|
ISOFS_I(inode)->i_iget5_offset == 0) {
|
|
|
|
printk(KERN_ERR
|
|
|
|
"ISOFS: Directory relocation points to "
|
|
|
|
"itself\n");
|
|
|
|
goto eio;
|
|
|
|
}
|
|
|
|
ISOFS_I(inode)->i_first_extent = reloc_block;
|
|
|
|
reloc = isofs_iget_reloc(inode->i_sb, reloc_block, 0);
|
2008-02-07 16:15:41 +08:00
|
|
|
if (IS_ERR(reloc)) {
|
|
|
|
ret = PTR_ERR(reloc);
|
2005-06-22 08:16:42 +08:00
|
|
|
goto out;
|
2008-02-07 16:15:41 +08:00
|
|
|
}
|
2005-06-22 08:16:43 +08:00
|
|
|
inode->i_mode = reloc->i_mode;
|
2011-10-28 20:13:29 +08:00
|
|
|
set_nlink(inode, reloc->i_nlink);
|
2005-06-22 08:16:43 +08:00
|
|
|
inode->i_uid = reloc->i_uid;
|
|
|
|
inode->i_gid = reloc->i_gid;
|
|
|
|
inode->i_rdev = reloc->i_rdev;
|
|
|
|
inode->i_size = reloc->i_size;
|
|
|
|
inode->i_blocks = reloc->i_blocks;
|
|
|
|
inode->i_atime = reloc->i_atime;
|
|
|
|
inode->i_ctime = reloc->i_ctime;
|
|
|
|
inode->i_mtime = reloc->i_mtime;
|
|
|
|
iput(reloc);
|
|
|
|
break;
|
2005-04-17 06:20:36 +08:00
|
|
|
#ifdef CONFIG_ZISOFS
|
2005-06-22 08:16:43 +08:00
|
|
|
case SIG('Z', 'F'): {
|
|
|
|
int algo;
|
|
|
|
|
|
|
|
if (ISOFS_SB(inode->i_sb)->s_nocompress)
|
2005-06-22 08:16:42 +08:00
|
|
|
break;
|
2005-06-22 08:16:43 +08:00
|
|
|
algo = isonum_721(rr->u.ZF.algorithm);
|
|
|
|
if (algo == SIG('p', 'z')) {
|
|
|
|
int block_shift =
|
|
|
|
isonum_711(&rr->u.ZF.parms[1]);
|
2009-09-23 20:44:56 +08:00
|
|
|
if (block_shift > 17) {
|
2005-06-22 08:16:43 +08:00
|
|
|
printk(KERN_WARNING "isofs: "
|
|
|
|
"Can't handle ZF block "
|
|
|
|
"size of 2^%d\n",
|
|
|
|
block_shift);
|
|
|
|
} else {
|
|
|
|
/*
|
|
|
|
* Note: we don't change
|
|
|
|
* i_blocks here
|
|
|
|
*/
|
|
|
|
ISOFS_I(inode)->i_file_format =
|
|
|
|
isofs_file_compressed;
|
|
|
|
/*
|
|
|
|
* Parameters to compression
|
|
|
|
* algorithm (header size,
|
|
|
|
* block size)
|
|
|
|
*/
|
|
|
|
ISOFS_I(inode)->i_format_parm[0] =
|
|
|
|
isonum_711(&rr->u.ZF.parms[0]);
|
|
|
|
ISOFS_I(inode)->i_format_parm[1] =
|
|
|
|
isonum_711(&rr->u.ZF.parms[1]);
|
|
|
|
inode->i_size =
|
|
|
|
isonum_733(rr->u.ZF.
|
|
|
|
real_size);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
printk(KERN_WARNING
|
|
|
|
"isofs: Unknown ZF compression "
|
|
|
|
"algorithm: %c%c\n",
|
|
|
|
rr->u.ZF.algorithm[0],
|
|
|
|
rr->u.ZF.algorithm[1]);
|
2005-06-22 08:16:42 +08:00
|
|
|
}
|
2005-06-22 08:16:43 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
default:
|
|
|
|
break;
|
2005-06-22 08:16:42 +08:00
|
|
|
}
|
|
|
|
}
|
2005-06-22 08:16:46 +08:00
|
|
|
ret = rock_continue(&rs);
|
|
|
|
if (ret == 0)
|
|
|
|
goto repeat;
|
|
|
|
if (ret == 1)
|
|
|
|
ret = 0;
|
2005-06-22 08:16:43 +08:00
|
|
|
out:
|
2005-06-22 08:16:46 +08:00
|
|
|
kfree(rs.buffer);
|
|
|
|
return ret;
|
2005-06-22 08:16:51 +08:00
|
|
|
eio:
|
|
|
|
ret = -EIO;
|
|
|
|
goto out;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static char *get_symlink_chunk(char *rpnt, struct rock_ridge *rr, char *plimit)
|
|
|
|
{
|
|
|
|
int slen;
|
|
|
|
int rootflag;
|
|
|
|
struct SL_component *oldslp;
|
|
|
|
struct SL_component *slp;
|
|
|
|
slen = rr->len - 5;
|
|
|
|
slp = &rr->u.SL.link;
|
|
|
|
while (slen > 1) {
|
|
|
|
rootflag = 0;
|
|
|
|
switch (slp->flags & ~1) {
|
|
|
|
case 0:
|
|
|
|
if (slp->len > plimit - rpnt)
|
|
|
|
return NULL;
|
|
|
|
memcpy(rpnt, slp->text, slp->len);
|
2005-06-22 08:16:42 +08:00
|
|
|
rpnt += slp->len;
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
if (rpnt >= plimit)
|
|
|
|
return NULL;
|
2005-06-22 08:16:42 +08:00
|
|
|
*rpnt++ = '.';
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
if (2 > plimit - rpnt)
|
|
|
|
return NULL;
|
2005-06-22 08:16:42 +08:00
|
|
|
*rpnt++ = '.';
|
|
|
|
*rpnt++ = '.';
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
case 8:
|
|
|
|
if (rpnt >= plimit)
|
|
|
|
return NULL;
|
|
|
|
rootflag = 1;
|
2005-06-22 08:16:42 +08:00
|
|
|
*rpnt++ = '/';
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
printk("Symlink component flag not implemented (%d)\n",
|
2005-06-22 08:16:42 +08:00
|
|
|
slp->flags);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
slen -= slp->len + 2;
|
|
|
|
oldslp = slp;
|
2005-06-22 08:16:42 +08:00
|
|
|
slp = (struct SL_component *)((char *)slp + slp->len + 2);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
if (slen < 2) {
|
|
|
|
/*
|
|
|
|
* If there is another SL record, and this component
|
|
|
|
* record isn't continued, then add a slash.
|
|
|
|
*/
|
|
|
|
if ((!rootflag) && (rr->u.SL.flags & 1) &&
|
|
|
|
!(oldslp->flags & 1)) {
|
|
|
|
if (rpnt >= plimit)
|
|
|
|
return NULL;
|
2005-06-22 08:16:42 +08:00
|
|
|
*rpnt++ = '/';
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If this component record isn't continued, then append a '/'.
|
|
|
|
*/
|
|
|
|
if (!rootflag && !(oldslp->flags & 1)) {
|
|
|
|
if (rpnt >= plimit)
|
|
|
|
return NULL;
|
2005-06-22 08:16:42 +08:00
|
|
|
*rpnt++ = '/';
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return rpnt;
|
|
|
|
}
|
|
|
|
|
2014-08-17 17:49:57 +08:00
|
|
|
int parse_rock_ridge_inode(struct iso_directory_record *de, struct inode *inode,
|
|
|
|
int relocated)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2014-08-17 17:49:57 +08:00
|
|
|
int flags = relocated ? RR_RELOC_DE : 0;
|
|
|
|
int result = parse_rock_ridge_inode_internal(de, inode, flags);
|
2005-06-22 08:16:47 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* if rockridge flag was reset and we didn't look for attributes
|
|
|
|
* behind eventual XA attributes, have a look there
|
|
|
|
*/
|
2005-06-22 08:16:42 +08:00
|
|
|
if ((ISOFS_SB(inode->i_sb)->s_rock_offset == -1)
|
|
|
|
&& (ISOFS_SB(inode->i_sb)->s_rock == 2)) {
|
2014-08-17 17:49:57 +08:00
|
|
|
result = parse_rock_ridge_inode_internal(de, inode,
|
|
|
|
flags | RR_REGARD_XA);
|
2005-06-22 08:16:42 +08:00
|
|
|
}
|
|
|
|
return result;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2005-06-22 08:16:47 +08:00
|
|
|
/*
|
|
|
|
* readpage() for symlinks: reads symlink contents into the page and either
|
|
|
|
* makes it uptodate and returns 0 or returns error (-EIO)
|
|
|
|
*/
|
2005-04-17 06:20:36 +08:00
|
|
|
static int rock_ridge_symlink_readpage(struct file *file, struct page *page)
|
|
|
|
{
|
|
|
|
struct inode *inode = page->mapping->host;
|
2005-06-22 08:16:42 +08:00
|
|
|
struct iso_inode_info *ei = ISOFS_I(inode);
|
2010-09-13 01:05:56 +08:00
|
|
|
struct isofs_sb_info *sbi = ISOFS_SB(inode->i_sb);
|
2015-11-17 14:07:57 +08:00
|
|
|
char *link = page_address(page);
|
2005-04-17 06:20:36 +08:00
|
|
|
unsigned long bufsize = ISOFS_BUFFER_SIZE(inode);
|
|
|
|
struct buffer_head *bh;
|
|
|
|
char *rpnt = link;
|
|
|
|
unsigned char *pnt;
|
2005-06-22 08:16:46 +08:00
|
|
|
struct iso_directory_record *raw_de;
|
2005-04-17 06:20:36 +08:00
|
|
|
unsigned long block, offset;
|
|
|
|
int sig;
|
|
|
|
struct rock_ridge *rr;
|
2005-06-22 08:16:46 +08:00
|
|
|
struct rock_state rs;
|
|
|
|
int ret;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2010-09-13 01:05:56 +08:00
|
|
|
if (!sbi->s_rock)
|
2005-04-17 06:20:36 +08:00
|
|
|
goto error;
|
|
|
|
|
2005-06-22 08:16:46 +08:00
|
|
|
init_rock_state(&rs, inode);
|
2005-04-17 06:20:36 +08:00
|
|
|
block = ei->i_iget5_block;
|
|
|
|
bh = sb_bread(inode->i_sb, block);
|
|
|
|
if (!bh)
|
|
|
|
goto out_noread;
|
|
|
|
|
2005-06-22 08:16:42 +08:00
|
|
|
offset = ei->i_iget5_offset;
|
|
|
|
pnt = (unsigned char *)bh->b_data + offset;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-06-22 08:16:46 +08:00
|
|
|
raw_de = (struct iso_directory_record *)pnt;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* If we go past the end of the buffer, there is some sort of error.
|
|
|
|
*/
|
|
|
|
if (offset + *pnt > bufsize)
|
|
|
|
goto out_bad_span;
|
|
|
|
|
2005-06-22 08:16:47 +08:00
|
|
|
/*
|
|
|
|
* Now test for possible Rock Ridge extensions which will override
|
|
|
|
* some of these numbers in the inode structure.
|
|
|
|
*/
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-06-22 08:16:46 +08:00
|
|
|
setup_rock_ridge(raw_de, inode, &rs);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-06-22 08:16:43 +08:00
|
|
|
repeat:
|
2005-06-22 08:16:46 +08:00
|
|
|
while (rs.len > 2) { /* There may be one byte for padding somewhere */
|
|
|
|
rr = (struct rock_ridge *)rs.chr;
|
2005-04-17 06:20:36 +08:00
|
|
|
if (rr->len < 3)
|
|
|
|
goto out; /* Something got screwed up here */
|
2005-06-22 08:16:46 +08:00
|
|
|
sig = isonum_721(rs.chr);
|
2005-06-22 08:16:51 +08:00
|
|
|
if (rock_check_overflow(&rs, sig))
|
|
|
|
goto out;
|
2005-06-22 08:16:46 +08:00
|
|
|
rs.chr += rr->len;
|
|
|
|
rs.len -= rr->len;
|
|
|
|
if (rs.len < 0)
|
2005-04-17 06:20:36 +08:00
|
|
|
goto out; /* corrupted isofs */
|
|
|
|
|
|
|
|
switch (sig) {
|
|
|
|
case SIG('R', 'R'):
|
|
|
|
if ((rr->u.RR.flags[0] & RR_SL) == 0)
|
|
|
|
goto out;
|
|
|
|
break;
|
|
|
|
case SIG('S', 'P'):
|
2005-06-22 08:16:44 +08:00
|
|
|
if (check_sp(rr, inode))
|
|
|
|
goto out;
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
case SIG('S', 'L'):
|
|
|
|
rpnt = get_symlink_chunk(rpnt, rr,
|
|
|
|
link + (PAGE_SIZE - 1));
|
|
|
|
if (rpnt == NULL)
|
|
|
|
goto out;
|
|
|
|
break;
|
|
|
|
case SIG('C', 'E'):
|
|
|
|
/* This tells is if there is a continuation record */
|
2005-06-22 08:16:46 +08:00
|
|
|
rs.cont_extent = isonum_733(rr->u.CE.extent);
|
|
|
|
rs.cont_offset = isonum_733(rr->u.CE.offset);
|
|
|
|
rs.cont_size = isonum_733(rr->u.CE.size);
|
2005-04-17 06:20:36 +08:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2005-06-22 08:16:46 +08:00
|
|
|
ret = rock_continue(&rs);
|
|
|
|
if (ret == 0)
|
|
|
|
goto repeat;
|
|
|
|
if (ret < 0)
|
|
|
|
goto fail;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
if (rpnt == link)
|
|
|
|
goto fail;
|
|
|
|
brelse(bh);
|
|
|
|
*rpnt = '\0';
|
|
|
|
SetPageUptodate(page);
|
|
|
|
unlock_page(page);
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
/* error exit from macro */
|
2005-06-22 08:16:43 +08:00
|
|
|
out:
|
2005-06-22 08:16:46 +08:00
|
|
|
kfree(rs.buffer);
|
2005-04-17 06:20:36 +08:00
|
|
|
goto fail;
|
2005-06-22 08:16:43 +08:00
|
|
|
out_noread:
|
2005-04-17 06:20:36 +08:00
|
|
|
printk("unable to read i-node block");
|
|
|
|
goto fail;
|
2005-06-22 08:16:43 +08:00
|
|
|
out_bad_span:
|
2005-04-17 06:20:36 +08:00
|
|
|
printk("symlink spans iso9660 blocks\n");
|
2005-06-22 08:16:43 +08:00
|
|
|
fail:
|
2005-04-17 06:20:36 +08:00
|
|
|
brelse(bh);
|
2005-06-22 08:16:43 +08:00
|
|
|
error:
|
2005-04-17 06:20:36 +08:00
|
|
|
SetPageError(page);
|
|
|
|
unlock_page(page);
|
|
|
|
return -EIO;
|
|
|
|
}
|
|
|
|
|
2006-06-28 19:26:44 +08:00
|
|
|
const struct address_space_operations isofs_symlink_aops = {
|
2005-06-22 08:16:42 +08:00
|
|
|
.readpage = rock_ridge_symlink_readpage
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|