src/cdrom/bsdi/SDL_syscdrom.c
branchSDL-1.3
changeset 1668 4da1ee79c9af
parent 1662 782fd950bd46
     1.1 --- a/src/cdrom/bsdi/SDL_syscdrom.c	Mon May 29 03:53:21 2006 +0000
     1.2 +++ b/src/cdrom/bsdi/SDL_syscdrom.c	Mon May 29 04:04:35 2006 +0000
     1.3 @@ -52,13 +52,13 @@
     1.4  #define	FRAMES_PER_MINUTE	(FRAMES_PER_SECOND * 60)
     1.5  
     1.6  int
     1.7 -msf_to_frame (int minute, int second, int frame)
     1.8 +msf_to_frame(int minute, int second, int frame)
     1.9  {
    1.10      return (minute * FRAMES_PER_MINUTE + second * FRAMES_PER_SECOND + frame);
    1.11  }
    1.12  
    1.13  void
    1.14 -frame_to_msf (int frame, int *minp, int *secp, int *framep)
    1.15 +frame_to_msf(int frame, int *minp, int *secp, int *framep)
    1.16  {
    1.17      *minp = frame / FRAMES_PER_MINUTE;
    1.18      *secp = (frame % FRAMES_PER_MINUTE) / FRAMES_PER_SECOND;
    1.19 @@ -73,24 +73,24 @@
    1.20  static dev_t SDL_cdmode[MAX_DRIVES];
    1.21  
    1.22  /* The system-dependent CD control functions */
    1.23 -static const char *SDL_SYS_CDName (int drive);
    1.24 -static int SDL_SYS_CDOpen (int drive);
    1.25 -static int SDL_SYS_CDGetTOC (SDL_CD * cdrom);
    1.26 -static CDstatus SDL_SYS_CDStatus (SDL_CD * cdrom, int *position);
    1.27 -static int SDL_SYS_CDPlay (SDL_CD * cdrom, int start, int length);
    1.28 -static int SDL_SYS_CDPause (SDL_CD * cdrom);
    1.29 -static int SDL_SYS_CDResume (SDL_CD * cdrom);
    1.30 -static int SDL_SYS_CDStop (SDL_CD * cdrom);
    1.31 -static int SDL_SYS_CDEject (SDL_CD * cdrom);
    1.32 -static void SDL_SYS_CDClose (SDL_CD * cdrom);
    1.33 +static const char *SDL_SYS_CDName(int drive);
    1.34 +static int SDL_SYS_CDOpen(int drive);
    1.35 +static int SDL_SYS_CDGetTOC(SDL_CD * cdrom);
    1.36 +static CDstatus SDL_SYS_CDStatus(SDL_CD * cdrom, int *position);
    1.37 +static int SDL_SYS_CDPlay(SDL_CD * cdrom, int start, int length);
    1.38 +static int SDL_SYS_CDPause(SDL_CD * cdrom);
    1.39 +static int SDL_SYS_CDResume(SDL_CD * cdrom);
    1.40 +static int SDL_SYS_CDStop(SDL_CD * cdrom);
    1.41 +static int SDL_SYS_CDEject(SDL_CD * cdrom);
    1.42 +static void SDL_SYS_CDClose(SDL_CD * cdrom);
    1.43  
    1.44  typedef struct scsi_cdb cdb_t;
    1.45  
    1.46  static int
    1.47 -scsi_cmd (int fd,
    1.48 -          struct scsi_cdb *cdb,
    1.49 -          int cdblen,
    1.50 -          int rw, caddr_t data, int datalen, struct scsi_user_cdb *sus)
    1.51 +scsi_cmd(int fd,
    1.52 +         struct scsi_cdb *cdb,
    1.53 +         int cdblen,
    1.54 +         int rw, caddr_t data, int datalen, struct scsi_user_cdb *sus)
    1.55  {
    1.56      int scsistatus;
    1.57      unsigned char *cp;
    1.58 @@ -104,11 +104,11 @@
    1.59  
    1.60      suc.suc_flags = rw;
    1.61      suc.suc_cdblen = cdblen;
    1.62 -    bcopy (cdb, suc.suc_cdb, cdblen);
    1.63 +    bcopy(cdb, suc.suc_cdb, cdblen);
    1.64      suc.suc_datalen = datalen;
    1.65      suc.suc_data = data;
    1.66      suc.suc_timeout = 10;       /* 10 secs max for TUR or SENSE */
    1.67 -    if (ioctl (fd, SCSIRAWCDB, &suc) == -1)
    1.68 +    if (ioctl(fd, SCSIRAWCDB, &suc) == -1)
    1.69          return (-11);
    1.70      scsistatus = suc.suc_sus.sus_status;
    1.71      cp = suc.suc_sus.sus_sense;
    1.72 @@ -119,16 +119,15 @@
    1.73   * out if the status was not successful.
    1.74  */
    1.75      if (scsistatus != 0 && !sus) {
    1.76 -        fprintf (stderr, "scsistatus = %x cmd = %x\n", scsistatus, cdb[0]);
    1.77 -        fprintf (stderr,
    1.78 -                 "sense %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x\n",
    1.79 -                 cp[0], cp[1], cp[2], cp[3], cp[4], cp[5], cp[6], cp[7],
    1.80 -                 cp[8], cp[9], cp[10], cp[11], cp[12], cp[13], cp[14],
    1.81 -                 cp[15]);
    1.82 +        fprintf(stderr, "scsistatus = %x cmd = %x\n", scsistatus, cdb[0]);
    1.83 +        fprintf(stderr,
    1.84 +                "sense %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x\n",
    1.85 +                cp[0], cp[1], cp[2], cp[3], cp[4], cp[5], cp[6], cp[7],
    1.86 +                cp[8], cp[9], cp[10], cp[11], cp[12], cp[13], cp[14], cp[15]);
    1.87          return (1);
    1.88      }
    1.89      if (sus)
    1.90 -        bcopy (&suc, sus, sizeof (struct scsi_user_cdb));
    1.91 +        bcopy(&suc, sus, sizeof(struct scsi_user_cdb));
    1.92      if (scsistatus)
    1.93          return (1);             /* Return non-zero for unsuccessful status */
    1.94      return (0);
    1.95 @@ -136,7 +135,7 @@
    1.96  
    1.97  /* request vendor brand and model */
    1.98  unsigned char *
    1.99 -Inquiry (int fd)
   1.100 +Inquiry(int fd)
   1.101  {
   1.102      static struct scsi_cdb6 cdb = {
   1.103          0x12,
   1.104 @@ -146,8 +145,8 @@
   1.105      };
   1.106      static unsigned char Inqbuffer[56];
   1.107  
   1.108 -    if (scsi_cmd (fd, (cdb_t *) & cdb, 6, SUC_READ, Inqbuffer,
   1.109 -                  sizeof (Inqbuffer), 0))
   1.110 +    if (scsi_cmd(fd, (cdb_t *) & cdb, 6, SUC_READ, Inqbuffer,
   1.111 +                 sizeof(Inqbuffer), 0))
   1.112          return ("\377");
   1.113      return (Inqbuffer);
   1.114  }
   1.115 @@ -156,7 +155,7 @@
   1.116  #define ADD_SC_QUALIFIER 13
   1.117  
   1.118  int
   1.119 -TestForMedium (int fd)
   1.120 +TestForMedium(int fd)
   1.121  {
   1.122      int sts, asc, ascq;
   1.123      struct scsi_user_cdb sus;
   1.124 @@ -169,7 +168,7 @@
   1.125          0                       /* reserved */
   1.126      };
   1.127  
   1.128 -  again:sts = scsi_cmd (fd, (cdb_t *) & cdb, 6, SUC_READ, 0, 0, &sus);
   1.129 +  again:sts = scsi_cmd(fd, (cdb_t *) & cdb, 6, SUC_READ, 0, 0, &sus);
   1.130      asc = sus.suc_sus.sus_sense[ADD_SENSECODE];
   1.131      ascq = sus.suc_sus.sus_sense[ADD_SC_QUALIFIER];
   1.132      if (asc == 0x3a && ascq == 0x0)     /* no medium */
   1.133 @@ -177,7 +176,7 @@
   1.134      if (asc == 0x28 && ascq == 0x0)     /* medium changed */
   1.135          goto again;
   1.136      if (asc == 0x4 && ascq == 0x1) {    /* coming ready */
   1.137 -        sleep (2);
   1.138 +        sleep(2);
   1.139          goto again;
   1.140      }
   1.141      return (1);
   1.142 @@ -185,30 +184,30 @@
   1.143  
   1.144  /* Check a drive to see if it is a CD-ROM */
   1.145  static int
   1.146 -CheckDrive (char *drive, struct stat *stbuf)
   1.147 +CheckDrive(char *drive, struct stat *stbuf)
   1.148  {
   1.149      int is_cd = 0, cdfd;
   1.150      char *p;
   1.151  
   1.152      /* If it doesn't exist, return -1 */
   1.153 -    if (stat (drive, stbuf) < 0) {
   1.154 +    if (stat(drive, stbuf) < 0) {
   1.155          return (-1);
   1.156      }
   1.157  
   1.158      /* If it does exist, verify that it's an available CD-ROM */
   1.159 -    cdfd = open (drive, (O_RDONLY | O_EXCL | O_NONBLOCK), 0);
   1.160 +    cdfd = open(drive, (O_RDONLY | O_EXCL | O_NONBLOCK), 0);
   1.161      if (cdfd >= 0) {
   1.162 -        p = Inquiry (cdfd);
   1.163 +        p = Inquiry(cdfd);
   1.164          if (*p == TYPE_ROM)
   1.165              is_cd = 1;
   1.166 -        close (cdfd);
   1.167 +        close(cdfd);
   1.168      }
   1.169      return (is_cd);
   1.170  }
   1.171  
   1.172  /* Add a CD-ROM drive to our list of valid drives */
   1.173  static void
   1.174 -AddDrive (char *drive, struct stat *stbuf)
   1.175 +AddDrive(char *drive, struct stat *stbuf)
   1.176  {
   1.177      int i;
   1.178  
   1.179 @@ -219,8 +218,8 @@
   1.180          for (i = 0; i < SDL_numcds; ++i) {
   1.181              if (stbuf->st_rdev == SDL_cdmode[i]) {
   1.182  #ifdef DEBUG_CDROM
   1.183 -                fprintf (stderr, "Duplicate drive detected: %s == %s\n",
   1.184 -                         drive, SDL_cdlist[i]);
   1.185 +                fprintf(stderr, "Duplicate drive detected: %s == %s\n",
   1.186 +                        drive, SDL_cdlist[i]);
   1.187  #endif
   1.188                  return;
   1.189              }
   1.190 @@ -228,21 +227,21 @@
   1.191  
   1.192          /* Add this drive to our list */
   1.193          i = SDL_numcds;
   1.194 -        SDL_cdlist[i] = SDL_strdup (drive);
   1.195 +        SDL_cdlist[i] = SDL_strdup(drive);
   1.196          if (SDL_cdlist[i] == NULL) {
   1.197 -            SDL_OutOfMemory ();
   1.198 +            SDL_OutOfMemory();
   1.199              return;
   1.200          }
   1.201          SDL_cdmode[i] = stbuf->st_rdev;
   1.202          ++SDL_numcds;
   1.203  #ifdef DEBUG_CDROM
   1.204 -        fprintf (stderr, "Added CD-ROM drive: %s\n", drive);
   1.205 +        fprintf(stderr, "Added CD-ROM drive: %s\n", drive);
   1.206  #endif
   1.207      }
   1.208  }
   1.209  
   1.210  int
   1.211 -SDL_SYS_CDInit (void)
   1.212 +SDL_SYS_CDInit(void)
   1.213  {
   1.214      /* checklist: /dev/rsr?c */
   1.215      static char *checklist[] = {
   1.216 @@ -266,21 +265,21 @@
   1.217      SDL_CDcaps.Close = SDL_SYS_CDClose;
   1.218  
   1.219      /* Look in the environment for our CD-ROM drive list */
   1.220 -    SDLcdrom = SDL_getenv ("SDL_CDROM");        /* ':' separated list of devices */
   1.221 +    SDLcdrom = SDL_getenv("SDL_CDROM"); /* ':' separated list of devices */
   1.222      if (SDLcdrom != NULL) {
   1.223          char *cdpath, *delim;
   1.224 -        size_t len = SDL_strlen (SDLcdrom) + 1;
   1.225 -        cdpath = SDL_stack_alloc (char, len);
   1.226 +        size_t len = SDL_strlen(SDLcdrom) + 1;
   1.227 +        cdpath = SDL_stack_alloc(char, len);
   1.228          if (cdpath != NULL) {
   1.229 -            SDL_strlcpy (cdpath, SDLcdrom, len);
   1.230 +            SDL_strlcpy(cdpath, SDLcdrom, len);
   1.231              SDLcdrom = cdpath;
   1.232              do {
   1.233 -                delim = SDL_strchr (SDLcdrom, ':');
   1.234 +                delim = SDL_strchr(SDLcdrom, ':');
   1.235                  if (delim) {
   1.236                      *delim++ = '\0';
   1.237                  }
   1.238 -                if (CheckDrive (SDLcdrom, &stbuf) > 0) {
   1.239 -                    AddDrive (SDLcdrom, &stbuf);
   1.240 +                if (CheckDrive(SDLcdrom, &stbuf) > 0) {
   1.241 +                    AddDrive(SDLcdrom, &stbuf);
   1.242                  }
   1.243                  if (delim) {
   1.244                      SDLcdrom = delim;
   1.245 @@ -289,7 +288,7 @@
   1.246                  }
   1.247              }
   1.248              while (SDLcdrom);
   1.249 -            SDL_stack_free (cdpath);
   1.250 +            SDL_stack_free(cdpath);
   1.251          }
   1.252  
   1.253          /* If we found our drives, there's nothing left to do */
   1.254 @@ -304,16 +303,16 @@
   1.255              char *insert;
   1.256              exists = 1;
   1.257              for (j = checklist[i][1]; exists; ++j) {
   1.258 -                SDL_snprintf (drive, SDL_arraysize (drive), "/dev/%sc",
   1.259 -                              &checklist[i][3]);
   1.260 -                insert = SDL_strchr (drive, '?');
   1.261 +                SDL_snprintf(drive, SDL_arraysize(drive), "/dev/%sc",
   1.262 +                             &checklist[i][3]);
   1.263 +                insert = SDL_strchr(drive, '?');
   1.264                  if (insert != NULL) {
   1.265                      *insert = j;
   1.266                  }
   1.267 -                switch (CheckDrive (drive, &stbuf)) {
   1.268 +                switch (CheckDrive(drive, &stbuf)) {
   1.269                      /* Drive exists and is a CD-ROM */
   1.270                  case 1:
   1.271 -                    AddDrive (drive, &stbuf);
   1.272 +                    AddDrive(drive, &stbuf);
   1.273                      break;
   1.274                      /* Drive exists, but isn't a CD-ROM */
   1.275                  case 0:
   1.276 @@ -325,10 +324,10 @@
   1.277                  }
   1.278              }
   1.279          } else {
   1.280 -            SDL_snprintf (drive, SDL_arraysize (drive), "/dev/%s",
   1.281 -                          checklist[i]);
   1.282 -            if (CheckDrive (drive, &stbuf) > 0) {
   1.283 -                AddDrive (drive, &stbuf);
   1.284 +            SDL_snprintf(drive, SDL_arraysize(drive), "/dev/%s",
   1.285 +                         checklist[i]);
   1.286 +            if (CheckDrive(drive, &stbuf) > 0) {
   1.287 +                AddDrive(drive, &stbuf);
   1.288              }
   1.289          }
   1.290      }
   1.291 @@ -336,29 +335,29 @@
   1.292  }
   1.293  
   1.294  static const char *
   1.295 -SDL_SYS_CDName (int drive)
   1.296 +SDL_SYS_CDName(int drive)
   1.297  {
   1.298      return (SDL_cdlist[drive]);
   1.299  }
   1.300  
   1.301  static int
   1.302 -SDL_SYS_CDOpen (int drive)
   1.303 +SDL_SYS_CDOpen(int drive)
   1.304  {
   1.305 -    return (open (SDL_cdlist[drive], O_RDONLY | O_NONBLOCK | O_EXCL, 0));
   1.306 +    return (open(SDL_cdlist[drive], O_RDONLY | O_NONBLOCK | O_EXCL, 0));
   1.307  }
   1.308  
   1.309  static int
   1.310 -SDL_SYS_CDGetTOC (SDL_CD * cdrom)
   1.311 +SDL_SYS_CDGetTOC(SDL_CD * cdrom)
   1.312  {
   1.313      u_char cdb[10], buf[4], *p, *toc;
   1.314      struct scsi_user_cdb sus;
   1.315      int i, sts, first_track, last_track, ntracks, toc_size;
   1.316  
   1.317 -    bzero (cdb, sizeof (cdb));
   1.318 +    bzero(cdb, sizeof(cdb));
   1.319      cdb[0] = 0x43;              /* Read TOC */
   1.320      cdb[1] = 0x2;               /* MSF */
   1.321      cdb[8] = 4;                 /* size TOC header */
   1.322 -    sts = scsi_cmd (cdrom->id, (cdb_t *) cdb, 10, SUC_READ, buf, 4, &sus);
   1.323 +    sts = scsi_cmd(cdrom->id, (cdb_t *) cdb, 10, SUC_READ, buf, 4, &sus);
   1.324      if (sts < 0)
   1.325          return (-1);
   1.326      first_track = buf[2];
   1.327 @@ -366,19 +365,19 @@
   1.328      ntracks = last_track - first_track + 1;
   1.329      cdrom->numtracks = ntracks;
   1.330      toc_size = 4 + (ntracks + 1) * 8;
   1.331 -    toc = (u_char *) SDL_malloc (toc_size);
   1.332 +    toc = (u_char *) SDL_malloc(toc_size);
   1.333      if (toc == NULL)
   1.334          return (-1);
   1.335 -    bzero (cdb, sizeof (cdb));
   1.336 +    bzero(cdb, sizeof(cdb));
   1.337      cdb[0] = 0x43;
   1.338      cdb[1] = 0x2;
   1.339      cdb[6] = first_track;
   1.340      cdb[7] = toc_size >> 8;
   1.341      cdb[8] = toc_size & 0xff;
   1.342 -    sts = scsi_cmd (cdrom->id, (cdb_t *) cdb, 10, SUC_READ, toc, toc_size,
   1.343 -                    &sus);
   1.344 +    sts = scsi_cmd(cdrom->id, (cdb_t *) cdb, 10, SUC_READ, toc, toc_size,
   1.345 +                   &sus);
   1.346      if (sts < 0) {
   1.347 -        SDL_free (toc);
   1.348 +        SDL_free(toc);
   1.349          return (-1);
   1.350      }
   1.351  
   1.352 @@ -391,38 +390,38 @@
   1.353              cdrom->track[i].type = SDL_DATA_TRACK;
   1.354          else
   1.355              cdrom->track[i].type = SDL_AUDIO_TRACK;
   1.356 -        cdrom->track[i].offset = msf_to_frame (p[5], p[6], p[7]);
   1.357 +        cdrom->track[i].offset = msf_to_frame(p[5], p[6], p[7]);
   1.358          cdrom->track[i].length = 0;
   1.359          if (i > 0)
   1.360              cdrom->track[i - 1].length = cdrom->track[i].offset -
   1.361                  cdrom->track[i - 1].offset;
   1.362      }
   1.363 -    SDL_free (toc);
   1.364 +    SDL_free(toc);
   1.365      return (0);
   1.366  }
   1.367  
   1.368  /* Get CD-ROM status */
   1.369  static CDstatus
   1.370 -SDL_SYS_CDStatus (SDL_CD * cdrom, int *position)
   1.371 +SDL_SYS_CDStatus(SDL_CD * cdrom, int *position)
   1.372  {
   1.373      CDstatus status;
   1.374      u_char cdb[10], buf[16];
   1.375      int sts;
   1.376      struct scsi_user_cdb sus;
   1.377  
   1.378 -    bzero (cdb, sizeof (cdb));
   1.379 +    bzero(cdb, sizeof(cdb));
   1.380      cdb[0] = 0x42;              /* read subq */
   1.381      cdb[1] = 0x2;               /* MSF */
   1.382      cdb[2] = 0x40;              /* q channel */
   1.383      cdb[3] = 1;                 /* current pos */
   1.384 -    cdb[7] = sizeof (buf) >> 8;
   1.385 -    cdb[8] = sizeof (buf) & 0xff;
   1.386 -    sts = scsi_cmd (cdrom->id, (cdb_t *) cdb, 10, SUC_READ, buf, sizeof (buf),
   1.387 -                    &sus);
   1.388 +    cdb[7] = sizeof(buf) >> 8;
   1.389 +    cdb[8] = sizeof(buf) & 0xff;
   1.390 +    sts = scsi_cmd(cdrom->id, (cdb_t *) cdb, 10, SUC_READ, buf, sizeof(buf),
   1.391 +                   &sus);
   1.392      if (sts < 0)
   1.393          return (-1);
   1.394      if (sts) {
   1.395 -        if (TestForMedium (cdrom->id) == 0)
   1.396 +        if (TestForMedium(cdrom->id) == 0)
   1.397              status = CD_TRAYEMPTY;
   1.398          else
   1.399              status = CD_ERROR;
   1.400 @@ -446,7 +445,7 @@
   1.401      }
   1.402      if (position) {
   1.403          if (status == CD_PLAYING || (status == CD_PAUSED))
   1.404 -            *position = msf_to_frame (buf[9], buf[10], buf[11]);
   1.405 +            *position = msf_to_frame(buf[9], buf[10], buf[11]);
   1.406          else
   1.407              *position = 0;
   1.408      }
   1.409 @@ -455,94 +454,94 @@
   1.410  
   1.411  /* Start play */
   1.412  static int
   1.413 -SDL_SYS_CDPlay (SDL_CD * cdrom, int start, int length)
   1.414 +SDL_SYS_CDPlay(SDL_CD * cdrom, int start, int length)
   1.415  {
   1.416      u_char cdb[10];
   1.417      int sts, minute, second, frame, eminute, esecond, eframe;
   1.418      struct scsi_user_cdb sus;
   1.419  
   1.420 -    bzero (cdb, sizeof (cdb));
   1.421 +    bzero(cdb, sizeof(cdb));
   1.422      cdb[0] = 0x47;              /* Play */
   1.423 -    frame_to_msf (start, &minute, &second, &frame);
   1.424 -    frame_to_msf (start + length, &eminute, &esecond, &eframe);
   1.425 +    frame_to_msf(start, &minute, &second, &frame);
   1.426 +    frame_to_msf(start + length, &eminute, &esecond, &eframe);
   1.427      cdb[3] = minute;
   1.428      cdb[4] = second;
   1.429      cdb[5] = frame;
   1.430      cdb[6] = eminute;
   1.431      cdb[7] = esecond;
   1.432      cdb[8] = eframe;
   1.433 -    sts = scsi_cmd (cdrom->id, (cdb_t *) cdb, 10, SUC_READ, 0, 0, &sus);
   1.434 +    sts = scsi_cmd(cdrom->id, (cdb_t *) cdb, 10, SUC_READ, 0, 0, &sus);
   1.435      return (sts);
   1.436  }
   1.437  
   1.438  static int
   1.439 -pauseresume (SDL_CD * cdrom, int flag)
   1.440 +pauseresume(SDL_CD * cdrom, int flag)
   1.441  {
   1.442      u_char cdb[10];
   1.443      struct scsi_user_cdb sus;
   1.444  
   1.445 -    bzero (cdb, sizeof (cdb));
   1.446 +    bzero(cdb, sizeof(cdb));
   1.447      cdb[0] = 0x4b;
   1.448      cdb[8] = flag & 0x1;
   1.449 -    return (scsi_cmd (cdrom->id, (cdb_t *) cdb, 10, SUC_READ, 0, 0, &sus));
   1.450 +    return (scsi_cmd(cdrom->id, (cdb_t *) cdb, 10, SUC_READ, 0, 0, &sus));
   1.451  }
   1.452  
   1.453  /* Pause play */
   1.454  static int
   1.455 -SDL_SYS_CDPause (SDL_CD * cdrom)
   1.456 +SDL_SYS_CDPause(SDL_CD * cdrom)
   1.457  {
   1.458 -    return (pauseresume (cdrom, 0));
   1.459 +    return (pauseresume(cdrom, 0));
   1.460  }
   1.461  
   1.462  /* Resume play */
   1.463  static int
   1.464 -SDL_SYS_CDResume (SDL_CD * cdrom)
   1.465 +SDL_SYS_CDResume(SDL_CD * cdrom)
   1.466  {
   1.467 -    return (pauseresume (cdrom, 1));
   1.468 +    return (pauseresume(cdrom, 1));
   1.469  }
   1.470  
   1.471  /* Stop play */
   1.472  static int
   1.473 -SDL_SYS_CDStop (SDL_CD * cdrom)
   1.474 +SDL_SYS_CDStop(SDL_CD * cdrom)
   1.475  {
   1.476      u_char cdb[6];
   1.477      struct scsi_user_cdb sus;
   1.478  
   1.479 -    bzero (cdb, sizeof (cdb));
   1.480 +    bzero(cdb, sizeof(cdb));
   1.481      cdb[0] = 0x1b;              /* stop */
   1.482      cdb[1] = 1;                 /* immediate */
   1.483 -    return (scsi_cmd (cdrom->id, (cdb_t *) cdb, 6, SUC_READ, 0, 0, &sus));
   1.484 +    return (scsi_cmd(cdrom->id, (cdb_t *) cdb, 6, SUC_READ, 0, 0, &sus));
   1.485  }
   1.486  
   1.487  /* Eject the CD-ROM */
   1.488  static int
   1.489 -SDL_SYS_CDEject (SDL_CD * cdrom)
   1.490 +SDL_SYS_CDEject(SDL_CD * cdrom)
   1.491  {
   1.492      u_char cdb[6];
   1.493      struct scsi_user_cdb sus;
   1.494  
   1.495 -    bzero (cdb, sizeof (cdb));
   1.496 +    bzero(cdb, sizeof(cdb));
   1.497      cdb[0] = 0x1b;              /* stop */
   1.498      cdb[1] = 1;                 /* immediate */
   1.499      cdb[4] = 2;                 /* eject */
   1.500 -    return (scsi_cmd (cdrom->id, (cdb_t *) cdb, 6, SUC_READ, 0, 0, &sus));
   1.501 +    return (scsi_cmd(cdrom->id, (cdb_t *) cdb, 6, SUC_READ, 0, 0, &sus));
   1.502  }
   1.503  
   1.504  /* Close the CD-ROM handle */
   1.505  static void
   1.506 -SDL_SYS_CDClose (SDL_CD * cdrom)
   1.507 +SDL_SYS_CDClose(SDL_CD * cdrom)
   1.508  {
   1.509 -    close (cdrom->id);
   1.510 +    close(cdrom->id);
   1.511  }
   1.512  
   1.513  void
   1.514 -SDL_SYS_CDQuit (void)
   1.515 +SDL_SYS_CDQuit(void)
   1.516  {
   1.517      int i;
   1.518  
   1.519      if (SDL_numcds > 0) {
   1.520          for (i = 0; i < SDL_numcds; ++i) {
   1.521 -            SDL_free (SDL_cdlist[i]);
   1.522 +            SDL_free(SDL_cdlist[i]);
   1.523          }
   1.524      }
   1.525      SDL_numcds = 0;