Lines Matching refs:h

60 #define	GETCDSECTOR(h, buf, secno, nosec) (getdisk(h, buf, \  argument
61 ((secno)+(h)->cdroff)*ISO_SECTOR_SIZE, \
66 static int ckvoldesc(fstyp_hsfs_t *h, int *cd_type);
67 static int findhsvol(fstyp_hsfs_t *h, char *volp);
68 static int findisovol(fstyp_hsfs_t *h, char *volp);
69 static int findunixvol(fstyp_hsfs_t *h, char *volp);
72 static int getdisk(fstyp_hsfs_t *h, char *buf, int daddr, int size);
74 static int is_hsfs(fstyp_hsfs_t *h);
75 static int get_attr(fstyp_hsfs_t *h);
87 fstyp_hsfs_t *h = (fstyp_hsfs_t *)handle; in fstyp_mod_init() local
93 if ((h = calloc(1, sizeof (fstyp_hsfs_t))) == NULL) { in fstyp_mod_init()
96 h->fd = fd; in fstyp_mod_init()
98 *handle = (fstyp_mod_handle_t)h; in fstyp_mod_init()
105 fstyp_hsfs_t *h = (fstyp_hsfs_t *)handle; in fstyp_mod_fini() local
107 if (h->attr == NULL) { in fstyp_mod_fini()
108 nvlist_free(h->attr); in fstyp_mod_fini()
109 h->attr = NULL; in fstyp_mod_fini()
111 free(h); in fstyp_mod_fini()
117 fstyp_hsfs_t *h = (fstyp_hsfs_t *)handle; in fstyp_mod_ident() local
119 return (is_hsfs(h)); in fstyp_mod_ident()
125 fstyp_hsfs_t *h = (fstyp_hsfs_t *)handle; in fstyp_mod_get_attr() local
128 if (h->attr == NULL) { in fstyp_mod_get_attr()
129 if (nvlist_alloc(&h->attr, NV_UNIQUE_NAME_TYPE, 0)) { in fstyp_mod_get_attr()
132 if ((error = get_attr(h)) != 0) { in fstyp_mod_get_attr()
133 nvlist_free(h->attr); in fstyp_mod_get_attr()
134 h->attr = NULL; in fstyp_mod_get_attr()
139 *attrp = h->attr; in fstyp_mod_get_attr()
225 findhsvol(fstyp_hsfs_t *h, char *volp) in findhsvol() argument
232 if ((err = GETCDSECTOR(h, volp, secno++, 1)) != 0) { in findhsvol()
243 h->hs_pvd_sec_no = secno-1; in findhsvol()
248 if ((err = GETCDSECTOR(h, volp, secno++, 1)) != 0) { in findhsvol()
263 findisovol(fstyp_hsfs_t *h, char *volp) in findisovol() argument
270 if ((err = GETCDSECTOR(h, volp, secno++, 1)) != 0) { in findisovol()
281 h->iso_pvd_sec_no = secno-1; in findisovol()
286 if ((err = GETCDSECTOR(h, volp, secno++, 1)) != 0) { in findisovol()
301 findunixvol(fstyp_hsfs_t *h, char *volp) in findunixvol() argument
308 if ((err = GETCDSECTOR(h, volp, secno++, 1)) != 0) { in findunixvol()
319 h->unix_pvd_sec_no = secno-1; in findunixvol()
324 if ((err = GETCDSECTOR(h, volp, secno++, 1)) != 0) { in findunixvol()
333 ckvoldesc(fstyp_hsfs_t *h, int *cd_type) in ckvoldesc() argument
337 if ((err = findhsvol(h, h->hs_buf)) == 0) { in ckvoldesc()
339 } else if ((err = findisovol(h, h->iso_buf)) == 0) { in ckvoldesc()
340 if (findunixvol(h, h->unix_buf) == 0) { in ckvoldesc()
353 is_hsfs(fstyp_hsfs_t *h) in is_hsfs() argument
358 if (rdev_is_a_cd(h->fd)) { in is_hsfs()
359 err = ioctl(h->fd, CDROMREADOFFSET, &h->cdroff); in is_hsfs()
365 h->cdroff = 0; in is_hsfs()
369 return (ckvoldesc(h, &h->cd_type)); in is_hsfs()
372 #define ADD_STRING(h, name, value) \ argument
373 if (nvlist_add_string(h->attr, name, value) != 0) { \
377 #define ADD_UINT64(h, name, value) \ argument
378 if (nvlist_add_uint64(h->attr, name, value) != 0) { \
382 #define ADD_BOOL(h, name, value) \ argument
383 if (nvlist_add_boolean_value(h->attr, name, value) != 0) { \
388 get_attr(fstyp_hsfs_t *h) in get_attr() argument
405 switch (h->cd_type) { in get_attr()
407 ADD_STRING(h, "format", "High Sierra"); in get_attr()
408 ADD_STRING(h, "gen_version", "High Sierra"); in get_attr()
409 sysid = (char *)HSV_sys_id(h->hs_buf); in get_attr()
410 volid = (char *)HSV_vol_id(h->hs_buf); in get_attr()
411 volsetid = (char *)HSV_vol_set_id(h->hs_buf); in get_attr()
412 pubid = (char *)HSV_pub_id(h->hs_buf); in get_attr()
413 prepid = (char *)HSV_prep_id(h->hs_buf); in get_attr()
414 applid = (char *)HSV_appl_id(h->hs_buf); in get_attr()
415 copyfile = (char *)HSV_copyr_id(h->hs_buf); in get_attr()
416 absfile = (char *)HSV_abstr_id(h->hs_buf); in get_attr()
418 volsetsize = HSV_SET_SIZE(h->hs_buf); in get_attr()
419 volsetseq = HSV_SET_SEQ(h->hs_buf); in get_attr()
420 blksize = HSV_BLK_SIZE(h->hs_buf); in get_attr()
421 volsize = HSV_VOL_SIZE(h->hs_buf); in get_attr()
424 ADD_STRING(h, "format", "ISO 9660"); in get_attr()
425 ADD_STRING(h, "gen_version", "ISO 9660"); in get_attr()
426 sysid = (char *)ISO_sys_id(h->iso_buf); in get_attr()
427 volid = (char *)ISO_vol_id(h->iso_buf); in get_attr()
428 volsetid = (char *)ISO_vol_set_id(h->iso_buf); in get_attr()
429 pubid = (char *)ISO_pub_id(h->iso_buf); in get_attr()
430 prepid = (char *)ISO_prep_id(h->iso_buf); in get_attr()
431 applid = (char *)ISO_appl_id(h->iso_buf); in get_attr()
432 copyfile = (char *)ISO_copyr_id(h->iso_buf); in get_attr()
433 absfile = (char *)ISO_abstr_id(h->iso_buf); in get_attr()
434 bibfile = (char *)ISO_bibli_id(h->iso_buf); in get_attr()
435 volsetsize = ISO_SET_SIZE(h->iso_buf); in get_attr()
436 volsetseq = ISO_SET_SEQ(h->iso_buf); in get_attr()
437 blksize = ISO_BLK_SIZE(h->iso_buf); in get_attr()
438 volsize = ISO_VOL_SIZE(h->iso_buf); in get_attr()
441 ADD_STRING(h, "format", "ISO 9660 with UNIX extension"); in get_attr()
442 ADD_STRING(h, "gen_version", "ISO 9660 with UNIX extension"); in get_attr()
443 sysid = (char *)ISO_sys_id(h->unix_buf); in get_attr()
444 volid = (char *)ISO_vol_id(h->unix_buf); in get_attr()
445 volsetid = (char *)ISO_vol_set_id(h->unix_buf); in get_attr()
446 pubid = (char *)ISO_pub_id(h->unix_buf); in get_attr()
447 prepid = (char *)ISO_prep_id(h->unix_buf); in get_attr()
448 applid = (char *)ISO_appl_id(h->unix_buf); in get_attr()
449 copyfile = (char *)ISO_copyr_id(h->unix_buf); in get_attr()
450 absfile = (char *)ISO_abstr_id(h->unix_buf); in get_attr()
451 bibfile = (char *)ISO_bibli_id(h->unix_buf); in get_attr()
452 volsetsize = ISO_SET_SIZE(h->unix_buf); in get_attr()
453 volsetseq = ISO_SET_SEQ(h->unix_buf); in get_attr()
454 blksize = ISO_BLK_SIZE(h->unix_buf); in get_attr()
455 volsize = ISO_VOL_SIZE(h->unix_buf); in get_attr()
462 ADD_STRING(h, "system_id", s); in get_attr()
464 ADD_STRING(h, "volume_id", s); in get_attr()
465 ADD_STRING(h, "gen_volume_label", s); in get_attr()
467 ADD_STRING(h, "volume_set_id", s); in get_attr()
469 ADD_STRING(h, "publisher_id", s); in get_attr()
471 ADD_STRING(h, "data_preparer_id", s); in get_attr()
473 ADD_STRING(h, "application_id", s); in get_attr()
475 ADD_STRING(h, "copyright_file_id", s); in get_attr()
477 ADD_STRING(h, "abstract_file_id", s); in get_attr()
479 ADD_STRING(h, "bibliographic_file_id", s); in get_attr()
480 ADD_UINT64(h, "volume_set_size", volsetsize); in get_attr()
481 ADD_UINT64(h, "volume_set_sequence_number", volsetseq); in get_attr()
482 ADD_UINT64(h, "logical_block_size", blksize); in get_attr()
483 ADD_UINT64(h, "volume_size", volsize); in get_attr()
484 ADD_BOOL(h, "gen_clean", B_TRUE); in get_attr()
510 getdisk(fstyp_hsfs_t *h, char *buf, int daddr, int size) in getdisk() argument
512 if (lseek(h->fd, daddr, L_SET) == -1) { in getdisk()
515 if (read(h->fd, buf, size) != size) { in getdisk()