dosfstools  4.2
About: dosfstools are utilities to create, check and label (MS-DOS) FAT filesystems.
  Fossies Dox: dosfstools-4.2.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

blkdev.h File Reference
#include <sys/types.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <unistd.h>
Include dependency graph for blkdev.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  hd_geometry
 

Macros

#define DEFAULT_SECTOR_SIZE   512
 
#define SCSI_TYPE_DISK   0x00
 
#define SCSI_TYPE_TAPE   0x01
 
#define SCSI_TYPE_PRINTER   0x02
 
#define SCSI_TYPE_PROCESSOR   0x03 /* HP scanners use this */
 
#define SCSI_TYPE_WORM   0x04 /* Treated as ROM by our system */
 
#define SCSI_TYPE_ROM   0x05
 
#define SCSI_TYPE_SCANNER   0x06
 
#define SCSI_TYPE_MOD   0x07 /* Magneto-optical disk - treated as SCSI_TYPE_DISK */
 
#define SCSI_TYPE_MEDIUM_CHANGER   0x08
 
#define SCSI_TYPE_COMM   0x09 /* Communications device */
 
#define SCSI_TYPE_RAID   0x0c
 
#define SCSI_TYPE_ENCLOSURE   0x0d /* Enclosure Services Device */
 
#define SCSI_TYPE_RBC   0x0e
 
#define SCSI_TYPE_OSD   0x11
 
#define SCSI_TYPE_NO_LUN   0x7f
 

Functions

int is_blkdev (int fd)
 
off_t blkdev_find_size (int fd)
 
int blkdev_get_size (int fd, unsigned long long *bytes)
 
int blkdev_get_sectors (int fd, unsigned long long *sectors)
 
int blkdev_get_sector_size (int fd, int *sector_size)
 
int blkdev_is_misaligned (int fd)
 
int blkdev_get_physector_size (int fd, int *sector_size)
 
int blkdev_is_cdrom (int fd)
 
int blkdev_get_geometry (int fd, unsigned int *h, unsigned int *s)
 
int blkdev_get_start (int fd, dev_t rdev, unsigned long long *s)
 
const char * blkdev_scsi_type_to_name (int type)
 

Macro Definition Documentation

◆ DEFAULT_SECTOR_SIZE

#define DEFAULT_SECTOR_SIZE   512

Definition at line 22 of file blkdev.h.

◆ SCSI_TYPE_COMM

#define SCSI_TYPE_COMM   0x09 /* Communications device */

Definition at line 138 of file blkdev.h.

◆ SCSI_TYPE_DISK

#define SCSI_TYPE_DISK   0x00

Definition at line 129 of file blkdev.h.

◆ SCSI_TYPE_ENCLOSURE

#define SCSI_TYPE_ENCLOSURE   0x0d /* Enclosure Services Device */

Definition at line 140 of file blkdev.h.

◆ SCSI_TYPE_MEDIUM_CHANGER

#define SCSI_TYPE_MEDIUM_CHANGER   0x08

Definition at line 137 of file blkdev.h.

◆ SCSI_TYPE_MOD

#define SCSI_TYPE_MOD   0x07 /* Magneto-optical disk - treated as SCSI_TYPE_DISK */

Definition at line 136 of file blkdev.h.

◆ SCSI_TYPE_NO_LUN

#define SCSI_TYPE_NO_LUN   0x7f

Definition at line 143 of file blkdev.h.

◆ SCSI_TYPE_OSD

#define SCSI_TYPE_OSD   0x11

Definition at line 142 of file blkdev.h.

◆ SCSI_TYPE_PRINTER

#define SCSI_TYPE_PRINTER   0x02

Definition at line 131 of file blkdev.h.

◆ SCSI_TYPE_PROCESSOR

#define SCSI_TYPE_PROCESSOR   0x03 /* HP scanners use this */

Definition at line 132 of file blkdev.h.

◆ SCSI_TYPE_RAID

#define SCSI_TYPE_RAID   0x0c

Definition at line 139 of file blkdev.h.

◆ SCSI_TYPE_RBC

#define SCSI_TYPE_RBC   0x0e

Definition at line 141 of file blkdev.h.

◆ SCSI_TYPE_ROM

#define SCSI_TYPE_ROM   0x05

Definition at line 134 of file blkdev.h.

◆ SCSI_TYPE_SCANNER

#define SCSI_TYPE_SCANNER   0x06

Definition at line 135 of file blkdev.h.

◆ SCSI_TYPE_TAPE

#define SCSI_TYPE_TAPE   0x01

Definition at line 130 of file blkdev.h.

◆ SCSI_TYPE_WORM

#define SCSI_TYPE_WORM   0x04 /* Treated as ROM by our system */

Definition at line 133 of file blkdev.h.

Function Documentation

◆ blkdev_find_size()

off_t blkdev_find_size ( int  fd)

Definition at line 56 of file blkdev.c.

References blkdev_valid_offset(), and fd.

Referenced by blkdev_get_size().

◆ blkdev_get_geometry()

int blkdev_get_geometry ( int  fd,
unsigned int *  h,
unsigned int *  s 
)

Definition at line 288 of file blkdev.c.

References fd, hd_geometry::heads, and hd_geometry::sectors.

Referenced by get_block_geometry().

◆ blkdev_get_physector_size()

int blkdev_get_physector_size ( int  fd,
int *  sector_size 
)

Definition at line 231 of file blkdev.c.

References DEFAULT_SECTOR_SIZE, fd, and sector_size.

◆ blkdev_get_sector_size()

int blkdev_get_sector_size ( int  fd,
int *  sector_size 
)

Definition at line 204 of file blkdev.c.

References DEFAULT_SECTOR_SIZE, fd, and sector_size.

Referenced by get_sector_size().

◆ blkdev_get_sectors()

int blkdev_get_sectors ( int  fd,
unsigned long long *  sectors 
)

Definition at line 186 of file blkdev.c.

References blkdev_get_size(), and fd.

◆ blkdev_get_size()

int blkdev_get_size ( int  fd,
unsigned long long *  bytes 
)

Definition at line 86 of file blkdev.c.

References blkdev_find_size(), fd, get_linux_version(), and KERNEL_VERSION.

Referenced by blkdev_get_sectors(), and get_block_device_size().

◆ blkdev_get_start()

int blkdev_get_start ( int  fd,
dev_t  rdev,
unsigned long long *  s 
)

Definition at line 323 of file blkdev.c.

References fd, and hd_geometry::start.

Referenced by get_block_geometry().

◆ blkdev_is_cdrom()

int blkdev_is_cdrom ( int  fd)

Definition at line 265 of file blkdev.c.

References fd.

◆ blkdev_is_misaligned()

int blkdev_is_misaligned ( int  fd)

Definition at line 247 of file blkdev.c.

References fd.

◆ blkdev_scsi_type_to_name()

◆ is_blkdev()

int is_blkdev ( int  fd)

Definition at line 49 of file blkdev.c.

References fd.