• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /****************************************************************************
2  * include/sys/statfs.h
3  *
4  * Licensed to the Apache Software Foundation (ASF) under one or more
5  * contributor license agreements.  See the NOTICE file distributed with
6  * this work for additional information regarding copyright ownership.  The
7  * ASF licenses this file to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance with the
9  * License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
16  * License for the specific language governing permissions and limitations
17  * under the License.
18  *
19  ****************************************************************************/
20 
21 #ifndef __INCLUDE_SYS_STATFS_H
22 #define __INCLUDE_SYS_STATFS_H
23 
24 /****************************************************************************
25  * Included Files
26  ****************************************************************************/
27 
28 #include <nuttx/config.h>
29 
30 #include <sys/types.h>
31 #include <stdint.h>
32 
33 /****************************************************************************
34  * Pre-processor Definitions
35  ****************************************************************************/
36 
37 /* struct statfs file system types. */
38 
39 #define ADFS_SUPER_MAGIC      0xadf5
40 #define AFFS_SUPER_MAGIC      0xadff
41 #define BEFS_SUPER_MAGIC      0x42465331
42 #define BFS_MAGIC             0x1badface
43 #define CIFS_MAGIC_NUMBER     0xff534d42
44 #define CODA_SUPER_MAGIC      0x73757245
45 #define COH_SUPER_MAGIC       0x012ff7b7
46 #define CRAMFS_MAGIC          0x28cd3d45
47 #define DEVFS_SUPER_MAGIC     0x1373
48 #define EFS_SUPER_MAGIC       0x00414a53
49 #define EXT_SUPER_MAGIC       0x137d
50 #define EXT2_OLD_SUPER_MAGIC  0xef51
51 #define EXT2_SUPER_MAGIC      0xef53
52 #define EXT3_SUPER_MAGIC      0xef53
53 #define HFS_SUPER_MAGIC       0x4244
54 #define HPFS_SUPER_MAGIC      0xf995e849
55 #define HUGETLBFS_MAGIC       0x958458f6
56 #define ISOFS_SUPER_MAGIC     0x9660
57 #define JFFS2_SUPER_MAGIC     0x72b6
58 #define JFS_SUPER_MAGIC       0x3153464a
59 #define MINIX_SUPER_MAGIC     0x137f /* orig. minix */
60 #define MINIX_SUPER_MAGIC2    0x138f /* 30 char minix */
61 #define MINIX2_SUPER_MAGIC    0x2468 /* minix V2 */
62 #define MINIX2_SUPER_MAGIC2   0x2478 /* minix V2, 30 char names */
63 #define MSDOS_SUPER_MAGIC     0x4d44
64 #define NCP_SUPER_MAGIC       0x564c
65 #define NFS_SUPER_MAGIC       0x6969
66 #define NTFS_SB_MAGIC         0x5346544e
67 #define OPENPROM_SUPER_MAGIC  0x9fa1
68 #define PROC_SUPER_MAGIC      0x9fa0
69 #define QNX4_SUPER_MAGIC      0x002f
70 #define REISERFS_SUPER_MAGIC  0x52654973
71 #define ROMFS_MAGIC           0x7275
72 #define SMB_SUPER_MAGIC       0x517B
73 #define SYSV2_SUPER_MAGIC     0x012ff7b6
74 #define SYSV4_SUPER_MAGIC     0x012FF7B5
75 #define TMPFS_MAGIC           0x01021994
76 #define UDF_SUPER_MAGIC       0x15013346
77 #define UFS_MAGIC             0x00011954
78 #define USBDEVICE_SUPER_MAGIC 0x9fa2
79 #define VXFS_SUPER_MAGIC      0xa501fcf5
80 #define XENIX_SUPER_MAGIC     0x012ff7b4
81 #define XFS_SUPER_MAGIC       0x58465342
82 #define _XIAFS_SUPER_MAGIC    0x012fd16d
83 #define SPIFFS_SUPER_MAGIC    0x20090315
84 #define LITTLEFS_SUPER_MAGIC  0x0a732923
85 #define ZPFS_MAGIC            0xa000e93
86 
87 /* NuttX specific file-systems */
88 
89 #define BINFS_MAGIC           0x4242
90 #define PROCFS_MAGIC          0x434f5250
91 #define NXFFS_MAGIC           0x4747
92 #define SMARTFS_MAGIC         0x54524D53
93 #define UNIONFS_MAGIC         0x53464e55
94 #define HOSTFS_MAGIC          0x54534f48
95 #define USERFS_MAGIC          0x52455355
96 #define CROMFS_MAGIC          0x4d4f5243
97 
98 /****************************************************************************
99  * Type Definitions
100  ****************************************************************************/
101 
102 struct statfs
103 {
104   uint32_t f_type;     /* Type of filesystem (see definitions above) */
105   size_t   f_namelen;  /* Maximum length of filenames */
106   size_t   f_bsize;    /* Optimal block size for transfers */
107   off_t    f_blocks;   /* Total data blocks in the file system of this size */
108   off_t    f_bfree;    /* Free blocks in the file system */
109   off_t    f_bavail;   /* Free blocks avail to non-superuser */
110   off_t    f_files;    /* Total file nodes in the file system */
111   off_t    f_ffree;    /* Free file nodes in the file system */
112 };
113 
114 /****************************************************************************
115  * Public Function Prototypes
116  ****************************************************************************/
117 
118 #undef EXTERN
119 #if defined(__cplusplus)
120 #define EXTERN extern "C"
121 extern "C"
122 {
123 #else
124 #define EXTERN extern
125 #endif
126 
127 /* Inspired by Linux statfs() which was, in turn, inspired by
128  * the BSD statfs(). None of these implementations agree in the
129  * form of the struct statfs.
130  */
131 
132 int statfs(FAR const char *path, FAR struct statfs *buf);
133 int fstatfs(int fd, FAR struct statfs *buf);
134 
135 #undef EXTERN
136 #if defined(__cplusplus)
137 }
138 #endif
139 
140 #endif /* __INCLUDE_SYS_STATFS_H */
141