blob: afbe2f484f6e78ae17f2b1a6503c3e5d4ec5b494 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
/******************************************************/
/* tpax: a topological pax implementation */
/* Copyright (C) 2020 Z. Gilboa */
/* Released under GPLv2 and GPLv3; see COPYING.TPAX. */
/******************************************************/
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <sys/stat.h>
#include <tpax/tpax.h>
#include "tpax_driver_impl.h"
#define TPAX_STAT_COMPARE(member) \
if (src -> member - dst -> member) \
return (src -> member > dst -> member) \
? (1) : (-1)
int tpax_stat_compare(
const struct stat * src,
const struct stat * dst)
{
TPAX_STAT_COMPARE(st_dev);
TPAX_STAT_COMPARE(st_ino);
TPAX_STAT_COMPARE(st_mode);
TPAX_STAT_COMPARE(st_uid);
TPAX_STAT_COMPARE(st_gid);
TPAX_STAT_COMPARE(st_rdev);
TPAX_STAT_COMPARE(st_size);
TPAX_STAT_COMPARE(st_blksize);
TPAX_STAT_COMPARE(st_blocks);
TPAX_STAT_COMPARE(st_mtim.tv_sec);
TPAX_STAT_COMPARE(st_mtim.tv_nsec);
return 0;
}
|