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