Modularize net/zlib so it can be used by the vnd module (and, eventually,

by an opencrypto module).
This commit is contained in:
pgoyette 2013-12-29 08:09:44 +00:00
parent a05b8588f7
commit 1b0023ef9a
4 changed files with 51 additions and 12 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: vnd.c,v 1.226 2013/09/15 16:05:51 martin Exp $ */
/* $NetBSD: vnd.c,v 1.227 2013/12/29 08:09:44 pgoyette Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
@ -91,7 +91,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.226 2013/09/15 16:05:51 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.227 2013/12/29 08:09:44 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_vnd.h"
@ -2014,7 +2014,7 @@ vnd_set_geometry(struct vnd_softc *vnd)
#include <sys/module.h>
MODULE(MODULE_CLASS_DRIVER, vnd, NULL);
MODULE(MODULE_CLASS_DRIVER, vnd, "zlib");
CFDRIVER_DECL(vnd, DV_DISK, NULL);
static int

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.130 2013/12/28 19:45:13 pgoyette Exp $
# $NetBSD: Makefile,v 1.131 2013/12/29 08:09:44 pgoyette Exp $
.include <bsd.own.mk>
@ -92,6 +92,7 @@ SUBDIR+= usbverbose
SUBDIR+= vcoda
SUBDIR+= v7fs
SUBDIR+= vnd
SUBDIR+= zlib
SUBDIR+= tprof
.if (defined(NOTYET))
SUBDIR+= unionfs

10
sys/modules/zlib/Makefile Normal file
View File

@ -0,0 +1,10 @@
# $NetBSD: Makefile,v 1.1 2013/12/29 08:09:44 pgoyette Exp $
.include "../Makefile.inc"
.PATH: ${S}/net
KMOD= zlib
SRCS= zlib.c
.include <bsd.kmodule.mk>

View File

@ -1,4 +1,4 @@
/* $NetBSD: zlib.c,v 1.33 2009/03/18 10:22:42 cegger Exp $ */
/* $NetBSD: zlib.c,v 1.34 2013/12/29 08:09:44 pgoyette Exp $ */
/*
* This file is derived from various .h and .c files from the zlib-1.0.4
* distribution by Jean-loup Gailly and Mark Adler, with some additions
@ -11,7 +11,7 @@
* - added inflateIncomp and deflateOutputPending
* - allow strm->next_out to be NULL, meaning discard the output
*
* $Id: zlib.c,v 1.33 2009/03/18 10:22:42 cegger Exp $
* $Id: zlib.c,v 1.34 2013/12/29 08:09:44 pgoyette Exp $
*/
/*
@ -22,7 +22,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: zlib.c,v 1.33 2009/03/18 10:22:42 cegger Exp $");
__KERNEL_RCSID(0, "$NetBSD: zlib.c,v 1.34 2013/12/29 08:09:44 pgoyette Exp $");
#define NO_DUMMY_DECL
#define NO_ZCFUNCS
@ -45,7 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: zlib.c,v 1.33 2009/03/18 10:22:42 cegger Exp $");
subject to change. Applications should only use zlib.h.
*/
/* @(#) $Id: zlib.c,v 1.33 2009/03/18 10:22:42 cegger Exp $ */
/* @(#) $Id: zlib.c,v 1.34 2013/12/29 08:09:44 pgoyette Exp $ */
#ifndef _Z_UTIL_H
#define _Z_UTIL_H
@ -294,7 +294,7 @@ void zcfree(voidpf opaque, voidpf ptr);
subject to change. Applications should only use zlib.h.
*/
/* @(#) $Id: zlib.c,v 1.33 2009/03/18 10:22:42 cegger Exp $ */
/* @(#) $Id: zlib.c,v 1.34 2013/12/29 08:09:44 pgoyette Exp $ */
#ifndef _DEFLATE_H
#define _DEFLATE_H
@ -656,7 +656,7 @@ void _tr_stored_type_only(deflate_state *);
*
*/
/* @(#) $Id: zlib.c,v 1.33 2009/03/18 10:22:42 cegger Exp $ */
/* @(#) $Id: zlib.c,v 1.34 2013/12/29 08:09:44 pgoyette Exp $ */
/* #include "deflate.h" */
@ -1999,7 +1999,7 @@ local block_state deflate_slow(deflate_state *s, int flush)
* Addison-Wesley, 1983. ISBN 0-201-06672-6.
*/
/* @(#) $Id: zlib.c,v 1.33 2009/03/18 10:22:42 cegger Exp $ */
/* @(#) $Id: zlib.c,v 1.34 2013/12/29 08:09:44 pgoyette Exp $ */
/* #define GEN_TREES_H */
@ -5813,7 +5813,7 @@ void zcfree (opaque, ptr)
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id: zlib.c,v 1.33 2009/03/18 10:22:42 cegger Exp $ */
/* @(#) $Id: zlib.c,v 1.34 2013/12/29 08:09:44 pgoyette Exp $ */
/* #include "zlib.h" */
@ -5855,3 +5855,31 @@ uLong ZEXPORT adler32(uLong adler, const Bytef *buf, uInt len)
}
/* --- adler32.c */
#if defined(_KERNEL)
/*
* NetBSD module glue - this code is required for the vnd and swcrypto
* pseudo-devices.
*/
#include <sys/module.h>
static int zlib_modcmd(modcmd_t, void *);
MODULE(MODULE_CLASS_MISC, zlib, NULL);
static int
zlib_modcmd(modcmd_t cmd, void *arg)
{
switch (cmd) {
case MODULE_CMD_INIT:
case MODULE_CMD_FINI:
return 0;
case MODULE_CMD_STAT:
case MODULE_CMD_AUTOUNLOAD:
default:
return ENOTTY;
}
}
#endif /* defined(_KERNEL) */