Refactor pfsxattr to use pfs_xattr_ namespace
All psync_fs_ prefixed functions in the pfsxattr module renamed to pfs_xattr_ (e.g., pfs_xattr_set, pfs_xattr_get, pfs_xattr_list, pfs_xattr_remove, pfs_xattr_file_deleted, pfs_xattr_task_to_file, etc.). Local macro psync_fs_set_thread_name renamed to pfs_xattr_set_thread_name. Internal static helpers (delete_object_id, update_object_id, xattr_get_object_id_locked) remain static and unchanged. Updated all call sites in pfs.c, pfsupload.c, and pdiff.c. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
fbc1f8e25c
commit
b5420b54b4
|
|
@ -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);
|
||||
psync_fs_folder_deleted(folderid);
|
||||
pfs_xattr_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);
|
||||
psync_fs_file_deleted(delfileid->num);
|
||||
pfs_xattr_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;
|
||||
psync_fs_file_deleted(fileid);
|
||||
pfs_xattr_file_deleted(fileid);
|
||||
}
|
||||
if (path)
|
||||
free(path);
|
||||
|
|
|
|||
|
|
@ -2159,7 +2159,7 @@ pfs_reopen_file_for_writing(psync_openfile_t *of) {
|
|||
return -EIO;
|
||||
}
|
||||
pfs_update_openfile_fileid_locked(of, cr->fileid);
|
||||
psync_fs_file_to_task(of->remotefileid, cr->taskid);
|
||||
pfs_xattr_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);
|
||||
psync_fs_static_to_task(taskid, cr->taskid);
|
||||
pfs_xattr_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 = psync_fs_setxattr;
|
||||
psync_oper.getxattr = psync_fs_getxattr;
|
||||
psync_oper.listxattr = psync_fs_listxattr;
|
||||
psync_oper.removexattr = psync_fs_removexattr;
|
||||
psync_oper.setxattr = pfs_xattr_set;
|
||||
psync_oper.getxattr = pfs_xattr_get;
|
||||
psync_oper.listxattr = pfs_xattr_list;
|
||||
psync_oper.removexattr = pfs_xattr_remove;
|
||||
|
||||
#if defined(FUSE_HAS_CAN_UNLINK)
|
||||
psync_oper.can_unlink = pfs_can_unlink;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
psync_fs_task_to_folder(task->id, folderid);
|
||||
pfs_xattr_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);
|
||||
psync_fs_task_to_file(taskid, fileid);
|
||||
pfs_xattr_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);
|
||||
psync_fs_task_deleted(taskid);
|
||||
pfs_xattr_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);
|
||||
psync_fs_task_to_file(task->id, fileid);
|
||||
pfs_xattr_task_to_file(task->id, fileid);
|
||||
task->int2 = fileid;
|
||||
pdbg_logf(D_NOTICE, "file %lu/%s uploaded", (unsigned long)task->folderid,
|
||||
task->text1);
|
||||
|
|
|
|||
|
|
@ -41,16 +41,16 @@
|
|||
#include "psql.h"
|
||||
#include "plibs.h"
|
||||
|
||||
// needed by psync_fs_set_thread_name
|
||||
// needed by pfs_xattr_set_thread_name
|
||||
extern PSYNC_THREAD const char *psync_thread_name;
|
||||
|
||||
#if IS_DEBUG
|
||||
#define psync_fs_set_thread_name() \
|
||||
#define pfs_xattr_set_thread_name() \
|
||||
do { \
|
||||
psync_thread_name = __FUNCTION__; \
|
||||
} while (0)
|
||||
#else
|
||||
#define psync_fs_set_thread_name() \
|
||||
#define pfs_xattr_set_thread_name() \
|
||||
do { \
|
||||
} while (0)
|
||||
#endif
|
||||
|
|
@ -90,15 +90,15 @@ static void delete_object_id(uint64_t oid) {
|
|||
psql_run_free(res);
|
||||
}
|
||||
|
||||
void psync_fs_file_deleted(psync_fileid_t fileid) {
|
||||
void pfs_xattr_file_deleted(psync_fileid_t fileid) {
|
||||
delete_object_id(fileid_to_objid(fileid));
|
||||
}
|
||||
|
||||
void psync_fs_folder_deleted(psync_folderid_t folderid) {
|
||||
void pfs_xattr_folder_deleted(psync_folderid_t folderid) {
|
||||
delete_object_id(folderid_to_objid(folderid));
|
||||
}
|
||||
|
||||
void psync_fs_task_deleted(uint64_t taskid) {
|
||||
void pfs_xattr_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 psync_fs_task_to_file(uint64_t taskid, psync_fileid_t fileid) {
|
||||
void pfs_xattr_task_to_file(uint64_t taskid, psync_fileid_t fileid) {
|
||||
update_object_id(taskid_to_objid(taskid), fileid_to_objid(fileid));
|
||||
}
|
||||
|
||||
void psync_fs_task_to_folder(uint64_t taskid, psync_folderid_t folderid) {
|
||||
void pfs_xattr_task_to_folder(uint64_t taskid, psync_folderid_t folderid) {
|
||||
update_object_id(taskid_to_objid(taskid), folderid_to_objid(folderid));
|
||||
}
|
||||
|
||||
void psync_fs_static_to_task(uint64_t statictaskid, uint64_t taskid) {
|
||||
void pfs_xattr_static_to_task(uint64_t statictaskid, uint64_t taskid) {
|
||||
update_object_id(static_taskid_to_objid(statictaskid),
|
||||
taskid_to_objid(taskid));
|
||||
}
|
||||
|
||||
void psync_fs_file_to_task(psync_fileid_t fileid, uint64_t taskid) {
|
||||
void pfs_xattr_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 psync_fs_setxattr(const char *path, const char *name, const char *value,
|
||||
int pfs_xattr_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;
|
||||
psync_fs_set_thread_name();
|
||||
pfs_xattr_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 psync_fs_setxattr(const char *path, const char *name, const char *value,
|
|||
return ret;
|
||||
}
|
||||
|
||||
int psync_fs_getxattr(const char *path, const char *name, char *value,
|
||||
int pfs_xattr_get(const char *path, const char *name, char *value,
|
||||
size_t size PFS_XATTR_IGN) {
|
||||
psync_sql_res *res;
|
||||
int64_t oid;
|
||||
int ret;
|
||||
psync_fs_set_thread_name();
|
||||
pfs_xattr_set_thread_name();
|
||||
LOCK_AND_LOOKUPRD();
|
||||
if (size && value) {
|
||||
psync_variant_row row;
|
||||
|
|
@ -341,13 +341,13 @@ int psync_fs_getxattr(const char *path, const char *name, char *value,
|
|||
return ret;
|
||||
}
|
||||
|
||||
int psync_fs_listxattr(const char *path, char *list, size_t size) {
|
||||
int pfs_xattr_list(const char *path, char *list, size_t size) {
|
||||
psync_sql_res *res;
|
||||
int64_t oid;
|
||||
const char *str;
|
||||
size_t len;
|
||||
int ret;
|
||||
psync_fs_set_thread_name();
|
||||
pfs_xattr_set_thread_name();
|
||||
LOCK_AND_LOOKUPRD();
|
||||
if (size && list) {
|
||||
psync_variant_row row;
|
||||
|
|
@ -382,11 +382,11 @@ int psync_fs_listxattr(const char *path, char *list, size_t size) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
int psync_fs_removexattr(const char *path, const char *name) {
|
||||
int pfs_xattr_remove(const char *path, const char *name) {
|
||||
psync_sql_res *res;
|
||||
int64_t oid;
|
||||
uint32_t aff;
|
||||
psync_fs_set_thread_name();
|
||||
pfs_xattr_set_thread_name();
|
||||
LOCK_AND_LOOKUP();
|
||||
res = psql_prepare(
|
||||
"DELETE FROM fsxattr WHERE objectid=? AND name=?");
|
||||
|
|
|
|||
|
|
@ -38,20 +38,20 @@
|
|||
|
||||
#define PFS_XATTR_IGN
|
||||
|
||||
int psync_fs_setxattr(const char *path, const char *name, const char *value,
|
||||
int pfs_xattr_set(const char *path, const char *name, const char *value,
|
||||
size_t size, int flags PFS_XATTR_IGN);
|
||||
int psync_fs_getxattr(const char *path, const char *name, char *value,
|
||||
int pfs_xattr_get(const char *path, const char *name, char *value,
|
||||
size_t size PFS_XATTR_IGN);
|
||||
int psync_fs_listxattr(const char *path, char *list, size_t size);
|
||||
int psync_fs_removexattr(const char *path, const char *name);
|
||||
int pfs_xattr_list(const char *path, char *list, size_t size);
|
||||
int pfs_xattr_remove(const char *path, const char *name);
|
||||
|
||||
void psync_fs_file_deleted(psync_fileid_t fileid);
|
||||
void psync_fs_folder_deleted(psync_folderid_t folderid);
|
||||
void psync_fs_task_deleted(uint64_t taskid);
|
||||
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 psync_fs_task_to_file(uint64_t taskid, psync_fileid_t fileid);
|
||||
void psync_fs_task_to_folder(uint64_t taskid, psync_folderid_t folderid);
|
||||
void psync_fs_static_to_task(uint64_t statictaskid, uint64_t taskid);
|
||||
void psync_fs_file_to_task(psync_fileid_t fileid, 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);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue