?login_element?

Subversion Repositories NedoOS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. #ifndef DEVICE_INFO_H
  2. #define DEVICE_INFO_H
  3.  
  4. enum device_type {
  5.     TYPE_UNKNOWN,   /* type could not be determined */
  6.     TYPE_BAD,       /* neither file nor block device */
  7.     TYPE_FILE,      /* image file rather than device */
  8.     TYPE_VIRTUAL,   /* block devices like LVM or RAID volumes */
  9.     TYPE_REMOVABLE, /* removable disk device */
  10.     TYPE_FIXED      /* fixed disk device */
  11. };
  12.  
  13. struct device_info {
  14.     enum device_type type;
  15.  
  16.     /*
  17.      * partition number if detected
  18.      * 0  = whole disk device (including unpartitioned image file)
  19.      * -1 = could not be determined
  20.      */
  21.     int partition;
  22.  
  23.     /*
  24.      * whether partitions or device mapper devices or any other kind of
  25.      * children use this device
  26.      *  1 = yes
  27.      *  0 = no
  28.      * -1 = could not be determined
  29.      */
  30.     int has_children;
  31.  
  32.     /*
  33.      * detected geometry, or -1 if unknown
  34.      */
  35.     int geom_heads;
  36.     int geom_sectors;
  37.     long long geom_start;
  38.     long long geom_size;
  39.  
  40.     /*
  41.      * detected sector size or -1 if unknown
  42.      */
  43.     int sector_size;
  44.  
  45.     /*
  46.      * size in bytes, or -1 if unknown
  47.      */
  48.     long long size;
  49. };
  50.  
  51.  
  52. extern int device_info_verbose;
  53.  
  54. int get_device_info(int fd, struct device_info *info);
  55. int is_device_mounted(const char *path);
  56.  
  57. #endif
  58.