diff options
author | Christoph Hellwig <hch@sgi.com> | 2005-09-02 02:56:02 -0400 |
---|---|---|
committer | Nathan Scott <nathans@sgi.com> | 2005-09-02 02:56:02 -0400 |
commit | 760dea671ea9c5b8c732d76d09673d6d052a186f (patch) | |
tree | a86bef9269c786a073980749044fe495b730ea8d | |
parent | 6f948fbd443255e3a918438ce41cd7581cf8146d (diff) |
[XFS] Fix sparse warnings in kmem_* functions Patch from Victor Fusco
<victor@cetuc.puc-rio.br>
SGI-PV: 940376
SGI-Modid: xfs-linux:xfs-kern:196705a
Signed-off-by: Christoph Hellwig <hch@sgi.com>
Signed-off-by: Nathan Scott <nathans@sgi.com>
-rw-r--r-- | fs/xfs/linux-2.6/kmem.c | 23 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/kmem.h | 23 | ||||
-rw-r--r-- | fs/xfs/xfs_log_recover.c | 2 |
3 files changed, 25 insertions, 23 deletions
diff --git a/fs/xfs/linux-2.6/kmem.c b/fs/xfs/linux-2.6/kmem.c index 364ea8c386b1..4b184559f231 100644 --- a/fs/xfs/linux-2.6/kmem.c +++ b/fs/xfs/linux-2.6/kmem.c | |||
@@ -45,11 +45,11 @@ | |||
45 | 45 | ||
46 | 46 | ||
47 | void * | 47 | void * |
48 | kmem_alloc(size_t size, int flags) | 48 | kmem_alloc(size_t size, unsigned int __nocast flags) |
49 | { | 49 | { |
50 | int retries = 0; | 50 | int retries = 0; |
51 | int lflags = kmem_flags_convert(flags); | 51 | unsigned int lflags = kmem_flags_convert(flags); |
52 | void *ptr; | 52 | void *ptr; |
53 | 53 | ||
54 | do { | 54 | do { |
55 | if (size < MAX_SLAB_SIZE || retries > MAX_VMALLOCS) | 55 | if (size < MAX_SLAB_SIZE || retries > MAX_VMALLOCS) |
@@ -67,7 +67,7 @@ kmem_alloc(size_t size, int flags) | |||
67 | } | 67 | } |
68 | 68 | ||
69 | void * | 69 | void * |
70 | kmem_zalloc(size_t size, int flags) | 70 | kmem_zalloc(size_t size, unsigned int __nocast flags) |
71 | { | 71 | { |
72 | void *ptr; | 72 | void *ptr; |
73 | 73 | ||
@@ -89,7 +89,8 @@ kmem_free(void *ptr, size_t size) | |||
89 | } | 89 | } |
90 | 90 | ||
91 | void * | 91 | void * |
92 | kmem_realloc(void *ptr, size_t newsize, size_t oldsize, int flags) | 92 | kmem_realloc(void *ptr, size_t newsize, size_t oldsize, |
93 | unsigned int __nocast flags) | ||
93 | { | 94 | { |
94 | void *new; | 95 | void *new; |
95 | 96 | ||
@@ -104,11 +105,11 @@ kmem_realloc(void *ptr, size_t newsize, size_t oldsize, int flags) | |||
104 | } | 105 | } |
105 | 106 | ||
106 | void * | 107 | void * |
107 | kmem_zone_alloc(kmem_zone_t *zone, int flags) | 108 | kmem_zone_alloc(kmem_zone_t *zone, unsigned int __nocast flags) |
108 | { | 109 | { |
109 | int retries = 0; | 110 | int retries = 0; |
110 | int lflags = kmem_flags_convert(flags); | 111 | unsigned int lflags = kmem_flags_convert(flags); |
111 | void *ptr; | 112 | void *ptr; |
112 | 113 | ||
113 | do { | 114 | do { |
114 | ptr = kmem_cache_alloc(zone, lflags); | 115 | ptr = kmem_cache_alloc(zone, lflags); |
@@ -123,7 +124,7 @@ kmem_zone_alloc(kmem_zone_t *zone, int flags) | |||
123 | } | 124 | } |
124 | 125 | ||
125 | void * | 126 | void * |
126 | kmem_zone_zalloc(kmem_zone_t *zone, int flags) | 127 | kmem_zone_zalloc(kmem_zone_t *zone, unsigned int __nocast flags) |
127 | { | 128 | { |
128 | void *ptr; | 129 | void *ptr; |
129 | 130 | ||
diff --git a/fs/xfs/linux-2.6/kmem.h b/fs/xfs/linux-2.6/kmem.h index 1397b669b059..109fcf27e256 100644 --- a/fs/xfs/linux-2.6/kmem.h +++ b/fs/xfs/linux-2.6/kmem.h | |||
@@ -39,10 +39,10 @@ | |||
39 | /* | 39 | /* |
40 | * memory management routines | 40 | * memory management routines |
41 | */ | 41 | */ |
42 | #define KM_SLEEP 0x0001 | 42 | #define KM_SLEEP 0x0001u |
43 | #define KM_NOSLEEP 0x0002 | 43 | #define KM_NOSLEEP 0x0002u |
44 | #define KM_NOFS 0x0004 | 44 | #define KM_NOFS 0x0004u |
45 | #define KM_MAYFAIL 0x0008 | 45 | #define KM_MAYFAIL 0x0008u |
46 | 46 | ||
47 | #define kmem_zone kmem_cache_s | 47 | #define kmem_zone kmem_cache_s |
48 | #define kmem_zone_t kmem_cache_t | 48 | #define kmem_zone_t kmem_cache_t |
@@ -81,9 +81,9 @@ typedef unsigned long xfs_pflags_t; | |||
81 | *(NSTATEP) = *(OSTATEP); \ | 81 | *(NSTATEP) = *(OSTATEP); \ |
82 | } while (0) | 82 | } while (0) |
83 | 83 | ||
84 | static __inline unsigned int kmem_flags_convert(int flags) | 84 | static __inline unsigned int kmem_flags_convert(unsigned int __nocast flags) |
85 | { | 85 | { |
86 | int lflags = __GFP_NOWARN; /* we'll report problems, if need be */ | 86 | unsigned int lflags = __GFP_NOWARN; /* we'll report problems, if need be */ |
87 | 87 | ||
88 | #ifdef DEBUG | 88 | #ifdef DEBUG |
89 | if (unlikely(flags & ~(KM_SLEEP|KM_NOSLEEP|KM_NOFS|KM_MAYFAIL))) { | 89 | if (unlikely(flags & ~(KM_SLEEP|KM_NOSLEEP|KM_NOFS|KM_MAYFAIL))) { |
@@ -125,12 +125,13 @@ kmem_zone_destroy(kmem_zone_t *zone) | |||
125 | BUG(); | 125 | BUG(); |
126 | } | 126 | } |
127 | 127 | ||
128 | extern void *kmem_zone_zalloc(kmem_zone_t *, int); | 128 | extern void *kmem_zone_zalloc(kmem_zone_t *, unsigned int __nocast); |
129 | extern void *kmem_zone_alloc(kmem_zone_t *, int); | 129 | extern void *kmem_zone_alloc(kmem_zone_t *, unsigned int __nocast); |
130 | 130 | ||
131 | extern void *kmem_alloc(size_t, int); | 131 | extern void *kmem_alloc(size_t, unsigned int __nocast); |
132 | extern void *kmem_realloc(void *, size_t, size_t, int); | 132 | extern void *kmem_realloc(void *, size_t, size_t, |
133 | extern void *kmem_zalloc(size_t, int); | 133 | unsigned int __nocast); |
134 | extern void *kmem_zalloc(size_t, unsigned int __nocast); | ||
134 | extern void kmem_free(void *, size_t); | 135 | extern void kmem_free(void *, size_t); |
135 | 136 | ||
136 | typedef struct shrinker *kmem_shaker_t; | 137 | typedef struct shrinker *kmem_shaker_t; |
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c index 0aac28ddb81c..14faabaabf29 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c | |||
@@ -1387,7 +1387,7 @@ xlog_recover_add_to_cont_trans( | |||
1387 | old_ptr = item->ri_buf[item->ri_cnt-1].i_addr; | 1387 | old_ptr = item->ri_buf[item->ri_cnt-1].i_addr; |
1388 | old_len = item->ri_buf[item->ri_cnt-1].i_len; | 1388 | old_len = item->ri_buf[item->ri_cnt-1].i_len; |
1389 | 1389 | ||
1390 | ptr = kmem_realloc(old_ptr, len+old_len, old_len, 0); | 1390 | ptr = kmem_realloc(old_ptr, len+old_len, old_len, 0u); |
1391 | memcpy(&ptr[old_len], dp, len); /* d, s, l */ | 1391 | memcpy(&ptr[old_len], dp, len); /* d, s, l */ |
1392 | item->ri_buf[item->ri_cnt-1].i_len += len; | 1392 | item->ri_buf[item->ri_cnt-1].i_len += len; |
1393 | item->ri_buf[item->ri_cnt-1].i_addr = ptr; | 1393 | item->ri_buf[item->ri_cnt-1].i_addr = ptr; |