1 /* 2 * Utility functions for stat structures. 3 * 4 * Copyright (C) 2022 Paul Boddie <paul@boddie.org.uk> 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License as 8 * published by the Free Software Foundation; either version 2 of 9 * the License, or (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 * Boston, MA 02110-1301, USA 20 */ 21 22 #include "stat.h" 23 24 #define COPY_STAT(s1, s2) \ 25 s1->st_dev = s2->st_dev; \ 26 s1->st_ino = s2->st_ino; \ 27 s1->st_mode = s2->st_mode; \ 28 s1->st_nlink = s2->st_nlink; \ 29 s1->st_uid = s2->st_uid; \ 30 s1->st_gid = s2->st_gid; \ 31 s1->st_rdev = s2->st_rdev; \ 32 s1->st_size = s2->st_size; \ 33 s1->st_atim.tv_sec = s2->st_atim.tv_sec; \ 34 s1->st_atim.tv_nsec = s2->st_atim.tv_nsec; \ 35 s1->st_mtim.tv_sec = s2->st_mtim.tv_sec; \ 36 s1->st_mtim.tv_nsec = s2->st_mtim.tv_nsec; \ 37 s1->st_ctim.tv_sec = s2->st_ctim.tv_sec; \ 38 s1->st_ctim.tv_nsec = s2->st_ctim.tv_nsec; \ 39 s1->st_blksize = s2->st_blksize; \ 40 s1->st_blocks = s2->st_blocks; 41 42 void systypes_copy_from_sys_stat(struct stat *st, sys_stat_t *sst) 43 { 44 COPY_STAT(st, sst) 45 } 46 47 void systypes_copy_to_sys_stat(struct stat *st, sys_stat_t *sst) 48 { 49 COPY_STAT(sst, st) 50 } 51 52 // vim: tabstop=2 expandtab shiftwidth=2