root/fs/ext2/ioctl.c

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

DEFINITIONS

This source file includes following definitions.
  1. ext2_ioctl

   1 /*
   2  * linux/fs/ext2/ioctl.c
   3  *
   4  * Copyright (C) 1993, 1994  Remy Card (card@masi.ibp.fr)
   5  *                           Laboratoire MASI - Institut Blaise Pascal
   6  *                           Universite Pierre et Marie Curie (Paris VI)
   7  */
   8 
   9 #include <asm/segment.h>
  10 
  11 #include <linux/errno.h>
  12 #include <linux/fs.h>
  13 #include <linux/ext2_fs.h>
  14 #include <linux/ioctl.h>
  15 #include <linux/sched.h>
  16 
  17 int ext2_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
     /* [previous][next][first][last][top][bottom][index][help] */
  18                 unsigned long arg)
  19 {
  20 
  21         ext2_debug ("cmd = %u, arg = %lu\n", cmd, arg);
  22 
  23         switch (cmd) {
  24         case EXT2_IOC_GETFLAGS:
  25                 put_fs_long (inode->u.ext2_i.i_flags, (long *) arg);
  26                 return 0;
  27         case EXT2_IOC_SETFLAGS:
  28                 if ((current->euid != inode->i_uid) && !suser())
  29                         return -EPERM;
  30                 if (IS_RDONLY(inode))
  31                         return -EROFS;
  32                 inode->u.ext2_i.i_flags = get_fs_long ((long *) arg);
  33                 inode->i_ctime = CURRENT_TIME;
  34                 inode->i_dirt = 1;
  35                 return 0;
  36         case EXT2_IOC_GETVERSION:
  37                 put_fs_long (inode->u.ext2_i.i_version, (long *) arg);
  38                 return 0;
  39         case EXT2_IOC_SETVERSION:
  40                 if ((current->euid != inode->i_uid) && !suser())
  41                         return -EPERM;
  42                 if (IS_RDONLY(inode))
  43                         return -EROFS;
  44                 inode->u.ext2_i.i_version = get_fs_long ((long *) arg);
  45                 inode->i_ctime = CURRENT_TIME;
  46                 inode->i_dirt = 1;
  47                 return 0;
  48         default:
  49                 return -EINVAL;
  50         }
  51 }

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