summaryrefslogtreecommitdiff
path: root/fatfs
diff options
context:
space:
mode:
authorFlavio Cruz <flaviocruz@gmail.com>2015-12-29 22:32:38 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2015-12-29 22:36:42 +0100
commit8b87e8c44466f6852c9544c908edef8075757dda (patch)
tree1aa3190278c4b01ea9bbe2f0e188bfdce0413366 /fatfs
parent2280227bedf69b733a589f12ac6b6d5a4fc36af4 (diff)
fix compiler warnings in hurd/isofs
* fatfs/dir.c: Use casts to avoid warnings. * fatfs/fat.c: Use unsigned char in fat_{from,to}_epoch. * fatfs/fat.h: Change arguments accordingly. * fatfs/fat.c (fat_read_sblock): Use size_t instead. * fatfs/inode.c (diskfs_cached_lookup_in_dirbuf): Remove err variable. * fatfs/inode.c (diskfs_user_read_node): Don't cast constant. * fatfs/inode.c (write_node): Check for errors in vm_map.
Diffstat (limited to 'fatfs')
-rw-r--r--fatfs/dir.c9
-rw-r--r--fatfs/fat.c6
-rw-r--r--fatfs/fat.h4
-rw-r--r--fatfs/inode.c9
4 files changed, 17 insertions, 11 deletions
diff --git a/fatfs/dir.c b/fatfs/dir.c
index 66c95d27..b9b7ae55 100644
--- a/fatfs/dir.c
+++ b/fatfs/dir.c
@@ -497,13 +497,14 @@ dirscanblock (vm_address_t blockaddr, struct node *dp, int idx,
component. */
continue;
- if (fatnamematch (entry->name, name, namelen))
+ if (fatnamematch ((const char *) entry->name, name, namelen))
break;
}
if (consider_compress
- && (ds->type == LOOKING
- || (ds->type == COMPRESS && ds->nbytes > nbytes)))
+ && ((enum slot_status) ds->type == LOOKING
+ || ((enum slot_status) ds->type == COMPRESS &&
+ ds->nbytes > nbytes)))
{
ds->type = CREATE;
ds->stat = COMPRESS;
@@ -934,7 +935,7 @@ diskfs_get_directs (struct node *dp,
/* See if there's room to hold this one. */
- fat_to_unix_filename(ep->name, name);
+ fat_to_unix_filename ((const char *) ep->name, name);
namlen = strlen(name);
/* Perhaps downcase it? */
diff --git a/fatfs/fat.c b/fatfs/fat.c
index 14926ff3..4c98f623 100644
--- a/fatfs/fat.c
+++ b/fatfs/fat.c
@@ -69,7 +69,7 @@ void
fat_read_sblock (void)
{
error_t err;
- int read;
+ size_t read;
sblock = malloc (sizeof (struct boot_sector));
err = store_read (store, 0, sizeof (struct boot_sector),
@@ -706,7 +706,7 @@ fat_from_unix_filename(char *fn, const char *un, int ul)
/* Return Epoch-based time from a MSDOS time/date pair. */
void
-fat_to_epoch (char *date, char *time, struct timespec *ts)
+fat_to_epoch (unsigned char *date, unsigned char *time, struct timespec *ts)
{
struct tm tm;
@@ -735,7 +735,7 @@ fat_to_epoch (char *date, char *time, struct timespec *ts)
/* Return MSDOS time/date pair from Epoch-based time. */
void
-fat_from_epoch (char *date, char *time, time_t *tp)
+fat_from_epoch (unsigned char *date, unsigned char *time, time_t *tp)
{
struct tm *tm;
diff --git a/fatfs/fat.h b/fatfs/fat.h
index eac7015a..d4a509ea 100644
--- a/fatfs/fat.h
+++ b/fatfs/fat.h
@@ -318,8 +318,8 @@ struct cluster_chain
/* Prototyping. */
void fat_read_sblock (void);
-void fat_to_epoch (char *, char *, struct timespec *);
-void fat_from_epoch (char *, char *, time_t *);
+void fat_to_epoch (unsigned char *, unsigned char *, struct timespec *);
+void fat_from_epoch (unsigned char *, unsigned char *, time_t *);
error_t fat_getcluster (struct node *, cluster_t, int, cluster_t *);
void fat_truncate_node (struct node *, cluster_t);
error_t fat_extend_chain (struct node *, cluster_t, int);
diff --git a/fatfs/inode.c b/fatfs/inode.c
index 610f3575..4f28d144 100644
--- a/fatfs/inode.c
+++ b/fatfs/inode.c
@@ -22,6 +22,7 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
#include <string.h>
+#include <error.h>
#include "fatfs.h"
#include "libdiskfs/fs_S.h"
@@ -73,7 +74,6 @@ diskfs_user_make_node (struct node **npp, struct lookup_context *ctx)
error_t
diskfs_cached_lookup_in_dirbuf (int inum, struct node **npp, vm_address_t buf)
{
- error_t err;
struct lookup_context ctx = { buf: buf, inode: vi_lookup (inum) };
return diskfs_cached_lookup_context (inum, npp, &ctx);
}
@@ -165,7 +165,7 @@ diskfs_user_read_node (struct node *np, struct lookup_context *ctx)
allocated node that has no directory entry yet, only set a
minimal amount of data until the dirent is created (and we get
called a second time?). */
- if (vk.dir_inode == 0 && vk.dir_offset == (void *) 2)
+ if (vk.dir_inode == 0 && vk.dir_offset == 2)
return 0;
if (vk.dir_inode == 0)
@@ -363,6 +363,11 @@ write_node (struct node *np)
err = vm_map (mach_task_self (),
&buf, buflen, 0, 1, memobj, 0, 0, prot, prot, 0);
mach_port_deallocate (mach_task_self (), memobj);
+ if (err)
+ {
+ pthread_mutex_unlock (&dp->lock);
+ error (1, err, "Could not map memory");
+ }
dr = (struct dirrect *) (buf + vk.dir_offset);