source: gpfs_3.1_ker2.6.20/lpp/mmfs/src/gpl-linux/opsdeclare.c @ 152

Last change on this file since 152 was 16, checked in by rock, 17 years ago
File size: 14.5 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/* @(#)88       1.84.1.4  src/avs/fs/mmfs/ts/kernext/gpl-linux/opsdeclare.c, mmfs, avs_rgpfs24, rgpfs24s007a 10/24/06 17:58:00 */
34
35#include <Shark-gpl.h>
36
37/* Linux headers */
38#include <linux/module.h>
39#include <linux/mm.h> /* vm operations */
40
41/* GPFS headers */
42#include <linux2gpfs.h>
43#include <verdep.h>
44
45
46struct super_operations gpfs_sops =
47{
48  read_inode:    gpfs_s_read_inode,
49#if HAS_SOP_READ_INODE2
50  read_inode2:   gpfs_s_read_inode2,
51#endif
52  write_inode:   NULL,
53  delete_inode:  gpfs_s_delete_inode,
54  put_super:     gpfs_s_put_super,        /* unmount (not force) */
55  write_super:   gpfs_s_write_super,      /* sync */
56  statfs:        gpfs_s_statfs,           /* statfs */
57  remount_fs:    NULL,
58  clear_inode:   gpfs_s_clear_inode,      /* inode completely unused */
59  umount_begin:  gpfs_s_umount_begin,     /* unmount (force) */
60#if LINUX_KERNEL_VERSION < 2060000
61  fh_to_dentry:  gpfs_fh_to_dentry,
62  dentry_to_fh:  gpfs_dentry_to_fh,
63#endif
64#if HAS_SOP_ALLOC_INODE
65  alloc_inode:   gpfs_alloc_inode,
66  destroy_inode: gpfs_destroy_inode,
67#endif
68};
69
70#if LINUX_KERNEL_VERSION > 2060000
71struct export_operations gpfs_export_ops =
72{
73  encode_fh:  gpfs_encode_fh,
74  decode_fh:  gpfs_decode_fh,
75  get_dentry:  gpfs_get_dentry,
76  get_parent:  gpfs_get_dparent,
77#ifdef NFS_CLUSTER_LOCKS
78  lock:  gpfs_f_lock,
79#endif
80#ifdef P_NFS4
81  get_devicelist: gpfs_get_devicelist,
82  layout_get:     gpfs_layout_get,
83  get_deviceinfo: gpfs_get_deviceinfo,
84  layout_return:  gpfs_layout_return,
85  get_state:      gpfs_get_state,
86  layout_type:    gpfs_layout_type,
87  get_verifier:   gpfs_get_verifier,
88#endif
89};
90#endif
91
92#if LINUX_KERNEL_VERSION >= 2050000
93struct file_system_type gpfs_fs_type = 
94{
95  .owner          = THIS_MODULE,
96  .name           = "gpfs",
97  .get_sb         = gpfs_get_sb,
98  .kill_sb        = kill_anon_super,
99};
100#else
101DECLARE_FSTYPE_DEV(gpfs_fs_type, "gpfs", gpfs_fill_super);
102/* DECLARE_FSTYPE(gpfs_fs_type, "gpfs", gpfs_fill_super, 0); */
103#endif
104
105struct super_operations null_sops =
106{
107};
108
109struct file_operations gpfs_cleanup_fops =
110{
111  release: gpfs_f_cleanup
112};
113
114
115/* Inode operations for non-symlinks, non-directory with standard Unix
116   permissions (no extended acls) and valid inode attributes (valid owner and
117   mode cached in the Linux inode structure). */
118struct inode_operations gpfs_iops_stdperm =
119{
120  create:      gpfs_i_create,
121  // lookup:     no lookup op for non-directory
122  link:        gpfs_i_link,
123  unlink:      gpfs_i_unlink,
124  symlink:     gpfs_i_symlink,
125  mkdir:       gpfs_i_mkdir,
126  rmdir:       gpfs_i_rmdir,
127  mknod:       gpfs_i_mknod,
128  rename:      gpfs_i_rename,
129  readlink:    gpfs_i_readlink,
130  truncate:    gpfs_i_truncate,   /* noop (done by setattr) */
131  permission:  GENERIC_PERMISSION,
132#if HAS_IOP_REVALIDATE
133  revalidate:  gpfs_i_revalidate,
134#endif
135  setattr:     gpfs_i_setattr,
136  getattr:     gpfs_i_getattr
137#if LINUX_KERNEL_VERSION > 2060000
138  ,
139  setxattr: gpfs_i_setxattr,
140  getxattr: gpfs_i_getxattr,
141  listxattr: gpfs_i_listxattr,
142  removexattr: gpfs_i_removexattr
143#endif
144};
145
146/* Inode operations for non-symlinks, non-directory that require a gpfs call
147   to do permission checking either because the file/dir has extended acls or
148   because the owner and mode cached in the Linux inode structure are not
149   known to be valid. */
150struct inode_operations gpfs_iops_xperm =
151{
152  create:      gpfs_i_create,
153  // lookup:     no lookup op for non-directory
154  link:        gpfs_i_link,
155  unlink:      gpfs_i_unlink,
156  symlink:     gpfs_i_symlink,
157  mkdir:       gpfs_i_mkdir,
158  rmdir:       gpfs_i_rmdir,
159  mknod:       gpfs_i_mknod,
160  rename:      gpfs_i_rename,
161  readlink:    gpfs_i_readlink,
162  truncate:    gpfs_i_truncate,   /* noop (done by setattr) */
163  permission:  gpfs_i_permission,
164#if HAS_IOP_REVALIDATE
165  revalidate:  gpfs_i_revalidate,
166#endif
167  setattr:     gpfs_i_setattr,
168  getattr:     gpfs_i_getattr
169#if LINUX_KERNEL_VERSION > 2060000
170  ,
171  setxattr: gpfs_i_setxattr,
172  getxattr: gpfs_i_getxattr,
173  listxattr: gpfs_i_listxattr,
174  removexattr: gpfs_i_removexattr
175#endif
176};
177
178/* Inode operations for directory with standard Unix permissions
179   (no extended acls) and valid inode attributes (valid owner and mode
180   cached in the Linux inode structure). */
181struct inode_operations gpfs_dir_iops_stdperm =
182{
183  create:      gpfs_i_create,
184  lookup:      gpfs_i_lookup,
185  link:        gpfs_i_link,
186  unlink:      gpfs_i_unlink,
187  symlink:     gpfs_i_symlink,
188  mkdir:       gpfs_i_mkdir,
189  rmdir:       gpfs_i_rmdir,
190  mknod:       gpfs_i_mknod,
191  rename:      gpfs_i_rename,
192  readlink:    gpfs_i_readlink,
193  truncate:    gpfs_i_truncate,   /* noop (done by setattr) */
194  permission:  GENERIC_PERMISSION,
195#if HAS_IOP_REVALIDATE
196  revalidate:  gpfs_i_revalidate,
197#endif
198  setattr:     gpfs_i_setattr,
199  getattr:     gpfs_i_getattr
200#if LINUX_KERNEL_VERSION > 2060000
201  ,
202  setxattr: gpfs_i_setxattr,
203  getxattr: gpfs_i_getxattr,
204  listxattr: gpfs_i_listxattr,
205  removexattr: gpfs_i_removexattr
206#endif
207};
208
209/* Inode operations for directory that require a gpfs call to do permission
210   checking either because the file/dir has extended acls or because the owner
211   and mode cached in the Linux inode structure are not known to be valid. */
212struct inode_operations gpfs_dir_iops_xperm =
213{
214  create:      gpfs_i_create,
215  lookup:      gpfs_i_lookup,
216  link:        gpfs_i_link,
217  unlink:      gpfs_i_unlink,
218  symlink:     gpfs_i_symlink,
219  mkdir:       gpfs_i_mkdir,
220  rmdir:       gpfs_i_rmdir,
221  mknod:       gpfs_i_mknod,
222  rename:      gpfs_i_rename,
223  readlink:    gpfs_i_readlink,
224  truncate:    gpfs_i_truncate,   /* noop (done by setattr) */
225  permission:  gpfs_i_permission,
226#if HAS_IOP_REVALIDATE
227  revalidate:  gpfs_i_revalidate,
228#endif
229  setattr:     gpfs_i_setattr,
230  getattr:     gpfs_i_getattr
231#if LINUX_KERNEL_VERSION > 2060000
232  ,
233  setxattr: gpfs_i_setxattr,
234  getxattr: gpfs_i_getxattr,
235  listxattr: gpfs_i_listxattr,
236  removexattr: gpfs_i_removexattr
237#endif
238};
239
240/* inode operations for symlinks */
241struct inode_operations gpfs_link_iops =
242{
243  create:       gpfs_i_create,     /* create             */
244// lookup:      no lookup op for symlink
245  link:         gpfs_i_link,       /* link               */
246  unlink:       gpfs_i_unlink,     /* remove             */
247  symlink:      gpfs_i_symlink,    /* symlink            */
248  mkdir:        gpfs_i_mkdir,      /* mkdir              */
249  rmdir:        gpfs_i_rmdir,      /* rmdir              */
250  mknod:        gpfs_i_mknod,      /* mknod              */
251  rename:       gpfs_i_rename,     /* rename             */
252  readlink:     gpfs_i_readlink,   /* readlink           */
253  follow_link:  gpfs_i_follow_link,/* readlink...      */
254#ifdef HAS_IOP_PUT_LINK
255  put_link:     gpfs_i_put_link,   /* delete link */
256#endif
257  truncate:     gpfs_i_truncate,   /* noop (done by setattr) */
258// permission:  no permission checking for symlink
259#if HAS_IOP_REVALIDATE
260  revalidate:   gpfs_i_revalidate,
261#endif
262  setattr:      gpfs_i_setattr,    /* setattr */
263  getattr:      gpfs_i_getattr     /* getattr */
264#if LINUX_KERNEL_VERSION > 2060000
265  ,
266  setxattr: gpfs_i_setxattr,
267  getxattr: gpfs_i_getxattr,
268  listxattr: gpfs_i_listxattr,
269  removexattr: gpfs_i_removexattr
270#endif
271  // no truncate_range
272};
273
274/* Default file operations, the other operations for the device
275 * come from the bare device
276 */
277struct file_operations gpfs_fops =
278{
279  llseek:     gpfs_f_llseek,
280  read:       gpfs_f_read,
281  write:      gpfs_f_write,
282  readdir:    gpfs_f_readdir,
283/*poll:       gpfs_f_poll,            let Linux handle poll by doing nothing */
284  ioctl:      gpfs_f_ioctl,              /* ENOSYS */
285  mmap:       gpfs_f_mmap,               /* ENOSYS */
286  open:       gpfs_f_open,
287  release:    gpfs_f_release,
288  fsync:      gpfs_f_fsync,
289  fasync:     gpfs_f_fasync,
290  lock:       gpfs_f_lock,
291#ifdef NFS4_CLUSTER
292  flock:      gpfs_f_flock,
293#endif
294#if LINUX_KERNEL_VERSION >= 2060000
295  sendfile:   generic_file_sendfile,
296#endif
297  aio_read:      gpfs_f_readv,
298  aio_write:     gpfs_f_writev
299};
300
301struct file_operations gpfs_fops_no_sendfile =
302{
303  llseek:     gpfs_f_llseek,
304  read:       gpfs_f_read,
305  write:      gpfs_f_write,
306  readdir:    gpfs_f_readdir,
307/*poll:       gpfs_f_poll,            let Linux handle poll by doing nothing */
308  ioctl:      gpfs_f_ioctl,              /* ENOSYS */
309  mmap:       gpfs_f_mmap,               /* ENOSYS */
310  open:       gpfs_f_open,
311  release:    gpfs_f_release,
312  fsync:      gpfs_f_fsync,
313  fasync:     gpfs_f_fasync,
314  lock:       gpfs_f_lock,
315#ifdef NFS4_CLUSTER
316  flock:      gpfs_f_flock,
317#endif
318  aio_read:      gpfs_f_readv,
319  aio_write:     gpfs_f_writev
320};
321
322/* Directory file operations are the same as regular file operations, but
323   read (as opposed to readdir) is not allowed */
324struct file_operations gpfs_dir_fops =
325{
326  llseek:     gpfs_f_llseek,
327  read:       gpfs_f_dir_read,
328  write:      gpfs_f_write,
329  readdir:    gpfs_f_readdir,
330/*poll:       gpfs_f_poll,            let Linux handle poll by doing nothing */
331  ioctl:      gpfs_f_ioctl,              /* ENOSYS */
332  mmap:       gpfs_f_mmap,               /* ENOSYS */
333  open:       gpfs_f_open,
334  release:    gpfs_f_release,
335  fsync:      gpfs_f_fsync,
336  fasync:     gpfs_f_fasync,
337  lock:       gpfs_f_lock,
338#ifdef NFS4_CLUSTER
339  flock:      gpfs_f_flock,
340#endif
341  aio_read:      gpfs_f_readv,
342  aio_write:     gpfs_f_writev
343};
344
345/* dcache operations for a valid dentry:
346   A valid dentry has no gpfs-specific operations defined;
347   linux2gpfs.h #defines gpfs_dops_valid so that the assignement
348   "d_op = &gpfs_dops_valid" will assign NULL to d_op instead of
349   assigning a pointer to a table that only contains NULL function
350   pointers.  This saves a few instructions on each potential call
351   to one of the d_op callbacks.  The declaration below is left here
352   ifdef'ed out so that a search for gpfs_dops_valid will find our
353   comment here. */
354#if 0
355struct dentry_operations gpfs_dops_valid = { };
356#endif
357
358/* dcache operations for a valid dentry for a file that has been or will
359   be unlinked shortly; a BR token revoke on the directory containing this
360   entry should invalidate this entry even if it does not look like a
361   negative dcache entry yet (call to d_delete has not yet happened);
362   see also comment in gpfs_i_unlink.  */
363struct dentry_operations gpfs_dops_ddeletepending =
364{
365  /* No operations defined.  There are explicit tests in the code for
366     "d_op == &gpfs_dops_ddeletepending", so this structure cannot be
367     removed as gpfs_dops_valid was. */
368};
369
370/* dcache operations for a dentry that has been invalidated by an inode
371   token revoke on the file that this dentry refers to, or (in case of
372   a negative dcache entry) by a BR token revoke on the directory
373   containing this entry */
374struct dentry_operations gpfs_dops_invalid =
375{
376  d_revalidate: gpfs_d_invalid, 
377};
378
379struct dentry_operations gpfs_dops_revalidate =
380{
381  d_revalidate: gpfs_d_revalidate,
382};
383
384#ifdef CCL
385/* dcache operations for a positive dentry that was created for
386   an inexact caseless file name match which succeeded for a Samba client.
387   The d_revalidate returns "true" for subsequent Samba clients
388   indicating that the dcache entry is still valid.
389   It returns "false" for local or NFS clients indicating
390   that the dcache entry is no longer valid which forces
391   a new lookup. */
392struct dentry_operations gpfs_dops_valid_if_Samba =
393{
394  d_revalidate: gpfs_d_valid_if_Samba, 
395};
396/* dcache operations for a negative dentry that was created for
397   an exact file name match which failed for a local or NFS client.
398   The d_revalidate returns "true" for subsequent local or NFS clients
399   indicating that the negative dcache entry is still valid.
400   It returns "false" for Samba clients indicating
401   that the dcache entry is no longer valid which forces
402   a new lookup. */
403struct dentry_operations gpfs_dops_invalid_if_Samba =
404{
405  d_revalidate: gpfs_d_invalid_if_Samba, 
406};
407#endif
408
409#if LINUX_KERNEL_VERSION < 2050000
410/* The other operations for the device come from the bare device */
411struct block_device_operations gpfs_bops = 
412{
413  open:       gpfs_b_open,
414  release:    gpfs_b_release,
415  ioctl:      gpfs_b_ioctl,
416};
417
418struct file_operations gpfs_fbps = 
419{
420  open:    gpfs_fb_open,
421  release: gpfs_fb_release,
422  ioctl:   gpfs_fb_ioctl,
423  read:    gpfs_fb_read,
424  write:   gpfs_fb_write,
425};
426#endif
427
428struct address_space_operations gpfs_aops =
429{
430  readpage:       gpfs_i_readpage,
431  writepage:      gpfs_i_writepage,
432#if LINUX_KERNEL_VERSION >= 2060000
433  sync_page:      block_sync_page,
434#endif
435#if LINUX_KERNEL_VERSION >= 2060000  || defined(SUSE_LINUX)
436  direct_IO:      gpfs_f_direct_IO,
437#endif
438};
439
440/* address_space_operations after inode deletion */
441struct address_space_operations gpfs_aops_after_inode_delete =
442{
443};
444
445/*
446 * filemap nopage callback function
447 */
448struct vm_operations_struct gpfs_vmop = 
449{
450  nopage:  gpfs_filemap_nopage,
451#if defined(MMAP_LINUX_PATCH) && LINUX_KERNEL_VERSION < 2060000
452  nopagedone:  gpfs_filemap_nopagedone,
453#endif
454  open:    gpfs_filemap_open,
455  close:   gpfs_filemap_close,
456};
457                                                                                                 
Note: See TracBrowser for help on using the repository browser.