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         inode->i_atime = CURRENT_TIME;
  41         inode->i_dirt = 1;
  42         return ret;
  43 }
  44 /*
  45         Write a file from user space memory
  46 */
  47 static int UMSDOS_file_write(
     /* [previous][next][first][last][top][bottom][index][help] */
  48         struct inode *inode,
  49         struct file *filp,
  50         char *buf,
  51     int count)
  52 {
  53         return msdos_file_write(inode,filp,buf,count);
  54 }
  55 /*
  56         Truncate a file to 0 length.
  57 */
  58 static void UMSDOS_truncate(struct inode *inode)
     /* [previous][next][first][last][top][bottom][index][help] */
  59 {
  60         PRINTK (("UMSDOS_truncate\n"));
  61         msdos_truncate (inode);
  62         inode->i_ctime = inode->i_mtime = CURRENT_TIME;
  63         inode->i_dirt = 1;
  64 }
  65 
  66 /* Function for normal file system (512 bytes hardware sector size) */
  67 struct file_operations umsdos_file_operations = {
  68         NULL,                           /* lseek - default */
  69         UMSDOS_file_read,       /* read */
  70         UMSDOS_file_write,      /* write */
  71         NULL,                           /* readdir - bad */
  72         NULL,                           /* select - default */
  73         NULL,                           /* ioctl - default */
  74         generic_mmap,                   /* mmap */
  75         NULL,                           /* no special open is needed */
  76         NULL,                           /* release */
  77         file_fsync                      /* fsync */
  78 };
  79 
  80 struct inode_operations umsdos_file_inode_operations = {
  81         &umsdos_file_operations,        /* default file operations */
  82         NULL,                   /* create */
  83         NULL,                   /* lookup */
  84         NULL,                   /* link */
  85         NULL,                   /* unlink */
  86         NULL,                   /* symlink */
  87         NULL,                   /* mkdir */
  88         NULL,                   /* rmdir */
  89         NULL,                   /* mknod */
  90         NULL,                   /* rename */
  91         NULL,                   /* readlink */
  92         NULL,                   /* follow_link */
  93         msdos_bmap,             /* bmap */
  94         UMSDOS_truncate,/* truncate */
  95         NULL,                   /* permission */
  96         msdos_smap              /* smap */
  97 };
  98 /* For other with larger and unaligned file system */
  99 struct file_operations umsdos_file_operations_no_bmap = {
 100         NULL,                           /* lseek - default */
 101         UMSDOS_file_read,       /* read */
 102         UMSDOS_file_write,      /* write */
 103         NULL,                           /* readdir - bad */
 104         NULL,                           /* select - default */
 105         NULL,                           /* ioctl - default */
 106         msdos_mmap,                     /* mmap */
 107         NULL,                           /* no special open is needed */
 108         NULL,                           /* release */
 109         file_fsync                      /* fsync */
 110 };
 111 
 112 struct inode_operations umsdos_file_inode_operations_no_bmap = {
 113         &umsdos_file_operations_no_bmap,        /* default file operations */
 114         NULL,                   /* create */
 115         NULL,                   /* lookup */
 116         NULL,                   /* link */
 117         NULL,                   /* unlink */
 118         NULL,                   /* symlink */
 119         NULL,                   /* mkdir */
 120         NULL,                   /* rmdir */
 121         NULL,                   /* mknod */
 122         NULL,                   /* rename */
 123         NULL,                   /* readlink */
 124         NULL,                   /* follow_link */
 125         NULL,                   /* bmap */
 126         UMSDOS_truncate,/* truncate */
 127         NULL,                   /* permission */
 128         NULL,                   /* smap */
 129 };
 130 

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