Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / include / statlite.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
2 // vim: ts=8 sw=2 smarttab
3 #ifndef CEPH_STATLITE_H
4 #define CEPH_STATLITE_H
5
6 extern "C" {
7
8 #include <time.h>
9 #include <sys/types.h>
10 #include <sys/stat.h>
11 #include <unistd.h>
12 #include <dirent.h>
13
14 struct statlite {
15   dev_t         st_dev;      /* device */
16   ino_t         st_ino;      /* inode */
17   mode_t        st_mode;     /* protection */
18   nlink_t       st_nlink;    /* number of hard links */
19   uid_t         st_uid;      /* user ID of owner */
20   gid_t         st_gid;      /* group ID of owner */
21   dev_t         st_rdev;     /* device type (if inode device)*/
22   unsigned long st_litemask; /* bit mask for optional fields */
23   /***************************************************************/
24   /**** Remaining fields are optional according to st_litemask ***/
25   off_t         st_size;     /* total size, in bytes         */
26   blksize_t     st_blksize;  /* blocksize for filesystem I/O */
27   blkcnt_t      st_blocks;   /* number of blocks allocated   */
28   struct timespec st_atim;            /* Time of last access.  */
29   struct timespec st_mtim;            /* Time of last modification.  */
30   struct timespec st_ctim;            /* Time of last status change.  */
31   //time_t        st_atime;    /* time of last access          */
32   //time_t        st_mtime;    /* time of last modification    */
33   //time_t        st_ctime;    /* time of last change          */
34 }; 
35
36 #define S_STATLITE_SIZE     1
37 #define S_STATLITE_BLKSIZE  2
38 #define S_STATLITE_BLOCKS   4
39 #define S_STATLITE_ATIME    8
40 #define S_STATLITE_MTIME    16
41 #define S_STATLITE_CTIME    32
42
43 #define S_REQUIRESIZE(m)      (m | S_STATLITE_SIZE)
44 #define S_REQUIREBLKSIZE(m)   (m | S_STATLITE_BLKSIZE)
45 #define S_REQUIREBLOCKS(m)    (m | S_STATLITE_BLOCKS)
46 #define S_REQUIREATIME(m)     (m | S_STATLITE_ATIME)
47 #define S_REQUIREMTIME(m)     (m | S_STATLITE_MTIME)
48 #define S_REQUIRECTIME(m)     (m | S_STATLITE_CTIME)
49
50 #define S_ISVALIDSIZE(m)      (m & S_STATLITE_SIZE)
51 #define S_ISVALIDBLKSIZE(m)   (m & S_STATLITE_BLKSIZE)
52 #define S_ISVALIDBLOCKS(m)    (m & S_STATLITE_BLOCKS)
53 #define S_ISVALIDATIME(m)     (m & S_STATLITE_ATIME)
54 #define S_ISVALIDMTIME(m)     (m & S_STATLITE_MTIME)
55 #define S_ISVALIDCTIME(m)     (m & S_STATLITE_CTIME)
56
57
58 // readdirplus etc.
59
60 struct dirent_plus {
61  struct dirent     d_dirent;  /* dirent struct for this entry */
62  struct stat       d_stat;    /* attributes for this entry */
63  int               d_stat_err;/* errno for d_stat, or 0 */
64 };
65 struct dirent_lite {
66  struct dirent     d_dirent;  /* dirent struct for this entry */
67  struct statlite   d_stat;    /* attributes for this entry */
68  int               d_stat_err;/* errno for d_stat, or 0 */
69 };
70
71 }
72 #endif