mirror of
https://github.com/pbatard/rufus.git
synced 2025-05-29 05:55:30 -04:00
[core] added badblock checks (ALPHA)
* also fixed some issues with read_sectors/write_sectors and dropped bufsize parameters
This commit is contained in:
parent
d81525d3f4
commit
e419cf9015
18 changed files with 1219 additions and 80 deletions
60
src/badblocks.h
Normal file
60
src/badblocks.h
Normal file
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* badblocks.c - Bad blocks checker
|
||||
*
|
||||
* Copyright (C) 1992, 1993, 1994 Remy Card <card@masi.ibp.fr>
|
||||
* Laboratoire MASI, Institut Blaise Pascal
|
||||
* Universite Pierre et Marie Curie (Paris VI)
|
||||
*
|
||||
* Copyright 1995, 1996, 1997, 1998, 1999 by Theodore Ts'o
|
||||
* Copyright 1999 by David Beattie
|
||||
* Copyright 2011 by Pete Batard
|
||||
*
|
||||
* This file is based on the minix file system programs fsck and mkfs
|
||||
* written and copyrighted by Linus Torvalds <Linus.Torvalds@cs.helsinki.fi>
|
||||
*
|
||||
* %Begin-Header%
|
||||
* This file may be redistributed under the terms of the GNU Public
|
||||
* License.
|
||||
* %End-Header%
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#ifndef __u32
|
||||
#define __u32 UINT32
|
||||
#endif
|
||||
typedef UINT32 blk_t;
|
||||
typedef struct ext2_struct_u32_list *ext2_badblocks_list;
|
||||
typedef struct ext2_struct_u32_iterate *ext2_badblocks_iterate;
|
||||
typedef struct ext2_struct_u32_list *ext2_u32_list;
|
||||
typedef struct ext2_struct_u32_iterate *ext2_u32_iterate;
|
||||
typedef long errcode_t;
|
||||
|
||||
#define EXT2_ET_NO_MEMORY (2133571398L)
|
||||
#define EXT2_ET_MAGIC_BADBLOCKS_LIST (2133571330L)
|
||||
#define EXT2_ET_MAGIC_BADBLOCKS_ITERATE (2133571331L)
|
||||
|
||||
#define EXT2_CHECK_MAGIC(struct, code) \
|
||||
if ((struct)->magic != (code)) return (code)
|
||||
|
||||
/*
|
||||
* Badblocks list
|
||||
*/
|
||||
struct ext2_struct_u32_list {
|
||||
int magic;
|
||||
int num;
|
||||
int size;
|
||||
__u32 *list;
|
||||
int badblocks_flags;
|
||||
};
|
||||
|
||||
struct ext2_struct_u32_iterate {
|
||||
int magic;
|
||||
ext2_u32_list bb;
|
||||
int ptr;
|
||||
};
|
||||
|
||||
/*
|
||||
* Shared prototypes
|
||||
*/
|
||||
BOOL BadBlocks(HANDLE hPhysicalDrive, ULONGLONG disk_size, int block_size);
|
Loading…
Add table
Add a link
Reference in a new issue