Lines Matching defs:res

91 create_one(struct hast_resource *res, intmax_t mediasize, intmax_t extentsize,
99 pjdlog_prefix_set("[%s] ", res->hr_name);
101 if (provinfo(res, true) == -1) {
106 mediasize = res->hr_local_mediasize;
107 else if (mediasize > res->hr_local_mediasize) {
109 res->hr_localpath);
113 if (!powerof2(res->hr_local_sectorsize)) {
115 res->hr_localpath, res->hr_local_sectorsize);
121 if (extentsize < res->hr_local_sectorsize) {
123 (intmax_t)extentsize, res->hr_local_sectorsize);
127 if ((extentsize % res->hr_local_sectorsize) != 0) {
129 (intmax_t)extentsize, res->hr_local_sectorsize);
134 extentsize, res->hr_local_sectorsize);
137 res->hr_datasize = mediasize - METADATA_SIZE - mapsize;
138 res->hr_extentsize = extentsize;
139 res->hr_keepdirty = keepdirty;
141 res->hr_localoff = METADATA_SIZE + mapsize;
143 if (metadata_write(res) == -1) {
154 if (pwrite(res->hr_localfd, buf, mapsize, METADATA_SIZE) !=
157 res->hr_localpath);
164 if (res->hr_localfd >= 0)
165 close(res->hr_localfd);
174 struct hast_resource *res;
182 TAILQ_FOREACH(res, &cfg->hc_resources, hr_next) {
183 if (strcmp(argv[ii], res->hr_name) == 0)
186 if (res == NULL) {
192 ret = create_one(res, mediasize, extentsize, keepdirty);
200 dump_one(struct hast_resource *res)
204 ret = metadata_read(res, false);
208 printf("resource: %s\n", res->hr_name);
209 printf(" datasize: %ju (%NB)\n", (uintmax_t)res->hr_datasize,
210 (intmax_t)res->hr_datasize);
211 printf(" extentsize: %d (%NB)\n", res->hr_extentsize,
212 (intmax_t)res->hr_extentsize);
213 printf(" keepdirty: %d\n", res->hr_keepdirty);
214 printf(" localoff: %ju\n", (uintmax_t)res->hr_localoff);
215 printf(" resuid: %ju\n", (uintmax_t)res->hr_resuid);
216 printf(" localcnt: %ju\n", (uintmax_t)res->hr_primary_localcnt);
217 printf(" remotecnt: %ju\n", (uintmax_t)res->hr_primary_remotecnt);
218 printf(" prevrole: %s\n", role2str(res->hr_previous_role));
226 struct hast_resource *res;
233 TAILQ_FOREACH(res, &cfg->hc_resources, hr_next) {
234 ret = dump_one(res);
242 TAILQ_FOREACH(res, &cfg->hc_resources, hr_next) {
243 if (strcmp(argv[ii], res->hr_name) == 0)
246 if (res == NULL) {
252 ret = dump_one(res);
263 const char *res, *oldrole;
270 res = nv_get_string(nv, "resource%u", ii);
271 if (res == NULL)
273 pjdlog_prefix_set("[%s] ", res);