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 = fat_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 fat_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         fat_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_file_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         generic_readpage,       /* readpage */
  91         NULL,                   /* writepage */
  92         fat_bmap,               /* bmap */
  93         UMSDOS_truncate,/* truncate */
  94         NULL,                   /* permission */
  95         fat_smap                /* smap */
  96 };
  97 /* For other with larger and unaligned file system */
  98 struct file_operations umsdos_file_operations_no_bmap = {
  99         NULL,                           /* lseek - default */
 100         UMSDOS_file_read,       /* read */
 101         UMSDOS_file_write,      /* write */
 102         NULL,                           /* readdir - bad */
 103         NULL,                           /* select - default */
 104         NULL,                           /* ioctl - default */
 105         fat_mmap,                       /* mmap */
 106         NULL,                           /* no special open is needed */
 107         NULL,                           /* release */
 108         file_fsync                      /* fsync */
 109 };
 110 
 111 struct inode_operations umsdos_file_inode_operations_no_bmap = {
 112         &umsdos_file_operations_no_bmap,        /* default file operations */
 113         NULL,                   /* create */
 114         NULL,                   /* lookup */
 115         NULL,                   /* link */
 116         NULL,                   /* unlink */
 117         NULL,                   /* symlink */
 118         NULL,                   /* mkdir */
 119         NULL,                   /* rmdir */
 120         NULL,                   /* mknod */
 121         NULL,                   /* rename */
 122         NULL,                   /* readlink */
 123         NULL,                   /* follow_link */
 124         NULL,                   /* readpage */
 125         NULL,                   /* writepage */
 126         NULL,                   /* bmap */
 127         UMSDOS_truncate,/* truncate */
 128         NULL,                   /* permission */
 129         NULL,                   /* smap */
 130 };
 131 

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