aboutsummaryrefslogtreecommitdiffstats
path: root/libfat
diff options
context:
space:
mode:
authorhpa <hpa>2005-01-04 03:04:53 +0000
committerhpa <hpa>2005-01-04 03:04:53 +0000
commit6c00ab2e9e714d5963f3dcf85c7dd100e02a08d1 (patch)
tree8220ce3f97b94d1a13926cf62cfccb26b7663f44 /libfat
parent140970b0b6669dfeab8ee42720aab159e5ccd6b5 (diff)
downloadsyslinux-elf-6c00ab2e9e714d5963f3dcf85c7dd100e02a08d1.tar.gz
syslinux-elf-6c00ab2e9e714d5963f3dcf85c7dd100e02a08d1.tar.xz
syslinux-elf-6c00ab2e9e714d5963f3dcf85c7dd100e02a08d1.zip
Use libfat to set the MS-DOS attributes when using the unix installer.
Diffstat (limited to 'libfat')
-rw-r--r--libfat/libfat.h8
-rw-r--r--libfat/searchdir.c13
2 files changed, 15 insertions, 6 deletions
diff --git a/libfat/libfat.h b/libfat/libfat.h
index 58bf6b5a..8c6a9d21 100644
--- a/libfat/libfat.h
+++ b/libfat/libfat.h
@@ -30,6 +30,12 @@
typedef uint32_t libfat_sector_t;
struct libfat_filesystem;
+struct libfat_direntry {
+ libfat_sector_t sector;
+ int offset;
+ unsigned char entry[32];
+};
+
/*
* Open the filesystem. The readfunc is the function to read
* sectors, in the format:
@@ -75,7 +81,7 @@ void * libfat_get_sector(struct libfat_filesystem *fs, libfat_sector_t n);
* Copies the directory entry into direntry and returns 0 if found.
*/
int32_t libfat_searchdir(struct libfat_filesystem *fs, int32_t dirclust,
- const void *name, void *direntry);
+ const void *name, struct libfat_direntry *direntry);
#endif /* LIBFAT_H */
diff --git a/libfat/searchdir.c b/libfat/searchdir.c
index 7c07165b..8b652682 100644
--- a/libfat/searchdir.c
+++ b/libfat/searchdir.c
@@ -23,7 +23,7 @@
#include "libfatint.h"
int32_t libfat_searchdir(struct libfat_filesystem *fs, int32_t dirclust,
- const void *name, void *direntry)
+ const void *name, struct libfat_direntry *direntry)
{
struct fat_dirent *dep;
int nent;
@@ -39,11 +39,14 @@ int32_t libfat_searchdir(struct libfat_filesystem *fs, int32_t dirclust,
if ( !dep )
return -1; /* Read error */
- for ( nent = LIBFAT_SECTOR_SIZE/sizeof(struct fat_dirent) ;
- nent ; nent-- ) {
+ for ( nent = 0 ; nent < LIBFAT_SECTOR_SIZE ;
+ nent += sizeof(struct fat_dirent) ) {
if ( !memcmp(dep->name, name, 11) ) {
- if ( direntry )
- memcpy(direntry, dep, sizeof (*dep));
+ if ( direntry ) {
+ memcpy(direntry->entry, dep, sizeof (*dep));
+ direntry->sector = s;
+ direntry->offset = nent;
+ }
if ( read32(&dep->size) == 0 )
return 0; /* An empty file has no clusters */
else