diff options
author | H. Peter Anvin <hpa@zytor.com> | 2006-05-03 17:21:14 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2006-05-03 17:21:14 -0700 |
commit | f8c463722022008c8412a69f90576d2bf38818ed (patch) | |
tree | cb81cefc0f146741ca837344b1b493e1397f709f | |
parent | 09806eda585a00fb24e4b1e8aea0154ee5dc1502 (diff) | |
download | syslinux-f8c463722022008c8412a69f90576d2bf38818ed.tar.gz |
libfat: stealth whitespace cleanup
-rw-r--r-- | libfat/cache.c | 10 | ||||
-rw-r--r-- | libfat/fat.h | 7 | ||||
-rw-r--r-- | libfat/fatchain.c | 11 | ||||
-rw-r--r-- | libfat/libfat.h | 3 | ||||
-rw-r--r-- | libfat/libfatint.h | 4 | ||||
-rw-r--r-- | libfat/open.c | 16 | ||||
-rw-r--r-- | libfat/searchdir.c | 8 | ||||
-rw-r--r-- | libfat/ulint.h | 6 |
8 files changed, 28 insertions, 37 deletions
diff --git a/libfat/cache.c b/libfat/cache.c index cc6c57fe..48c54be9 100644 --- a/libfat/cache.c +++ b/libfat/cache.c @@ -1,6 +1,6 @@ #ident "$Id$" /* ----------------------------------------------------------------------- * - * + * * Copyright 2004 H. Peter Anvin - All Rights Reserved * * This program is free software; you can redistribute it and/or modify @@ -34,12 +34,12 @@ void * libfat_get_sector(struct libfat_filesystem *fs, libfat_sector_t n) if ( !ls ) { libfat_flush(fs); ls = malloc(sizeof(struct libfat_sector)); - + if ( !ls ) return NULL; /* Can't allocate memory */ } - if ( fs->read(fs->readptr, ls->data, LIBFAT_SECTOR_SIZE, n) + if ( fs->read(fs->readptr, ls->data, LIBFAT_SECTOR_SIZE, n) != LIBFAT_SECTOR_SIZE ) { free(ls); return NULL; /* I/O error */ @@ -64,7 +64,3 @@ void libfat_flush(struct libfat_filesystem *fs) free(ls); } } - - - - diff --git a/libfat/fat.h b/libfat/fat.h index 921f9f4a..5da9ec7e 100644 --- a/libfat/fat.h +++ b/libfat/fat.h @@ -1,6 +1,6 @@ #ident "$Id$" /* ----------------------------------------------------------------------- * - * + * * Copyright 2001-2004 H. Peter Anvin - All Rights Reserved * * This program is free software; you can redistribute it and/or modify @@ -47,10 +47,10 @@ struct fat_bootsect { le32_t bsVolumeID; /* Volume serial number */ char bsVolumeLabel[11]; /* Volume name */ char bsFileSysType[8]; /* File system type */ - + le8_t bsCode[448]; /* Boot sector code */ } fat16; - + /* FAT32 */ struct { le32_t bpb_fatsz32; /* Sectors/FAT */ @@ -109,4 +109,3 @@ struct fat_vfat_slot }; #endif /* FAT_H */ - diff --git a/libfat/fatchain.c b/libfat/fatchain.c index 6c640bed..cc8152f7 100644 --- a/libfat/fatchain.c +++ b/libfat/fatchain.c @@ -1,6 +1,6 @@ #ident "$Id$" /* ----------------------------------------------------------------------- * - * + * * Copyright 2004 H. Peter Anvin - All Rights Reserved * * This program is free software; you can redistribute it and/or modify @@ -107,7 +107,7 @@ libfat_sector_t libfat_nextsector(struct libfat_filesystem *fs, if ( !fsdata ) return -1; nextcluster = read16((le16_t *)&fsdata[fatoffset & LIBFAT_SECTOR_MASK]); - + if ( nextcluster >= 0x0FFF8 ) return 0; break; @@ -120,17 +120,14 @@ libfat_sector_t libfat_nextsector(struct libfat_filesystem *fs, return -1; nextcluster = read32((le32_t *)&fsdata[fatoffset & LIBFAT_SECTOR_MASK]); nextcluster &= 0x0FFFFFFF; - + if ( nextcluster >= 0x0FFFFFF8 ) return 0; break; - + default: return -1; /* WTF? */ } return libfat_clustertosector(fs, nextcluster); } - - - diff --git a/libfat/libfat.h b/libfat/libfat.h index 8c6a9d21..a1414ac5 100644 --- a/libfat/libfat.h +++ b/libfat/libfat.h @@ -1,6 +1,6 @@ #ident "$Id$" /* ----------------------------------------------------------------------- * - * + * * Copyright 2004 H. Peter Anvin - All Rights Reserved * * This program is free software; you can redistribute it and/or modify @@ -84,4 +84,3 @@ int32_t libfat_searchdir(struct libfat_filesystem *fs, int32_t dirclust, const void *name, struct libfat_direntry *direntry); #endif /* LIBFAT_H */ - diff --git a/libfat/libfatint.h b/libfat/libfatint.h index 67b67b22..b0476195 100644 --- a/libfat/libfatint.h +++ b/libfat/libfatint.h @@ -1,6 +1,6 @@ #ident "$Id$" /* ----------------------------------------------------------------------- * - * + * * Copyright 2004 H. Peter Anvin - All Rights Reserved * * This program is free software; you can redistribute it and/or modify @@ -38,7 +38,7 @@ enum fat_type { struct libfat_filesystem { int (*read)(intptr_t, void *, size_t, libfat_sector_t); intptr_t readptr; - + enum fat_type fat_type; unsigned int clustsize; int clustshift; diff --git a/libfat/open.c b/libfat/open.c index a66d21e7..f454fa3d 100644 --- a/libfat/open.c +++ b/libfat/open.c @@ -1,6 +1,6 @@ #ident "$Id$" /* ----------------------------------------------------------------------- * - * + * * Copyright 2004 H. Peter Anvin - All Rights Reserved * * This program is free software; you can redistribute it and/or modify @@ -35,13 +35,13 @@ libfat_open(int (*readfunc)(intptr_t, void *, size_t, libfat_sector_t), fs = malloc(sizeof(struct libfat_filesystem)); if ( !fs ) goto barf; - + fs->sectors = NULL; fs->read = readfunc; fs->readptr = readptr; bs = libfat_get_sector(fs, 0); - if ( !bs ) + if ( !bs ) goto barf; if ( read16(&bs->bsBytesPerSec) != LIBFAT_SECTOR_SIZE ) @@ -55,20 +55,20 @@ libfat_open(int (*readfunc)(intptr_t, void *, size_t, libfat_sector_t), goto barf; fs->clustsize = 1 << i; /* Treat 0 as 2^8 = 64K */ fs->clustshift = i; - + sectors = read16(&bs->bsSectors); if ( !sectors ) sectors = read32(&bs->bsHugeSectors); fs->end = sectors; - + fs->fat = read16(&bs->bsResSectors); fatsize = read16(&bs->bsFATsecs); if ( !fatsize ) fatsize = read32(&bs->u.fat32.bpb_fatsz32); - + fs->rootdir = fs->fat + fatsize * read8(&bs->bsFATs); - + rootdirsize = ((read16(&bs->bsRootDirEnts) << 5) + LIBFAT_SECTOR_MASK) >> LIBFAT_SECTOR_SHIFT; fs->data = fs->rootdir + rootdirsize; @@ -92,7 +92,7 @@ libfat_open(int (*readfunc)(intptr_t, void *, size_t, libfat_sector_t), minfatsize = fs->endcluster << 2; } else goto barf; /* Impossibly many clusters */ - + minfatsize = (minfatsize + LIBFAT_SECTOR_SIZE-1) >> LIBFAT_SECTOR_SHIFT; if ( minfatsize > fatsize ) diff --git a/libfat/searchdir.c b/libfat/searchdir.c index 8b652682..26953f26 100644 --- a/libfat/searchdir.c +++ b/libfat/searchdir.c @@ -1,6 +1,6 @@ #ident "$Id$" /* ----------------------------------------------------------------------- * - * + * * Copyright 2004 H. Peter Anvin - All Rights Reserved * * This program is free software; you can redistribute it and/or modify @@ -34,7 +34,7 @@ int32_t libfat_searchdir(struct libfat_filesystem *fs, int32_t dirclust, return -2; /* Not found */ else if ( s == (libfat_sector_t)-1 ) return -1; /* Error */ - + dep = libfat_get_sector(fs, s); if ( !dep ) return -1; /* Read error */ @@ -52,12 +52,12 @@ int32_t libfat_searchdir(struct libfat_filesystem *fs, int32_t dirclust, else return read16(&dep->clustlo) + (read16(&dep->clusthi) << 16); } - + if ( dep->name[0] == 0 ) return -2; /* Hit high water mark */ dep++; - } + } s = libfat_nextsector(fs, s); } diff --git a/libfat/ulint.h b/libfat/ulint.h index 82a46acb..24d5f017 100644 --- a/libfat/ulint.h +++ b/libfat/ulint.h @@ -1,6 +1,6 @@ #ident "$Id$" /* ----------------------------------------------------------------------- * - * + * * Copyright 2001-2004 H. Peter Anvin - All Rights Reserved * * This program is free software; you can redistribute it and/or modify @@ -14,7 +14,7 @@ /* * ulint.h * - * Basic operations on unaligned, littleendian integers + * Basic operations on unaligned, littleendian integers */ #ifndef ULINT_H @@ -70,7 +70,7 @@ write32(le32_t *_p, uint32_t _v) *((uint32_t *)_p) = _v; } -#else +#else /* Generic, mostly portable versions */ |