Skip to content

Commit

Permalink
Forbid b{copy,zero,cmp}(). Don't include <strings.h> for <string.h>
Browse files Browse the repository at this point in the history
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
  • Loading branch information
nabijaczleweli committed Jan 22, 2022
1 parent cef7194 commit 71439f5
Show file tree
Hide file tree
Showing 61 changed files with 63 additions and 141 deletions.
2 changes: 1 addition & 1 deletion cmd/zed/agents/fmd_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include <sys/fm/protocol.h>
#include <uuid/uuid.h>
#include <signal.h>
#include <strings.h>
#include <string.h>
#include <time.h>

#include "fmd_api.h"
Expand Down
2 changes: 1 addition & 1 deletion cmd/zed/agents/fmd_serd.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <assert.h>
#include <stddef.h>
#include <stdlib.h>
#include <strings.h>
#include <string.h>
#include <sys/list.h>
#include <sys/time.h>

Expand Down
1 change: 0 additions & 1 deletion cmd/zed/agents/zfs_diagnosis.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

#include <stddef.h>
#include <string.h>
#include <strings.h>
#include <libuutil.h>
#include <libzfs.h>
#include <sys/types.h>
Expand Down
1 change: 0 additions & 1 deletion cmd/zfs/zfs_iter.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>

#include <libzfs.h>

