Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) #include <linux/pagemap.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) #include <linux/blkdev.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) #include <linux/genhd.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) #include "../blk.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8)  * add_gd_partition adds a partitions details to the devices partition
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9)  * description.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) struct parsed_partitions {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) 	struct block_device *bdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 	char name[BDEVNAME_SIZE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) 	struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 		sector_t from;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) 		sector_t size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 		int flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 		bool has_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 		struct partition_meta_info info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 	} *parts;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 	int next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 	int limit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 	bool access_beyond_eod;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 	char *pp_buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) typedef struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 	struct page *v;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) } Sector;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) void *read_part_sector(struct parsed_partitions *state, sector_t n, Sector *p);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) static inline void put_dev_sector(Sector p)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	put_page(p.v);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) static inline void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) put_partition(struct parsed_partitions *p, int n, sector_t from, sector_t size)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 	if (n < p->limit) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 		char tmp[1 + BDEVNAME_SIZE + 10 + 1];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 		p->parts[n].from = from;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 		p->parts[n].size = size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 		snprintf(tmp, sizeof(tmp), " %s%d", p->name, n);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 		strlcat(p->pp_buf, tmp, PAGE_SIZE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) /* detection routines go here in alphabetical order: */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) int adfspart_check_ADFS(struct parsed_partitions *state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) int adfspart_check_CUMANA(struct parsed_partitions *state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) int adfspart_check_EESOX(struct parsed_partitions *state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) int adfspart_check_ICS(struct parsed_partitions *state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) int adfspart_check_POWERTEC(struct parsed_partitions *state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) int aix_partition(struct parsed_partitions *state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) int amiga_partition(struct parsed_partitions *state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) int atari_partition(struct parsed_partitions *state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) int cmdline_partition(struct parsed_partitions *state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) int efi_partition(struct parsed_partitions *state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) int ibm_partition(struct parsed_partitions *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) int karma_partition(struct parsed_partitions *state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) int ldm_partition(struct parsed_partitions *state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) int mac_partition(struct parsed_partitions *state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) int msdos_partition(struct parsed_partitions *state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) int osf_partition(struct parsed_partitions *state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) int sgi_partition(struct parsed_partitions *state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) int sun_partition(struct parsed_partitions *state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) int sysv68_partition(struct parsed_partitions *state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) int ultrix_partition(struct parsed_partitions *state);