XRootD
Loading...
Searching...
No Matches
XrdSysStatxHelpers Class Reference

#include <XrdSysStatx.hh>

Collaboration diagram for XrdSysStatxHelpers:

Static Public Member Functions

static size_t GetSize (const XrdSysStatx &buf)
static void Stat2Statx (const struct stat &stat, XrdSysStatx &statx)
static void StatT2StatxT (const struct timespec &sta_T, statx_timestamp &stx_T)
static void Statx2Stat (const XrdSysStatx &statx, struct stat &stat)
static void StatxT2StatT (const statx_timestamp &stx_T, struct timespec &sta_T)

Detailed Description

Definition at line 56 of file XrdSysStatx.hh.

Member Function Documentation

◆ GetSize()

size_t XrdSysStatxHelpers::GetSize ( const XrdSysStatx & buf)
inlinestatic

Returns the size of the XrdSysStatx buf passed in parameter

Parameters
buf- the buffer from which we return the size

Definition at line 90 of file XrdSysStatx.hh.

90 {
91#ifdef HAVE_STATX
92 return buf.stx_size;
93#else
94 return buf.statx.st_size;
95#endif
96 }
struct stat statx

References XrdSysStatx::statx.

◆ Stat2Statx()

void XrdSysStatxHelpers::Stat2Statx ( const struct stat & stat,
XrdSysStatx & statx )
inlinestatic

Converts a stat structure into a statx structure

Parameters
statthe stat structure to convert
statxthe converted statx structure

Definition at line 109 of file XrdSysStatx.hh.

109 {
110#ifdef HAVE_STATX
111 memset(&stx, 0, sizeof(stx));
112 stx.stx_mask = STATX_BASIC_STATS;
113 stx.stx_blksize = st.st_blksize;
114 stx.stx_nlink = st.st_nlink;
115 stx.stx_uid = st.st_uid;
116 stx.stx_gid = st.st_gid;
117 stx.stx_mode = st.st_mode;
118 stx.stx_ino = st.st_ino;
119 stx.stx_size = st.st_size;
120 stx.stx_blocks = st.st_blocks;
121 StatT2StatxT(st.st_atim, stx.stx_atime);
122 StatT2StatxT(st.st_mtim, stx.stx_mtime);
123 StatT2StatxT(st.st_ctim, stx.stx_ctime);
124 stx.stx_dev_major = major(st.st_dev);
125 stx.stx_dev_minor = minor(st.st_dev);
126 stx.stx_rdev_major = major(st.st_rdev);
127 stx.stx_rdev_minor = minor(st.st_rdev);
128#else
129 // In that case, stx.statx and st are identical definition. See XrdSysStatx.hh
130 stx.stx_mask = STATX_BASIC_STATS;
131 stx.statx = st;
132#endif
133}
#define STATX_BASIC_STATS
static void StatT2StatxT(const struct timespec &sta_T, statx_timestamp &stx_T)

References stat, StatT2StatxT(), XrdSysStatx::statx, STATX_BASIC_STATS, and XrdSysStatx::stx_mask.

Referenced by Xrd_U_Statx(), and XrdPosix_Statx().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ StatT2StatxT()

void XrdSysStatxHelpers::StatT2StatxT ( const struct timespec & sta_T,
statx_timestamp & stx_T )
inlinestatic

Converts a stat timestamp to a statx timestamp

Parameters
sta_Tthe stat timestamp to convert
stx_Tthe converted statx timestamp

Definition at line 104 of file XrdSysStatx.hh.

104 {
105 stx_T.tv_sec = sta_T.tv_sec;
106 stx_T.tv_nsec = sta_T.tv_nsec;
107}

Referenced by Stat2Statx().

Here is the caller graph for this function:

◆ Statx2Stat()

void XrdSysStatxHelpers::Statx2Stat ( const XrdSysStatx & statx,
struct stat & stat )
inlinestatic

Converts a statx structure into a stat structure

Parameters
statxthe statx structure to convert
statthe converted stat structure

Definition at line 135 of file XrdSysStatx.hh.

135 {
136#ifdef HAVE_STATX
137 memset(&st, 0, sizeof(st));
138
144
145 if (stx.stx_mask & STATX_NLINK)
146 st.st_nlink = stx.stx_nlink;
147 if (stx.stx_mask & STATX_UID)
148 st.st_uid = stx.stx_uid;
149 if (stx.stx_mask & STATX_GID)
150 st.st_gid = stx.stx_gid;
151 if (stx.stx_mask & STATX_MODE)
152 st.st_mode = stx.stx_mode;
153 if (stx.stx_mask & STATX_INO)
154 st.st_ino = stx.stx_ino;
155 if (stx.stx_mask & STATX_SIZE)
156 st.st_size = stx.stx_size;
157 if (stx.stx_mask & STATX_BLOCKS)
158 st.st_blocks = stx.stx_blocks;
159 if (stx.stx_mask & STATX_ATIME)
160 StatxT2StatT(stx.stx_atime, st.st_atim);
161 if (stx.stx_mask & STATX_MTIME)
162 StatxT2StatT(stx.stx_mtime, st.st_mtim);
163 if (stx.stx_mask & STATX_CTIME)
164 StatxT2StatT(stx.stx_ctime, st.st_ctim);
165 if (stx.stx_mask & STATX_BASIC_STATS) {
166 // There is no mask for those three attributes, so let's use the STATX_BASIC_STATS one
167 st.st_dev = makedev(stx.stx_dev_major, stx.stx_dev_minor);
168 st.st_rdev = makedev(stx.stx_rdev_major, stx.stx_rdev_minor);
169 st.st_blksize = stx.stx_blksize;
170 }
171
172#else
173 // In that case, stx.statx and st are identical definition. See XrdSysStatx.hh
174 st = stx.statx;
175#endif
176}
static void StatxT2StatT(const statx_timestamp &stx_T, struct timespec &sta_T)

References stat, XrdSysStatx::statx, STATX_BASIC_STATS, StatxT2StatT(), and XrdSysStatx::stx_mask.

Here is the call graph for this function:

◆ StatxT2StatT()

void XrdSysStatxHelpers::StatxT2StatT ( const statx_timestamp & stx_T,
struct timespec & sta_T )
inlinestatic

Converts a statx timestamp to a stat timestamp

Parameters
stx_Tthe statx timestamp to convert
sta_Tthe converted stat timestamp

Definition at line 99 of file XrdSysStatx.hh.

99 {
100 sta_T.tv_sec = stx_T.tv_sec;
101 sta_T.tv_nsec = stx_T.tv_nsec;
102}

Referenced by Statx2Stat().

Here is the caller graph for this function:

The documentation for this class was generated from the following file: