From ea4ea530c43645e258f7ff6f7a4b101b3491ea53 Mon Sep 17 00:00:00 2001 From: Levi Neely <141506390+lneely@users.noreply.github.com> Date: Sun, 30 Jun 2024 12:01:38 +0200 Subject: [PATCH] cleanup --- lib/pclsync/pdevice_monitor.c | 111 ++-------------------------------- lib/pclsync/pdevice_monitor.h | 25 -------- lib/pclsync/pdevicemap.h | 53 ---------------- 3 files changed, 5 insertions(+), 184 deletions(-) delete mode 100644 lib/pclsync/pdevicemap.h diff --git a/lib/pclsync/pdevice_monitor.c b/lib/pclsync/pdevice_monitor.c index 2cce8c1..f28b6c5 100644 --- a/lib/pclsync/pdevice_monitor.c +++ b/lib/pclsync/pdevice_monitor.c @@ -31,16 +31,15 @@ #include "plibs.h" #include "psynclib.h" -// #include "pdevice_monitor.h" -#include "papi.h" -#include "pbusinessaccount.h" -#include "pdevicemap.h" -#include "pnetlibs.h" #include "pdevice_monitor.h" -// #include "pdevicemap.h" #include "plocalscan.h" #include "ptimer.h" +#include +#include +#include +#include +#include #define DEV_MONITOR_ACTIVITY_TIMER_INT 20 @@ -63,106 +62,6 @@ void devmon_activity_timer_start() { pthread_mutex_unlock(&devmon_mutex); } -// device_event_callback *device_callbacks; -// int device_clbsize = 10; -// int device_clbnum = 0; - -// void psync_add_device_monitor_callback(device_event_callback callback) { -// if (callback) { -// if (device_clbnum == 0) -// device_callbacks = (device_event_callback -// *)psync_malloc(sizeof(device_event_callback)*device_clbsize); -// else { -// while (device_clbnum > device_clbsize) { -// device_event_callback *callbacks_old = device_callbacks; -// device_callbacks = (device_event_callback -// *)psync_malloc(sizeof(device_event_callback)*device_clbsize*2); -// memccpy(device_callbacks, callbacks_old, -// 0,sizeof(device_event_callback)*device_clbsize); device_clbsize = -// device_clbsize * 2; psync_free(callbacks_old); -// } -// } -// device_callbacks[device_clbnum] = callback; -// device_clbnum -// ++; -// } -// } - -// static pdevice_info * new_dev_info( char *szPath, pdevice_types type, -// device_event evt) { -// /*int pathsize = strlen(szPath); -// int infstrsize = sizeof(pdevice_info); -// int infsize = pathsize + infstrsize + 1;*/ -// // pdevice_info *infop = (pdevice_info *)psync_malloc(infsize); -// pdevice_info *infop = (pdevice_info *)psync_malloc(sizeof(pdevice_info)); -// //ZeroMemory(infop, infsize); -// //infop->filesystem_path = (char *)(infop) + infstrsize; -// infop->filesystem_path = strdup(szPath); -// //memcpy(infop->filesystem_path, szPath, pathsize); -// //infop->filesystem_path[pathsize] = '\0'; -// infop->type = type; -// infop->isextended = 0; -// return infop; -// } - -// static pdevice_extended_info * new_dev_ext_info(char *szPath, char * vendor, -// char *product, char* deviceid, pdevice_types type, device_event evt) { -// /*uint32_t pathsize = strlen(szPath); -// uint32_t vndsize = strlen(vendor); -// uint32_t prdsize = strlen(product); -// uint32_t devsize = strlen(deviceid); -// uint32_t infstrsize = sizeof(pdevice_extended_info); -// uint32_t infsize = pathsize + infstrsize + pathsize + vndsize + prdsize + -// 5; void * infovp = psync_malloc(infsize); pdevice_extended_info *infop = -// (pdevice_extended_info *)infovp; ZeroMemory(infop, infsize); char -// *storage_begin = (char *)(infovp)+infstrsize; -// put_into_storage(&infop->filesystem_path, &storage_begin, szPath, -// pathsize); put_into_storage(&infop->vendor, &storage_begin, vendor, -// vndsize); put_into_storage(&infop->product, &storage_begin, product, -// prdsize); put_into_storage(&infop->device_id, &storage_begin, deviceid, -// devsize); infop->type = type; infop->event = evt; infop->isextended = 1; -// infop->size = infsize; -// infop->me = infop;*/ -// pdevice_extended_info *infop = (pdevice_extended_info -// *)psync_malloc(sizeof(pdevice_extended_info)); infop->filesystem_path = -// strdup(szPath); infop->vendor = strdup(vendor); infop->product = -// strdup(product); infop->device_id = strdup(deviceid); infop->type = type; -// infop->isextended = 1; -// return infop; -// } - -// void psync_devmon_notify_device_callbacks(pdevice_extended_info * param, -// device_event event) { -// if (event == Dev_Event_arrival) -// psync_run_thread1("Device notifications", do_notify_device_callbacks_in, -// (void*)param); -// else -// psync_run_thread1("Device notifications", do_notify_device_callbacks_out, -// (void*)param); -// } - -// static void psync_devmon_arivalmonitor(device_event event, void * -// device_info) -//{ -// pdevice_extended_info *pDevExtInfo = (pdevice_extended_info*)device_info; -// if (event == Dev_Event_arrival){ -// debug(D_NOTICE, "Device arrived."); -// psync_do_restat_sync_folders(); -// } -// else{ -// debug(D_NOTICE, "Device removed."); -// psync_do_restat_sync_folders(); -// } -// if (pDevExtInfo) -// print_device_info(pDevExtInfo); -// } - -#include -#include -#include -#include -#include - void enumerate_devices(struct udev *udev, device_event event) { devmon_activity_timer_start(); } diff --git a/lib/pclsync/pdevice_monitor.h b/lib/pclsync/pdevice_monitor.h index 868339c..2f65e62 100644 --- a/lib/pclsync/pdevice_monitor.h +++ b/lib/pclsync/pdevice_monitor.h @@ -33,36 +33,11 @@ #ifndef _PDEVICE_MONITOR #define _PDEVICE_MONITOR -#include "psynclib.h" -#include - -// typedef struct _pdevice_info pdevice_info; - -// struct _pdevice_info { -// pdevice_types type; -// int isextended; -// char * filesystem_path; -// }; - -// typedef struct _pdevice_extended_info pdevice_extended_info; - -// struct _pdevice_extended_info { -// pdevice_types type; -// int isextended; -// char *filesystem_path; -// char *vendor; -// char *product; -// char *device_id; -// pdevice_extended_info* next; -// pdevice_extended_info* prev; -// }; #ifdef __cplusplus extern "C" { #endif void psync_devmon_init(); -// void psync_devmon_notify_device_callbacks(pdevice_extended_info *param, -// device_event event); #ifdef __cplusplus } #endif diff --git a/lib/pclsync/pdevicemap.h b/lib/pclsync/pdevicemap.h deleted file mode 100644 index 7b01490..0000000 --- a/lib/pclsync/pdevicemap.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - Copyright (c) 2013-2014 Anton Titov. - - Copyright (c) 2013-2014 pCloud Ltd. All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: Redistributions of source code must retain the above - copyright notice, this list of conditions and the following - disclaimer. Redistributions in binary form must reproduce the - above copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. Neither the name of pCloud Ltd nor the - names of its contributors may be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL pCloud - Ltd BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE - USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. -*/ - -#pragma once - -#ifndef _PDEVICE_MAP -#define _PDEVICE_MAP -// #include "pdevice_monitor.h" -// void do_notify_device_callbacks_in(void * param); -// void do_notify_device_callbacks_out(void * param); - -// pdevice_extended_info* construct_deviceininfo( pdevice_types type, int -// isextended,const char *filesystem_path, -// const char *vendor,const char -// *product,const char -// *device_id); -// void destruct_deviceininfo(pdevice_extended_info* device); - -// void add_device (pdevice_types type, int isextended, const char -// *filesystem_path, const char *vendor, const char *product,const char -// *device_id); void remove_device (const char *filesystem_path); void -// filter_unconnected_device (); void init_devices (); void print_stree(); void -// print_device_info(pdevice_extended_info *ret ); - -#endif //_PDEVICE_MAP