Skip to contentSkip to conversation

syscalls/ustat: convert to new lib, use direct syscall

PATCH Superseded Steve Muckle 3 participants 5 messages Jan 29, 2019 – Feb 2, 2019

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 syscalls/ustat: convert to new lib, use direct syscall

Use direct syscall to expand test compatibility to Android.

---
 include/lapi/ustat.h                      |  8 ++
 testcases/kernel/syscalls/ustat/ustat01.c | 84 +++++----------------
 testcases/kernel/syscalls/ustat/ustat02.c | 92 +++++------------------
 3 files changed, 45 insertions(+), 139 deletions(-)
 create mode 100644 include/lapi/ustat.h
include/lapi/ustat.h new file +8 -0
new file mode 100644
index 000000000..bcc4e83eb
@@ -0,0 +1,8 @@
+#include <sys/types.h>
+
+struct ustat {
+	daddr_t f_tfree;
+	ino_t f_tinode;
+	char f_fname[6];
+	char f_fpack[6];
+};
testcases/kernel/syscalls/ustat/ustat01.c +17 -67

109 lines not on this page · raw message

testcases/kernel/syscalls/ustat/ustat02.c +20 -72

118 lines not on this page · raw message

Signature · 1 line
2.20.1.495.gaa96b0ce6b-goog
#2 lore raw

PATCH 1/1 syscalls/ustat: convert to new lib, use direct syscall

In reply to Steve Muckle

Hi Steve, Cyril,

include/lapi/ustat.h line 1

Quoted 3 lines

+++ b/include/lapi/ustat.h

include/lapi/ustat.h new file +1 -0
@@ -0,0 +1,8 @@
+#include <sys/types.h>

I'd put here at least
//SPDX-License-Identifier: GPL-2.0-or-later

include/lapi/ustat.h line 8

Quoted 7 lines
include/lapi/ustat.h new file +7 -0
+
+struct ustat {
+	daddr_t f_tfree;
+	ino_t f_tinode;
+	char f_fname[6];
+	char f_fpack[6];
+};

Thinking about it twice, wouldn't be better to include <sys/ustat.h> and detect with autotools whether struct ustat is defined and use this only if it's not defined? The same approach we use for struct statx?

Review line 1

Quoted 3 lines

+++ b/testcases/kernel/syscalls/ustat/ustat01.c

(quoted diff) +1 -0
@@ -1,21 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0

@Cyril: can we use GPL-2.0-or-later? Original was GPL only.

Quoted 6 lines
testcases/kernel/syscalls/ustat/ustat01.c +0 -3
 /*
  * Copyright (c) Wipro Technologies Ltd, 2003.  All Rights Reserved.
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.

testcases/kernel/syscalls/ustat/ustat01.c line 16

Quoted 10 lines
testcases/kernel/syscalls/ustat/ustat01.c +0 -10
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- */

Kind regards,
Petr

#3 lore raw

PATCH 1/1 syscalls/ustat: convert to new lib, use direct syscall

Hi!

Quoted 5 lines

include/lapi/ustat.h line 1

Quoted 3 lines

+++ b/include/lapi/ustat.h

include/lapi/ustat.h new file +1 -0
@@ -0,0 +1,8 @@
+#include <sys/types.h>

I'd put here at least
//SPDX-License-Identifier: GPL-2.0-or-later

Quoted 10 lines

include/lapi/ustat.h line 8

Quoted 7 lines
include/lapi/ustat.h new file +7 -0
+
+struct ustat {
+	daddr_t f_tfree;
+	ino_t f_tinode;
+	char f_fname[6];
+	char f_fpack[6];
+};

Thinking about it twice, wouldn't be better to include <sys/ustat.h> and detect with autotools whether struct ustat is defined and use this only if it's not defined? The same approach we use for struct statx?

And we do have the configure check for ustat.h in place so this should be as easy as doing:

#ifdef HAVE_SYS_USTAT_H

# include <sys/ustat.h>
#else
struct ustat {
...
}
#endif

Also ideally this header should include guards, even if it's unlikely to be included twice.

Quoted 4 lines

Review line 1

Quoted 3 lines

+++ b/testcases/kernel/syscalls/ustat/ustat01.c

(quoted diff) +1 -0
@@ -1,21 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0

@Cyril: can we use GPL-2.0-or-later? Original was GPL only.

I would have kept it GPL-2.0 unless it's rewritten from scratch completely.

Signature · 2 lines
Cyril Hrubis
[email protected]
#4 lore raw

PATCH 1/1 syscalls/ustat: convert to new lib, use direct syscall

Quoted 31 lines · Cyril Hrubis

Hi!

Quoted 5 lines

include/lapi/ustat.h line 1

Quoted 3 lines

+++ b/include/lapi/ustat.h

include/lapi/ustat.h new file +1 -0
@@ -0,0 +1,8 @@
+#include <sys/types.h>

I'd put here at least
//SPDX-License-Identifier: GPL-2.0-or-later

Quoted 10 lines

include/lapi/ustat.h line 8

Quoted 7 lines
include/lapi/ustat.h new file +7 -0
+
+struct ustat {
+	daddr_t f_tfree;
+	ino_t f_tinode;
+	char f_fname[6];
+	char f_fpack[6];
+};

Thinking about it twice, wouldn't be better to include <sys/ustat.h> and detect with autotools whether struct ustat is defined and use this only if it's not defined? The same approach we use for struct statx?

And we do have the configure check for ustat.h in place so this should be as easy as doing:

#ifdef HAVE_SYS_USTAT_H

# include <sys/ustat.h>
#else
struct ustat {
...
}
#endif

Also ideally this header should include guards, even if it's unlikely to be included twice.

Quoted 7 lines
Quoted 4 lines

Review line 1

Quoted 3 lines

+++ b/testcases/kernel/syscalls/ustat/ustat01.c

(quoted diff) +1 -0
@@ -1,21 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0

@Cyril: can we use GPL-2.0-or-later? Original was GPL only.

I would have kept it GPL-2.0 unless it's rewritten from scratch completely.

Thanks Petr and Cyril for the review, v2 sent.