1*2912Sartem /*************************************************************************** 2*2912Sartem * 3*2912Sartem * cdutils.h : definitions for CD/DVD utilities 4*2912Sartem * 5*2912Sartem * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 6*2912Sartem * Use is subject to license terms. 7*2912Sartem * 8*2912Sartem * Licensed under the Academic Free License version 2.1 9*2912Sartem * 10*2912Sartem **************************************************************************/ 11*2912Sartem 12*2912Sartem #pragma ident "%Z%%M% %I% %E% SMI" 13*2912Sartem 14*2912Sartem #ifndef CDUTILS_H 15*2912Sartem #define CDUTILS_H 16*2912Sartem 17*2912Sartem #include <sys/types.h> 18*2912Sartem #include <sys/dkio.h> 19*2912Sartem #include <sys/cdio.h> 20*2912Sartem #include <sys/scsi/impl/uscsi.h> 21*2912Sartem 22*2912Sartem enum { 23*2912Sartem CDUTIL_WALK_CONTINUE, 24*2912Sartem CDUTIL_WALK_STOP 25*2912Sartem }; 26*2912Sartem 27*2912Sartem typedef struct intlist { 28*2912Sartem int val; 29*2912Sartem struct intlist *next; 30*2912Sartem } intlist_t; 31*2912Sartem 32*2912Sartem typedef struct disc_info { 33*2912Sartem int disc_status; 34*2912Sartem int erasable; 35*2912Sartem uint_t capacity; 36*2912Sartem } disc_info_t; 37*2912Sartem 38*2912Sartem #define min(a, b) ((a) < (b) ? (a) : (b)) 39*2912Sartem #define max(a, b) ((a) > (b) ? (a) : (b)) 40*2912Sartem 41*2912Sartem void uscsi_cmd_init(struct uscsi_cmd *scmd, char *cdb, int cdblen); 42*2912Sartem int uscsi(int fd, struct uscsi_cmd *scmd); 43*2912Sartem int mode_sense(int fd, uchar_t pc, int dbd, int page_len, 44*2912Sartem uchar_t *buffer); 45*2912Sartem int get_mode_page(int fd, int page_no, int pc, int buf_len, 46*2912Sartem uchar_t *buffer, int *plen); 47*2912Sartem int get_configuration(int fd, uint16_t feature, int bufsize, 48*2912Sartem uchar_t *buf); 49*2912Sartem boolean_t get_current_profile(int fd, int *profile); 50*2912Sartem void walk_profiles(int fd, int (*f)(void *, int, boolean_t), void *); 51*2912Sartem void get_read_write_speeds(int fd, int *read_speed, int *write_speed, 52*2912Sartem intlist_t **wspeeds, int *n_wspeeds, intlist_t **wspeeds_mem); 53*2912Sartem boolean_t get_disc_info(int fd, disc_info_t *); 54*2912Sartem boolean_t read_format_capacity(int fd, uint64_t *capacity); 55*2912Sartem boolean_t get_media_info(int fd, struct dk_minfo *minfop); 56*2912Sartem boolean_t get_disc_capacity_for_profile(int fd, int profile, 57*2912Sartem uint64_t *capacity); 58*2912Sartem boolean_t read_toc(int fd, int format, int trackno, int buflen, 59*2912Sartem uchar_t *buf); 60*2912Sartem 61*2912Sartem #endif /* CDUTILS_H */ 62