[16] | 1 | /*************************************************************************** |
---|
| 2 | * |
---|
| 3 | * Copyright (C) 2001 International Business Machines |
---|
| 4 | * All rights reserved. |
---|
| 5 | * |
---|
| 6 | * This file is part of the GPFS mmfslinux kernel module. |
---|
| 7 | * |
---|
| 8 | * Redistribution and use in source and binary forms, with or without |
---|
| 9 | * modification, are permitted provided that the following conditions |
---|
| 10 | * are met: |
---|
| 11 | * |
---|
| 12 | * 1. Redistributions of source code must retain the above copyright notice, |
---|
| 13 | * this list of conditions and the following disclaimer. |
---|
| 14 | * 2. Redistributions in binary form must reproduce the above copyright |
---|
| 15 | * notice, this list of conditions and the following disclaimer in the |
---|
| 16 | * documentation and/or other materials provided with the distribution. |
---|
| 17 | * 3. The name of the author may not be used to endorse or promote products |
---|
| 18 | * derived from this software without specific prior written |
---|
| 19 | * permission. |
---|
| 20 | * |
---|
| 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
---|
| 22 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
---|
| 23 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
---|
| 24 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
---|
| 25 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
---|
| 26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
---|
| 27 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
---|
| 28 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
---|
| 29 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
---|
| 30 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
| 31 | * |
---|
| 32 | *************************************************************************** */ |
---|
| 33 | /* @(#)41 1.57.1.5 src/avs/fs/mmfs/ts/kernext/gpl-linux/verdep.h, mmfs, avs_rgpfs24, rgpfs24s008a 11/10/06 11:47:24 */ |
---|
| 34 | #ifndef _h_verdep |
---|
| 35 | #define _h_verdep |
---|
| 36 | |
---|
| 37 | #if (LINUX_KERNEL_VERSION >= 2060000) |
---|
| 38 | /************************************ |
---|
| 39 | * Linux 2.6 functional differences * |
---|
| 40 | ************************************/ |
---|
| 41 | # include <linux/buffer_head.h> |
---|
| 42 | # include <linux/kdev_t.h> |
---|
| 43 | # include <linux/namei.h> |
---|
| 44 | # include <linux/mount.h> |
---|
| 45 | # include <linux/page-flags.h> |
---|
| 46 | # include <linux/security.h> |
---|
| 47 | # include <linux/sched.h> |
---|
| 48 | # include <linux/init.h> |
---|
| 49 | # include <linux/fs.h> |
---|
| 50 | |
---|
| 51 | # include <cxiTypes.h> |
---|
| 52 | # include <cxiSystem.h> |
---|
| 53 | # include <Logger-gpl.h> |
---|
| 54 | # include <linux/moduleparam.h> |
---|
| 55 | |
---|
| 56 | |
---|
| 57 | /* Inode state indicators. |
---|
| 58 | SLES9 2.6.5-7.244+ kernels and SLES10 kernels require truncate_inode_pages |
---|
| 59 | to be called from the delete_inode sop and check for I_WILL_FREE flag, |
---|
| 60 | RHEL4 kernels do not (thus far). */ |
---|
| 61 | # if defined(SUSE_LINUX) && \ |
---|
| 62 | ((LINUX_KERNEL_VERSION == 2060507 && \ |
---|
| 63 | SUSE_LINUX_UPDATE_SUBLEVEL >= 24400000000) || \ |
---|
| 64 | LINUX_KERNEL_VERSION > 2060507) |
---|
| 65 | # define INODE_BEING_RELEASED (I_FREEING|I_CLEAR|I_WILL_FREE) |
---|
| 66 | # define INODE_IN_CACHE (I_FREEING|I_CLEAR|I_LOCK|I_NEW|I_WILL_FREE) |
---|
| 67 | /* required if file system defines delete_inode */ |
---|
| 68 | # define MUST_TRUNCATE_INODE_PAGES 1 |
---|
| 69 | # else |
---|
| 70 | # define INODE_BEING_RELEASED (I_FREEING|I_CLEAR) |
---|
| 71 | # define INODE_IN_CACHE (I_FREEING|I_CLEAR|I_LOCK|I_NEW) |
---|
| 72 | # define MUST_TRUNCATE_INODE_PAGES 0 |
---|
| 73 | # endif |
---|
| 74 | |
---|
| 75 | /* Retrieve a new empty inode from the vfs */ |
---|
| 76 | # define NEW_INODE(SUPER) new_inode(SUPER) |
---|
| 77 | |
---|
| 78 | /* Uncache a directory entry. Must hold dcache lock. */ |
---|
| 79 | # define DENTRY_DROP(DP) \ |
---|
| 80 | { \ |
---|
| 81 | spin_lock(&(DP)->d_lock); \ |
---|
| 82 | __d_drop(DP); \ |
---|
| 83 | spin_unlock(&(DP)->d_lock); \ |
---|
| 84 | } |
---|
| 85 | |
---|
| 86 | /* Uncache a directory entry. Must hold *NO* locks. */ |
---|
| 87 | /* __d_drop checks state of DCACHE_UNHASHED prior to drop. */ |
---|
| 88 | # define DENTRY_D_DROP(DP) \ |
---|
| 89 | { \ |
---|
| 90 | spin_lock(&dcache_lock); \ |
---|
| 91 | spin_lock(&(DP)->d_lock); \ |
---|
| 92 | __d_drop(DP); \ |
---|
| 93 | spin_unlock(&(DP)->d_lock); \ |
---|
| 94 | spin_unlock(&dcache_lock); \ |
---|
| 95 | } |
---|
| 96 | |
---|
| 97 | /* Check if directory is already uncached. Must hold dcache lock. */ |
---|
| 98 | # define DENTRY_UNHASHED(DP) d_unhashed(DP) |
---|
| 99 | |
---|
| 100 | /* Mark buffer in error and call iodone routine */ |
---|
| 101 | # define BUFHEAD_ERROR_IODONE(BH) \ |
---|
| 102 | { \ |
---|
| 103 | clear_buffer_uptodate(BH); \ |
---|
| 104 | (BHP)->b_end_io((BH), 0); \ |
---|
| 105 | } |
---|
| 106 | |
---|
| 107 | |
---|
| 108 | #if LINUX_KERNEL_VERSION >= 2061300 || \ |
---|
| 109 | (LINUX_KERNEL_VERSION == 2060507 && defined(SUSE_LINUX) && SUSE_LINUX_UPDATE_SUBLEVEL >= 13900000000) |
---|
| 110 | #define MY_INIT_LIST_HEAD(SINODES) INIT_LIST_HEAD(SINODES) |
---|
| 111 | #else |
---|
| 112 | #define MY_INIT_LIST_HEAD(SINODES) |
---|
| 113 | #endif |
---|
| 114 | |
---|
| 115 | # define SET_SUPER_BLOCK(SBP,SOPS) \ |
---|
| 116 | { \ |
---|
| 117 | memset((SBP), 0, sizeof(struct super_block)); \ |
---|
| 118 | (SBP)->s_op = SOPS; \ |
---|
| 119 | (SBP)->s_flags |= MS_ACTIVE; \ |
---|
| 120 | security_sb_alloc(SBP); \ |
---|
| 121 | MY_INIT_LIST_HEAD(&((SBP)->s_inodes)); \ |
---|
| 122 | } |
---|
| 123 | |
---|
| 124 | # define UNSET_SUPER_BLOCK(SBP) \ |
---|
| 125 | { \ |
---|
| 126 | security_sb_free(SBP); \ |
---|
| 127 | } |
---|
| 128 | |
---|
| 129 | # define KSTATFS kstatfs |
---|
| 130 | # define HAS_SOP_ALLOC_INODE 1 |
---|
| 131 | # define NODE_TOO_BIG_FOR_OSNODE(SZ) 0 /* false if HAS_SOP_ALLOC_INODE */ |
---|
| 132 | |
---|
| 133 | # define DAEMONIZE(A) daemonize(A); |
---|
| 134 | # define FOR_EACH_TASK(T) for_each_process(T) |
---|
| 135 | # define DO_EACH_THREAD(G,T) do_each_thread(G,T) |
---|
| 136 | # define WHILE_EACH_THREAD(G,T) while_each_thread(G,T) |
---|
| 137 | # define NEXT_TASK(T) list_entry((T)->tasks.next, \ |
---|
| 138 | struct task_struct, tasks) |
---|
| 139 | # define PROCESS_GROUP(T) process_group(T) |
---|
| 140 | # define REVOKE_LEASE(INODE,MODE) break_lease(INODE,MODE) |
---|
| 141 | # define KDEV_INT(KDEV) ((unsigned int)(KDEV)) |
---|
| 142 | # define PAGE_UP_TO_DATE(PAGE) PageUptodate(PAGE) |
---|
| 143 | # define PAGE_UNLOCK(PAGE) unlock_page(PAGE) |
---|
| 144 | # define HAS_IOP_REVALIDATE 0 /* uses getattr inode op instead */ |
---|
| 145 | # define HAS_SOP_READ_INODE2 0 |
---|
| 146 | # define SBLOCK_PRIVATE(SBP) (SBP)->s_fs_info |
---|
| 147 | # define SBLOCK_BDEVNAME(SBP,BNAME) bdevname((SBP)->s_bdev,(BNAME)) |
---|
| 148 | |
---|
| 149 | # define DCACHE_DFLAGS_DISCONNECTED DCACHE_DISCONNECTED |
---|
| 150 | # define POSIX_UNBLOCK_LOCK(FLP) posix_unblock_lock((FLP)->fl_file,(FLP)) |
---|
| 151 | # define POSIX_LOCK_FILE(FLP1,FLP2) posix_lock_file((FLP1),(FLP2)) |
---|
| 152 | # define SPIN_LOCK_IRQ(LOCK,FLAGS) spin_lock_irqsave(LOCK,FLAGS) |
---|
| 153 | # define SPIN_UNLOCK_IRQ(LOCK,FLAGS) spin_unlock_irqrestore(LOCK,FLAGS) |
---|
| 154 | |
---|
| 155 | # define GET_INODETIME_SEC(ITIME) (ITIME).tv_sec |
---|
| 156 | # define CXITIME_TO_INODETIME(CXITIME, ITIME) \ |
---|
| 157 | { \ |
---|
| 158 | (ITIME).tv_sec = (CXITIME).tv_sec; \ |
---|
| 159 | (ITIME).tv_nsec = (CXITIME).tv_nsec; \ |
---|
| 160 | } |
---|
| 161 | # define CXITIME_FROM_INODETIME(CXITIME, ITIME) \ |
---|
| 162 | { \ |
---|
| 163 | (CXITIME).tv_sec = (ITIME).tv_sec; \ |
---|
| 164 | (CXITIME).tv_nsec = (ITIME).tv_nsec; \ |
---|
| 165 | } |
---|
| 166 | |
---|
| 167 | #ifdef MODULE |
---|
| 168 | /* Module function interfaces for 2.6 kernel */ |
---|
| 169 | # define MY_INIT_FUNCTION() static int __init myModuleInit(void) |
---|
| 170 | # define MY_EXIT_FUNCTION() static void __exit myModuleExit(void) |
---|
| 171 | # define MY_MODULE_INCREMENT() try_module_get(THIS_MODULE) |
---|
| 172 | # define MY_MODULE_DECREMENT() module_put(THIS_MODULE) |
---|
| 173 | |
---|
| 174 | # define MODULE_INCREMENT(MOD) try_module_get(MOD) |
---|
| 175 | # define MODULE_DECREMENT(MOD) module_put(MOD) |
---|
| 176 | |
---|
| 177 | # define DEFINE_MODULE_INIT() module_init(myModuleInit) |
---|
| 178 | # define DEFINE_MODULE_EXIT() module_exit(myModuleExit) |
---|
| 179 | #endif /* MODULE */ |
---|
| 180 | |
---|
| 181 | #define SETUP_MODULE_PATH_PARMS \ |
---|
| 182 | char progPath[20] = "/usr/lpp/mmfs/bin/"; \ |
---|
| 183 | char *prog_path = progPath; \ |
---|
| 184 | char mmfsdPath[20] = "/usr/lpp/mmfs/bin/"; \ |
---|
| 185 | char *mmfsd_path = mmfsdPath; \ |
---|
| 186 | module_param_string(mmfsd_path, mmfsdPath, 0666, sizeof(mmfsdPath)); \ |
---|
| 187 | module_param_string(prog_path, progPath, 0666, sizeof(progPath)); |
---|
| 188 | |
---|
| 189 | /* pte functions */ |
---|
| 190 | # define PTE_OFFSET(PMDP,VADDR) pte_offset_map((PMDP),(VADDR)) |
---|
| 191 | # define PTE_UNMAP(PTEP) pte_unmap(PTEP); |
---|
| 192 | |
---|
| 193 | /* mmap functions */ |
---|
| 194 | # define ACQUIRE_MMAP_SEM(SEM) down_write(SEM) |
---|
| 195 | # define RELEASE_MMAP_SEM(SEM) up_write(SEM) |
---|
| 196 | |
---|
| 197 | # define FILEMAP_FDATASYNC(RC, M) RC = filemap_fdatawrite(M) |
---|
| 198 | # define FILEMAP_FDATAWAIT(RC, M) RC = filemap_fdatawait(M) |
---|
| 199 | |
---|
| 200 | # define MOD_PGPGIN(amount) add_page_state(pgpgin, (amount)) |
---|
| 201 | # define MOD_PGPGOUT(amount) add_page_state(pgpgout, (amount)) |
---|
| 202 | |
---|
| 203 | #if (LINUX_KERNEL_VERSION >= 2060700) |
---|
| 204 | #define PUTNAME __putname |
---|
| 205 | #else |
---|
| 206 | #define PUTNAME putname |
---|
| 207 | #endif |
---|
| 208 | |
---|
| 209 | #ifdef GPFS_ARCH_IA64 |
---|
| 210 | /* user addresses are below region 5 (while PAGE_OFFSET is at region 7) */ |
---|
| 211 | #define GPFS_KERNEL_OFFSET 0xa000000000000000UL |
---|
| 212 | #elif GPFS_ARCH_I386 |
---|
| 213 | #if LINUX_KERNEL_VERSION >= 2060900 |
---|
| 214 | #define GPFS_KERNEL_OFFSET (UIntPtr) PAGE_OFFSET - (0x8000000 + 0x100000) |
---|
| 215 | #else |
---|
| 216 | #define GPFS_KERNEL_OFFSET (UIntPtr) PAGE_OFFSET |
---|
| 217 | #endif /* LINUX_KERNEL_VERSION >= 2060900 */ |
---|
| 218 | #else |
---|
| 219 | #define GPFS_KERNEL_OFFSET (UIntPtr) PAGE_OFFSET |
---|
| 220 | #endif /* GPFS_ARCH_IA64 */ |
---|
| 221 | |
---|
| 222 | #define EXEC_HELPER(PATH,AV,EV,WAIT) call_usermodehelper(PATH,AV,EV,WAIT) |
---|
| 223 | #define USING_MOUNT_HELPER() false |
---|
| 224 | |
---|
| 225 | #if LINUX_KERNEL_VERSION >= 2060600 || \ |
---|
| 226 | (LINUX_KERNEL_VERSION == 2060507 && defined(SUSE_LINUX) && SUSE_LINUX_UPDATE_SUBLEVEL >= 13900000000) |
---|
| 227 | #define UNMAP_MAPPING_RANGE(MAPPING, START, STOP) unmap_shared_mapping_range(MAPPING, START, STOP); |
---|
| 228 | #define MMAP_WRITE_ACCESS(WRITEACCESS) WRITEACCESS = true; |
---|
| 229 | #elif defined(MMAP_LINUX_PATCH) |
---|
| 230 | #define UNMAP_MAPPING_RANGE(MAPPING, START, STOP) invalidate_mappings(MAPPING, START); |
---|
| 231 | #define MMAP_WRITE_ACCESS(WRITEACCESS) WRITEACCESS = true; |
---|
| 232 | #else |
---|
| 233 | #define UNMAP_MAPPING_RANGE(MAPPING, START, STOP) |
---|
| 234 | #define MMAP_WRITE_ACCESS(WRITEACCESS) WRITEACCESS = false; |
---|
| 235 | #endif |
---|
| 236 | |
---|
| 237 | #if LINUX_KERNEL_VERSION >= 2060900 |
---|
| 238 | #define VFS_FOLLOW_LINK(RC, ND, BUF) nd_set_link(ND, BUF); BUF = NULL |
---|
| 239 | #else |
---|
| 240 | #define VFS_FOLLOW_LINK(RC, ND, BUF) RC = vfs_follow_link(ND, BUF) |
---|
| 241 | #endif |
---|
| 242 | |
---|
| 243 | #if LINUX_KERNEL_VERSION >= 2061000 |
---|
| 244 | #define MY_RLIM_CUR(WHAT) current->signal->rlim[WHAT].rlim_cur |
---|
| 245 | #else |
---|
| 246 | #define MY_RLIM_CUR(WHAT) current->rlim[WHAT].rlim_cur |
---|
| 247 | #endif |
---|
| 248 | |
---|
| 249 | #if LINUX_KERNEL_VERSION >= 2061000 |
---|
| 250 | /* generic_permission does not have a definition that is expected in |
---|
| 251 | struct inode_operations, but it is safe to call it because the |
---|
| 252 | only difference is in the last argument, which should not come into |
---|
| 253 | play for a GPFS inode. Cast the definition to eliminate compiler |
---|
| 254 | warnings. */ |
---|
| 255 | #define GENERIC_PERMISSION ((int (*) (struct inode *, int, struct nameidata *))generic_permission) |
---|
| 256 | #else |
---|
| 257 | #define GENERIC_PERMISSION vfs_permission |
---|
| 258 | #endif |
---|
| 259 | |
---|
| 260 | #if LINUX_KERNEL_VERSION >= 2061600 |
---|
| 261 | #define d_child d_u.d_child |
---|
| 262 | #endif |
---|
| 263 | |
---|
| 264 | #if LINUX_KERNEL_VERSION >= 2060900 |
---|
| 265 | #define HAS_IOP_PUT_LINK |
---|
| 266 | #endif |
---|
| 267 | |
---|
| 268 | #define cxiDevMajor(D) ((UInt32)((D) >> 20)) |
---|
| 269 | #define cxiDevMinor(D) ((UInt32)((D) & 0xfffff)) |
---|
| 270 | #define cxiDevToKernelDev(D) new_decode_dev(D) |
---|
| 271 | #define cxiDev32ToDev(D) \ |
---|
| 272 | (cxiDev_t)((cxiDev32Major(D) << 8) | \ |
---|
| 273 | (cxiDev32Minor(D) & 0xFF) | \ |
---|
| 274 | ((cxiDev32Minor(D) & ~0xFF) << 12)) |
---|
| 275 | |
---|
| 276 | #if LINUX_KERNEL_VERSION >= 2061900 |
---|
| 277 | #define PRVINODE i_private |
---|
| 278 | #else |
---|
| 279 | #define PRVINODE u.generic_ip |
---|
| 280 | #endif |
---|
| 281 | |
---|
| 282 | #else /* < 2060000 */ |
---|
| 283 | /************************************ |
---|
| 284 | * Linux 2.4 functional differences * |
---|
| 285 | ********************************** */ |
---|
| 286 | # include <linux/locks.h> |
---|
| 287 | # include <linux/kernel_stat.h> |
---|
| 288 | |
---|
| 289 | # include <cxiTypes.h> |
---|
| 290 | # include <cxiSystem.h> |
---|
| 291 | # include <Logger-gpl.h> |
---|
| 292 | |
---|
| 293 | /* Inode state indicators */ |
---|
| 294 | #define INODE_BEING_RELEASED (I_FREEING|I_CLEAR) |
---|
| 295 | #define INODE_IN_CACHE (I_FREEING|I_CLEAR|I_LOCK) |
---|
| 296 | #define MUST_TRUNCATE_INODE_PAGES 0 |
---|
| 297 | |
---|
| 298 | #define PRVINODE u.generic_ip |
---|
| 299 | |
---|
| 300 | #define GENERIC_PERMISSION vfs_permission |
---|
| 301 | |
---|
| 302 | #if defined(REDHAT_AS_LINUX) || defined(SUSE_LINUX) ||\ |
---|
| 303 | (defined(REDHAT_LINUX) && LINUX_KERNEL_VERSION >= 2041814) |
---|
| 304 | /* Retrieve a new empty inode from the vfs */ |
---|
| 305 | # define NEW_INODE(SUPER) new_inode(SUPER) |
---|
| 306 | #else |
---|
| 307 | # define NEW_INODE(SUPER) get_empty_inode() |
---|
| 308 | #endif |
---|
| 309 | |
---|
| 310 | /* Check if directory is already uncached. Must hold dcache lock. */ |
---|
| 311 | # define DENTRY_UNHASHED(DP) list_empty(&(DP)->d_hash) |
---|
| 312 | |
---|
| 313 | /* Uncache a directory entry. Assumes dcache lock is held */ |
---|
| 314 | # define DENTRY_DROP(DP) \ |
---|
| 315 | { \ |
---|
| 316 | if (!DENTRY_UNHASHED((DP))) \ |
---|
| 317 | list_del_init(&(DP)->d_hash); \ |
---|
| 318 | } |
---|
| 319 | |
---|
| 320 | /* Uncache a directory entry. Must hold *NO* locks. */ |
---|
| 321 | # define DENTRY_D_DROP(DP) \ |
---|
| 322 | { \ |
---|
| 323 | spin_lock(&dcache_lock); \ |
---|
| 324 | list_del_init(&(DP)->d_hash); \ |
---|
| 325 | spin_unlock(&dcache_lock); \ |
---|
| 326 | } |
---|
| 327 | |
---|
| 328 | /* Mark buffer in error and call iodone routine */ |
---|
| 329 | # define BUFHEAD_ERROR_IODONE(BH) buffer_IO_error(BH) |
---|
| 330 | |
---|
| 331 | #if LINUX_KERNEL_VERSION >= 2041800 |
---|
| 332 | # define SET_SUPER_BLOCK(SBP,SOPS) \ |
---|
| 333 | { \ |
---|
| 334 | memset((SBP), 0, sizeof(struct super_block)); \ |
---|
| 335 | (SBP)->s_op = SOPS; \ |
---|
| 336 | (SBP)->s_flags |= MS_ACTIVE; \ |
---|
| 337 | } |
---|
| 338 | #else |
---|
| 339 | # define SET_SUPER_BLOCK(SBP,SOPS) \ |
---|
| 340 | { \ |
---|
| 341 | memset((SBP), 0, sizeof(struct super_block)); \ |
---|
| 342 | (SBP)->s_op = SOPS; \ |
---|
| 343 | } |
---|
| 344 | #endif |
---|
| 345 | # define UNSET_SUPER_BLOCK(SBP) |
---|
| 346 | |
---|
| 347 | #if ((defined(REDHAT_LINUX) && (LINUX_DISTRIBUTION_LEVEL >= 90)) || \ |
---|
| 348 | (defined(REDHAT_AS_LINUX) && (LINUX_KERNEL_VERSION >= 2042000))) |
---|
| 349 | # define HAS_01_SCHED_THREADING |
---|
| 350 | #endif |
---|
| 351 | |
---|
| 352 | #ifdef HAS_01_SCHED_THREADING |
---|
| 353 | # define NEXT_TASK(T) list_entry((T)->tasks.next, \ |
---|
| 354 | struct task_struct, tasks) |
---|
| 355 | # define FOR_EACH_TASK(T) for ((T) = &init_task; \ |
---|
| 356 | ((T) = NEXT_TASK(T)) != &init_task; ) |
---|
| 357 | #else |
---|
| 358 | # define FOR_EACH_TASK(T) for_each_task(T) |
---|
| 359 | # define NEXT_TASK(T) (T)->next_task |
---|
| 360 | #endif |
---|
| 361 | # define DO_EACH_THREAD(G,T) FOR_EACH_TASK(T) |
---|
| 362 | # define WHILE_EACH_THREAD(G,T) |
---|
| 363 | # define PROCESS_GROUP(T) (T)->pgrp |
---|
| 364 | |
---|
| 365 | # define KSTATFS statfs |
---|
| 366 | # define HAS_SOP_ALLOC_INODE 0 |
---|
| 367 | # define NODE_TOO_BIG_FOR_OSNODE(SZ) \ |
---|
| 368 | ((sizeof(((struct inode *)0)->u) - sizeof(void *)) < (SZ)) |
---|
| 369 | |
---|
| 370 | # define DAEMONIZE(A) do { daemonize(); reparent_to_init(); } \ |
---|
| 371 | while (0) |
---|
| 372 | # define REVOKE_LEASE(INODE,MODE) get_lease(INODE,MODE) |
---|
| 373 | # define KDEV_INT(KDEV) (KDEV) |
---|
| 374 | # define PAGE_UP_TO_DATE(PAGE) Page_Uptodate(PAGE) |
---|
| 375 | # define PAGE_UNLOCK(PAGE) UnlockPage(PAGE) |
---|
| 376 | # define HAS_SOP_READ_INODE2 1 /* read_inode2 super block op present */ |
---|
| 377 | # define HAS_IOP_REVALIDATE 1 /* revalidate inode op present */ |
---|
| 378 | # define SBLOCK_PRIVATE(SBP) (SBP)->u.generic_sbp |
---|
| 379 | # define SBLOCK_BDEVNAME(SBP,BNAME) bdevname((SBP)->s_dev) |
---|
| 380 | # define BDEVNAME_SIZE 0 /* char array unneeded on 2.4 */ |
---|
| 381 | |
---|
| 382 | # define DCACHE_DFLAGS_DISCONNECTED DCACHE_NFSD_DISCONNECTED |
---|
| 383 | # define POSIX_UNBLOCK_LOCK(FLP) posix_unblock_lock(FLP) |
---|
| 384 | # define POSIX_LOCK_FILE(FLP1,FLP2) posix_lock_file((FLP1),(FLP2),0) |
---|
| 385 | # define SPIN_LOCK_IRQ(LOCK,FLAGS) spin_lock_irqsave(LOCK,FLAGS) |
---|
| 386 | # define SPIN_UNLOCK_IRQ(LOCK,FLAGS) spin_unlock_irqrestore(LOCK,FLAGS) |
---|
| 387 | |
---|
| 388 | # define GET_INODETIME_SEC(ITIME) (ITIME) |
---|
| 389 | # define CXITIME_TO_INODETIME(CXITIME, ITIME) \ |
---|
| 390 | { \ |
---|
| 391 | (ITIME) = (CXITIME).tv_sec; \ |
---|
| 392 | } |
---|
| 393 | # define CXITIME_FROM_INODETIME(CXITIME, ITIME) \ |
---|
| 394 | { \ |
---|
| 395 | (CXITIME).tv_sec = (ITIME); \ |
---|
| 396 | (CXITIME).tv_nsec = 0; \ |
---|
| 397 | } |
---|
| 398 | |
---|
| 399 | #ifdef MODULE |
---|
| 400 | /* Module function interfaces for 2.4 kernel */ |
---|
| 401 | # define MY_INIT_FUNCTION() int init_module(void) |
---|
| 402 | # define MY_EXIT_FUNCTION() void cleanup_module(void) |
---|
| 403 | # define MY_MODULE_INCREMENT() MOD_INC_USE_COUNT |
---|
| 404 | # define MY_MODULE_DECREMENT() if (MOD_IN_USE) \ |
---|
| 405 | MOD_DEC_USE_COUNT |
---|
| 406 | |
---|
| 407 | # define MODULE_INCREMENT(MOD) __MOD_INC_USE_COUNT(MOD) |
---|
| 408 | # define MODULE_DECREMENT(MOD) if (__MOD_IN_USE(MOD)) \ |
---|
| 409 | __MOD_DEC_USE_COUNT(MOD) |
---|
| 410 | # define DEFINE_MODULE_INIT() |
---|
| 411 | # define DEFINE_MODULE_EXIT() |
---|
| 412 | # define SETUP_MODULE_PATH_PARMS \ |
---|
| 413 | char *prog_path = NULL; \ |
---|
| 414 | char *mmfsd_path = NULL; \ |
---|
| 415 | MODULE_PARM(prog_path,"s"); \ |
---|
| 416 | MODULE_PARM(mmfsd_path,"s"); |
---|
| 417 | |
---|
| 418 | #else |
---|
| 419 | /* No ops if not building a module */ |
---|
| 420 | # define MY_INIT_FUNCTION() int myInit(void) |
---|
| 421 | # define MY_EXIT_FUNCTION() void myExit(void) |
---|
| 422 | # define MY_MODULE_INCREMENT() |
---|
| 423 | # define MY_MODULE_DECREMENT() |
---|
| 424 | |
---|
| 425 | # define MODULE_INCREMENT(MOD) |
---|
| 426 | # define MODULE_DECREMENT(MOD) |
---|
| 427 | |
---|
| 428 | # define DEFINE_MODULE_INIT() module_init(myInit) |
---|
| 429 | # define DEFINE_MODULE_EXIT() module_exit(myExit) |
---|
| 430 | # define SETUP_MODULE_PATH_PARMS \ |
---|
| 431 | char *prog_path = NULL; \ |
---|
| 432 | char *mmfsd_path = NULL; |
---|
| 433 | #endif /* !MODULE */ |
---|
| 434 | |
---|
| 435 | |
---|
| 436 | /* pte functions */ |
---|
| 437 | #if defined(REDHAT_AS_LINUX) || \ |
---|
| 438 | (defined(REDHAT_LINUX) && (LINUX_KERNEL_VERSION >= 2042006)) |
---|
| 439 | # define PTE_OFFSET(PMDP,VADDR) pte_offset_map((PMDP),(VADDR)) |
---|
| 440 | # define PTE_UNMAP(PTEP) pte_unmap(PTEP); |
---|
| 441 | #else |
---|
| 442 | # define PTE_OFFSET(PMDP,VADDR) pte_offset(PMDP, VADDR) |
---|
| 443 | # if defined(SUSE_LINUX) && defined(GPFS_ARCH_I386) |
---|
| 444 | # define PTE_UNMAP(PTEP) pte_kunmap(PTEP); |
---|
| 445 | # else |
---|
| 446 | # define PTE_UNMAP(PTEP) /* nothing */ |
---|
| 447 | # endif |
---|
| 448 | #endif /* pte functions */ |
---|
| 449 | |
---|
| 450 | #if LINUX_KERNEL_VERSION >= 2040312 || GPFS_ARCH_POWER |
---|
| 451 | # define ACQUIRE_MMAP_SEM(SEM) down_write(SEM) |
---|
| 452 | # define RELEASE_MMAP_SEM(SEM) up_write(SEM) |
---|
| 453 | |
---|
| 454 | #else |
---|
| 455 | # define ACQUIRE_MMAP_SEM(SEM) down(SEM) |
---|
| 456 | # define RELEASE_MMAP_SEM(SEM) up(SEM) |
---|
| 457 | #endif |
---|
| 458 | |
---|
| 459 | #if LINUX_KERNEL_VERSION >= 2041800 |
---|
| 460 | /* Earlier kernels do not have a return code */ |
---|
| 461 | # define FILEMAP_FDATASYNC(RC, M) RC = filemap_fdatasync(M) |
---|
| 462 | # define FILEMAP_FDATAWAIT(RC, M) RC = filemap_fdatawait(M) |
---|
| 463 | #else |
---|
| 464 | # define FILEMAP_FDATASYNC(RC, M) do { filemap_fdatasync(M); RC = 0; } while (0) |
---|
| 465 | # define FILEMAP_FDATAWAIT(RC, M) do { filemap_fdatawait(M); RC = 0; } while (0) |
---|
| 466 | #endif |
---|
| 467 | |
---|
| 468 | #if (defined(REDHAT_AS_LINUX)) && \ |
---|
| 469 | (LINUX_KERNEL_VERSION >= 2042100) |
---|
| 470 | # define MOD_PGPGIN(amount) kstat_percpu[smp_processor_id()].pgpgin += amount |
---|
| 471 | # define MOD_PGPGOUT(amount) kstat_percpu[smp_processor_id()].pgpgout+= amount |
---|
| 472 | #else |
---|
| 473 | # define MOD_PGPGIN(amount) kstat.pgpgin += amount |
---|
| 474 | # define MOD_PGPGOUT(amount) kstat.pgpgout += amount |
---|
| 475 | #endif |
---|
| 476 | |
---|
| 477 | #define PUTNAME putname |
---|
| 478 | |
---|
| 479 | #ifdef GPFS_ARCH_IA64 |
---|
| 480 | /* user addresses are below region 5 (while PAGE_OFFSET is at region 7) */ |
---|
| 481 | #define GPFS_KERNEL_OFFSET 0xa000000000000000UL |
---|
| 482 | #elif GPFS_ARCH_I386 |
---|
| 483 | #define GPFS_KERNEL_OFFSET (UIntPtr) PAGE_OFFSET |
---|
| 484 | #else |
---|
| 485 | #define GPFS_KERNEL_OFFSET (UIntPtr) PAGE_OFFSET |
---|
| 486 | #endif /* GPFS_ARCH_IA64 */ |
---|
| 487 | |
---|
| 488 | #if defined(GPFS_ARCH_X86_64) |
---|
| 489 | # define EXEC_HELPER(PATH,AV,EV,WAIT) exec_usermodehelper(PATH,AV,EV) |
---|
| 490 | # define USING_MOUNT_HELPER() false |
---|
| 491 | #else |
---|
| 492 | # define EXEC_HELPER(PATH,AV,EV,WAIT) execve(PATH,AV,EV) |
---|
| 493 | # define USING_MOUNT_HELPER() true |
---|
| 494 | #endif |
---|
| 495 | |
---|
| 496 | #ifdef MMAP_LINUX_PATCH |
---|
| 497 | #define UNMAP_MAPPING_RANGE(MAPPING, START, STOP) invalidate_mappings(MAPPING, START); |
---|
| 498 | #define MMAP_WRITE_ACCESS(WRITEACCESS) WRITEACCESS = true; |
---|
| 499 | #else |
---|
| 500 | #define UNMAP_MAPPING_RANGE(MAPPING, START, STOP) |
---|
| 501 | #define MMAP_WRITE_ACCESS(WRITEACCESS) WRITEACCESS = false; |
---|
| 502 | #endif |
---|
| 503 | |
---|
| 504 | #define VFS_FOLLOW_LINK(RC, ND, BUF) RC = vfs_follow_link(ND, BUF) |
---|
| 505 | |
---|
| 506 | #define MY_RLIM_CUR(WHAT) current->rlim[WHAT].rlim_cur |
---|
| 507 | |
---|
| 508 | #define cxiDevMajor(D) ((Int32)(((UInt32)(D) >> 8) & 0xFF)) |
---|
| 509 | #define cxiDevMinor(D) ((Int32)((D) & 0xFF)) |
---|
| 510 | |
---|
| 511 | /* Extra defines not on other platforms to massage it back down |
---|
| 512 | * to a linux kernel specific 16 bits. |
---|
| 513 | */ |
---|
| 514 | #define cxiDevToKernelDev(D) ((cxiDevMajor(D) << 8) | (cxiDevMinor(D) & 0xFF)) |
---|
| 515 | #define cxiDev32ToDev(D) \ |
---|
| 516 | (cxiDev_t)((cxiDev32Major(D) << 8) | (cxiDev32Minor(D) & 0xFF)) |
---|
| 517 | |
---|
| 518 | #endif /* 2.4 kernel */ |
---|
| 519 | |
---|
| 520 | /* Translate to GPFS native disk format which used high and low 16 bits |
---|
| 521 | * for major/minor |
---|
| 522 | */ |
---|
| 523 | #define cxiDevToDev32(D) \ |
---|
| 524 | (cxiDev32_t)((cxiDevMajor(D) << 16) | (cxiDevMinor(D) & 0xFFFF)) |
---|
| 525 | |
---|
| 526 | #endif /* _h_verdep */ |
---|