* Re: [9fans] device names in venti conf
@ 2013-09-13 11:57 yaroslav
2014-04-04 9:28 ` Yaroslav
0 siblings, 1 reply; 3+ messages in thread
From: yaroslav @ 2013-09-13 11:57 UTC (permalink / raw)
To: 9fans
[-- Attachment #1: Type: text/plain, Size: 358 bytes --]
> Can we avoid explicit device names in venti conf? Changes in device
> names on new hardware cause unnecessary delays during FS recovery.
One of available options is to modify venti so it prepends the
non-rooted partitions with the same prefix as the config file has.
/dev/sdC0/arenas may then have a config wired in with entries
like"isect isect".
[-- Attachment #2: config.c.diff --]
[-- Type: text/plain, Size: 2768 bytes --]
/n/sources/plan9/sys/src/cmd/venti/srv/config.c:44,49 - /sys/src/cmd/venti/srv/config.c:44,55
return 0;
}
+ static int
+ isrooted(char* s)
+ {
+ return *s == '/' || *s == '#';
+ }
+
/*
* configs :
* | configs config
/n/sources/plan9/sys/src/cmd/venti/srv/config.c:69,75 - /sys/src/cmd/venti/srv/config.c:75,81
ArenaPart **av;
ISect **sv;
IFile f;
- char *s, *line, *flds[MaxArgs + 1];
+ char *s, *p, *q, *line, *flds[MaxArgs + 1];
int i, ok;
if(readifile(&f, file) < 0)
/n/sources/plan9/sys/src/cmd/venti/srv/config.c:78,83 - /sys/src/cmd/venti/srv/config.c:84,98
config->mem = Unspecified;
ok = -1;
line = nil;
+
+ /* conf basename as default prefix for partitions */
+ p = estrdup(file);
+ s = strrchr(p, '/');
+ if(s)
+ *s = 0;
+ else
+ *p = 0;
+
for(;;){
s = ifileline(&f);
if(s == nil){
/n/sources/plan9/sys/src/cmd/venti/srv/config.c:92,98 - /sys/src/cmd/venti/srv/config.c:107,118
sv[i] = config->sects[i];
free(config->sects);
config->sects = sv;
- config->sects[config->nsects] = configisect(flds[1]);
+ if(!isrooted(flds[1])){
+ q = smprint("%s/%s", p, flds[1]);
+ config->sects[config->nsects] = configisect(q);
+ free(q);
+ }else
+ config->sects[config->nsects] = configisect(flds[1]);
if(config->sects[config->nsects] == nil)
break;
config->nsects++;
/n/sources/plan9/sys/src/cmd/venti/srv/config.c:102,108 - /sys/src/cmd/venti/srv/config.c:122,133
av[i] = config->aparts[i];
free(config->aparts);
config->aparts = av;
- config->aparts[config->naparts] = configarenas(flds[1]);
+ if(!isrooted(flds[1])){
+ q = smprint("%s/%s", p, flds[1]);
+ config->aparts[config->naparts] = configarenas(q);
+ free(q);
+ }else
+ config->aparts[config->naparts] = configarenas(flds[1]);
if(config->aparts[config->naparts] == nil)
break;
config->naparts++;
/n/sources/plan9/sys/src/cmd/venti/srv/config.c:111,117 - /sys/src/cmd/venti/srv/config.c:136,148
seterr(EAdmin, "duplicate bloom lines in configuration file %s", file);
break;
}
- if((config->bloom = configbloom(flds[1])) == nil)
+ if(!isrooted(flds[1])){
+ q = smprint("%s/%s", p, flds[1]);
+ config->bloom = configbloom(q);
+ free(q);
+ }else
+ config->bloom = configbloom(flds[1]);
+ if(config->bloom == nil)
break;
}else if(i == 2 && strcmp(flds[0], "index") == 0){
if(nameok(flds[1]) < 0){
/n/sources/plan9/sys/src/cmd/venti/srv/config.c:183,188 - /sys/src/cmd/venti/srv/config.c:214,220
free(line);
line = nil;
}
+ free(p);
free(line);
freeifile(&f);
if(ok < 0){
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [9fans] device names in venti conf
2013-09-13 11:57 [9fans] device names in venti conf yaroslav
@ 2014-04-04 9:28 ` Yaroslav
0 siblings, 0 replies; 3+ messages in thread
From: Yaroslav @ 2014-04-04 9:28 UTC (permalink / raw)
To: 9fans
the proposal submitted: /n/sources/patch/venti-cfgrelpath
2013-09-13 14:57 GMT+03:00 yaroslav <yarikos@gmail.com>:
>> Can we avoid explicit device names in venti conf? Changes in device
>> names on new hardware cause unnecessary delays during FS recovery.
>
> One of available options is to modify venti so it prepends the
> non-rooted partitions with the same prefix as the config file has.
> /dev/sdC0/arenas may then have a config wired in with entries
> like"isect isect".
--
- Yaroslav
^ permalink raw reply [flat|nested] 3+ messages in thread
* [9fans] device names in venti conf
@ 2013-09-12 7:39 Yaroslav
0 siblings, 0 replies; 3+ messages in thread
From: Yaroslav @ 2013-09-12 7:39 UTC (permalink / raw)
To: 9fans
Can we avoid explicit device names in venti conf? Changes in device
names on new hardware cause unnecessary delays during FS recovery.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-04-04 9:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-13 11:57 [9fans] device names in venti conf yaroslav
2014-04-04 9:28 ` Yaroslav
-- strict thread matches above, loose matches on Subject: below --
2013-09-12 7:39 Yaroslav
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).