LCOV - code coverage report
Current view: top level - spdk/module/bdev/gpt - gpt.h (source / functions) Hit Total Coverage
Test: Combined Lines: 1 1 100.0 %
Date: 2024-07-15 10:27:24 Functions: 1 1 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 1 2 50.0 %

           Branch data     Line data    Source code
       1                 :            : /*   SPDX-License-Identifier: BSD-3-Clause
       2                 :            :  *   Copyright (C) 2017 Intel Corporation.
       3                 :            :  *   All rights reserved.
       4                 :            :  */
       5                 :            : 
       6                 :            : /** \file
       7                 :            :  * GPT internal Interface
       8                 :            :  */
       9                 :            : 
      10                 :            : #ifndef SPDK_INTERNAL_GPT_H
      11                 :            : #define SPDK_INTERNAL_GPT_H
      12                 :            : 
      13                 :            : #include "spdk/stdinc.h"
      14                 :            : 
      15                 :            : #include "spdk/gpt_spec.h"
      16                 :            : #include "spdk/log.h"
      17                 :            : 
      18                 :            : #define SPDK_GPT_PART_TYPE_GUID     SPDK_GPT_GUID(0x6527994e, 0x2c5a, 0x4eec, 0x9613, 0x8f5944074e8b)
      19                 :            : 
      20                 :            : /* PART_TYPE_GUID_OLD partitions will be constructed as bdevs with one fewer block than expected.
      21                 :            :  * See GitHub issue #2801.
      22                 :            :  */
      23                 :            : #ifdef REGISTER_GUID_DEPRECATION
      24                 :            : /* Register the deprecation in the header file, to make it clear to readers that this GUID
      25                 :            :  * shouldn't be used for new SPDK GPT partitions.  We will never actually log this deprecation
      26                 :            :  * though, since we are not recommending that users try to migrate existing partitions with the
      27                 :            :  * old GUID to the new GUID. Wrap it in this REGISTER_GUID_DEPRECATION flag to avoid defining
      28                 :            :  * this deprecation in multiple compilation units.
      29                 :            :  */
      30         [ -  + ]:       2285 : SPDK_LOG_DEPRECATION_REGISTER(old_gpt_guid, "old gpt guid", "Never", 0)
      31                 :            : #endif
      32                 :            : #define SPDK_GPT_PART_TYPE_GUID_OLD SPDK_GPT_GUID(0x7c5222bd, 0x8f5d, 0x4087, 0x9c00, 0xbf9843c7b58c)
      33                 :            : 
      34                 :            : #define SPDK_GPT_BUFFER_SIZE 32768  /* 32KB */
      35                 :            : #define SPDK_GPT_GUID_EQUAL(x,y) (memcmp(x, y, sizeof(struct spdk_gpt_guid)) == 0)
      36                 :            : 
      37                 :            : enum spdk_gpt_parse_phase {
      38                 :            :         SPDK_GPT_PARSE_PHASE_INVALID = 0,
      39                 :            :         SPDK_GPT_PARSE_PHASE_PRIMARY,
      40                 :            :         SPDK_GPT_PARSE_PHASE_SECONDARY,
      41                 :            : };
      42                 :            : 
      43                 :            : struct spdk_gpt {
      44                 :            :         uint8_t parse_phase;
      45                 :            :         unsigned char *buf;
      46                 :            :         uint64_t buf_size;
      47                 :            :         uint64_t lba_start;
      48                 :            :         uint64_t lba_end;
      49                 :            :         uint64_t total_sectors;
      50                 :            :         uint32_t sector_size;
      51                 :            :         struct spdk_gpt_header *header;
      52                 :            :         struct spdk_gpt_partition_entry *partitions;
      53                 :            : };
      54                 :            : 
      55                 :            : int gpt_parse_mbr(struct spdk_gpt *gpt);
      56                 :            : int gpt_parse_partition_table(struct spdk_gpt *gpt);
      57                 :            : 
      58                 :            : #endif  /* SPDK_INTERNAL_GPT_H */

Generated by: LCOV version 1.14