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
|
|
|
/*
|
|
|
|
* Author(s)......: Holger Smolinski <Holger.Smolinski@de.ibm.com>
|
|
|
|
* Volker Sameske <sameske@de.ibm.com>
|
|
|
|
* Bugreports.to..: <Linux390@de.ibm.com>
|
2012-08-31 16:52:13 +08:00
|
|
|
* Copyright IBM Corp. 1999, 2012
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/buffer_head.h>
|
|
|
|
#include <linux/hdreg.h>
|
|
|
|
#include <linux/slab.h>
|
|
|
|
#include <asm/dasd.h>
|
|
|
|
#include <asm/ebcdic.h>
|
2016-12-25 03:46:01 +08:00
|
|
|
#include <linux/uaccess.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <asm/vtoc.h>
|
2020-05-19 22:22:59 +08:00
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/dasd_mod.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#include "check.h"
|
|
|
|
|
2012-08-31 16:52:13 +08:00
|
|
|
union label_t {
|
|
|
|
struct vtoc_volume_label_cdl vol;
|
|
|
|
struct vtoc_volume_label_ldl lnx;
|
|
|
|
struct vtoc_cms_label cms;
|
|
|
|
};
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
2006-03-24 19:15:23 +08:00
|
|
|
* compute the block number from a
|
2005-04-17 06:20:36 +08:00
|
|
|
* cyl-cyl-head-head structure
|
|
|
|
*/
|
2012-08-31 16:52:13 +08:00
|
|
|
static sector_t cchh2blk(struct vtoc_cchh *ptr, struct hd_geometry *geo)
|
|
|
|
{
|
2009-03-26 22:23:47 +08:00
|
|
|
sector_t cyl;
|
|
|
|
__u16 head;
|
|
|
|
|
2012-08-31 16:52:13 +08:00
|
|
|
/* decode cylinder and heads for large volumes */
|
2009-03-26 22:23:47 +08:00
|
|
|
cyl = ptr->hh & 0xFFF0;
|
|
|
|
cyl <<= 12;
|
|
|
|
cyl |= ptr->cc;
|
|
|
|
head = ptr->hh & 0x000F;
|
|
|
|
return cyl * geo->heads * geo->sectors +
|
|
|
|
head * geo->sectors;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2006-03-24 19:15:23 +08:00
|
|
|
* compute the block number from a
|
2005-04-17 06:20:36 +08:00
|
|
|
* cyl-cyl-head-head-block structure
|
|
|
|
*/
|
2012-08-31 16:52:13 +08:00
|
|
|
static sector_t cchhb2blk(struct vtoc_cchhb *ptr, struct hd_geometry *geo)
|
|
|
|
{
|
2009-03-26 22:23:47 +08:00
|
|
|
sector_t cyl;
|
|
|
|
__u16 head;
|
|
|
|
|
2012-08-31 16:52:13 +08:00
|
|
|
/* decode cylinder and heads for large volumes */
|
2009-03-26 22:23:47 +08:00
|
|
|
cyl = ptr->hh & 0xFFF0;
|
|
|
|
cyl <<= 12;
|
|
|
|
cyl |= ptr->cc;
|
|
|
|
head = ptr->hh & 0x000F;
|
|
|
|
return cyl * geo->heads * geo->sectors +
|
|
|
|
head * geo->sectors +
|
2005-04-17 06:20:36 +08:00
|
|
|
ptr->b;
|
|
|
|
}
|
|
|
|
|
2012-08-31 16:52:13 +08:00
|
|
|
static int find_label(struct parsed_partitions *state,
|
|
|
|
dasd_information2_t *info,
|
|
|
|
struct hd_geometry *geo,
|
|
|
|
int blocksize,
|
|
|
|
sector_t *labelsect,
|
|
|
|
char name[],
|
|
|
|
char type[],
|
|
|
|
union label_t *label)
|
|
|
|
{
|
|
|
|
Sector sect;
|
|
|
|
unsigned char *data;
|
|
|
|
sector_t testsect[3];
|
|
|
|
unsigned char temp[5];
|
|
|
|
int found = 0;
|
|
|
|
int i, testcount;
|
|
|
|
|
|
|
|
/* There a three places where we may find a valid label:
|
|
|
|
* - on an ECKD disk it's block 2
|
|
|
|
* - on an FBA disk it's block 1
|
|
|
|
* - on an CMS formatted FBA disk it is sector 1, even if the block size
|
|
|
|
* is larger than 512 bytes (possible if the DIAG discipline is used)
|
|
|
|
* If we have a valid info structure, then we know exactly which case we
|
|
|
|
* have, otherwise we just search through all possebilities.
|
|
|
|
*/
|
|
|
|
if (info) {
|
|
|
|
if ((info->cu_type == 0x6310 && info->dev_type == 0x9336) ||
|
|
|
|
(info->cu_type == 0x3880 && info->dev_type == 0x3370))
|
|
|
|
testsect[0] = info->label_block;
|
|
|
|
else
|
|
|
|
testsect[0] = info->label_block * (blocksize >> 9);
|
|
|
|
testcount = 1;
|
|
|
|
} else {
|
|
|
|
testsect[0] = 1;
|
|
|
|
testsect[1] = (blocksize >> 9);
|
|
|
|
testsect[2] = 2 * (blocksize >> 9);
|
|
|
|
testcount = 3;
|
|
|
|
}
|
|
|
|
for (i = 0; i < testcount; ++i) {
|
|
|
|
data = read_part_sector(state, testsect[i], §);
|
|
|
|
if (data == NULL)
|
|
|
|
continue;
|
|
|
|
memcpy(label, data, sizeof(*label));
|
|
|
|
memcpy(temp, data, 4);
|
|
|
|
temp[4] = 0;
|
|
|
|
EBCASC(temp, 4);
|
|
|
|
put_dev_sector(sect);
|
|
|
|
if (!strcmp(temp, "VOL1") ||
|
|
|
|
!strcmp(temp, "LNX1") ||
|
|
|
|
!strcmp(temp, "CMS1")) {
|
|
|
|
if (!strcmp(temp, "VOL1")) {
|
|
|
|
strncpy(type, label->vol.vollbl, 4);
|
|
|
|
strncpy(name, label->vol.volid, 6);
|
|
|
|
} else {
|
|
|
|
strncpy(type, label->lnx.vollbl, 4);
|
|
|
|
strncpy(name, label->lnx.volid, 6);
|
|
|
|
}
|
|
|
|
EBCASC(type, 4);
|
|
|
|
EBCASC(name, 6);
|
|
|
|
*labelsect = testsect[i];
|
|
|
|
found = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!found)
|
|
|
|
memset(label, 0, sizeof(*label));
|
|
|
|
|
|
|
|
return found;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int find_vol1_partitions(struct parsed_partitions *state,
|
|
|
|
struct hd_geometry *geo,
|
|
|
|
int blocksize,
|
|
|
|
char name[],
|
|
|
|
union label_t *label)
|
|
|
|
{
|
|
|
|
sector_t blk;
|
|
|
|
int counter;
|
|
|
|
char tmp[64];
|
|
|
|
Sector sect;
|
|
|
|
unsigned char *data;
|
|
|
|
loff_t offset, size;
|
|
|
|
struct vtoc_format1_label f1;
|
|
|
|
int secperblk;
|
|
|
|
|
|
|
|
snprintf(tmp, sizeof(tmp), "VOL1/%8s:", name);
|
|
|
|
strlcat(state->pp_buf, tmp, PAGE_SIZE);
|
|
|
|
/*
|
|
|
|
* get start of VTOC from the disk label and then search for format1
|
|
|
|
* and format8 labels
|
|
|
|
*/
|
|
|
|
secperblk = blocksize >> 9;
|
|
|
|
blk = cchhb2blk(&label->vol.vtoc, geo) + 1;
|
|
|
|
counter = 0;
|
|
|
|
data = read_part_sector(state, blk * secperblk, §);
|
|
|
|
while (data != NULL) {
|
|
|
|
memcpy(&f1, data, sizeof(struct vtoc_format1_label));
|
|
|
|
put_dev_sector(sect);
|
|
|
|
/* skip FMT4 / FMT5 / FMT7 labels */
|
|
|
|
if (f1.DS1FMTID == _ascebc['4']
|
|
|
|
|| f1.DS1FMTID == _ascebc['5']
|
|
|
|
|| f1.DS1FMTID == _ascebc['7']
|
|
|
|
|| f1.DS1FMTID == _ascebc['9']) {
|
|
|
|
blk++;
|
|
|
|
data = read_part_sector(state, blk * secperblk, §);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
/* only FMT1 and 8 labels valid at this point */
|
|
|
|
if (f1.DS1FMTID != _ascebc['1'] &&
|
|
|
|
f1.DS1FMTID != _ascebc['8'])
|
|
|
|
break;
|
|
|
|
/* OK, we got valid partition data */
|
|
|
|
offset = cchh2blk(&f1.DS1EXT1.llimit, geo);
|
|
|
|
size = cchh2blk(&f1.DS1EXT1.ulimit, geo) -
|
|
|
|
offset + geo->sectors;
|
|
|
|
offset *= secperblk;
|
|
|
|
size *= secperblk;
|
|
|
|
if (counter >= state->limit)
|
|
|
|
break;
|
|
|
|
put_partition(state, counter + 1, offset, size);
|
|
|
|
counter++;
|
|
|
|
blk++;
|
|
|
|
data = read_part_sector(state, blk * secperblk, §);
|
|
|
|
}
|
|
|
|
strlcat(state->pp_buf, "\n", PAGE_SIZE);
|
|
|
|
|
|
|
|
if (!data)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int find_lnx1_partitions(struct parsed_partitions *state,
|
|
|
|
struct hd_geometry *geo,
|
|
|
|
int blocksize,
|
|
|
|
char name[],
|
|
|
|
union label_t *label,
|
|
|
|
sector_t labelsect,
|
2021-10-19 14:20:24 +08:00
|
|
|
sector_t nr_sectors,
|
2012-08-31 16:52:13 +08:00
|
|
|
dasd_information2_t *info)
|
|
|
|
{
|
|
|
|
loff_t offset, geo_size, size;
|
|
|
|
char tmp[64];
|
|
|
|
int secperblk;
|
|
|
|
|
|
|
|
snprintf(tmp, sizeof(tmp), "LNX1/%8s:", name);
|
|
|
|
strlcat(state->pp_buf, tmp, PAGE_SIZE);
|
|
|
|
secperblk = blocksize >> 9;
|
|
|
|
if (label->lnx.ldl_version == 0xf2) {
|
|
|
|
size = label->lnx.formatted_blocks * secperblk;
|
|
|
|
} else {
|
|
|
|
/*
|
|
|
|
* Formated w/o large volume support. If the sanity check
|
2021-10-19 14:20:24 +08:00
|
|
|
* 'size based on geo == size based on nr_sectors' is true, then
|
2012-08-31 16:52:13 +08:00
|
|
|
* we can safely assume that we know the formatted size of
|
|
|
|
* the disk, otherwise we need additional information
|
|
|
|
* that we can only get from a real DASD device.
|
|
|
|
*/
|
|
|
|
geo_size = geo->cylinders * geo->heads
|
|
|
|
* geo->sectors * secperblk;
|
2021-10-19 14:20:24 +08:00
|
|
|
size = nr_sectors;
|
2012-08-31 16:52:13 +08:00
|
|
|
if (size != geo_size) {
|
|
|
|
if (!info) {
|
|
|
|
strlcat(state->pp_buf, "\n", PAGE_SIZE);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
if (!strcmp(info->type, "ECKD"))
|
|
|
|
if (geo_size < size)
|
|
|
|
size = geo_size;
|
2021-10-19 14:20:24 +08:00
|
|
|
/* else keep size based on nr_sectors */
|
2012-08-31 16:52:13 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
/* first and only partition starts in the first block after the label */
|
|
|
|
offset = labelsect + secperblk;
|
|
|
|
put_partition(state, 1, offset, size - offset);
|
|
|
|
strlcat(state->pp_buf, "\n", PAGE_SIZE);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int find_cms1_partitions(struct parsed_partitions *state,
|
|
|
|
struct hd_geometry *geo,
|
|
|
|
int blocksize,
|
|
|
|
char name[],
|
|
|
|
union label_t *label,
|
|
|
|
sector_t labelsect)
|
|
|
|
{
|
|
|
|
loff_t offset, size;
|
|
|
|
char tmp[64];
|
|
|
|
int secperblk;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* VM style CMS1 labeled disk
|
|
|
|
*/
|
|
|
|
blocksize = label->cms.block_size;
|
|
|
|
secperblk = blocksize >> 9;
|
|
|
|
if (label->cms.disk_offset != 0) {
|
|
|
|
snprintf(tmp, sizeof(tmp), "CMS1/%8s(MDSK):", name);
|
|
|
|
strlcat(state->pp_buf, tmp, PAGE_SIZE);
|
|
|
|
/* disk is reserved minidisk */
|
|
|
|
offset = label->cms.disk_offset * secperblk;
|
|
|
|
size = (label->cms.block_count - 1) * secperblk;
|
|
|
|
} else {
|
|
|
|
snprintf(tmp, sizeof(tmp), "CMS1/%8s:", name);
|
|
|
|
strlcat(state->pp_buf, tmp, PAGE_SIZE);
|
|
|
|
/*
|
|
|
|
* Special case for FBA devices:
|
|
|
|
* If an FBA device is CMS formatted with blocksize > 512 byte
|
|
|
|
* and the DIAG discipline is used, then the CMS label is found
|
|
|
|
* in sector 1 instead of block 1. However, the partition is
|
|
|
|
* still supposed to start in block 2.
|
|
|
|
*/
|
|
|
|
if (labelsect == 1)
|
|
|
|
offset = 2 * secperblk;
|
|
|
|
else
|
|
|
|
offset = labelsect + secperblk;
|
|
|
|
size = label->cms.block_count * secperblk;
|
|
|
|
}
|
|
|
|
|
|
|
|
put_partition(state, 1, offset, size-offset);
|
|
|
|
strlcat(state->pp_buf, "\n", PAGE_SIZE);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
2012-08-31 16:52:13 +08:00
|
|
|
* This is the main function, called by check.c
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
2010-05-16 02:09:30 +08:00
|
|
|
int ibm_partition(struct parsed_partitions *state)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2020-05-19 22:22:59 +08:00
|
|
|
int (*fn)(struct gendisk *disk, dasd_information2_t *info);
|
2021-08-10 23:45:09 +08:00
|
|
|
struct gendisk *disk = state->disk;
|
|
|
|
struct block_device *bdev = disk->part0;
|
2009-03-26 22:23:47 +08:00
|
|
|
int blocksize, res;
|
2021-10-19 14:20:24 +08:00
|
|
|
loff_t offset, size;
|
|
|
|
sector_t nr_sectors;
|
2007-07-10 17:24:11 +08:00
|
|
|
dasd_information2_t *info;
|
2005-04-17 06:20:36 +08:00
|
|
|
struct hd_geometry *geo;
|
|
|
|
char type[5] = {0,};
|
|
|
|
char name[7] = {0,};
|
2010-07-19 15:22:35 +08:00
|
|
|
sector_t labelsect;
|
2012-08-31 16:52:13 +08:00
|
|
|
union label_t *label;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2006-12-07 12:35:16 +08:00
|
|
|
res = 0;
|
2020-05-19 22:22:59 +08:00
|
|
|
if (!disk->fops->getgeo)
|
|
|
|
goto out_exit;
|
|
|
|
fn = symbol_get(dasd_biodasdinfo);
|
2009-05-23 05:17:49 +08:00
|
|
|
blocksize = bdev_logical_block_size(bdev);
|
2006-03-08 13:55:39 +08:00
|
|
|
if (blocksize <= 0)
|
2020-05-19 22:22:59 +08:00
|
|
|
goto out_symbol;
|
2021-10-19 14:20:24 +08:00
|
|
|
nr_sectors = bdev_nr_sectors(bdev);
|
|
|
|
if (nr_sectors == 0)
|
2020-05-19 22:22:59 +08:00
|
|
|
goto out_symbol;
|
2007-07-10 17:24:11 +08:00
|
|
|
info = kmalloc(sizeof(dasd_information2_t), GFP_KERNEL);
|
|
|
|
if (info == NULL)
|
2020-05-19 22:22:59 +08:00
|
|
|
goto out_symbol;
|
2007-07-10 17:24:11 +08:00
|
|
|
geo = kmalloc(sizeof(struct hd_geometry), GFP_KERNEL);
|
|
|
|
if (geo == NULL)
|
2005-04-17 06:20:36 +08:00
|
|
|
goto out_nogeo;
|
2007-07-10 17:24:11 +08:00
|
|
|
label = kmalloc(sizeof(union label_t), GFP_KERNEL);
|
|
|
|
if (label == NULL)
|
2006-01-06 16:19:09 +08:00
|
|
|
goto out_nolab;
|
2020-05-19 22:22:59 +08:00
|
|
|
/* set start if not filled by getgeo function e.g. virtblk */
|
|
|
|
geo->start = get_start_sect(bdev);
|
|
|
|
if (disk->fops->getgeo(bdev, geo))
|
2006-12-07 12:35:16 +08:00
|
|
|
goto out_freeall;
|
2020-10-07 20:40:09 +08:00
|
|
|
if (!fn || fn(disk, info)) {
|
2012-08-31 16:52:13 +08:00
|
|
|
kfree(info);
|
|
|
|
info = NULL;
|
2009-03-26 22:23:47 +08:00
|
|
|
}
|
2006-12-07 12:35:16 +08:00
|
|
|
|
2012-08-31 16:52:13 +08:00
|
|
|
if (find_label(state, info, geo, blocksize, &labelsect, name, type,
|
|
|
|
label)) {
|
|
|
|
if (!strncmp(type, "VOL1", 4)) {
|
|
|
|
res = find_vol1_partitions(state, geo, blocksize, name,
|
|
|
|
label);
|
|
|
|
} else if (!strncmp(type, "LNX1", 4)) {
|
|
|
|
res = find_lnx1_partitions(state, geo, blocksize, name,
|
2021-10-19 14:20:24 +08:00
|
|
|
label, labelsect, nr_sectors,
|
2012-08-31 16:52:13 +08:00
|
|
|
info);
|
|
|
|
} else if (!strncmp(type, "CMS1", 4)) {
|
|
|
|
res = find_cms1_partitions(state, geo, blocksize, name,
|
|
|
|
label, labelsect);
|
2009-03-26 22:23:47 +08:00
|
|
|
}
|
2012-08-31 16:52:13 +08:00
|
|
|
} else if (info) {
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
2012-08-31 16:52:13 +08:00
|
|
|
* ugly but needed for backward compatibility:
|
|
|
|
* If the block device is a DASD (i.e. BIODASDINFO2 works),
|
|
|
|
* then we claim it in any case, even though it has no valid
|
|
|
|
* label. If it has the LDL format, then we simply define a
|
|
|
|
* partition as if it had an LNX1 label.
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
2012-08-31 16:52:13 +08:00
|
|
|
res = 1;
|
|
|
|
if (info->format == DASD_FORMAT_LDL) {
|
|
|
|
strlcat(state->pp_buf, "(nonl)", PAGE_SIZE);
|
2021-10-19 14:20:24 +08:00
|
|
|
size = nr_sectors;
|
2012-08-31 16:52:13 +08:00
|
|
|
offset = (info->label_block + 1) * (blocksize >> 9);
|
|
|
|
put_partition(state, 1, offset, size-offset);
|
|
|
|
strlcat(state->pp_buf, "\n", PAGE_SIZE);
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
res = 0;
|
2006-03-24 19:15:23 +08:00
|
|
|
|
2006-12-07 12:35:16 +08:00
|
|
|
out_freeall:
|
2006-01-06 16:19:09 +08:00
|
|
|
kfree(label);
|
|
|
|
out_nolab:
|
2005-04-17 06:20:36 +08:00
|
|
|
kfree(geo);
|
|
|
|
out_nogeo:
|
|
|
|
kfree(info);
|
2020-05-19 22:22:59 +08:00
|
|
|
out_symbol:
|
2020-10-07 20:40:09 +08:00
|
|
|
if (fn)
|
|
|
|
symbol_put(dasd_biodasdinfo);
|
2006-12-07 12:35:16 +08:00
|
|
|
out_exit:
|
|
|
|
return res;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|