/***************************************************** a wrapper for utimes *******************************************************/ int smbw_utimes(const char *fname, void *buf) { char path[PATH_MAX]; smbw_fix_path(fname, path); return smbc_utimes(path, buf); }
static int smbcfs_utimens(const char* const path, const struct timespec tv[2]) { const std::string smbcfs_path = smbcfs_root_path + path; struct timeval tbuf[2]; tbuf[0].tv_sec = tv[0].tv_sec; tbuf[0].tv_usec = tv[0].tv_nsec/1000; tbuf[1].tv_sec = tv[1].tv_sec; tbuf[1].tv_usec = tv[1].tv_nsec/1000; #ifdef MUTEX_LOCK pthread_mutex_lock(&mutex_lock); #endif const int ret_utimes = smbc_utimes(smbcfs_path.c_str(), tbuf); #ifdef MUTEX_LOCK pthread_mutex_unlock(&mutex_lock); #endif #ifdef SMBCFS_DEBUG fprintf(stderr, "[smbc_utimes] %s (%ld, %ld) => %d\n", smbcfs_path.c_str(), tbuf[0].tv_sec, tbuf[1].tv_sec, ret_utimes); #endif return ret_utimes; }
static int smbcfs_utime(const char* const path, struct utimbuf* const utbuf) { const std::string smbcfs_path = smbcfs_root_path + path; struct timeval tbuf[2]; tbuf[0].tv_sec = utbuf->actime; tbuf[1].tv_sec = utbuf->modtime; #ifdef MUTEX_LOCK pthread_mutex_lock(&mutex_lock); #endif const int ret_utimes = smbc_utimes(smbcfs_path.c_str(), tbuf); #ifdef MUTEX_LOCK pthread_mutex_unlock(&mutex_lock); #endif #ifdef SMBCFS_DEBUG fprintf(stderr, "[smbc_utimes] %s %p => %d\n", smbcfs_path.c_str(), tbuf, ret_utimes); #endif return ret_utimes; }
int FSSmb::SetFileTime ( FSPath& path, FSTime aTime, FSTime mTime, int* err, FSCInfo* info ) { FREPARE_SMB_OPER( lock, info, &_param ); struct timeval tv[2]; tv[0].tv_sec = aTime; tv[0].tv_usec = 0; tv[1].tv_sec = mTime; tv[1].tv_usec = 0; int n = smbc_utimes( pathBuffer1.SetPath( path ), tv ); SetError( err, errno ); return n < 0 ? -1 : n; }
static int _utimes(const char *uri, const struct timeval *times) { return smbc_utimes(uri, (struct timeval *) times); }