Blame src/helper/tpax_stat_compare.c

5874a9
/**************************************************************/
5874a9
/*  tpax: a topological pax implementation                    */
5874a9
/*  Copyright (C) 2020--2021  SysDeer Technologies, LLC       */
5874a9
/*  Released under GPLv2 and GPLv3; see COPYING.TPAX.         */
5874a9
/**************************************************************/
845037
845037
#include <stdint.h>
845037
#include <stdlib.h>
845037
#include <string.h>
845037
#include <errno.h>
845037
#include <sys/stat.h>
845037
845037
#include <tpax/tpax.h>
845037
#include "tpax_driver_impl.h"
845037
845037
#define TPAX_STAT_COMPARE(member)                    \
845037
	if (src -> member - dst -> member)            \
845037
		return (src -> member > dst -> member) \
845037
			? (1) : (-1)
845037
845037
int tpax_stat_compare(
845037
	const struct stat * src,
845037
	const struct stat * dst)
845037
{
845037
	TPAX_STAT_COMPARE(st_dev);
845037
	TPAX_STAT_COMPARE(st_ino);
845037
845037
	TPAX_STAT_COMPARE(st_mode);
845037
	TPAX_STAT_COMPARE(st_uid);
845037
	TPAX_STAT_COMPARE(st_gid);
845037
845037
	TPAX_STAT_COMPARE(st_rdev);
845037
	TPAX_STAT_COMPARE(st_size);
845037
	TPAX_STAT_COMPARE(st_blksize);
845037
	TPAX_STAT_COMPARE(st_blocks);
845037
845037
	TPAX_STAT_COMPARE(st_mtim.tv_sec);
845037
	TPAX_STAT_COMPARE(st_mtim.tv_nsec);
845037
845037
	return 0;
845037
}