Home | History | Annotate | Download | only in sg_write_buffer

Lines Matching refs:dev_fd

190  * true if dev_fd is a scsi generic pass-through device. If yields
191 * *is_nvme_p = true with *nsid_p = 0 then dev_fd is a NVMe char device.
192 * If yields *nsid_p > 0 then dev_fd is a NVMe block device. */
194 check_file_type(int dev_fd, struct stat * dev_statp, bool * is_bsg_p,
206 if (dev_fd >= 0) {
207 if (fstat(dev_fd, dev_statp) < 0) {
226 nsid = ioctl(dev_fd, NVME_IOCTL_ID, NULL);
240 pr2ws("%s: invalid file descriptor (%d)\n", __func__, dev_fd);
270 /* Assumes dev_fd is an "open" file handle associated with device_name. If
271 * the implementation (possibly for one OS) cannot determine from dev_fd if
276 * NSID), or 0 if something else (e.g. ATA block device) or dev_fd < 0.
279 check_pt_file_handle(int dev_fd, const char * device_name, int verbose)
282 pr2ws("%s: dev_fd=%d, device_name: %s\n", __func__, dev_fd,
289 if (dev_fd >= 0) {
295 is_sg = check_file_type(dev_fd, &a_stat, &is_bsg, &is_nvme, &nsid,
395 construct_scsi_pt_obj_with_fd(int dev_fd, int verbose)
409 err = set_pt_file_handle((struct sg_pt_base *)ptp, dev_fd, verbose);
428 return construct_scsi_pt_obj_with_fd(-1 /* dev_fd */, 0 /* verbose */);
455 fd = ptp->dev_fd;
468 ptp->dev_fd = fd;
477 /* Forget any previous dev_fd and install the one given. May attempt to
480 * will return. dev_fd should be >= 0 for a valid file handle or -1 . */
482 set_pt_file_handle(struct sg_pt_base * vp, int dev_fd, int verbose)
491 ptp->dev_fd = dev_fd;
492 if (dev_fd >= 0)
493 ptp->is_sg = check_file_type(dev_fd, &a_stat, &ptp->is_bsg,
514 return ptp->dev_fd;
898 bool have_checked_for_type = (ptp->dev_fd >= 0);
910 if ((ptp->dev_fd >= 0) && (fd != ptp->dev_fd)) {
916 ptp->dev_fd = fd;
917 } else if (ptp->dev_fd < 0) {
922 fd = ptp->dev_fd;
924 err = set_pt_file_handle(vp, ptp->dev_fd, verbose);