Open_Disk
, Clone_Disk
,
Free_Disk
, Debug_Disk
,
Set_Bios_Geom
, Delete_Chunk
,
Collapse_Disk
, Collapse_Chunk
,
Create_Chunk
, All_FreeBSD
,
CheckRules
, Disk_Names
,
Set_Boot_Mgr
, Set_Boot_Blocks
,
Write_Disk
, Cyl_Aligned
,
Next_Cyl_Aligned
,
Prev_Cyl_Aligned
,
Track_Aligned
,
Next_Track_Aligned
,
Prev_Track_Aligned
,
Create_Chunk_DWIM
, MakeDev
,
MakeDevDisk
, ShowChunkFlags
,
ChunkCanBeRoot
, chunk_n
,
slice_type_name
—
???饤???????ӥѡ??ƥ??????????٥????Ф??륤?ե??????饤?֥???
Interface to Slice and Partition Labels Library (libdisk,
-ldisk)
<sys/types.h>
<libdisk.h>
extern const char *chunk_n[];
const char *
slice_type_name
(int type,
int subtype) struct disk *
Open_Disk
(const char *devname)
struct disk *
Clone_Disk
(struct disk *disk)
void
Free_Disk
(struct disk *disk)
void
Debug_Disk
(struct disk *disk)
void
Set_Bios_Geom
(struct disk
*disk, u_long cyl, u_long
heads, u_long sects) int
Delete_Chunk
(struct disk
*disk, struct chunk *)
void
Collapse_Disk
(struct disk
*disk) int
Collapse_Chunk
(struct disk
*disk, struct chunk *chunk)
int
Create_Chunk
(struct disk
*disk, u_long offset, u_long
size, chunk_e type, int
subtype, u_long flags)
void
All_FreeBSD
(struct disk *d,
int force_all) char *
CheckRules
(struct disk *)
char **
Disk_Names
(void)
void
Set_Boot_Mgr
(struct disk *d,
const u_char *bootmgr, const size_t
bootmgr_size) int
Set_Boot_Blocks
(struct disk
*d, const u_char *boot1, const
u_char *boot2) int
Write_Disk
(struct disk *d)
int
Cyl_Aligned
(struct disk *d,
u_long offset) u_long
Next_Cyl_Aligned
(struct disk
*d, u_long offset) u_long
Prev_Cyl_Aligned
(struct disk
*d, u_long offset) int
Track_Aligned
(struct disk *d,
u_long offset) u_long
Next_Track_Aligned
(struct disk
*d, u_long offset) u_long
Prev_Track_Aligned
(struct disk
*d, u_long offset) struct chunk
* Create_Chunk_DWIM
(struct
disk *d, struct chunk *parent,
u_long size, chunk_e type,
int subtype, u_long flags)
int
MakeDev
(struct chunk *c,
const char *path) int
MakeDevDisk
(struct disk *d,
const char *path) char *
ShowChunkFlags
(struct chunk
*c) char *
ChunkCanBeRoot
(struct chunk
*c)
libdisk
?ϡ??????٥??Υǥ????????饤??
?????ӥѡ??ƥ??????????٥????Ф??륤?ե??????????ޤ???
?ۤȤ??ɤδؿ??ϡ?
‘struct disk
’ ?ޤ???
‘struct chunk
’
?Ȥ??????ΰ?????????ư??ޤ???
?ɤ????η????ץ??????ޤˤϤ狼???ˤ????Τǡ?????????????????
?ʲ?????????¤???ޤ???
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;
};
?ؿ??ˤ????ե饰?ͤ?
‘DISK_ON_TRACK
’
?????ǡ??ǥ??????? On-Track
?ǥ??????ޥ͡??????ˤ??ä?
??????Ƥ??뤳?Ȥ???̣???ޤ???
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;
};
‘type
’ ?ե??????ɤ?
‘whole, unknown, fat, freebsd, extended, part,
unused
’
?Τ??????ɤ줫???Ĥ??ͤ??????ޤ???
?ʲ??? ‘struct chunk
’
?ˤ????? ‘flags
’
?????뤳?ȤΤǤ????ͤǤ???
- CHUNK_PAST_1024
- ???????? 1024
???ۤ??Ƥ??뤿?ᡢ?????ΰ褫???ϥ֡??ȤǤ??ޤ?????
- CHUNK_BSD_COMPAT
- ?????ΰ??ϡ? BSD
?ߴ??Ǥ??ꡢ ‘
wd0s4f ->
wd0f
’
?Τ褦??û?̷??????ѤǤ??ޤ???
- CHUNK_ALIGN
- ?????ΰ???????(align)???Ƥ??ʤ????Фʤ??ޤ?????
- CHUNK_IS_ROOT
- ???? ‘
part
’ ?? rootfs
?Ǥ??ꡢ?ѡ??ƥ?????????
‘a
’ ??
???꿶???ޤ???
- CHUNK_ACTIVE
- MBR ???Υ????ƥ??֥??饤???Ǥ???
- CHUNK_FORCE_ALL
- ???٤Ƥ? BIOS
?ˤ??른?????ȥ???????̵?뤷??Ϳ?????줿?ǥ????????Τ?
????Ū?? FreeBSD
?ѤȤ??ޤ???
?ե??????? ‘private_data,
`private_free', private_clone
’ ?ϡ?
???ץꥱ??????????ͭ?Υǡ??????????Ӥ??δ????Τ????Τ??ΤǤ???????
??ǽ???ʤ????С????????δ????ϤǤ????????????˥ˤ????ݥ???
ʣ???????Ƥ??????Ǥ??ʤ??ʤ??ޤ???
Open_Disk
()
?ϡ?̾???եǥ??????? open ?????췲 (populated)
?Υĥ?? ?֤??ޤ???
Clone_Disk
()
?ϡ??ĥ??ʣ???????????ޤ???
“Undo” ??ǽ???????Ǥ???
Free_Disk
() ?ϡ?
Open_Disk
() ?ޤ???
Clone_Disk
()
?Ǻ??????줿?ĥ?????????ޤ???
Debug_Disk
() ?ϡ?ɸ??????
(stdout) ?Υĥ?????Ƥ????Ϥ??ޤ???
Set_Bios_Geom
() ?ϡ? BIOS
???Ȥ????????ȥ??????ꤷ?ޤ???
Delete_Chunk
() ?ϡ?disk_space
???ΰ??????????ޤ???
Collapse_Disk
() ??????
Collapse_Chunk
()
?ϡ??ޤ??Ū?ʤ??ΤʤΤǻȤäƤϤ????ޤ?????
Create_Chunk
()
?ϡ????ꤵ?줿?ѥ???????????ΰ??????????ޤ???
All_FreeBSD
()
?ϡ??ǥ????????Τ????Ĥ?
FreeBSD ???ΰ??????????ޤ???
‘force_all
’
?????ꤵ???Ƥ????ȡ?BIOS
?ˤ??른?????ȥ??????٤?̵?뤷?ޤ???
CheckRules
()
?ϡ????Υǥ??????쥤?????Ȥ?̷?⤷?????赬§?ˤĤ??Ƥηٹ???
ʸ???? ‘char*
’
?Ȥ????֤??ޤ???
Disk_Names
() ?ϡ?
???٤ƤΥǥ?????̾ (wd0, wd1 ...)
????Ǽ????ʸ??????
‘char**
’ ???֤??ޤ???
??????Ʊ?͡??ƥݥ?????ư?Dz??????ʤ????Фʤ??ޤ?????
Set_Boot_Mgr
()
?ϡ????Υ֡??ȥޥ͡????????ǥ????????ǻȤ??褦?????ꤷ?ޤ???
Write_Disk
()
???ƤӽФ??????Ȥ??˽??ޤ줿???Τ????????ޤ???
Set_Boot_Blocks
()
?ϡ??ǥ????????ǻȤ??????֡??ȥ֥??å??????ꤷ?ޤ???
Write_Disk
()
???ƤӽФ??????Ȥ??˽??ޤ줿???Τ????????ޤ???
Write_Disk
() ?ϡ?MBR
???ǥ????????٥롢?֡??ȥ֥??å????֡??ȥޥ͡?????
???٤Ƥ????ߤޤ???
Cyl_Aligned
() ?ϡ?BIOS
???????ȥ??˽??ä?
‘offset
’
?????????????????礷?Ƥ??뤫?ɤ?????Ĵ?٤ޤ???
Next_Cyl_Aligned
() ?ϡ?BIOS
???????ȥ??˽??ä?
‘offset
’
?Υ??????????ڤ??夲?????֤??ޤ???
Prev_Cyl_Aligned
() ?ϡ?BIOS
???????ȥ??˽??ä?
‘offset
’
?????Υ??????????ڤ겼???????֤??ޤ???
Track_Aligned
() ?ϡ?BIOS
???????ȥ??˽??ä?
‘offset
’
???ȥ??å????????֤????Ƥ??뤫?ɤ?????Ĵ?٤ޤ???
Next_Track_Aligned
() ?ϡ?BIOS
???????ȥ??˽??ä?
‘offset
’
?Υȥ??å????ڤ??夲?????֤??ޤ???
Prev_Track_Aligned
() ?ϡ?BIOS
???????ȥ??˽??ä?
‘offset
’
???ȥ??å????????֤????Ƥ??뤫?ɤ?????Ĵ?٤ޤ???
Create_Chunk_DWIM
()
?ϡ????ꤵ?줿???ΰ????˻??ꥵ?????Υѡ??ƥ?????????????????
???Υݥ????֤??ޤ???
?ǽ??˸??Ĥ??ä???ʬ???礭????̤?????ΰ褬?Ȥ????ޤ???
MakeDev
()
?ϡ??????ΰ??ΥǥХ????Ρ??ɤ????????ޤ???
MakeDevDisk
()
?ϡ??ǥ????????ˤ??뤹?٤Ƥ??ΰ??ΥǥХ????Ρ??ɤ????????ޤ???
ShowChunkFlags
()
?ϡ??ե饰??ɽ??????ʸ???????֤??ޤ???
ChunkCanBeRoot
()
?ϡ??ΰ褬 ‘/
’
?ˤʤ????ʤ??Х̥????֤??ޤ???
?ΰ?̾??ʸ?????ϡ??????????ѿ?
chunk_n
???Ȥä?ľ?ܥ????????Ǥ??ޤ???
slice_type_name
()
?ϡ????ꤵ?줿 ‘type
’.
‘subtype
’
?˴?Ϣ?Ť????줿̾??ʸ???????֤??ޤ???
slice_type_name
() ?????饤?????Ф???
"unknown" ???֤??Τϡ?
̤?Τξ??硢???ʤ???
‘/
’ ?Ǥ???
libdisk
?ϡ? Poul-Henning
Kamp ?????????ޤ?????
???Υޥ˥奢???ڡ????μ?ɮ?Ԥ?
Jörg Wunsch ?Ǥ???