diff --git a/pclsync/pdiff.c b/pclsync/pdiff.c index e8aec55..3b64300 100644 --- a/pclsync/pdiff.c +++ b/pclsync/pdiff.c @@ -1315,7 +1315,7 @@ static void process_deletefolder(const binresult *entry) { psql_bind_uint( st2, 2, papi_find_result2(meta, "parentfolderid", PARAM_NUM)->num); psql_run(st2); - pfs_xattr_folder_deleted(folderid); + pfs_xatr_folder_deleted(folderid); } if (path) free(path); @@ -1333,7 +1333,7 @@ static void check_for_deletedfileid(const binresult *meta) { res = psql_prepare("DELETE FROM file WHERE id=?"); psql_bind_uint(res, 1, delfileid->num); psql_run_free(res); - pfs_xattr_file_deleted(delfileid->num); + pfs_xatr_file_deleted(delfileid->num); } } @@ -1751,7 +1751,7 @@ static void process_deletefile(const binresult *entry) { } if (papi_find_result2(meta, "ismine", PARAM_BOOL)->num) used_quota -= papi_find_result2(meta, "size", PARAM_NUM)->num; - pfs_xattr_file_deleted(fileid); + pfs_xatr_file_deleted(fileid); } if (path) free(path); diff --git a/pclsync/pfs.c b/pclsync/pfs.c index 3802e5d..2b83f2e 100644 --- a/pclsync/pfs.c +++ b/pclsync/pfs.c @@ -2159,7 +2159,7 @@ pfs_reopen_file_for_writing(psync_openfile_t *of) { return -EIO; } pfs_update_openfile_fileid_locked(of, cr->fileid); - pfs_xattr_file_to_task(of->remotefileid, cr->taskid); + pfs_xatr_file_to_task(of->remotefileid, cr->taskid); psql_unlock(); of->newfile = 1; of->modified = 1; @@ -2237,7 +2237,7 @@ pfs_reopen_static_file_for_writing(psync_openfile_t *of) { return -EIO; } pfs_update_openfile_fileid_locked(of, cr->fileid); - pfs_xattr_static_to_task(taskid, cr->taskid); + pfs_xatr_static_to_task(taskid, cr->taskid); cr = psync_fstask_find_creat(of->currentfolder, of->currentname, taskid); if (pdbg_likely(cr)) { ptree_del(&of->currentfolder->creats, &cr->tree); @@ -3743,10 +3743,10 @@ static int pfs_do_start() { psync_oper.ftruncate = pfs_ftruncate; psync_oper.truncate = pfs_truncate; - psync_oper.setxattr = pfs_xattr_set; - psync_oper.getxattr = pfs_xattr_get; - psync_oper.listxattr = pfs_xattr_list; - psync_oper.removexattr = pfs_xattr_remove; + psync_oper.setxattr = pfs_xatr_set; + psync_oper.getxattr = pfs_xatr_get; + psync_oper.listxattr = pfs_xatr_list; + psync_oper.removexattr = pfs_xatr_remove; #if defined(FUSE_HAS_CAN_UNLINK) psync_oper.can_unlink = pfs_can_unlink; diff --git a/pclsync/pfsupload.c b/pclsync/pfsupload.c index d2c02e6..99f180b 100644 --- a/pclsync/pfsupload.c +++ b/pclsync/pfsupload.c @@ -156,7 +156,7 @@ static int psync_process_task_mkdir(fsupload_task_t *task) { task->int2 = folderid; pfileops_create_fldr(meta); psync_fstask_folder_created(task->folderid, task->id, folderid, task->text1); - pfs_xattr_task_to_folder(task->id, folderid); + pfs_xatr_task_to_folder(task->id, folderid); if (task->text2 && papi_find_result2(task->res, "created", PARAM_BOOL)->num) { psync_sql_res *res; unsigned char *enckey; @@ -455,7 +455,7 @@ static int save_meta(const binresult *meta, psync_folderid_t folderid, if (!deleted) ppagecache_creat(taskid, hash, 0); psync_fstask_file_created(folderid, taskid, name, fileid); - pfs_xattr_task_to_file(taskid, fileid); + pfs_xatr_task_to_file(taskid, fileid); } else { pfileops_update_file(meta); if (!deleted) @@ -597,7 +597,7 @@ static void perm_fail_upload_task(uint64_t taskid) { sql = psql_prepare("DELETE FROM fstask WHERE id=?"); psql_bind_uint(sql, 1, taskid); psql_run_free(sql); - pfs_xattr_task_deleted(taskid); + pfs_xatr_task_deleted(taskid); psql_commit(); pstatus_upload_recalc_async(); } @@ -1357,7 +1357,7 @@ static int psync_process_task_creat(fsupload_task_t *task) { psync_fstask_file_created(task->folderid, task->id, task->text1, fileid); if (task->text2) set_key_for_fileid(fileid, hash, task->text2); - pfs_xattr_task_to_file(task->id, fileid); + pfs_xatr_task_to_file(task->id, fileid); task->int2 = fileid; pdbg_logf(D_NOTICE, "file %lu/%s uploaded", (unsigned long)task->folderid, task->text1); diff --git a/pclsync/pfsxattr.c b/pclsync/pfsxattr.c index 815b3f9..f07d945 100644 --- a/pclsync/pfsxattr.c +++ b/pclsync/pfsxattr.c @@ -41,16 +41,16 @@ #include "psql.h" #include "plibs.h" -// needed by pfs_xattr_set_thread_name +// needed by pfs_xatr_set_thread_name extern PSYNC_THREAD const char *psync_thread_name; #if IS_DEBUG -#define pfs_xattr_set_thread_name() \ +#define pfs_xatr_set_thread_name() \ do { \ psync_thread_name = __FUNCTION__; \ } while (0) #else -#define pfs_xattr_set_thread_name() \ +#define pfs_xatr_set_thread_name() \ do { \ } while (0) #endif @@ -90,15 +90,15 @@ static void delete_object_id(uint64_t oid) { psql_run_free(res); } -void pfs_xattr_file_deleted(psync_fileid_t fileid) { +void pfs_xatr_file_deleted(psync_fileid_t fileid) { delete_object_id(fileid_to_objid(fileid)); } -void pfs_xattr_folder_deleted(psync_folderid_t folderid) { +void pfs_xatr_folder_deleted(psync_folderid_t folderid) { delete_object_id(folderid_to_objid(folderid)); } -void pfs_xattr_task_deleted(uint64_t taskid) { +void pfs_xatr_task_deleted(uint64_t taskid) { delete_object_id(taskid_to_objid(taskid)); } @@ -111,20 +111,20 @@ static void update_object_id(uint64_t ooid, uint64_t noid) { psql_run_free(res); } -void pfs_xattr_task_to_file(uint64_t taskid, psync_fileid_t fileid) { +void pfs_xatr_task_to_file(uint64_t taskid, psync_fileid_t fileid) { update_object_id(taskid_to_objid(taskid), fileid_to_objid(fileid)); } -void pfs_xattr_task_to_folder(uint64_t taskid, psync_folderid_t folderid) { +void pfs_xatr_task_to_folder(uint64_t taskid, psync_folderid_t folderid) { update_object_id(taskid_to_objid(taskid), folderid_to_objid(folderid)); } -void pfs_xattr_static_to_task(uint64_t statictaskid, uint64_t taskid) { +void pfs_xatr_static_to_task(uint64_t statictaskid, uint64_t taskid) { update_object_id(static_taskid_to_objid(statictaskid), taskid_to_objid(taskid)); } -void pfs_xattr_file_to_task(psync_fileid_t fileid, uint64_t taskid) { +void pfs_xatr_file_to_task(psync_fileid_t fileid, uint64_t taskid) { update_object_id(fileid_to_objid(fileid), taskid_to_objid(taskid)); } @@ -248,12 +248,12 @@ static int64_t xattr_get_object_id_locked(const char *path) { } \ } while (0) -int pfs_xattr_set(const char *path, const char *name, const char *value, +int pfs_xatr_set(const char *path, const char *name, const char *value, size_t size, int flags PFS_XATTR_IGN) { psync_sql_res *res; int64_t oid; int ret; - pfs_xattr_set_thread_name(); + pfs_xatr_set_thread_name(); pdbg_logf(D_NOTICE, "setting attribute %s of %s", name, path); LOCK_AND_LOOKUP(); if (flags & XATTR_CREATE) { @@ -291,12 +291,12 @@ int pfs_xattr_set(const char *path, const char *name, const char *value, return ret; } -int pfs_xattr_get(const char *path, const char *name, char *value, +int pfs_xatr_get(const char *path, const char *name, char *value, size_t size PFS_XATTR_IGN) { psync_sql_res *res; int64_t oid; int ret; - pfs_xattr_set_thread_name(); + pfs_xatr_set_thread_name(); LOCK_AND_LOOKUPRD(); if (size && value) { psync_variant_row row; @@ -341,13 +341,13 @@ int pfs_xattr_get(const char *path, const char *name, char *value, return ret; } -int pfs_xattr_list(const char *path, char *list, size_t size) { +int pfs_xatr_list(const char *path, char *list, size_t size) { psync_sql_res *res; int64_t oid; const char *str; size_t len; int ret; - pfs_xattr_set_thread_name(); + pfs_xatr_set_thread_name(); LOCK_AND_LOOKUPRD(); if (size && list) { psync_variant_row row; @@ -382,11 +382,11 @@ int pfs_xattr_list(const char *path, char *list, size_t size) { return ret; } -int pfs_xattr_remove(const char *path, const char *name) { +int pfs_xatr_remove(const char *path, const char *name) { psync_sql_res *res; int64_t oid; uint32_t aff; - pfs_xattr_set_thread_name(); + pfs_xatr_set_thread_name(); LOCK_AND_LOOKUP(); res = psql_prepare( "DELETE FROM fsxattr WHERE objectid=? AND name=?"); diff --git a/pclsync/pfsxattr.h b/pclsync/pfsxattr.h index e64489a..78a324e 100644 --- a/pclsync/pfsxattr.h +++ b/pclsync/pfsxattr.h @@ -38,20 +38,20 @@ #define PFS_XATTR_IGN -int pfs_xattr_set(const char *path, const char *name, const char *value, +int pfs_xatr_set(const char *path, const char *name, const char *value, size_t size, int flags PFS_XATTR_IGN); -int pfs_xattr_get(const char *path, const char *name, char *value, +int pfs_xatr_get(const char *path, const char *name, char *value, size_t size PFS_XATTR_IGN); -int pfs_xattr_list(const char *path, char *list, size_t size); -int pfs_xattr_remove(const char *path, const char *name); +int pfs_xatr_list(const char *path, char *list, size_t size); +int pfs_xatr_remove(const char *path, const char *name); -void pfs_xattr_file_deleted(psync_fileid_t fileid); -void pfs_xattr_folder_deleted(psync_folderid_t folderid); -void pfs_xattr_task_deleted(uint64_t taskid); +void pfs_xatr_file_deleted(psync_fileid_t fileid); +void pfs_xatr_folder_deleted(psync_folderid_t folderid); +void pfs_xatr_task_deleted(uint64_t taskid); -void pfs_xattr_task_to_file(uint64_t taskid, psync_fileid_t fileid); -void pfs_xattr_task_to_folder(uint64_t taskid, psync_folderid_t folderid); -void pfs_xattr_static_to_task(uint64_t statictaskid, uint64_t taskid); -void pfs_xattr_file_to_task(psync_fileid_t fileid, uint64_t taskid); +void pfs_xatr_task_to_file(uint64_t taskid, psync_fileid_t fileid); +void pfs_xatr_task_to_folder(uint64_t taskid, psync_folderid_t folderid); +void pfs_xatr_static_to_task(uint64_t statictaskid, uint64_t taskid); +void pfs_xatr_file_to_task(psync_fileid_t fileid, uint64_t taskid); #endif