Lines Matching refs:device
51 extern char *devattr(char *device, char *attribute);
54 extern int getvol(char *device, char *label, int options, char *prompt);
61 /* device types */
75 #define G_FILE 28 /* file, not a device */
76 #define G_NO_DEV 29 /* device does not require special treatment */
77 #define G_DEV_MAX 30 /* last valid device type */
95 int ds_next(char *device, char *instdir);
96 int ds_ginit(char *device);
100 static int ds_realfd = -1; /* file descriptor for real device */
111 static int ds_getnextvol(char *device);
112 static int ds_skip(char *device, int nskip);
183 ds_readbuf(char *device)
189 if ((ds_fd = open(device, O_RDONLY)) >= 0 &&
201 if (ds_ginit(device) < 0) {
203 logerr(pkg_gt(MSG_OPEN), device, errno);
289 * Read the source device. Acquire the header data and check it for validity.
292 ds_init(char *device, char **pkg, char *norewind)
304 /* always start with rewind device */
305 if ((ds_fd = open(device, O_RDONLY)) < 0) {
307 logerr(pkg_gt(MSG_OPEN), device, errno);
318 /* initialize the device */
319 if (ds_ginit(device) < 0) {
322 logerr(pkg_gt(MSG_OPEN), device, errno);
326 /* read a logical block from the source device */
342 /* only ten tries iff the device rewinds */
355 /* then close the device */
361 logerr(pkg_gt(MSG_OPEN), device, errno);
366 /* initialize the device */
367 if (ds_ginit(device) < 0) {
370 logerr(pkg_gt(MSG_OPEN), device, errno);
400 /* read a logical block from the source device */
413 * remember rewind device for ds_close to rewind at
417 ds_device = device;
519 ds_findpkg(char *device, char *pkg)
527 if (ds_init(device, pkglist, NULL))
562 if (ds_volpart > 0 && ds_getnextvol(device))
565 if (ds_skip(device, ods_volpart))
568 if (ds_skip(device, nskip - ds_totread))
583 ds_getpkg(char *device, int n, char *dstdir)
611 return (ds_next(device, dstdir));
615 ds_getnextvol(char *device)
625 if (n = getvol(device, NULL, NULL, prompt))
627 if ((ds_fd = open(device, O_RDONLY)) < 0)
629 if (ds_ginit(device) < 0) {
642 ds_skip(char *device, int nskip)
658 if (n = ds_getnextvol(device))
670 ds_skiptoend(char *device)
673 (void) ds_skip(device, ds_nparts - ds_read);
677 ds_next(char *device, char *instdir)
686 if (n = ds_getnextvol(device))
707 if (n = ds_getnextvol(device))
726 * device - Description of device being dumped into,
734 BIO_ds_dump(PKG_ERR *err, char *device, BIO *bio)
740 * note this will read to the end of the device, so it won't
746 pkgerr_add(err, PKGERR_WRITE, ERR_WRITE, device,
788 * ds_ginit: Determine the device being accessed, set the buffer size,
789 * and perform any device specific initialization.
793 ds_ginit(char *device)
799 if ((pbufsize = devattr(device, "bufsize")) != NULL) {
858 /* rewind device */