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

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