Back to index

lshw  02.16
Defines | Functions
blockio.cc File Reference
#include "version.h"
#include "blockio.h"
#include "osutils.h"
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdint.h>

Go to the source code of this file.

Defines

#define _LARGEFILE_SOURCE
#define _FILE_OFFSET_BITS   64

Functions

 __ID ("@(#) $Id: blockio.cc 2433 2012-01-10 22:01:30Z lyonel $")
ssize_t readlogicalblocks (source &s, void *buffer, long long pos, long long count)

Define Documentation

#define _FILE_OFFSET_BITS   64

Definition at line 8 of file blockio.cc.

Definition at line 7 of file blockio.cc.


Function Documentation

__ID ( "@(#) $Id: blockio.cc 2433 2012-01-10 22:01:30Z lyonel $"  )
ssize_t readlogicalblocks ( source s,
void *  buffer,
long long  pos,
long long  count 
)

Definition at line 23 of file blockio.cc.

{
  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);

  if(result!=count*s.blocksize)
    return 0;
  else
    return count;
}

Here is the caller graph for this function: