root/fs/umsdos/file.c

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. UMSDOS_file_read
  2. UMSDOS_file_write
  3. UMSDOS_truncate

   1 /*
   2  *  linux/fs/umsdos/file.c
   3  *
   4  *  Written 1993 by Jacques Gelinas
   5  *      inspired from linux/fs/msdos/file.c Werner Almesberger
   6  *
   7  *  Extended MS-DOS regular file handling primitives
   8  */
   9 
  10 #ifdef MODULE
  11 #include <linux/module.h>
  12 #endif
  13 
  14 #include <asm/segment.h>
  15 #include <asm/system.h>
  16 
  17 #include <linux/sched.h>
  18 #include <linux/fs.h>
  19 #include <linux/msdos_fs.h>
  20 #include <linux/errno.h>
  21 #include <linux/fcntl.h>
  22 #include <linux/stat.h>
  23 #include <linux/msdos_fs.h>
  24 #include <linux/umsdos_fs.h>
  25 
  26 
  27 #define PRINTK(x)
  28 #define Printk(x)       printk x
  29 /*
  30         Read a file into user space memory
  31 */
  32 static int UMSDOS_file_read(
     /* [previous][next][first][last][top][bottom][index][help] */
  33         struct inode *inode,
  34         struct file *filp,
  35         char *buf,
  36     int count)
  37 {
  38         /* We have to set the access time because msdos don't care */
  39         int ret = msdos_file_read(inode,filp,buf,count);
  40         if (!IS_RDONLY(inode)){
  41                 inode->i_atime = CURRENT_TIME;
  42                 inode->i_dirt = 1;
  43         }
  44         return ret;
  45 }
  46 /*
  47         Write a file from user space memory
  48 */
  49 static int UMSDOS_file_write(
     /* [previous][next][first][last][top][bottom][index][help] */
  50         struct inode *inode,
  51         struct file *filp,
  52         const char *buf,
  53     int count)
  54 {
  55         return msdos_file_write(inode,filp,buf,count);
  56 }
  57 /*
  58         Truncate a file to 0 length.
  59 */
  60 static void UMSDOS_truncate(struct inode *inode)
     /* [previous][next][first][last][top][bottom][index][help] */
  61 {
  62         PRINTK (("UMSDOS_truncate\n"));
  63         msdos_truncate (inode);
  64         inode->i_ctime = inode->i_mtime = CURRENT_TIME;
  65         inode->i_dirt = 1;
  66 }
  67 
  68 /* Function for normal file system (512 bytes hardware sector size) */
  69 struct file_operations umsdos_file_operations = {
  70         NULL,                           /* lseek - default */
  71         UMSDOS_file_read,       /* read */
  72         UMSDOS_file_write,      /* write */
  73         NULL,                           /* readdir - bad */
  74         NULL,                           /* select - default */
  75         NULL,                           /* ioctl - default */
  76         generic_mmap,                   /* mmap */
  77         NULL,                           /* no special open is needed */
  78         NULL,                           /* release */
  79         file_fsync                      /* fsync */
  80 };
  81 
  82 struct inode_operations umsdos_file_inode_operations = {
  83         &umsdos_file_operations,        /* default file operations */
  84         NULL,                   /* create */
  85         NULL,                   /* lookup */
  86         NULL,                   /* link */
  87         NULL,                   /* unlink */
  88         NULL,                   /* symlink */
  89         NULL,                   /* mkdir */
  90         NULL,                   /* rmdir */
  91         NULL,                   /* mknod */
  92         NULL,                   /* rename */
  93         NULL,                   /* readlink */
  94         NULL,                   /* follow_link */
  95         msdos_bmap,             /* bmap */
  96         UMSDOS_truncate,/* truncate */
  97         NULL,                   /* permission */
  98         msdos_smap              /* smap */
  99 };
 100 /* For other with larger and unaligned file system */
 101 struct file_operations umsdos_file_operations_no_bmap = {
 102         NULL,                           /* lseek - default */
 103         UMSDOS_file_read,       /* read */
 104         UMSDOS_file_write,      /* write */
 105         NULL,                           /* readdir - bad */
 106         NULL,                           /* select - default */
 107         NULL,                           /* ioctl - default */
 108         msdos_mmap,                     /* mmap */
 109         NULL,                           /* no special open is needed */
 110         NULL,                           /* release */
 111         file_fsync                      /* fsync */
 112 };
 113 
 114 struct inode_operations umsdos_file_inode_operations_no_bmap = {
 115         &umsdos_file_operations_no_bmap,        /* default file operations */
 116         NULL,                   /* create */
 117         NULL,                   /* lookup */
 118         NULL,                   /* link */
 119         NULL,                   /* unlink */
 120         NULL,                   /* symlink */
 121         NULL,                   /* mkdir */
 122         NULL,                   /* rmdir */
 123         NULL,                   /* mknod */
 124         NULL,                   /* rename */
 125         NULL,                   /* readlink */
 126         NULL,                   /* follow_link */
 127         NULL,                   /* bmap */
 128         UMSDOS_truncate,/* truncate */
 129         NULL,                   /* permission */
 130         NULL,                   /* smap */
 131 };
 132 

/* [previous][next][first][last][top][bottom][index][help] */