Fork me on GitHub

root/kernel/syscalls/fstatfs.c

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

DEFINITIONS

This source file includes following definitions.
  1. sys_fstatfs

   1 /*
   2  * fiwix/kernel/syscalls/fstatfs.c
   3  *
   4  * Copyright 2018, Jordi Sanfeliu. All rights reserved.
   5  * Distributed under the terms of the Fiwix License.
   6  */
   7 
   8 #include <fiwix/fs.h>
   9 #include <fiwix/statfs.h>
  10 #include <fiwix/errno.h>
  11 
  12 #ifdef __DEBUG__
  13 #include <fiwix/stdio.h>
  14 #include <fiwix/process.h>
  15 #endif /*__DEBUG__ */
  16 
  17 int sys_fstatfs(unsigned int ufd, struct statfs *statfsbuf)
  18 {
  19         struct inode *i;
  20         int errno;
  21 
  22 #ifdef __DEBUG__
  23         printk("(pid %d) sys_fstatfs(%d, 0x%08x)\n", current->pid, ufd, (unsigned int)statfsbuf);
  24 #endif /*__DEBUG__ */
  25 
  26         CHECK_UFD(ufd);
  27         if((errno = check_user_area(VERIFY_WRITE, statfsbuf, sizeof(struct statfs)))) {
  28                 return errno;
  29         }
  30         i = fd_table[current->fd[ufd]].inode;
  31         if(i->sb && i->sb->fsop && i->sb->fsop->statfs) {
  32                 i->sb->fsop->statfs(i->sb, statfsbuf);
  33                 return 0;
  34         }
  35         return -ENOSYS;
  36 }

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