Lines Matching defs:res
80 provinfo(struct hast_resource *res, bool dowrite)
84 PJDLOG_ASSERT(res->hr_localpath != NULL &&
85 res->hr_localpath[0] != '\0');
87 if (res->hr_localfd == -1) {
88 res->hr_localfd = open(res->hr_localpath,
90 if (res->hr_localfd == -1) {
92 res->hr_localpath);
96 if (fstat(res->hr_localfd, &sb) == -1) {
97 pjdlog_errno(LOG_ERR, "Unable to stat %s", res->hr_localpath);
104 if (ioctl(res->hr_localfd, DIOCGMEDIASIZE,
105 &res->hr_local_mediasize) == -1) {
108 res->hr_localpath);
111 if (ioctl(res->hr_localfd, DIOCGSECTORSIZE,
112 &res->hr_local_sectorsize) == -1) {
115 res->hr_localpath);
123 res->hr_local_mediasize = sb.st_size;
124 res->hr_local_sectorsize = 512;
130 res->hr_localpath);
153 drop_privs(const struct hast_resource *res)
155 char jailhost[sizeof(res->hr_name) * 2];
185 if (res == NULL) {
189 res->hr_name, role2str(res->hr_role));
233 } else if (res != NULL) {
240 PJDLOG_ASSERT(res->hr_role == HAST_ROLE_PRIMARY ||
241 res->hr_role == HAST_ROLE_SECONDARY);
245 if (cap_rights_limit(res->hr_localfd, &rights) == -1) {
249 if (cap_ioctls_limit(res->hr_localfd, geomcmds,
255 if (res->hr_role == HAST_ROLE_PRIMARY) {
264 if (cap_rights_limit(res->hr_ggatefd, &rights) == -1) {
268 if (cap_ioctls_limit(res->hr_ggatefd, ggatecmds,