FreeBSD Bugzilla – Attachment 10590 Details for
Bug 21178
voltag selector, and unload support for chio(1).
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
chio.diffs.20000915
chio.diffs.20000915 (text/plain; charset=us-ascii), 13.61 KB, created by
ken
on 2000-09-15 07:58:23 UTC
(
hide
)
Description:
chio.diffs.20000915
Filename:
MIME Type:
Creator:
ken
Created:
2000-09-15 07:58:23 UTC
Size:
13.61 KB
patch
obsolete
>==== //depot/FreeBSD-ken/src/bin/chio/chio.1#1 - /a/ken/perforce/FreeBSD-ken/src/bin/chio/chio.1 ==== >*** /tmp/tmp.83992.0 Fri Sep 15 00:55:41 2000 >--- /a/ken/perforce/FreeBSD-ken/src/bin/chio/chio.1 Thu Sep 14 21:04:10 2000 >*************** >*** 69,88 **** > .Pp > A medium changer apparatus is made up of > .Em elements . >! There are four element types: > .Em picker > (medium transport), > .Em slot > (storage), > .Em portal >! (import/export), and > .Em drive >! (data transfer). In this command description, the shorthand > .Em ET > will be used to represent an element type, and > .Em EU >! will be used to represent an element unit. For example, to represent >! the first robotic arm in the changer, the > .Em ET > would be > .Dq picker >--- 69,95 ---- > .Pp > A medium changer apparatus is made up of > .Em elements . >! There are five element types: > .Em picker > (medium transport), > .Em slot > (storage), > .Em portal >! (import/export), > .Em drive >! (data transfer), and >! .Em voltag >! (select by volume identifier). The >! .Em voltag >! pseudo-element type allows the selection of tapes by their volume tag >! (typically a barcode on the tape). >! .Pp >! In this command description, the shorthand > .Em ET > will be used to represent an element type, and > .Em EU >! will be used to represent an element unit. >! For example, to represent the first robotic arm in the changer, the > .Em ET > would be > .Dq picker >*************** >*** 137,142 **** >--- 144,158 ---- > .Ic exchange > operation; the changer must have multiple free pickers or emulate > multiple free pickers with transient storage. >+ .It Xo Nm return >+ .Ar <from ET> <from EU> >+ .Xc >+ Return the media unit to its source element. >+ This command will query the status of the specified media unit, and >+ will move it to the element specified in its source attribute. >+ This is a convenient way to return media from a drive or portal >+ to its previous element in the changer. >+ .Pp > .It Xo Nm position > .Ar <to ET> <to EU> > .Op Ar inv >*************** >*** 246,251 **** >--- 262,272 ---- > .Bl -tag -width indent > .It Nm chio move slot 3 drive 0 > Move the media in slot 3 (fourth slot) to drive 0 (first drive). >+ .It Nm chio move voltag VOLUME01 drive 0 >+ Move the media with the barcode VOLUME01 to drive 0 (first drive). >+ .It Nm chio return drive 0 >+ Remove the tape from drive 0 (first drive) and return it to its original >+ location in the rack. > .It Nm chio setpicker 2 > Configure the changer to use picker 2 (third picker) for operations. > .El >*************** >*** 265,268 **** > for And Communications, http://www.and.com/. > .br > Additional work by >! .An Hans Huebner Aq hans@artcom.de >--- 286,292 ---- > for And Communications, http://www.and.com/. > .br > Additional work by >! .An Hans Huebner >! .Aq hans@artcom.de >! and Steve Gunn >! .Aq csg@waterspout.com >==== //depot/FreeBSD-ken/src/bin/chio/chio.c#1 - /a/ken/perforce/FreeBSD-ken/src/bin/chio/chio.c ==== >*** /tmp/tmp.83992.1 Fri Sep 15 00:55:41 2000 >--- /a/ken/perforce/FreeBSD-ken/src/bin/chio/chio.c Fri Sep 15 00:49:25 2000 >*************** >*** 32,37 **** >--- 32,38 ---- > */ > /* > * Additional Copyright (c) 1997, by Matthew Jacob, for NASA/Ames Research Ctr. >+ * Addidional Copyright (c) 2000, by C. Stephen Gunn, Waterspout Communications > */ > > #ifndef lint >*************** >*** 65,70 **** >--- 66,74 ---- > static int is_special __P((char *)); > static const char *bits_to_string __P((int, const char *)); > >+ static void find_element __P((char *, u_int16_t *, u_int16_t *)); >+ static struct changer_element_status *get_element_status __P((u_int16_t, u_int16_t)); >+ > static int do_move __P((char *, int, char **)); > static int do_exchange __P((char *, int, char **)); > static int do_position __P((char *, int, char **)); >*************** >*** 73,86 **** >--- 77,96 ---- > static int do_setpicker __P((char *, int, char **)); > static int do_status __P((char *, int, char **)); > static int do_ielem __P((char *, int, char **)); >+ static int do_return __P((char *, int, char **)); > static int do_voltag __P((char *, int, char **)); > >+ #ifndef CHET_VT >+ #define CHET_VT 10 /* Completely Arbitrary */ >+ #endif >+ > /* Valid changer element types. */ > const struct element_type elements[] = { > { "drive", CHET_DT }, > { "picker", CHET_MT }, > { "portal", CHET_IE }, > { "slot", CHET_ST }, >+ { "voltag", CHET_VT }, /* Select tapes by barcode */ > { NULL, 0 }, > }; > >*************** >*** 94,99 **** >--- 104,110 ---- > { "position", do_position }, > { "setpicker", do_setpicker }, > { "status", do_status }, >+ { "return", do_return }, > { "voltag", do_voltag }, > { NULL, 0 }, > }; >*************** >*** 196,209 **** > cmd.cm_fromtype = parse_element_type(*argv); > ++argv; --argc; > >! /* <from EU> */ >! cmd.cm_fromunit = parse_element_unit(*argv); > ++argv; --argc; > > /* <to ET> */ > cmd.cm_totype = parse_element_type(*argv); > ++argv; --argc; > > /* <to EU> */ > cmd.cm_tounit = parse_element_unit(*argv); > ++argv; --argc; >--- 207,230 ---- > cmd.cm_fromtype = parse_element_type(*argv); > ++argv; --argc; > >! /* Check for voltag virtual type */ >! if (CHET_VT == cmd.cm_fromtype) { >! find_element(*argv, &cmd.cm_fromtype, &cmd.cm_fromunit); >! } else { >! /* <from EU> */ >! cmd.cm_fromunit = parse_element_unit(*argv); >! } > ++argv; --argc; > > /* <to ET> */ > cmd.cm_totype = parse_element_type(*argv); > ++argv; --argc; > >+ /* Check for voltag virtual type, and report error */ >+ if (CHET_VT == cmd.cm_totype) >+ errx(1,"%s: voltag only makes sense as an element source", >+ cname); >+ > /* <to EU> */ > cmd.cm_tounit = parse_element_unit(*argv); > ++argv; --argc; >*************** >*** 267,282 **** > cmd.ce_srctype = parse_element_type(*argv); > ++argv; --argc; > >! /* <src EU> */ >! cmd.ce_srcunit = parse_element_unit(*argv); > ++argv; --argc; > > /* <dst1 ET> */ > cmd.ce_fdsttype = parse_element_type(*argv); > ++argv; --argc; > >! /* <dst1 EU> */ >! cmd.ce_fdstunit = parse_element_unit(*argv); > ++argv; --argc; > > /* >--- 288,313 ---- > cmd.ce_srctype = parse_element_type(*argv); > ++argv; --argc; > >! /* Check for voltag virtual type */ >! if (CHET_VT == cmd.ce_srctype) { >! find_element(*argv, &cmd.ce_srctype, &cmd.ce_srcunit); >! } else { >! /* <from EU> */ >! cmd.ce_srcunit = parse_element_unit(*argv); >! } > ++argv; --argc; > > /* <dst1 ET> */ > cmd.ce_fdsttype = parse_element_type(*argv); > ++argv; --argc; > >! /* Check for voltag virtual type */ >! if (CHET_VT == cmd.ce_fdsttype) { >! find_element(*argv, &cmd.ce_fdsttype, &cmd.ce_fdstunit); >! } else { >! /* <from EU> */ >! cmd.ce_fdstunit = parse_element_unit(*argv); >! } > ++argv; --argc; > > /* >*************** >*** 294,299 **** >--- 325,334 ---- > cmd.ce_sdsttype = parse_element_type(*argv); > ++argv; --argc; > >+ if (CHET_VT == cmd.ce_sdsttype) >+ errx(1,"%s %s: voltag only makes sense as an element source", >+ cname, *argv); >+ > /* <dst2 EU> */ > cmd.ce_sdstunit = parse_element_unit(*argv); > ++argv; --argc; >*************** >*** 653,661 **** > cesr.cesr_element_base = base; > cesr.cesr_element_count = count; > /* Allocate storage for the status structures. */ >! cesr.cesr_element_status >! = (struct changer_element_status *) >! malloc(count * sizeof(struct changer_element_status)); > > if (!cesr.cesr_element_status) > errx(1, "can't allocate status storage"); >--- 688,696 ---- > cesr.cesr_element_base = base; > cesr.cesr_element_count = count; > /* Allocate storage for the status structures. */ >! cesr.cesr_element_status = >! (struct changer_element_status *) >! calloc(count, sizeof(struct changer_element_status)); > > if (!cesr.cesr_element_status) > errx(1, "can't allocate status storage"); >*************** >*** 934,939 **** >--- 969,1204 ---- > *bp = '>'; > > return (buf); >+ } >+ /* >+ * do_return() >+ * >+ * Given an element reference, ask the changer/picker to move that >+ * element back to its source slot. >+ */ >+ static int >+ do_return(cname, argc, argv) >+ char *cname; >+ int argc; >+ char **argv; >+ { >+ struct changer_element_status *ces; >+ struct changer_move cmd; >+ u_int16_t type, element; >+ >+ ++argv; --argc; >+ >+ if (argc < 2) { >+ warnx("%s: too few arguments", cname); >+ goto usage; >+ } else if (argc > 3) { >+ warnx("%s: too many arguments", cname); >+ goto usage; >+ } >+ >+ type = parse_element_type(*argv); >+ ++argv; --argc; >+ >+ /* Handle voltag virtual Changer Element Type */ >+ if (CHET_VT == type) { >+ find_element(*argv, &type, &element); >+ } else { >+ element = parse_element_unit(*argv); >+ } >+ ++argv; --argc; >+ >+ ces = get_element_status(type, element); /* Get the status */ >+ >+ if (NULL == ces) >+ errx(1, "%s: null element status pointer", cname); >+ >+ if (!(ces->ces_flags & CES_SOURCE_VALID)) >+ errx(1, "%s: no source information", cname); >+ >+ (void) memset(&cmd, 0, sizeof(cmd)); >+ >+ cmd.cm_fromtype = type; >+ cmd.cm_fromunit = element; >+ cmd.cm_totype = ces->ces_source_type; >+ cmd.cm_tounit = ces->ces_source_addr; >+ >+ if (ioctl(changer_fd, CHIOMOVE, &cmd) == -1) >+ err(1, "%s: CHIOMOVE", changer_name); >+ free(ces); >+ >+ return(0); >+ >+ usage: >+ (void) fprintf(stderr, "usage: %s %s " >+ "<from ET> <from EU>\n", __progname, cname); >+ return(1); >+ } >+ >+ /* >+ * get_element_status() >+ * >+ * return a *cesr for the specified changer element. This >+ * routing will malloc()/calloc() the memory. The caller >+ * should free() it when done. >+ */ >+ static struct changer_element_status * >+ get_element_status(type, element) >+ u_int16_t type; >+ u_int16_t element; >+ { >+ struct changer_element_status_request cesr; >+ struct changer_element_status *ces; >+ >+ ces = (struct changer_element_status *) >+ calloc(1, sizeof(struct changer_element_status)); >+ >+ if (NULL == ces) >+ errx(1, "can't allocate status storage"); >+ >+ (void)memset(&cesr, 0, sizeof(cesr)); >+ >+ cesr.cesr_element_type = type; >+ cesr.cesr_element_base = element; >+ cesr.cesr_element_count = 1; /* Only this one element */ >+ cesr.cesr_flags |= CESR_VOLTAGS; /* Grab voltags as well */ >+ cesr.cesr_element_status = ces; >+ >+ if (ioctl(changer_fd, CHIOGSTATUS, (char *)&cesr) == -1) { >+ free(ces); >+ err(1, "%s: CHIOGSTATUS", changer_name); >+ /* NOTREACHED */ >+ } >+ >+ return ces; >+ } >+ >+ >+ /* >+ * find_element() >+ * >+ * Given a <voltag> find the chager element and unit, or exit >+ * with an error if it isn't found. We grab the changer status >+ * and iterate until we find a match, or crap out. >+ */ >+ static void >+ find_element(voltag, et, eu) >+ char *voltag; >+ u_int16_t *et; >+ u_int16_t *eu; >+ { >+ struct changer_params cp; >+ struct changer_element_status_request cesr; >+ struct changer_element_status *ch_ces, *ces; >+ int elem, total_elem, found = 0; >+ >+ /* >+ * Get the changer parameters, we're interested in the counts >+ * for all types of elements to perform our search. >+ */ >+ if (ioctl(changer_fd, CHIOGPARAMS, (char *)&cp)) >+ err(1, "%s: CHIOGPARAMS", changer_name); >+ >+ /* Allocate some memory for the results */ >+ total_elem = (cp.cp_nslots + cp.cp_ndrives >+ + cp.cp_npickers + cp.cp_nportals); >+ >+ ch_ces = (struct changer_element_status *) >+ calloc(total_elem, sizeof(struct changer_element_status)); >+ >+ if (NULL == ch_ces) >+ errx(1, "can't allocate status storage"); >+ >+ ces = ch_ces; >+ >+ /* Read in the changer slots */ >+ if (cp.cp_nslots > 0) { >+ cesr.cesr_element_type = CHET_ST; >+ cesr.cesr_element_base = 0; >+ cesr.cesr_element_count = cp.cp_nslots; >+ cesr.cesr_flags |= CESR_VOLTAGS; >+ cesr.cesr_element_status = ces; >+ >+ if (ioctl(changer_fd, CHIOGSTATUS, (char *)&cesr) == -1) { >+ free(ch_ces); >+ err(1, "%s: CHIOGSTATUS", changer_name); >+ } >+ ces += cp.cp_nslots; >+ } >+ >+ /* Read in the drive information */ >+ if (cp.cp_ndrives > 0 ) { >+ >+ (void) memset(&cesr, 0, sizeof(cesr)); >+ cesr.cesr_element_type = CHET_DT; >+ cesr.cesr_element_base = 0; >+ cesr.cesr_element_count = cp.cp_ndrives; >+ cesr.cesr_flags |= CESR_VOLTAGS; >+ cesr.cesr_element_status = ces; >+ >+ if (ioctl(changer_fd, CHIOGSTATUS, (char *)&cesr) == -1) { >+ free(ch_ces); >+ err(1, "%s: CHIOGSTATUS", changer_name); >+ } >+ ces += cp.cp_ndrives; >+ } >+ >+ /* Read in the portal information */ >+ if (cp.cp_nportals > 0 ) { >+ (void) memset(&cesr, 0, sizeof(cesr)); >+ cesr.cesr_element_type = CHET_IE; >+ cesr.cesr_element_base = 0; >+ cesr.cesr_element_count = cp.cp_nportals; >+ cesr.cesr_flags |= CESR_VOLTAGS; >+ cesr.cesr_element_status = ces; >+ >+ if (ioctl(changer_fd, CHIOGSTATUS, (char *)&cesr) == -1) { >+ free(ch_ces); >+ err(1, "%s: CHIOGSTATUS", changer_name); >+ } >+ ces += cp.cp_nportals; >+ } >+ >+ /* Read in the picker information */ >+ if (cp.cp_npickers > 0) { >+ (void) memset(&cesr, 0, sizeof(cesr)); >+ cesr.cesr_element_type = CHET_MT; >+ cesr.cesr_element_base = 0; >+ cesr.cesr_element_count = cp.cp_npickers; >+ cesr.cesr_flags |= CESR_VOLTAGS; >+ cesr.cesr_element_status = ces; >+ >+ if (ioctl(changer_fd, CHIOGSTATUS, (char *)&cesr) == -1) { >+ free(ch_ces); >+ err(1, "%s: CHIOGSTATUS", changer_name); >+ } >+ } >+ >+ /* >+ * Now search the list the specified <voltag> >+ */ >+ for (elem = 0; elem <= total_elem; ++elem) { >+ >+ ces = &ch_ces[elem]; >+ >+ /* Make sure we have a tape in this element */ >+ if ((ces->ces_flags & (CES_STATUS_ACCESS|CES_STATUS_FULL)) >+ != (CES_STATUS_ACCESS|CES_STATUS_FULL)) >+ continue; >+ >+ /* Check to see if it is our target */ >+ if (strcasecmp(voltag, ces->ces_pvoltag.cv_volid) == 0) { >+ *et = ces->ces_type; >+ *eu = ces->ces_addr; >+ ++found; >+ break; >+ } >+ } >+ if (!found) { >+ errx(1, "%s: unable to locate voltag: %s", changer_name, >+ voltag); >+ } >+ free(ch_ces); >+ return; > } > > static void
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 21178
: 10590