Expand Down
2 changes: 1 addition & 1 deletion cmd/zfs/zfs_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <zone.h>
Expand Down
2 changes: 1 addition & 1 deletion cmd/zfs/zfs_project.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include <getopt.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <dirent.h>
Expand Down
3 changes: 2 additions & 1 deletion cmd/zinject/translate.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <string.h>
#include <sys/file.h>
#include <sys/mntent.h>
#include <sys/mnttab.h>
Expand Down Expand Up @@ -186,6 +186,7 @@ initialize_range(err_type_t type, int level, char *range,
switch (type) {
default:
break;

case TYPE_DATA:
break;

Expand Down
3 changes: 2 additions & 1 deletion cmd/zinject/zinject.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <unistd.h>

Expand All @@ -159,7 +160,7 @@
libzfs_handle_t *g_zfs;
int zfs_fd;

static const char *errtable[TYPE_INVAL] = {
static const char *const errtable[TYPE_INVAL] = {
"data",
"dnode",
"mos",
Expand Down
2 changes: 1 addition & 1 deletion cmd/zpool/zpool_iter.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <string.h>
#include <thread_pool.h>

#include <libzfs.h>
Expand Down
2 changes: 1 addition & 1 deletion cmd/zpool/zpool_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <libintl.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <string.h>
#include <ctype.h>

#include "zpool_util.h"
Expand Down
2 changes: 1 addition & 1 deletion cmd/zstream/zstream.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <string.h>
#include <unistd.h>
#include <libintl.h>
#include <stddef.h>
Expand Down
2 changes: 1 addition & 1 deletion cmd/zstream/zstream_dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include <libnvpair.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <string.h>
#include <unistd.h>
#include <stddef.h>

Expand Down
2 changes: 1 addition & 1 deletion cmd/zstream/zstream_redup.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <string.h>
#include <umem.h>
#include <unistd.h>
#include <sys/debug.h>
Expand Down
2 changes: 1 addition & 1 deletion cmd/zstream/zstream_token.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include <libnvpair.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <string.h>
#include <unistd.h>
#include <stddef.h>

Expand Down
3 changes: 3 additions & 0 deletions config/Rules.am
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ AM_CPPFLAGS += -D"strtok(...)=strtok(__VA_ARGS__) __attribute__((deprecated(\"Us
AM_CPPFLAGS += -D"__xpg_basename(...)=__xpg_basename(__VA_ARGS__) __attribute__((deprecated(\"basename(3) is underspecified. Use zfs_basename() instead!\")))"
AM_CPPFLAGS += -D"basename(...)=basename(__VA_ARGS__) __attribute__((deprecated(\"basename(3) is underspecified. Use zfs_basename() instead!\")))"
AM_CPPFLAGS += -D"dirname(...)=dirname(__VA_ARGS__) __attribute__((deprecated(\"dirname(3) is underspecified. Use zfs_dirnamelen() instead!\")))"
AM_CPPFLAGS += -D"bcopy(...)=bcopy(__VA_ARGS__) __attribute__((deprecated(\"bcopy(3) is deprecated. Use memcpy(3)/memmove(3) instead!\")))"
AM_CPPFLAGS += -D"bcmp(...)=bcmp(__VA_ARGS__) __attribute__((deprecated(\"bcmp(3) is deprecated. Use memcmp(3) instead!\")))"
AM_CPPFLAGS += -D"bzero(...)=bzero(__VA_ARGS__) __attribute__((deprecated(\"bzero(3) is deprecated. Use memset(3) instead!\")))"

AM_LDFLAGS = $(DEBUG_LDFLAGS)
AM_LDFLAGS += $(ASAN_LDFLAGS)
Expand Down
1 change: 0 additions & 1 deletion include/os/freebsd/spl/sys/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ KERNEL_H = \
simd.h \
spl_condvar.h \
string.h \
strings.h \
sunddi.h \
sysmacros.h \
systeminfo.h \
Expand Down
1 change: 0 additions & 1 deletion include/os/freebsd/spl/sys/strings.h

This file was deleted.

2 changes: 1 addition & 1 deletion include/os/linux/spl/sys/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ KERNEL_H = \
signal.h \
simd.h \
stat.h \
strings.h \
string.h \
sunddi.h \
sysmacros.h \
systeminfo.h \
Expand Down
1 change: 1 addition & 0 deletions include/os/linux/spl/sys/string.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include <linux/string.h>
30 changes: 0 additions & 30 deletions include/os/linux/spl/sys/strings.h

This file was deleted.

2 changes: 1 addition & 1 deletion include/sys/xvattr.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#define _SYS_XVATTR_H

#include <sys/vnode.h>
#include <sys/strings.h>
#include <sys/string.h>

#define AV_SCANSTAMP_SZ 32 /* length of anti-virus scanstamp */

Expand Down
3 changes: 1 addition & 2 deletions include/sys/zfs_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ extern "C" {
#include <sys/disp.h>
#include <sys/debug.h>
#include <sys/random.h>
#include <sys/strings.h>
#include <sys/string.h>
#include <sys/byteorder.h>
#include <sys/list.h>
#include <sys/time.h>
Expand Down Expand Up @@ -91,7 +91,6 @@ extern "C" {
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <strings.h>
#include <pthread.h>
#include <setjmp.h>
#include <assert.h>
Expand Down
1 change: 0 additions & 1 deletion lib/libefi/rdwr_efi.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <strings.h>
#include <unistd.h>
#include <uuid/uuid.h>
#include <zlib.h>
Expand Down
2 changes: 1 addition & 1 deletion lib/libnvpair/libnvpair_json.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <string.h>
#include <wchar.h>
#include <sys/debug.h>

Expand Down
2 changes: 1 addition & 1 deletion lib/libshare/libshare.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <strings.h>
#include <libintl.h>
#include <sys/file.h>
#include <sys/types.h>
Expand Down
1 change: 0 additions & 1 deletion lib/libshare/os/freebsd/smb.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <unistd.h>
Expand Down
1 change: 0 additions & 1 deletion lib/libshare/os/linux/nfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include <dirent.h>
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/file.h>
Expand Down
1 change: 0 additions & 1 deletion lib/libshare/os/linux/smb.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <unistd.h>
Expand Down
2 changes: 1 addition & 1 deletion lib/libspl/include/sys/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ libspl_HEADERS = \
simd.h \
stack.h \
stdtypes.h \
strings.h \
string.h \
stropts.h \
sunddi.h \
systeminfo.h \
Expand Down
1 change: 1 addition & 0 deletions lib/libspl/include/sys/string.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include <string.h>
33 changes: 0 additions & 33 deletions lib/libspl/include/sys/strings.h

This file was deleted.

2 changes: 1 addition & 1 deletion lib/libzfs/libzfs_iter.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <string.h>
#include <unistd.h>
#include <stddef.h>
#include <libintl.h>
Expand Down
2 changes: 1 addition & 1 deletion lib/libzfs/libzfs_mount.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
#include <libintl.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <string.h>
#include <unistd.h>
#include <zone.h>
#include <sys/mntent.h>
Expand Down
2 changes: 1 addition & 1 deletion lib/libzfs/libzfs_sendrecv.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include <libintl.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <string.h>
#include <unistd.h>
#include <stddef.h>
#include <fcntl.h>
Expand Down
2 changes: 1 addition & 1 deletion lib/libzfs/os/linux/libzfs_mount_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#include <libintl.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <string.h>
#include <unistd.h>
#include <zone.h>
#include <sys/mntent.h>
Expand Down
2 changes: 1 addition & 1 deletion lib/libzfs/os/linux/libzfs_pool_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include <libintl.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <string.h>
#include <unistd.h>
#include <libgen.h>
#include <zone.h>
Expand Down
2 changes: 1 addition & 1 deletion module/icp/algs/edonr/edonr.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* cryptographic use. Users of Edon-R must interface directly to this module.
*/

#include <sys/strings.h>
#include <sys/string.h>
#include <sys/edonr.h>
#include <sys/debug.h>

Expand Down
2 changes: 1 addition & 1 deletion module/icp/algs/skein/skein_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#define _SKEIN_IMPL_H_

#include <sys/skein.h>
#include <sys/strings.h>
#include <sys/string.h>
#include "skein_impl.h"
#include "skein_port.h"

Expand Down
Loading

0 comments on commit 71439f5

Please sign in to comment.