LCOV - code coverage report
Current view: top level - plugins/nvme - nvme.c (source / functions) Coverage Total Hit
Test: libblockdev Coverage Report Lines: 76.9 % 13 10
Test Date: 2026-01-23 09:12:16 Functions: 100.0 % 3 3
Legend: Lines: hit not hit

            Line data    Source code
       1              : /*
       2              :  * Copyright (C) 2014-2021 Red Hat, Inc.
       3              :  *
       4              :  * This library is free software; you can redistribute it and/or
       5              :  * modify it under the terms of the GNU Lesser General Public
       6              :  * License as published by the Free Software Foundation; either
       7              :  * version 2.1 of the License, or (at your option) any later version.
       8              :  *
       9              :  * This library is distributed in the hope that it will be useful,
      10              :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      11              :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      12              :  * Lesser General Public License for more details.
      13              :  *
      14              :  * You should have received a copy of the GNU Lesser General Public
      15              :  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
      16              :  *
      17              :  * Author: Tomas Bzatek <tbzatek@redhat.com>
      18              :  */
      19              : 
      20              : #include <glib.h>
      21              : #include <string.h>
      22              : #include <stdio.h>
      23              : #include <unistd.h>
      24              : #include <sys/ioctl.h>
      25              : #include <sys/stat.h>
      26              : #include <errno.h>
      27              : #include <fcntl.h>
      28              : #include <malloc.h>
      29              : 
      30              : #include <libnvme.h>
      31              : 
      32              : #include <blockdev/utils.h>
      33              : #include <check_deps.h>
      34              : #include "nvme.h"
      35              : #include "nvme-private.h"
      36              : 
      37              : /**
      38              :  * SECTION: nvme
      39              :  * @short_description: plugin for NVMe device reporting and management
      40              :  * @title: NVMe
      41              :  * @include: nvme.h
      42              :  *
      43              :  * A plugin for NVMe device reporting and management, based around libnvme.
      44              :  */
      45              : 
      46              : 
      47              : /**
      48              :  * bd_nvme_init:
      49              :  *
      50              :  * Initializes the plugin. **This function is called automatically by the
      51              :  * library's initialization functions.**
      52              :  *
      53              :  */
      54            3 : gboolean bd_nvme_init (void) {
      55              :     /* nothing to do here */
      56            3 :     return TRUE;
      57              : };
      58              : 
      59              : /**
      60              :  * bd_nvme_close:
      61              :  *
      62              :  * Cleans up after the plugin. **This function is called automatically by the
      63              :  * library's functions that unload it.**
      64              :  *
      65              :  */
      66            3 : void bd_nvme_close (void) {
      67              :     /* nothing to do here */
      68            3 : }
      69              : 
      70              : /**
      71              :  * bd_nvme_is_tech_avail:
      72              :  * @tech: the queried tech
      73              :  * @mode: a bit mask of queried modes of operation (#BDNVMETechMode) for @tech
      74              :  * @error: (out) (nullable): place to store error (details about why the @tech-@mode combination is not available)
      75              :  *
      76              :  * Returns: whether the @tech-@mode combination is available -- supported by the
      77              :  *          plugin implementation and having all the runtime dependencies available
      78              :  */
      79            2 : gboolean bd_nvme_is_tech_avail (BDNVMETech tech, G_GNUC_UNUSED guint64 mode, GError **error) {
      80            2 :     switch (tech) {
      81            1 :         case BD_NVME_TECH_NVME:
      82            1 :             return TRUE;
      83            1 :         case BD_NVME_TECH_FABRICS:
      84            1 :             return TRUE;
      85            0 :         default:
      86            0 :             g_set_error (error, BD_NVME_ERROR, BD_NVME_ERROR_TECH_UNAVAIL, "Unknown technology");
      87            0 :             return FALSE;
      88              :     }
      89              : }
        

Generated by: LCOV version 2.0-1