static int mount_local_utimens (const char *path, const struct timespec ts[2]) { int r; time_t atsecs, mtsecs; long atnsecs, mtnsecs; DECL_G (); DEBUG_CALL ("%s, [{ %ld, %ld }, { %ld, %ld }]", path, ts[0].tv_sec, ts[0].tv_nsec, ts[1].tv_sec, ts[1].tv_nsec); if (g->ml_read_only) return -EROFS; dir_cache_invalidate (g, path); atsecs = ts[0].tv_sec; atnsecs = ts[0].tv_nsec; mtsecs = ts[1].tv_sec; mtnsecs = ts[1].tv_nsec; #ifdef UTIME_NOW if (atnsecs == UTIME_NOW) atnsecs = -1; #endif #ifdef UTIME_OMIT if (atnsecs == UTIME_OMIT) atnsecs = -2; #endif #ifdef UTIME_NOW if (mtnsecs == UTIME_NOW) mtnsecs = -1; #endif #ifdef UTIME_OMIT if (mtnsecs == UTIME_OMIT) mtnsecs = -2; #endif r = guestfs_utimens (g, path, atsecs, atnsecs, mtsecs, mtnsecs); if (r == -1) RETURN_ERRNO; return 0; }
static int fg_utimens (const char *path, const struct timespec ts[2]) { TRACE_CALL ("%s, [{ %ld, %ld }, { %ld, %ld }]", path, ts[0].tv_sec, ts[0].tv_nsec, ts[1].tv_sec, ts[1].tv_nsec); int r; if (read_only) return -EROFS; dir_cache_invalidate (path); time_t atsecs = ts[0].tv_sec; long atnsecs = ts[0].tv_nsec; time_t mtsecs = ts[1].tv_sec; long mtnsecs = ts[1].tv_nsec; #ifdef UTIME_NOW if (atnsecs == UTIME_NOW) atnsecs = -1; #endif #ifdef UTIME_OMIT if (atnsecs == UTIME_OMIT) atnsecs = -2; #endif #ifdef UTIME_NOW if (mtnsecs == UTIME_NOW) mtnsecs = -1; #endif #ifdef UTIME_OMIT if (mtnsecs == UTIME_OMIT) mtnsecs = -2; #endif r = guestfs_utimens (g, path, atsecs, atnsecs, mtsecs, mtnsecs); if (r == -1) return error (); return 0; }