瀏覽代碼

NTFS: Fix sign of various error return values to be negative in
fs/ntfs/lcnalloc.c.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>

Anton Altaparmakov 20 年之前
父節點
當前提交
43b01fda8b
共有 2 個文件被更改,包括 11 次插入9 次删除
  1. 2 0
      fs/ntfs/ChangeLog
  2. 9 9
      fs/ntfs/lcnalloc.c

+ 2 - 0
fs/ntfs/ChangeLog

@@ -98,6 +98,8 @@ ToDo/Notes:
 	- Rename fs/ntfs/attrib.c::ntfs_find_vcn_nolock() to
 	- Rename fs/ntfs/attrib.c::ntfs_find_vcn_nolock() to
 	  ntfs_attr_find_vcn_nolock() and update all callers.
 	  ntfs_attr_find_vcn_nolock() and update all callers.
 	- Add fs/ntfs/attrib.[hc]::ntfs_attr_make_non_resident().
 	- Add fs/ntfs/attrib.[hc]::ntfs_attr_make_non_resident().
+	- Fix sign of various error return values to be negative in
+	  fs/ntfs/lcnalloc.c.
 
 
 2.1.22 - Many bug and race fixes and error handling improvements.
 2.1.22 - Many bug and race fixes and error handling improvements.
 
 

+ 9 - 9
fs/ntfs/lcnalloc.c

@@ -1,7 +1,7 @@
 /*
 /*
  * lcnalloc.c - Cluster (de)allocation code.  Part of the Linux-NTFS project.
  * lcnalloc.c - Cluster (de)allocation code.  Part of the Linux-NTFS project.
  *
  *
- * Copyright (c) 2004 Anton Altaparmakov
+ * Copyright (c) 2004-2005 Anton Altaparmakov
  *
  *
  * This program/include file is free software; you can redistribute it and/or
  * This program/include file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as published
  * modify it under the terms of the GNU General Public License as published
@@ -60,7 +60,7 @@ int ntfs_cluster_free_from_rl_nolock(ntfs_volume *vol,
 		if (rl->lcn < 0)
 		if (rl->lcn < 0)
 			continue;
 			continue;
 		err = ntfs_bitmap_clear_run(lcnbmp_vi, rl->lcn, rl->length);
 		err = ntfs_bitmap_clear_run(lcnbmp_vi, rl->lcn, rl->length);
-		if (unlikely(err && (!ret || ret == ENOMEM) && ret != err))
+		if (unlikely(err && (!ret || ret == -ENOMEM) && ret != err))
 			ret = err;
 			ret = err;
 	}
 	}
 	ntfs_debug("Done.");
 	ntfs_debug("Done.");
@@ -693,7 +693,7 @@ switch_to_data1_zone:		search_zone = 2;
 		if (zone == MFT_ZONE || mft_zone_size <= 0) {
 		if (zone == MFT_ZONE || mft_zone_size <= 0) {
 			ntfs_debug("No free clusters left, going to out.");
 			ntfs_debug("No free clusters left, going to out.");
 			/* Really no more space left on device. */
 			/* Really no more space left on device. */
-			err = ENOSPC;
+			err = -ENOSPC;
 			goto out;
 			goto out;
 		} /* zone == DATA_ZONE && mft_zone_size > 0 */
 		} /* zone == DATA_ZONE && mft_zone_size > 0 */
 		ntfs_debug("Shrinking mft zone.");
 		ntfs_debug("Shrinking mft zone.");
@@ -757,9 +757,9 @@ out:
 	if (rl) {
 	if (rl) {
 		int err2;
 		int err2;
 
 
-		if (err == ENOSPC)
+		if (err == -ENOSPC)
 			ntfs_debug("Not enough space to complete allocation, "
 			ntfs_debug("Not enough space to complete allocation, "
-					"err ENOSPC, first free lcn 0x%llx, "
+					"err -ENOSPC, first free lcn 0x%llx, "
 					"could allocate up to 0x%llx "
 					"could allocate up to 0x%llx "
 					"clusters.",
 					"clusters.",
 					(unsigned long long)rl[0].lcn,
 					(unsigned long long)rl[0].lcn,
@@ -775,10 +775,10 @@ out:
 		}
 		}
 		/* Free the runlist. */
 		/* Free the runlist. */
 		ntfs_free(rl);
 		ntfs_free(rl);
-	} else if (err == ENOSPC)
-		ntfs_debug("No space left at all, err = ENOSPC, "
-				"first free lcn = 0x%llx.",
-				(unsigned long long)vol->data1_zone_pos);
+	} else if (err == -ENOSPC)
+		ntfs_debug("No space left at all, err = -ENOSPC, first free "
+				"lcn = 0x%llx.",
+				(long long)vol->data1_zone_pos);
 	up_write(&vol->lcnbmp_lock);
 	up_write(&vol->lcnbmp_lock);
 	return ERR_PTR(err);
 	return ERR_PTR(err);
 }
 }