Skip to content

Commit

Permalink
fix c file formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeGoldsmith committed Apr 19, 2023
1 parent 90b1f32 commit 7ba89cd
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion include/alloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ static __always_inline u64 get_area_end(u64 start)
{
s64 partition_size = (end_addr - start_addr) / total_cpus;
s32 end_index = 1;
u64* end = (u64*)bpf_map_lookup_elem(&alloc_map, &end_index);
u64 *end = (u64 *)bpf_map_lookup_elem(&alloc_map, &end_index);
if (end == NULL || *end == 0)
{
u64 current_end_addr = start + partition_size;
Expand Down
4 changes: 2 additions & 2 deletions include/arguments.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ void *get_argument_by_reg(struct pt_regs *ctx, int index)

void *get_argument_by_stack(struct pt_regs *ctx, int index)
{
void* ptr = 0;
bpf_probe_read(&ptr, sizeof(ptr), (void *)(PT_REGS_SP(ctx)+(index*8)));
void *ptr = 0;
bpf_probe_read(&ptr, sizeof(ptr), (void *)(PT_REGS_SP(ctx) + (index * 8)));
return ptr;
}

Expand Down
2 changes: 1 addition & 1 deletion include/go_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ static __always_inline struct go_string write_user_go_string(char *str, u32 len)
new_string.len = len;

// Copy new string struct to userspace
void* res = write_target_data((void*)&new_string, sizeof(new_string));
void *res = write_target_data((void *)&new_string, sizeof(new_string));
if (res == NULL) {
new_string.len = 0;
}
Expand Down
16 changes: 8 additions & 8 deletions pkg/instrumentors/bpf/google/golang/org/grpc/bpf/probe.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,12 @@ int uprobe_Http2Client_CreateHeaderFields(struct pt_regs *ctx)
struct go_slice_user_ptr slice_user_ptr = {};
if (is_registers_abi)
{
slice.array = (void*) GO_PARAM1(ctx);
slice.array = (void *)GO_PARAM1(ctx);
slice.len = (s32) GO_PARAM2(ctx);
slice.cap = (s32) GO_PARAM3(ctx);
slice_user_ptr.array = (void*) &GO_PARAM1(ctx);
slice_user_ptr.len = (void*) &GO_PARAM2(ctx);
slice_user_ptr.cap = (void*) &GO_PARAM3(ctx);
slice_user_ptr.array = (void *)&GO_PARAM1(ctx);
slice_user_ptr.len = (void *)&GO_PARAM2(ctx);
slice_user_ptr.cap = (void *)&GO_PARAM3(ctx);
}
else
{
Expand All @@ -147,9 +147,9 @@ int uprobe_Http2Client_CreateHeaderFields(struct pt_regs *ctx)
slice.array = get_argument(ctx, slice_pointer_pos);
slice.len = (long)get_argument(ctx, slice_len_pos);
slice.cap = (long)get_argument(ctx, slice_cap_pos);
slice_user_ptr.array = (void *)(PT_REGS_SP(ctx)+(slice_pointer_pos*8));
slice_user_ptr.len = (void *)(PT_REGS_SP(ctx)+(slice_len_pos*8));
slice_user_ptr.cap = (void *)(PT_REGS_SP(ctx)+(slice_cap_pos*8));
slice_user_ptr.array = (void *)(PT_REGS_SP(ctx) + (slice_pointer_pos * 8));
slice_user_ptr.len = (void *)(PT_REGS_SP(ctx) + (slice_len_pos * 8));
slice_user_ptr.cap = (void *)(PT_REGS_SP(ctx) + (slice_cap_pos * 8));
}
char key[11] = "traceparent";
struct go_string key_str = write_user_go_string(key, sizeof(key));
Expand All @@ -160,7 +160,7 @@ int uprobe_Http2Client_CreateHeaderFields(struct pt_regs *ctx)

// Get grpc request struct
void *context_ptr = 0;
bpf_probe_read(&context_ptr, sizeof(context_ptr), (void *)(PT_REGS_SP(ctx)+(context_pointer_pos*8)));
bpf_probe_read(&context_ptr, sizeof(context_ptr), (void *)(PT_REGS_SP(ctx) + (context_pointer_pos * 8)));
void *parent_ctx = find_context_in_map(context_ptr, &context_to_grpc_events);
void *grpcReq_ptr = bpf_map_lookup_elem(&context_to_grpc_events, &parent_ctx);
struct grpc_request_t grpcReq = {};
Expand Down

0 comments on commit 7ba89cd

Please sign in to comment.