Back to index

lshw  02.16
Functions
lvm.h File Reference
#include "hw.h"
#include "blockio.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

bool scan_lvm (hwNode &n, source &s)

Function Documentation

bool scan_lvm ( hwNode n,
source s 
)

Definition at line 106 of file lvm.cc.

{
  uint8_t sector[BLOCKSIZE];
  label_header lh;

  if(s.blocksize != BLOCKSIZE)
    return false;

  for(uint32_t i=0; i<4; i++)
  {
    if(readlogicalblocks(s, sector, i, 1) != 1)
      return false;
    memcpy(&lh, sector, sizeof(lh));
    lh.sector_xl = le_longlong(sector+8);
    lh.crc_xl = le_long(sector+0x10);
    lh.offset_xl = le_long(sector+0x14);

    if((strncmp((char*)lh.id, LABEL_ID, sizeof(lh.id))==0) &&
      (lh.sector_xl==i) &&
      (lh.offset_xl < BLOCKSIZE) &&
      (calc_crc(INITIAL_CRC, sector+0x14, LABEL_SIZE-0x14)==lh.crc_xl))
    {
      pv_header pvh;

      memcpy(&pvh, sector+lh.offset_xl, sizeof(pvh));
      if(n.getDescription()=="")
        n.setDescription(_("Linux LVM Physical Volume"));
      n.addCapability("lvm2");
      n.setSerial(uuid(pvh.pv_uuid));
      if(n.getCapacity()==0)
        n.setCapacity(n.getSize());
      n.setSize(le_longlong(&pvh.device_size_xl));
      return true;
    }
  }

  (void) &id;                                     // avoid warning "id defined but not used"

  return false;
}

Here is the call graph for this function:

Here is the caller graph for this function: