chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove duplicate includes
[elogind.git]
/
src
/
udev
/
mtd_probe
/
probe_smartmedia.c
diff --git
a/src/udev/mtd_probe/probe_smartmedia.c
b/src/udev/mtd_probe/probe_smartmedia.c
index b3cdefc63399f5127570e63b4605056082c57b2c..a007ccee2fca0e5be7e090acd22b99c5c588d823 100644
(file)
--- a/
src/udev/mtd_probe/probe_smartmedia.c
+++ b/
src/udev/mtd_probe/probe_smartmedia.c
@@
-26,7
+26,6
@@
#include <fcntl.h>
#include <unistd.h>
#include <stdint.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdint.h>
-#include <stdlib.h>
#include "mtd_probe.h"
static const uint8_t cis_signature[] = {
#include "mtd_probe.h"
static const uint8_t cis_signature[] = {
@@
-36,7
+35,13
@@
static const uint8_t cis_signature[] = {
void probe_smart_media(int mtd_fd, mtd_info_t* info)
{
void probe_smart_media(int mtd_fd, mtd_info_t* info)
{
+ int sector_size;
+ int block_size;
+ int size_in_megs;
+ int spare_count;
char* cis_buffer = malloc(SM_SECTOR_SIZE);
char* cis_buffer = malloc(SM_SECTOR_SIZE);
+ int offset;
+ int cis_found = 0;
if (!cis_buffer)
return;
if (!cis_buffer)
return;
@@
-44,11
+49,9
@@
void probe_smart_media(int mtd_fd, mtd_info_t* info)
if (info->type != MTD_NANDFLASH)
goto exit;
if (info->type != MTD_NANDFLASH)
goto exit;
- int sector_size = info->writesize;
- int block_size = info->erasesize;
- int size_in_megs = info->size / (1024 * 1024);
- int spare_count;
-
+ sector_size = info->writesize;
+ block_size = info->erasesize;
+ size_in_megs = info->size / (1024 * 1024);
if (sector_size != SM_SECTOR_SIZE && sector_size != SM_SMALL_PAGE)
goto exit;
if (sector_size != SM_SECTOR_SIZE && sector_size != SM_SMALL_PAGE)
goto exit;
@@
-66,13
+69,8
@@
void probe_smart_media(int mtd_fd, mtd_info_t* info)
break;
}
break;
}
-
- int offset;
- int cis_found = 0;
-
for (offset = 0 ; offset < block_size * spare_count ;
offset += sector_size) {
for (offset = 0 ; offset < block_size * spare_count ;
offset += sector_size) {
-
lseek(mtd_fd, SEEK_SET, offset);
if (read(mtd_fd, cis_buffer, SM_SECTOR_SIZE) == SM_SECTOR_SIZE){
cis_found = 1;
lseek(mtd_fd, SEEK_SET, offset);
if (read(mtd_fd, cis_buffer, SM_SECTOR_SIZE) == SM_SECTOR_SIZE){
cis_found = 1;