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

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