[Sheepdog] [PATCH v4 01/12] sheep: hide some minor store layout aware operations
Christoph Hellwig
hch at infradead.org
Wed Dec 28 14:11:37 CET 2011
>
> +static void get_store_dir(struct strbuf *buf, int epoch)
> +{
> + if (!strcmp(store.driver_name, "simple"))
> + strbuf_addf(buf, "%s%08u", obj_path, epoch);
> + else if (!strcmp(store.driver_name, "farm"))
> + strbuf_addf(buf, "%s", obj_path);
> +}
Wouldn't it be better to have a get_store_dir in struct store_driver
instead of hardcoding the store names here?
> int update_epoch_store(uint32_t epoch)
> {
> - char new[1024];
> -
> - snprintf(new, sizeof(new), "%s%08u/", obj_path, epoch);
> - mkdir(new, def_dmode);
> + if (!strcmp(store.driver_name, "simple")) {
> + char new[1024];
>
> + snprintf(new, sizeof(new), "%s%08u/", obj_path, epoch);
> + mkdir(new, def_dmode);
> + }
Same here.
More information about the sheepdog
mailing list