static void attach_and_detach_ns(int attachment_op) { int ns_id; struct dev *ctrlr; ctrlr = get_controller(); if (ctrlr == NULL) { printf("Invalid controller PCI Address.\n"); return; } if (!ctrlr->cdata->oacs.ns_manage) { printf("Controller does not support ns management\n"); return; } printf("Please Input Namespace ID: \n"); if (!scanf("%d", &ns_id)) { printf("Invalid Namespace ID\n"); while (getchar() != '\n'); return; } ns_attach(ctrlr, attachment_op, ctrlr->cdata->cntlid, ns_id); }
int cdli_ns8390init() { struct ndd *nddp; struct ns_8022 *filter; struct ns_user *ns_user; int ret; printf("%s initializing pseudo-CDLI ns8390 driver\n", ns8390wdname); if (!(nddp = (struct ndd *)kalloc(sizeof(struct ndd)))) { return(ENOMEM); } bzero((char *)nddp, sizeof(*nddp)); nddp->ndd_name = ns8390wdname; nddp->ndd_unit = 0; nddp->ndd_type = NDD_ISO88023; nddp->d_ops = cdli_ns8390_dops; nddp->ndd_open = cdli_ns8390_open; nddp->ndd_close = cdli_ns8390_close; nddp->ndd_output = cdli_ns8390_output; nddp->ndd_ctl = cdli_ns8390_ctl; (void) dmx_init(nddp); if (ret = ns_attach(nddp)) /* Add network device driver */ { goto bad; } if (!(filter = (struct ns_8022 *)kalloc(sizeof(*filter)))) { return(ENOMEM); } bzero((char *)filter, sizeof(*filter)); filter->filtertype = NS_STATUS_MASK; filter->dsap = 0x0; filter->orgcode[0] = '\0'; filter->orgcode[1] = '\0'; filter->orgcode[2] = '\0'; filter->ethertype = NS_ETHERTYPE; eth_add_demuxer(nddp->ndd_type); if (!(ns_user = (struct ns_user *)kalloc(sizeof(struct ns_user)))) { return(ENOMEM); } bzero((char *)ns_user, sizeof(struct ns_user)); ns_user->isr = 0; if (ret = dmx_8022_add_filter(nddp, filter, ns_user)) /* Add demuxing filter */ { goto bad; } ret = ns_alloc(nddp->ndd_name, &nddp); bad: return(ret); }