Home | History | Annotate | Download | only in sys
      1 /*
      2  * Copyright (C) 2014 The Android Open Source Project
      3  * All rights reserved.
      4  *
      5  * Redistribution and use in source and binary forms, with or without
      6  * modification, are permitted provided that the following conditions
      7  * are met:
      8  *  * Redistributions of source code must retain the above copyright
      9  *    notice, this list of conditions and the following disclaimer.
     10  *  * Redistributions in binary form must reproduce the above copyright
     11  *    notice, this list of conditions and the following disclaimer in
     12  *    the documentation and/or other materials provided with the
     13  *    distribution.
     14  *
     15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     16  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     17  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
     18  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
     19  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
     20  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
     21  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
     22  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
     23  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
     24  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
     25  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     26  * SUCH DAMAGE.
     27  */
     28 #ifndef _SYS_VFS_H_
     29 #define _SYS_VFS_H_
     30 
     31 #include <stdint.h>
     32 #include <sys/cdefs.h>
     33 #include <sys/types.h>
     34 
     35 __BEGIN_DECLS
     36 
     37 /* The kernel's __kernel_fsid_t has a 'val' member but glibc uses '__val'. */
     38 typedef struct { int __val[2]; } __fsid_t;
     39 typedef __fsid_t fsid_t;
     40 
     41 #define __STATFS64_BODY \
     42   uint64_t f_type; \
     43   uint64_t f_bsize; \
     44   uint64_t f_blocks; \
     45   uint64_t f_bfree; \
     46   uint64_t f_bavail; \
     47   uint64_t f_files; \
     48   uint64_t f_ffree; \
     49   fsid_t f_fsid; \
     50   uint64_t f_namelen; \
     51   uint64_t f_frsize; \
     52   uint64_t f_flags; \
     53   uint64_t f_spare[5];
     54 
     55 
     56 struct statfs { __STATFS64_BODY };
     57 struct statfs64 { __STATFS64_BODY };
     58 
     59 #undef __STATFS64_BODY
     60 
     61 /* Declare that we have the f_namelen, f_frsize, and f_flags fields. */
     62 #define _STATFS_F_NAMELEN
     63 #define _STATFS_F_FRSIZE
     64 #define _STATFS_F_FLAGS
     65 
     66 #define  ADFS_SUPER_MAGIC      0xadf5
     67 #define  AFFS_SUPER_MAGIC      0xADFF
     68 #define  BEFS_SUPER_MAGIC      0x42465331
     69 #define  BFS_MAGIC             0x1BADFACE
     70 #define  CIFS_MAGIC_NUMBER     0xFF534D42
     71 #define  CODA_SUPER_MAGIC      0x73757245
     72 #define  COH_SUPER_MAGIC       0x012FF7B7
     73 #define  CRAMFS_MAGIC          0x28cd3d45
     74 #define  DEVFS_SUPER_MAGIC     0x1373
     75 #define  EFS_SUPER_MAGIC       0x00414A53
     76 #define  EXT_SUPER_MAGIC       0x137D
     77 #define  EXT2_OLD_SUPER_MAGIC  0xEF51
     78 #define  EXT2_SUPER_MAGIC      0xEF53
     79 #define  EXT3_SUPER_MAGIC      0xEF53
     80 #define  HFS_SUPER_MAGIC       0x4244
     81 #define  HPFS_SUPER_MAGIC      0xF995E849
     82 #define  HUGETLBFS_MAGIC       0x958458f6
     83 #define  ISOFS_SUPER_MAGIC     0x9660
     84 #define  JFFS2_SUPER_MAGIC     0x72b6
     85 #define  JFS_SUPER_MAGIC       0x3153464a
     86 #define  MINIX_SUPER_MAGIC     0x137F /* orig. minix */
     87 #define  MINIX_SUPER_MAGIC2    0x138F /* 30 char minix */
     88 #define  MINIX2_SUPER_MAGIC    0x2468 /* minix V2 */
     89 #define  MINIX2_SUPER_MAGIC2   0x2478 /* minix V2, 30 char names */
     90 #define  MSDOS_SUPER_MAGIC     0x4d44
     91 #define  NCP_SUPER_MAGIC       0x564c
     92 #define  NFS_SUPER_MAGIC       0x6969
     93 #define  NTFS_SB_MAGIC         0x5346544e
     94 #define  OPENPROM_SUPER_MAGIC  0x9fa1
     95 #define  PROC_SUPER_MAGIC      0x9fa0
     96 #define  QNX4_SUPER_MAGIC      0x002f
     97 #define  REISERFS_SUPER_MAGIC  0x52654973
     98 #define  ROMFS_MAGIC           0x7275
     99 #define  SMB_SUPER_MAGIC       0x517B
    100 #define  SYSV2_SUPER_MAGIC     0x012FF7B6
    101 #define  SYSV4_SUPER_MAGIC     0x012FF7B5
    102 #define  TMPFS_MAGIC           0x01021994
    103 #define  UDF_SUPER_MAGIC       0x15013346
    104 #define  UFS_MAGIC             0x00011954
    105 #define  USBDEVICE_SUPER_MAGIC 0x9fa2
    106 #define  VXFS_SUPER_MAGIC      0xa501FCF5
    107 #define  XENIX_SUPER_MAGIC     0x012FF7B4
    108 #define  XFS_SUPER_MAGIC       0x58465342
    109 #define  _XIAFS_SUPER_MAGIC    0x012FD16D
    110 
    111 extern int statfs(const char*, struct statfs*) __nonnull((1, 2));
    112 extern int statfs64(const char*, struct statfs64*) __nonnull((1, 2));
    113 extern int fstatfs(int, struct statfs*) __nonnull((2));
    114 extern int fstatfs64(int, struct statfs64*) __nonnull((2));
    115 
    116 __END_DECLS
    117 
    118 #endif /* _SYS_VFS_H_ */
    119