diff mbox series

[v1,01/10] lapi: Add a configure check and fallback for loop ioctl and flag

Message ID 1585839990-19923-2-git-send-email-xuyang2018.jy@cn.fujitsu.com
State Superseded
Headers show
Series add loop ioctl test | expand

Commit Message

Yang Xu April 2, 2020, 3:06 p.m. UTC
Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
---
 configure.ac        |  1 +
 include/lapi/loop.h | 35 +++++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+)
 create mode 100644 include/lapi/loop.h

Comments

Cyril Hrubis April 3, 2020, 11:44 a.m. UTC | #1
Hi!
> ---
>  configure.ac        |  1 +
>  include/lapi/loop.h | 35 +++++++++++++++++++++++++++++++++++
>  2 files changed, 36 insertions(+)
>  create mode 100644 include/lapi/loop.h
> 
> diff --git a/configure.ac b/configure.ac
> index e1069b57e..e088cb564 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -50,6 +50,7 @@ AC_CHECK_HEADERS([ \
>      linux/if_ether.h \
>      linux/if_packet.h \
>      linux/keyctl.h \
> +    linux/loop.h \

I do wonder if there is actually a distrbution without the linux/loop.h
header, have you seen one?

>      linux/mempolicy.h \
>      linux/module.h \
>      linux/netlink.h \
> diff --git a/include/lapi/loop.h b/include/lapi/loop.h
> new file mode 100644
> index 000000000..bc6d9950d
> --- /dev/null
> +++ b/include/lapi/loop.h
> @@ -0,0 +1,35 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Copyright (c) 2020 FUJITSU LIMITED. All rights reserved.
> + * Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
> + */
> +#ifndef LAPI_LOOP_H
> +#define LAPI_LOOP_H
> +
> +#include <linux/types.h>
> +#ifdef HAVE_LINUX_LOOP_H
> +# include <linux/loop.h>
> +#endif
> +
> +#ifndef LO_FLAGS_PARTSCAN
> +# define LO_FLAGS_PARTSCAN 8
> +#endif
> +
> +#ifndef LO_FLAGS_DIRECT_IO
> +# define LO_FLAGS_DIRECT_IO 16
> +#endif
> +
> +#ifndef LOOP_SET_CAPACITY
> +# define LOOP_SET_CAPACITY 0x4C07
> +#endif
> +
> +#ifndef LOOP_SET_DIRECT_IO
> +# define LOOP_SET_DIRECT_IO 0x4C08
> +#endif
> +
> +#ifndef LOOP_SET_BLOCK_SIZE
> +# define LOOP_SET_BLOCK_SIZE 0x4C09
> +#endif
> +
> +#endif
> +
> -- 
> 2.23.0
> 
> 
> 
> 
> -- 
> Mailing list info: https://lists.linux.it/listinfo/ltp
xuyang April 6, 2020, 6:01 a.m. UTC | #2
Hi Cyril

Thanks for your review.
> Hi!
>> ---
>>   configure.ac        |  1 +
>>   include/lapi/loop.h | 35 +++++++++++++++++++++++++++++++++++
>>   2 files changed, 36 insertions(+)
>>   create mode 100644 include/lapi/loop.h
>>
>> diff --git a/configure.ac b/configure.ac
>> index e1069b57e..e088cb564 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -50,6 +50,7 @@ AC_CHECK_HEADERS([ \
>>       linux/if_ether.h \
>>       linux/if_packet.h \
>>       linux/keyctl.h \
>> +    linux/loop.h \
> 
> I do wonder if there is actually a distrbution without the linux/loop.h
> header, have you seen one?
> 
No, I don't see this distribution. We can remove this.
>>       linux/mempolicy.h \
>>       linux/module.h \
>>       linux/netlink.h \
>> diff --git a/include/lapi/loop.h b/include/lapi/loop.h
>> new file mode 100644
>> index 000000000..bc6d9950d
>> --- /dev/null
>> +++ b/include/lapi/loop.h
>> @@ -0,0 +1,35 @@
>> +// SPDX-License-Identifier: GPL-2.0-or-later
>> +/*
>> + * Copyright (c) 2020 FUJITSU LIMITED. All rights reserved.
>> + * Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
>> + */
>> +#ifndef LAPI_LOOP_H
>> +#define LAPI_LOOP_H
>> +
>> +#include <linux/types.h>
>> +#ifdef HAVE_LINUX_LOOP_H
>> +# include <linux/loop.h>
>> +#endif
>> +
>> +#ifndef LO_FLAGS_PARTSCAN
>> +# define LO_FLAGS_PARTSCAN 8
>> +#endif
>> +
>> +#ifndef LO_FLAGS_DIRECT_IO
>> +# define LO_FLAGS_DIRECT_IO 16
>> +#endif
>> +
>> +#ifndef LOOP_SET_CAPACITY
>> +# define LOOP_SET_CAPACITY 0x4C07
>> +#endif
>> +
>> +#ifndef LOOP_SET_DIRECT_IO
>> +# define LOOP_SET_DIRECT_IO 0x4C08
>> +#endif
>> +
>> +#ifndef LOOP_SET_BLOCK_SIZE
>> +# define LOOP_SET_BLOCK_SIZE 0x4C09
>> +#endif
>> +
>> +#endif
>> +
>> -- 
>> 2.23.0
>>
>>
>>
>>
>> -- 
>> Mailing list info: https://lists.linux.it/listinfo/ltp
>
Martin Doucha April 9, 2020, 8:47 a.m. UTC | #3
Hi,

On 02. 04. 20 17:06, Yang Xu wrote:
> Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
> ---
>  configure.ac        |  1 +
>  include/lapi/loop.h | 35 +++++++++++++++++++++++++++++++++++
>  2 files changed, 36 insertions(+)
>  create mode 100644 include/lapi/loop.h
> 
> diff --git a/configure.ac b/configure.ac
> index e1069b57e..e088cb564 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -50,6 +50,7 @@ AC_CHECK_HEADERS([ \
>      linux/if_ether.h \
>      linux/if_packet.h \
>      linux/keyctl.h \
> +    linux/loop.h \
>      linux/mempolicy.h \
>      linux/module.h \
>      linux/netlink.h \
> diff --git a/include/lapi/loop.h b/include/lapi/loop.h
> new file mode 100644
> index 000000000..bc6d9950d
> --- /dev/null
> +++ b/include/lapi/loop.h
> @@ -0,0 +1,35 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Copyright (c) 2020 FUJITSU LIMITED. All rights reserved.

Here's a little legal issue for LTP: "GPL" and "All rights reserved" are
mutually exclusive. Those two lines are effectively saying that your
code is both open-source and proprietary at the same time. Please pick
one, or the other. It can't be both.

> + * Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
> + */
> +#ifndef LAPI_LOOP_H
> +#define LAPI_LOOP_H
> +
> +#include <linux/types.h>
> +#ifdef HAVE_LINUX_LOOP_H
> +# include <linux/loop.h>
> +#endif
> +
> +#ifndef LO_FLAGS_PARTSCAN
> +# define LO_FLAGS_PARTSCAN 8
> +#endif
> +
> +#ifndef LO_FLAGS_DIRECT_IO
> +# define LO_FLAGS_DIRECT_IO 16
> +#endif
> +
> +#ifndef LOOP_SET_CAPACITY
> +# define LOOP_SET_CAPACITY 0x4C07
> +#endif
> +
> +#ifndef LOOP_SET_DIRECT_IO
> +# define LOOP_SET_DIRECT_IO 0x4C08
> +#endif
> +
> +#ifndef LOOP_SET_BLOCK_SIZE
> +# define LOOP_SET_BLOCK_SIZE 0x4C09
> +#endif
> +
> +#endif
> +
>
Cyril Hrubis April 9, 2020, 10:09 a.m. UTC | #4
Hi!
> > +// SPDX-License-Identifier: GPL-2.0-or-later
> > +/*
> > + * Copyright (c) 2020 FUJITSU LIMITED. All rights reserved.
> 
> Here's a little legal issue for LTP: "GPL" and "All rights reserved" are
> mutually exclusive. Those two lines are effectively saying that your
> code is both open-source and proprietary at the same time. Please pick
> one, or the other. It can't be both.

Actually the "All rights reserved" should not have any legal effects.
The Buenos Aires Convention required that text for estabilishing
copyright which you would have needed before you could license your work
under GPL. However it's long obsolete now and has no legal effect as far
as I can tell.

Btw "All rights reserved" is part of the BSD MIT license because of
these reasons.
Yang Xu April 9, 2020, 10:14 a.m. UTC | #5
Hi Martin

> Hi,
> 
> On 02. 04. 20 17:06, Yang Xu wrote:
>> Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
>> ---
>>   configure.ac        |  1 +
>>   include/lapi/loop.h | 35 +++++++++++++++++++++++++++++++++++
>>   2 files changed, 36 insertions(+)
>>   create mode 100644 include/lapi/loop.h
>>
>> diff --git a/configure.ac b/configure.ac
>> index e1069b57e..e088cb564 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -50,6 +50,7 @@ AC_CHECK_HEADERS([ \
>>       linux/if_ether.h \
>>       linux/if_packet.h \
>>       linux/keyctl.h \
>> +    linux/loop.h \
>>       linux/mempolicy.h \
>>       linux/module.h \
>>       linux/netlink.h \
>> diff --git a/include/lapi/loop.h b/include/lapi/loop.h
>> new file mode 100644
>> index 000000000..bc6d9950d
>> --- /dev/null
>> +++ b/include/lapi/loop.h
>> @@ -0,0 +1,35 @@
>> +// SPDX-License-Identifier: GPL-2.0-or-later
>> +/*
>> + * Copyright (c) 2020 FUJITSU LIMITED. All rights reserved.
> 
> Here's a little legal issue for LTP: "GPL" and "All rights reserved" are
> mutually exclusive. Those two lines are effectively saying that your
> code is both open-source and proprietary at the same time. Please pick
> one, or the other. It can't be both.
I never think this is a problem before. ltp has some cases also using 
this style. Also, xfstests have many cases like this.  Even kernel, it 
also has the two line. Is it a problem?

Best Regards
Yang Xu
> 
>> + * Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
>> + */
>> +#ifndef LAPI_LOOP_H
>> +#define LAPI_LOOP_H
>> +
>> +#include <linux/types.h>
>> +#ifdef HAVE_LINUX_LOOP_H
>> +# include <linux/loop.h>
>> +#endif
>> +
>> +#ifndef LO_FLAGS_PARTSCAN
>> +# define LO_FLAGS_PARTSCAN 8
>> +#endif
>> +
>> +#ifndef LO_FLAGS_DIRECT_IO
>> +# define LO_FLAGS_DIRECT_IO 16
>> +#endif
>> +
>> +#ifndef LOOP_SET_CAPACITY
>> +# define LOOP_SET_CAPACITY 0x4C07
>> +#endif
>> +
>> +#ifndef LOOP_SET_DIRECT_IO
>> +# define LOOP_SET_DIRECT_IO 0x4C08
>> +#endif
>> +
>> +#ifndef LOOP_SET_BLOCK_SIZE
>> +# define LOOP_SET_BLOCK_SIZE 0x4C09
>> +#endif
>> +
>> +#endif
>> +
>>
> 
>
diff mbox series

Patch

diff --git a/configure.ac b/configure.ac
index e1069b57e..e088cb564 100644
--- a/configure.ac
+++ b/configure.ac
@@ -50,6 +50,7 @@  AC_CHECK_HEADERS([ \
     linux/if_ether.h \
     linux/if_packet.h \
     linux/keyctl.h \
+    linux/loop.h \
     linux/mempolicy.h \
     linux/module.h \
     linux/netlink.h \
diff --git a/include/lapi/loop.h b/include/lapi/loop.h
new file mode 100644
index 000000000..bc6d9950d
--- /dev/null
+++ b/include/lapi/loop.h
@@ -0,0 +1,35 @@ 
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2020 FUJITSU LIMITED. All rights reserved.
+ * Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
+ */
+#ifndef LAPI_LOOP_H
+#define LAPI_LOOP_H
+
+#include <linux/types.h>
+#ifdef HAVE_LINUX_LOOP_H
+# include <linux/loop.h>
+#endif
+
+#ifndef LO_FLAGS_PARTSCAN
+# define LO_FLAGS_PARTSCAN 8
+#endif
+
+#ifndef LO_FLAGS_DIRECT_IO
+# define LO_FLAGS_DIRECT_IO 16
+#endif
+
+#ifndef LOOP_SET_CAPACITY
+# define LOOP_SET_CAPACITY 0x4C07
+#endif
+
+#ifndef LOOP_SET_DIRECT_IO
+# define LOOP_SET_DIRECT_IO 0x4C08
+#endif
+
+#ifndef LOOP_SET_BLOCK_SIZE
+# define LOOP_SET_BLOCK_SIZE 0x4C09
+#endif
+
+#endif
+