source: gpfs_3.1_ker2.6.20/lpp/mmfs/src/ibm-linux/cxiMode-plat.h @ 152

Last change on this file since 152 was 16, checked in by rock, 17 years ago
File size: 6.4 KB
Line 
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/* @(#)77 1.10  src/avs/fs/mmfs/ts/kernext/ibm-linux/cxiMode-plat.h, mmfs, avs_rgpfs24, rgpfs240610b 11/2/04 17:49:45 */
34
35
36#ifndef _h_cxiMode_plat
37#define _h_cxiMode_plat
38
39#ifndef _h_cxiMode
40#error Platform header (XXX-plat.h) should not be included directly
41#endif
42
43/* Linux portability portion of GPFS will have to include its own version of
44 * these linux header files before inclusion of cxiMode.h
45 */
46#ifndef GPFS_GPL
47#include <fcntl.h>
48#include <sys/stat.h>
49#endif
50
51/* These came from aix <sys/mode.h> and currently have equivalent
52 * definitions in linux <sys/stat.h>. 
53 */
54#ifndef S_IFMT
55#define S_IFMT          0170000 /* type of file */
56#define   S_IFREG       0100000 /*   regular */
57#define   S_IFDIR       0040000 /*   directory */
58#define   S_IFBLK       0060000 /*   block special */
59#define   S_IFCHR       0020000 /*   character special */
60#define   S_IFIFO       0010000 /*   fifo */
61#define   S_IFLNK       0120000 /*   symbolic link */
62#define   S_IFSOCK      0140000 /*   socket */
63
64#define S_ISUID         0004000 /* set user id on execution */
65#define S_ISGID         0002000 /* set group id on execution */
66#define S_ISVTX         0001000 /* save text */
67
68                                /* ->>> /usr/group definitions <<<- */
69#define S_IRWXU         0000700 /* read,write,execute perm: owner */
70#define S_IRUSR         0000400 /* read permission: owner */
71#define S_IWUSR         0000200 /* write permission: owner */
72#define S_IXUSR         0000100 /* execute/search permission: owner */
73#define S_IRWXG         0000070 /* read,write,execute perm: group */
74#define S_IRGRP         0000040 /* read permission: group */
75#define S_IWGRP         0000020 /* write permission: group */
76#define S_IXGRP         0000010 /* execute/search permission: group */
77#define S_IRWXO         0000007 /* read,write,execute perm: other */
78#define S_IROTH         0000004 /* read permission: other */
79#define S_IWOTH         0000002 /* write permission: other */
80#define S_IXOTH         0000001 /* execute/search permission: other */
81#endif /* S_IFMT */
82
83/* This mode bit is needed for compatibility with the JFS ACL API
84   and has no effect on Shark file system operations.*/
85#define S_IXACL      0x02000000 /* extended ACL */
86
87
88/* gpfsAccess() mode parameter */
89#define E_ACC                00 /* E_ACC does file exist */
90#define X_ACC           S_IXOTH /* X_ACC is it executable by caller */
91#define W_ACC           S_IWOTH /* W_ACC writable by caller */
92#define R_ACC           S_IROTH /* R_ACC readable by caller */
93
94/* File type macros */
95#ifndef S_ISFIFO
96#define S_ISFIFO(m)     (((m)&(S_IFMT)) == (S_IFIFO))
97#define S_ISDIR(m)      (((m)&(S_IFMT)) == (S_IFDIR))
98#define S_ISCHR(m)      (((m)&(S_IFMT)) == (S_IFCHR))
99#define S_ISBLK(m)      (((m)&(S_IFMT)) == (S_IFBLK))
100#define S_ISREG(m)      (((m)&(S_IFMT)) == (S_IFREG))
101#define S_ISLNK(m)      (((m)&(S_IFMT)) == (S_IFLNK))
102#define S_ISSOCK(m)     (((m)&(S_IFMT)) == (S_IFSOCK))
103#endif
104
105#ifndef O_DIRECT
106#ifdef GPFS_ARCH_PPC64
107#define O_DIRECT 0400000 /* Direct disk access.  */
108#else
109#define O_DIRECT 040000 /* Direct disk access.  */
110#endif
111#endif
112
113#define FOPEN          (-1)
114#define FWRITE         (O_WRONLY-FOPEN)
115#define FREAD          (O_RDONLY-FOPEN)
116#define FNDELAY        O_NDELAY
117#define FTRUNC         O_TRUNC
118#define FCREAT         O_CREAT
119#define FEXCL          O_EXCL
120#define FAPPEND        O_APPEND
121#define FSYNC          O_SYNC
122#define O_DSYNC        O_SYNC
123#define FDIRECT        O_DIRECT
124
125/* Translate open flags in linux filp->f_flag to appropriate
126 * flag for gpfs.  Since O_RDONLY is zero, this part of the
127 * test must appear after the others and not be a bit
128 * comparison operator.
129 */
130#define cxiOpenFlagsXlate(flags)                  \
131          (((flags) & ~O_ACCMODE) |                \
132           (((flags) & O_RDWR) ? (FREAD | FWRITE) : \
133            (((flags) & O_WRONLY) ? FWRITE :         \
134             ((((flags) & O_ACCMODE) == O_RDONLY) ? FREAD : 0))))
135
136#define ACL_MODE (S_ISUID|S_ISGID|S_ISVTX)
137
138#define FFILESYNC FSYNC      /* another name for FSYNC (AIX fattr.h) */
139#define FDATASYNC 0x00400000 /* fsync data only (AIX fattr.h)        */
140
141/* gpfsSetattr() flags (originally from aix sys/chownx.h)
142 * Specifies how the uid and gid values are to be set.
143 */
144#define T_OWNER_AS_IS 004 /* the owner id in the inode is unaltered */
145#define T_GROUP_AS_IS 040 /* the group id in the inode is unaltered */
146#define T_SYNC_IF_NFS 400 /* might need to sync chown for nfs */
147
148#ifndef SEEK_SET
149#define SEEK_SET 0
150#endif
151#ifndef SEEK_CUR
152#define SEEK_CUR 1
153#endif
154#ifndef SEEK_END
155#define SEEK_END 2
156#endif
157
158/* gpfsAccess() who parameter */
159#define ACC_SELF        0x00
160#define ACC_OTHERS      0x08
161#define ACC_ANY         0x10
162#define ACC_ALL         0x20
163
164#endif /* _h_cxiMode-plat */
Note: See TracBrowser for help on using the repository browser.