~ubuntu-branches/ubuntu/intrepid/sg3-utils/intrepid

« back to all changes in this revision

Viewing changes to examples/sg_excl.c

  • Committer: Bazaar Package Importer
  • Author(s): Luk Claes
  • Date: 2006-11-05 17:23:29 UTC
  • mfrom: (1.1.4 upstream) (3.1.2 edgy)
  • Revision ID: james.westby@ubuntu.com-20061105172329-l4loha00sk36qz6k
* Non-maintainer upload.
* Fix FTBFS due to old syscall usage (Closes: #395512).

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
#include <sys/ioctl.h>
8
8
#include <sys/types.h>
9
9
#include <sys/stat.h>
10
 
#include "sg_include.h"
11
 
#include "sg_err.h"
 
10
#include "sg_lib.h"
 
11
#include "sg_io_linux.h"
12
12
 
13
13
/* This is a simple program that tests the O_EXCL flag in sg while
14
14
   executing a SCSI INQUIRY command and a
91
91
#if 0
92
92
    if ((sg_fd2 = open(file_name, O_RDWR | O_EXCL)) < 0) {
93
93
        snprintf(ebuff, EBUFF_SZ,
94
 
                 ME "error opening file: %s a second time", file_name);
 
94
                 ME "error opening file: %s a second time", file_name);
95
95
        perror(ebuff);
96
96
        return 1;
97
97
    } else {
98
 
        printf(ME "second open of %s in violation of O_EXCL\n", file_name);
99
 
        close(sg_fd2);
 
98
        printf(ME "second open of %s in violation of O_EXCL\n", file_name);
 
99
        close(sg_fd2);
100
100
    }
101
101
#endif
102
102
 
125
125
    /* now for the error processing */
126
126
    ok = 0;
127
127
    switch (sg_err_category3(&io_hdr)) {
128
 
    case SG_ERR_CAT_CLEAN:
 
128
    case SG_LIB_CAT_CLEAN:
129
129
        ok = 1;
130
130
        break;
131
 
    case SG_ERR_CAT_RECOVERED:
 
131
    case SG_LIB_CAT_RECOVERED:
132
132
        printf("Recovered error on INQUIRY, continuing\n");
133
133
        ok = 1;
134
134
        break;
135
135
    default: /* won't bother decoding other categories */
136
 
        sg_chk_n_print3("INQUIRY command error", &io_hdr);
 
136
        sg_chk_n_print3("INQUIRY command error", &io_hdr, 1);
137
137
        break;
138
138
    }
139
139
 
170
170
    /* now for the error processing */
171
171
    ok = 0;
172
172
    switch (sg_err_category3(&io_hdr)) {
173
 
    case SG_ERR_CAT_CLEAN:
 
173
    case SG_LIB_CAT_CLEAN:
174
174
        ok = 1;
175
175
        break;
176
 
    case SG_ERR_CAT_RECOVERED:
 
176
    case SG_LIB_CAT_RECOVERED:
177
177
        printf("Recovered error on Test Unit Ready, continuing\n");
178
178
        ok = 1;
179
179
        break;
180
180
    default: /* won't bother decoding other categories */
181
 
        sg_chk_n_print3("Test Unit Ready command error", &io_hdr);
 
181
        sg_chk_n_print3("Test Unit Ready command error", &io_hdr, 1);
182
182
        break;
183
183
    }
184
184