cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

check.h (2118B)


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