Skip to content

Commit

Permalink
Allow sys/vdev_disk.h to have OS fields
Browse files Browse the repository at this point in the history
Based on the same style as zfs_znode_os.h.
Create an os/$platform/sys/vdev_disk_os.h for each platform, move
Linux specific fields into it. Currently it leaves FreeBSD's empty.

macOS header file will come in a future PR.

Signed-off-by: Jorgen Lundman <lundman@lundman.net>
  • Loading branch information
lundman committed Jun 14, 2020
1 parent 883a40f commit 55b58ea
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 2 deletions.
1 change: 1 addition & 0 deletions include/os/freebsd/zfs/sys/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ KERNEL_H = \
$(top_srcdir)/include/os/freebsd/zfs/sys/freebsd_crypto.h \
$(top_srcdir)/include/os/freebsd/zfs/sys/sha2.h \
$(top_srcdir)/include/os/freebsd/zfs/sys/vdev_os.h \
$(top_srcdir)/include/os/freebsd/zfs/sys/vdev_disk_os.h \
$(top_srcdir)/include/os/freebsd/zfs/sys/zfs_context_os.h \
$(top_srcdir)/include/os/freebsd/zfs/sys/zfs_ctldir.h \
$(top_srcdir)/include/os/freebsd/zfs/sys/zfs_dir.h \
Expand Down
28 changes: 28 additions & 0 deletions include/os/freebsd/zfs/sys/vdev_disk_os.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/

#ifndef ZFS_VDEV_DISK_OS_H
#define ZFS_VDEV_DISK_OS_H

#define VDEV_DISK_OS_FIELDS

#endif
1 change: 1 addition & 0 deletions include/os/linux/zfs/sys/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ KERNEL_H = \
$(top_srcdir)/include/os/linux/zfs/sys/trace_zil.h \
$(top_srcdir)/include/os/linux/zfs/sys/trace_zio.h \
$(top_srcdir)/include/os/linux/zfs/sys/trace_zrlock.h \
$(top_srcdir)/include/os/linux/zfs/sys/vdev_disk_os.h \
$(top_srcdir)/include/os/linux/zfs/sys/zfs_context_os.h \
$(top_srcdir)/include/os/linux/zfs/sys/zfs_ctldir.h \
$(top_srcdir)/include/os/linux/zfs/sys/zfs_dir.h \
Expand Down
30 changes: 30 additions & 0 deletions include/os/linux/zfs/sys/vdev_disk_os.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/

#ifndef ZFS_VDEV_DISK_OS_H
#define ZFS_VDEV_DISK_OS_H

#define VDEV_DISK_OS_FIELDS \
struct block_device *vd_bdev; \
krwlock_t vd_lock;

#endif
9 changes: 7 additions & 2 deletions include/sys/vdev_disk.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,17 @@

#ifdef _KERNEL
#include <sys/vdev.h>
#include <sys/vdev_disk_os.h>

typedef struct vdev_disk {
/* Common members */
ddi_devid_t vd_devid;
char *vd_minor;
struct block_device *vd_bdev;
krwlock_t vd_lock;
/*
* Platform specific field, defined by each platform and only
* accessable from platform specific code.
*/
VDEV_DISK_OS_FIELDS
} vdev_disk_t;

#endif /* _KERNEL */
Expand Down

0 comments on commit 55b58ea

Please sign in to comment.