Changeset View
Changeset View
Standalone View
Standalone View
sys/geom/part/g_part_if.m
Show First 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | default_fullname(struct g_part_table *table, | ||||
struct g_part_entry *entry, struct sbuf *sb, const char *pfx) | struct g_part_entry *entry, struct sbuf *sb, const char *pfx) | ||||
{ | { | ||||
char buf[32]; | char buf[32]; | ||||
sbuf_printf(sb, "%s%s%s", pfx, g_part_separator, | sbuf_printf(sb, "%s%s%s", pfx, g_part_separator, | ||||
G_PART_NAME(table, entry, buf, sizeof(buf))); | G_PART_NAME(table, entry, buf, sizeof(buf))); | ||||
} | } | ||||
static struct g_provider * | |||||
default_new_provider(struct g_part_table *table, struct g_geom *gp, | |||||
struct g_part_entry *entry, const char *pfx) | |||||
{ | |||||
struct g_provider *ret; | |||||
struct sbuf *sb; | |||||
sb = sbuf_new_auto(); | |||||
G_PART_FULLNAME(table, entry, sb, pfx); | |||||
sbuf_finish(sb); | |||||
ret = g_new_providerf(gp, "%s", sbuf_data(sb)); | |||||
sbuf_delete(sb); | |||||
return (ret); | |||||
} | |||||
static void | |||||
default_add_alias(struct g_part_table *table, struct g_provider *pp, | |||||
struct g_part_entry *entry, const char *pfx) | |||||
{ | |||||
struct sbuf *sb; | |||||
sb = sbuf_new_auto(); | |||||
G_PART_FULLNAME(table, entry, sb, pfx); | |||||
sbuf_finish(sb); | |||||
g_provider_add_alias(pp, "%s", sbuf_data(sb)); | |||||
sbuf_delete(sb); | |||||
} | |||||
imp: It's unfortunate these two functions are so close to each other, yet unsharable.
| |||||
cemAuthorUnsubmitted Done Inline ActionsThe first N lines could be merged to a small subroutine. Not a big deal to me one way or the other. We save ~3 lines and then add at least as many to make a subroutine. cem: The first N lines could be merged to a small subroutine. Not a big deal to me one way or the… | |||||
static int | static int | ||||
default_precheck(struct g_part_table *t __unused, | default_precheck(struct g_part_table *t __unused, | ||||
enum g_part_ctl r __unused, struct g_part_parms *p __unused) | enum g_part_ctl r __unused, struct g_part_parms *p __unused) | ||||
{ | { | ||||
return (0); | return (0); | ||||
} | } | ||||
static int | static int | ||||
Show All 20 Lines | |||||
# add() - scheme specific processing for the add verb. | # add() - scheme specific processing for the add verb. | ||||
METHOD int add { | METHOD int add { | ||||
struct g_part_table *table; | struct g_part_table *table; | ||||
struct g_part_entry *entry; | struct g_part_entry *entry; | ||||
struct g_part_parms *gpp; | struct g_part_parms *gpp; | ||||
}; | }; | ||||
# add_alias() - Create aliases for the partition's provider with the given | |||||
# alias prefixes. | |||||
METHOD void add_alias { | |||||
struct g_part_table *table; | |||||
struct g_provider *pp; | |||||
struct g_part_entry *entry; | |||||
const char *pfx; | |||||
} DEFAULT default_add_alias; | |||||
# bootcode() - scheme specific processing for the bootcode verb. | # bootcode() - scheme specific processing for the bootcode verb. | ||||
METHOD int bootcode { | METHOD int bootcode { | ||||
struct g_part_table *table; | struct g_part_table *table; | ||||
struct g_part_parms *gpp; | struct g_part_parms *gpp; | ||||
}; | }; | ||||
# create() - scheme specific processing for the create verb. | # create() - scheme specific processing for the create verb. | ||||
METHOD int create { | METHOD int create { | ||||
Show All 40 Lines | |||||
} DEFAULT default_ioctl; | } DEFAULT default_ioctl; | ||||
# modify() - scheme specific processing for the modify verb. | # modify() - scheme specific processing for the modify verb. | ||||
METHOD int modify { | METHOD int modify { | ||||
struct g_part_table *table; | struct g_part_table *table; | ||||
struct g_part_entry *entry; | struct g_part_entry *entry; | ||||
struct g_part_parms *gpp; | struct g_part_parms *gpp; | ||||
}; | }; | ||||
# new_provider() - Create the partition's provider(s). | |||||
METHOD struct g_provider * new_provider { | |||||
struct g_part_table *table; | |||||
struct g_geom *gp; | |||||
struct g_part_entry *entry; | |||||
const char *pfx; | |||||
} DEFAULT default_new_provider; | |||||
# resize() - scheme specific processing for the resize verb. | # resize() - scheme specific processing for the resize verb. | ||||
METHOD int resize { | METHOD int resize { | ||||
struct g_part_table *table; | struct g_part_table *table; | ||||
struct g_part_entry *entry; | struct g_part_entry *entry; | ||||
struct g_part_parms *gpp; | struct g_part_parms *gpp; | ||||
} DEFAULT default_resize; | } DEFAULT default_resize; | ||||
▲ Show 20 Lines • Show All 62 Lines • Show Last 20 Lines |
It's unfortunate these two functions are so close to each other, yet unsharable.