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

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