Back to index

lshw  02.16
Classes | Defines | Functions
blockio.h File Reference
#include <stdint.h>
#include <unistd.h>
#include <string>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


struct  source


#define BLOCKSIZE   512


ssize_t readlogicalblocks (source &s, void *buffer, long long pos, long long count)

Class Documentation

struct source

Definition at line 10 of file blockio.h.

Collaboration diagram for source:
Class Members
ssize_t blocksize
string diskname
int fd
long long offset
long long size

Define Documentation

#define BLOCKSIZE   512

Definition at line 8 of file blockio.h.

Function Documentation

ssize_t readlogicalblocks ( source s,
void *  buffer,
long long  pos,
long long  count 

Definition at line 23 of file

  long long result = 0;

  memset(buffer, 0, count*s.blocksize);

                                                  /* attempt to read past the end of the section */
  if((s.size>0) && ((pos+count)*s.blocksize>s.size)) return 0;

  result = lseek(s.fd, s.offset + pos*s.blocksize, SEEK_SET);

  if(result == -1) return 0;

  result = read(s.fd, buffer, count*s.blocksize);

    return 0;
    return count;

Here is the caller graph for this function: