public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 bpf-next] libbpf: Use local includes inside the library
@ 2023-08-02  8:05 Sergey Kacheev
  2023-08-02 14:44 ` Yonghong Song
  0 siblings, 1 reply; 4+ messages in thread
From: Sergey Kacheev @ 2023-08-02  8:05 UTC (permalink / raw)
  To: bpf

This patch makes it possible to import the header files of the bpf
part directly from the source tree.

Signed-off-by: Sergey Kacheev <s.kacheev@gmail.com>
---
Changes from v1:
- Replaced the patch for github/libpf with a patch for bpf-next Linux
source tree
Reference:
- v1: https://lore.kernel.org/bpf/CAJVhQqXomJeO_23DqNWO9KUU-+pwVFoae0Xj=8uH2V=N0mOUSg@mail.gmail.com/
---
 tools/lib/bpf/bpf_tracing.h | 2 +-
 tools/lib/bpf/usdt.bpf.h    | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/lib/bpf/bpf_tracing.h b/tools/lib/bpf/bpf_tracing.h
index be076a404..3803479db 100644
--- a/tools/lib/bpf/bpf_tracing.h
+++ b/tools/lib/bpf/bpf_tracing.h
@@ -2,7 +2,7 @@
 #ifndef __BPF_TRACING_H__
 #define __BPF_TRACING_H__

-#include <bpf/bpf_helpers.h>
+#include "bpf_helpers.h"

 /* Scan the ARCH passed in from ARCH env variable (see Makefile) */
 #if defined(__TARGET_ARCH_x86)
diff --git a/tools/lib/bpf/usdt.bpf.h b/tools/lib/bpf/usdt.bpf.h
index 0bd4c135a..f6763300b 100644
--- a/tools/lib/bpf/usdt.bpf.h
+++ b/tools/lib/bpf/usdt.bpf.h
@@ -4,8 +4,8 @@
 #define __USDT_BPF_H__

 #include <linux/errno.h>
-#include <bpf/bpf_helpers.h>
-#include <bpf/bpf_tracing.h>
+#include "bpf_helpers.h"
+#include "bpf_tracing.h"

 /* Below types and maps are internal implementation details of libbpf's USDT
  * support and are subjects to change. Also, bpf_usdt_xxx() API helpers should
--
2.39.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 bpf-next] libbpf: Use local includes inside the library
  2023-08-02  8:05 [PATCH v2 bpf-next] libbpf: Use local includes inside the library Sergey Kacheev
@ 2023-08-02 14:44 ` Yonghong Song
  2023-08-02 15:55   ` Sergey Kacheev
  0 siblings, 1 reply; 4+ messages in thread
From: Yonghong Song @ 2023-08-02 14:44 UTC (permalink / raw)
  To: Sergey Kacheev, bpf



On 8/2/23 1:05 AM, Sergey Kacheev wrote:
> This patch makes it possible to import the header files of the bpf
> part directly from the source tree.

Could you describe more about your workflow why this patch
is necessary? I would like to understand whether this is a bug
fix for your workflow or something else.

> 
> Signed-off-by: Sergey Kacheev <s.kacheev@gmail.com>
> ---
> Changes from v1:
> - Replaced the patch for github/libpf with a patch for bpf-next Linux
> source tree
> Reference:
> - v1: https://lore.kernel.org/bpf/CAJVhQqXomJeO_23DqNWO9KUU-+pwVFoae0Xj=8uH2V=N0mOUSg@mail.gmail.com/
> ---
>   tools/lib/bpf/bpf_tracing.h | 2 +-
>   tools/lib/bpf/usdt.bpf.h    | 4 ++--
>   2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/lib/bpf/bpf_tracing.h b/tools/lib/bpf/bpf_tracing.h
> index be076a404..3803479db 100644
> --- a/tools/lib/bpf/bpf_tracing.h
> +++ b/tools/lib/bpf/bpf_tracing.h
> @@ -2,7 +2,7 @@
>   #ifndef __BPF_TRACING_H__
>   #define __BPF_TRACING_H__
> 
> -#include <bpf/bpf_helpers.h>
> +#include "bpf_helpers.h"
> 
>   /* Scan the ARCH passed in from ARCH env variable (see Makefile) */
>   #if defined(__TARGET_ARCH_x86)
> diff --git a/tools/lib/bpf/usdt.bpf.h b/tools/lib/bpf/usdt.bpf.h
> index 0bd4c135a..f6763300b 100644
> --- a/tools/lib/bpf/usdt.bpf.h
> +++ b/tools/lib/bpf/usdt.bpf.h
> @@ -4,8 +4,8 @@
>   #define __USDT_BPF_H__
> 
>   #include <linux/errno.h>
> -#include <bpf/bpf_helpers.h>
> -#include <bpf/bpf_tracing.h>
> +#include "bpf_helpers.h"
> +#include "bpf_tracing.h"
> 
>   /* Below types and maps are internal implementation details of libbpf's USDT
>    * support and are subjects to change. Also, bpf_usdt_xxx() API helpers should
> --
> 2.39.2
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 bpf-next] libbpf: Use local includes inside the library
  2023-08-02 14:44 ` Yonghong Song
