Lines Matching defs:res
82 provinfo(struct hast_resource *res, bool dowrite)
86 PJDLOG_ASSERT(res->hr_localpath != NULL &&
87 res->hr_localpath[0] != '\0');
89 if (res->hr_localfd == -1) {
90 res->hr_localfd = open(res->hr_localpath,
92 if (res->hr_localfd == -1) {
94 res->hr_localpath);
98 if (fstat(res->hr_localfd, &sb) == -1) {
99 pjdlog_errno(LOG_ERR, "Unable to stat %s", res->hr_localpath);
106 if (ioctl(res->hr_localfd, DIOCGMEDIASIZE,
107 &res->hr_local_mediasize) == -1) {
110 res->hr_localpath);
113 if (ioctl(res->hr_localfd, DIOCGSECTORSIZE,
114 &res->hr_local_sectorsize) == -1) {
117 res->hr_localpath);
125 res->hr_local_mediasize = sb.st_size;
126 res->hr_local_sectorsize = 512;
132 res->hr_localpath);
155 drop_privs(const struct hast_resource *res)
157 char jailhost[sizeof(res->hr_name) * 2];
187 if (res == NULL) {
191 res->hr_name, role2str(res->hr_role));
235 } else if (res != NULL) {
242 PJDLOG_ASSERT(res->hr_role == HAST_ROLE_PRIMARY ||
243 res->hr_role == HAST_ROLE_SECONDARY);
247 if (cap_rights_limit(res->hr_localfd, &rights) == -1) {
251 if (cap_ioctls_limit(res->hr_localfd, geomcmds,
257 if (res->hr_role == HAST_ROLE_PRIMARY) {
266 if (cap_rights_limit(res->hr_ggatefd, &rights) == -1) {
270 if (cap_ioctls_limit(res->hr_ggatefd, ggatecmds,