static long long process_device(PedDevice *dev) { if (dev->read_only) return -1; if (is_cdrom(dev->path) || is_floppy(dev->path)) return -1; /* Exclude compcache (http://code.google.com/p/compcache/) */ if (strstr(dev->path, "/dev/ramzswap") != NULL || strstr(dev->path, "/dev/zram") != NULL) return -1; return dev->length * dev->sector_size; }
void process_device(PedDevice *dev) { if (dev->read_only) return; if (is_cdrom(dev->path) || is_floppy(dev->path)) return; /* Exclude compcache (http://code.google.com/p/compcache/) */ if (strstr(dev->path, "/dev/ccache") != NULL) return; printf("%s\t%lli\t%s\n", dev->path, dev->length * PED_SECTOR_SIZE_DEFAULT, dev->model); }
void process_device(PedDevice *dev) { if (dev->read_only) return; if (is_cdrom(dev->path) || is_floppy(dev->path)) return; /* Exclude compcache (http://code.google.com/p/compcache/) */ if (strstr(dev->path, "/dev/ramzswap") != NULL || strstr(dev->path, "/dev/zram") != NULL) return; printf("%s\t%lli\t%s\n", dev->path, dev->length * dev->sector_size, dev->model); }
int sanity_check(FILE *fp, const char *szPath, int iBr, int bPrintMessages) { int bIsDiskDevice = is_disk_device(fp); int bIsFloppy = is_floppy(fp); int bIsPartition = is_partition(fp); switch(iBr) { case MBR_WIN7: case MBR_VISTA: case MBR_2000: case MBR_95B: case MBR_DOS: case MBR_SYSLINUX: case MBR_GPT_SYSLINUX: case MBR_ZERO: { if( ! bIsDiskDevice ) { if(bPrintMessages) { printf(_("%s does not seem to be a disk device,\n"), szPath); printf( _("use the switch -f to force writing of a master boot record\n")); } return 0; } if( bIsFloppy ) { if(bPrintMessages) { printf(_("%s seems to be a floppy disk device,\n"), szPath); printf( _("use the switch -f to force writing of a master boot record\n")); } return 0; } if( bIsPartition ) { if(bPrintMessages) { printf(_("%s seems to be a disk partition device,\n"), szPath); printf( _("use the switch -f to force writing of a master boot record\n")); } return 0; } } break; case FAT12_BR: { if( ! bIsFloppy ) { if(bPrintMessages) { printf(_("%s does not seem to be a floppy disk device,\n"), szPath); printf( _("use the switch -f to force writing of a FAT12 boot record\n")); } return 0; } if( ! is_fat_12_fs(fp)) { if(bPrintMessages) { printf(_("%s does not seem to have a FAT12 file system,\n"), szPath); printf( _("use the switch -f to force writing of a FAT12 boot record\n")); } return 0; } } break; case FAT16_BR: case FAT16FD_BR: { if( ! bIsPartition ) { if(bPrintMessages) { printf(_("%s does not seem to be a disk partition device,\n"), szPath); printf( _("use the switch -f to force writing of a FAT16 boot record\n")); } return 0; } if( ! is_fat_16_fs(fp)) { if(bPrintMessages) { printf(_("%s does not seem to have a FAT16 file system,\n"), szPath); printf( _("use the switch -f to force writing of a FAT16 boot record\n")); } return 0; } } break; case FAT32_BR: case FAT32NT_BR: case FAT32FD_BR: { if( ! bIsPartition ) { if(bPrintMessages) { printf(_("%s does not seem to be a disk partition device,\n"), szPath); printf( _("use the switch -f to force writing of a FAT32 boot record\n")); } return 0; } if( ! is_fat_32_fs(fp)) { if(bPrintMessages) { printf(_("%s does not seem to have a FAT32 file system,\n"), szPath); printf( _("use the switch -f to force writing of a FAT32 boot record\n")); } return 0; } } break; case NTFS_BR: { if( ! bIsPartition ) { if(bPrintMessages) { printf(_("%s does not seem to be a disk partition device,\n"), szPath); printf( _("use the switch -f to force writing of a NTFS boot record\n")); } return 0; } if( ! is_ntfs_fs(fp)) { if(bPrintMessages) { printf(_("%s does not seem to have a NTFS file system,\n"), szPath); printf( _("use the switch -f to force writing of a NTFS boot record\n")); } return 0; } } break; default: { if(bPrintMessages) { printf(_("Whoops, internal error, unknown boot record\n")); } return 0; } break; } return 1; } /* sanity_check */