Page MenuHomeFreeBSD

D24938.diff
No OneTemporary

D24938.diff

Index: head/sys/geom/part/g_part.c
===================================================================
--- head/sys/geom/part/g_part.c
+++ head/sys/geom/part/g_part.c
@@ -469,7 +469,6 @@
{
struct g_consumer *cp;
struct g_provider *pp;
- struct sbuf *sb;
struct g_geom_alias *gap;
off_t offset;
@@ -481,11 +480,7 @@
entry->gpe_offset = offset;
if (entry->gpe_pp == NULL) {
- sb = sbuf_new_auto();
- G_PART_FULLNAME(table, entry, sb, gp->name);
- sbuf_finish(sb);
- entry->gpe_pp = g_new_providerf(gp, "%s", sbuf_data(sb));
- sbuf_delete(sb);
+ entry->gpe_pp = G_PART_NEW_PROVIDER(table, gp, entry, gp->name);
/*
* If our parent provider had any aliases, then copy them to our
* provider so when geom DEV tastes things later, they will be
@@ -493,13 +488,8 @@
* place of the geom's name we use to create the provider. The
* kobj interface that generates names makes this awkward.
*/
- LIST_FOREACH(gap, &pp->aliases, ga_next) {
- sb = sbuf_new_auto();
- G_PART_FULLNAME(table, entry, sb, gap->ga_alias);
- sbuf_finish(sb);
- g_provider_add_alias(entry->gpe_pp, "%s", sbuf_data(sb));
- sbuf_delete(sb);
- }
+ LIST_FOREACH(gap, &pp->aliases, ga_next)
+ G_PART_ADD_ALIAS(table, entry->gpe_pp, entry, gap->ga_alias);
entry->gpe_pp->flags |= G_PF_DIRECT_SEND | G_PF_DIRECT_RECEIVE;
entry->gpe_pp->private = entry; /* Close the circle. */
}
Index: head/sys/geom/part/g_part_if.m
===================================================================
--- head/sys/geom/part/g_part_if.m
+++ head/sys/geom/part/g_part_if.m
@@ -52,6 +52,34 @@
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);
+ }
+
static int
default_precheck(struct g_part_table *t __unused,
enum g_part_ctl r __unused, struct g_part_parms *p __unused)
@@ -88,6 +116,15 @@
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.
METHOD int bootcode {
struct g_part_table *table;
@@ -144,6 +181,14 @@
struct g_part_entry *entry;
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.
METHOD int resize {

File Metadata

Mime Type
text/plain
Expires
Thu, Feb 13, 8:50 AM (21 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16625344
Default Alt Text
D24938.diff (3 KB)

Event Timeline