|
1 /* |
|
2 * stat.h - SAM-FS file information definitions. |
|
3 * |
|
4 * Defines the SAM-FS file information structure and functions. |
|
5 * The POSIX stat structure and associated macros are used to allow |
|
6 * the sam_stat structure to be used on various client machine |
|
7 * architectures. |
|
8 * |
|
9 */ |
|
10 |
|
11 /* |
|
12 * SAM-QFS_notice_begin |
|
13 * |
|
14 * Solaris 2.x Sun Storage & Archiving Management File System |
|
15 * |
|
16 * Copyright (c) 2007 Sun Microsystems, Inc. All Rights Reserved. |
|
17 * |
|
18 * U.S. Government Rights - Commercial software. Government users are |
|
19 * subject to the Sun Microsystems, Inc. standard license agreement and applicable |
|
20 * provisions of the FAR and its supplements. |
|
21 * |
|
22 * Use is subject to license terms. Sun, Sun Microsystems and the Sun logo |
|
23 * are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. |
|
24 * and other countries. |
|
25 * |
|
26 * SAM-QFS_notice_end |
|
27 */ |
|
28 |
|
29 /* |
|
30 * LGPL NOTICE |
|
31 * |
|
32 * This library is free software; you can redistribute it and/or |
|
33 * modify it under the terms of the GNU Lesser General Public |
|
34 * License as published by the Free Software Foundation; either |
|
35 * version 2.1 of the License, or (at your option) any later version. |
|
36 * |
|
37 * This library is distributed in the hope that it will be useful, |
|
38 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
39 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
40 * Lesser General Public License for more details. |
|
41 * |
|
42 * You should have received a copy of the GNU Lesser General Public |
|
43 * License along with this library; if not, write to the Free Software |
|
44 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
45 */ |
|
46 |
|
47 /* |
|
48 * $Revision$ |
|
49 */ |
|
50 |
|
51 #ifdef sun |
|
52 #pragma ident "$Revision$" |
|
53 #endif |
|
54 |
|
55 |
|
56 #ifndef SAM_STAT_H |
|
57 #define SAM_STAT_H |
|
58 |
|
59 #ifdef linux |
|
60 #include <sam/linux_types.h> /* u_longlong_t */ |
|
61 #endif /* linux */ |
|
62 |
|
63 #ifdef __cplusplus |
|
64 extern "C" { |
|
65 #endif |
|
66 |
|
67 #define MAX_ARCHIVE 4 |
|
68 #define SAM_MIN_SEGMENT_SIZE (1024*1024) /* Minimum segment size in bytes */ |
|
69 |
|
70 /* |
|
71 * If sam/stat.h and sys/stat.h are needed in the same module, then |
|
72 * sys/stat.h must be included before sam/stat.h. |
|
73 * The following is provided to avoid compilation errors: |
|
74 */ |
|
75 #if defined(_SYS_STAT_H) || defined(_LINUX_STAT_H) |
|
76 #undef st_atime |
|
77 #undef st_mtime |
|
78 #undef st_ctime |
|
79 #undef S_ISBLK |
|
80 #undef S_ISCHR |
|
81 #undef S_ISDIR |
|
82 #undef S_ISFIFO |
|
83 #undef S_ISGID |
|
84 #undef S_ISREG |
|
85 #undef S_ISUID |
|
86 #undef S_ISLNK |
|
87 #undef S_ISSOCK |
|
88 |
|
89 #ifdef linux |
|
90 #undef S_IRWXU |
|
91 #undef S_IRUSR |
|
92 #undef S_IWUSR |
|
93 #undef S_IXUSR |
|
94 #undef S_IRWXG |
|
95 #undef S_IRGRP |
|
96 #undef S_IWGRP |
|
97 #undef S_IXGRP |
|
98 #undef S_IRWXO |
|
99 #undef S_IROTH |
|
100 #undef S_IWOTH |
|
101 #undef S_IXOTH |
|
102 #endif /* linux */ |
|
103 |
|
104 #endif /* defined(_SYS_STAT_H) */ |
|
105 |
|
106 /* |
|
107 * NOTE that in order to pass the following structures from a 64-bit |
|
108 * kernel to a 32-bit application, we need to conditionally define the |
|
109 * positions of the 32-bit time and the pad differently for SPARC and X86. |
|
110 */ |
|
111 |
|
112 /* |
|
113 * Begin: 32-bit align copyin() structs for amd64 only due to 32-bit x86 ABI |
|
114 */ |
|
115 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4 |
|
116 #pragma pack(4) |
|
117 #endif |
|
118 |
|
119 #if defined(__sparcv9) || defined(__amd64) || defined(linux) |
|
120 |
|
121 struct sam_copy_s { /* For each archive copy. */ |
|
122 u_longlong_t position; /* Location of archive file */ |
|
123 time_t creation_time; /* Time archive copy created */ |
|
124 uint_t offset; /* Location of copy in archive file - */ |
|
125 /* in units of 512 bytes */ |
|
126 ushort_t flags; |
|
127 short n_vsns; /* Number of VSNs the archive used */ |
|
128 char media[4]; /* Media type */ |
|
129 char vsn[32]; /* VSN */ |
|
130 }; |
|
131 |
|
132 struct sam_stat { |
|
133 /* POSIX stat structure. */ |
|
134 uint_t st_mode; /* File mode */ |
|
135 uint_t st_ino; /* File serial number */ |
|
136 #ifdef sun |
|
137 dev_t st_dev; /* ID of the device containing the file */ |
|
138 #endif /* sun */ |
|
139 #ifdef linux |
|
140 ushort_t st_dev; /* ID of the device containing the file */ |
|
141 #endif /* linux */ |
|
142 uint_t st_nlink; /* Number of links */ |
|
143 uint_t st_uid; /* User ID of the file's owner */ |
|
144 uint_t st_gid; /* Group ID of the file's owner */ |
|
145 u_longlong_t st_size; /* The file size in bytes */ |
|
146 time_t st_atime; /* Time of last access */ |
|
147 time_t st_mtime; /* Time of last data modification */ |
|
148 time_t st_ctime; /* Time of last file status change */ |
|
149 |
|
150 /* SAM-FS information. */ |
|
151 time_t attribute_time; /* Time attributes last changed */ |
|
152 time_t creation_time; /* Time inode created */ |
|
153 time_t residence_time; /* Time file changed residence */ |
|
154 struct sam_copy_s copy[MAX_ARCHIVE]; |
|
155 uint_t attr; /* File attributes */ |
|
156 uchar_t cs_algo; /* Checksum algorithm indicator */ |
|
157 uchar_t flags; /* Flags: staging, stage err, etc. */ |
|
158 uchar_t stripe_width; /* Stripe width set by setfa -s */ |
|
159 uchar_t stripe_group; /* Stripe group set by setfa -g */ |
|
160 uint_t gen; /* File generation number */ |
|
161 uint_t partial_size; /* Partial size in kilobytes */ |
|
162 #ifdef sun |
|
163 dev_t rdev; /* ID of device if S_IFBLK or S_IFCHR */ |
|
164 #endif /* sun */ |
|
165 #ifdef linux |
|
166 ushort_t rdev; /* ID of device if S_IFBLK or S_IFCHR */ |
|
167 #endif /* linux */ |
|
168 u_longlong_t st_blocks; /* Block count in units of 512 byte blocks */ |
|
169 uint_t segment_size; /* Segment size in megabytes (SS_SEGMENT_A) */ |
|
170 uint_t segment_number; /* Number of this segment */ |
|
171 /* 0 - SS_SEGMENT_F, 1 .. n - SS_SEGMENT_S */ |
|
172 uint_t stage_ahead; /* Number of segments to stage ahead */ |
|
173 uint_t admin_id; /* admin ID; inherited from dir */ |
|
174 uint_t allocahead; /* Allocate ahead size set by setfa -A */ |
|
175 uint_t pad9; |
|
176 u_longlong_t cs_val[2]; /* 128 bit checksum */ |
|
177 }; |
|
178 |
|
179 #else /* __sparcv9 || __amd64 || linux */ |
|
180 |
|
181 struct sam_copy_s { /* For each archive copy. */ |
|
182 u_longlong_t position; /* Location of archive file */ |
|
183 #if defined(__i386) |
|
184 time_t creation_time; /* Time archive copy created */ |
|
185 ulong_t pad0; |
|
186 #else |
|
187 ulong_t pad0; |
|
188 time_t creation_time; /* Time archive copy created */ |
|
189 #endif /* __i386 */ |
|
190 ulong_t offset; /* Location of copy in archive file - */ |
|
191 /* in units of 512 bytes */ |
|
192 ushort_t flags; |
|
193 short n_vsns; /* Number of VSNs the archive used */ |
|
194 char media[4]; /* Media type */ |
|
195 char vsn[32]; /* VSN */ |
|
196 }; |
|
197 |
|
198 struct sam_stat { |
|
199 /* POSIX stat structure. */ |
|
200 ulong_t st_mode; /* File mode */ |
|
201 ulong_t st_ino; /* File serial number */ |
|
202 dev_t st_dev; /* ID of the device containing the file */ |
|
203 long pad1; |
|
204 ulong_t st_nlink; /* Number of links */ |
|
205 ulong_t st_uid; /* User ID of the file's owner */ |
|
206 ulong_t st_gid; /* Group ID of the file's owner */ |
|
207 u_longlong_t st_size; /* The file size in bytes */ |
|
208 #if defined(__i386) |
|
209 time_t st_atime; /* Time of last access */ |
|
210 ulong_t pad2; |
|
211 time_t st_mtime; /* Time of last data modification */ |
|
212 ulong_t pad3; |
|
213 time_t st_ctime; /* Time of last file status change */ |
|
214 ulong_t pad4; |
|
215 |
|
216 /* SAM-FS information. */ |
|
217 time_t attribute_time; /* Time attributes last changed */ |
|
218 ulong_t pad5; |
|
219 time_t creation_time; /* Time inode created */ |
|
220 ulong_t pad6; |
|
221 time_t residence_time; /* Time file changed residence */ |
|
222 ulong_t pad7; |
|
223 #else /* __i386 */ |
|
224 ulong_t pad2; |
|
225 time_t st_atime; /* Time of last access */ |
|
226 ulong_t pad3; |
|
227 time_t st_mtime; /* Time of last data modification */ |
|
228 ulong_t pad4; |
|
229 time_t st_ctime; /* Time of last file status change */ |
|
230 |
|
231 /* SAM-FS information. */ |
|
232 ulong_t pad5; |
|
233 time_t attribute_time; /* Time attributes last changed */ |
|
234 ulong_t pad6; |
|
235 time_t creation_time; /* Time inode created */ |
|
236 ulong_t pad7; |
|
237 time_t residence_time; /* Time file changed residence */ |
|
238 #endif /* __i386 */ |
|
239 struct sam_copy_s copy[MAX_ARCHIVE]; |
|
240 uint_t attr; /* File attributes */ |
|
241 uchar_t cs_algo; /* Checksum algorithm indicator */ |
|
242 uchar_t flags; /* Flags: staging, stage err, etc. */ |
|
243 uchar_t stripe_width; /* Stripe width set by setfa -s */ |
|
244 uchar_t stripe_group; /* Stripe group set by setfa -g */ |
|
245 ulong_t gen; /* File generation number */ |
|
246 ulong_t partial_size; /* Partial size in kilobytes */ |
|
247 dev_t rdev; /* ID of device if S_IFBLK or S_IFCHR */ |
|
248 ulong_t pad8; |
|
249 u_longlong_t st_blocks; /* Block count in units of 512 byte blocks */ |
|
250 ulong_t segment_size; /* Segment size in megabytes (SS_SEGMENT_A) */ |
|
251 ulong_t segment_number; /* Number of this segment */ |
|
252 /* 0 - SS_SEGMENT_F, 1 .. n - SS_SEGMENT_S */ |
|
253 uint_t stage_ahead; /* Number of segments to stage ahead */ |
|
254 ulong_t admin_id; /* admin ID; inherited from dir */ |
|
255 ulong_t allocahead; /* Allocate ahead size set by setfa -A */ |
|
256 ulong_t pad9; |
|
257 u_longlong_t cs_val[2]; /* 128 bit checksum */ |
|
258 }; |
|
259 |
|
260 #endif /* __sparcv9 || __amd64 || linux */ |
|
261 |
|
262 |
|
263 #define SAM_SECTION_SIZE(n) (sizeof (struct sam_section) * n) |
|
264 |
|
265 struct sam_section { /* For each archive copy volume section */ |
|
266 char vsn[32]; /* VSN */ |
|
267 u_longlong_t length; /* Section length of file on this volume */ |
|
268 u_longlong_t position; /* Position of archive file for this section */ |
|
269 u_longlong_t offset; /* Location of copy section in archive file */ |
|
270 }; |
|
271 |
|
272 /* |
|
273 * End: 32-bit align copyin() structs for amd64 only due to 32-bit x86 ABI |
|
274 */ |
|
275 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4 |
|
276 #pragma pack() |
|
277 #endif |
|
278 |
|
279 /* |
|
280 * POSIX symbols. |
|
281 */ |
|
282 |
|
283 #define S_IRWXU 00700 /* read, write, execute: owner */ |
|
284 #define S_IRUSR 00400 /* read permission: owner */ |
|
285 #define S_IWUSR 00200 /* write permission: owner */ |
|
286 #define S_IXUSR 00100 /* execute permission: owner */ |
|
287 #define S_IRWXG 00070 /* read, write, execute: group */ |
|
288 #define S_IRGRP 00040 /* read permission: group */ |
|
289 #define S_IWGRP 00020 /* write permission: group */ |
|
290 #define S_IXGRP 00010 /* execute permission: group */ |
|
291 #define S_IRWXO 00007 /* read, write, execute: other */ |
|
292 #define S_IROTH 00004 /* read permission: other */ |
|
293 |
|
294 #define S_IWOTH 00002 /* write permission: other */ |
|
295 #define S_IXOTH 00001 /* execute permission: other */ |
|
296 |
|
297 #define S_ISBLK(mode) (((mode)&0xf000) == 0x6000) |
|
298 #define S_ISCHR(mode) (((mode)&0xf000) == 0x2000) |
|
299 #define S_ISDIR(mode) (((mode)&0xf000) == 0x4000) |
|
300 #define S_ISFIFO(mode) (((mode)&0xf000) == 0x1000) |
|
301 #define S_ISGID(mode) ((mode)&0x400) /* set group id on execution */ |
|
302 #define S_ISREG(mode) (((mode)&0xf000) == 0x8000) |
|
303 #define S_ISUID(mode) ((mode)&0x800) /* set user id on execution */ |
|
304 #define S_ISLNK(mode) (((mode)&0xf000) == 0xa000) |
|
305 #define S_ISSOCK(mode) (((mode)&0xf000) == 0xc000) |
|
306 |
|
307 /* |
|
308 * SAMFS attributes mapped into sam_stat but not in inode (ino_status_t). |
|
309 */ |
|
310 #define SS_SAMFS 0x00000800 /* SAM-FS file */ |
|
311 #define SS_ARCHIVE_R 0x00002000 /* Re-archive */ |
|
312 #define SS_ARCHIVED 0x00010000 /* File has at least one archive copy */ |
|
313 #define SS_DATA_V 0x00040000 /* File requires data verification */ |
|
314 #define SS_AIO 0x00080000 /* AIO Char Device file */ |
|
315 #define SS_ARCHIVE_A 0x08000000 /* Archive immediate */ |
|
316 |
|
317 /* |
|
318 * SAMFS attributes from the inode. |
|
319 */ |
|
320 #define SS_REMEDIA 0x00000001 /* Removable media file */ |
|
321 #define SS_RELEASE_A 0x00000002 /* Release after archive */ |
|
322 #define SS_RELEASE_N 0x00000004 /* Release never (nodrop) */ |
|
323 #define SS_STAGE_N 0x00000008 /* Stage never (direct) */ |
|
324 |
|
325 #define SS_DAMAGED 0x00000010 /* File is damaged - not online and no copy */ |
|
326 #define SS_RELEASE_P 0x00000020 /* Release partial (bof_online) */ |
|
327 #define SS_ARCHIVE_N 0x00000040 /* Archive never (noarch) */ |
|
328 #define SS_STAGE_A 0x00000080 /* Stage associative (stageall) */ |
|
329 |
|
330 #define SS_CSVAL 0x00000100 /* Valid checksum exists in inode */ |
|
331 #define SS_CSUSE 0x00000200 /* Checksum will be used upon stage */ |
|
332 #define SS_CSGEN 0x00000400 /* Checksum will be generated upon archive */ |
|
333 /* SS_SAMFS 0x00000800 used by sam_stat() - see above */ |
|
334 |
|
335 #define SS_ARCHDONE 0x00001000 /* File has all required archiving done */ |
|
336 /* SS_ARCHIVE_R 0x00002000 used by sam_stat() - see above */ |
|
337 #define SS_PARTIAL 0x00004000 /* Partial extents are online */ |
|
338 #define SS_OFFLINE 0x00008000 /* File is offline */ |
|
339 |
|
340 /* SS_ARCHIVED 0x00010000 used by sam_stat() - see above */ |
|
341 #define SS_SEGMENT_A 0x00020000 /* Segment attribute */ |
|
342 /* SS_DATA_V 0x00040000 used by sam_stat() - see above */ |
|
343 /* SS_AIO 0x00080000 used by sam_stat() - see above */ |
|
344 |
|
345 #define SS_ARCHIVE_C 0x00100000 /* Archive concurrent */ |
|
346 #define SS_DIRECTIO 0x00200000 /* Directio */ |
|
347 #define SS_ARCHIVE_I 0x00400000 /* Archive inconsistent copies */ |
|
348 #define SS_WORM 0x00800000 /* Read only attribute (worm_attr) */ |
|
349 |
|
350 #define SS_READONLY 0x01000000 /* Read only file enabled (worm_set) */ |
|
351 #define SS_SEGMENT_S 0x02000000 /* This is a segment of a segmented file */ |
|
352 #define SS_SEGMENT_F 0x04000000 /* Stage/archive this file in segments */ |
|
353 /* SS_ARCHIVE_A 0x08000000 used by sam_stat() - see above */ |
|
354 |
|
355 #define SS_SETFA_S 0x10000000 /* Stripe width set by setfa -s */ |
|
356 #define SS_SETFA_G 0x20000000 /* Stripe group set by setfa -g */ |
|
357 |
|
358 #define SS_DFACL 0x40000000 /* Default access control list present */ |
|
359 #define SS_ACL 0x80000000 /* Access control list present */ |
|
360 |
|
361 #define SS_ISSAMFS(attr) (((attr)&SS_SAMFS) != 0) |
|
362 #define SS_ISREMEDIA(attr) (((attr)&SS_REMEDIA) != 0) |
|
363 #define SS_ISARCHIVED(attr) (((attr)&SS_ARCHIVED) != 0) |
|
364 #define SS_ISARCHDONE(attr) (((attr)&SS_ARCHDONE) != 0) |
|
365 #define SS_ISDAMAGED(attr) (((attr)&SS_DAMAGED) != 0) |
|
366 #define SS_ISOFFLINE(attr) (((attr)&SS_OFFLINE) != 0) |
|
367 #define SS_ISPARTIAL(attr) (((attr)&SS_PARTIAL) != 0) |
|
368 #define SS_ISARCHIVE_C(attr) (((attr)&SS_ARCHIVE_C) != 0) |
|
369 #define SS_ISARCHIVE_I(attr) (((attr)&SS_ARCHIVE_I) != 0) |
|
370 #define SS_ISARCHIVE_N(attr) (((attr)&SS_ARCHIVE_N) != 0) |
|
371 #define SS_ISARCHIVE_A(attr) (((attr)&SS_ARCHIVE_A) != 0) |
|
372 #define SS_ISARCHIVE_R(attr) (((attr)&SS_ARCHIVE_R) != 0) |
|
373 #define SS_ISRELEASE_A(attr) (((attr)&SS_RELEASE_A) != 0) |
|
374 #define SS_ISRELEASE_N(attr) (((attr)&SS_RELEASE_N) != 0) |
|
375 #define SS_ISRELEASE_P(attr) (((attr)&SS_RELEASE_P) != 0) |
|
376 #define SS_ISSTAGE_A(attr) (((attr)&SS_STAGE_A) != 0) |
|
377 #define SS_ISSTAGE_N(attr) (((attr)&SS_STAGE_N) != 0) |
|
378 #define SS_ISSEGMENT_A(attr) (((attr)&SS_SEGMENT_A) != 0) |
|
379 #define SS_ISSEGMENT_S(attr) (((attr)&SS_SEGMENT_S) != 0) |
|
380 #define SS_ISSEGMENT_F(attr) (((attr)&SS_SEGMENT_F) != 0) |
|
381 #define SS_ISCSGEN(attr) (((attr)&SS_CSGEN) != 0) |
|
382 #define SS_ISCSUSE(attr) (((attr)&SS_CSUSE) != 0) |
|
383 #define SS_ISCSVAL(attr) (((attr)&SS_CSVAL) != 0) |
|
384 #define SS_ISDIRECTIO(attr) (((attr)&SS_DIRECTIO) != 0) |
|
385 #define SS_ISSTAGE_M(attr) (((attr)&SS_STAGE_M) != 0) |
|
386 #define SS_ISWORM(attr) (((attr)&SS_WORM) != 0) |
|
387 #define SS_ISREADONLY(attr) (((attr)&SS_READONLY) != 0) |
|
388 #define SS_ISSETFA_G(attr) (((attr)&SS_SETFA_G) != 0) |
|
389 #define SS_ISSETFA_S(attr) (((attr)&SS_SETFA_S) != 0) |
|
390 #define SS_ISDFACL(attr) (((attr)&SS_DFACL) != 0) |
|
391 #define SS_ISACL(attr) (((attr)&SS_ACL) != 0) |
|
392 #define SS_ISDATAV(attr) (((attr)&SS_DATA_V) != 0) |
|
393 #define SS_ISAIO(attr) (((attr)&SS_AIO) != 0) |
|
394 |
|
395 /* |
|
396 * SAMFS flags. |
|
397 */ |
|
398 |
|
399 #define SS_STAGING 0x01 /* Stage is pending on the file */ |
|
400 #define SS_STAGEFAIL 0x02 /* Error occurred on last stage attempt */ |
|
401 |
|
402 #define SS_ISSTAGING(flags) (((flags)&SS_STAGING) != 0) |
|
403 #define SS_ISSTAGEFAIL(flags) (((flags)&SS_STAGEFAIL) != 0) |
|
404 |
|
405 /* |
|
406 * Copy flag masks. |
|
407 */ |
|
408 #define CF_STALE 0x0001 /* This archive copy is stale */ |
|
409 #define CF_REARCH 0x0002 /* Copy is to be rearchived */ |
|
410 #define CF_ARCH_I 0x0004 /* Copy is to be archived immediately */ |
|
411 #define CF_VERIFIED 0x0008 /* Copy has been verified */ |
|
412 #define CF_DAMAGED 0x0010 /* This archive copy is damaged */ |
|
413 #define CF_UNARCHIVED 0x0020 /* This archive copy was unarchived */ |
|
414 #define CF_INCONSISTENT 0x0040 /* This archive copy is inconsistent */ |
|
415 #define CF_ARCHIVED 0x0080 /* This archive copy made */ |
|
416 |
|
417 int sam_stat(const char *path, struct sam_stat *buf, size_t bufsize); |
|
418 int sam_lstat(const char *path, struct sam_stat *buf, size_t bufsize); |
|
419 int sam_vsn_stat(const char *path, int copy, struct sam_section *buf, |
|
420 size_t bufsize); |
|
421 int sam_segment_vsn_stat(const char *path, int copy, int segment_index, |
|
422 struct sam_section *buf, size_t bufsize); |
|
423 int sam_segment_stat(const char *path, struct sam_stat *buf, |
|
424 size_t bufsize); |
|
425 int sam_segment_lstat(const char *path, struct sam_stat *buf, |
|
426 size_t bufsize); |
|
427 int sam_restore_file(const char *path, struct sam_stat *buf, |
|
428 size_t bufsize); |
|
429 int sam_restore_copy(const char *path, int copy, struct sam_stat *buf, |
|
430 size_t bufsize, struct sam_section *vbuf, size_t vbufsize); |
|
431 |
|
432 /* |
|
433 * macro NUM_SEGS, takes in, fsbuff, a ptr to a sam_stat struct, returns the |
|
434 * number of segments of the file associated with fsbuff. |
|
435 */ |
|
436 |
|
437 #define NUM_SEGS(fsbuff) (int)(((fsbuff) == NULL || (fsbuff)->st_size <= 0 || \ |
|
438 (fsbuff)->segment_size <= 0 || \ |
|
439 !SS_ISSEGMENT_F((fsbuff)->attr)) ? 0 : \ |
|
440 ((fsbuff)->st_size + \ |
|
441 (offset_t)(fsbuff)->segment_size * (SAM_MIN_SEGMENT_SIZE) - 1LL) / \ |
|
442 ((offset_t)(fsbuff)->segment_size * (SAM_MIN_SEGMENT_SIZE))) |
|
443 |
|
444 #ifdef __cplusplus |
|
445 } |
|
446 #endif |
|
447 |
|
448 #endif /* SAM_STAT_H */ |