Back to index

lshw  02.16
Classes | Defines | Functions | Variables File Reference
#include "version.h"
#include "config.h"
#include "lvm.h"
#include "osutils.h"
#include <string.h>

Go to the source code of this file.


struct  label_header
struct  disk_locn
struct  pv_header
struct  label


#define LABEL_SIZE   BLOCKSIZE /* Think very carefully before changing this */
#define INITIAL_CRC   0xf597a6cf
#define ID_LEN   32


 __ID ("@(#) $Id: 2433 2012-01-10 22:01:30Z lyonel $")
struct label_header __attribute__ ((packed))
uint32_t calc_crc (uint32_t initial, void *buf, uint32_t size)
static string uuid (void *s)
bool scan_lvm (hwNode &n, source &s)


uint8_t id [8] = "@(#) $Id: 2433 2012-01-10 22:01:30Z lyonel $"
uint64_t sector_xl
uint32_t crc_xl
uint32_t offset_xl
uint8_t type [8]
uint64_t offset
uint64_t size
uint8_t pv_uuid [ID_LEN]
uint64_t device_size_xl
struct label __attribute__

Class Documentation

struct label_header

Definition at line 26 of file

Class Members
uint32_t crc_xl
uint8_t id
uint32_t offset_xl
uint64_t sector_xl
uint8_t type
struct disk_locn

Definition at line 36 of file

Class Members
uint64_t offset
uint64_t size
struct pv_header

Definition at line 46 of file

Class Members
uint64_t device_size_xl
uint8_t pv_uuid
struct label

Definition at line 59 of file

Class Members
void * info
struct labeller * labeller
uint64_t sector
char type

Define Documentation

#define ID_LEN   32

Definition at line 42 of file

#define INITIAL_CRC   0xf597a6cf

Definition at line 23 of file


Definition at line 20 of file


Definition at line 22 of file

#define LABEL_SIZE   BLOCKSIZE /* Think very carefully before changing this */

Definition at line 21 of file

Function Documentation

struct label_header __attribute__ ( (packed)  )
__ID ( "@(#) $Id: 2433 2012-01-10 22:01:30Z lyonel $"  )
uint32_t calc_crc ( uint32_t  initial,
void *  buf,
uint32_t  size 

Definition at line 68 of file

  static const uint32_t crctab[] =
    0x00000000, 0x1db71064, 0x3b6e20c8, 0x26d930ac,
    0x76dc4190, 0x6b6b51f4, 0x4db26158, 0x5005713c,
    0xedb88320, 0xf00f9344, 0xd6d6a3e8, 0xcb61b38c,
    0x9b64c2b0, 0x86d3d2d4, 0xa00ae278, 0xbdbdf21c
  uint32_t i, crc = initial;
  uint8_t *data = (uint8_t *) buf;

  for(i = 0; i < size; i++)
    crc ^= *data++;
    crc = (crc >> 4) ^ crctab[crc & 0xf];
    crc = (crc >> 4) ^ crctab[crc & 0xf];
  return crc;

Here is the caller graph for this function:

bool scan_lvm ( hwNode n,
source s 

Definition at line 106 of file

  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*), LABEL_ID, sizeof( &&
      (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));
        n.setDescription(_("Linux LVM Physical Volume"));
      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:

static string uuid ( void *  s) [static]

Definition at line 92 of file

  char * id = (char*)s;

  return string(id   ,6)+"-"+
    string(id+ 6,4)+"-"+

Here is the caller graph for this function:

Variable Documentation

uint32_t crc_xl

Definition at line 36 of file

uint64_t device_size_xl

Definition at line 60 of file

static const char * id = "@(#) $Id: 2433 2012-01-10 22:01:30Z lyonel $"

Definition at line 34 of file

uint64_t offset

Definition at line 41 of file

uint32_t offset_xl

Definition at line 37 of file

uint8_t pv_uuid[ID_LEN]

Definition at line 57 of file

uint64_t sector_xl

Definition at line 35 of file

uint64_t size

Definition at line 42 of file

uint8_t type[8]

Definition at line 38 of file