Skip to content

Commit

Permalink
Merge pull request #112 from marcone/master
Browse files Browse the repository at this point in the history
Reduce logging
  • Loading branch information
jfdelnero authored Nov 4, 2024
2 parents 6c1f1e3 + a0fd2f2 commit 531a745
Showing 1 changed file with 23 additions and 18 deletions.
41 changes: 23 additions & 18 deletions src/mtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -777,16 +777,15 @@ uint32_t mtp_get_storage_id_by_name(mtp_ctx * ctx, char * name)
{
int i;

PRINT_DEBUG("mtp_get_storage_id_by_name : %s", name );

i = 0;
while(i < MAX_STORAGE_NB)
{
if( ctx->storages[i].root_path )
{
if( !strcmp(ctx->storages[i].description, name ) )
{
PRINT_DEBUG("mtp_get_storage_id_by_name : %s -> %.8X",
PRINT_DEBUG("%s : %s -> %.8X",
__func__,
ctx->storages[i].root_path,
ctx->storages[i].storage_id);

Expand All @@ -796,23 +795,24 @@ uint32_t mtp_get_storage_id_by_name(mtp_ctx * ctx, char * name)
i++;
}

PRINT_DEBUG("%s : '%s' not found", __func__, name );

return 0xFFFFFFFF;
}

int mtp_get_storage_index_by_name(mtp_ctx * ctx, char * name)
{
int i;

PRINT_DEBUG("mtp_get_storage_index_by_name : %s", name );

i = 0;
while(i < MAX_STORAGE_NB)
{
if( ctx->storages[i].root_path )
{
if( !strcmp(ctx->storages[i].description, name ) )
{
PRINT_DEBUG("mtp_get_storage_index_by_name : %s -> %.8X",
PRINT_DEBUG("%s : %s -> %.8X",
__func__,
ctx->storages[i].root_path,
i);

Expand All @@ -822,23 +822,24 @@ int mtp_get_storage_index_by_name(mtp_ctx * ctx, char * name)
i++;
}

PRINT_DEBUG("%s : '%s' not found", __func__, name );

return -1;
}

int mtp_get_storage_index_by_id(mtp_ctx * ctx, uint32_t storage_id)
{
int i;

PRINT_DEBUG("mtp_get_storage_index_by_id : 0x%X", storage_id );

i = 0;
while(i < MAX_STORAGE_NB)
{
if( ctx->storages[i].root_path )
{
if( ctx->storages[i].storage_id == storage_id )
{
PRINT_DEBUG("mtp_get_storage_index_by_id : %.8X -> %d",
PRINT_DEBUG("%s : %.8X -> %d",
__func__,
storage_id,
i );
return i;
Expand All @@ -847,23 +848,24 @@ int mtp_get_storage_index_by_id(mtp_ctx * ctx, uint32_t storage_id)
i++;
}

PRINT_DEBUG("%s : 0x%X not found", __func__, storage_id );

return -1;
}

char * mtp_get_storage_root(mtp_ctx * ctx, uint32_t storage_id)
{
int i;

PRINT_DEBUG("mtp_get_storage_root : %.8X", storage_id );

i = 0;
while(i < MAX_STORAGE_NB)
{
if( ctx->storages[i].root_path )
{
if( ctx->storages[i].storage_id == storage_id )
{
PRINT_DEBUG("mtp_get_storage_root : %.8X -> %s",
PRINT_DEBUG("%s : %.8X -> %s",
__func__,
storage_id,
ctx->storages[i].root_path );
return ctx->storages[i].root_path;
Expand All @@ -872,23 +874,23 @@ char * mtp_get_storage_root(mtp_ctx * ctx, uint32_t storage_id)
i++;
}

PRINT_DEBUG("%s : %.8X not found", __func__, storage_id );
return NULL;
}

char * mtp_get_storage_description(mtp_ctx * ctx, uint32_t storage_id)
{
int i;

PRINT_DEBUG("mtp_get_storage_description : %.8X", storage_id );

i = 0;
while(i < MAX_STORAGE_NB)
{
if( ctx->storages[i].root_path )
{
if( ctx->storages[i].storage_id == storage_id )
{
PRINT_DEBUG("mtp_get_storage_description : %.8X -> %s",
PRINT_DEBUG("%s : %.8X -> %s",
__func__,
storage_id,
ctx->storages[i].description );
return ctx->storages[i].description;
Expand All @@ -897,23 +899,24 @@ char * mtp_get_storage_description(mtp_ctx * ctx, uint32_t storage_id)
i++;
}

PRINT_DEBUG("%s : %.8X not found", __func__, storage_id );

return NULL;
}

uint32_t mtp_get_storage_flags(mtp_ctx * ctx, uint32_t storage_id)
{
int i;

PRINT_DEBUG("mtp_get_storage_flags : %.8X", storage_id );

i = 0;
while(i < MAX_STORAGE_NB)
{
if( ctx->storages[i].root_path )
{
if( ctx->storages[i].storage_id == storage_id )
{
PRINT_DEBUG("mtp_get_storage_flags : %.8X -> 0x%.8X",
PRINT_DEBUG("%s : %.8X -> 0x%.8X",
__func__,
storage_id,
ctx->storages[i].flags );
return ctx->storages[i].flags;
Expand All @@ -922,6 +925,8 @@ uint32_t mtp_get_storage_flags(mtp_ctx * ctx, uint32_t storage_id)
i++;
}

PRINT_DEBUG("%s : %.8X not found", __func__, storage_id );

return 0xFFFFFFFF;
}

Expand Down

0 comments on commit 531a745

Please sign in to comment.