bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] fix compiler warnings in hurd/isofs


From: Flavio Cruz
Subject: [PATCH] fix compiler warnings in hurd/isofs
Date: Tue, 29 Dec 2015 22:32:38 +0100
User-agent: Mutt/1.5.24 (2015-08-30)

* 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.

diff --git a/fatfs/dir.c b/fatfs/dir.c
index 66c95d2..0a7c8dc 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 14926ff..4c98f62 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 eac7015..d4a509e 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 610f357..4f28d14 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);
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]