1
0
Fork 0
alistair23-linux/fs/befs/befs_fs_types.h

257 lines
5.0 KiB
C
Raw Permalink Normal View History

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 08:07:57 -06:00
/* SPDX-License-Identifier: GPL-2.0 */
/*
* fs/befs/befs_fs_types.h
*
* Copyright (C) 2001 Will Dyson (will@cs.earlham.edu)
*
*
*
* from linux/include/linux/befs_fs.h
*
* Copyright (C) 1999 Makoto Kato (m_kato@ga2.so-net.ne.jp)
*
*/
#ifndef _LINUX_BEFS_FS_TYPES
#define _LINUX_BEFS_FS_TYPES
#ifdef __KERNEL__
#include <linux/types.h>
#endif /*__KERNEL__*/
#define PACKED __attribute__ ((__packed__))
/*
* Max name lengths of BFS
*/
#define BEFS_NAME_LEN 255
#define BEFS_SYMLINK_LEN 144
#define BEFS_NUM_DIRECT_BLOCKS 12
#define B_OS_NAME_LENGTH 32
/* The datastream blocks mapped by the double-indirect
* block are always 4 fs blocks long.
* This eliminates the need for linear searches among
* the potentially huge number of indirect blocks
*
* Err. Should that be 4 fs blocks or 4k???
* It matters on large blocksize volumes
*/
#define BEFS_DBLINDIR_BRUN_LEN 4
/*
* Flags of superblock
*/
enum super_flags {
BEFS_BYTESEX_BE,
BEFS_BYTESEX_LE,
BEFS_CLEAN = 0x434c454e,
BEFS_DIRTY = 0x44495254,
BEFS_SUPER_MAGIC1 = 0x42465331, /* BFS1 */
BEFS_SUPER_MAGIC2 = 0xdd121031,
BEFS_SUPER_MAGIC3 = 0x15b6830e,
};
#define BEFS_BYTEORDER_NATIVE 0x42494745
#define BEFS_BYTEORDER_NATIVE_LE ((__force fs32)cpu_to_le32(BEFS_BYTEORDER_NATIVE))
#define BEFS_BYTEORDER_NATIVE_BE ((__force fs32)cpu_to_be32(BEFS_BYTEORDER_NATIVE))
#define BEFS_SUPER_MAGIC BEFS_SUPER_MAGIC1
#define BEFS_SUPER_MAGIC1_LE ((__force fs32)cpu_to_le32(BEFS_SUPER_MAGIC1))
#define BEFS_SUPER_MAGIC1_BE ((__force fs32)cpu_to_be32(BEFS_SUPER_MAGIC1))
/*
* Flags of inode
*/
#define BEFS_INODE_MAGIC1 0x3bbe0ad9
enum inode_flags {
BEFS_INODE_IN_USE = 0x00000001,
BEFS_ATTR_INODE = 0x00000004,
BEFS_INODE_LOGGED = 0x00000008,
BEFS_INODE_DELETED = 0x00000010,
BEFS_LONG_SYMLINK = 0x00000040,
BEFS_PERMANENT_FLAG = 0x0000ffff,
BEFS_INODE_NO_CREATE = 0x00010000,
BEFS_INODE_WAS_WRITTEN = 0x00020000,
BEFS_NO_TRANSACTION = 0x00040000,
};
/*
* On-Disk datastructures of BeFS
*/
typedef u64 __bitwise fs64;
typedef u32 __bitwise fs32;
typedef u16 __bitwise fs16;
typedef u64 befs_off_t;
typedef fs64 befs_time_t;
/* Block runs */
typedef struct {
fs32 allocation_group;
fs16 start;
fs16 len;
} PACKED befs_disk_block_run;
typedef struct {
u32 allocation_group;
u16 start;
u16 len;
} PACKED befs_block_run;
typedef befs_disk_block_run befs_disk_inode_addr;
typedef befs_block_run befs_inode_addr;
/*
* The Superblock Structure
*/
typedef struct {
char name[B_OS_NAME_LENGTH];
fs32 magic1;
fs32 fs_byte_order;
fs32 block_size;
fs32 block_shift;
fs64 num_blocks;
fs64 used_blocks;
fs32 inode_size;
fs32 magic2;
fs32 blocks_per_ag;
fs32 ag_shift;
fs32 num_ags;
fs32 flags;
befs_disk_block_run log_blocks;
fs64 log_start;
fs64 log_end;
fs32 magic3;
befs_disk_inode_addr root_dir;
befs_disk_inode_addr indices;
} PACKED befs_super_block;
/*
* Note: the indirect and dbl_indir block_runs may
* be longer than one block!
*/
typedef struct {
befs_disk_block_run direct[BEFS_NUM_DIRECT_BLOCKS];
fs64 max_direct_range;
befs_disk_block_run indirect;
fs64 max_indirect_range;
befs_disk_block_run double_indirect;
fs64 max_double_indirect_range;
fs64 size;
} PACKED befs_disk_data_stream;
typedef struct {
befs_block_run direct[BEFS_NUM_DIRECT_BLOCKS];
befs_off_t max_direct_range;
befs_block_run indirect;
befs_off_t max_indirect_range;
befs_block_run double_indirect;
befs_off_t max_double_indirect_range;
befs_off_t size;
} PACKED befs_data_stream;
/* Attribute */
typedef struct {
fs32 type;
fs16 name_size;
fs16 data_size;
char name[1];
} PACKED befs_small_data;
/* Inode structure */
typedef struct {
fs32 magic1;
befs_disk_inode_addr inode_num;
fs32 uid;
fs32 gid;
fs32 mode;
fs32 flags;
befs_time_t create_time;
befs_time_t last_modified_time;
befs_disk_inode_addr parent;
befs_disk_inode_addr attributes;
fs32 type;
fs32 inode_size;
fs32 etc; /* not use */
union {
befs_disk_data_stream datastream;
char symlink[BEFS_SYMLINK_LEN];
} data;
fs32 pad[4]; /* not use */
befs_small_data small_data[1];
} PACKED befs_inode;
/*
* B+tree superblock
*/
#define BEFS_BTREE_MAGIC 0x69f6c2e8
enum btree_types {
BTREE_STRING_TYPE = 0,
BTREE_INT32_TYPE = 1,
BTREE_UINT32_TYPE = 2,
BTREE_INT64_TYPE = 3,
BTREE_UINT64_TYPE = 4,
BTREE_FLOAT_TYPE = 5,
BTREE_DOUBLE_TYPE = 6
};
typedef struct {
fs32 magic;
fs32 node_size;
fs32 max_depth;
fs32 data_type;
fs64 root_node_ptr;
fs64 free_node_ptr;
fs64 max_size;
} PACKED befs_disk_btree_super;
typedef struct {
u32 magic;
u32 node_size;
u32 max_depth;
u32 data_type;
befs_off_t root_node_ptr;
befs_off_t free_node_ptr;
befs_off_t max_size;
} PACKED befs_btree_super;
/*
* Header structure of each btree node
*/
typedef struct {
fs64 left;
fs64 right;
fs64 overflow;
fs16 all_key_count;
fs16 all_key_length;
} PACKED befs_btree_nodehead;
typedef struct {
befs_off_t left;
befs_off_t right;
befs_off_t overflow;
u16 all_key_count;
u16 all_key_length;
} PACKED befs_host_btree_nodehead;
#endif /* _LINUX_BEFS_FS_TYPES */