xref: /minix3/sys/fs/udf/udf_strat_bootstrap.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc /* $NetBSD: udf_strat_bootstrap.c,v 1.4 2014/11/10 18:46:33 maxv Exp $ */
29f988b79SJean-Baptiste Boric 
39f988b79SJean-Baptiste Boric /*
49f988b79SJean-Baptiste Boric  * Copyright (c) 2006, 2008 Reinoud Zandijk
59f988b79SJean-Baptiste Boric  * All rights reserved.
69f988b79SJean-Baptiste Boric  *
79f988b79SJean-Baptiste Boric  * Redistribution and use in source and binary forms, with or without
89f988b79SJean-Baptiste Boric  * modification, are permitted provided that the following conditions
99f988b79SJean-Baptiste Boric  * are met:
109f988b79SJean-Baptiste Boric  * 1. Redistributions of source code must retain the above copyright
119f988b79SJean-Baptiste Boric  *    notice, this list of conditions and the following disclaimer.
129f988b79SJean-Baptiste Boric  * 2. Redistributions in binary form must reproduce the above copyright
139f988b79SJean-Baptiste Boric  *    notice, this list of conditions and the following disclaimer in the
149f988b79SJean-Baptiste Boric  *    documentation and/or other materials provided with the distribution.
159f988b79SJean-Baptiste Boric  *
169f988b79SJean-Baptiste Boric  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
179f988b79SJean-Baptiste Boric  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
189f988b79SJean-Baptiste Boric  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
199f988b79SJean-Baptiste Boric  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
209f988b79SJean-Baptiste Boric  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
219f988b79SJean-Baptiste Boric  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
229f988b79SJean-Baptiste Boric  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
239f988b79SJean-Baptiste Boric  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
249f988b79SJean-Baptiste Boric  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
259f988b79SJean-Baptiste Boric  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
269f988b79SJean-Baptiste Boric  *
279f988b79SJean-Baptiste Boric  */
289f988b79SJean-Baptiste Boric 
299f988b79SJean-Baptiste Boric #include <sys/cdefs.h>
309f988b79SJean-Baptiste Boric #ifndef lint
31*0a6a1f1dSLionel Sambuc __KERNEL_RCSID(0, "$NetBSD: udf_strat_bootstrap.c,v 1.4 2014/11/10 18:46:33 maxv Exp $");
329f988b79SJean-Baptiste Boric #endif /* not lint */
339f988b79SJean-Baptiste Boric 
349f988b79SJean-Baptiste Boric 
359f988b79SJean-Baptiste Boric #if defined(_KERNEL_OPT)
369f988b79SJean-Baptiste Boric #include "opt_compat_netbsd.h"
379f988b79SJean-Baptiste Boric #endif
389f988b79SJean-Baptiste Boric 
399f988b79SJean-Baptiste Boric #include <sys/param.h>
409f988b79SJean-Baptiste Boric #include <sys/systm.h>
419f988b79SJean-Baptiste Boric #include <sys/sysctl.h>
429f988b79SJean-Baptiste Boric #include <sys/namei.h>
439f988b79SJean-Baptiste Boric #include <sys/proc.h>
449f988b79SJean-Baptiste Boric #include <sys/kernel.h>
459f988b79SJean-Baptiste Boric #include <sys/vnode.h>
469f988b79SJean-Baptiste Boric #include <miscfs/genfs/genfs_node.h>
479f988b79SJean-Baptiste Boric #include <sys/mount.h>
489f988b79SJean-Baptiste Boric #include <sys/buf.h>
499f988b79SJean-Baptiste Boric #include <sys/file.h>
509f988b79SJean-Baptiste Boric #include <sys/device.h>
519f988b79SJean-Baptiste Boric #include <sys/disklabel.h>
529f988b79SJean-Baptiste Boric #include <sys/ioctl.h>
539f988b79SJean-Baptiste Boric #include <sys/dirent.h>
549f988b79SJean-Baptiste Boric #include <sys/stat.h>
559f988b79SJean-Baptiste Boric #include <sys/conf.h>
569f988b79SJean-Baptiste Boric #include <sys/kauth.h>
579f988b79SJean-Baptiste Boric #include <sys/kthread.h>
589f988b79SJean-Baptiste Boric #include <dev/clock_subr.h>
599f988b79SJean-Baptiste Boric 
609f988b79SJean-Baptiste Boric #include <fs/udf/ecma167-udf.h>
619f988b79SJean-Baptiste Boric #include <fs/udf/udf_mount.h>
629f988b79SJean-Baptiste Boric 
639f988b79SJean-Baptiste Boric #include "udf.h"
649f988b79SJean-Baptiste Boric #include "udf_subr.h"
659f988b79SJean-Baptiste Boric #include "udf_bswap.h"
669f988b79SJean-Baptiste Boric 
679f988b79SJean-Baptiste Boric 
689f988b79SJean-Baptiste Boric #define VTOI(vnode) ((struct udf_node *) vnode->v_data)
699f988b79SJean-Baptiste Boric #define PRIV(ump) ((struct strat_private *) ump->strategy_private)
709f988b79SJean-Baptiste Boric 
719f988b79SJean-Baptiste Boric /* --------------------------------------------------------------------- */
729f988b79SJean-Baptiste Boric 
739f988b79SJean-Baptiste Boric static int
udf_create_logvol_dscr_bootstrap(struct udf_strat_args * args)749f988b79SJean-Baptiste Boric udf_create_logvol_dscr_bootstrap(struct udf_strat_args *args)
759f988b79SJean-Baptiste Boric {
769f988b79SJean-Baptiste Boric 	panic("udf_create_logvol_dscr_bootstrap: not possible\n");
779f988b79SJean-Baptiste Boric 	return 0;
789f988b79SJean-Baptiste Boric }
799f988b79SJean-Baptiste Boric 
809f988b79SJean-Baptiste Boric 
819f988b79SJean-Baptiste Boric static void
udf_free_logvol_dscr_bootstrap(struct udf_strat_args * args)829f988b79SJean-Baptiste Boric udf_free_logvol_dscr_bootstrap(struct udf_strat_args *args)
839f988b79SJean-Baptiste Boric {
849f988b79SJean-Baptiste Boric 	panic("udf_free_logvol_dscr_bootstrap: no node descriptor reading\n");
859f988b79SJean-Baptiste Boric }
869f988b79SJean-Baptiste Boric 
879f988b79SJean-Baptiste Boric 
889f988b79SJean-Baptiste Boric static int
udf_read_logvol_dscr_bootstrap(struct udf_strat_args * args)899f988b79SJean-Baptiste Boric udf_read_logvol_dscr_bootstrap(struct udf_strat_args *args)
909f988b79SJean-Baptiste Boric {
919f988b79SJean-Baptiste Boric 	panic("udf_read_logvol_dscr_bootstrap: no node descriptor reading\n");
929f988b79SJean-Baptiste Boric 	return 0;
939f988b79SJean-Baptiste Boric }
949f988b79SJean-Baptiste Boric 
959f988b79SJean-Baptiste Boric 
969f988b79SJean-Baptiste Boric static int
udf_write_logvol_dscr_bootstrap(struct udf_strat_args * args)979f988b79SJean-Baptiste Boric udf_write_logvol_dscr_bootstrap(struct udf_strat_args *args)
989f988b79SJean-Baptiste Boric {
999f988b79SJean-Baptiste Boric 	panic("udf_write_logvol_dscr_bootstrap: no writing\n");
1009f988b79SJean-Baptiste Boric }
1019f988b79SJean-Baptiste Boric 
1029f988b79SJean-Baptiste Boric /* --------------------------------------------------------------------- */
1039f988b79SJean-Baptiste Boric 
1049f988b79SJean-Baptiste Boric static void
udf_queuebuf_bootstrap(struct udf_strat_args * args)1059f988b79SJean-Baptiste Boric udf_queuebuf_bootstrap(struct udf_strat_args *args)
1069f988b79SJean-Baptiste Boric {
1079f988b79SJean-Baptiste Boric 	struct udf_mount *ump = args->ump;
1089f988b79SJean-Baptiste Boric 	struct buf *buf = args->nestbuf;
1099f988b79SJean-Baptiste Boric 
1109f988b79SJean-Baptiste Boric 	KASSERT(ump);
1119f988b79SJean-Baptiste Boric 	KASSERT(buf);
1129f988b79SJean-Baptiste Boric 	KASSERT(buf->b_iodone == nestiobuf_iodone);
1139f988b79SJean-Baptiste Boric 
1149f988b79SJean-Baptiste Boric 	KASSERT(buf->b_flags & B_READ);
1159f988b79SJean-Baptiste Boric 	VOP_STRATEGY(ump->devvp, buf);
1169f988b79SJean-Baptiste Boric }
1179f988b79SJean-Baptiste Boric 
1189f988b79SJean-Baptiste Boric static void
udf_discstrat_init_bootstrap(struct udf_strat_args * args)1199f988b79SJean-Baptiste Boric udf_discstrat_init_bootstrap(struct udf_strat_args *args)
1209f988b79SJean-Baptiste Boric {
1219f988b79SJean-Baptiste Boric 	/* empty */
1229f988b79SJean-Baptiste Boric }
1239f988b79SJean-Baptiste Boric 
1249f988b79SJean-Baptiste Boric 
1259f988b79SJean-Baptiste Boric static void
udf_discstrat_finish_bootstrap(struct udf_strat_args * args)1269f988b79SJean-Baptiste Boric udf_discstrat_finish_bootstrap(struct udf_strat_args *args)
1279f988b79SJean-Baptiste Boric {
1289f988b79SJean-Baptiste Boric 	/* empty */
1299f988b79SJean-Baptiste Boric }
1309f988b79SJean-Baptiste Boric 
1319f988b79SJean-Baptiste Boric /* --------------------------------------------------------------------- */
1329f988b79SJean-Baptiste Boric 
1339f988b79SJean-Baptiste Boric struct udf_strategy udf_strat_bootstrap =
1349f988b79SJean-Baptiste Boric {
1359f988b79SJean-Baptiste Boric 	udf_create_logvol_dscr_bootstrap,
1369f988b79SJean-Baptiste Boric 	udf_free_logvol_dscr_bootstrap,
1379f988b79SJean-Baptiste Boric 	udf_read_logvol_dscr_bootstrap,
1389f988b79SJean-Baptiste Boric 	udf_write_logvol_dscr_bootstrap,
1399f988b79SJean-Baptiste Boric 	udf_queuebuf_bootstrap,
1409f988b79SJean-Baptiste Boric 	udf_discstrat_init_bootstrap,
1419f988b79SJean-Baptiste Boric 	udf_discstrat_finish_bootstrap
1429f988b79SJean-Baptiste Boric };
1439f988b79SJean-Baptiste Boric 
1449f988b79SJean-Baptiste Boric 
145