@ 2023-08-02 15:55   ` Sergey Kacheev
  2023-08-02 17:02     ` Yonghong Song
  0 siblings, 1 reply; 4+ messages in thread
From: Sergey Kacheev @ 2023-08-02 15:55 UTC (permalink / raw)
  To: yonghong.song; +Cc: bpf

In our monrepo, we try to minimize special processing when importing
(aka vendor) third-party source code. Ideally, we try to import
directly from the repositories with the code without changing it, we
try to stick to the source code dependency instead of the artifact
dependency. In the current situation, a patch has to be made for
libbpf to fix the includes in bpf headers so that they work directly
from libbpf/src.
I made this patch only because I believe that it will not harm the
quality of the library code in any way and will not break current
users, if this is not the case, please tell me what I'm missing and
what can break?

Thanks!

On Wed, Aug 2, 2023 at 5:44 PM Yonghong Song <yonghong.song@linux.dev> wrote:
>
>
>
> On 8/2/23 1:05 AM, Sergey Kacheev wrote:
> > This patch makes it possible to import the header files of the bpf
> > part directly from the source tree.
>
> Could you describe more about your workflow why this patch
> is necessary? I would like to understand whether this is a bug
> fix for your workflow or something else.
>
> >
> > Signed-off-by: Sergey Kacheev <s.kacheev@gmail.com>
> > ---
> > Changes from v1:
> > - Replaced the patch for github/libpf with a patch for bpf-next Linux
> > source tree
> > Reference:
> > - v1: https://lore.kernel.org/bpf/CAJVhQqXomJeO_23DqNWO9KUU-+pwVFoae0Xj=8uH2V=N0mOUSg@mail.gmail.com/
> > ---
> >   tools/lib/bpf/bpf_tracing.h | 2 +-
> >   tools/lib/bpf/usdt.bpf.h    | 4 ++--
> >   2 files changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/tools/lib/bpf/bpf_tracing.h b/tools/lib/bpf/bpf_tracing.h
> > index be076a404..3803479db 100644
> > --- a/tools/lib/bpf/bpf_tracing.h
> > +++ b/tools/lib/bpf/bpf_tracing.h
> > @@ -2,7 +2,7 @@
> >   #ifndef __BPF_TRACING_H__
> >   #define __BPF_TRACING_H__
> >
> > -#include <bpf/bpf_helpers.h>
> > +#include "bpf_helpers.h"
> >
> >   /* Scan the ARCH passed in from ARCH env variable (see Makefile) */
> >   #if defined(__TARGET_ARCH_x86)
> > diff --git a/tools/lib/bpf/usdt.bpf.h b/tools/lib/bpf/usdt.bpf.h
> > index 0bd4c135a..f6763300b 100644
> > --- a/tools/lib/bpf/usdt.bpf.h
> > +++ b/tools/lib/bpf/usdt.bpf.h
> > @@ -4,8 +4,8 @@
> >   #define __USDT_BPF_H__
> >
> >   #include <linux/errno.h>
> > -#include <bpf/bpf_helpers.h>
> > -#include <bpf/bpf_tracing.h>
> > +#include "bpf_helpers.h"
> > +#include "bpf_tracing.h"
> >
> >   /* Below types and maps are internal implementation details of libbpf's USDT
> >    * support and are subjects to change. Also, bpf_usdt_xxx() API helpers should
> > --
> > 2.39.2
> >

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 bpf-next] libbpf: Use local includes inside the library
  2023-08-02 15:55   ` Sergey Kacheev
@ 2023-08-02 17:02     ` Yonghong Song
  0 siblings, 0 replies; 4+ messages in thread
From: Yonghong Song @ 2023-08-02 17:02 UTC (permalink / raw)
  To: Sergey Kacheev; +Cc: bpf



On 8/2/23 8:55 AM, Sergey Kacheev wrote:
> In our monrepo, we try to minimize special processing when importing
> (aka vendor) third-party source code. Ideally, we try to import
> directly from the repositories with the code without changing it, we
> try to stick to the source code dependency instead of the artifact
> dependency. In the current situation, a patch has to be made for
> libbpf to fix the includes in bpf headers so that they work directly
> from libbpf/src.
> I made this patch only because I believe that it will not harm the
> quality of the library code in any way and will not break current
> users, if this is not the case, please tell me what I'm missing and
> what can break?

Your change looks okay to me. I agree that this should not
break existing libbpf users. Please add the above description
to your commit message to make it clear why you want to make
this change and resubmit.

> 
> Thanks!
> 
> On Wed, Aug 2, 2023 at 5:44 PM Yonghong Song <yonghong.song@linux.dev> wrote:
>>
>>
>>
>> On 8/2/23 1:05 AM, Sergey Kacheev wrote:
>>> This patch makes it possible to import the header files of the bpf
>>> part directly from the source tree.
>>
>> Could you describe more about your workflow why this patch
>> is necessary? I would like to understand whether this is a bug
>> fix for your workflow or something else.
>>
>>>
>>> Signed-off-by: Sergey Kacheev <s.kacheev@gmail.com>
>>> ---
>>> Changes from v1:
>>> - Replaced the patch for github/libpf with a patch for bpf-next Linux
>>> source tree
>>> Reference:
>>> - v1: https://lore.kernel.org/bpf/CAJVhQqXomJeO_23DqNWO9KUU-+pwVFoae0Xj=8uH2V=N0mOUSg@mail.gmail.com/
>>> ---
>>>    tools/lib/bpf/bpf_tracing.h | 2 +-
>>>    tools/lib/bpf/usdt.bpf.h    | 4 ++--
>>>    2 files changed, 3 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/tools/lib/bpf/bpf_tracing.h b/tools/lib/bpf/bpf_tracing.h
>>> index be076a404..3803479db 100644
>>> --- a/tools/lib/bpf/bpf_tracing.h
>>> +++ b/tools/lib/bpf/bpf_tracing.h
>>> @@ -2,7 +2,7 @@
>>>    #ifndef __BPF_TRACING_H__
>>>    #define __BPF_TRACING_H__
>>>
>>> -#include <bpf/bpf_helpers.h>
>>> +#include "bpf_helpers.h"
>>>
>>>    /* Scan the ARCH passed in from ARCH env variable (see Makefile) */
>>>    #if defined(__TARGET_ARCH_x86)
>>> diff --git a/tools/lib/bpf/usdt.bpf.h b/tools/lib/bpf/usdt.bpf.h
>>> index 0bd4c135a..f6763300b 100644
>>> --- a/tools/lib/bpf/usdt.bpf.h
>>> +++ b/tools/lib/bpf/usdt.bpf.h
>>> @@ -4,8 +4,8 @@
>>>    #define __USDT_BPF_H__
>>>
>>>    #include <linux/errno.h>
>>> -#include <bpf/bpf_helpers.h>
>>> -#include <bpf/bpf_tracing.h>
>>> +#include "bpf_helpers.h"
>>> +#include "bpf_tracing.h"
>>>
>>>    /* Below types and maps are internal implementation details of libbpf's USDT
>>>     * support and are subjects to change. Also, bpf_usdt_xxx() API helpers should
>>> --
>>> 2.39.2
>>>
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-08-02 17:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-02  8:05 [PATCH v2 bpf-next] libbpf: Use local includes inside the library Sergey Kacheev
2023-08-02 14:44 ` Yonghong Song
2023-08-02 15:55   ` Sergey Kacheev
2023-08-02 17:02     ` Yonghong Song

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox