doc/documentation/manual-pages/ja/man3/libdisk.3
Sergio Carlavilla Delgado 989d921f5d Migrate doc to Hugo/AsciiDoctor
I'm very pleased to announce the release of
our new website and documentation using
the new toolchain with Hugo and AsciiDoctor.

To get more information about the new toolchain
please read the FreeBSD Documentation Project Primer[1],
Hugo docs[2] and AsciiDoctor docs[3].

Acknowledgment:
Benedict Reuschling <bcr@>
Glen Barber <gjb@>
Hiroki Sato <hrs@>
Li-Wen Hsu <lwhsu@>
Sean Chittenden <seanc@>
The FreeBSD Foundation

[1] https://docs.FreeBSD.org/en/books/fdp-primer/
[2] https://gohugo.io/documentation/
[3] https://docs.asciidoctor.org/home/

Approved by:    doceng, core
2021-01-26 00:31:29 +01:00

362 lines
8.7 KiB
Groff

.\"
.\" Copyright (c) 1996 Joerg Wunsch
.\"
.\" All rights reserved.
.\"
.\" This program is free software.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" %FreeBSD: src/lib/libdisk/libdisk.3,v 1.11.2.10 2001/12/17 10:08:29 ru Exp %
.\" "
.\" $FreeBSD$
.Dd March 15, 1996
.Dt LIBDISK 3
.Os
.Sh ̾¾Î
.Nm Open_Disk ,
.Nm Clone_Disk ,
.Nm Free_Disk ,
.Nm Debug_Disk ,
.Nm Set_Bios_Geom ,
.Nm Delete_Chunk ,
.Nm Collapse_Disk ,
.Nm Collapse_Chunk ,
.Nm Create_Chunk ,
.Nm All_FreeBSD ,
.Nm CheckRules ,
.Nm Disk_Names ,
.Nm Set_Boot_Mgr ,
.Nm Set_Boot_Blocks ,
.Nm Write_Disk ,
.Nm Cyl_Aligned ,
.Nm Next_Cyl_Aligned ,
.Nm Prev_Cyl_Aligned ,
.Nm Track_Aligned ,
.Nm Next_Track_Aligned ,
.Nm Prev_Track_Aligned ,
.Nm Create_Chunk_DWIM ,
.Nm MakeDev ,
.Nm MakeDevDisk ,
.Nm ShowChunkFlags ,
.Nm ChunkCanBeRoot ,
.Nm chunk_n ,
.Nm slice_type_name
.Nd ¥¹¥é¥¤¥¹¤ª¤è¤Ó¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¥é¥Ù¥ë¤ËÂФ¹¤ë¥¤¥ó¥¿¥Õ¥§¡¼¥¹¥é¥¤¥Ö¥é¥ê
.Sh ¥é¥¤¥Ö¥é¥ê
.Lb libdisk
.Sh ½ñ¼°
.In sys/types.h
.In libdisk.h
.Pp
.Vt extern const char *chunk_n[] ;
.Ft const char *
.Fn slice_type_name "int type" "int subtype"
.Ft struct disk *
.Fn Open_Disk "const char *devname"
.Ft struct disk *
.Fn Clone_Disk "struct disk *disk"
.Ft void
.Fn Free_Disk "struct disk *disk"
.Ft void
.Fn Debug_Disk "struct disk *disk"
.Ft void
.Fn Set_Bios_Geom "struct disk *disk" "u_long cyl" "u_long heads" "u_long sects"
.Ft int
.Fn Delete_Chunk "struct disk *disk" "struct chunk *"
.Ft void
.Fn Collapse_Disk "struct disk *disk"
.Ft int
.Fn Collapse_Chunk "struct disk *disk" "struct chunk *chunk"
.Ft int
.Fn Create_Chunk "struct disk *disk" "u_long offset" "u_long size" "chunk_e type" "int subtype" "u_long flags"
.Ft void
.Fn All_FreeBSD "struct disk *d" "int force_all"
.Ft char *
.Fn CheckRules "struct disk *"
.Ft char **
.Fn Disk_Names "void"
.Ft void
.Fn Set_Boot_Mgr "struct disk *d" "const u_char *bootmgr" "const size_t bootmgr_size"
.Ft int
.Fn Set_Boot_Blocks "struct disk *d" "const u_char *boot1" "const u_char *boot2"
.Ft int
.Fn Write_Disk "struct disk *d"
.Ft int
.Fn Cyl_Aligned "struct disk *d" "u_long offset"
.Ft u_long
.Fn Next_Cyl_Aligned "struct disk *d" "u_long offset"
.Ft u_long
.Fn Prev_Cyl_Aligned "struct disk *d" "u_long offset"
.Ft int
.Fn Track_Aligned "struct disk *d" "u_long offset"
.Ft u_long
.Fn Next_Track_Aligned "struct disk *d" "u_long offset"
.Ft u_long
.Fn Prev_Track_Aligned "struct disk *d" "u_long offset"
.Ft struct chunk *
.Fn Create_Chunk_DWIM "struct disk *d" "struct chunk *parent" "u_long size" "chunk_e type" "int subtype" "u_long flags"
.Ft int
.Fn MakeDev "struct chunk *c" "const char *path"
.Ft int
.Fn MakeDevDisk "struct disk *d" "const char *path"
.Ft char *
.Fn ShowChunkFlags "struct chunk *c"
.Ft char *
.Fn ChunkCanBeRoot "struct chunk *c"
.Sh ²òÀâ
.Nm libdisk
¤Ï¡¢Äã¥ì¥Ù¥ë¤Î¥Ç¥£¥¹¥¯¥¹¥é¥¤¥¹
¤ª¤è¤Ó¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¥é¥Ù¥ë¤ËÂФ¹¤ë¥¤¥ó¥¿¥Õ¥§¡¼¥¹¤òÄ󶡤·¤Þ¤¹¡£
¤Û¤È¤ó¤É¤Î´Ø¿ô¤Ï¡¢
.Ql struct disk
¤Þ¤¿¤Ï
.Ql struct chunk
¤È¤¤¤¦·¿¤Î°ú¿ô¤ò¼è¤êÆ°ºî¤·¤Þ¤¹¡£
.Pp
¤É¤Á¤é¤Î·¿¤â¥×¥í¥°¥é¥Þ¤Ë¤Ï¤ï¤«¤ê¤Ë¤¯¤¤¤Î¤Ç¡¢´°Á´¤ò´ü¤¹¤¿¤á¤Ë
°Ê²¼¤ËÆâÉô¹½Â¤¤ò¼¨¤·¤Þ¤¹¡£
.Bd -literal -offset indent
struct disk {
char *name;
u_long flags;
u_long bios_cyl;
u_long bios_hd;
u_long bios_sect;
u_char *bootmgr;
u_char *boot1;
u_char *boot2;
struct chunk *chunks;
u_long sector_size;
};
.Ed
´Ø¿ô¤Ë¤è¤ë¥Õ¥é¥°ÃͤÏ
.Ql DISK_ON_TRACK
¤À¤±¤Ç¡¢¥Ç¥£¥¹¥¯¤¬ On-Track ¥Ç¥£¥¹¥¯¥Þ¥Í¡¼¥¸¥ã¤Ë¤è¤Ã¤Æ
Áàºî¤µ¤ì¤Æ¤¤¤ë¤³¤È¤ò°ÕÌ£¤·¤Þ¤¹¡£
.Pp
.Bd -literal -offset indent
struct chunk {
struct chunk *next;
struct chunk *part;
struct disk *disk;
long offset;
u_long size;
u_long end;
char *name;
char *oname;
chunk_e type;
int subtype;
u_long flags;
void (*private_free)(void*);
void *(*private_clone)(void*);
void *private_data;
};
.Ed
.Ql type
¥Õ¥£¡¼¥ë¥É¤Ï
.Ql whole, unknown, fat, freebsd, extended, part, unused
¤Î¤¦¤Á¡¢¤É¤ì¤«°ì¤Ä¤ÎÃͤò¼è¤ê¤Þ¤¹¡£
.Pp
°Ê²¼¤Ï
.Ql struct chunk
¤Ë¤ª¤¤¤Æ
.Ql flags
¤¬¼è¤ë¤³¤È¤Î¤Ç¤­¤ëÃͤǤ¹¡£
.Bl -tag -offset indent -width CHUNK_BSD_COMPATXX
.It CHUNK_PAST_1024
¥·¥ê¥ó¥À 1024 ¤ò±Û¤¨¤Æ¤¤¤ë¤¿¤á¡¢¤³¤ÎÎΰ褫¤é¤Ï¥Ö¡¼¥È¤Ç¤­¤Þ¤»¤ó¡£
.It CHUNK_BSD_COMPAT
¤³¤ÎÎΰè¤Ï¡¢
.Bx
¸ß´¹¤Ç¤¢¤ê¡¢
.Ql wd0s4f -> wd0f
¤Î¤è¤¦¤Êû½Ì·Á¤â»ÈÍѤǤ­¤Þ¤¹¡£
.It CHUNK_ALIGN
¤³¤ÎÎΰè¤ÏÀ°¹ç(align)¤·¤Æ¤¤¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£
.It CHUNK_IS_ROOT
¤³¤Î
.Ql part
¤Ï
rootfs
¤Ç¤¢¤ê¡¢¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¤ò
.Ql a
¤Ë
³ä¤ê¿¶¤ê¤Þ¤¹¡£
.It CHUNK_ACTIVE
MBR Æâ¤Î¥¢¥¯¥Æ¥£¥Ö¥¹¥é¥¤¥¹¤Ç¤¹¡£
.It CHUNK_FORCE_ALL
¤¹¤Ù¤Æ¤Î BIOS ¤Ë¤è¤ë¥¸¥ª¥á¥È¥ê²ò¼á¤ò̵»ë¤·¡¢Í¿¤¨¤é¤ì¤¿¥Ç¥£¥¹¥¯Á´ÂΤò
¶¯À©Åª¤Ë
.Fx
ÍѤȤ·¤Þ¤¹¡£
.El
.Pp
¥Õ¥£¡¼¥ë¥É
.Ql private_data, `private_free', private_clone
¤Ï¡¢
¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¸ÇÍ­¤Î¥Ç¡¼¥¿¡¢¤ª¤è¤Ó¤½¤Î´ÉÍý¤Î¤¿¤á¤Î¤â¤Î¤Ç¤¹¡£¤³¤Î
µ¡Ç½¤¬¤Ê¤±¤ì¤Ð¡¢µ­²±°è¤Î´ÉÍý¤Ï¤Ç¤­¤º¡¢¥¯¥í¡¼¥Ë¥ó¥°¤Ë¤è¤ê¥Ý¥¤¥ó¥¿¤¬
Ê£À½¤µ¤ì¤Æ¤â²òÊü¤Ç¤­¤Ê¤¯¤Ê¤ê¤Þ¤¹¡£
.Pp
.Fn Open_Disk
¤Ï¡¢Ì¾Á°Éեǥ£¥¹¥¯¤ò open ¤·¡¢°ì·² (populated) ¤Î¥Ä¥ê¡¼¤ò
ÊÖ¤·¤Þ¤¹¡£
.Pp
.Fn Clone_Disk
¤Ï¡¢¥Ä¥ê¡¼¤ÎÊ£À½¤òºîÀ®¤·¤Þ¤¹¡£
.Dq Undo
µ¡Ç½¤ËÊØÍø¤Ç¤¹¡£
.Pp
.Fn Free_Disk
¤Ï¡¢
.Fn Open_Disk
¤Þ¤¿¤Ï
.Fn Clone_Disk
¤ÇºîÀ®¤µ¤ì¤¿¥Ä¥ê¡¼¤ò²òÊü¤·¤Þ¤¹¡£
.Pp
.Fn Debug_Disk
¤Ï¡¢É¸½à½ÐÎÏ (stdout)
¤Î¥Ä¥ê¡¼¤ÎÆâÍƤò½ÐÎϤ·¤Þ¤¹¡£
.Pp
.Fn Set_Bios_Geom
¤Ï¡¢
BIOS ¤¬»È¤¦¥¸¥ª¥á¥È¥ê¤òÀßÄꤷ¤Þ¤¹¡£
.Pp
.Fn Delete_Chunk
¤Ï¡¢disk_space ¤ÎÎΰè¤ò²òÊü¤·¤Þ¤¹¡£
.Pp
.Fn Collapse_Disk
¤ª¤è¤Ó
.Fn Collapse_Chunk
¤Ï¡¢¤Þ¤À»î¸³Åª¤Ê¤â¤Î¤Ê¤Î¤Ç»È¤Ã¤Æ¤Ï¤¤¤±¤Þ¤»¤ó¡£
.Pp
.Fn Create_Chunk
¤Ï¡¢»ØÄꤵ¤ì¤¿¥Ñ¥é¥á¡¼¥¿¤ò»ý¤ÄÎΰè¤òÀ¸À®¤·¤Þ¤¹¡£
.Pp
.Fn All_FreeBSD
¤Ï¡¢¥Ç¥£¥¹¥¯Á´ÂΤò°ì¤Ä¤Î
.Fx
¤ÎÎΰè¤òºîÀ®¤·¤Þ¤¹¡£
.Ql force_all
¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë¤È¡¢BIOS ¤Ë¤è¤ë¥¸¥ª¥á¥È¥ê²ò¼á¤ò¤¹¤Ù¤Æ̵»ë¤·¤Þ¤¹¡£
.Pp
.Fn CheckRules
¤Ï¡¢¤³¤Î¥Ç¥£¥¹¥¯¥ì¥¤¥¢¥¦¥È¤ÎÌ·½â¤·¤¿¶è²èµ¬Â§¤Ë¤Ä¤¤¤Æ¤Î·Ù¹ð¤ò
ʸ»úÎó
.Ql char*
¤È¤·¤ÆÊÖ¤·¤Þ¤¹¡£
.Pp
.Fn Disk_Names
¤Ï¡¢
¤¹¤Ù¤Æ¤Î¥Ç¥£¥¹¥¯Ì¾ (wd0, wd1 ...) ¤ò³ÊǼ¤·¤¿Ê¸»úÎó·²
.Ql char**
¤òÊÖ¤·¤Þ¤¹¡£
ÇÛÎó¤ÈƱÍÍ¡¢³Æ¥Ý¥¤¥ó¥¿¤ò¼êÆ°¤Ç²òÊü¤·¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£
.Pp
.Fn Set_Boot_Mgr
¤Ï¡¢¤³¤Î¥Ö¡¼¥È¥Þ¥Í¡¼¥¸¥ã¤ò¥Ç¥£¥¹¥¯¾å¤Ç»È¤¦¤è¤¦¤ËÀßÄꤷ¤Þ¤¹¡£
.Fn Write_Disk
¤¬¸Æ¤Ó½Ð¤µ¤ì¤ë¤È¤­¤Ë½ñ¤­¹þ¤Þ¤ì¤¿¤â¤Î¤ò¼èÆÀ¤·¤Þ¤¹¡£
.Pp
.Fn Set_Boot_Blocks
¤Ï¡¢¥Ç¥£¥¹¥¯¾å¤Ç»È¤ï¤ì¤ë¥Ö¡¼¥È¥Ö¥í¥Ã¥¯¤òÀßÄꤷ¤Þ¤¹¡£
.Fn Write_Disk
¤¬¸Æ¤Ó½Ð¤µ¤ì¤ë¤È¤­¤Ë½ñ¤­¹þ¤Þ¤ì¤¿¤â¤Î¤ò¼èÆÀ¤·¤Þ¤¹¡£
.Pp
.Fn Write_Disk
¤Ï¡¢MBR ¡¢¥Ç¥£¥¹¥¯¥é¥Ù¥ë¡¢¥Ö¡¼¥È¥Ö¥í¥Ã¥¯¡¢¥Ö¡¼¥È¥Þ¥Í¡¼¥¸¥ã
¤¹¤Ù¤Æ¤ò½ñ¤­¹þ¤ß¤Þ¤¹¡£
.Pp
.Fn Cyl_Aligned
¤Ï¡¢BIOS ¥¸¥ª¥á¥È¥ê¤Ë½¾¤Ã¤Æ
.Ql offset
¤¬¥·¥ê¥ó¥À¾å¤ËÀ°¹ç¤·¤Æ¤¤¤ë¤«¤É¤¦¤«¤òÄ´¤Ù¤Þ¤¹¡£
.Pp
.Fn Next_Cyl_Aligned
¤Ï¡¢BIOS ¥¸¥ª¥á¥È¥ê¤Ë½¾¤Ã¤Æ
.Ql offset
¤ò¼¡¤Î¥·¥ê¥ó¥À¤ËÀÚ¤ê¾å¤²¤ÆÇÛÃÖ¤·¤Þ¤¹¡£
.Pp
.Fn Prev_Cyl_Aligned
¤Ï¡¢BIOS ¥¸¥ª¥á¥È¥ê¤Ë½¾¤Ã¤Æ
.Ql offset
¤òÁ°¤Î¥·¥ê¥ó¥À¤ËÀڤ겼¤²¤ÆÇÛÃÖ¤·¤Þ¤¹¡£
.Pp
.Fn Track_Aligned
¤Ï¡¢BIOS ¥¸¥ª¥á¥È¥ê¤Ë½¾¤Ã¤Æ
.Ql offset
¤¬¥È¥é¥Ã¥¯¾å¤ËÇÛÃÖ¤µ¤ì¤Æ¤¤¤ë¤«¤É¤¦¤«¤òÄ´¤Ù¤Þ¤¹¡£
.Pp
.Fn Next_Track_Aligned
¤Ï¡¢BIOS ¥¸¥ª¥á¥È¥ê¤Ë½¾¤Ã¤Æ
.Ql offset
¤ò¼¡¤Î¥È¥é¥Ã¥¯¤ËÀÚ¤ê¾å¤²¤ÆÇÛÃÖ¤·¤Þ¤¹¡£
.Pp
.Fn Prev_Track_Aligned
¤Ï¡¢BIOS ¥¸¥ª¥á¥È¥ê¤Ë½¾¤Ã¤Æ
.Ql offset
¤¬¥È¥é¥Ã¥¯¾å¤ËÇÛÃÖ¤µ¤ì¤Æ¤¤¤ë¤«¤É¤¦¤«¤òÄ´¤Ù¤Þ¤¹¡£
.Pp
.Fn Create_Chunk_DWIM
¤Ï¡¢»ØÄꤵ¤ì¤¿¿ÆÎΰèÆâ¤Ë»ØÄꥵ¥¤¥º¤Î¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¤òÀ¸À®¤·¡¢
¤½¤Î¥Ý¥¤¥ó¥¿¤òÊÖ¤·¤Þ¤¹¡£
ºÇ½é¤Ë¸«¤Ä¤«¤Ã¤¿½½Ê¬¤ÊÂ礭¤µ¤Î̤»ÈÍÑÎΰ褬»È¤ï¤ì¤Þ¤¹¡£
.Pp
.Fn MakeDev
¤Ï¡¢¤³¤ÎÎΰè¤Î¥Ç¥Ð¥¤¥¹¥Î¡¼¥É¤òºîÀ®¤·¤Þ¤¹¡£
.Pp
.Fn MakeDevDisk
¤Ï¡¢¥Ç¥£¥¹¥¯¾å¤Ë¤¢¤ë¤¹¤Ù¤Æ¤ÎÎΰè¤Î¥Ç¥Ð¥¤¥¹¥Î¡¼¥É¤òºîÀ®¤·¤Þ¤¹¡£
.Pp
.Fn ShowChunkFlags
¤Ï¡¢¥Õ¥é¥°¤òɽ¼¨¤¹¤ëʸ»úÎó¤òÊÖ¤·¤Þ¤¹¡£
.Pp
.Fn ChunkCanBeRoot
¤Ï¡¢Îΰ褬
.Ql /
¤Ë¤Ê¤ì¤ë¤Ê¤é¤Ð¥Ì¥ë¤òÊÖ¤·¤Þ¤¹¡£
.Pp
Îΰè̾¤ò¼¨¤¹Ê¸»úÎó¤Ï¡¢³°ÉôÇÛÎóÊÑ¿ô
.Va chunk_n
¤ò»È¤Ã¤ÆľÀÜ¥¢¥¯¥»¥¹¤Ç¤­¤Þ¤¹¡£
.Pp
.Fn slice_type_name
¤Ï¡¢»ØÄꤵ¤ì¤¿
.Ql type .
.Ql subtype
¤Ë´ØÏ¢¤Å¤±¤é¤ì¤¿Ì¾Á°Ê¸»úÎó¤òÊÖ¤·¤Þ¤¹¡£
.Fn slice_type_name
¤¬¥¹¥é¥¤¥¹¤ËÂФ·¤Æ "unknown" ¤òÊÖ¤¹¤Î¤Ï¡¢
̤ÃΤξì¹ç¡¢¤¹¤Ê¤ï¤Á
.Ql /
¤Ç¤¹¡£
.Pp
.Sh ºî¼Ô
.An -nosplit
.Nm libdisk
¤Ï¡¢
.An Poul-Henning Kamp
¤¬ºîÀ®¤·¤Þ¤·¤¿¡£
.Pp
¤³¤Î¥Þ¥Ë¥å¥¢¥ë¥Ú¡¼¥¸¤Î¼¹É®¼Ô¤Ï
.An J\(:org Wunsch
¤Ç¤¹¡£