~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Linux/fs/ufs/file.c

Version: ~ [ 2.4.0 ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  *  linux/fs/ufs/file.c
  3  *
  4  * Copyright (C) 1998
  5  * Daniel Pirkl <daniel.pirkl@email.cz>
  6  * Charles University, Faculty of Mathematics and Physics
  7  *
  8  *  from
  9  *
 10  *  linux/fs/ext2/file.c
 11  *
 12  * Copyright (C) 1992, 1993, 1994, 1995
 13  * Remy Card (card@masi.ibp.fr)
 14  * Laboratoire MASI - Institut Blaise Pascal
 15  * Universite Pierre et Marie Curie (Paris VI)
 16  *
 17  *  from
 18  *
 19  *  linux/fs/minix/file.c
 20  *
 21  *  Copyright (C) 1991, 1992  Linus Torvalds
 22  *
 23  *  ext2 fs regular file handling primitives
 24  */
 25 
 26 #include <asm/uaccess.h>
 27 #include <asm/system.h>
 28 
 29 #include <linux/errno.h>
 30 #include <linux/fs.h>
 31 #include <linux/ufs_fs.h>
 32 #include <linux/fcntl.h>
 33 #include <linux/sched.h>
 34 #include <linux/stat.h>
 35 #include <linux/locks.h>
 36 #include <linux/mm.h>
 37 #include <linux/pagemap.h>
 38 
 39 /*
 40  * Make sure the offset never goes beyond the 32-bit mark..
 41  */
 42 static long long ufs_file_lseek(
 43         struct file *file,
 44         long long offset,
 45         int origin )
 46 {
 47         long long retval;
 48         struct inode *inode = file->f_dentry->d_inode;
 49 
 50         switch (origin) {
 51                 case 2:
 52                         offset += inode->i_size;
 53                         break;
 54                 case 1:
 55                         offset += file->f_pos;
 56         }
 57         retval = -EINVAL;
 58         /* make sure the offset fits in 32 bits */
 59         if (((unsigned long long) offset >> 32) == 0) {
 60                 if (offset != file->f_pos) {
 61                         file->f_pos = offset;
 62                         file->f_reada = 0;
 63                         file->f_version = ++event;
 64                 }
 65                 retval = offset;
 66         }
 67         return retval;
 68 }
 69 
 70 /*
 71  * We have mostly NULL's here: the current defaults are ok for
 72  * the ufs filesystem.
 73  */
 74 struct file_operations ufs_file_operations = {
 75         llseek:         ufs_file_lseek,
 76         read:           generic_file_read,
 77         write:          generic_file_write,
 78         mmap:           generic_file_mmap,
 79 };
 80 
 81 struct inode_operations ufs_file_inode_operations = {
 82         truncate:       ufs_truncate,
 83 };
 84 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.